@guardian/bridget 8.5.0 → 8.6.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/Environment.d.ts CHANGED
@@ -34,19 +34,6 @@ export declare class IsMyGuardianEnabled__Args extends thrift.StructLike impleme
34
34
  static write(args: IIsMyGuardianEnabled__ArgsArgs, output: thrift.TProtocol): void;
35
35
  write(output: thrift.TProtocol): void;
36
36
  }
37
- export interface IIsListenToArticleEnabled__Args {
38
- }
39
- export interface IIsListenToArticleEnabled__ArgsArgs {
40
- }
41
- export declare const IsListenToArticleEnabled__ArgsCodec: thrift.IStructCodec<IIsListenToArticleEnabled__ArgsArgs, IIsListenToArticleEnabled__Args>;
42
- export declare class IsListenToArticleEnabled__Args extends thrift.StructLike implements IIsListenToArticleEnabled__Args {
43
- readonly _annotations: thrift.IThriftAnnotations;
44
- readonly _fieldAnnotations: thrift.IFieldAnnotations;
45
- constructor(args?: IIsListenToArticleEnabled__ArgsArgs);
46
- static read(input: thrift.TProtocol): IsListenToArticleEnabled__Args;
47
- static write(args: IIsListenToArticleEnabled__ArgsArgs, output: thrift.TProtocol): void;
48
- write(output: thrift.TProtocol): void;
49
- }
50
37
  export interface INativeThriftPackageVersion__Result {
51
38
  success?: string;
52
39
  }
@@ -79,22 +66,6 @@ export declare class IsMyGuardianEnabled__Result extends thrift.StructLike imple
79
66
  static write(args: IIsMyGuardianEnabled__ResultArgs, output: thrift.TProtocol): void;
80
67
  write(output: thrift.TProtocol): void;
81
68
  }
82
- export interface IIsListenToArticleEnabled__Result {
83
- success?: boolean;
84
- }
85
- export interface IIsListenToArticleEnabled__ResultArgs {
86
- success?: boolean;
87
- }
88
- export declare const IsListenToArticleEnabled__ResultCodec: thrift.IStructCodec<IIsListenToArticleEnabled__ResultArgs, IIsListenToArticleEnabled__Result>;
89
- export declare class IsListenToArticleEnabled__Result extends thrift.StructLike implements IIsListenToArticleEnabled__Result {
90
- success?: boolean;
91
- readonly _annotations: thrift.IThriftAnnotations;
92
- readonly _fieldAnnotations: thrift.IFieldAnnotations;
93
- constructor(args?: IIsListenToArticleEnabled__ResultArgs);
94
- static read(input: thrift.TProtocol): IsListenToArticleEnabled__Result;
95
- static write(args: IIsListenToArticleEnabled__ResultArgs, output: thrift.TProtocol): void;
96
- write(output: thrift.TProtocol): void;
97
- }
98
69
  export declare class Client<Context = any> extends thrift.ThriftClient<Context> {
99
70
  static readonly serviceName: string;
100
71
  static readonly annotations: thrift.IThriftAnnotations;
@@ -109,12 +80,10 @@ export declare class Client<Context = any> extends thrift.ThriftClient<Context>
109
80
  };
110
81
  nativeThriftPackageVersion(context?: Context): Promise<string>;
111
82
  isMyGuardianEnabled(context?: Context): Promise<boolean>;
112
- isListenToArticleEnabled(context?: Context): Promise<boolean>;
113
83
  }
114
84
  export interface IHandler<Context = any> {
115
85
  nativeThriftPackageVersion(context?: Context): string | Promise<string>;
116
86
  isMyGuardianEnabled(context?: Context): boolean | Promise<boolean>;
117
- isListenToArticleEnabled(context?: Context): boolean | Promise<boolean>;
118
87
  }
119
88
  export declare class Processor<Context = any> extends thrift.ThriftProcessor<Context, IHandler<Context>> {
120
89
  protected readonly _handler: IHandler<Context>;
@@ -130,5 +99,4 @@ export declare class Processor<Context = any> extends thrift.ThriftProcessor<Con
130
99
  process(input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
131
100
  process_nativeThriftPackageVersion(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
132
101
  process_isMyGuardianEnabled(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
133
- process_isListenToArticleEnabled(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
134
102
  }
package/Environment.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.IsListenToArticleEnabled__Result = exports.IsListenToArticleEnabled__ResultCodec = exports.IsMyGuardianEnabled__Result = exports.IsMyGuardianEnabled__ResultCodec = exports.NativeThriftPackageVersion__Result = exports.NativeThriftPackageVersion__ResultCodec = exports.IsListenToArticleEnabled__Args = exports.IsListenToArticleEnabled__ArgsCodec = exports.IsMyGuardianEnabled__Args = exports.IsMyGuardianEnabled__ArgsCodec = exports.NativeThriftPackageVersion__Args = exports.NativeThriftPackageVersion__ArgsCodec = exports.methodParameters = exports.methodNames = exports.methodAnnotations = exports.annotations = exports.serviceName = void 0;
26
+ exports.Processor = exports.Client = exports.IsMyGuardianEnabled__Result = exports.IsMyGuardianEnabled__ResultCodec = exports.NativeThriftPackageVersion__Result = exports.NativeThriftPackageVersion__ResultCodec = exports.IsMyGuardianEnabled__Args = exports.IsMyGuardianEnabled__ArgsCodec = exports.NativeThriftPackageVersion__Args = exports.NativeThriftPackageVersion__ArgsCodec = exports.methodParameters = exports.methodNames = exports.methodAnnotations = exports.annotations = exports.serviceName = void 0;
27
27
  /* tslint:disable */
28
28
  /* eslint-disable */
29
29
  /*
@@ -41,17 +41,12 @@ exports.methodAnnotations = {
41
41
  isMyGuardianEnabled: {
42
42
  annotations: {},
43
43
  fieldAnnotations: {}
44
- },
45
- isListenToArticleEnabled: {
46
- annotations: {},
47
- fieldAnnotations: {}
48
44
  }
49
45
  };
50
- exports.methodNames = ["nativeThriftPackageVersion", "isMyGuardianEnabled", "isListenToArticleEnabled"];
46
+ exports.methodNames = ["nativeThriftPackageVersion", "isMyGuardianEnabled"];
51
47
  exports.methodParameters = {
52
48
  nativeThriftPackageVersion: 1,
53
- isMyGuardianEnabled: 1,
54
- isListenToArticleEnabled: 1
49
+ isMyGuardianEnabled: 1
55
50
  };
56
51
  exports.NativeThriftPackageVersion__ArgsCodec = {
57
52
  encode(args, output) {
@@ -141,50 +136,6 @@ class IsMyGuardianEnabled__Args extends thrift.StructLike {
141
136
  }
142
137
  }
143
138
  exports.IsMyGuardianEnabled__Args = IsMyGuardianEnabled__Args;
144
- exports.IsListenToArticleEnabled__ArgsCodec = {
145
- encode(args, output) {
146
- output.writeStructBegin("IsListenToArticleEnabled__Args");
147
- output.writeFieldStop();
148
- output.writeStructEnd();
149
- return;
150
- },
151
- decode(input) {
152
- input.readStructBegin();
153
- while (true) {
154
- const ret = input.readFieldBegin();
155
- const fieldType = ret.fieldType;
156
- const fieldId = ret.fieldId;
157
- if (fieldType === thrift.TType.STOP) {
158
- break;
159
- }
160
- switch (fieldId) {
161
- default: {
162
- input.skip(fieldType);
163
- }
164
- }
165
- input.readFieldEnd();
166
- }
167
- input.readStructEnd();
168
- return {};
169
- }
170
- };
171
- class IsListenToArticleEnabled__Args extends thrift.StructLike {
172
- constructor(args = {}) {
173
- super();
174
- this._annotations = {};
175
- this._fieldAnnotations = {};
176
- }
177
- static read(input) {
178
- return new IsListenToArticleEnabled__Args(exports.IsListenToArticleEnabled__ArgsCodec.decode(input));
179
- }
180
- static write(args, output) {
181
- return exports.IsListenToArticleEnabled__ArgsCodec.encode(args, output);
182
- }
183
- write(output) {
184
- return exports.IsListenToArticleEnabled__ArgsCodec.encode(this, output);
185
- }
186
- }
187
- exports.IsListenToArticleEnabled__Args = IsListenToArticleEnabled__Args;
188
139
  exports.NativeThriftPackageVersion__ResultCodec = {
189
140
  encode(args, output) {
190
141
  const obj = {
@@ -321,74 +272,6 @@ class IsMyGuardianEnabled__Result extends thrift.StructLike {
321
272
  }
322
273
  }
323
274
  exports.IsMyGuardianEnabled__Result = IsMyGuardianEnabled__Result;
324
- exports.IsListenToArticleEnabled__ResultCodec = {
325
- encode(args, output) {
326
- const obj = {
327
- success: args.success
328
- };
329
- output.writeStructBegin("IsListenToArticleEnabled__Result");
330
- if (obj.success != null) {
331
- output.writeFieldBegin("success", thrift.TType.BOOL, 0);
332
- output.writeBool(obj.success);
333
- output.writeFieldEnd();
334
- }
335
- output.writeFieldStop();
336
- output.writeStructEnd();
337
- return;
338
- },
339
- decode(input) {
340
- let _args = {};
341
- input.readStructBegin();
342
- while (true) {
343
- const ret = input.readFieldBegin();
344
- const fieldType = ret.fieldType;
345
- const fieldId = ret.fieldId;
346
- if (fieldType === thrift.TType.STOP) {
347
- break;
348
- }
349
- switch (fieldId) {
350
- case 0:
351
- if (fieldType === thrift.TType.BOOL) {
352
- const value_5 = input.readBool();
353
- _args.success = value_5;
354
- }
355
- else {
356
- input.skip(fieldType);
357
- }
358
- break;
359
- default: {
360
- input.skip(fieldType);
361
- }
362
- }
363
- input.readFieldEnd();
364
- }
365
- input.readStructEnd();
366
- return {
367
- success: _args.success
368
- };
369
- }
370
- };
371
- class IsListenToArticleEnabled__Result extends thrift.StructLike {
372
- constructor(args = {}) {
373
- super();
374
- this._annotations = {};
375
- this._fieldAnnotations = {};
376
- if (args.success != null) {
377
- const value_6 = args.success;
378
- this.success = value_6;
379
- }
380
- }
381
- static read(input) {
382
- return new IsListenToArticleEnabled__Result(exports.IsListenToArticleEnabled__ResultCodec.decode(input));
383
- }
384
- static write(args, output) {
385
- return exports.IsListenToArticleEnabled__ResultCodec.encode(args, output);
386
- }
387
- write(output) {
388
- return exports.IsListenToArticleEnabled__ResultCodec.encode(this, output);
389
- }
390
- }
391
- exports.IsListenToArticleEnabled__Result = IsListenToArticleEnabled__Result;
392
275
  class Client extends thrift.ThriftClient {
393
276
  constructor() {
394
277
  super(...arguments);
@@ -474,44 +357,6 @@ class Client extends thrift.ThriftClient {
474
357
  }
475
358
  });
476
359
  }
477
- isListenToArticleEnabled(context) {
478
- const writer = new this.transport();
479
- const output = new this.protocol(writer);
480
- output.writeMessageBegin("isListenToArticleEnabled", thrift.MessageType.CALL, this.incrementRequestId());
481
- const args = {};
482
- exports.IsListenToArticleEnabled__ArgsCodec.encode(args, output);
483
- output.writeMessageEnd();
484
- return this.connection.send(writer.flush(), context).then((data) => {
485
- const reader = this.transport.receiver(data);
486
- const input = new this.protocol(reader);
487
- try {
488
- const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
489
- if (fieldName === "isListenToArticleEnabled") {
490
- if (messageType === thrift.MessageType.EXCEPTION) {
491
- const err = thrift.TApplicationExceptionCodec.decode(input);
492
- input.readMessageEnd();
493
- return Promise.reject(err);
494
- }
495
- else {
496
- const result = exports.IsListenToArticleEnabled__ResultCodec.decode(input);
497
- input.readMessageEnd();
498
- if (result.success != null) {
499
- return Promise.resolve(result.success);
500
- }
501
- else {
502
- return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "isListenToArticleEnabled failed: unknown result"));
503
- }
504
- }
505
- }
506
- else {
507
- return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName));
508
- }
509
- }
510
- catch (err) {
511
- return Promise.reject(err);
512
- }
513
- });
514
- }
515
360
  }
516
361
  exports.Client = Client;
517
362
  Client.serviceName = exports.serviceName;
@@ -542,10 +387,6 @@ class Processor extends thrift.ThriftProcessor {
542
387
  resolve(this.process_isMyGuardianEnabled(requestId, input, output, context));
543
388
  break;
544
389
  }
545
- case "process_isListenToArticleEnabled": {
546
- resolve(this.process_isListenToArticleEnabled(requestId, input, output, context));
547
- break;
548
- }
549
390
  default: {
550
391
  input.skip(thrift.TType.STRUCT);
551
392
  input.readMessageEnd();
@@ -606,29 +447,6 @@ class Processor extends thrift.ThriftProcessor {
606
447
  return output.flush();
607
448
  });
608
449
  }
609
- process_isListenToArticleEnabled(requestId, input, output, context) {
610
- return new Promise((resolve, reject) => {
611
- try {
612
- input.readMessageEnd();
613
- resolve(this._handler.isListenToArticleEnabled(context));
614
- }
615
- catch (err) {
616
- reject(err);
617
- }
618
- }).then((data) => {
619
- const result = { success: data };
620
- output.writeMessageBegin("isListenToArticleEnabled", thrift.MessageType.REPLY, requestId);
621
- exports.IsListenToArticleEnabled__ResultCodec.encode(result, output);
622
- output.writeMessageEnd();
623
- return output.flush();
624
- }).catch((err) => {
625
- const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
626
- output.writeMessageBegin("isListenToArticleEnabled", thrift.MessageType.EXCEPTION, requestId);
627
- thrift.TApplicationExceptionCodec.encode(result, output);
628
- output.writeMessageEnd();
629
- return output.flush();
630
- });
631
- }
632
450
  }
633
451
  exports.Processor = Processor;
634
452
  Processor.serviceName = exports.serviceName;
@@ -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>;
@@ -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.Play__ArgsCodec = {
145
+ exports.GetAudioDurationSeconds__ArgsCodec = {
141
146
  encode(args, output) {
142
147
  const obj = {
143
148
  articleId: args.articleId
144
149
  };
145
- output.writeStructBegin("Play__Args");
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 Play__Args from input");
196
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read GetAudioDurationSeconds__Args from input");
192
197
  }
193
198
  }
194
199
  };
195
- class Play__Args extends thrift.StructLike {
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 value_5 = input.readString();
251
- _args.articleId = value_5;
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 value_6 = args.articleId;
281
- this.articleId = value_6;
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 value_7 = input.readString();
330
- _args.articleId = value_7;
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 value_8 = args.articleId;
360
- this.articleId = value_8;
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 value_9 = input.readBool();
406
- _args.success = value_9;
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 value_10 = args.success;
431
- this.success = value_10;
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 value_11 = input.readBool();
474
- _args.success = value_11;
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 value_12 = args.success;
499
- this.success = value_12;
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 value_13 = input.readBool();
542
- _args.success = value_13;
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 value_14 = args.success;
567
- this.success = value_14;
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 value_15 = input.readBool();
610
- _args.success = value_15;
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 value_16 = args.success;
635
- this.success = value_16;
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guardian/bridget",
3
- "version": "8.5.0",
3
+ "version": "8.6.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {