@guardian/content-api-models 21.0.0 → 23.0.0-PREVIEW.timeline-model.2024-03-26T1038.17f5ef3f

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": "21.0.0",
4
+ "version": "23.0.0-PREVIEW.timeline-model.2024-03-26T1038.17f5ef3f",
5
5
  "description": "Typescript library built from the content api thrift definitions",
6
6
  "repository": {
7
7
  "type": "git",
@@ -23,8 +23,8 @@ export interface SchemaRecipe {
23
23
  cookTime?: string;
24
24
  totalTime?: string;
25
25
  author?: AuthorInfo;
26
- suitableForDiet?: string;
27
- cookingMethod?: string;
26
+ suitableForDiet?: string[];
27
+ cookingMethod?: string[];
28
28
  }
29
29
  export declare class SchemaRecipeSerde {
30
30
  static read(protocol: TProtocol): SchemaRecipe;
@@ -13,7 +13,7 @@ var SchemaRecipeSerde = /** @class */ (function () {
13
13
  function SchemaRecipeSerde() {
14
14
  }
15
15
  SchemaRecipeSerde.read = function (protocol) {
16
- var _a, _b, _c, _d, _e;
16
+ var _a, _b, _c, _d, _e, _f, _g;
17
17
  protocol.readStructBegin();
18
18
  var result = {};
19
19
  while (true) {
@@ -214,8 +214,17 @@ var SchemaRecipeSerde = /** @class */ (function () {
214
214
  }
215
215
  break;
216
216
  case 17:
217
- if (ftype === thrift_1.Thrift.Type.STRING) {
218
- var value1 = protocol.readString();
217
+ if (ftype === thrift_1.Thrift.Type.LIST) {
218
+ var listInfo1 = protocol.readListBegin();
219
+ var listSize1 = (_f = listInfo1.size) !== null && _f !== void 0 ? _f : 0;
220
+ var value1 = [];
221
+ if (listInfo1.etype === thrift_1.Thrift.Type.STRING) {
222
+ for (var i = 0; i < listSize1; i++) {
223
+ var value2 = protocol.readString();
224
+ value1.push(value2);
225
+ }
226
+ }
227
+ protocol.readListEnd();
219
228
  result.suitableForDiet = value1;
220
229
  }
221
230
  else {
@@ -223,8 +232,17 @@ var SchemaRecipeSerde = /** @class */ (function () {
223
232
  }
224
233
  break;
225
234
  case 18:
226
- if (ftype === thrift_1.Thrift.Type.STRING) {
227
- var value1 = protocol.readString();
235
+ if (ftype === thrift_1.Thrift.Type.LIST) {
236
+ var listInfo1 = protocol.readListBegin();
237
+ var listSize1 = (_g = listInfo1.size) !== null && _g !== void 0 ? _g : 0;
238
+ var value1 = [];
239
+ if (listInfo1.etype === thrift_1.Thrift.Type.STRING) {
240
+ for (var i = 0; i < listSize1; i++) {
241
+ var value2 = protocol.readString();
242
+ value1.push(value2);
243
+ }
244
+ }
245
+ protocol.readListEnd();
228
246
  result.cookingMethod = value1;
229
247
  }
230
248
  else {
@@ -360,14 +378,22 @@ var SchemaRecipeSerde = /** @class */ (function () {
360
378
  }
361
379
  if (value0.suitableForDiet !== null && value0.suitableForDiet !== undefined) {
362
380
  var value1 = value0.suitableForDiet;
363
- protocol.writeFieldBegin('suitableForDiet', thrift_1.Thrift.Type.STRING, 17);
364
- protocol.writeString(value1);
381
+ protocol.writeFieldBegin('suitableForDiet', thrift_1.Thrift.Type.LIST, 17);
382
+ protocol.writeListBegin(thrift_1.Thrift.Type.STRING, value1.length);
383
+ value1.forEach(function (value2) {
384
+ protocol.writeString(value2);
385
+ });
386
+ protocol.writeListEnd();
365
387
  protocol.writeFieldEnd();
366
388
  }
367
389
  if (value0.cookingMethod !== null && value0.cookingMethod !== undefined) {
368
390
  var value1 = value0.cookingMethod;
369
- protocol.writeFieldBegin('cookingMethod', thrift_1.Thrift.Type.STRING, 18);
370
- protocol.writeString(value1);
391
+ protocol.writeFieldBegin('cookingMethod', thrift_1.Thrift.Type.LIST, 18);
392
+ protocol.writeListBegin(thrift_1.Thrift.Type.STRING, value1.length);
393
+ value1.forEach(function (value2) {
394
+ protocol.writeString(value2);
395
+ });
396
+ protocol.writeListEnd();
371
397
  protocol.writeFieldEnd();
372
398
  }
373
399
  protocol.writeFieldStop();
@@ -24,6 +24,7 @@ import { RecipeElementFields } from './recipeElementFields';
24
24
  import { RichLinkElementFields } from './richLinkElementFields';
25
25
  import { StandardElementFields } from './standardElementFields';
26
26
  import { TextElementFields } from './textElementFields';
27
+ import { TimelineElementFields } from './timelineElementFields';
27
28
  import { TweetElementFields } from './tweetElementFields';
28
29
  import { VideoElementFields } from './videoElementFields';
29
30
  import { VineElementFields } from './vineElementFields';
@@ -55,6 +56,7 @@ export interface BlockElement {
55
56
  cartoonTypeData?: CartoonElementFields;
56
57
  recipeTypeData?: RecipeElementFields;
57
58
  listTypeData?: ListElementFields;
59
+ timelineTypeData?: TimelineElementFields;
58
60
  }
59
61
  export declare class BlockElementSerde {
60
62
  static read(protocol: TProtocol): BlockElement;
@@ -26,6 +26,7 @@ var recipeElementFields_1 = require("./recipeElementFields");
26
26
  var richLinkElementFields_1 = require("./richLinkElementFields");
27
27
  var standardElementFields_1 = require("./standardElementFields");
28
28
  var textElementFields_1 = require("./textElementFields");
29
+ var timelineElementFields_1 = require("./timelineElementFields");
29
30
  var tweetElementFields_1 = require("./tweetElementFields");
30
31
  var videoElementFields_1 = require("./videoElementFields");
31
32
  var vineElementFields_1 = require("./vineElementFields");
@@ -288,6 +289,15 @@ var BlockElementSerde = /** @class */ (function () {
288
289
  protocol.skip(ftype);
289
290
  }
290
291
  break;
292
+ case 27:
293
+ if (ftype === thrift_1.Thrift.Type.STRUCT) {
294
+ var value1 = timelineElementFields_1.TimelineElementFieldsSerde.read(protocol);
295
+ result.timelineTypeData = value1;
296
+ }
297
+ else {
298
+ protocol.skip(ftype);
299
+ }
300
+ break;
291
301
  default:
292
302
  protocol.skip(ftype);
293
303
  }
@@ -459,6 +469,12 @@ var BlockElementSerde = /** @class */ (function () {
459
469
  listElementFields_1.ListElementFieldsSerde.write(protocol, value1);
460
470
  protocol.writeFieldEnd();
461
471
  }
472
+ if (value0.timelineTypeData !== null && value0.timelineTypeData !== undefined) {
473
+ var value1 = value0.timelineTypeData;
474
+ protocol.writeFieldBegin('timelineTypeData', thrift_1.Thrift.Type.STRUCT, 27);
475
+ timelineElementFields_1.TimelineElementFieldsSerde.write(protocol, value1);
476
+ protocol.writeFieldEnd();
477
+ }
462
478
  protocol.writeFieldStop();
463
479
  protocol.writeStructEnd();
464
480
  };
@@ -27,5 +27,6 @@ export declare enum ElementType {
27
27
  CALLOUT = 20,
28
28
  CARTOON = 21,
29
29
  RECIPE = 22,
30
- LIST = 23
30
+ LIST = 23,
31
+ TIMELINE = 24
31
32
  }
package/v1/elementType.js CHANGED
@@ -32,4 +32,5 @@ var ElementType;
32
32
  ElementType[ElementType["CARTOON"] = 21] = "CARTOON";
33
33
  ElementType[ElementType["RECIPE"] = 22] = "RECIPE";
34
34
  ElementType[ElementType["LIST"] = 23] = "LIST";
35
+ ElementType[ElementType["TIMELINE"] = 24] = "TIMELINE";
35
36
  })(ElementType || (exports.ElementType = ElementType = {}));
@@ -0,0 +1,14 @@
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 { TimelineSection } from './timelineSection';
8
+ export interface TimelineElementFields {
9
+ sections: TimelineSection[];
10
+ }
11
+ export declare class TimelineElementFieldsSerde {
12
+ static read(protocol: TProtocol): TimelineElementFields;
13
+ static write(protocol: TProtocol, value0: TimelineElementFields): void;
14
+ }
@@ -0,0 +1,70 @@
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.TimelineElementFieldsSerde = void 0;
9
+ var thrift_1 = require("thrift");
10
+ var timelineSection_1 = require("./timelineSection");
11
+ var TimelineElementFieldsSerde = /** @class */ (function () {
12
+ function TimelineElementFieldsSerde() {
13
+ }
14
+ TimelineElementFieldsSerde.read = function (protocol) {
15
+ var _a;
16
+ protocol.readStructBegin();
17
+ var result = {};
18
+ while (true) {
19
+ var ret = protocol.readFieldBegin();
20
+ var ftype = ret.ftype;
21
+ var fid = ret.fid;
22
+ if (ftype === thrift_1.Thrift.Type.STOP) {
23
+ break;
24
+ }
25
+ switch (fid) {
26
+ case 1:
27
+ if (ftype === thrift_1.Thrift.Type.LIST) {
28
+ var listInfo1 = protocol.readListBegin();
29
+ var listSize1 = (_a = listInfo1.size) !== null && _a !== void 0 ? _a : 0;
30
+ var value1 = [];
31
+ if (listInfo1.etype === thrift_1.Thrift.Type.STRUCT) {
32
+ for (var i = 0; i < listSize1; i++) {
33
+ var value2 = timelineSection_1.TimelineSectionSerde.read(protocol);
34
+ value1.push(value2);
35
+ }
36
+ }
37
+ protocol.readListEnd();
38
+ result.sections = value1;
39
+ }
40
+ else {
41
+ protocol.skip(ftype);
42
+ }
43
+ break;
44
+ default:
45
+ protocol.skip(ftype);
46
+ }
47
+ protocol.readFieldEnd();
48
+ }
49
+ protocol.readStructEnd();
50
+ // @ts-ignore
51
+ return result;
52
+ };
53
+ TimelineElementFieldsSerde.write = function (protocol, value0) {
54
+ protocol.writeStructBegin('TimelineElementFields');
55
+ if (value0.sections !== null && value0.sections !== undefined) {
56
+ var value1 = value0.sections;
57
+ protocol.writeFieldBegin('sections', thrift_1.Thrift.Type.LIST, 1);
58
+ protocol.writeListBegin(thrift_1.Thrift.Type.STRUCT, value1.length);
59
+ value1.forEach(function (value2) {
60
+ timelineSection_1.TimelineSectionSerde.write(protocol, value2);
61
+ });
62
+ protocol.writeListEnd();
63
+ protocol.writeFieldEnd();
64
+ }
65
+ protocol.writeFieldStop();
66
+ protocol.writeStructEnd();
67
+ };
68
+ return TimelineElementFieldsSerde;
69
+ }());
70
+ exports.TimelineElementFieldsSerde = TimelineElementFieldsSerde;
@@ -0,0 +1,18 @@
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 { BlockElement } from './blockElement';
8
+ export interface TimelineEvent {
9
+ body: BlockElement[];
10
+ main?: BlockElement;
11
+ title?: string;
12
+ date?: string;
13
+ label?: string;
14
+ }
15
+ export declare class TimelineEventSerde {
16
+ static read(protocol: TProtocol): TimelineEvent;
17
+ static write(protocol: TProtocol, value0: TimelineEvent): void;
18
+ }
@@ -0,0 +1,132 @@
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.TimelineEventSerde = void 0;
9
+ var thrift_1 = require("thrift");
10
+ var blockElement_1 = require("./blockElement");
11
+ var TimelineEventSerde = /** @class */ (function () {
12
+ function TimelineEventSerde() {
13
+ }
14
+ TimelineEventSerde.read = function (protocol) {
15
+ var _a;
16
+ protocol.readStructBegin();
17
+ var result = {
18
+ body: [],
19
+ };
20
+ while (true) {
21
+ var ret = protocol.readFieldBegin();
22
+ var ftype = ret.ftype;
23
+ var fid = ret.fid;
24
+ if (ftype === thrift_1.Thrift.Type.STOP) {
25
+ break;
26
+ }
27
+ switch (fid) {
28
+ case 1:
29
+ if (ftype === thrift_1.Thrift.Type.LIST) {
30
+ var listInfo1 = protocol.readListBegin();
31
+ var listSize1 = (_a = listInfo1.size) !== null && _a !== void 0 ? _a : 0;
32
+ var value1 = [];
33
+ if (listInfo1.etype === thrift_1.Thrift.Type.STRUCT) {
34
+ for (var i = 0; i < listSize1; i++) {
35
+ var value2 = blockElement_1.BlockElementSerde.read(protocol);
36
+ value1.push(value2);
37
+ }
38
+ }
39
+ protocol.readListEnd();
40
+ result.body = value1;
41
+ }
42
+ else {
43
+ protocol.skip(ftype);
44
+ }
45
+ break;
46
+ case 2:
47
+ if (ftype === thrift_1.Thrift.Type.STRUCT) {
48
+ var value1 = blockElement_1.BlockElementSerde.read(protocol);
49
+ result.main = value1;
50
+ }
51
+ else {
52
+ protocol.skip(ftype);
53
+ }
54
+ break;
55
+ case 3:
56
+ if (ftype === thrift_1.Thrift.Type.STRING) {
57
+ var value1 = protocol.readString();
58
+ result.title = value1;
59
+ }
60
+ else {
61
+ protocol.skip(ftype);
62
+ }
63
+ break;
64
+ case 4:
65
+ if (ftype === thrift_1.Thrift.Type.STRING) {
66
+ var value1 = protocol.readString();
67
+ result.date = value1;
68
+ }
69
+ else {
70
+ protocol.skip(ftype);
71
+ }
72
+ break;
73
+ case 5:
74
+ if (ftype === thrift_1.Thrift.Type.STRING) {
75
+ var value1 = protocol.readString();
76
+ result.label = value1;
77
+ }
78
+ else {
79
+ protocol.skip(ftype);
80
+ }
81
+ break;
82
+ default:
83
+ protocol.skip(ftype);
84
+ }
85
+ protocol.readFieldEnd();
86
+ }
87
+ protocol.readStructEnd();
88
+ // @ts-ignore
89
+ return result;
90
+ };
91
+ TimelineEventSerde.write = function (protocol, value0) {
92
+ protocol.writeStructBegin('TimelineEvent');
93
+ if (value0.body !== null && value0.body !== undefined) {
94
+ var value1 = value0.body;
95
+ protocol.writeFieldBegin('body', thrift_1.Thrift.Type.LIST, 1);
96
+ protocol.writeListBegin(thrift_1.Thrift.Type.STRUCT, value1.length);
97
+ value1.forEach(function (value2) {
98
+ blockElement_1.BlockElementSerde.write(protocol, value2);
99
+ });
100
+ protocol.writeListEnd();
101
+ protocol.writeFieldEnd();
102
+ }
103
+ if (value0.main !== null && value0.main !== undefined) {
104
+ var value1 = value0.main;
105
+ protocol.writeFieldBegin('main', thrift_1.Thrift.Type.STRUCT, 2);
106
+ blockElement_1.BlockElementSerde.write(protocol, value1);
107
+ protocol.writeFieldEnd();
108
+ }
109
+ if (value0.title !== null && value0.title !== undefined) {
110
+ var value1 = value0.title;
111
+ protocol.writeFieldBegin('title', thrift_1.Thrift.Type.STRING, 3);
112
+ protocol.writeString(value1);
113
+ protocol.writeFieldEnd();
114
+ }
115
+ if (value0.date !== null && value0.date !== undefined) {
116
+ var value1 = value0.date;
117
+ protocol.writeFieldBegin('date', thrift_1.Thrift.Type.STRING, 4);
118
+ protocol.writeString(value1);
119
+ protocol.writeFieldEnd();
120
+ }
121
+ if (value0.label !== null && value0.label !== undefined) {
122
+ var value1 = value0.label;
123
+ protocol.writeFieldBegin('label', thrift_1.Thrift.Type.STRING, 5);
124
+ protocol.writeString(value1);
125
+ protocol.writeFieldEnd();
126
+ }
127
+ protocol.writeFieldStop();
128
+ protocol.writeStructEnd();
129
+ };
130
+ return TimelineEventSerde;
131
+ }());
132
+ exports.TimelineEventSerde = TimelineEventSerde;
@@ -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 { TimelineEvent } from './timelineEvent';
8
+ export interface TimelineSection {
9
+ events: TimelineEvent[];
10
+ title?: string;
11
+ }
12
+ export declare class TimelineSectionSerde {
13
+ static read(protocol: TProtocol): TimelineSection;
14
+ static write(protocol: TProtocol, value0: TimelineSection): void;
15
+ }
@@ -0,0 +1,85 @@
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.TimelineSectionSerde = void 0;
9
+ var thrift_1 = require("thrift");
10
+ var timelineEvent_1 = require("./timelineEvent");
11
+ var TimelineSectionSerde = /** @class */ (function () {
12
+ function TimelineSectionSerde() {
13
+ }
14
+ TimelineSectionSerde.read = function (protocol) {
15
+ var _a;
16
+ protocol.readStructBegin();
17
+ var result = {};
18
+ while (true) {
19
+ var ret = protocol.readFieldBegin();
20
+ var ftype = ret.ftype;
21
+ var fid = ret.fid;
22
+ if (ftype === thrift_1.Thrift.Type.STOP) {
23
+ break;
24
+ }
25
+ switch (fid) {
26
+ case 1:
27
+ if (ftype === thrift_1.Thrift.Type.LIST) {
28
+ var listInfo1 = protocol.readListBegin();
29
+ var listSize1 = (_a = listInfo1.size) !== null && _a !== void 0 ? _a : 0;
30
+ var value1 = [];
31
+ if (listInfo1.etype === thrift_1.Thrift.Type.STRUCT) {
32
+ for (var i = 0; i < listSize1; i++) {
33
+ var value2 = timelineEvent_1.TimelineEventSerde.read(protocol);
34
+ value1.push(value2);
35
+ }
36
+ }
37
+ protocol.readListEnd();
38
+ result.events = value1;
39
+ }
40
+ else {
41
+ protocol.skip(ftype);
42
+ }
43
+ break;
44
+ case 2:
45
+ if (ftype === thrift_1.Thrift.Type.STRING) {
46
+ var value1 = protocol.readString();
47
+ result.title = value1;
48
+ }
49
+ else {
50
+ protocol.skip(ftype);
51
+ }
52
+ break;
53
+ default:
54
+ protocol.skip(ftype);
55
+ }
56
+ protocol.readFieldEnd();
57
+ }
58
+ protocol.readStructEnd();
59
+ // @ts-ignore
60
+ return result;
61
+ };
62
+ TimelineSectionSerde.write = function (protocol, value0) {
63
+ protocol.writeStructBegin('TimelineSection');
64
+ if (value0.events !== null && value0.events !== undefined) {
65
+ var value1 = value0.events;
66
+ protocol.writeFieldBegin('events', thrift_1.Thrift.Type.LIST, 1);
67
+ protocol.writeListBegin(thrift_1.Thrift.Type.STRUCT, value1.length);
68
+ value1.forEach(function (value2) {
69
+ timelineEvent_1.TimelineEventSerde.write(protocol, value2);
70
+ });
71
+ protocol.writeListEnd();
72
+ protocol.writeFieldEnd();
73
+ }
74
+ if (value0.title !== null && value0.title !== undefined) {
75
+ var value1 = value0.title;
76
+ protocol.writeFieldBegin('title', thrift_1.Thrift.Type.STRING, 2);
77
+ protocol.writeString(value1);
78
+ protocol.writeFieldEnd();
79
+ }
80
+ protocol.writeFieldStop();
81
+ protocol.writeStructEnd();
82
+ };
83
+ return TimelineSectionSerde;
84
+ }());
85
+ exports.TimelineSectionSerde = TimelineSectionSerde;