blob: 4ceb55a7a62825235bcfeb805d411794850750d0 [file] [log] [blame]
Adrià Vilanova Martínez413cb442021-09-06 00:30:45 +02001// source: google/protobuf/duration.proto
2/**
3 * @fileoverview
4 * @enhanceable
5 * @suppress {missingRequire} reports error on implicit type usages.
6 * @suppress {messageConventions} JS Compiler reports an error if a variable or
7 * field starts with 'MSG_' and isn't a translatable message.
8 * @public
9 */
10// GENERATED CODE -- DO NOT EDIT!
11/* eslint-disable */
12// @ts-nocheck
13
14var jspb = require('google-protobuf');
15var goog = jspb;
16var proto = {};
17
18goog.exportSymbol('google.protobuf.Duration', null, proto);
19/**
20 * Generated by JsPbCodeGenerator.
21 * @param {Array=} opt_data Optional initial data array, typically from a
22 * server response, or constructed directly in Javascript. The array is used
23 * in place and becomes part of the constructed object. It is not cloned.
24 * If no data is provided, the constructed object will be empty, but still
25 * valid.
26 * @extends {jspb.Message}
27 * @constructor
28 */
29proto.google.protobuf.Duration = function(opt_data) {
30 jspb.Message.initialize(this, opt_data, 0, -1, null, null);
31};
32goog.inherits(proto.google.protobuf.Duration, jspb.Message);
33if (goog.DEBUG && !COMPILED) {
34 /**
35 * @public
36 * @override
37 */
38 proto.google.protobuf.Duration.displayName = 'proto.google.protobuf.Duration';
39}
40
41
42
43if (jspb.Message.GENERATE_TO_OBJECT) {
44/**
45 * Creates an object representation of this proto.
46 * Field names that are reserved in JavaScript and will be renamed to pb_name.
47 * Optional fields that are not set will be set to undefined.
48 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
49 * For the list of reserved names please see:
50 * net/proto2/compiler/js/internal/generator.cc#kKeyword.
51 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
52 * JSPB instance for transitional soy proto support:
53 * http://goto/soy-param-migration
54 * @return {!Object}
55 */
56proto.google.protobuf.Duration.prototype.toObject = function(opt_includeInstance) {
57 return proto.google.protobuf.Duration.toObject(opt_includeInstance, this);
58};
59
60
61/**
62 * Static version of the {@see toObject} method.
63 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
64 * the JSPB instance for transitional soy proto support:
65 * http://goto/soy-param-migration
66 * @param {!proto.google.protobuf.Duration} msg The msg instance to transform.
67 * @return {!Object}
68 * @suppress {unusedLocalVariables} f is only used for nested messages
69 */
70proto.google.protobuf.Duration.toObject = function(includeInstance, msg) {
71 var f, obj = {
72 seconds: jspb.Message.getFieldWithDefault(msg, 1, 0),
73 nanos: jspb.Message.getFieldWithDefault(msg, 2, 0)
74 };
75
76 if (includeInstance) {
77 obj.$jspbMessageInstance = msg;
78 }
79 return obj;
80};
81}
82
83
84/**
85 * Deserializes binary data (in protobuf wire format).
86 * @param {jspb.ByteSource} bytes The bytes to deserialize.
87 * @return {!proto.google.protobuf.Duration}
88 */
89proto.google.protobuf.Duration.deserializeBinary = function(bytes) {
90 var reader = new jspb.BinaryReader(bytes);
91 var msg = new proto.google.protobuf.Duration;
92 return proto.google.protobuf.Duration.deserializeBinaryFromReader(msg, reader);
93};
94
95
96/**
97 * Deserializes binary data (in protobuf wire format) from the
98 * given reader into the given message object.
99 * @param {!proto.google.protobuf.Duration} msg The message object to deserialize into.
100 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
101 * @return {!proto.google.protobuf.Duration}
102 */
103proto.google.protobuf.Duration.deserializeBinaryFromReader = function(msg, reader) {
104 while (reader.nextField()) {
105 if (reader.isEndGroup()) {
106 break;
107 }
108 var field = reader.getFieldNumber();
109 switch (field) {
110 case 1:
111 var value = /** @type {number} */ (reader.readInt64());
112 msg.setSeconds(value);
113 break;
114 case 2:
115 var value = /** @type {number} */ (reader.readInt32());
116 msg.setNanos(value);
117 break;
118 default:
119 reader.skipField();
120 break;
121 }
122 }
123 return msg;
124};
125
126
127/**
128 * Serializes the message to binary data (in protobuf wire format).
129 * @return {!Uint8Array}
130 */
131proto.google.protobuf.Duration.prototype.serializeBinary = function() {
132 var writer = new jspb.BinaryWriter();
133 proto.google.protobuf.Duration.serializeBinaryToWriter(this, writer);
134 return writer.getResultBuffer();
135};
136
137
138/**
139 * Serializes the given message to binary data (in protobuf wire
140 * format), writing to the given BinaryWriter.
141 * @param {!proto.google.protobuf.Duration} message
142 * @param {!jspb.BinaryWriter} writer
143 * @suppress {unusedLocalVariables} f is only used for nested messages
144 */
145proto.google.protobuf.Duration.serializeBinaryToWriter = function(message, writer) {
146 var f = undefined;
147 f = message.getSeconds();
148 if (f !== 0) {
149 writer.writeInt64(
150 1,
151 f
152 );
153 }
154 f = message.getNanos();
155 if (f !== 0) {
156 writer.writeInt32(
157 2,
158 f
159 );
160 }
161};
162
163
164/**
165 * optional int64 seconds = 1;
166 * @return {number}
167 */
168proto.google.protobuf.Duration.prototype.getSeconds = function() {
169 return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
170};
171
172
173/**
174 * @param {number} value
175 * @return {!proto.google.protobuf.Duration} returns this
176 */
177proto.google.protobuf.Duration.prototype.setSeconds = function(value) {
178 return jspb.Message.setProto3IntField(this, 1, value);
179};
180
181
182/**
183 * optional int32 nanos = 2;
184 * @return {number}
185 */
186proto.google.protobuf.Duration.prototype.getNanos = function() {
187 return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
188};
189
190
191/**
192 * @param {number} value
193 * @return {!proto.google.protobuf.Duration} returns this
194 */
195proto.google.protobuf.Duration.prototype.setNanos = function(value) {
196 return jspb.Message.setProto3IntField(this, 2, value);
197};
198
199
200goog.object.extend(exports, proto);