@guardian/bridget 2.9.0 → 3.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.Reply__Result = exports.Reply__ResultCodec = exports.Comment__Result = exports.Comment__ResultCodec = exports.Recommend__Result = exports.Recommend__ResultCodec = exports.IsDiscussionEnabled__Result = exports.IsDiscussionEnabled__ResultCodec = exports.Preview__Result = exports.Preview__ResultCodec = exports.Reply__Args = exports.Reply__ArgsCodec = exports.Comment__Args = exports.Comment__ArgsCodec = exports.Recommend__Args = exports.Recommend__ArgsCodec = exports.IsDiscussionEnabled__Args = exports.IsDiscussionEnabled__ArgsCodec = exports.Preview__Args = exports.Preview__ArgsCodec = exports.methodParameters = exports.methodNames = exports.methodAnnotations = exports.annotations = exports.serviceName = void 0;
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;
27
27
  /* tslint:disable */
28
28
  /* eslint-disable */
29
29
  /*
@@ -31,692 +31,33 @@ exports.Processor = exports.Client = exports.Reply__Result = exports.Reply__Resu
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 CommentResponse = __importStar(require("./CommentResponse"));
34
+ const DiscussionResponse = __importStar(require("./DiscussionResponse"));
35
35
  exports.serviceName = "Discussion";
36
36
  exports.annotations = {};
37
37
  exports.methodAnnotations = {
38
- preview: {
39
- annotations: {},
40
- fieldAnnotations: {}
41
- },
42
- isDiscussionEnabled: {
43
- annotations: {},
44
- fieldAnnotations: {}
45
- },
46
38
  recommend: {
47
- annotations: {},
48
- fieldAnnotations: {}
49
- },
50
- comment: {
51
- annotations: {},
52
- fieldAnnotations: {}
53
- },
54
- reply: {
55
- annotations: {},
56
- fieldAnnotations: {}
57
- }
58
- };
59
- exports.methodNames = ["preview", "isDiscussionEnabled", "recommend", "comment", "reply"];
60
- exports.methodParameters = {
61
- preview: 2,
62
- isDiscussionEnabled: 1,
63
- recommend: 2,
64
- comment: 3,
65
- reply: 4
66
- };
67
- exports.Preview__ArgsCodec = {
68
- encode(args, output) {
69
- const obj = {
70
- body: args.body
71
- };
72
- output.writeStructBegin("Preview__Args");
73
- if (obj.body != null) {
74
- output.writeFieldBegin("body", thrift.TType.STRING, 1);
75
- output.writeString(obj.body);
76
- output.writeFieldEnd();
77
- }
78
- else {
79
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[body] is unset!");
80
- }
81
- output.writeFieldStop();
82
- output.writeStructEnd();
83
- return;
84
- },
85
- decode(input) {
86
- let _args = {};
87
- input.readStructBegin();
88
- while (true) {
89
- const ret = input.readFieldBegin();
90
- const fieldType = ret.fieldType;
91
- const fieldId = ret.fieldId;
92
- if (fieldType === thrift.TType.STOP) {
93
- break;
94
- }
95
- switch (fieldId) {
96
- case 1:
97
- if (fieldType === thrift.TType.STRING) {
98
- const value_1 = input.readString();
99
- _args.body = value_1;
100
- }
101
- else {
102
- input.skip(fieldType);
103
- }
104
- break;
105
- default: {
106
- input.skip(fieldType);
107
- }
108
- }
109
- input.readFieldEnd();
110
- }
111
- input.readStructEnd();
112
- if (_args.body !== undefined) {
113
- return {
114
- body: _args.body
115
- };
116
- }
117
- else {
118
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read Preview__Args from input");
119
- }
120
- }
121
- };
122
- class Preview__Args extends thrift.StructLike {
123
- constructor(args) {
124
- super();
125
- this._annotations = {};
126
- this._fieldAnnotations = {};
127
- if (args.body != null) {
128
- const value_2 = args.body;
129
- this.body = value_2;
130
- }
131
- else {
132
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[body] is unset!");
133
- }
134
- }
135
- static read(input) {
136
- return new Preview__Args(exports.Preview__ArgsCodec.decode(input));
137
- }
138
- static write(args, output) {
139
- return exports.Preview__ArgsCodec.encode(args, output);
140
- }
141
- write(output) {
142
- return exports.Preview__ArgsCodec.encode(this, output);
143
- }
144
- }
145
- exports.Preview__Args = Preview__Args;
146
- exports.IsDiscussionEnabled__ArgsCodec = {
147
- encode(args, output) {
148
- output.writeStructBegin("IsDiscussionEnabled__Args");
149
- output.writeFieldStop();
150
- output.writeStructEnd();
151
- return;
152
- },
153
- decode(input) {
154
- input.readStructBegin();
155
- while (true) {
156
- const ret = input.readFieldBegin();
157
- const fieldType = ret.fieldType;
158
- const fieldId = ret.fieldId;
159
- if (fieldType === thrift.TType.STOP) {
160
- break;
161
- }
162
- switch (fieldId) {
163
- default: {
164
- input.skip(fieldType);
165
- }
166
- }
167
- input.readFieldEnd();
168
- }
169
- input.readStructEnd();
170
- return {};
171
- }
172
- };
173
- class IsDiscussionEnabled__Args extends thrift.StructLike {
174
- constructor(args = {}) {
175
- super();
176
- this._annotations = {};
177
- this._fieldAnnotations = {};
178
- }
179
- static read(input) {
180
- return new IsDiscussionEnabled__Args(exports.IsDiscussionEnabled__ArgsCodec.decode(input));
181
- }
182
- static write(args, output) {
183
- return exports.IsDiscussionEnabled__ArgsCodec.encode(args, output);
184
- }
185
- write(output) {
186
- return exports.IsDiscussionEnabled__ArgsCodec.encode(this, output);
187
- }
188
- }
189
- exports.IsDiscussionEnabled__Args = IsDiscussionEnabled__Args;
190
- exports.Recommend__ArgsCodec = {
191
- encode(args, output) {
192
- const obj = {
193
- commentId: args.commentId
194
- };
195
- output.writeStructBegin("Recommend__Args");
196
- if (obj.commentId != null) {
197
- output.writeFieldBegin("commentId", thrift.TType.I32, 1);
198
- output.writeI32(obj.commentId);
199
- output.writeFieldEnd();
200
- }
201
- else {
202
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[commentId] is unset!");
203
- }
204
- output.writeFieldStop();
205
- output.writeStructEnd();
206
- return;
207
- },
208
- decode(input) {
209
- let _args = {};
210
- input.readStructBegin();
211
- while (true) {
212
- const ret = input.readFieldBegin();
213
- const fieldType = ret.fieldType;
214
- const fieldId = ret.fieldId;
215
- if (fieldType === thrift.TType.STOP) {
216
- break;
217
- }
218
- switch (fieldId) {
219
- case 1:
220
- if (fieldType === thrift.TType.I32) {
221
- const value_3 = input.readI32();
222
- _args.commentId = value_3;
223
- }
224
- else {
225
- input.skip(fieldType);
226
- }
227
- break;
228
- default: {
229
- input.skip(fieldType);
230
- }
231
- }
232
- input.readFieldEnd();
233
- }
234
- input.readStructEnd();
235
- if (_args.commentId !== undefined) {
236
- return {
237
- commentId: _args.commentId
238
- };
239
- }
240
- else {
241
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read Recommend__Args from input");
242
- }
243
- }
244
- };
245
- class Recommend__Args extends thrift.StructLike {
246
- constructor(args) {
247
- super();
248
- this._annotations = {};
249
- this._fieldAnnotations = {};
250
- if (args.commentId != null) {
251
- const value_4 = args.commentId;
252
- this.commentId = value_4;
253
- }
254
- else {
255
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[commentId] is unset!");
256
- }
257
- }
258
- static read(input) {
259
- return new Recommend__Args(exports.Recommend__ArgsCodec.decode(input));
260
- }
261
- static write(args, output) {
262
- return exports.Recommend__ArgsCodec.encode(args, output);
263
- }
264
- write(output) {
265
- return exports.Recommend__ArgsCodec.encode(this, output);
266
- }
267
- }
268
- exports.Recommend__Args = Recommend__Args;
269
- exports.Comment__ArgsCodec = {
270
- encode(args, output) {
271
- const obj = {
272
- shortUrl: args.shortUrl,
273
- body: args.body
274
- };
275
- output.writeStructBegin("Comment__Args");
276
- if (obj.shortUrl != null) {
277
- output.writeFieldBegin("shortUrl", thrift.TType.STRING, 1);
278
- output.writeString(obj.shortUrl);
279
- output.writeFieldEnd();
280
- }
281
- else {
282
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[shortUrl] is unset!");
283
- }
284
- if (obj.body != null) {
285
- output.writeFieldBegin("body", thrift.TType.STRING, 2);
286
- output.writeString(obj.body);
287
- output.writeFieldEnd();
288
- }
289
- else {
290
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[body] is unset!");
291
- }
292
- output.writeFieldStop();
293
- output.writeStructEnd();
294
- return;
295
- },
296
- decode(input) {
297
- let _args = {};
298
- input.readStructBegin();
299
- while (true) {
300
- const ret = input.readFieldBegin();
301
- const fieldType = ret.fieldType;
302
- const fieldId = ret.fieldId;
303
- if (fieldType === thrift.TType.STOP) {
304
- break;
305
- }
306
- switch (fieldId) {
307
- case 1:
308
- if (fieldType === thrift.TType.STRING) {
309
- const value_5 = input.readString();
310
- _args.shortUrl = value_5;
311
- }
312
- else {
313
- input.skip(fieldType);
314
- }
315
- break;
316
- case 2:
317
- if (fieldType === thrift.TType.STRING) {
318
- const value_6 = input.readString();
319
- _args.body = value_6;
320
- }
321
- else {
322
- input.skip(fieldType);
323
- }
324
- break;
325
- default: {
326
- input.skip(fieldType);
327
- }
328
- }
329
- input.readFieldEnd();
330
- }
331
- input.readStructEnd();
332
- if (_args.shortUrl !== undefined && _args.body !== undefined) {
333
- return {
334
- shortUrl: _args.shortUrl,
335
- body: _args.body
336
- };
337
- }
338
- else {
339
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read Comment__Args from input");
340
- }
341
- }
342
- };
343
- class Comment__Args extends thrift.StructLike {
344
- constructor(args) {
345
- super();
346
- this._annotations = {};
347
- this._fieldAnnotations = {};
348
- if (args.shortUrl != null) {
349
- const value_7 = args.shortUrl;
350
- this.shortUrl = value_7;
351
- }
352
- else {
353
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[shortUrl] is unset!");
354
- }
355
- if (args.body != null) {
356
- const value_8 = args.body;
357
- this.body = value_8;
358
- }
359
- else {
360
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[body] is unset!");
361
- }
362
- }
363
- static read(input) {
364
- return new Comment__Args(exports.Comment__ArgsCodec.decode(input));
365
- }
366
- static write(args, output) {
367
- return exports.Comment__ArgsCodec.encode(args, output);
368
- }
369
- write(output) {
370
- return exports.Comment__ArgsCodec.encode(this, output);
371
- }
372
- }
373
- exports.Comment__Args = Comment__Args;
374
- exports.Reply__ArgsCodec = {
375
- encode(args, output) {
376
- const obj = {
377
- shortUrl: args.shortUrl,
378
- body: args.body,
379
- parentCommentId: args.parentCommentId
380
- };
381
- output.writeStructBegin("Reply__Args");
382
- if (obj.shortUrl != null) {
383
- output.writeFieldBegin("shortUrl", thrift.TType.STRING, 1);
384
- output.writeString(obj.shortUrl);
385
- output.writeFieldEnd();
386
- }
387
- else {
388
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[shortUrl] is unset!");
389
- }
390
- if (obj.body != null) {
391
- output.writeFieldBegin("body", thrift.TType.STRING, 2);
392
- output.writeString(obj.body);
393
- output.writeFieldEnd();
394
- }
395
- else {
396
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[body] is unset!");
397
- }
398
- if (obj.parentCommentId != null) {
399
- output.writeFieldBegin("parentCommentId", thrift.TType.I32, 3);
400
- output.writeI32(obj.parentCommentId);
401
- output.writeFieldEnd();
402
- }
403
- else {
404
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[parentCommentId] is unset!");
405
- }
406
- output.writeFieldStop();
407
- output.writeStructEnd();
408
- return;
409
- },
410
- decode(input) {
411
- let _args = {};
412
- input.readStructBegin();
413
- while (true) {
414
- const ret = input.readFieldBegin();
415
- const fieldType = ret.fieldType;
416
- const fieldId = ret.fieldId;
417
- if (fieldType === thrift.TType.STOP) {
418
- break;
419
- }
420
- switch (fieldId) {
421
- case 1:
422
- if (fieldType === thrift.TType.STRING) {
423
- const value_9 = input.readString();
424
- _args.shortUrl = value_9;
425
- }
426
- else {
427
- input.skip(fieldType);
428
- }
429
- break;
430
- case 2:
431
- if (fieldType === thrift.TType.STRING) {
432
- const value_10 = input.readString();
433
- _args.body = value_10;
434
- }
435
- else {
436
- input.skip(fieldType);
437
- }
438
- break;
439
- case 3:
440
- if (fieldType === thrift.TType.I32) {
441
- const value_11 = input.readI32();
442
- _args.parentCommentId = value_11;
443
- }
444
- else {
445
- input.skip(fieldType);
446
- }
447
- break;
448
- default: {
449
- input.skip(fieldType);
450
- }
451
- }
452
- input.readFieldEnd();
453
- }
454
- input.readStructEnd();
455
- if (_args.shortUrl !== undefined && _args.body !== undefined && _args.parentCommentId !== undefined) {
456
- return {
457
- shortUrl: _args.shortUrl,
458
- body: _args.body,
459
- parentCommentId: _args.parentCommentId
460
- };
461
- }
462
- else {
463
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read Reply__Args from input");
464
- }
465
- }
466
- };
467
- class Reply__Args extends thrift.StructLike {
468
- constructor(args) {
469
- super();
470
- this._annotations = {};
471
- this._fieldAnnotations = {};
472
- if (args.shortUrl != null) {
473
- const value_12 = args.shortUrl;
474
- this.shortUrl = value_12;
475
- }
476
- else {
477
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[shortUrl] is unset!");
478
- }
479
- if (args.body != null) {
480
- const value_13 = args.body;
481
- this.body = value_13;
482
- }
483
- else {
484
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[body] is unset!");
485
- }
486
- if (args.parentCommentId != null) {
487
- const value_14 = args.parentCommentId;
488
- this.parentCommentId = value_14;
489
- }
490
- else {
491
- throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[parentCommentId] is unset!");
492
- }
493
- }
494
- static read(input) {
495
- return new Reply__Args(exports.Reply__ArgsCodec.decode(input));
496
- }
497
- static write(args, output) {
498
- return exports.Reply__ArgsCodec.encode(args, output);
499
- }
500
- write(output) {
501
- return exports.Reply__ArgsCodec.encode(this, output);
502
- }
503
- }
504
- exports.Reply__Args = Reply__Args;
505
- exports.Preview__ResultCodec = {
506
- encode(args, output) {
507
- const obj = {
508
- success: args.success
509
- };
510
- output.writeStructBegin("Preview__Result");
511
- if (obj.success != null) {
512
- output.writeFieldBegin("success", thrift.TType.STRING, 0);
513
- output.writeString(obj.success);
514
- output.writeFieldEnd();
515
- }
516
- output.writeFieldStop();
517
- output.writeStructEnd();
518
- return;
519
- },
520
- decode(input) {
521
- let _args = {};
522
- input.readStructBegin();
523
- while (true) {
524
- const ret = input.readFieldBegin();
525
- const fieldType = ret.fieldType;
526
- const fieldId = ret.fieldId;
527
- if (fieldType === thrift.TType.STOP) {
528
- break;
529
- }
530
- switch (fieldId) {
531
- case 0:
532
- if (fieldType === thrift.TType.STRING) {
533
- const value_15 = input.readString();
534
- _args.success = value_15;
535
- }
536
- else {
537
- input.skip(fieldType);
538
- }
539
- break;
540
- default: {
541
- input.skip(fieldType);
542
- }
543
- }
544
- input.readFieldEnd();
545
- }
546
- input.readStructEnd();
547
- return {
548
- success: _args.success
549
- };
550
- }
551
- };
552
- class Preview__Result extends thrift.StructLike {
553
- constructor(args = {}) {
554
- super();
555
- this._annotations = {};
556
- this._fieldAnnotations = {};
557
- if (args.success != null) {
558
- const value_16 = args.success;
559
- this.success = value_16;
560
- }
561
- }
562
- static read(input) {
563
- return new Preview__Result(exports.Preview__ResultCodec.decode(input));
564
- }
565
- static write(args, output) {
566
- return exports.Preview__ResultCodec.encode(args, output);
567
- }
568
- write(output) {
569
- return exports.Preview__ResultCodec.encode(this, output);
570
- }
571
- }
572
- exports.Preview__Result = Preview__Result;
573
- exports.IsDiscussionEnabled__ResultCodec = {
574
- encode(args, output) {
575
- const obj = {
576
- success: args.success
577
- };
578
- output.writeStructBegin("IsDiscussionEnabled__Result");
579
- if (obj.success != null) {
580
- output.writeFieldBegin("success", thrift.TType.BOOL, 0);
581
- output.writeBool(obj.success);
582
- output.writeFieldEnd();
583
- }
584
- output.writeFieldStop();
585
- output.writeStructEnd();
586
- return;
587
- },
588
- decode(input) {
589
- let _args = {};
590
- input.readStructBegin();
591
- while (true) {
592
- const ret = input.readFieldBegin();
593
- const fieldType = ret.fieldType;
594
- const fieldId = ret.fieldId;
595
- if (fieldType === thrift.TType.STOP) {
596
- break;
597
- }
598
- switch (fieldId) {
599
- case 0:
600
- if (fieldType === thrift.TType.BOOL) {
601
- const value_17 = input.readBool();
602
- _args.success = value_17;
603
- }
604
- else {
605
- input.skip(fieldType);
606
- }
607
- break;
608
- default: {
609
- input.skip(fieldType);
610
- }
611
- }
612
- input.readFieldEnd();
613
- }
614
- input.readStructEnd();
615
- return {
616
- success: _args.success
617
- };
618
- }
619
- };
620
- class IsDiscussionEnabled__Result extends thrift.StructLike {
621
- constructor(args = {}) {
622
- super();
623
- this._annotations = {};
624
- this._fieldAnnotations = {};
625
- if (args.success != null) {
626
- const value_18 = args.success;
627
- this.success = value_18;
628
- }
629
- }
630
- static read(input) {
631
- return new IsDiscussionEnabled__Result(exports.IsDiscussionEnabled__ResultCodec.decode(input));
632
- }
633
- static write(args, output) {
634
- return exports.IsDiscussionEnabled__ResultCodec.encode(args, output);
635
- }
636
- write(output) {
637
- return exports.IsDiscussionEnabled__ResultCodec.encode(this, output);
638
- }
639
- }
640
- exports.IsDiscussionEnabled__Result = IsDiscussionEnabled__Result;
641
- exports.Recommend__ResultCodec = {
642
- encode(args, output) {
643
- const obj = {
644
- success: args.success
645
- };
646
- output.writeStructBegin("Recommend__Result");
647
- if (obj.success != null) {
648
- output.writeFieldBegin("success", thrift.TType.BOOL, 0);
649
- output.writeBool(obj.success);
650
- output.writeFieldEnd();
651
- }
652
- output.writeFieldStop();
653
- output.writeStructEnd();
654
- return;
655
- },
656
- decode(input) {
657
- let _args = {};
658
- input.readStructBegin();
659
- while (true) {
660
- const ret = input.readFieldBegin();
661
- const fieldType = ret.fieldType;
662
- const fieldId = ret.fieldId;
663
- if (fieldType === thrift.TType.STOP) {
664
- break;
665
- }
666
- switch (fieldId) {
667
- case 0:
668
- if (fieldType === thrift.TType.BOOL) {
669
- const value_19 = input.readBool();
670
- _args.success = value_19;
671
- }
672
- else {
673
- input.skip(fieldType);
674
- }
675
- break;
676
- default: {
677
- input.skip(fieldType);
678
- }
679
- }
680
- input.readFieldEnd();
681
- }
682
- input.readStructEnd();
683
- return {
684
- success: _args.success
685
- };
686
- }
687
- };
688
- class Recommend__Result extends thrift.StructLike {
689
- constructor(args = {}) {
690
- super();
691
- this._annotations = {};
692
- this._fieldAnnotations = {};
693
- if (args.success != null) {
694
- const value_20 = args.success;
695
- this.success = value_20;
696
- }
697
- }
698
- static read(input) {
699
- return new Recommend__Result(exports.Recommend__ResultCodec.decode(input));
700
- }
701
- static write(args, output) {
702
- return exports.Recommend__ResultCodec.encode(args, output);
703
- }
704
- write(output) {
705
- return exports.Recommend__ResultCodec.encode(this, output);
39
+ annotations: {},
40
+ fieldAnnotations: {}
706
41
  }
707
- }
708
- exports.Recommend__Result = Recommend__Result;
709
- exports.Comment__ResultCodec = {
42
+ };
43
+ exports.methodNames = ["recommend"];
44
+ exports.methodParameters = {
45
+ recommend: 2
46
+ };
47
+ exports.Recommend__ArgsCodec = {
710
48
  encode(args, output) {
711
49
  const obj = {
712
- success: args.success
50
+ commentId: args.commentId
713
51
  };
714
- output.writeStructBegin("Comment__Result");
715
- if (obj.success != null) {
716
- output.writeFieldBegin("success", thrift.TType.STRUCT, 0);
717
- CommentResponse.CommentResponseCodec.encode(obj.success, output);
52
+ output.writeStructBegin("Recommend__Args");
53
+ if (obj.commentId != null) {
54
+ output.writeFieldBegin("commentId", thrift.TType.STRING, 1);
55
+ output.writeString(obj.commentId);
718
56
  output.writeFieldEnd();
719
57
  }
58
+ else {
59
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[commentId] is unset!");
60
+ }
720
61
  output.writeFieldStop();
721
62
  output.writeStructEnd();
722
63
  return;
@@ -732,10 +73,10 @@ exports.Comment__ResultCodec = {
732
73
  break;
733
74
  }
734
75
  switch (fieldId) {
735
- case 0:
736
- if (fieldType === thrift.TType.STRUCT) {
737
- const value_21 = CommentResponse.CommentResponseCodec.decode(input);
738
- _args.success = value_21;
76
+ case 1:
77
+ if (fieldType === thrift.TType.STRING) {
78
+ const value_1 = input.readString();
79
+ _args.commentId = value_1;
739
80
  }
740
81
  else {
741
82
  input.skip(fieldType);
@@ -748,41 +89,49 @@ exports.Comment__ResultCodec = {
748
89
  input.readFieldEnd();
749
90
  }
750
91
  input.readStructEnd();
751
- return {
752
- success: _args.success
753
- };
92
+ if (_args.commentId !== undefined) {
93
+ return {
94
+ commentId: _args.commentId
95
+ };
96
+ }
97
+ else {
98
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read Recommend__Args from input");
99
+ }
754
100
  }
755
101
  };
756
- class Comment__Result extends thrift.StructLike {
757
- constructor(args = {}) {
102
+ class Recommend__Args extends thrift.StructLike {
103
+ constructor(args) {
758
104
  super();
759
105
  this._annotations = {};
760
106
  this._fieldAnnotations = {};
761
- if (args.success != null) {
762
- const value_22 = new CommentResponse.CommentResponse(args.success);
763
- this.success = value_22;
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!");
764
113
  }
765
114
  }
766
115
  static read(input) {
767
- return new Comment__Result(exports.Comment__ResultCodec.decode(input));
116
+ return new Recommend__Args(exports.Recommend__ArgsCodec.decode(input));
768
117
  }
769
118
  static write(args, output) {
770
- return exports.Comment__ResultCodec.encode(args, output);
119
+ return exports.Recommend__ArgsCodec.encode(args, output);
771
120
  }
772
121
  write(output) {
773
- return exports.Comment__ResultCodec.encode(this, output);
122
+ return exports.Recommend__ArgsCodec.encode(this, output);
774
123
  }
775
124
  }
776
- exports.Comment__Result = Comment__Result;
777
- exports.Reply__ResultCodec = {
125
+ exports.Recommend__Args = Recommend__Args;
126
+ exports.Recommend__ResultCodec = {
778
127
  encode(args, output) {
779
128
  const obj = {
780
129
  success: args.success
781
130
  };
782
- output.writeStructBegin("Reply__Result");
131
+ output.writeStructBegin("Recommend__Result");
783
132
  if (obj.success != null) {
784
133
  output.writeFieldBegin("success", thrift.TType.STRUCT, 0);
785
- CommentResponse.CommentResponseCodec.encode(obj.success, output);
134
+ DiscussionResponse.DiscussionResponseCodec.encode(obj.success, output);
786
135
  output.writeFieldEnd();
787
136
  }
788
137
  output.writeFieldStop();
@@ -802,8 +151,8 @@ exports.Reply__ResultCodec = {
802
151
  switch (fieldId) {
803
152
  case 0:
804
153
  if (fieldType === thrift.TType.STRUCT) {
805
- const value_23 = CommentResponse.CommentResponseCodec.decode(input);
806
- _args.success = value_23;
154
+ const value_3 = DiscussionResponse.DiscussionResponseCodec.decode(input);
155
+ _args.success = value_3;
807
156
  }
808
157
  else {
809
158
  input.skip(fieldType);
@@ -821,27 +170,27 @@ exports.Reply__ResultCodec = {
821
170
  };
822
171
  }
823
172
  };
824
- class Reply__Result extends thrift.StructLike {
173
+ class Recommend__Result extends thrift.StructLike {
825
174
  constructor(args = {}) {
826
175
  super();
827
176
  this._annotations = {};
828
177
  this._fieldAnnotations = {};
829
178
  if (args.success != null) {
830
- const value_24 = new CommentResponse.CommentResponse(args.success);
831
- this.success = value_24;
179
+ const value_4 = DiscussionResponse.DiscussionResponseCodec.create(args.success);
180
+ this.success = value_4;
832
181
  }
833
182
  }
834
183
  static read(input) {
835
- return new Reply__Result(exports.Reply__ResultCodec.decode(input));
184
+ return new Recommend__Result(exports.Recommend__ResultCodec.decode(input));
836
185
  }
837
186
  static write(args, output) {
838
- return exports.Reply__ResultCodec.encode(args, output);
187
+ return exports.Recommend__ResultCodec.encode(args, output);
839
188
  }
840
189
  write(output) {
841
- return exports.Reply__ResultCodec.encode(this, output);
190
+ return exports.Recommend__ResultCodec.encode(this, output);
842
191
  }
843
192
  }
844
- exports.Reply__Result = Reply__Result;
193
+ exports.Recommend__Result = Recommend__Result;
845
194
  class Client extends thrift.ThriftClient {
846
195
  constructor() {
847
196
  super(...arguments);
@@ -851,82 +200,6 @@ class Client extends thrift.ThriftClient {
851
200
  this._methodNames = exports.methodNames;
852
201
  this._methodParameters = exports.methodParameters;
853
202
  }
854
- preview(body, context) {
855
- const writer = new this.transport();
856
- const output = new this.protocol(writer);
857
- output.writeMessageBegin("preview", thrift.MessageType.CALL, this.incrementRequestId());
858
- const args = { body };
859
- exports.Preview__ArgsCodec.encode(args, output);
860
- output.writeMessageEnd();
861
- return this.connection.send(writer.flush(), context).then((data) => {
862
- const reader = this.transport.receiver(data);
863
- const input = new this.protocol(reader);
864
- try {
865
- const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
866
- if (fieldName === "preview") {
867
- if (messageType === thrift.MessageType.EXCEPTION) {
868
- const err = thrift.TApplicationExceptionCodec.decode(input);
869
- input.readMessageEnd();
870
- return Promise.reject(err);
871
- }
872
- else {
873
- const result = exports.Preview__ResultCodec.decode(input);
874
- input.readMessageEnd();
875
- if (result.success != null) {
876
- return Promise.resolve(result.success);
877
- }
878
- else {
879
- return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "preview failed: unknown result"));
880
- }
881
- }
882
- }
883
- else {
884
- return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName));
885
- }
886
- }
887
- catch (err) {
888
- return Promise.reject(err);
889
- }
890
- });
891
- }
892
- isDiscussionEnabled(context) {
893
- const writer = new this.transport();
894
- const output = new this.protocol(writer);
895
- output.writeMessageBegin("isDiscussionEnabled", thrift.MessageType.CALL, this.incrementRequestId());
896
- const args = {};
897
- exports.IsDiscussionEnabled__ArgsCodec.encode(args, output);
898
- output.writeMessageEnd();
899
- return this.connection.send(writer.flush(), context).then((data) => {
900
- const reader = this.transport.receiver(data);
901
- const input = new this.protocol(reader);
902
- try {
903
- const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
904
- if (fieldName === "isDiscussionEnabled") {
905
- if (messageType === thrift.MessageType.EXCEPTION) {
906
- const err = thrift.TApplicationExceptionCodec.decode(input);
907
- input.readMessageEnd();
908
- return Promise.reject(err);
909
- }
910
- else {
911
- const result = exports.IsDiscussionEnabled__ResultCodec.decode(input);
912
- input.readMessageEnd();
913
- if (result.success != null) {
914
- return Promise.resolve(result.success);
915
- }
916
- else {
917
- return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "isDiscussionEnabled failed: unknown result"));
918
- }
919
- }
920
- }
921
- else {
922
- return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName));
923
- }
924
- }
925
- catch (err) {
926
- return Promise.reject(err);
927
- }
928
- });
929
- }
930
203
  recommend(commentId, context) {
931
204
  const writer = new this.transport();
932
205
  const output = new this.protocol(writer);
@@ -965,82 +238,6 @@ class Client extends thrift.ThriftClient {
965
238
  }
966
239
  });
967
240
  }
968
- comment(shortUrl, body, context) {
969
- const writer = new this.transport();
970
- const output = new this.protocol(writer);
971
- output.writeMessageBegin("comment", thrift.MessageType.CALL, this.incrementRequestId());
972
- const args = { shortUrl, body };
973
- exports.Comment__ArgsCodec.encode(args, output);
974
- output.writeMessageEnd();
975
- return this.connection.send(writer.flush(), context).then((data) => {
976
- const reader = this.transport.receiver(data);
977
- const input = new this.protocol(reader);
978
- try {
979
- const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
980
- if (fieldName === "comment") {
981
- if (messageType === thrift.MessageType.EXCEPTION) {
982
- const err = thrift.TApplicationExceptionCodec.decode(input);
983
- input.readMessageEnd();
984
- return Promise.reject(err);
985
- }
986
- else {
987
- const result = exports.Comment__ResultCodec.decode(input);
988
- input.readMessageEnd();
989
- if (result.success != null) {
990
- return Promise.resolve(result.success);
991
- }
992
- else {
993
- return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "comment failed: unknown result"));
994
- }
995
- }
996
- }
997
- else {
998
- return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName));
999
- }
1000
- }
1001
- catch (err) {
1002
- return Promise.reject(err);
1003
- }
1004
- });
1005
- }
1006
- reply(shortUrl, body, parentCommentId, context) {
1007
- const writer = new this.transport();
1008
- const output = new this.protocol(writer);
1009
- output.writeMessageBegin("reply", thrift.MessageType.CALL, this.incrementRequestId());
1010
- const args = { shortUrl, body, parentCommentId };
1011
- exports.Reply__ArgsCodec.encode(args, output);
1012
- output.writeMessageEnd();
1013
- return this.connection.send(writer.flush(), context).then((data) => {
1014
- const reader = this.transport.receiver(data);
1015
- const input = new this.protocol(reader);
1016
- try {
1017
- const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
1018
- if (fieldName === "reply") {
1019
- if (messageType === thrift.MessageType.EXCEPTION) {
1020
- const err = thrift.TApplicationExceptionCodec.decode(input);
1021
- input.readMessageEnd();
1022
- return Promise.reject(err);
1023
- }
1024
- else {
1025
- const result = exports.Reply__ResultCodec.decode(input);
1026
- input.readMessageEnd();
1027
- if (result.success != null) {
1028
- return Promise.resolve(result.success);
1029
- }
1030
- else {
1031
- return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "reply failed: unknown result"));
1032
- }
1033
- }
1034
- }
1035
- else {
1036
- return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName));
1037
- }
1038
- }
1039
- catch (err) {
1040
- return Promise.reject(err);
1041
- }
1042
- });
1043
- }
1044
241
  }
1045
242
  exports.Client = Client;
1046
243
  Client.serviceName = exports.serviceName;
@@ -1063,26 +260,10 @@ class Processor extends thrift.ThriftProcessor {
1063
260
  const requestId = metadata.requestId;
1064
261
  const methodName = "process_" + fieldName;
1065
262
  switch (methodName) {
1066
- case "process_preview": {
1067
- resolve(this.process_preview(requestId, input, output, context));
1068
- break;
1069
- }
1070
- case "process_isDiscussionEnabled": {
1071
- resolve(this.process_isDiscussionEnabled(requestId, input, output, context));
1072
- break;
1073
- }
1074
263
  case "process_recommend": {
1075
264
  resolve(this.process_recommend(requestId, input, output, context));
1076
265
  break;
1077
266
  }
1078
- case "process_comment": {
1079
- resolve(this.process_comment(requestId, input, output, context));
1080
- break;
1081
- }
1082
- case "process_reply": {
1083
- resolve(this.process_reply(requestId, input, output, context));
1084
- break;
1085
- }
1086
267
  default: {
1087
268
  input.skip(thrift.TType.STRUCT);
1088
269
  input.readMessageEnd();
@@ -1097,53 +278,6 @@ class Processor extends thrift.ThriftProcessor {
1097
278
  }
1098
279
  });
1099
280
  }
1100
- process_preview(requestId, input, output, context) {
1101
- return new Promise((resolve, reject) => {
1102
- try {
1103
- const args = exports.Preview__ArgsCodec.decode(input);
1104
- input.readMessageEnd();
1105
- resolve(this._handler.preview(args.body, context));
1106
- }
1107
- catch (err) {
1108
- reject(err);
1109
- }
1110
- }).then((data) => {
1111
- const result = { success: data };
1112
- output.writeMessageBegin("preview", thrift.MessageType.REPLY, requestId);
1113
- exports.Preview__ResultCodec.encode(result, output);
1114
- output.writeMessageEnd();
1115
- return output.flush();
1116
- }).catch((err) => {
1117
- const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
1118
- output.writeMessageBegin("preview", thrift.MessageType.EXCEPTION, requestId);
1119
- thrift.TApplicationExceptionCodec.encode(result, output);
1120
- output.writeMessageEnd();
1121
- return output.flush();
1122
- });
1123
- }
1124
- process_isDiscussionEnabled(requestId, input, output, context) {
1125
- return new Promise((resolve, reject) => {
1126
- try {
1127
- input.readMessageEnd();
1128
- resolve(this._handler.isDiscussionEnabled(context));
1129
- }
1130
- catch (err) {
1131
- reject(err);
1132
- }
1133
- }).then((data) => {
1134
- const result = { success: data };
1135
- output.writeMessageBegin("isDiscussionEnabled", thrift.MessageType.REPLY, requestId);
1136
- exports.IsDiscussionEnabled__ResultCodec.encode(result, output);
1137
- output.writeMessageEnd();
1138
- return output.flush();
1139
- }).catch((err) => {
1140
- const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
1141
- output.writeMessageBegin("isDiscussionEnabled", thrift.MessageType.EXCEPTION, requestId);
1142
- thrift.TApplicationExceptionCodec.encode(result, output);
1143
- output.writeMessageEnd();
1144
- return output.flush();
1145
- });
1146
- }
1147
281
  process_recommend(requestId, input, output, context) {
1148
282
  return new Promise((resolve, reject) => {
1149
283
  try {
@@ -1168,54 +302,6 @@ class Processor extends thrift.ThriftProcessor {
1168
302
  return output.flush();
1169
303
  });
1170
304
  }
1171
- process_comment(requestId, input, output, context) {
1172
- return new Promise((resolve, reject) => {
1173
- try {
1174
- const args = exports.Comment__ArgsCodec.decode(input);
1175
- input.readMessageEnd();
1176
- resolve(this._handler.comment(args.shortUrl, args.body, context));
1177
- }
1178
- catch (err) {
1179
- reject(err);
1180
- }
1181
- }).then((data) => {
1182
- const result = { success: data };
1183
- output.writeMessageBegin("comment", thrift.MessageType.REPLY, requestId);
1184
- exports.Comment__ResultCodec.encode(result, output);
1185
- output.writeMessageEnd();
1186
- return output.flush();
1187
- }).catch((err) => {
1188
- const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
1189
- output.writeMessageBegin("comment", thrift.MessageType.EXCEPTION, requestId);
1190
- thrift.TApplicationExceptionCodec.encode(result, output);
1191
- output.writeMessageEnd();
1192
- return output.flush();
1193
- });
1194
- }
1195
- process_reply(requestId, input, output, context) {
1196
- return new Promise((resolve, reject) => {
1197
- try {
1198
- const args = exports.Reply__ArgsCodec.decode(input);
1199
- input.readMessageEnd();
1200
- resolve(this._handler.reply(args.shortUrl, args.body, args.parentCommentId, context));
1201
- }
1202
- catch (err) {
1203
- reject(err);
1204
- }
1205
- }).then((data) => {
1206
- const result = { success: data };
1207
- output.writeMessageBegin("reply", thrift.MessageType.REPLY, requestId);
1208
- exports.Reply__ResultCodec.encode(result, output);
1209
- output.writeMessageEnd();
1210
- return output.flush();
1211
- }).catch((err) => {
1212
- const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
1213
- output.writeMessageBegin("reply", thrift.MessageType.EXCEPTION, requestId);
1214
- thrift.TApplicationExceptionCodec.encode(result, output);
1215
- output.writeMessageEnd();
1216
- return output.flush();
1217
- });
1218
- }
1219
305
  }
1220
306
  exports.Processor = Processor;
1221
307
  Processor.serviceName = exports.serviceName;