@@ -130,15 +130,41 @@ export namespace ClientCompatMessage {
130
130
//========================================//
131
131
132
132
export const Empty = {
133
- writeMessage : function ( msg : Partial < Empty > , writer : BinaryWriter ) : void { } ,
134
-
133
+ /**
134
+ * Serializes a Empty to protobuf.
135
+ */
135
136
encode : function ( empty : Partial < Empty > ) : Uint8Array {
136
- const writer = new BinaryWriter ( ) ;
137
- Empty . writeMessage ( empty , writer ) ;
138
- return writer . getResultBuffer ( ) ;
137
+ return Empty . _writeMessage ( empty , new BinaryWriter ( ) ) . getResultBuffer ( ) ;
138
+ } ,
139
+
140
+ /**
141
+ * Deserializes a Empty from protobuf.
142
+ */
143
+ decode : function ( bytes : ByteSource ) : Empty {
144
+ return Empty . _readMessage ( Empty . initialize ( ) , new BinaryReader ( bytes ) ) ;
145
+ } ,
146
+
147
+ /**
148
+ * Initializes a Empty with all fields set to their default value.
149
+ */
150
+ initialize : function ( ) : Empty {
151
+ return { } ;
152
+ } ,
153
+
154
+ /**
155
+ * @private
156
+ */
157
+ _writeMessage : function (
158
+ msg : Partial < Empty > ,
159
+ writer : BinaryWriter
160
+ ) : BinaryWriter {
161
+ return writer ;
139
162
} ,
140
163
141
- readMessage : function ( msg : Partial < Empty > , reader : BinaryReader ) : void {
164
+ /**
165
+ * @private
166
+ */
167
+ _readMessage : function ( msg : Empty , reader : BinaryReader ) : Empty {
142
168
while ( reader . nextField ( ) ) {
143
169
const field = reader . getFieldNumber ( ) ;
144
170
switch ( field ) {
@@ -148,34 +174,51 @@ export const Empty = {
148
174
}
149
175
}
150
176
}
177
+ return msg ;
151
178
} ,
179
+ } ;
152
180
153
- decode : function ( bytes : ByteSource ) : Empty {
154
- const reader = new BinaryReader ( bytes ) ;
155
- const message = { } ;
156
- Empty . readMessage ( message , reader ) ;
157
- return message as Empty ;
181
+ export const Req = {
182
+ /**
183
+ * Serializes a Req to protobuf.
184
+ */
185
+ encode : function ( req : Partial < Req > ) : Uint8Array {
186
+ return Req . _writeMessage ( req , new BinaryWriter ( ) ) . getResultBuffer ( ) ;
158
187
} ,
159
188
160
- defaultValue : function ( ) : Empty {
161
- return { } ;
189
+ /**
190
+ * Deserializes a Req from protobuf.
191
+ */
192
+ decode : function ( bytes : ByteSource ) : Req {
193
+ return Req . _readMessage ( Req . initialize ( ) , new BinaryReader ( bytes ) ) ;
162
194
} ,
163
- } ;
164
195
165
- export const Req = {
166
- writeMessage : function ( msg : Partial < Req > , writer : BinaryWriter ) : void {
196
+ /**
197
+ * Initializes a Req with all fields set to their default value.
198
+ */
199
+ initialize : function ( ) : Req {
200
+ return {
201
+ v : "" ,
202
+ } ;
203
+ } ,
204
+
205
+ /**
206
+ * @private
207
+ */
208
+ _writeMessage : function (
209
+ msg : Partial < Req > ,
210
+ writer : BinaryWriter
211
+ ) : BinaryWriter {
167
212
if ( msg . v ) {
168
213
writer . writeString ( 1 , msg . v ) ;
169
214
}
215
+ return writer ;
170
216
} ,
171
217
172
- encode : function ( req : Partial < Req > ) : Uint8Array {
173
- const writer = new BinaryWriter ( ) ;
174
- Req . writeMessage ( req , writer ) ;
175
- return writer . getResultBuffer ( ) ;
176
- } ,
177
-
178
- readMessage : function ( msg : Partial < Req > , reader : BinaryReader ) : void {
218
+ /**
219
+ * @private
220
+ */
221
+ _readMessage : function ( msg : Req , reader : BinaryReader ) : Req {
179
222
while ( reader . nextField ( ) ) {
180
223
const field = reader . getFieldNumber ( ) ;
181
224
switch ( field ) {
@@ -189,39 +232,51 @@ export const Req = {
189
232
}
190
233
}
191
234
}
192
- if ( ! msg . v ) {
193
- msg . v = "" ;
194
- }
235
+ return msg ;
195
236
} ,
237
+ } ;
196
238
197
- decode : function ( bytes : ByteSource ) : Req {
198
- const reader = new BinaryReader ( bytes ) ;
199
- const message = { } ;
200
- Req . readMessage ( message , reader ) ;
201
- return message as Req ;
239
+ export const Resp = {
240
+ /**
241
+ * Serializes a Resp to protobuf.
242
+ */
243
+ encode : function ( resp : Partial < Resp > ) : Uint8Array {
244
+ return Resp . _writeMessage ( resp , new BinaryWriter ( ) ) . getResultBuffer ( ) ;
245
+ } ,
246
+
247
+ /**
248
+ * Deserializes a Resp from protobuf.
249
+ */
250
+ decode : function ( bytes : ByteSource ) : Resp {
251
+ return Resp . _readMessage ( Resp . initialize ( ) , new BinaryReader ( bytes ) ) ;
202
252
} ,
203
253
204
- defaultValue : function ( ) : Req {
254
+ /**
255
+ * Initializes a Resp with all fields set to their default value.
256
+ */
257
+ initialize : function ( ) : Resp {
205
258
return {
206
- v : "" ,
259
+ v : 0 ,
207
260
} ;
208
261
} ,
209
- } ;
210
262
211
- export const Resp = {
212
- writeMessage : function ( msg : Partial < Resp > , writer : BinaryWriter ) : void {
263
+ /**
264
+ * @private
265
+ */
266
+ _writeMessage : function (
267
+ msg : Partial < Resp > ,
268
+ writer : BinaryWriter
269
+ ) : BinaryWriter {
213
270
if ( msg . v ) {
214
271
writer . writeInt32 ( 1 , msg . v ) ;
215
272
}
273
+ return writer ;
216
274
} ,
217
275
218
- encode : function ( resp : Partial < Resp > ) : Uint8Array {
219
- const writer = new BinaryWriter ( ) ;
220
- Resp . writeMessage ( resp , writer ) ;
221
- return writer . getResultBuffer ( ) ;
222
- } ,
223
-
224
- readMessage : function ( msg : Partial < Resp > , reader : BinaryReader ) : void {
276
+ /**
277
+ * @private
278
+ */
279
+ _readMessage : function ( msg : Resp , reader : BinaryReader ) : Resp {
225
280
while ( reader . nextField ( ) ) {
226
281
const field = reader . getFieldNumber ( ) ;
227
282
switch ( field ) {
@@ -235,30 +290,51 @@ export const Resp = {
235
290
}
236
291
}
237
292
}
238
- if ( ! msg . v ) {
239
- msg . v = 0 ;
240
- }
293
+ return msg ;
241
294
} ,
295
+ } ;
242
296
243
- decode : function ( bytes : ByteSource ) : Resp {
244
- const reader = new BinaryReader ( bytes ) ;
245
- const message = { } ;
246
- Resp . readMessage ( message , reader ) ;
247
- return message as Resp ;
297
+ export const ClientCompatMessage = {
298
+ /**
299
+ * Serializes a ClientCompatMessage to protobuf.
300
+ */
301
+ encode : function (
302
+ clientCompatMessage : Partial < ClientCompatMessage >
303
+ ) : Uint8Array {
304
+ return ClientCompatMessage . _writeMessage (
305
+ clientCompatMessage ,
306
+ new BinaryWriter ( )
307
+ ) . getResultBuffer ( ) ;
248
308
} ,
249
309
250
- defaultValue : function ( ) : Resp {
310
+ /**
311
+ * Deserializes a ClientCompatMessage from protobuf.
312
+ */
313
+ decode : function ( bytes : ByteSource ) : ClientCompatMessage {
314
+ return ClientCompatMessage . _readMessage (
315
+ ClientCompatMessage . initialize ( ) ,
316
+ new BinaryReader ( bytes )
317
+ ) ;
318
+ } ,
319
+
320
+ /**
321
+ * Initializes a ClientCompatMessage with all fields set to their default value.
322
+ */
323
+ initialize : function ( ) : ClientCompatMessage {
251
324
return {
252
- v : 0 ,
325
+ service_address : "" ,
326
+ method : 0 ,
327
+ request : new Uint8Array ( ) ,
253
328
} ;
254
329
} ,
255
- } ;
256
330
257
- export const ClientCompatMessage = {
258
- writeMessage : function (
331
+ /**
332
+ * @private
333
+ */
334
+ _writeMessage : function (
259
335
msg : Partial < ClientCompatMessage > ,
260
336
writer : BinaryWriter
261
- ) : void {
337
+ ) : BinaryWriter {
262
338
if ( msg . service_address ) {
263
339
writer . writeString ( 1 , msg . service_address ) ;
264
340
}
@@ -268,20 +344,16 @@ export const ClientCompatMessage = {
268
344
if ( msg . request ) {
269
345
writer . writeBytes ( 3 , msg . request ) ;
270
346
}
347
+ return writer ;
271
348
} ,
272
349
273
- encode : function (
274
- clientCompatMessage : Partial < ClientCompatMessage >
275
- ) : Uint8Array {
276
- const writer = new BinaryWriter ( ) ;
277
- ClientCompatMessage . writeMessage ( clientCompatMessage , writer ) ;
278
- return writer . getResultBuffer ( ) ;
279
- } ,
280
-
281
- readMessage : function (
282
- msg : Partial < ClientCompatMessage > ,
350
+ /**
351
+ * @private
352
+ */
353
+ _readMessage : function (
354
+ msg : ClientCompatMessage ,
283
355
reader : BinaryReader
284
- ) : void {
356
+ ) : ClientCompatMessage {
285
357
while ( reader . nextField ( ) ) {
286
358
const field = reader . getFieldNumber ( ) ;
287
359
switch ( field ) {
@@ -304,30 +376,7 @@ export const ClientCompatMessage = {
304
376
}
305
377
}
306
378
}
307
- if ( ! msg . service_address ) {
308
- msg . service_address = "" ;
309
- }
310
- if ( ! msg . method ) {
311
- msg . method = 0 ;
312
- }
313
- if ( ! msg . request ) {
314
- msg . request = new Uint8Array ( ) ;
315
- }
316
- } ,
317
-
318
- decode : function ( bytes : ByteSource ) : ClientCompatMessage {
319
- const reader = new BinaryReader ( bytes ) ;
320
- const message = { } ;
321
- ClientCompatMessage . readMessage ( message , reader ) ;
322
- return message as ClientCompatMessage ;
323
- } ,
324
-
325
- defaultValue : function ( ) : ClientCompatMessage {
326
- return {
327
- service_address : "" ,
328
- method : 0 ,
329
- request : new Uint8Array ( ) ,
330
- } ;
379
+ return msg ;
331
380
} ,
332
381
333
382
CompatServiceMethod : { NOOP : 0 , METHOD : 1 } as const ,
0 commit comments