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