@guardian/content-api-models 17.4.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/crier/event/v1/eventPayload.d.ts +1 -1
- package/package.json +12 -11
- package/v1/channelFields.d.ts +15 -0
- package/v1/channelFields.js +71 -0
- package/v1/content.d.ts +2 -0
- package/v1/content.js +30 -1
- package/v1/contentChannel.d.ts +15 -0
- package/v1/contentChannel.js +71 -0
|
@@ -8,7 +8,7 @@ import { Content } from '../../../v1/content';
|
|
|
8
8
|
import { DeletedContent } from './deletedContent';
|
|
9
9
|
import { RetrievableContent } from './retrievableContent';
|
|
10
10
|
import { Atom } from '@guardian/content-atom-model/atom';
|
|
11
|
-
export
|
|
11
|
+
export type EventPayload = {
|
|
12
12
|
kind: "content";
|
|
13
13
|
content: Content;
|
|
14
14
|
} | {
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
|
|
1
2
|
{
|
|
2
3
|
"name": "@guardian/content-api-models",
|
|
3
|
-
"version": "17.
|
|
4
|
+
"version": "17.6.0-beta.0",
|
|
4
5
|
"description": "Typescript library built from the content api thrift definitions",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
@@ -9,15 +10,15 @@
|
|
|
9
10
|
"author": "",
|
|
10
11
|
"license": "Apache-2.0",
|
|
11
12
|
"devDependencies": {
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
"typescript": "^4.5.4"
|
|
14
|
+
},
|
|
14
15
|
"dependencies": {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
16
|
+
"@guardian/story-packages-model": "^2.2.0",
|
|
17
|
+
"@guardian/content-entity-model": "^2.2.1",
|
|
18
|
+
"@types/thrift": "^0.10.11",
|
|
19
|
+
"thrift": "^0.15.0",
|
|
20
|
+
"@guardian/content-atom-model": "^3.4.0",
|
|
21
|
+
"@types/node-int64": "^0.4.29",
|
|
22
|
+
"node-int64": "^0.4.0"
|
|
23
23
|
}
|
|
24
|
+
}
|
|
@@ -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;
|
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
|
};
|
|
@@ -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;
|