@guardian/bridget 5.0.0 → 7.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/Videos.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.UpdateVideos__Result = exports.UpdateVideos__ResultCodec = exports.InsertVideos__Result = exports.InsertVideos__ResultCodec = exports.UpdateVideos__Args = exports.UpdateVideos__ArgsCodec = exports.InsertVideos__Args = exports.InsertVideos__ArgsCodec = exports.methodParameters = exports.methodNames = exports.methodAnnotations = exports.annotations = exports.serviceName = void 0;
26
+ exports.Processor = exports.Client = exports.Fullscreen__Result = exports.Fullscreen__ResultCodec = exports.SendVideoEvent__Result = exports.SendVideoEvent__ResultCodec = exports.UpdateVideos__Result = exports.UpdateVideos__ResultCodec = exports.InsertVideos__Result = exports.InsertVideos__ResultCodec = exports.Fullscreen__Args = exports.Fullscreen__ArgsCodec = exports.SendVideoEvent__Args = exports.SendVideoEvent__ArgsCodec = exports.UpdateVideos__Args = exports.UpdateVideos__ArgsCodec = exports.InsertVideos__Args = exports.InsertVideos__ArgsCodec = exports.methodParameters = exports.methodNames = exports.methodAnnotations = exports.annotations = exports.serviceName = void 0;
27
27
  /* tslint:disable */
28
28
  /* eslint-disable */
29
29
  /*
@@ -32,6 +32,7 @@ exports.Processor = exports.Client = exports.UpdateVideos__Result = exports.Upda
32
32
  */
33
33
  const thrift = __importStar(require("@creditkarma/thrift-server-core"));
34
34
  const VideoSlot = __importStar(require("./VideoSlot"));
35
+ const VideoEvent = __importStar(require("./VideoEvent"));
35
36
  exports.serviceName = "Videos";
36
37
  exports.annotations = {};
37
38
  exports.methodAnnotations = {
@@ -42,12 +43,22 @@ exports.methodAnnotations = {
42
43
  updateVideos: {
43
44
  annotations: {},
44
45
  fieldAnnotations: {}
46
+ },
47
+ sendVideoEvent: {
48
+ annotations: {},
49
+ fieldAnnotations: {}
50
+ },
51
+ fullscreen: {
52
+ annotations: {},
53
+ fieldAnnotations: {}
45
54
  }
46
55
  };
47
- exports.methodNames = ["insertVideos", "updateVideos"];
56
+ exports.methodNames = ["insertVideos", "updateVideos", "sendVideoEvent", "fullscreen"];
48
57
  exports.methodParameters = {
49
58
  insertVideos: 2,
50
- updateVideos: 2
59
+ updateVideos: 2,
60
+ sendVideoEvent: 2,
61
+ fullscreen: 1
51
62
  };
52
63
  exports.InsertVideos__ArgsCodec = {
53
64
  encode(args, output) {
@@ -237,6 +248,129 @@ class UpdateVideos__Args extends thrift.StructLike {
237
248
  }
238
249
  }
239
250
  exports.UpdateVideos__Args = UpdateVideos__Args;
251
+ exports.SendVideoEvent__ArgsCodec = {
252
+ encode(args, output) {
253
+ const obj = {
254
+ videoEvent: args.videoEvent
255
+ };
256
+ output.writeStructBegin("SendVideoEvent__Args");
257
+ if (obj.videoEvent != null) {
258
+ output.writeFieldBegin("videoEvent", thrift.TType.STRUCT, 1);
259
+ VideoEvent.VideoEventCodec.encode(obj.videoEvent, output);
260
+ output.writeFieldEnd();
261
+ }
262
+ else {
263
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[videoEvent] is unset!");
264
+ }
265
+ output.writeFieldStop();
266
+ output.writeStructEnd();
267
+ return;
268
+ },
269
+ decode(input) {
270
+ let _args = {};
271
+ input.readStructBegin();
272
+ while (true) {
273
+ const ret = input.readFieldBegin();
274
+ const fieldType = ret.fieldType;
275
+ const fieldId = ret.fieldId;
276
+ if (fieldType === thrift.TType.STOP) {
277
+ break;
278
+ }
279
+ switch (fieldId) {
280
+ case 1:
281
+ if (fieldType === thrift.TType.STRUCT) {
282
+ const value_13 = VideoEvent.VideoEventCodec.decode(input);
283
+ _args.videoEvent = value_13;
284
+ }
285
+ else {
286
+ input.skip(fieldType);
287
+ }
288
+ break;
289
+ default: {
290
+ input.skip(fieldType);
291
+ }
292
+ }
293
+ input.readFieldEnd();
294
+ }
295
+ input.readStructEnd();
296
+ if (_args.videoEvent !== undefined) {
297
+ return {
298
+ videoEvent: _args.videoEvent
299
+ };
300
+ }
301
+ else {
302
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read SendVideoEvent__Args from input");
303
+ }
304
+ }
305
+ };
306
+ class SendVideoEvent__Args extends thrift.StructLike {
307
+ constructor(args) {
308
+ super();
309
+ this._annotations = {};
310
+ this._fieldAnnotations = {};
311
+ if (args.videoEvent != null) {
312
+ const value_14 = new VideoEvent.VideoEvent(args.videoEvent);
313
+ this.videoEvent = value_14;
314
+ }
315
+ else {
316
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[videoEvent] is unset!");
317
+ }
318
+ }
319
+ static read(input) {
320
+ return new SendVideoEvent__Args(exports.SendVideoEvent__ArgsCodec.decode(input));
321
+ }
322
+ static write(args, output) {
323
+ return exports.SendVideoEvent__ArgsCodec.encode(args, output);
324
+ }
325
+ write(output) {
326
+ return exports.SendVideoEvent__ArgsCodec.encode(this, output);
327
+ }
328
+ }
329
+ exports.SendVideoEvent__Args = SendVideoEvent__Args;
330
+ exports.Fullscreen__ArgsCodec = {
331
+ encode(args, output) {
332
+ output.writeStructBegin("Fullscreen__Args");
333
+ output.writeFieldStop();
334
+ output.writeStructEnd();
335
+ return;
336
+ },
337
+ decode(input) {
338
+ input.readStructBegin();
339
+ while (true) {
340
+ const ret = input.readFieldBegin();
341
+ const fieldType = ret.fieldType;
342
+ const fieldId = ret.fieldId;
343
+ if (fieldType === thrift.TType.STOP) {
344
+ break;
345
+ }
346
+ switch (fieldId) {
347
+ default: {
348
+ input.skip(fieldType);
349
+ }
350
+ }
351
+ input.readFieldEnd();
352
+ }
353
+ input.readStructEnd();
354
+ return {};
355
+ }
356
+ };
357
+ class Fullscreen__Args extends thrift.StructLike {
358
+ constructor(args = {}) {
359
+ super();
360
+ this._annotations = {};
361
+ this._fieldAnnotations = {};
362
+ }
363
+ static read(input) {
364
+ return new Fullscreen__Args(exports.Fullscreen__ArgsCodec.decode(input));
365
+ }
366
+ static write(args, output) {
367
+ return exports.Fullscreen__ArgsCodec.encode(args, output);
368
+ }
369
+ write(output) {
370
+ return exports.Fullscreen__ArgsCodec.encode(this, output);
371
+ }
372
+ }
373
+ exports.Fullscreen__Args = Fullscreen__Args;
240
374
  exports.InsertVideos__ResultCodec = {
241
375
  encode(args, output) {
242
376
  output.writeStructBegin("InsertVideos__Result");
@@ -281,8 +415,8 @@ class InsertVideos__Result extends thrift.StructLike {
281
415
  this._annotations = {};
282
416
  this._fieldAnnotations = {};
283
417
  if (args.success != null) {
284
- const value_13 = undefined;
285
- this.success = value_13;
418
+ const value_15 = undefined;
419
+ this.success = value_15;
286
420
  }
287
421
  }
288
422
  static read(input) {
@@ -340,8 +474,8 @@ class UpdateVideos__Result extends thrift.StructLike {
340
474
  this._annotations = {};
341
475
  this._fieldAnnotations = {};
342
476
  if (args.success != null) {
343
- const value_14 = undefined;
344
- this.success = value_14;
477
+ const value_16 = undefined;
478
+ this.success = value_16;
345
479
  }
346
480
  }
347
481
  static read(input) {
@@ -355,6 +489,124 @@ class UpdateVideos__Result extends thrift.StructLike {
355
489
  }
356
490
  }
357
491
  exports.UpdateVideos__Result = UpdateVideos__Result;
492
+ exports.SendVideoEvent__ResultCodec = {
493
+ encode(args, output) {
494
+ output.writeStructBegin("SendVideoEvent__Result");
495
+ output.writeFieldStop();
496
+ output.writeStructEnd();
497
+ return;
498
+ },
499
+ decode(input) {
500
+ let _args = {};
501
+ input.readStructBegin();
502
+ while (true) {
503
+ const ret = input.readFieldBegin();
504
+ const fieldType = ret.fieldType;
505
+ const fieldId = ret.fieldId;
506
+ if (fieldType === thrift.TType.STOP) {
507
+ break;
508
+ }
509
+ switch (fieldId) {
510
+ case 0:
511
+ if (fieldType === thrift.TType.VOID) {
512
+ input.skip(fieldType);
513
+ }
514
+ else {
515
+ input.skip(fieldType);
516
+ }
517
+ break;
518
+ default: {
519
+ input.skip(fieldType);
520
+ }
521
+ }
522
+ input.readFieldEnd();
523
+ }
524
+ input.readStructEnd();
525
+ return {
526
+ success: _args.success
527
+ };
528
+ }
529
+ };
530
+ class SendVideoEvent__Result extends thrift.StructLike {
531
+ constructor(args = {}) {
532
+ super();
533
+ this._annotations = {};
534
+ this._fieldAnnotations = {};
535
+ if (args.success != null) {
536
+ const value_17 = undefined;
537
+ this.success = value_17;
538
+ }
539
+ }
540
+ static read(input) {
541
+ return new SendVideoEvent__Result(exports.SendVideoEvent__ResultCodec.decode(input));
542
+ }
543
+ static write(args, output) {
544
+ return exports.SendVideoEvent__ResultCodec.encode(args, output);
545
+ }
546
+ write(output) {
547
+ return exports.SendVideoEvent__ResultCodec.encode(this, output);
548
+ }
549
+ }
550
+ exports.SendVideoEvent__Result = SendVideoEvent__Result;
551
+ exports.Fullscreen__ResultCodec = {
552
+ encode(args, output) {
553
+ output.writeStructBegin("Fullscreen__Result");
554
+ output.writeFieldStop();
555
+ output.writeStructEnd();
556
+ return;
557
+ },
558
+ decode(input) {
559
+ let _args = {};
560
+ input.readStructBegin();
561
+ while (true) {
562
+ const ret = input.readFieldBegin();
563
+ const fieldType = ret.fieldType;
564
+ const fieldId = ret.fieldId;
565
+ if (fieldType === thrift.TType.STOP) {
566
+ break;
567
+ }
568
+ switch (fieldId) {
569
+ case 0:
570
+ if (fieldType === thrift.TType.VOID) {
571
+ input.skip(fieldType);
572
+ }
573
+ else {
574
+ input.skip(fieldType);
575
+ }
576
+ break;
577
+ default: {
578
+ input.skip(fieldType);
579
+ }
580
+ }
581
+ input.readFieldEnd();
582
+ }
583
+ input.readStructEnd();
584
+ return {
585
+ success: _args.success
586
+ };
587
+ }
588
+ };
589
+ class Fullscreen__Result extends thrift.StructLike {
590
+ constructor(args = {}) {
591
+ super();
592
+ this._annotations = {};
593
+ this._fieldAnnotations = {};
594
+ if (args.success != null) {
595
+ const value_18 = undefined;
596
+ this.success = value_18;
597
+ }
598
+ }
599
+ static read(input) {
600
+ return new Fullscreen__Result(exports.Fullscreen__ResultCodec.decode(input));
601
+ }
602
+ static write(args, output) {
603
+ return exports.Fullscreen__ResultCodec.encode(args, output);
604
+ }
605
+ write(output) {
606
+ return exports.Fullscreen__ResultCodec.encode(this, output);
607
+ }
608
+ }
609
+ exports.Fullscreen__Result = Fullscreen__Result;
358
610
  class Client extends thrift.ThriftClient {
359
611
  constructor() {
360
612
  super(...arguments);
@@ -430,6 +682,72 @@ class Client extends thrift.ThriftClient {
430
682
  }
431
683
  });
432
684
  }
685
+ sendVideoEvent(videoEvent, context) {
686
+ const writer = new this.transport();
687
+ const output = new this.protocol(writer);
688
+ output.writeMessageBegin("sendVideoEvent", thrift.MessageType.CALL, this.incrementRequestId());
689
+ const args = { videoEvent };
690
+ exports.SendVideoEvent__ArgsCodec.encode(args, output);
691
+ output.writeMessageEnd();
692
+ return this.connection.send(writer.flush(), context).then((data) => {
693
+ const reader = this.transport.receiver(data);
694
+ const input = new this.protocol(reader);
695
+ try {
696
+ const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
697
+ if (fieldName === "sendVideoEvent") {
698
+ if (messageType === thrift.MessageType.EXCEPTION) {
699
+ const err = thrift.TApplicationExceptionCodec.decode(input);
700
+ input.readMessageEnd();
701
+ return Promise.reject(err);
702
+ }
703
+ else {
704
+ const result = exports.SendVideoEvent__ResultCodec.decode(input);
705
+ input.readMessageEnd();
706
+ return Promise.resolve(result.success);
707
+ }
708
+ }
709
+ else {
710
+ return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName));
711
+ }
712
+ }
713
+ catch (err) {
714
+ return Promise.reject(err);
715
+ }
716
+ });
717
+ }
718
+ fullscreen(context) {
719
+ const writer = new this.transport();
720
+ const output = new this.protocol(writer);
721
+ output.writeMessageBegin("fullscreen", thrift.MessageType.CALL, this.incrementRequestId());
722
+ const args = {};
723
+ exports.Fullscreen__ArgsCodec.encode(args, output);
724
+ output.writeMessageEnd();
725
+ return this.connection.send(writer.flush(), context).then((data) => {
726
+ const reader = this.transport.receiver(data);
727
+ const input = new this.protocol(reader);
728
+ try {
729
+ const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
730
+ if (fieldName === "fullscreen") {
731
+ if (messageType === thrift.MessageType.EXCEPTION) {
732
+ const err = thrift.TApplicationExceptionCodec.decode(input);
733
+ input.readMessageEnd();
734
+ return Promise.reject(err);
735
+ }
736
+ else {
737
+ const result = exports.Fullscreen__ResultCodec.decode(input);
738
+ input.readMessageEnd();
739
+ return Promise.resolve(result.success);
740
+ }
741
+ }
742
+ else {
743
+ return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName));
744
+ }
745
+ }
746
+ catch (err) {
747
+ return Promise.reject(err);
748
+ }
749
+ });
750
+ }
433
751
  }
434
752
  exports.Client = Client;
435
753
  Client.serviceName = exports.serviceName;
@@ -460,6 +778,14 @@ class Processor extends thrift.ThriftProcessor {
460
778
  resolve(this.process_updateVideos(requestId, input, output, context));
461
779
  break;
462
780
  }
781
+ case "process_sendVideoEvent": {
782
+ resolve(this.process_sendVideoEvent(requestId, input, output, context));
783
+ break;
784
+ }
785
+ case "process_fullscreen": {
786
+ resolve(this.process_fullscreen(requestId, input, output, context));
787
+ break;
788
+ }
463
789
  default: {
464
790
  input.skip(thrift.TType.STRUCT);
465
791
  input.readMessageEnd();
@@ -522,6 +848,53 @@ class Processor extends thrift.ThriftProcessor {
522
848
  return output.flush();
523
849
  });
524
850
  }
851
+ process_sendVideoEvent(requestId, input, output, context) {
852
+ return new Promise((resolve, reject) => {
853
+ try {
854
+ const args = exports.SendVideoEvent__ArgsCodec.decode(input);
855
+ input.readMessageEnd();
856
+ resolve(this._handler.sendVideoEvent(args.videoEvent, context));
857
+ }
858
+ catch (err) {
859
+ reject(err);
860
+ }
861
+ }).then((data) => {
862
+ const result = { success: data };
863
+ output.writeMessageBegin("sendVideoEvent", thrift.MessageType.REPLY, requestId);
864
+ exports.SendVideoEvent__ResultCodec.encode(result, output);
865
+ output.writeMessageEnd();
866
+ return output.flush();
867
+ }).catch((err) => {
868
+ const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
869
+ output.writeMessageBegin("sendVideoEvent", thrift.MessageType.EXCEPTION, requestId);
870
+ thrift.TApplicationExceptionCodec.encode(result, output);
871
+ output.writeMessageEnd();
872
+ return output.flush();
873
+ });
874
+ }
875
+ process_fullscreen(requestId, input, output, context) {
876
+ return new Promise((resolve, reject) => {
877
+ try {
878
+ input.readMessageEnd();
879
+ resolve(this._handler.fullscreen(context));
880
+ }
881
+ catch (err) {
882
+ reject(err);
883
+ }
884
+ }).then((data) => {
885
+ const result = { success: data };
886
+ output.writeMessageBegin("fullscreen", thrift.MessageType.REPLY, requestId);
887
+ exports.Fullscreen__ResultCodec.encode(result, output);
888
+ output.writeMessageEnd();
889
+ return output.flush();
890
+ }).catch((err) => {
891
+ const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
892
+ output.writeMessageBegin("fullscreen", thrift.MessageType.EXCEPTION, requestId);
893
+ thrift.TApplicationExceptionCodec.encode(result, output);
894
+ output.writeMessageEnd();
895
+ return output.flush();
896
+ });
897
+ }
525
898
  }
526
899
  exports.Processor = Processor;
527
900
  Processor.serviceName = exports.serviceName;
package/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from "./MediaEvent";
1
2
  export * from "./PurchaseScreenReason";
2
3
  export * from "./SignInScreenReason";
3
4
  export * from "./SignInScreenReferrer";
@@ -11,12 +12,9 @@ export * from "./MaybeEpic";
11
12
  export * from "./VideoSlot";
12
13
  export * from "./MetricPaint";
13
14
  export * from "./MetricFont";
14
- export * from "./DiscussionBadge";
15
- export * from "./DiscussionUserProfile";
16
- export * from "./DiscussionApiResponse";
15
+ export * from "./VideoEvent";
17
16
  export * from "./Metric";
18
- export * from "./GetUserProfileResponse";
19
- export * from "./DiscussionResponse";
17
+ export * from "./DiscussionServiceResponse";
20
18
  import * as Environment from "./Environment";
21
19
  export { Environment as Environment };
22
20
  import * as Commercial from "./Commercial";
package/index.js CHANGED
@@ -33,6 +33,7 @@ exports.Newsletters = exports.Navigation = exports.Analytics = exports.Discussio
33
33
  * Autogenerated by @creditkarma/thrift-typescript v3.7.6
34
34
  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
35
35
  */
36
+ __exportStar(require("./MediaEvent"), exports);
36
37
  __exportStar(require("./PurchaseScreenReason"), exports);
37
38
  __exportStar(require("./SignInScreenReason"), exports);
38
39
  __exportStar(require("./SignInScreenReferrer"), exports);
@@ -46,12 +47,9 @@ __exportStar(require("./MaybeEpic"), exports);
46
47
  __exportStar(require("./VideoSlot"), exports);
47
48
  __exportStar(require("./MetricPaint"), exports);
48
49
  __exportStar(require("./MetricFont"), exports);
49
- __exportStar(require("./DiscussionBadge"), exports);
50
- __exportStar(require("./DiscussionUserProfile"), exports);
51
- __exportStar(require("./DiscussionApiResponse"), exports);
50
+ __exportStar(require("./VideoEvent"), exports);
52
51
  __exportStar(require("./Metric"), exports);
53
- __exportStar(require("./GetUserProfileResponse"), exports);
54
- __exportStar(require("./DiscussionResponse"), exports);
52
+ __exportStar(require("./DiscussionServiceResponse"), exports);
55
53
  const Environment = __importStar(require("./Environment"));
56
54
  exports.Environment = Environment;
57
55
  const Commercial = __importStar(require("./Commercial"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guardian/bridget",
3
- "version": "5.0.0",
3
+ "version": "7.0.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,26 +0,0 @@
1
- import * as thrift from "@creditkarma/thrift-server-core";
2
- export interface IDiscussionApiResponse {
3
- status: string;
4
- statusCode: number;
5
- message: string;
6
- errorCode?: string;
7
- }
8
- export interface IDiscussionApiResponseArgs {
9
- status: string;
10
- statusCode: number;
11
- message: string;
12
- errorCode?: string;
13
- }
14
- export declare const DiscussionApiResponseCodec: thrift.IStructCodec<IDiscussionApiResponseArgs, IDiscussionApiResponse>;
15
- export declare class DiscussionApiResponse extends thrift.StructLike implements IDiscussionApiResponse {
16
- status: string;
17
- statusCode: number;
18
- message: string;
19
- errorCode?: string;
20
- readonly _annotations: thrift.IThriftAnnotations;
21
- readonly _fieldAnnotations: thrift.IFieldAnnotations;
22
- constructor(args: IDiscussionApiResponseArgs);
23
- static read(input: thrift.TProtocol): DiscussionApiResponse;
24
- static write(args: IDiscussionApiResponseArgs, output: thrift.TProtocol): void;
25
- write(output: thrift.TProtocol): void;
26
- }