@guardian/bridget 8.5.1 → 8.7.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/AbTesting.d.ts +70 -0
- package/AbTesting.js +291 -0
- package/ListenToArticle.d.ts +35 -0
- package/ListenToArticle.js +248 -30
- package/index.d.ts +2 -0
- package/index.js +3 -1
- package/package.json +1 -1
package/AbTesting.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import * as thrift from "@creditkarma/thrift-server-core";
|
|
4
|
+
export declare const serviceName: string;
|
|
5
|
+
export declare const annotations: thrift.IThriftAnnotations;
|
|
6
|
+
export declare const methodAnnotations: thrift.IMethodAnnotations;
|
|
7
|
+
export declare const methodNames: Array<string>;
|
|
8
|
+
export declare const methodParameters: {
|
|
9
|
+
[methodName: string]: number;
|
|
10
|
+
};
|
|
11
|
+
export interface IGetParticipations__Args {
|
|
12
|
+
}
|
|
13
|
+
export interface IGetParticipations__ArgsArgs {
|
|
14
|
+
}
|
|
15
|
+
export declare const GetParticipations__ArgsCodec: thrift.IStructCodec<IGetParticipations__ArgsArgs, IGetParticipations__Args>;
|
|
16
|
+
export declare class GetParticipations__Args extends thrift.StructLike implements IGetParticipations__Args {
|
|
17
|
+
readonly _annotations: thrift.IThriftAnnotations;
|
|
18
|
+
readonly _fieldAnnotations: thrift.IFieldAnnotations;
|
|
19
|
+
constructor(args?: IGetParticipations__ArgsArgs);
|
|
20
|
+
static read(input: thrift.TProtocol): GetParticipations__Args;
|
|
21
|
+
static write(args: IGetParticipations__ArgsArgs, output: thrift.TProtocol): void;
|
|
22
|
+
write(output: thrift.TProtocol): void;
|
|
23
|
+
}
|
|
24
|
+
export interface IGetParticipations__Result {
|
|
25
|
+
success?: Map<string, string>;
|
|
26
|
+
}
|
|
27
|
+
export interface IGetParticipations__ResultArgs {
|
|
28
|
+
success?: Map<string, string>;
|
|
29
|
+
}
|
|
30
|
+
export declare const GetParticipations__ResultCodec: thrift.IStructCodec<IGetParticipations__ResultArgs, IGetParticipations__Result>;
|
|
31
|
+
export declare class GetParticipations__Result extends thrift.StructLike implements IGetParticipations__Result {
|
|
32
|
+
success?: Map<string, string>;
|
|
33
|
+
readonly _annotations: thrift.IThriftAnnotations;
|
|
34
|
+
readonly _fieldAnnotations: thrift.IFieldAnnotations;
|
|
35
|
+
constructor(args?: IGetParticipations__ResultArgs);
|
|
36
|
+
static read(input: thrift.TProtocol): GetParticipations__Result;
|
|
37
|
+
static write(args: IGetParticipations__ResultArgs, output: thrift.TProtocol): void;
|
|
38
|
+
write(output: thrift.TProtocol): void;
|
|
39
|
+
}
|
|
40
|
+
export declare class Client<Context = any> extends thrift.ThriftClient<Context> {
|
|
41
|
+
static readonly serviceName: string;
|
|
42
|
+
static readonly annotations: thrift.IThriftAnnotations;
|
|
43
|
+
static readonly methodAnnotations: thrift.IMethodAnnotations;
|
|
44
|
+
static readonly methodNames: Array<string>;
|
|
45
|
+
readonly _serviceName: string;
|
|
46
|
+
readonly _annotations: thrift.IThriftAnnotations;
|
|
47
|
+
readonly _methodAnnotations: thrift.IMethodAnnotations;
|
|
48
|
+
readonly _methodNames: Array<string>;
|
|
49
|
+
readonly _methodParameters?: {
|
|
50
|
+
[methodName: string]: number;
|
|
51
|
+
};
|
|
52
|
+
getParticipations(context?: Context): Promise<Map<string, string>>;
|
|
53
|
+
}
|
|
54
|
+
export interface IHandler<Context = any> {
|
|
55
|
+
getParticipations(context?: Context): Map<string, string> | Promise<Map<string, string>>;
|
|
56
|
+
}
|
|
57
|
+
export declare class Processor<Context = any> extends thrift.ThriftProcessor<Context, IHandler<Context>> {
|
|
58
|
+
protected readonly _handler: IHandler<Context>;
|
|
59
|
+
static readonly serviceName: string;
|
|
60
|
+
static readonly annotations: thrift.IThriftAnnotations;
|
|
61
|
+
static readonly methodAnnotations: thrift.IMethodAnnotations;
|
|
62
|
+
static readonly methodNames: Array<string>;
|
|
63
|
+
readonly _serviceName: string;
|
|
64
|
+
readonly _annotations: thrift.IThriftAnnotations;
|
|
65
|
+
readonly _methodAnnotations: thrift.IMethodAnnotations;
|
|
66
|
+
readonly _methodNames: Array<string>;
|
|
67
|
+
constructor(handler: IHandler<Context>);
|
|
68
|
+
process(input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
|
|
69
|
+
process_getParticipations(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
|
|
70
|
+
}
|
package/AbTesting.js
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Processor = exports.Client = exports.GetParticipations__Result = exports.GetParticipations__ResultCodec = exports.GetParticipations__Args = exports.GetParticipations__ArgsCodec = exports.methodParameters = exports.methodNames = exports.methodAnnotations = exports.annotations = exports.serviceName = void 0;
|
|
27
|
+
/* tslint:disable */
|
|
28
|
+
/* eslint-disable */
|
|
29
|
+
/*
|
|
30
|
+
* Autogenerated by @creditkarma/thrift-typescript v3.7.6
|
|
31
|
+
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
|
32
|
+
*/
|
|
33
|
+
const thrift = __importStar(require("@creditkarma/thrift-server-core"));
|
|
34
|
+
exports.serviceName = "AbTesting";
|
|
35
|
+
exports.annotations = {};
|
|
36
|
+
exports.methodAnnotations = {
|
|
37
|
+
getParticipations: {
|
|
38
|
+
annotations: {},
|
|
39
|
+
fieldAnnotations: {}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
exports.methodNames = ["getParticipations"];
|
|
43
|
+
exports.methodParameters = {
|
|
44
|
+
getParticipations: 1
|
|
45
|
+
};
|
|
46
|
+
exports.GetParticipations__ArgsCodec = {
|
|
47
|
+
encode(args, output) {
|
|
48
|
+
output.writeStructBegin("GetParticipations__Args");
|
|
49
|
+
output.writeFieldStop();
|
|
50
|
+
output.writeStructEnd();
|
|
51
|
+
return;
|
|
52
|
+
},
|
|
53
|
+
decode(input) {
|
|
54
|
+
input.readStructBegin();
|
|
55
|
+
while (true) {
|
|
56
|
+
const ret = input.readFieldBegin();
|
|
57
|
+
const fieldType = ret.fieldType;
|
|
58
|
+
const fieldId = ret.fieldId;
|
|
59
|
+
if (fieldType === thrift.TType.STOP) {
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
switch (fieldId) {
|
|
63
|
+
default: {
|
|
64
|
+
input.skip(fieldType);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
input.readFieldEnd();
|
|
68
|
+
}
|
|
69
|
+
input.readStructEnd();
|
|
70
|
+
return {};
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
class GetParticipations__Args extends thrift.StructLike {
|
|
74
|
+
constructor(args = {}) {
|
|
75
|
+
super();
|
|
76
|
+
this._annotations = {};
|
|
77
|
+
this._fieldAnnotations = {};
|
|
78
|
+
}
|
|
79
|
+
static read(input) {
|
|
80
|
+
return new GetParticipations__Args(exports.GetParticipations__ArgsCodec.decode(input));
|
|
81
|
+
}
|
|
82
|
+
static write(args, output) {
|
|
83
|
+
return exports.GetParticipations__ArgsCodec.encode(args, output);
|
|
84
|
+
}
|
|
85
|
+
write(output) {
|
|
86
|
+
return exports.GetParticipations__ArgsCodec.encode(this, output);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.GetParticipations__Args = GetParticipations__Args;
|
|
90
|
+
exports.GetParticipations__ResultCodec = {
|
|
91
|
+
encode(args, output) {
|
|
92
|
+
const obj = {
|
|
93
|
+
success: args.success
|
|
94
|
+
};
|
|
95
|
+
output.writeStructBegin("GetParticipations__Result");
|
|
96
|
+
if (obj.success != null) {
|
|
97
|
+
output.writeFieldBegin("success", thrift.TType.MAP, 0);
|
|
98
|
+
output.writeMapBegin(thrift.TType.STRING, thrift.TType.STRING, obj.success.size);
|
|
99
|
+
obj.success.forEach((value_1, key_1) => {
|
|
100
|
+
output.writeString(key_1);
|
|
101
|
+
output.writeString(value_1);
|
|
102
|
+
});
|
|
103
|
+
output.writeMapEnd();
|
|
104
|
+
output.writeFieldEnd();
|
|
105
|
+
}
|
|
106
|
+
output.writeFieldStop();
|
|
107
|
+
output.writeStructEnd();
|
|
108
|
+
return;
|
|
109
|
+
},
|
|
110
|
+
decode(input) {
|
|
111
|
+
let _args = {};
|
|
112
|
+
input.readStructBegin();
|
|
113
|
+
while (true) {
|
|
114
|
+
const ret = input.readFieldBegin();
|
|
115
|
+
const fieldType = ret.fieldType;
|
|
116
|
+
const fieldId = ret.fieldId;
|
|
117
|
+
if (fieldType === thrift.TType.STOP) {
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
switch (fieldId) {
|
|
121
|
+
case 0:
|
|
122
|
+
if (fieldType === thrift.TType.MAP) {
|
|
123
|
+
const value_2 = new Map();
|
|
124
|
+
const metadata_1 = input.readMapBegin();
|
|
125
|
+
const size_1 = metadata_1.size;
|
|
126
|
+
for (let i_1 = 0; i_1 < size_1; i_1++) {
|
|
127
|
+
const key_2 = input.readString();
|
|
128
|
+
const value_3 = input.readString();
|
|
129
|
+
value_2.set(key_2, value_3);
|
|
130
|
+
}
|
|
131
|
+
input.readMapEnd();
|
|
132
|
+
_args.success = value_2;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
input.skip(fieldType);
|
|
136
|
+
}
|
|
137
|
+
break;
|
|
138
|
+
default: {
|
|
139
|
+
input.skip(fieldType);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
input.readFieldEnd();
|
|
143
|
+
}
|
|
144
|
+
input.readStructEnd();
|
|
145
|
+
return {
|
|
146
|
+
success: _args.success
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
class GetParticipations__Result extends thrift.StructLike {
|
|
151
|
+
constructor(args = {}) {
|
|
152
|
+
super();
|
|
153
|
+
this._annotations = {};
|
|
154
|
+
this._fieldAnnotations = {};
|
|
155
|
+
if (args.success != null) {
|
|
156
|
+
const value_4 = new Map();
|
|
157
|
+
args.success.forEach((value_5, key_3) => {
|
|
158
|
+
const value_6 = value_5;
|
|
159
|
+
const key_4 = key_3;
|
|
160
|
+
value_4.set(key_4, value_6);
|
|
161
|
+
});
|
|
162
|
+
this.success = value_4;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
static read(input) {
|
|
166
|
+
return new GetParticipations__Result(exports.GetParticipations__ResultCodec.decode(input));
|
|
167
|
+
}
|
|
168
|
+
static write(args, output) {
|
|
169
|
+
return exports.GetParticipations__ResultCodec.encode(args, output);
|
|
170
|
+
}
|
|
171
|
+
write(output) {
|
|
172
|
+
return exports.GetParticipations__ResultCodec.encode(this, output);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
exports.GetParticipations__Result = GetParticipations__Result;
|
|
176
|
+
class Client extends thrift.ThriftClient {
|
|
177
|
+
constructor() {
|
|
178
|
+
super(...arguments);
|
|
179
|
+
this._serviceName = exports.serviceName;
|
|
180
|
+
this._annotations = exports.annotations;
|
|
181
|
+
this._methodAnnotations = exports.methodAnnotations;
|
|
182
|
+
this._methodNames = exports.methodNames;
|
|
183
|
+
this._methodParameters = exports.methodParameters;
|
|
184
|
+
}
|
|
185
|
+
getParticipations(context) {
|
|
186
|
+
const writer = new this.transport();
|
|
187
|
+
const output = new this.protocol(writer);
|
|
188
|
+
output.writeMessageBegin("getParticipations", thrift.MessageType.CALL, this.incrementRequestId());
|
|
189
|
+
const args = {};
|
|
190
|
+
exports.GetParticipations__ArgsCodec.encode(args, output);
|
|
191
|
+
output.writeMessageEnd();
|
|
192
|
+
return this.connection.send(writer.flush(), context).then((data) => {
|
|
193
|
+
const reader = this.transport.receiver(data);
|
|
194
|
+
const input = new this.protocol(reader);
|
|
195
|
+
try {
|
|
196
|
+
const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
|
|
197
|
+
if (fieldName === "getParticipations") {
|
|
198
|
+
if (messageType === thrift.MessageType.EXCEPTION) {
|
|
199
|
+
const err = thrift.TApplicationExceptionCodec.decode(input);
|
|
200
|
+
input.readMessageEnd();
|
|
201
|
+
return Promise.reject(err);
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
const result = exports.GetParticipations__ResultCodec.decode(input);
|
|
205
|
+
input.readMessageEnd();
|
|
206
|
+
if (result.success != null) {
|
|
207
|
+
return Promise.resolve(result.success);
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "getParticipations failed: unknown result"));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
catch (err) {
|
|
219
|
+
return Promise.reject(err);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
exports.Client = Client;
|
|
225
|
+
Client.serviceName = exports.serviceName;
|
|
226
|
+
Client.annotations = exports.annotations;
|
|
227
|
+
Client.methodAnnotations = exports.methodAnnotations;
|
|
228
|
+
Client.methodNames = exports.methodNames;
|
|
229
|
+
class Processor extends thrift.ThriftProcessor {
|
|
230
|
+
constructor(handler) {
|
|
231
|
+
super();
|
|
232
|
+
this._serviceName = exports.serviceName;
|
|
233
|
+
this._annotations = exports.annotations;
|
|
234
|
+
this._methodAnnotations = exports.methodAnnotations;
|
|
235
|
+
this._methodNames = exports.methodNames;
|
|
236
|
+
this._handler = handler;
|
|
237
|
+
}
|
|
238
|
+
process(input, output, context) {
|
|
239
|
+
return new Promise((resolve, reject) => {
|
|
240
|
+
const metadata = input.readMessageBegin();
|
|
241
|
+
const fieldName = metadata.fieldName;
|
|
242
|
+
const requestId = metadata.requestId;
|
|
243
|
+
const methodName = "process_" + fieldName;
|
|
244
|
+
switch (methodName) {
|
|
245
|
+
case "process_getParticipations": {
|
|
246
|
+
resolve(this.process_getParticipations(requestId, input, output, context));
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
default: {
|
|
250
|
+
input.skip(thrift.TType.STRUCT);
|
|
251
|
+
input.readMessageEnd();
|
|
252
|
+
const errMessage = "Unknown function " + fieldName;
|
|
253
|
+
const err = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN_METHOD, errMessage);
|
|
254
|
+
output.writeMessageBegin(fieldName, thrift.MessageType.EXCEPTION, requestId);
|
|
255
|
+
thrift.TApplicationExceptionCodec.encode(err, output);
|
|
256
|
+
output.writeMessageEnd();
|
|
257
|
+
resolve(output.flush());
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
process_getParticipations(requestId, input, output, context) {
|
|
264
|
+
return new Promise((resolve, reject) => {
|
|
265
|
+
try {
|
|
266
|
+
input.readMessageEnd();
|
|
267
|
+
resolve(this._handler.getParticipations(context));
|
|
268
|
+
}
|
|
269
|
+
catch (err) {
|
|
270
|
+
reject(err);
|
|
271
|
+
}
|
|
272
|
+
}).then((data) => {
|
|
273
|
+
const result = { success: data };
|
|
274
|
+
output.writeMessageBegin("getParticipations", thrift.MessageType.REPLY, requestId);
|
|
275
|
+
exports.GetParticipations__ResultCodec.encode(result, output);
|
|
276
|
+
output.writeMessageEnd();
|
|
277
|
+
return output.flush();
|
|
278
|
+
}).catch((err) => {
|
|
279
|
+
const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
|
280
|
+
output.writeMessageBegin("getParticipations", thrift.MessageType.EXCEPTION, requestId);
|
|
281
|
+
thrift.TApplicationExceptionCodec.encode(result, output);
|
|
282
|
+
output.writeMessageEnd();
|
|
283
|
+
return output.flush();
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
exports.Processor = Processor;
|
|
288
|
+
Processor.serviceName = exports.serviceName;
|
|
289
|
+
Processor.annotations = exports.annotations;
|
|
290
|
+
Processor.methodAnnotations = exports.methodAnnotations;
|
|
291
|
+
Processor.methodNames = exports.methodNames;
|
package/ListenToArticle.d.ts
CHANGED
|
@@ -24,6 +24,22 @@ export declare class IsAvailable__Args extends thrift.StructLike implements IIsA
|
|
|
24
24
|
static write(args: IIsAvailable__ArgsArgs, output: thrift.TProtocol): void;
|
|
25
25
|
write(output: thrift.TProtocol): void;
|
|
26
26
|
}
|
|
27
|
+
export interface IGetAudioDurationSeconds__Args {
|
|
28
|
+
articleId: string;
|
|
29
|
+
}
|
|
30
|
+
export interface IGetAudioDurationSeconds__ArgsArgs {
|
|
31
|
+
articleId: string;
|
|
32
|
+
}
|
|
33
|
+
export declare const GetAudioDurationSeconds__ArgsCodec: thrift.IStructCodec<IGetAudioDurationSeconds__ArgsArgs, IGetAudioDurationSeconds__Args>;
|
|
34
|
+
export declare class GetAudioDurationSeconds__Args extends thrift.StructLike implements IGetAudioDurationSeconds__Args {
|
|
35
|
+
articleId: string;
|
|
36
|
+
readonly _annotations: thrift.IThriftAnnotations;
|
|
37
|
+
readonly _fieldAnnotations: thrift.IFieldAnnotations;
|
|
38
|
+
constructor(args: IGetAudioDurationSeconds__ArgsArgs);
|
|
39
|
+
static read(input: thrift.TProtocol): GetAudioDurationSeconds__Args;
|
|
40
|
+
static write(args: IGetAudioDurationSeconds__ArgsArgs, output: thrift.TProtocol): void;
|
|
41
|
+
write(output: thrift.TProtocol): void;
|
|
42
|
+
}
|
|
27
43
|
export interface IPlay__Args {
|
|
28
44
|
articleId: string;
|
|
29
45
|
}
|
|
@@ -88,6 +104,22 @@ export declare class IsAvailable__Result extends thrift.StructLike implements II
|
|
|
88
104
|
static write(args: IIsAvailable__ResultArgs, output: thrift.TProtocol): void;
|
|
89
105
|
write(output: thrift.TProtocol): void;
|
|
90
106
|
}
|
|
107
|
+
export interface IGetAudioDurationSeconds__Result {
|
|
108
|
+
success?: number;
|
|
109
|
+
}
|
|
110
|
+
export interface IGetAudioDurationSeconds__ResultArgs {
|
|
111
|
+
success?: number;
|
|
112
|
+
}
|
|
113
|
+
export declare const GetAudioDurationSeconds__ResultCodec: thrift.IStructCodec<IGetAudioDurationSeconds__ResultArgs, IGetAudioDurationSeconds__Result>;
|
|
114
|
+
export declare class GetAudioDurationSeconds__Result extends thrift.StructLike implements IGetAudioDurationSeconds__Result {
|
|
115
|
+
success?: number;
|
|
116
|
+
readonly _annotations: thrift.IThriftAnnotations;
|
|
117
|
+
readonly _fieldAnnotations: thrift.IFieldAnnotations;
|
|
118
|
+
constructor(args?: IGetAudioDurationSeconds__ResultArgs);
|
|
119
|
+
static read(input: thrift.TProtocol): GetAudioDurationSeconds__Result;
|
|
120
|
+
static write(args: IGetAudioDurationSeconds__ResultArgs, output: thrift.TProtocol): void;
|
|
121
|
+
write(output: thrift.TProtocol): void;
|
|
122
|
+
}
|
|
91
123
|
export interface IPlay__Result {
|
|
92
124
|
success?: boolean;
|
|
93
125
|
}
|
|
@@ -149,12 +181,14 @@ export declare class Client<Context = any> extends thrift.ThriftClient<Context>
|
|
|
149
181
|
[methodName: string]: number;
|
|
150
182
|
};
|
|
151
183
|
isAvailable(articleId: string, context?: Context): Promise<boolean>;
|
|
184
|
+
getAudioDurationSeconds(articleId: string, context?: Context): Promise<number>;
|
|
152
185
|
play(articleId: string, context?: Context): Promise<boolean>;
|
|
153
186
|
isPlaying(articleId: string, context?: Context): Promise<boolean>;
|
|
154
187
|
pause(articleId: string, context?: Context): Promise<boolean>;
|
|
155
188
|
}
|
|
156
189
|
export interface IHandler<Context = any> {
|
|
157
190
|
isAvailable(articleId: string, context?: Context): boolean | Promise<boolean>;
|
|
191
|
+
getAudioDurationSeconds(articleId: string, context?: Context): number | Promise<number>;
|
|
158
192
|
play(articleId: string, context?: Context): boolean | Promise<boolean>;
|
|
159
193
|
isPlaying(articleId: string, context?: Context): boolean | Promise<boolean>;
|
|
160
194
|
pause(articleId: string, context?: Context): boolean | Promise<boolean>;
|
|
@@ -172,6 +206,7 @@ export declare class Processor<Context = any> extends thrift.ThriftProcessor<Con
|
|
|
172
206
|
constructor(handler: IHandler<Context>);
|
|
173
207
|
process(input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
|
|
174
208
|
process_isAvailable(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
|
|
209
|
+
process_getAudioDurationSeconds(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
|
|
175
210
|
process_play(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
|
|
176
211
|
process_isPlaying(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
|
|
177
212
|
process_pause(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
|
package/ListenToArticle.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.Pause__Result = exports.Pause__ResultCodec = exports.IsPlaying__Result = exports.IsPlaying__ResultCodec = exports.Play__Result = exports.Play__ResultCodec = exports.IsAvailable__Result = exports.IsAvailable__ResultCodec = exports.Pause__Args = exports.Pause__ArgsCodec = exports.IsPlaying__Args = exports.IsPlaying__ArgsCodec = exports.Play__Args = exports.Play__ArgsCodec = exports.IsAvailable__Args = exports.IsAvailable__ArgsCodec = exports.methodParameters = exports.methodNames = exports.methodAnnotations = exports.annotations = exports.serviceName = void 0;
|
|
26
|
+
exports.Processor = exports.Client = exports.Pause__Result = exports.Pause__ResultCodec = exports.IsPlaying__Result = exports.IsPlaying__ResultCodec = exports.Play__Result = exports.Play__ResultCodec = exports.GetAudioDurationSeconds__Result = exports.GetAudioDurationSeconds__ResultCodec = exports.IsAvailable__Result = exports.IsAvailable__ResultCodec = exports.Pause__Args = exports.Pause__ArgsCodec = exports.IsPlaying__Args = exports.IsPlaying__ArgsCodec = exports.Play__Args = exports.Play__ArgsCodec = exports.GetAudioDurationSeconds__Args = exports.GetAudioDurationSeconds__ArgsCodec = exports.IsAvailable__Args = exports.IsAvailable__ArgsCodec = exports.methodParameters = exports.methodNames = exports.methodAnnotations = exports.annotations = exports.serviceName = void 0;
|
|
27
27
|
/* tslint:disable */
|
|
28
28
|
/* eslint-disable */
|
|
29
29
|
/*
|
|
@@ -38,6 +38,10 @@ exports.methodAnnotations = {
|
|
|
38
38
|
annotations: {},
|
|
39
39
|
fieldAnnotations: {}
|
|
40
40
|
},
|
|
41
|
+
getAudioDurationSeconds: {
|
|
42
|
+
annotations: {},
|
|
43
|
+
fieldAnnotations: {}
|
|
44
|
+
},
|
|
41
45
|
play: {
|
|
42
46
|
annotations: {},
|
|
43
47
|
fieldAnnotations: {}
|
|
@@ -51,9 +55,10 @@ exports.methodAnnotations = {
|
|
|
51
55
|
fieldAnnotations: {}
|
|
52
56
|
}
|
|
53
57
|
};
|
|
54
|
-
exports.methodNames = ["isAvailable", "play", "isPlaying", "pause"];
|
|
58
|
+
exports.methodNames = ["isAvailable", "getAudioDurationSeconds", "play", "isPlaying", "pause"];
|
|
55
59
|
exports.methodParameters = {
|
|
56
60
|
isAvailable: 2,
|
|
61
|
+
getAudioDurationSeconds: 2,
|
|
57
62
|
play: 2,
|
|
58
63
|
isPlaying: 2,
|
|
59
64
|
pause: 2
|
|
@@ -137,12 +142,12 @@ class IsAvailable__Args extends thrift.StructLike {
|
|
|
137
142
|
}
|
|
138
143
|
}
|
|
139
144
|
exports.IsAvailable__Args = IsAvailable__Args;
|
|
140
|
-
exports.
|
|
145
|
+
exports.GetAudioDurationSeconds__ArgsCodec = {
|
|
141
146
|
encode(args, output) {
|
|
142
147
|
const obj = {
|
|
143
148
|
articleId: args.articleId
|
|
144
149
|
};
|
|
145
|
-
output.writeStructBegin("
|
|
150
|
+
output.writeStructBegin("GetAudioDurationSeconds__Args");
|
|
146
151
|
if (obj.articleId != null) {
|
|
147
152
|
output.writeFieldBegin("articleId", thrift.TType.STRING, 1);
|
|
148
153
|
output.writeString(obj.articleId);
|
|
@@ -188,11 +193,11 @@ exports.Play__ArgsCodec = {
|
|
|
188
193
|
};
|
|
189
194
|
}
|
|
190
195
|
else {
|
|
191
|
-
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read
|
|
196
|
+
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read GetAudioDurationSeconds__Args from input");
|
|
192
197
|
}
|
|
193
198
|
}
|
|
194
199
|
};
|
|
195
|
-
class
|
|
200
|
+
class GetAudioDurationSeconds__Args extends thrift.StructLike {
|
|
196
201
|
constructor(args) {
|
|
197
202
|
super();
|
|
198
203
|
this._annotations = {};
|
|
@@ -205,6 +210,85 @@ class Play__Args extends thrift.StructLike {
|
|
|
205
210
|
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[articleId] is unset!");
|
|
206
211
|
}
|
|
207
212
|
}
|
|
213
|
+
static read(input) {
|
|
214
|
+
return new GetAudioDurationSeconds__Args(exports.GetAudioDurationSeconds__ArgsCodec.decode(input));
|
|
215
|
+
}
|
|
216
|
+
static write(args, output) {
|
|
217
|
+
return exports.GetAudioDurationSeconds__ArgsCodec.encode(args, output);
|
|
218
|
+
}
|
|
219
|
+
write(output) {
|
|
220
|
+
return exports.GetAudioDurationSeconds__ArgsCodec.encode(this, output);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
exports.GetAudioDurationSeconds__Args = GetAudioDurationSeconds__Args;
|
|
224
|
+
exports.Play__ArgsCodec = {
|
|
225
|
+
encode(args, output) {
|
|
226
|
+
const obj = {
|
|
227
|
+
articleId: args.articleId
|
|
228
|
+
};
|
|
229
|
+
output.writeStructBegin("Play__Args");
|
|
230
|
+
if (obj.articleId != null) {
|
|
231
|
+
output.writeFieldBegin("articleId", thrift.TType.STRING, 1);
|
|
232
|
+
output.writeString(obj.articleId);
|
|
233
|
+
output.writeFieldEnd();
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[articleId] is unset!");
|
|
237
|
+
}
|
|
238
|
+
output.writeFieldStop();
|
|
239
|
+
output.writeStructEnd();
|
|
240
|
+
return;
|
|
241
|
+
},
|
|
242
|
+
decode(input) {
|
|
243
|
+
let _args = {};
|
|
244
|
+
input.readStructBegin();
|
|
245
|
+
while (true) {
|
|
246
|
+
const ret = input.readFieldBegin();
|
|
247
|
+
const fieldType = ret.fieldType;
|
|
248
|
+
const fieldId = ret.fieldId;
|
|
249
|
+
if (fieldType === thrift.TType.STOP) {
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
switch (fieldId) {
|
|
253
|
+
case 1:
|
|
254
|
+
if (fieldType === thrift.TType.STRING) {
|
|
255
|
+
const value_5 = input.readString();
|
|
256
|
+
_args.articleId = value_5;
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
input.skip(fieldType);
|
|
260
|
+
}
|
|
261
|
+
break;
|
|
262
|
+
default: {
|
|
263
|
+
input.skip(fieldType);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
input.readFieldEnd();
|
|
267
|
+
}
|
|
268
|
+
input.readStructEnd();
|
|
269
|
+
if (_args.articleId !== undefined) {
|
|
270
|
+
return {
|
|
271
|
+
articleId: _args.articleId
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read Play__Args from input");
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
class Play__Args extends thrift.StructLike {
|
|
280
|
+
constructor(args) {
|
|
281
|
+
super();
|
|
282
|
+
this._annotations = {};
|
|
283
|
+
this._fieldAnnotations = {};
|
|
284
|
+
if (args.articleId != null) {
|
|
285
|
+
const value_6 = args.articleId;
|
|
286
|
+
this.articleId = value_6;
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[articleId] is unset!");
|
|
290
|
+
}
|
|
291
|
+
}
|
|
208
292
|
static read(input) {
|
|
209
293
|
return new Play__Args(exports.Play__ArgsCodec.decode(input));
|
|
210
294
|
}
|
|
@@ -247,8 +331,8 @@ exports.IsPlaying__ArgsCodec = {
|
|
|
247
331
|
switch (fieldId) {
|
|
248
332
|
case 1:
|
|
249
333
|
if (fieldType === thrift.TType.STRING) {
|
|
250
|
-
const
|
|
251
|
-
_args.articleId =
|
|
334
|
+
const value_7 = input.readString();
|
|
335
|
+
_args.articleId = value_7;
|
|
252
336
|
}
|
|
253
337
|
else {
|
|
254
338
|
input.skip(fieldType);
|
|
@@ -277,8 +361,8 @@ class IsPlaying__Args extends thrift.StructLike {
|
|
|
277
361
|
this._annotations = {};
|
|
278
362
|
this._fieldAnnotations = {};
|
|
279
363
|
if (args.articleId != null) {
|
|
280
|
-
const
|
|
281
|
-
this.articleId =
|
|
364
|
+
const value_8 = args.articleId;
|
|
365
|
+
this.articleId = value_8;
|
|
282
366
|
}
|
|
283
367
|
else {
|
|
284
368
|
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[articleId] is unset!");
|
|
@@ -326,8 +410,8 @@ exports.Pause__ArgsCodec = {
|
|
|
326
410
|
switch (fieldId) {
|
|
327
411
|
case 1:
|
|
328
412
|
if (fieldType === thrift.TType.STRING) {
|
|
329
|
-
const
|
|
330
|
-
_args.articleId =
|
|
413
|
+
const value_9 = input.readString();
|
|
414
|
+
_args.articleId = value_9;
|
|
331
415
|
}
|
|
332
416
|
else {
|
|
333
417
|
input.skip(fieldType);
|
|
@@ -356,8 +440,8 @@ class Pause__Args extends thrift.StructLike {
|
|
|
356
440
|
this._annotations = {};
|
|
357
441
|
this._fieldAnnotations = {};
|
|
358
442
|
if (args.articleId != null) {
|
|
359
|
-
const
|
|
360
|
-
this.articleId =
|
|
443
|
+
const value_10 = args.articleId;
|
|
444
|
+
this.articleId = value_10;
|
|
361
445
|
}
|
|
362
446
|
else {
|
|
363
447
|
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[articleId] is unset!");
|
|
@@ -402,8 +486,8 @@ exports.IsAvailable__ResultCodec = {
|
|
|
402
486
|
switch (fieldId) {
|
|
403
487
|
case 0:
|
|
404
488
|
if (fieldType === thrift.TType.BOOL) {
|
|
405
|
-
const
|
|
406
|
-
_args.success =
|
|
489
|
+
const value_11 = input.readBool();
|
|
490
|
+
_args.success = value_11;
|
|
407
491
|
}
|
|
408
492
|
else {
|
|
409
493
|
input.skip(fieldType);
|
|
@@ -427,8 +511,8 @@ class IsAvailable__Result extends thrift.StructLike {
|
|
|
427
511
|
this._annotations = {};
|
|
428
512
|
this._fieldAnnotations = {};
|
|
429
513
|
if (args.success != null) {
|
|
430
|
-
const
|
|
431
|
-
this.success =
|
|
514
|
+
const value_12 = args.success;
|
|
515
|
+
this.success = value_12;
|
|
432
516
|
}
|
|
433
517
|
}
|
|
434
518
|
static read(input) {
|
|
@@ -442,6 +526,74 @@ class IsAvailable__Result extends thrift.StructLike {
|
|
|
442
526
|
}
|
|
443
527
|
}
|
|
444
528
|
exports.IsAvailable__Result = IsAvailable__Result;
|
|
529
|
+
exports.GetAudioDurationSeconds__ResultCodec = {
|
|
530
|
+
encode(args, output) {
|
|
531
|
+
const obj = {
|
|
532
|
+
success: args.success
|
|
533
|
+
};
|
|
534
|
+
output.writeStructBegin("GetAudioDurationSeconds__Result");
|
|
535
|
+
if (obj.success != null) {
|
|
536
|
+
output.writeFieldBegin("success", thrift.TType.I32, 0);
|
|
537
|
+
output.writeI32(obj.success);
|
|
538
|
+
output.writeFieldEnd();
|
|
539
|
+
}
|
|
540
|
+
output.writeFieldStop();
|
|
541
|
+
output.writeStructEnd();
|
|
542
|
+
return;
|
|
543
|
+
},
|
|
544
|
+
decode(input) {
|
|
545
|
+
let _args = {};
|
|
546
|
+
input.readStructBegin();
|
|
547
|
+
while (true) {
|
|
548
|
+
const ret = input.readFieldBegin();
|
|
549
|
+
const fieldType = ret.fieldType;
|
|
550
|
+
const fieldId = ret.fieldId;
|
|
551
|
+
if (fieldType === thrift.TType.STOP) {
|
|
552
|
+
break;
|
|
553
|
+
}
|
|
554
|
+
switch (fieldId) {
|
|
555
|
+
case 0:
|
|
556
|
+
if (fieldType === thrift.TType.I32) {
|
|
557
|
+
const value_13 = input.readI32();
|
|
558
|
+
_args.success = value_13;
|
|
559
|
+
}
|
|
560
|
+
else {
|
|
561
|
+
input.skip(fieldType);
|
|
562
|
+
}
|
|
563
|
+
break;
|
|
564
|
+
default: {
|
|
565
|
+
input.skip(fieldType);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
input.readFieldEnd();
|
|
569
|
+
}
|
|
570
|
+
input.readStructEnd();
|
|
571
|
+
return {
|
|
572
|
+
success: _args.success
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
class GetAudioDurationSeconds__Result extends thrift.StructLike {
|
|
577
|
+
constructor(args = {}) {
|
|
578
|
+
super();
|
|
579
|
+
this._annotations = {};
|
|
580
|
+
this._fieldAnnotations = {};
|
|
581
|
+
if (args.success != null) {
|
|
582
|
+
const value_14 = args.success;
|
|
583
|
+
this.success = value_14;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
static read(input) {
|
|
587
|
+
return new GetAudioDurationSeconds__Result(exports.GetAudioDurationSeconds__ResultCodec.decode(input));
|
|
588
|
+
}
|
|
589
|
+
static write(args, output) {
|
|
590
|
+
return exports.GetAudioDurationSeconds__ResultCodec.encode(args, output);
|
|
591
|
+
}
|
|
592
|
+
write(output) {
|
|
593
|
+
return exports.GetAudioDurationSeconds__ResultCodec.encode(this, output);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
exports.GetAudioDurationSeconds__Result = GetAudioDurationSeconds__Result;
|
|
445
597
|
exports.Play__ResultCodec = {
|
|
446
598
|
encode(args, output) {
|
|
447
599
|
const obj = {
|
|
@@ -470,8 +622,8 @@ exports.Play__ResultCodec = {
|
|
|
470
622
|
switch (fieldId) {
|
|
471
623
|
case 0:
|
|
472
624
|
if (fieldType === thrift.TType.BOOL) {
|
|
473
|
-
const
|
|
474
|
-
_args.success =
|
|
625
|
+
const value_15 = input.readBool();
|
|
626
|
+
_args.success = value_15;
|
|
475
627
|
}
|
|
476
628
|
else {
|
|
477
629
|
input.skip(fieldType);
|
|
@@ -495,8 +647,8 @@ class Play__Result extends thrift.StructLike {
|
|
|
495
647
|
this._annotations = {};
|
|
496
648
|
this._fieldAnnotations = {};
|
|
497
649
|
if (args.success != null) {
|
|
498
|
-
const
|
|
499
|
-
this.success =
|
|
650
|
+
const value_16 = args.success;
|
|
651
|
+
this.success = value_16;
|
|
500
652
|
}
|
|
501
653
|
}
|
|
502
654
|
static read(input) {
|
|
@@ -538,8 +690,8 @@ exports.IsPlaying__ResultCodec = {
|
|
|
538
690
|
switch (fieldId) {
|
|
539
691
|
case 0:
|
|
540
692
|
if (fieldType === thrift.TType.BOOL) {
|
|
541
|
-
const
|
|
542
|
-
_args.success =
|
|
693
|
+
const value_17 = input.readBool();
|
|
694
|
+
_args.success = value_17;
|
|
543
695
|
}
|
|
544
696
|
else {
|
|
545
697
|
input.skip(fieldType);
|
|
@@ -563,8 +715,8 @@ class IsPlaying__Result extends thrift.StructLike {
|
|
|
563
715
|
this._annotations = {};
|
|
564
716
|
this._fieldAnnotations = {};
|
|
565
717
|
if (args.success != null) {
|
|
566
|
-
const
|
|
567
|
-
this.success =
|
|
718
|
+
const value_18 = args.success;
|
|
719
|
+
this.success = value_18;
|
|
568
720
|
}
|
|
569
721
|
}
|
|
570
722
|
static read(input) {
|
|
@@ -606,8 +758,8 @@ exports.Pause__ResultCodec = {
|
|
|
606
758
|
switch (fieldId) {
|
|
607
759
|
case 0:
|
|
608
760
|
if (fieldType === thrift.TType.BOOL) {
|
|
609
|
-
const
|
|
610
|
-
_args.success =
|
|
761
|
+
const value_19 = input.readBool();
|
|
762
|
+
_args.success = value_19;
|
|
611
763
|
}
|
|
612
764
|
else {
|
|
613
765
|
input.skip(fieldType);
|
|
@@ -631,8 +783,8 @@ class Pause__Result extends thrift.StructLike {
|
|
|
631
783
|
this._annotations = {};
|
|
632
784
|
this._fieldAnnotations = {};
|
|
633
785
|
if (args.success != null) {
|
|
634
|
-
const
|
|
635
|
-
this.success =
|
|
786
|
+
const value_20 = args.success;
|
|
787
|
+
this.success = value_20;
|
|
636
788
|
}
|
|
637
789
|
}
|
|
638
790
|
static read(input) {
|
|
@@ -693,6 +845,44 @@ class Client extends thrift.ThriftClient {
|
|
|
693
845
|
}
|
|
694
846
|
});
|
|
695
847
|
}
|
|
848
|
+
getAudioDurationSeconds(articleId, context) {
|
|
849
|
+
const writer = new this.transport();
|
|
850
|
+
const output = new this.protocol(writer);
|
|
851
|
+
output.writeMessageBegin("getAudioDurationSeconds", thrift.MessageType.CALL, this.incrementRequestId());
|
|
852
|
+
const args = { articleId };
|
|
853
|
+
exports.GetAudioDurationSeconds__ArgsCodec.encode(args, output);
|
|
854
|
+
output.writeMessageEnd();
|
|
855
|
+
return this.connection.send(writer.flush(), context).then((data) => {
|
|
856
|
+
const reader = this.transport.receiver(data);
|
|
857
|
+
const input = new this.protocol(reader);
|
|
858
|
+
try {
|
|
859
|
+
const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
|
|
860
|
+
if (fieldName === "getAudioDurationSeconds") {
|
|
861
|
+
if (messageType === thrift.MessageType.EXCEPTION) {
|
|
862
|
+
const err = thrift.TApplicationExceptionCodec.decode(input);
|
|
863
|
+
input.readMessageEnd();
|
|
864
|
+
return Promise.reject(err);
|
|
865
|
+
}
|
|
866
|
+
else {
|
|
867
|
+
const result = exports.GetAudioDurationSeconds__ResultCodec.decode(input);
|
|
868
|
+
input.readMessageEnd();
|
|
869
|
+
if (result.success != null) {
|
|
870
|
+
return Promise.resolve(result.success);
|
|
871
|
+
}
|
|
872
|
+
else {
|
|
873
|
+
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "getAudioDurationSeconds failed: unknown result"));
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
else {
|
|
878
|
+
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName));
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
catch (err) {
|
|
882
|
+
return Promise.reject(err);
|
|
883
|
+
}
|
|
884
|
+
});
|
|
885
|
+
}
|
|
696
886
|
play(articleId, context) {
|
|
697
887
|
const writer = new this.transport();
|
|
698
888
|
const output = new this.protocol(writer);
|
|
@@ -833,6 +1023,10 @@ class Processor extends thrift.ThriftProcessor {
|
|
|
833
1023
|
resolve(this.process_isAvailable(requestId, input, output, context));
|
|
834
1024
|
break;
|
|
835
1025
|
}
|
|
1026
|
+
case "process_getAudioDurationSeconds": {
|
|
1027
|
+
resolve(this.process_getAudioDurationSeconds(requestId, input, output, context));
|
|
1028
|
+
break;
|
|
1029
|
+
}
|
|
836
1030
|
case "process_play": {
|
|
837
1031
|
resolve(this.process_play(requestId, input, output, context));
|
|
838
1032
|
break;
|
|
@@ -883,6 +1077,30 @@ class Processor extends thrift.ThriftProcessor {
|
|
|
883
1077
|
return output.flush();
|
|
884
1078
|
});
|
|
885
1079
|
}
|
|
1080
|
+
process_getAudioDurationSeconds(requestId, input, output, context) {
|
|
1081
|
+
return new Promise((resolve, reject) => {
|
|
1082
|
+
try {
|
|
1083
|
+
const args = exports.GetAudioDurationSeconds__ArgsCodec.decode(input);
|
|
1084
|
+
input.readMessageEnd();
|
|
1085
|
+
resolve(this._handler.getAudioDurationSeconds(args.articleId, context));
|
|
1086
|
+
}
|
|
1087
|
+
catch (err) {
|
|
1088
|
+
reject(err);
|
|
1089
|
+
}
|
|
1090
|
+
}).then((data) => {
|
|
1091
|
+
const result = { success: data };
|
|
1092
|
+
output.writeMessageBegin("getAudioDurationSeconds", thrift.MessageType.REPLY, requestId);
|
|
1093
|
+
exports.GetAudioDurationSeconds__ResultCodec.encode(result, output);
|
|
1094
|
+
output.writeMessageEnd();
|
|
1095
|
+
return output.flush();
|
|
1096
|
+
}).catch((err) => {
|
|
1097
|
+
const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
|
1098
|
+
output.writeMessageBegin("getAudioDurationSeconds", thrift.MessageType.EXCEPTION, requestId);
|
|
1099
|
+
thrift.TApplicationExceptionCodec.encode(result, output);
|
|
1100
|
+
output.writeMessageEnd();
|
|
1101
|
+
return output.flush();
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
886
1104
|
process_play(requestId, input, output, context) {
|
|
887
1105
|
return new Promise((resolve, reject) => {
|
|
888
1106
|
try {
|
package/index.d.ts
CHANGED
|
@@ -40,6 +40,8 @@ import * as Discussion from "./Discussion";
|
|
|
40
40
|
export { Discussion as Discussion };
|
|
41
41
|
import * as Analytics from "./Analytics";
|
|
42
42
|
export { Analytics as Analytics };
|
|
43
|
+
import * as AbTesting from "./AbTesting";
|
|
44
|
+
export { AbTesting as AbTesting };
|
|
43
45
|
import * as Navigation from "./Navigation";
|
|
44
46
|
export { Navigation as Navigation };
|
|
45
47
|
import * as Newsletters from "./Newsletters";
|
package/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26
26
|
return result;
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.Interactives = exports.Interaction = exports.Newsletters = exports.Navigation = exports.Analytics = exports.Discussion = exports.Metrics = exports.Videos = exports.Gallery = exports.User = exports.ListenToArticle = exports.Notifications = exports.Tag = exports.Acquisitions = exports.Commercial = exports.Environment = void 0;
|
|
29
|
+
exports.Interactives = exports.Interaction = exports.Newsletters = exports.Navigation = exports.AbTesting = exports.Analytics = exports.Discussion = exports.Metrics = exports.Videos = exports.Gallery = exports.User = exports.ListenToArticle = exports.Notifications = exports.Tag = exports.Acquisitions = exports.Commercial = exports.Environment = void 0;
|
|
30
30
|
/* tslint:disable */
|
|
31
31
|
/* eslint-disable */
|
|
32
32
|
/*
|
|
@@ -75,6 +75,8 @@ const Discussion = __importStar(require("./Discussion"));
|
|
|
75
75
|
exports.Discussion = Discussion;
|
|
76
76
|
const Analytics = __importStar(require("./Analytics"));
|
|
77
77
|
exports.Analytics = Analytics;
|
|
78
|
+
const AbTesting = __importStar(require("./AbTesting"));
|
|
79
|
+
exports.AbTesting = AbTesting;
|
|
78
80
|
const Navigation = __importStar(require("./Navigation"));
|
|
79
81
|
exports.Navigation = Navigation;
|
|
80
82
|
const Newsletters = __importStar(require("./Newsletters"));
|