@guardian/content-api-models 17.5.0-beta.0 → 17.6.0-beta.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  {
3
3
  "name": "@guardian/content-api-models",
4
- "version": "17.5.0-beta.0",
4
+ "version": "17.6.0-beta.0",
5
5
  "description": "Typescript library built from the content api thrift definitions",
6
6
  "repository": {
7
7
  "type": "git",
@@ -17,7 +17,6 @@ export interface AudioElementFields {
17
17
  explicit?: boolean;
18
18
  role?: string;
19
19
  sourceDomain?: string;
20
- isMandatory?: boolean;
21
20
  }
22
21
  export declare class AudioElementFieldsSerde {
23
22
  static read(protocol: TProtocol): AudioElementFields;
@@ -129,15 +129,6 @@ var AudioElementFieldsSerde = /** @class */ (function () {
129
129
  protocol.skip(ftype);
130
130
  }
131
131
  break;
132
- case 15:
133
- if (ftype === thrift_1.Thrift.Type.BOOL) {
134
- var value1 = protocol.readBool();
135
- result.isMandatory = value1;
136
- }
137
- else {
138
- protocol.skip(ftype);
139
- }
140
- break;
141
132
  default:
142
133
  protocol.skip(ftype);
143
134
  }
@@ -221,12 +212,6 @@ var AudioElementFieldsSerde = /** @class */ (function () {
221
212
  protocol.writeString(value1);
222
213
  protocol.writeFieldEnd();
223
214
  }
224
- if (value0.isMandatory !== null && value0.isMandatory !== undefined) {
225
- var value1 = value0.isMandatory;
226
- protocol.writeFieldBegin('isMandatory', thrift_1.Thrift.Type.BOOL, 15);
227
- protocol.writeBool(value1);
228
- protocol.writeFieldEnd();
229
- }
230
215
  protocol.writeFieldStop();
231
216
  protocol.writeStructEnd();
232
217
  };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Autogenerated by scrooge-generator-extras
3
+ *
4
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ */
6
+ import { TProtocol } from 'thrift';
7
+ import { CapiDateTime } from './capiDateTime';
8
+ export interface ChannelFields {
9
+ isAvailable: boolean;
10
+ publicationDate?: CapiDateTime;
11
+ }
12
+ export declare class ChannelFieldsSerde {
13
+ static read(protocol: TProtocol): ChannelFields;
14
+ static write(protocol: TProtocol, value0: ChannelFields): void;
15
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ /**
3
+ * Autogenerated by scrooge-generator-extras
4
+ *
5
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.ChannelFieldsSerde = void 0;
9
+ var thrift_1 = require("thrift");
10
+ var capiDateTime_1 = require("./capiDateTime");
11
+ var ChannelFieldsSerde = /** @class */ (function () {
12
+ function ChannelFieldsSerde() {
13
+ }
14
+ ChannelFieldsSerde.read = function (protocol) {
15
+ protocol.readStructBegin();
16
+ var result = {};
17
+ while (true) {
18
+ var ret = protocol.readFieldBegin();
19
+ var ftype = ret.ftype;
20
+ var fid = ret.fid;
21
+ if (ftype === thrift_1.Thrift.Type.STOP) {
22
+ break;
23
+ }
24
+ switch (fid) {
25
+ case 1:
26
+ if (ftype === thrift_1.Thrift.Type.BOOL) {
27
+ var value1 = protocol.readBool();
28
+ result.isAvailable = value1;
29
+ }
30
+ else {
31
+ protocol.skip(ftype);
32
+ }
33
+ break;
34
+ case 2:
35
+ if (ftype === thrift_1.Thrift.Type.STRUCT) {
36
+ var value1 = capiDateTime_1.CapiDateTimeSerde.read(protocol);
37
+ result.publicationDate = value1;
38
+ }
39
+ else {
40
+ protocol.skip(ftype);
41
+ }
42
+ break;
43
+ default:
44
+ protocol.skip(ftype);
45
+ }
46
+ protocol.readFieldEnd();
47
+ }
48
+ protocol.readStructEnd();
49
+ // @ts-ignore
50
+ return result;
51
+ };
52
+ ChannelFieldsSerde.write = function (protocol, value0) {
53
+ protocol.writeStructBegin('ChannelFields');
54
+ if (value0.isAvailable !== null && value0.isAvailable !== undefined) {
55
+ var value1 = value0.isAvailable;
56
+ protocol.writeFieldBegin('isAvailable', thrift_1.Thrift.Type.BOOL, 1);
57
+ protocol.writeBool(value1);
58
+ protocol.writeFieldEnd();
59
+ }
60
+ if (value0.publicationDate !== null && value0.publicationDate !== undefined) {
61
+ var value1 = value0.publicationDate;
62
+ protocol.writeFieldBegin('publicationDate', thrift_1.Thrift.Type.STRUCT, 2);
63
+ capiDateTime_1.CapiDateTimeSerde.write(protocol, value1);
64
+ protocol.writeFieldEnd();
65
+ }
66
+ protocol.writeFieldStop();
67
+ protocol.writeStructEnd();
68
+ };
69
+ return ChannelFieldsSerde;
70
+ }());
71
+ exports.ChannelFieldsSerde = ChannelFieldsSerde;
@@ -16,7 +16,6 @@ export interface CommentElementFields {
16
16
  authorName?: string;
17
17
  commentId?: number;
18
18
  role?: string;
19
- isMandatory?: boolean;
20
19
  }
21
20
  export declare class CommentElementFieldsSerde {
22
21
  static read(protocol: TProtocol): CommentElementFields;
@@ -120,15 +120,6 @@ var CommentElementFieldsSerde = /** @class */ (function () {
120
120
  protocol.skip(ftype);
121
121
  }
122
122
  break;
123
- case 12:
124
- if (ftype === thrift_1.Thrift.Type.BOOL) {
125
- var value1 = protocol.readBool();
126
- result.isMandatory = value1;
127
- }
128
- else {
129
- protocol.skip(ftype);
130
- }
131
- break;
132
123
  default:
133
124
  protocol.skip(ftype);
134
125
  }
@@ -206,12 +197,6 @@ var CommentElementFieldsSerde = /** @class */ (function () {
206
197
  protocol.writeString(value1);
207
198
  protocol.writeFieldEnd();
208
199
  }
209
- if (value0.isMandatory !== null && value0.isMandatory !== undefined) {
210
- var value1 = value0.isMandatory;
211
- protocol.writeFieldBegin('isMandatory', thrift_1.Thrift.Type.BOOL, 12);
212
- protocol.writeBool(value1);
213
- protocol.writeFieldEnd();
214
- }
215
200
  protocol.writeFieldStop();
216
201
  protocol.writeStructEnd();
217
202
  };
package/v1/content.d.ts CHANGED
@@ -8,6 +8,7 @@ import { AliasPath } from './aliasPath';
8
8
  import { Atoms } from './atoms';
9
9
  import { Blocks } from './blocks';
10
10
  import { CapiDateTime } from './capiDateTime';
11
+ import { ContentChannel } from './contentChannel';
11
12
  import { ContentFields } from './contentFields';
12
13
  import { ContentStats } from './contentStats';
13
14
  import { ContentType } from './contentType';
@@ -44,6 +45,7 @@ export interface Content {
44
45
  pillarId?: string;
45
46
  pillarName?: string;
46
47
  aliasPaths?: AliasPath[];
48
+ channels?: ContentChannel[];
47
49
  }
48
50
  export declare class ContentSerde {
49
51
  static read(protocol: TProtocol): Content;
package/v1/content.js CHANGED
@@ -11,6 +11,7 @@ var aliasPath_1 = require("./aliasPath");
11
11
  var atoms_1 = require("./atoms");
12
12
  var blocks_1 = require("./blocks");
13
13
  var capiDateTime_1 = require("./capiDateTime");
14
+ var contentChannel_1 = require("./contentChannel");
14
15
  var contentFields_1 = require("./contentFields");
15
16
  var contentStats_1 = require("./contentStats");
16
17
  var contentType_1 = require("./contentType");
@@ -25,7 +26,7 @@ var ContentSerde = /** @class */ (function () {
25
26
  function ContentSerde() {
26
27
  }
27
28
  ContentSerde.read = function (protocol) {
28
- var _a, _b, _c, _d;
29
+ var _a, _b, _c, _d, _e;
29
30
  protocol.readStructBegin();
30
31
  var result = {
31
32
  type: contentType_1.ContentType.ARTICLE,
@@ -302,6 +303,24 @@ var ContentSerde = /** @class */ (function () {
302
303
  protocol.skip(ftype);
303
304
  }
304
305
  break;
306
+ case 28:
307
+ if (ftype === thrift_1.Thrift.Type.LIST) {
308
+ var listInfo1 = protocol.readListBegin();
309
+ var listSize1 = (_e = listInfo1.size) !== null && _e !== void 0 ? _e : 0;
310
+ var value1 = [];
311
+ if (listInfo1.etype === thrift_1.Thrift.Type.STRUCT) {
312
+ for (var i = 0; i < listSize1; i++) {
313
+ var value2 = contentChannel_1.ContentChannelSerde.read(protocol);
314
+ value1.push(value2);
315
+ }
316
+ }
317
+ protocol.readListEnd();
318
+ result.channels = value1;
319
+ }
320
+ else {
321
+ protocol.skip(ftype);
322
+ }
323
+ break;
305
324
  default:
306
325
  protocol.skip(ftype);
307
326
  }
@@ -479,6 +498,16 @@ var ContentSerde = /** @class */ (function () {
479
498
  protocol.writeListEnd();
480
499
  protocol.writeFieldEnd();
481
500
  }
501
+ if (value0.channels !== null && value0.channels !== undefined) {
502
+ var value1 = value0.channels;
503
+ protocol.writeFieldBegin('channels', thrift_1.Thrift.Type.LIST, 28);
504
+ protocol.writeListBegin(thrift_1.Thrift.Type.STRUCT, value1.length);
505
+ value1.forEach(function (value2) {
506
+ contentChannel_1.ContentChannelSerde.write(protocol, value2);
507
+ });
508
+ protocol.writeListEnd();
509
+ protocol.writeFieldEnd();
510
+ }
482
511
  protocol.writeFieldStop();
483
512
  protocol.writeStructEnd();
484
513
  };
@@ -8,7 +8,6 @@ export interface ContentAtomElementFields {
8
8
  atomId: string;
9
9
  atomType: string;
10
10
  role?: string;
11
- isMandatory?: boolean;
12
11
  }
13
12
  export declare class ContentAtomElementFieldsSerde {
14
13
  static read(protocol: TProtocol): ContentAtomElementFields;
@@ -48,15 +48,6 @@ var ContentAtomElementFieldsSerde = /** @class */ (function () {
48
48
  protocol.skip(ftype);
49
49
  }
50
50
  break;
51
- case 4:
52
- if (ftype === thrift_1.Thrift.Type.BOOL) {
53
- var value1 = protocol.readBool();
54
- result.isMandatory = value1;
55
- }
56
- else {
57
- protocol.skip(ftype);
58
- }
59
- break;
60
51
  default:
61
52
  protocol.skip(ftype);
62
53
  }
@@ -86,12 +77,6 @@ var ContentAtomElementFieldsSerde = /** @class */ (function () {
86
77
  protocol.writeString(value1);
87
78
  protocol.writeFieldEnd();
88
79
  }
89
- if (value0.isMandatory !== null && value0.isMandatory !== undefined) {
90
- var value1 = value0.isMandatory;
91
- protocol.writeFieldBegin('isMandatory', thrift_1.Thrift.Type.BOOL, 4);
92
- protocol.writeBool(value1);
93
- protocol.writeFieldEnd();
94
- }
95
80
  protocol.writeFieldStop();
96
81
  protocol.writeStructEnd();
97
82
  };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Autogenerated by scrooge-generator-extras
3
+ *
4
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ */
6
+ import { TProtocol } from 'thrift';
7
+ import { ChannelFields } from './channelFields';
8
+ export interface ContentChannel {
9
+ channelId: string;
10
+ fields: ChannelFields;
11
+ }
12
+ export declare class ContentChannelSerde {
13
+ static read(protocol: TProtocol): ContentChannel;
14
+ static write(protocol: TProtocol, value0: ContentChannel): void;
15
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ /**
3
+ * Autogenerated by scrooge-generator-extras
4
+ *
5
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.ContentChannelSerde = void 0;
9
+ var thrift_1 = require("thrift");
10
+ var channelFields_1 = require("./channelFields");
11
+ var ContentChannelSerde = /** @class */ (function () {
12
+ function ContentChannelSerde() {
13
+ }
14
+ ContentChannelSerde.read = function (protocol) {
15
+ protocol.readStructBegin();
16
+ var result = {};
17
+ while (true) {
18
+ var ret = protocol.readFieldBegin();
19
+ var ftype = ret.ftype;
20
+ var fid = ret.fid;
21
+ if (ftype === thrift_1.Thrift.Type.STOP) {
22
+ break;
23
+ }
24
+ switch (fid) {
25
+ case 1:
26
+ if (ftype === thrift_1.Thrift.Type.STRING) {
27
+ var value1 = protocol.readString();
28
+ result.channelId = value1;
29
+ }
30
+ else {
31
+ protocol.skip(ftype);
32
+ }
33
+ break;
34
+ case 2:
35
+ if (ftype === thrift_1.Thrift.Type.STRUCT) {
36
+ var value1 = channelFields_1.ChannelFieldsSerde.read(protocol);
37
+ result.fields = value1;
38
+ }
39
+ else {
40
+ protocol.skip(ftype);
41
+ }
42
+ break;
43
+ default:
44
+ protocol.skip(ftype);
45
+ }
46
+ protocol.readFieldEnd();
47
+ }
48
+ protocol.readStructEnd();
49
+ // @ts-ignore
50
+ return result;
51
+ };
52
+ ContentChannelSerde.write = function (protocol, value0) {
53
+ protocol.writeStructBegin('ContentChannel');
54
+ if (value0.channelId !== null && value0.channelId !== undefined) {
55
+ var value1 = value0.channelId;
56
+ protocol.writeFieldBegin('channelId', thrift_1.Thrift.Type.STRING, 1);
57
+ protocol.writeString(value1);
58
+ protocol.writeFieldEnd();
59
+ }
60
+ if (value0.fields !== null && value0.fields !== undefined) {
61
+ var value1 = value0.fields;
62
+ protocol.writeFieldBegin('fields', thrift_1.Thrift.Type.STRUCT, 2);
63
+ channelFields_1.ChannelFieldsSerde.write(protocol, value1);
64
+ protocol.writeFieldEnd();
65
+ }
66
+ protocol.writeFieldStop();
67
+ protocol.writeStructEnd();
68
+ };
69
+ return ContentChannelSerde;
70
+ }());
71
+ exports.ContentChannelSerde = ContentChannelSerde;
@@ -12,7 +12,6 @@ export interface TweetElementFields {
12
12
  originalUrl?: string;
13
13
  role?: string;
14
14
  sourceDomain?: string;
15
- isMandatory?: boolean;
16
15
  }
17
16
  export declare class TweetElementFieldsSerde {
18
17
  static read(protocol: TProtocol): TweetElementFields;
@@ -84,15 +84,6 @@ var TweetElementFieldsSerde = /** @class */ (function () {
84
84
  protocol.skip(ftype);
85
85
  }
86
86
  break;
87
- case 10:
88
- if (ftype === thrift_1.Thrift.Type.BOOL) {
89
- var value1 = protocol.readBool();
90
- result.isMandatory = value1;
91
- }
92
- else {
93
- protocol.skip(ftype);
94
- }
95
- break;
96
87
  default:
97
88
  protocol.skip(ftype);
98
89
  }
@@ -146,12 +137,6 @@ var TweetElementFieldsSerde = /** @class */ (function () {
146
137
  protocol.writeString(value1);
147
138
  protocol.writeFieldEnd();
148
139
  }
149
- if (value0.isMandatory !== null && value0.isMandatory !== undefined) {
150
- var value1 = value0.isMandatory;
151
- protocol.writeFieldBegin('isMandatory', thrift_1.Thrift.Type.BOOL, 10);
152
- protocol.writeBool(value1);
153
- protocol.writeFieldEnd();
154
- }
155
140
  protocol.writeFieldStop();
156
141
  protocol.writeStructEnd();
157
142
  };
@@ -25,7 +25,6 @@ export interface VideoElementFields {
25
25
  role?: string;
26
26
  originalUrl?: string;
27
27
  sourceDomain?: string;
28
- isMandatory?: boolean;
29
28
  }
30
29
  export declare class VideoElementFieldsSerde {
31
30
  static read(protocol: TProtocol): VideoElementFields;
@@ -201,15 +201,6 @@ var VideoElementFieldsSerde = /** @class */ (function () {
201
201
  protocol.skip(ftype);
202
202
  }
203
203
  break;
204
- case 21:
205
- if (ftype === thrift_1.Thrift.Type.BOOL) {
206
- var value1 = protocol.readBool();
207
- result.isMandatory = value1;
208
- }
209
- else {
210
- protocol.skip(ftype);
211
- }
212
- break;
213
204
  default:
214
205
  protocol.skip(ftype);
215
206
  }
@@ -341,12 +332,6 @@ var VideoElementFieldsSerde = /** @class */ (function () {
341
332
  protocol.writeString(value1);
342
333
  protocol.writeFieldEnd();
343
334
  }
344
- if (value0.isMandatory !== null && value0.isMandatory !== undefined) {
345
- var value1 = value0.isMandatory;
346
- protocol.writeFieldBegin('isMandatory', thrift_1.Thrift.Type.BOOL, 21);
347
- protocol.writeBool(value1);
348
- protocol.writeFieldEnd();
349
- }
350
335
  protocol.writeFieldStop();
351
336
  protocol.writeStructEnd();
352
337
  };