@guardian/bridget 4.0.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Discussion.js CHANGED
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.Processor = exports.Client = exports.Recommend__Result = exports.Recommend__ResultCodec = exports.Recommend__Args = exports.Recommend__ArgsCodec = exports.methodParameters = exports.methodNames = exports.methodAnnotations = exports.annotations = exports.serviceName = void 0;
26
+ exports.Processor = exports.Client = exports.GetUserProfile__Result = exports.GetUserProfile__ResultCodec = exports.Reply__Result = exports.Reply__ResultCodec = exports.Comment__Result = exports.Comment__ResultCodec = exports.Recommend__Result = exports.Recommend__ResultCodec = exports.GetUserProfile__Args = exports.GetUserProfile__ArgsCodec = exports.Reply__Args = exports.Reply__ArgsCodec = exports.Comment__Args = exports.Comment__ArgsCodec = exports.Recommend__Args = exports.Recommend__ArgsCodec = exports.methodParameters = exports.methodNames = exports.methodAnnotations = exports.annotations = exports.serviceName = void 0;
27
27
  /* tslint:disable */
28
28
  /* eslint-disable */
29
29
  /*
@@ -31,33 +31,472 @@ exports.Processor = exports.Client = exports.Recommend__Result = exports.Recomme
31
31
  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
32
32
  */
33
33
  const thrift = __importStar(require("@creditkarma/thrift-server-core"));
34
- const DiscussionResponse = __importStar(require("./DiscussionResponse"));
34
+ const DiscussionServiceResponse = __importStar(require("./DiscussionServiceResponse"));
35
35
  exports.serviceName = "Discussion";
36
36
  exports.annotations = {};
37
37
  exports.methodAnnotations = {
38
38
  recommend: {
39
39
  annotations: {},
40
40
  fieldAnnotations: {}
41
+ },
42
+ comment: {
43
+ annotations: {},
44
+ fieldAnnotations: {}
45
+ },
46
+ reply: {
47
+ annotations: {},
48
+ fieldAnnotations: {}
49
+ },
50
+ getUserProfile: {
51
+ annotations: {},
52
+ fieldAnnotations: {}
41
53
  }
42
54
  };
43
- exports.methodNames = ["recommend"];
55
+ exports.methodNames = ["recommend", "comment", "reply", "getUserProfile"];
44
56
  exports.methodParameters = {
45
- recommend: 2
57
+ recommend: 2,
58
+ comment: 3,
59
+ reply: 4,
60
+ getUserProfile: 1
46
61
  };
47
62
  exports.Recommend__ArgsCodec = {
48
63
  encode(args, output) {
49
64
  const obj = {
50
- commentId: args.commentId
65
+ commentId: args.commentId
66
+ };
67
+ output.writeStructBegin("Recommend__Args");
68
+ if (obj.commentId != null) {
69
+ output.writeFieldBegin("commentId", thrift.TType.STRING, 1);
70
+ output.writeString(obj.commentId);
71
+ output.writeFieldEnd();
72
+ }
73
+ else {
74
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[commentId] is unset!");
75
+ }
76
+ output.writeFieldStop();
77
+ output.writeStructEnd();
78
+ return;
79
+ },
80
+ decode(input) {
81
+ let _args = {};
82
+ input.readStructBegin();
83
+ while (true) {
84
+ const ret = input.readFieldBegin();
85
+ const fieldType = ret.fieldType;
86
+ const fieldId = ret.fieldId;
87
+ if (fieldType === thrift.TType.STOP) {
88
+ break;
89
+ }
90
+ switch (fieldId) {
91
+ case 1:
92
+ if (fieldType === thrift.TType.STRING) {
93
+ const value_1 = input.readString();
94
+ _args.commentId = value_1;
95
+ }
96
+ else {
97
+ input.skip(fieldType);
98
+ }
99
+ break;
100
+ default: {
101
+ input.skip(fieldType);
102
+ }
103
+ }
104
+ input.readFieldEnd();
105
+ }
106
+ input.readStructEnd();
107
+ if (_args.commentId !== undefined) {
108
+ return {
109
+ commentId: _args.commentId
110
+ };
111
+ }
112
+ else {
113
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read Recommend__Args from input");
114
+ }
115
+ }
116
+ };
117
+ class Recommend__Args extends thrift.StructLike {
118
+ constructor(args) {
119
+ super();
120
+ this._annotations = {};
121
+ this._fieldAnnotations = {};
122
+ if (args.commentId != null) {
123
+ const value_2 = args.commentId;
124
+ this.commentId = value_2;
125
+ }
126
+ else {
127
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[commentId] is unset!");
128
+ }
129
+ }
130
+ static read(input) {
131
+ return new Recommend__Args(exports.Recommend__ArgsCodec.decode(input));
132
+ }
133
+ static write(args, output) {
134
+ return exports.Recommend__ArgsCodec.encode(args, output);
135
+ }
136
+ write(output) {
137
+ return exports.Recommend__ArgsCodec.encode(this, output);
138
+ }
139
+ }
140
+ exports.Recommend__Args = Recommend__Args;
141
+ exports.Comment__ArgsCodec = {
142
+ encode(args, output) {
143
+ const obj = {
144
+ shortUrl: args.shortUrl,
145
+ body: args.body
146
+ };
147
+ output.writeStructBegin("Comment__Args");
148
+ if (obj.shortUrl != null) {
149
+ output.writeFieldBegin("shortUrl", thrift.TType.STRING, 1);
150
+ output.writeString(obj.shortUrl);
151
+ output.writeFieldEnd();
152
+ }
153
+ else {
154
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[shortUrl] is unset!");
155
+ }
156
+ if (obj.body != null) {
157
+ output.writeFieldBegin("body", thrift.TType.STRING, 2);
158
+ output.writeString(obj.body);
159
+ output.writeFieldEnd();
160
+ }
161
+ else {
162
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[body] is unset!");
163
+ }
164
+ output.writeFieldStop();
165
+ output.writeStructEnd();
166
+ return;
167
+ },
168
+ decode(input) {
169
+ let _args = {};
170
+ input.readStructBegin();
171
+ while (true) {
172
+ const ret = input.readFieldBegin();
173
+ const fieldType = ret.fieldType;
174
+ const fieldId = ret.fieldId;
175
+ if (fieldType === thrift.TType.STOP) {
176
+ break;
177
+ }
178
+ switch (fieldId) {
179
+ case 1:
180
+ if (fieldType === thrift.TType.STRING) {
181
+ const value_3 = input.readString();
182
+ _args.shortUrl = value_3;
183
+ }
184
+ else {
185
+ input.skip(fieldType);
186
+ }
187
+ break;
188
+ case 2:
189
+ if (fieldType === thrift.TType.STRING) {
190
+ const value_4 = input.readString();
191
+ _args.body = value_4;
192
+ }
193
+ else {
194
+ input.skip(fieldType);
195
+ }
196
+ break;
197
+ default: {
198
+ input.skip(fieldType);
199
+ }
200
+ }
201
+ input.readFieldEnd();
202
+ }
203
+ input.readStructEnd();
204
+ if (_args.shortUrl !== undefined && _args.body !== undefined) {
205
+ return {
206
+ shortUrl: _args.shortUrl,
207
+ body: _args.body
208
+ };
209
+ }
210
+ else {
211
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read Comment__Args from input");
212
+ }
213
+ }
214
+ };
215
+ class Comment__Args extends thrift.StructLike {
216
+ constructor(args) {
217
+ super();
218
+ this._annotations = {};
219
+ this._fieldAnnotations = {};
220
+ if (args.shortUrl != null) {
221
+ const value_5 = args.shortUrl;
222
+ this.shortUrl = value_5;
223
+ }
224
+ else {
225
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[shortUrl] is unset!");
226
+ }
227
+ if (args.body != null) {
228
+ const value_6 = args.body;
229
+ this.body = value_6;
230
+ }
231
+ else {
232
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[body] is unset!");
233
+ }
234
+ }
235
+ static read(input) {
236
+ return new Comment__Args(exports.Comment__ArgsCodec.decode(input));
237
+ }
238
+ static write(args, output) {
239
+ return exports.Comment__ArgsCodec.encode(args, output);
240
+ }
241
+ write(output) {
242
+ return exports.Comment__ArgsCodec.encode(this, output);
243
+ }
244
+ }
245
+ exports.Comment__Args = Comment__Args;
246
+ exports.Reply__ArgsCodec = {
247
+ encode(args, output) {
248
+ const obj = {
249
+ shortUrl: args.shortUrl,
250
+ body: args.body,
251
+ parentCommentId: args.parentCommentId
252
+ };
253
+ output.writeStructBegin("Reply__Args");
254
+ if (obj.shortUrl != null) {
255
+ output.writeFieldBegin("shortUrl", thrift.TType.STRING, 1);
256
+ output.writeString(obj.shortUrl);
257
+ output.writeFieldEnd();
258
+ }
259
+ else {
260
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[shortUrl] is unset!");
261
+ }
262
+ if (obj.body != null) {
263
+ output.writeFieldBegin("body", thrift.TType.STRING, 2);
264
+ output.writeString(obj.body);
265
+ output.writeFieldEnd();
266
+ }
267
+ else {
268
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[body] is unset!");
269
+ }
270
+ if (obj.parentCommentId != null) {
271
+ output.writeFieldBegin("parentCommentId", thrift.TType.STRING, 3);
272
+ output.writeString(obj.parentCommentId);
273
+ output.writeFieldEnd();
274
+ }
275
+ else {
276
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[parentCommentId] is unset!");
277
+ }
278
+ output.writeFieldStop();
279
+ output.writeStructEnd();
280
+ return;
281
+ },
282
+ decode(input) {
283
+ let _args = {};
284
+ input.readStructBegin();
285
+ while (true) {
286
+ const ret = input.readFieldBegin();
287
+ const fieldType = ret.fieldType;
288
+ const fieldId = ret.fieldId;
289
+ if (fieldType === thrift.TType.STOP) {
290
+ break;
291
+ }
292
+ switch (fieldId) {
293
+ case 1:
294
+ if (fieldType === thrift.TType.STRING) {
295
+ const value_7 = input.readString();
296
+ _args.shortUrl = value_7;
297
+ }
298
+ else {
299
+ input.skip(fieldType);
300
+ }
301
+ break;
302
+ case 2:
303
+ if (fieldType === thrift.TType.STRING) {
304
+ const value_8 = input.readString();
305
+ _args.body = value_8;
306
+ }
307
+ else {
308
+ input.skip(fieldType);
309
+ }
310
+ break;
311
+ case 3:
312
+ if (fieldType === thrift.TType.STRING) {
313
+ const value_9 = input.readString();
314
+ _args.parentCommentId = value_9;
315
+ }
316
+ else {
317
+ input.skip(fieldType);
318
+ }
319
+ break;
320
+ default: {
321
+ input.skip(fieldType);
322
+ }
323
+ }
324
+ input.readFieldEnd();
325
+ }
326
+ input.readStructEnd();
327
+ if (_args.shortUrl !== undefined && _args.body !== undefined && _args.parentCommentId !== undefined) {
328
+ return {
329
+ shortUrl: _args.shortUrl,
330
+ body: _args.body,
331
+ parentCommentId: _args.parentCommentId
332
+ };
333
+ }
334
+ else {
335
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read Reply__Args from input");
336
+ }
337
+ }
338
+ };
339
+ class Reply__Args extends thrift.StructLike {
340
+ constructor(args) {
341
+ super();
342
+ this._annotations = {};
343
+ this._fieldAnnotations = {};
344
+ if (args.shortUrl != null) {
345
+ const value_10 = args.shortUrl;
346
+ this.shortUrl = value_10;
347
+ }
348
+ else {
349
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[shortUrl] is unset!");
350
+ }
351
+ if (args.body != null) {
352
+ const value_11 = args.body;
353
+ this.body = value_11;
354
+ }
355
+ else {
356
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[body] is unset!");
357
+ }
358
+ if (args.parentCommentId != null) {
359
+ const value_12 = args.parentCommentId;
360
+ this.parentCommentId = value_12;
361
+ }
362
+ else {
363
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[parentCommentId] is unset!");
364
+ }
365
+ }
366
+ static read(input) {
367
+ return new Reply__Args(exports.Reply__ArgsCodec.decode(input));
368
+ }
369
+ static write(args, output) {
370
+ return exports.Reply__ArgsCodec.encode(args, output);
371
+ }
372
+ write(output) {
373
+ return exports.Reply__ArgsCodec.encode(this, output);
374
+ }
375
+ }
376
+ exports.Reply__Args = Reply__Args;
377
+ exports.GetUserProfile__ArgsCodec = {
378
+ encode(args, output) {
379
+ output.writeStructBegin("GetUserProfile__Args");
380
+ output.writeFieldStop();
381
+ output.writeStructEnd();
382
+ return;
383
+ },
384
+ decode(input) {
385
+ input.readStructBegin();
386
+ while (true) {
387
+ const ret = input.readFieldBegin();
388
+ const fieldType = ret.fieldType;
389
+ const fieldId = ret.fieldId;
390
+ if (fieldType === thrift.TType.STOP) {
391
+ break;
392
+ }
393
+ switch (fieldId) {
394
+ default: {
395
+ input.skip(fieldType);
396
+ }
397
+ }
398
+ input.readFieldEnd();
399
+ }
400
+ input.readStructEnd();
401
+ return {};
402
+ }
403
+ };
404
+ class GetUserProfile__Args extends thrift.StructLike {
405
+ constructor(args = {}) {
406
+ super();
407
+ this._annotations = {};
408
+ this._fieldAnnotations = {};
409
+ }
410
+ static read(input) {
411
+ return new GetUserProfile__Args(exports.GetUserProfile__ArgsCodec.decode(input));
412
+ }
413
+ static write(args, output) {
414
+ return exports.GetUserProfile__ArgsCodec.encode(args, output);
415
+ }
416
+ write(output) {
417
+ return exports.GetUserProfile__ArgsCodec.encode(this, output);
418
+ }
419
+ }
420
+ exports.GetUserProfile__Args = GetUserProfile__Args;
421
+ exports.Recommend__ResultCodec = {
422
+ encode(args, output) {
423
+ const obj = {
424
+ success: args.success
425
+ };
426
+ output.writeStructBegin("Recommend__Result");
427
+ if (obj.success != null) {
428
+ output.writeFieldBegin("success", thrift.TType.STRUCT, 0);
429
+ DiscussionServiceResponse.DiscussionServiceResponseCodec.encode(obj.success, output);
430
+ output.writeFieldEnd();
431
+ }
432
+ output.writeFieldStop();
433
+ output.writeStructEnd();
434
+ return;
435
+ },
436
+ decode(input) {
437
+ let _args = {};
438
+ input.readStructBegin();
439
+ while (true) {
440
+ const ret = input.readFieldBegin();
441
+ const fieldType = ret.fieldType;
442
+ const fieldId = ret.fieldId;
443
+ if (fieldType === thrift.TType.STOP) {
444
+ break;
445
+ }
446
+ switch (fieldId) {
447
+ case 0:
448
+ if (fieldType === thrift.TType.STRUCT) {
449
+ const value_13 = DiscussionServiceResponse.DiscussionServiceResponseCodec.decode(input);
450
+ _args.success = value_13;
451
+ }
452
+ else {
453
+ input.skip(fieldType);
454
+ }
455
+ break;
456
+ default: {
457
+ input.skip(fieldType);
458
+ }
459
+ }
460
+ input.readFieldEnd();
461
+ }
462
+ input.readStructEnd();
463
+ return {
464
+ success: _args.success
465
+ };
466
+ }
467
+ };
468
+ class Recommend__Result extends thrift.StructLike {
469
+ constructor(args = {}) {
470
+ super();
471
+ this._annotations = {};
472
+ this._fieldAnnotations = {};
473
+ if (args.success != null) {
474
+ const value_14 = DiscussionServiceResponse.DiscussionServiceResponseCodec.create(args.success);
475
+ this.success = value_14;
476
+ }
477
+ }
478
+ static read(input) {
479
+ return new Recommend__Result(exports.Recommend__ResultCodec.decode(input));
480
+ }
481
+ static write(args, output) {
482
+ return exports.Recommend__ResultCodec.encode(args, output);
483
+ }
484
+ write(output) {
485
+ return exports.Recommend__ResultCodec.encode(this, output);
486
+ }
487
+ }
488
+ exports.Recommend__Result = Recommend__Result;
489
+ exports.Comment__ResultCodec = {
490
+ encode(args, output) {
491
+ const obj = {
492
+ success: args.success
51
493
  };
52
- output.writeStructBegin("Recommend__Args");
53
- if (obj.commentId != null) {
54
- output.writeFieldBegin("commentId", thrift.TType.STRING, 1);
55
- output.writeString(obj.commentId);
494
+ output.writeStructBegin("Comment__Result");
495
+ if (obj.success != null) {
496
+ output.writeFieldBegin("success", thrift.TType.STRUCT, 0);
497
+ DiscussionServiceResponse.DiscussionServiceResponseCodec.encode(obj.success, output);
56
498
  output.writeFieldEnd();
57
499
  }
58
- else {
59
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[commentId] is unset!");
60
- }
61
500
  output.writeFieldStop();
62
501
  output.writeStructEnd();
63
502
  return;
@@ -73,10 +512,10 @@ exports.Recommend__ArgsCodec = {
73
512
  break;
74
513
  }
75
514
  switch (fieldId) {
76
- case 1:
77
- if (fieldType === thrift.TType.STRING) {
78
- const value_1 = input.readString();
79
- _args.commentId = value_1;
515
+ case 0:
516
+ if (fieldType === thrift.TType.STRUCT) {
517
+ const value_15 = DiscussionServiceResponse.DiscussionServiceResponseCodec.decode(input);
518
+ _args.success = value_15;
80
519
  }
81
520
  else {
82
521
  input.skip(fieldType);
@@ -89,49 +528,109 @@ exports.Recommend__ArgsCodec = {
89
528
  input.readFieldEnd();
90
529
  }
91
530
  input.readStructEnd();
92
- if (_args.commentId !== undefined) {
93
- return {
94
- commentId: _args.commentId
95
- };
531
+ return {
532
+ success: _args.success
533
+ };
534
+ }
535
+ };
536
+ class Comment__Result extends thrift.StructLike {
537
+ constructor(args = {}) {
538
+ super();
539
+ this._annotations = {};
540
+ this._fieldAnnotations = {};
541
+ if (args.success != null) {
542
+ const value_16 = DiscussionServiceResponse.DiscussionServiceResponseCodec.create(args.success);
543
+ this.success = value_16;
96
544
  }
97
- else {
98
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read Recommend__Args from input");
545
+ }
546
+ static read(input) {
547
+ return new Comment__Result(exports.Comment__ResultCodec.decode(input));
548
+ }
549
+ static write(args, output) {
550
+ return exports.Comment__ResultCodec.encode(args, output);
551
+ }
552
+ write(output) {
553
+ return exports.Comment__ResultCodec.encode(this, output);
554
+ }
555
+ }
556
+ exports.Comment__Result = Comment__Result;
557
+ exports.Reply__ResultCodec = {
558
+ encode(args, output) {
559
+ const obj = {
560
+ success: args.success
561
+ };
562
+ output.writeStructBegin("Reply__Result");
563
+ if (obj.success != null) {
564
+ output.writeFieldBegin("success", thrift.TType.STRUCT, 0);
565
+ DiscussionServiceResponse.DiscussionServiceResponseCodec.encode(obj.success, output);
566
+ output.writeFieldEnd();
567
+ }
568
+ output.writeFieldStop();
569
+ output.writeStructEnd();
570
+ return;
571
+ },
572
+ decode(input) {
573
+ let _args = {};
574
+ input.readStructBegin();
575
+ while (true) {
576
+ const ret = input.readFieldBegin();
577
+ const fieldType = ret.fieldType;
578
+ const fieldId = ret.fieldId;
579
+ if (fieldType === thrift.TType.STOP) {
580
+ break;
581
+ }
582
+ switch (fieldId) {
583
+ case 0:
584
+ if (fieldType === thrift.TType.STRUCT) {
585
+ const value_17 = DiscussionServiceResponse.DiscussionServiceResponseCodec.decode(input);
586
+ _args.success = value_17;
587
+ }
588
+ else {
589
+ input.skip(fieldType);
590
+ }
591
+ break;
592
+ default: {
593
+ input.skip(fieldType);
594
+ }
595
+ }
596
+ input.readFieldEnd();
99
597
  }
598
+ input.readStructEnd();
599
+ return {
600
+ success: _args.success
601
+ };
100
602
  }
101
603
  };
102
- class Recommend__Args extends thrift.StructLike {
103
- constructor(args) {
604
+ class Reply__Result extends thrift.StructLike {
605
+ constructor(args = {}) {
104
606
  super();
105
607
  this._annotations = {};
106
608
  this._fieldAnnotations = {};
107
- if (args.commentId != null) {
108
- const value_2 = args.commentId;
109
- this.commentId = value_2;
110
- }
111
- else {
112
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[commentId] is unset!");
609
+ if (args.success != null) {
610
+ const value_18 = DiscussionServiceResponse.DiscussionServiceResponseCodec.create(args.success);
611
+ this.success = value_18;
113
612
  }
114
613
  }
115
614
  static read(input) {
116
- return new Recommend__Args(exports.Recommend__ArgsCodec.decode(input));
615
+ return new Reply__Result(exports.Reply__ResultCodec.decode(input));
117
616
  }
118
617
  static write(args, output) {
119
- return exports.Recommend__ArgsCodec.encode(args, output);
618
+ return exports.Reply__ResultCodec.encode(args, output);
120
619
  }
121
620
  write(output) {
122
- return exports.Recommend__ArgsCodec.encode(this, output);
621
+ return exports.Reply__ResultCodec.encode(this, output);
123
622
  }
124
623
  }
125
- exports.Recommend__Args = Recommend__Args;
126
- exports.Recommend__ResultCodec = {
624
+ exports.Reply__Result = Reply__Result;
625
+ exports.GetUserProfile__ResultCodec = {
127
626
  encode(args, output) {
128
627
  const obj = {
129
628
  success: args.success
130
629
  };
131
- output.writeStructBegin("Recommend__Result");
630
+ output.writeStructBegin("GetUserProfile__Result");
132
631
  if (obj.success != null) {
133
632
  output.writeFieldBegin("success", thrift.TType.STRUCT, 0);
134
- DiscussionResponse.DiscussionResponseCodec.encode(obj.success, output);
633
+ DiscussionServiceResponse.DiscussionServiceResponseCodec.encode(obj.success, output);
135
634
  output.writeFieldEnd();
136
635
  }
137
636
  output.writeFieldStop();
@@ -151,8 +650,8 @@ exports.Recommend__ResultCodec = {
151
650
  switch (fieldId) {
152
651
  case 0:
153
652
  if (fieldType === thrift.TType.STRUCT) {
154
- const value_3 = DiscussionResponse.DiscussionResponseCodec.decode(input);
155
- _args.success = value_3;
653
+ const value_19 = DiscussionServiceResponse.DiscussionServiceResponseCodec.decode(input);
654
+ _args.success = value_19;
156
655
  }
157
656
  else {
158
657
  input.skip(fieldType);
@@ -170,27 +669,27 @@ exports.Recommend__ResultCodec = {
170
669
  };
171
670
  }
172
671
  };
173
- class Recommend__Result extends thrift.StructLike {
672
+ class GetUserProfile__Result extends thrift.StructLike {
174
673
  constructor(args = {}) {
175
674
  super();
176
675
  this._annotations = {};
177
676
  this._fieldAnnotations = {};
178
677
  if (args.success != null) {
179
- const value_4 = DiscussionResponse.DiscussionResponseCodec.create(args.success);
180
- this.success = value_4;
678
+ const value_20 = DiscussionServiceResponse.DiscussionServiceResponseCodec.create(args.success);
679
+ this.success = value_20;
181
680
  }
182
681
  }
183
682
  static read(input) {
184
- return new Recommend__Result(exports.Recommend__ResultCodec.decode(input));
683
+ return new GetUserProfile__Result(exports.GetUserProfile__ResultCodec.decode(input));
185
684
  }
186
685
  static write(args, output) {
187
- return exports.Recommend__ResultCodec.encode(args, output);
686
+ return exports.GetUserProfile__ResultCodec.encode(args, output);
188
687
  }
189
688
  write(output) {
190
- return exports.Recommend__ResultCodec.encode(this, output);
689
+ return exports.GetUserProfile__ResultCodec.encode(this, output);
191
690
  }
192
691
  }
193
- exports.Recommend__Result = Recommend__Result;
692
+ exports.GetUserProfile__Result = GetUserProfile__Result;
194
693
  class Client extends thrift.ThriftClient {
195
694
  constructor() {
196
695
  super(...arguments);
@@ -238,6 +737,120 @@ class Client extends thrift.ThriftClient {
238
737
  }
239
738
  });
240
739
  }
740
+ comment(shortUrl, body, context) {
741
+ const writer = new this.transport();
742
+ const output = new this.protocol(writer);
743
+ output.writeMessageBegin("comment", thrift.MessageType.CALL, this.incrementRequestId());
744
+ const args = { shortUrl, body };
745
+ exports.Comment__ArgsCodec.encode(args, output);
746
+ output.writeMessageEnd();
747
+ return this.connection.send(writer.flush(), context).then((data) => {
748
+ const reader = this.transport.receiver(data);
749
+ const input = new this.protocol(reader);
750
+ try {
751
+ const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
752
+ if (fieldName === "comment") {
753
+ if (messageType === thrift.MessageType.EXCEPTION) {
754
+ const err = thrift.TApplicationExceptionCodec.decode(input);
755
+ input.readMessageEnd();
756
+ return Promise.reject(err);
757
+ }
758
+ else {
759
+ const result = exports.Comment__ResultCodec.decode(input);
760
+ input.readMessageEnd();
761
+ if (result.success != null) {
762
+ return Promise.resolve(result.success);
763
+ }
764
+ else {
765
+ return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "comment failed: unknown result"));
766
+ }
767
+ }
768
+ }
769
+ else {
770
+ return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName));
771
+ }
772
+ }
773
+ catch (err) {
774
+ return Promise.reject(err);
775
+ }
776
+ });
777
+ }
778
+ reply(shortUrl, body, parentCommentId, context) {
779
+ const writer = new this.transport();
780
+ const output = new this.protocol(writer);
781
+ output.writeMessageBegin("reply", thrift.MessageType.CALL, this.incrementRequestId());
782
+ const args = { shortUrl, body, parentCommentId };
783
+ exports.Reply__ArgsCodec.encode(args, output);
784
+ output.writeMessageEnd();
785
+ return this.connection.send(writer.flush(), context).then((data) => {
786
+ const reader = this.transport.receiver(data);
787
+ const input = new this.protocol(reader);
788
+ try {
789
+ const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
790
+ if (fieldName === "reply") {
791
+ if (messageType === thrift.MessageType.EXCEPTION) {
792
+ const err = thrift.TApplicationExceptionCodec.decode(input);
793
+ input.readMessageEnd();
794
+ return Promise.reject(err);
795
+ }
796
+ else {
797
+ const result = exports.Reply__ResultCodec.decode(input);
798
+ input.readMessageEnd();
799
+ if (result.success != null) {
800
+ return Promise.resolve(result.success);
801
+ }
802
+ else {
803
+ return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "reply failed: unknown result"));
804
+ }
805
+ }
806
+ }
807
+ else {
808
+ return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName));
809
+ }
810
+ }
811
+ catch (err) {
812
+ return Promise.reject(err);
813
+ }
814
+ });
815
+ }
816
+ getUserProfile(context) {
817
+ const writer = new this.transport();
818
+ const output = new this.protocol(writer);
819
+ output.writeMessageBegin("getUserProfile", thrift.MessageType.CALL, this.incrementRequestId());
820
+ const args = {};
821
+ exports.GetUserProfile__ArgsCodec.encode(args, output);
822
+ output.writeMessageEnd();
823
+ return this.connection.send(writer.flush(), context).then((data) => {
824
+ const reader = this.transport.receiver(data);
825
+ const input = new this.protocol(reader);
826
+ try {
827
+ const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
828
+ if (fieldName === "getUserProfile") {
829
+ if (messageType === thrift.MessageType.EXCEPTION) {
830
+ const err = thrift.TApplicationExceptionCodec.decode(input);
831
+ input.readMessageEnd();
832
+ return Promise.reject(err);
833
+ }
834
+ else {
835
+ const result = exports.GetUserProfile__ResultCodec.decode(input);
836
+ input.readMessageEnd();
837
+ if (result.success != null) {
838
+ return Promise.resolve(result.success);
839
+ }
840
+ else {
841
+ return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "getUserProfile failed: unknown result"));
842
+ }
843
+ }
844
+ }
845
+ else {
846
+ return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName));
847
+ }
848
+ }
849
+ catch (err) {
850
+ return Promise.reject(err);
851
+ }
852
+ });
853
+ }
241
854
  }
242
855
  exports.Client = Client;
243
856
  Client.serviceName = exports.serviceName;
@@ -264,6 +877,18 @@ class Processor extends thrift.ThriftProcessor {
264
877
  resolve(this.process_recommend(requestId, input, output, context));
265
878
  break;
266
879
  }
880
+ case "process_comment": {
881
+ resolve(this.process_comment(requestId, input, output, context));
882
+ break;
883
+ }
884
+ case "process_reply": {
885
+ resolve(this.process_reply(requestId, input, output, context));
886
+ break;
887
+ }
888
+ case "process_getUserProfile": {
889
+ resolve(this.process_getUserProfile(requestId, input, output, context));
890
+ break;
891
+ }
267
892
  default: {
268
893
  input.skip(thrift.TType.STRUCT);
269
894
  input.readMessageEnd();
@@ -302,6 +927,77 @@ class Processor extends thrift.ThriftProcessor {
302
927
  return output.flush();
303
928
  });
304
929
  }
930
+ process_comment(requestId, input, output, context) {
931
+ return new Promise((resolve, reject) => {
932
+ try {
933
+ const args = exports.Comment__ArgsCodec.decode(input);
934
+ input.readMessageEnd();
935
+ resolve(this._handler.comment(args.shortUrl, args.body, context));
936
+ }
937
+ catch (err) {
938
+ reject(err);
939
+ }
940
+ }).then((data) => {
941
+ const result = { success: data };
942
+ output.writeMessageBegin("comment", thrift.MessageType.REPLY, requestId);
943
+ exports.Comment__ResultCodec.encode(result, output);
944
+ output.writeMessageEnd();
945
+ return output.flush();
946
+ }).catch((err) => {
947
+ const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
948
+ output.writeMessageBegin("comment", thrift.MessageType.EXCEPTION, requestId);
949
+ thrift.TApplicationExceptionCodec.encode(result, output);
950
+ output.writeMessageEnd();
951
+ return output.flush();
952
+ });
953
+ }
954
+ process_reply(requestId, input, output, context) {
955
+ return new Promise((resolve, reject) => {
956
+ try {
957
+ const args = exports.Reply__ArgsCodec.decode(input);
958
+ input.readMessageEnd();
959
+ resolve(this._handler.reply(args.shortUrl, args.body, args.parentCommentId, context));
960
+ }
961
+ catch (err) {
962
+ reject(err);
963
+ }
964
+ }).then((data) => {
965
+ const result = { success: data };
966
+ output.writeMessageBegin("reply", thrift.MessageType.REPLY, requestId);
967
+ exports.Reply__ResultCodec.encode(result, output);
968
+ output.writeMessageEnd();
969
+ return output.flush();
970
+ }).catch((err) => {
971
+ const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
972
+ output.writeMessageBegin("reply", thrift.MessageType.EXCEPTION, requestId);
973
+ thrift.TApplicationExceptionCodec.encode(result, output);
974
+ output.writeMessageEnd();
975
+ return output.flush();
976
+ });
977
+ }
978
+ process_getUserProfile(requestId, input, output, context) {
979
+ return new Promise((resolve, reject) => {
980
+ try {
981
+ input.readMessageEnd();
982
+ resolve(this._handler.getUserProfile(context));
983
+ }
984
+ catch (err) {
985
+ reject(err);
986
+ }
987
+ }).then((data) => {
988
+ const result = { success: data };
989
+ output.writeMessageBegin("getUserProfile", thrift.MessageType.REPLY, requestId);
990
+ exports.GetUserProfile__ResultCodec.encode(result, output);
991
+ output.writeMessageEnd();
992
+ return output.flush();
993
+ }).catch((err) => {
994
+ const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
995
+ output.writeMessageBegin("getUserProfile", thrift.MessageType.EXCEPTION, requestId);
996
+ thrift.TApplicationExceptionCodec.encode(result, output);
997
+ output.writeMessageEnd();
998
+ return output.flush();
999
+ });
1000
+ }
305
1001
  }
306
1002
  exports.Processor = Processor;
307
1003
  Processor.serviceName = exports.serviceName;