@guardian/content-api-models 31.1.0 → 32.0.0-PREVIEW.filterproduct-element-temp.2025-10-15T1557.c1c37df6

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": "31.1.0",
4
+ "version": "32.0.0-PREVIEW.filterproduct-element-temp.2025-10-15T1557.c1c37df6",
5
5
  "description": "Typescript library built from the content api thrift definitions",
6
6
  "repository": {
7
7
  "type": "git",
@@ -20,6 +20,7 @@ import { InteractiveElementFields } from './interactiveElementFields';
20
20
  import { LinkElementFields } from './linkElementFields';
21
21
  import { ListElementFields } from './listElementFields';
22
22
  import { MembershipElementFields } from './membershipElementFields';
23
+ import { ProductElementFields } from './productElementFields';
23
24
  import { PullquoteElementFields } from './pullquoteElementFields';
24
25
  import { RecipeElementFields } from './recipeElementFields';
25
26
  import { RichLinkElementFields } from './richLinkElementFields';
@@ -59,6 +60,7 @@ export interface BlockElement {
59
60
  listTypeData?: ListElementFields;
60
61
  timelineTypeData?: TimelineElementFields;
61
62
  linkTypeData?: LinkElementFields;
63
+ tempProductTypeData?: ProductElementFields;
62
64
  }
63
65
  export declare class BlockElementSerde {
64
66
  static read(protocol: TProtocol): BlockElement;
@@ -22,6 +22,7 @@ var interactiveElementFields_1 = require("./interactiveElementFields");
22
22
  var linkElementFields_1 = require("./linkElementFields");
23
23
  var listElementFields_1 = require("./listElementFields");
24
24
  var membershipElementFields_1 = require("./membershipElementFields");
25
+ var productElementFields_1 = require("./productElementFields");
25
26
  var pullquoteElementFields_1 = require("./pullquoteElementFields");
26
27
  var recipeElementFields_1 = require("./recipeElementFields");
27
28
  var richLinkElementFields_1 = require("./richLinkElementFields");
@@ -308,6 +309,15 @@ var BlockElementSerde = /** @class */ (function () {
308
309
  protocol.skip(ftype);
309
310
  }
310
311
  break;
312
+ case 29:
313
+ if (ftype === thrift_1.Thrift.Type.STRUCT) {
314
+ var value1 = productElementFields_1.ProductElementFieldsSerde.read(protocol);
315
+ result.tempProductTypeData = value1;
316
+ }
317
+ else {
318
+ protocol.skip(ftype);
319
+ }
320
+ break;
311
321
  default:
312
322
  protocol.skip(ftype);
313
323
  }
@@ -491,6 +501,12 @@ var BlockElementSerde = /** @class */ (function () {
491
501
  linkElementFields_1.LinkElementFieldsSerde.write(protocol, value1);
492
502
  protocol.writeFieldEnd();
493
503
  }
504
+ if (value0.tempProductTypeData !== null && value0.tempProductTypeData !== undefined) {
505
+ var value1 = value0.tempProductTypeData;
506
+ protocol.writeFieldBegin('tempProductTypeData', thrift_1.Thrift.Type.STRUCT, 29);
507
+ productElementFields_1.ProductElementFieldsSerde.write(protocol, value1);
508
+ protocol.writeFieldEnd();
509
+ }
494
510
  protocol.writeFieldStop();
495
511
  protocol.writeStructEnd();
496
512
  };
@@ -29,5 +29,6 @@ export declare enum ElementType {
29
29
  RECIPE = 22,
30
30
  LIST = 23,
31
31
  TIMELINE = 24,
32
- LINK = 25
32
+ LINK = 25,
33
+ PRODUCT = 26
33
34
  }
package/v1/elementType.js CHANGED
@@ -34,4 +34,5 @@ var ElementType;
34
34
  ElementType[ElementType["LIST"] = 23] = "LIST";
35
35
  ElementType[ElementType["TIMELINE"] = 24] = "TIMELINE";
36
36
  ElementType[ElementType["LINK"] = 25] = "LINK";
37
+ ElementType[ElementType["PRODUCT"] = 26] = "PRODUCT";
37
38
  })(ElementType || (exports.ElementType = ElementType = {}));
@@ -0,0 +1,16 @@
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
+ export interface ProductCTA {
8
+ url?: string;
9
+ text?: string;
10
+ retailer?: string;
11
+ price?: string;
12
+ }
13
+ export declare class ProductCTASerde {
14
+ static read(protocol: TProtocol): ProductCTA;
15
+ static write(protocol: TProtocol, value0: ProductCTA): void;
16
+ }
@@ -0,0 +1,100 @@
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.ProductCTASerde = void 0;
9
+ var thrift_1 = require("thrift");
10
+ var ProductCTASerde = /** @class */ (function () {
11
+ function ProductCTASerde() {
12
+ }
13
+ ProductCTASerde.read = function (protocol) {
14
+ protocol.readStructBegin();
15
+ var result = {};
16
+ while (true) {
17
+ var ret = protocol.readFieldBegin();
18
+ var ftype = ret.ftype;
19
+ var fid = ret.fid;
20
+ if (ftype === thrift_1.Thrift.Type.STOP) {
21
+ break;
22
+ }
23
+ switch (fid) {
24
+ case 1:
25
+ if (ftype === thrift_1.Thrift.Type.STRING) {
26
+ var value1 = protocol.readString();
27
+ result.url = value1;
28
+ }
29
+ else {
30
+ protocol.skip(ftype);
31
+ }
32
+ break;
33
+ case 2:
34
+ if (ftype === thrift_1.Thrift.Type.STRING) {
35
+ var value1 = protocol.readString();
36
+ result.text = value1;
37
+ }
38
+ else {
39
+ protocol.skip(ftype);
40
+ }
41
+ break;
42
+ case 3:
43
+ if (ftype === thrift_1.Thrift.Type.STRING) {
44
+ var value1 = protocol.readString();
45
+ result.retailer = value1;
46
+ }
47
+ else {
48
+ protocol.skip(ftype);
49
+ }
50
+ break;
51
+ case 4:
52
+ if (ftype === thrift_1.Thrift.Type.STRING) {
53
+ var value1 = protocol.readString();
54
+ result.price = value1;
55
+ }
56
+ else {
57
+ protocol.skip(ftype);
58
+ }
59
+ break;
60
+ default:
61
+ protocol.skip(ftype);
62
+ }
63
+ protocol.readFieldEnd();
64
+ }
65
+ protocol.readStructEnd();
66
+ // @ts-ignore
67
+ return result;
68
+ };
69
+ ProductCTASerde.write = function (protocol, value0) {
70
+ protocol.writeStructBegin('ProductCTA');
71
+ if (value0.url !== null && value0.url !== undefined) {
72
+ var value1 = value0.url;
73
+ protocol.writeFieldBegin('url', thrift_1.Thrift.Type.STRING, 1);
74
+ protocol.writeString(value1);
75
+ protocol.writeFieldEnd();
76
+ }
77
+ if (value0.text !== null && value0.text !== undefined) {
78
+ var value1 = value0.text;
79
+ protocol.writeFieldBegin('text', thrift_1.Thrift.Type.STRING, 2);
80
+ protocol.writeString(value1);
81
+ protocol.writeFieldEnd();
82
+ }
83
+ if (value0.retailer !== null && value0.retailer !== undefined) {
84
+ var value1 = value0.retailer;
85
+ protocol.writeFieldBegin('retailer', thrift_1.Thrift.Type.STRING, 3);
86
+ protocol.writeString(value1);
87
+ protocol.writeFieldEnd();
88
+ }
89
+ if (value0.price !== null && value0.price !== undefined) {
90
+ var value1 = value0.price;
91
+ protocol.writeFieldBegin('price', thrift_1.Thrift.Type.STRING, 4);
92
+ protocol.writeString(value1);
93
+ protocol.writeFieldEnd();
94
+ }
95
+ protocol.writeFieldStop();
96
+ protocol.writeStructEnd();
97
+ };
98
+ return ProductCTASerde;
99
+ }());
100
+ exports.ProductCTASerde = ProductCTASerde;
@@ -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
+ export interface ProductCustomAttribute {
8
+ name?: string;
9
+ value?: string;
10
+ }
11
+ export declare class ProductCustomAttributeSerde {
12
+ static read(protocol: TProtocol): ProductCustomAttribute;
13
+ static write(protocol: TProtocol, value0: ProductCustomAttribute): 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.ProductCustomAttributeSerde = void 0;
9
+ var thrift_1 = require("thrift");
10
+ var ProductCustomAttributeSerde = /** @class */ (function () {
11
+ function ProductCustomAttributeSerde() {
12
+ }
13
+ ProductCustomAttributeSerde.read = function (protocol) {
14
+ protocol.readStructBegin();
15
+ var result = {};
16
+ while (true) {
17
+ var ret = protocol.readFieldBegin();
18
+ var ftype = ret.ftype;
19
+ var fid = ret.fid;
20
+ if (ftype === thrift_1.Thrift.Type.STOP) {
21
+ break;
22
+ }
23
+ switch (fid) {
24
+ case 1:
25
+ if (ftype === thrift_1.Thrift.Type.STRING) {
26
+ var value1 = protocol.readString();
27
+ result.name = value1;
28
+ }
29
+ else {
30
+ protocol.skip(ftype);
31
+ }
32
+ break;
33
+ case 2:
34
+ if (ftype === thrift_1.Thrift.Type.STRING) {
35
+ var value1 = protocol.readString();
36
+ result.value = value1;
37
+ }
38
+ else {
39
+ protocol.skip(ftype);
40
+ }
41
+ break;
42
+ default:
43
+ protocol.skip(ftype);
44
+ }
45
+ protocol.readFieldEnd();
46
+ }
47
+ protocol.readStructEnd();
48
+ // @ts-ignore
49
+ return result;
50
+ };
51
+ ProductCustomAttributeSerde.write = function (protocol, value0) {
52
+ protocol.writeStructBegin('ProductCustomAttribute');
53
+ if (value0.name !== null && value0.name !== undefined) {
54
+ var value1 = value0.name;
55
+ protocol.writeFieldBegin('name', thrift_1.Thrift.Type.STRING, 1);
56
+ protocol.writeString(value1);
57
+ protocol.writeFieldEnd();
58
+ }
59
+ if (value0.value !== null && value0.value !== undefined) {
60
+ var value1 = value0.value;
61
+ protocol.writeFieldBegin('value', thrift_1.Thrift.Type.STRING, 2);
62
+ protocol.writeString(value1);
63
+ protocol.writeFieldEnd();
64
+ }
65
+ protocol.writeFieldStop();
66
+ protocol.writeStructEnd();
67
+ };
68
+ return ProductCustomAttributeSerde;
69
+ }());
70
+ exports.ProductCustomAttributeSerde = ProductCustomAttributeSerde;
@@ -0,0 +1,10 @@
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
+ export declare enum ProductDisplayType {
7
+ INLINE_WITH_PRODUCT_CARD = 0,
8
+ INLINE_ONLY = 1,
9
+ PRODUCT_CARD_ONLY = 2
10
+ }
@@ -0,0 +1,14 @@
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.ProductDisplayType = void 0;
9
+ var ProductDisplayType;
10
+ (function (ProductDisplayType) {
11
+ ProductDisplayType[ProductDisplayType["INLINE_WITH_PRODUCT_CARD"] = 0] = "INLINE_WITH_PRODUCT_CARD";
12
+ ProductDisplayType[ProductDisplayType["INLINE_ONLY"] = 1] = "INLINE_ONLY";
13
+ ProductDisplayType[ProductDisplayType["PRODUCT_CARD_ONLY"] = 2] = "PRODUCT_CARD_ONLY";
14
+ })(ProductDisplayType || (exports.ProductDisplayType = ProductDisplayType = {}));
@@ -0,0 +1,27 @@
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
+ import { ProductCTA } from './productCTA';
9
+ import { ProductCustomAttribute } from './productCustomAttribute';
10
+ import { ProductDisplayType } from './productDisplayType';
11
+ import { ProductImage } from './productImage';
12
+ export interface ProductElementFields {
13
+ productName?: string;
14
+ brandName?: string;
15
+ primaryHeading?: string;
16
+ secondaryHeading?: string;
17
+ displayType: ProductDisplayType;
18
+ starRating?: string;
19
+ productCtas?: ProductCTA[];
20
+ customAttributes?: ProductCustomAttribute[];
21
+ image?: ProductImage;
22
+ content?: BlockElement[];
23
+ }
24
+ export declare class ProductElementFieldsSerde {
25
+ static read(protocol: TProtocol): ProductElementFields;
26
+ static write(protocol: TProtocol, value0: ProductElementFields): void;
27
+ }
@@ -0,0 +1,234 @@
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.ProductElementFieldsSerde = void 0;
9
+ var thrift_1 = require("thrift");
10
+ var blockElement_1 = require("./blockElement");
11
+ var productCTA_1 = require("./productCTA");
12
+ var productCustomAttribute_1 = require("./productCustomAttribute");
13
+ var productImage_1 = require("./productImage");
14
+ var ProductElementFieldsSerde = /** @class */ (function () {
15
+ function ProductElementFieldsSerde() {
16
+ }
17
+ ProductElementFieldsSerde.read = function (protocol) {
18
+ var _a, _b, _c;
19
+ protocol.readStructBegin();
20
+ var result = {};
21
+ while (true) {
22
+ var ret = protocol.readFieldBegin();
23
+ var ftype = ret.ftype;
24
+ var fid = ret.fid;
25
+ if (ftype === thrift_1.Thrift.Type.STOP) {
26
+ break;
27
+ }
28
+ switch (fid) {
29
+ case 1:
30
+ if (ftype === thrift_1.Thrift.Type.STRING) {
31
+ var value1 = protocol.readString();
32
+ result.productName = value1;
33
+ }
34
+ else {
35
+ protocol.skip(ftype);
36
+ }
37
+ break;
38
+ case 2:
39
+ if (ftype === thrift_1.Thrift.Type.STRING) {
40
+ var value1 = protocol.readString();
41
+ result.brandName = value1;
42
+ }
43
+ else {
44
+ protocol.skip(ftype);
45
+ }
46
+ break;
47
+ case 3:
48
+ if (ftype === thrift_1.Thrift.Type.STRING) {
49
+ var value1 = protocol.readString();
50
+ result.primaryHeading = value1;
51
+ }
52
+ else {
53
+ protocol.skip(ftype);
54
+ }
55
+ break;
56
+ case 4:
57
+ if (ftype === thrift_1.Thrift.Type.STRING) {
58
+ var value1 = protocol.readString();
59
+ result.secondaryHeading = value1;
60
+ }
61
+ else {
62
+ protocol.skip(ftype);
63
+ }
64
+ break;
65
+ case 5:
66
+ if (ftype === thrift_1.Thrift.Type.I32) {
67
+ var value1 = protocol.readI32();
68
+ result.displayType = value1;
69
+ }
70
+ else {
71
+ protocol.skip(ftype);
72
+ }
73
+ break;
74
+ case 6:
75
+ if (ftype === thrift_1.Thrift.Type.STRING) {
76
+ var value1 = protocol.readString();
77
+ result.starRating = value1;
78
+ }
79
+ else {
80
+ protocol.skip(ftype);
81
+ }
82
+ break;
83
+ case 7:
84
+ if (ftype === thrift_1.Thrift.Type.LIST) {
85
+ var listInfo1 = protocol.readListBegin();
86
+ var listSize1 = (_a = listInfo1.size) !== null && _a !== void 0 ? _a : 0;
87
+ var value1 = [];
88
+ if (listInfo1.etype === thrift_1.Thrift.Type.STRUCT) {
89
+ for (var i = 0; i < listSize1; i++) {
90
+ var value2 = productCTA_1.ProductCTASerde.read(protocol);
91
+ value1.push(value2);
92
+ }
93
+ }
94
+ protocol.readListEnd();
95
+ result.productCtas = value1;
96
+ }
97
+ else {
98
+ protocol.skip(ftype);
99
+ }
100
+ break;
101
+ case 8:
102
+ if (ftype === thrift_1.Thrift.Type.LIST) {
103
+ var listInfo1 = protocol.readListBegin();
104
+ var listSize1 = (_b = listInfo1.size) !== null && _b !== void 0 ? _b : 0;
105
+ var value1 = [];
106
+ if (listInfo1.etype === thrift_1.Thrift.Type.STRUCT) {
107
+ for (var i = 0; i < listSize1; i++) {
108
+ var value2 = productCustomAttribute_1.ProductCustomAttributeSerde.read(protocol);
109
+ value1.push(value2);
110
+ }
111
+ }
112
+ protocol.readListEnd();
113
+ result.customAttributes = value1;
114
+ }
115
+ else {
116
+ protocol.skip(ftype);
117
+ }
118
+ break;
119
+ case 9:
120
+ if (ftype === thrift_1.Thrift.Type.STRUCT) {
121
+ var value1 = productImage_1.ProductImageSerde.read(protocol);
122
+ result.image = value1;
123
+ }
124
+ else {
125
+ protocol.skip(ftype);
126
+ }
127
+ break;
128
+ case 10:
129
+ if (ftype === thrift_1.Thrift.Type.LIST) {
130
+ var listInfo1 = protocol.readListBegin();
131
+ var listSize1 = (_c = listInfo1.size) !== null && _c !== void 0 ? _c : 0;
132
+ var value1 = [];
133
+ if (listInfo1.etype === thrift_1.Thrift.Type.STRUCT) {
134
+ for (var i = 0; i < listSize1; i++) {
135
+ var value2 = blockElement_1.BlockElementSerde.read(protocol);
136
+ value1.push(value2);
137
+ }
138
+ }
139
+ protocol.readListEnd();
140
+ result.content = value1;
141
+ }
142
+ else {
143
+ protocol.skip(ftype);
144
+ }
145
+ break;
146
+ default:
147
+ protocol.skip(ftype);
148
+ }
149
+ protocol.readFieldEnd();
150
+ }
151
+ protocol.readStructEnd();
152
+ // @ts-ignore
153
+ return result;
154
+ };
155
+ ProductElementFieldsSerde.write = function (protocol, value0) {
156
+ protocol.writeStructBegin('ProductElementFields');
157
+ if (value0.productName !== null && value0.productName !== undefined) {
158
+ var value1 = value0.productName;
159
+ protocol.writeFieldBegin('productName', thrift_1.Thrift.Type.STRING, 1);
160
+ protocol.writeString(value1);
161
+ protocol.writeFieldEnd();
162
+ }
163
+ if (value0.brandName !== null && value0.brandName !== undefined) {
164
+ var value1 = value0.brandName;
165
+ protocol.writeFieldBegin('brandName', thrift_1.Thrift.Type.STRING, 2);
166
+ protocol.writeString(value1);
167
+ protocol.writeFieldEnd();
168
+ }
169
+ if (value0.primaryHeading !== null && value0.primaryHeading !== undefined) {
170
+ var value1 = value0.primaryHeading;
171
+ protocol.writeFieldBegin('primaryHeading', thrift_1.Thrift.Type.STRING, 3);
172
+ protocol.writeString(value1);
173
+ protocol.writeFieldEnd();
174
+ }
175
+ if (value0.secondaryHeading !== null && value0.secondaryHeading !== undefined) {
176
+ var value1 = value0.secondaryHeading;
177
+ protocol.writeFieldBegin('secondaryHeading', thrift_1.Thrift.Type.STRING, 4);
178
+ protocol.writeString(value1);
179
+ protocol.writeFieldEnd();
180
+ }
181
+ if (value0.displayType !== null && value0.displayType !== undefined) {
182
+ var value1 = value0.displayType;
183
+ protocol.writeFieldBegin('displayType', thrift_1.Thrift.Type.I32, 5);
184
+ protocol.writeI32(value1);
185
+ protocol.writeFieldEnd();
186
+ }
187
+ if (value0.starRating !== null && value0.starRating !== undefined) {
188
+ var value1 = value0.starRating;
189
+ protocol.writeFieldBegin('starRating', thrift_1.Thrift.Type.STRING, 6);
190
+ protocol.writeString(value1);
191
+ protocol.writeFieldEnd();
192
+ }
193
+ if (value0.productCtas !== null && value0.productCtas !== undefined) {
194
+ var value1 = value0.productCtas;
195
+ protocol.writeFieldBegin('productCtas', thrift_1.Thrift.Type.LIST, 7);
196
+ protocol.writeListBegin(thrift_1.Thrift.Type.STRUCT, value1.length);
197
+ value1.forEach(function (value2) {
198
+ productCTA_1.ProductCTASerde.write(protocol, value2);
199
+ });
200
+ protocol.writeListEnd();
201
+ protocol.writeFieldEnd();
202
+ }
203
+ if (value0.customAttributes !== null && value0.customAttributes !== undefined) {
204
+ var value1 = value0.customAttributes;
205
+ protocol.writeFieldBegin('customAttributes', thrift_1.Thrift.Type.LIST, 8);
206
+ protocol.writeListBegin(thrift_1.Thrift.Type.STRUCT, value1.length);
207
+ value1.forEach(function (value2) {
208
+ productCustomAttribute_1.ProductCustomAttributeSerde.write(protocol, value2);
209
+ });
210
+ protocol.writeListEnd();
211
+ protocol.writeFieldEnd();
212
+ }
213
+ if (value0.image !== null && value0.image !== undefined) {
214
+ var value1 = value0.image;
215
+ protocol.writeFieldBegin('image', thrift_1.Thrift.Type.STRUCT, 9);
216
+ productImage_1.ProductImageSerde.write(protocol, value1);
217
+ protocol.writeFieldEnd();
218
+ }
219
+ if (value0.content !== null && value0.content !== undefined) {
220
+ var value1 = value0.content;
221
+ protocol.writeFieldBegin('content', thrift_1.Thrift.Type.LIST, 10);
222
+ protocol.writeListBegin(thrift_1.Thrift.Type.STRUCT, value1.length);
223
+ value1.forEach(function (value2) {
224
+ blockElement_1.BlockElementSerde.write(protocol, value2);
225
+ });
226
+ protocol.writeListEnd();
227
+ protocol.writeFieldEnd();
228
+ }
229
+ protocol.writeFieldStop();
230
+ protocol.writeStructEnd();
231
+ };
232
+ return ProductElementFieldsSerde;
233
+ }());
234
+ exports.ProductElementFieldsSerde = ProductElementFieldsSerde;
@@ -0,0 +1,20 @@
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
+ export interface ProductImage {
8
+ caption?: string;
9
+ displayCredit?: boolean;
10
+ source?: string;
11
+ photographer?: string;
12
+ alt?: string;
13
+ mediaId?: string;
14
+ file?: string;
15
+ suppliersReference?: string;
16
+ }
17
+ export declare class ProductImageSerde {
18
+ static read(protocol: TProtocol): ProductImage;
19
+ static write(protocol: TProtocol, value0: ProductImage): void;
20
+ }
@@ -0,0 +1,160 @@
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.ProductImageSerde = void 0;
9
+ var thrift_1 = require("thrift");
10
+ var ProductImageSerde = /** @class */ (function () {
11
+ function ProductImageSerde() {
12
+ }
13
+ ProductImageSerde.read = function (protocol) {
14
+ protocol.readStructBegin();
15
+ var result = {};
16
+ while (true) {
17
+ var ret = protocol.readFieldBegin();
18
+ var ftype = ret.ftype;
19
+ var fid = ret.fid;
20
+ if (ftype === thrift_1.Thrift.Type.STOP) {
21
+ break;
22
+ }
23
+ switch (fid) {
24
+ case 1:
25
+ if (ftype === thrift_1.Thrift.Type.STRING) {
26
+ var value1 = protocol.readString();
27
+ result.caption = value1;
28
+ }
29
+ else {
30
+ protocol.skip(ftype);
31
+ }
32
+ break;
33
+ case 2:
34
+ if (ftype === thrift_1.Thrift.Type.BOOL) {
35
+ var value1 = protocol.readBool();
36
+ result.displayCredit = value1;
37
+ }
38
+ else {
39
+ protocol.skip(ftype);
40
+ }
41
+ break;
42
+ case 3:
43
+ if (ftype === thrift_1.Thrift.Type.STRING) {
44
+ var value1 = protocol.readString();
45
+ result.source = value1;
46
+ }
47
+ else {
48
+ protocol.skip(ftype);
49
+ }
50
+ break;
51
+ case 4:
52
+ if (ftype === thrift_1.Thrift.Type.STRING) {
53
+ var value1 = protocol.readString();
54
+ result.photographer = value1;
55
+ }
56
+ else {
57
+ protocol.skip(ftype);
58
+ }
59
+ break;
60
+ case 5:
61
+ if (ftype === thrift_1.Thrift.Type.STRING) {
62
+ var value1 = protocol.readString();
63
+ result.alt = value1;
64
+ }
65
+ else {
66
+ protocol.skip(ftype);
67
+ }
68
+ break;
69
+ case 6:
70
+ if (ftype === thrift_1.Thrift.Type.STRING) {
71
+ var value1 = protocol.readString();
72
+ result.mediaId = value1;
73
+ }
74
+ else {
75
+ protocol.skip(ftype);
76
+ }
77
+ break;
78
+ case 7:
79
+ if (ftype === thrift_1.Thrift.Type.STRING) {
80
+ var value1 = protocol.readString();
81
+ result.file = value1;
82
+ }
83
+ else {
84
+ protocol.skip(ftype);
85
+ }
86
+ break;
87
+ case 8:
88
+ if (ftype === thrift_1.Thrift.Type.STRING) {
89
+ var value1 = protocol.readString();
90
+ result.suppliersReference = value1;
91
+ }
92
+ else {
93
+ protocol.skip(ftype);
94
+ }
95
+ break;
96
+ default:
97
+ protocol.skip(ftype);
98
+ }
99
+ protocol.readFieldEnd();
100
+ }
101
+ protocol.readStructEnd();
102
+ // @ts-ignore
103
+ return result;
104
+ };
105
+ ProductImageSerde.write = function (protocol, value0) {
106
+ protocol.writeStructBegin('ProductImage');
107
+ if (value0.caption !== null && value0.caption !== undefined) {
108
+ var value1 = value0.caption;
109
+ protocol.writeFieldBegin('caption', thrift_1.Thrift.Type.STRING, 1);
110
+ protocol.writeString(value1);
111
+ protocol.writeFieldEnd();
112
+ }
113
+ if (value0.displayCredit !== null && value0.displayCredit !== undefined) {
114
+ var value1 = value0.displayCredit;
115
+ protocol.writeFieldBegin('displayCredit', thrift_1.Thrift.Type.BOOL, 2);
116
+ protocol.writeBool(value1);
117
+ protocol.writeFieldEnd();
118
+ }
119
+ if (value0.source !== null && value0.source !== undefined) {
120
+ var value1 = value0.source;
121
+ protocol.writeFieldBegin('source', thrift_1.Thrift.Type.STRING, 3);
122
+ protocol.writeString(value1);
123
+ protocol.writeFieldEnd();
124
+ }
125
+ if (value0.photographer !== null && value0.photographer !== undefined) {
126
+ var value1 = value0.photographer;
127
+ protocol.writeFieldBegin('photographer', thrift_1.Thrift.Type.STRING, 4);
128
+ protocol.writeString(value1);
129
+ protocol.writeFieldEnd();
130
+ }
131
+ if (value0.alt !== null && value0.alt !== undefined) {
132
+ var value1 = value0.alt;
133
+ protocol.writeFieldBegin('alt', thrift_1.Thrift.Type.STRING, 5);
134
+ protocol.writeString(value1);
135
+ protocol.writeFieldEnd();
136
+ }
137
+ if (value0.mediaId !== null && value0.mediaId !== undefined) {
138
+ var value1 = value0.mediaId;
139
+ protocol.writeFieldBegin('mediaId', thrift_1.Thrift.Type.STRING, 6);
140
+ protocol.writeString(value1);
141
+ protocol.writeFieldEnd();
142
+ }
143
+ if (value0.file !== null && value0.file !== undefined) {
144
+ var value1 = value0.file;
145
+ protocol.writeFieldBegin('file', thrift_1.Thrift.Type.STRING, 7);
146
+ protocol.writeString(value1);
147
+ protocol.writeFieldEnd();
148
+ }
149
+ if (value0.suppliersReference !== null && value0.suppliersReference !== undefined) {
150
+ var value1 = value0.suppliersReference;
151
+ protocol.writeFieldBegin('suppliersReference', thrift_1.Thrift.Type.STRING, 8);
152
+ protocol.writeString(value1);
153
+ protocol.writeFieldEnd();
154
+ }
155
+ protocol.writeFieldStop();
156
+ protocol.writeStructEnd();
157
+ };
158
+ return ProductImageSerde;
159
+ }());
160
+ exports.ProductImageSerde = ProductImageSerde;