@prezly/sdk 10.1.0-0 → 10.2.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/dist/api/constants.js +1 -1
- package/dist/endpoints/Stories/Client.d.ts +35 -5
- package/dist/endpoints/Stories/Client.js +150 -6
- package/dist/endpoints/Stories/index.d.ts +1 -0
- package/dist/endpoints/Stories/index.js +2 -1
- package/dist/endpoints/Stories/scopes.d.ts +2 -0
- package/dist/endpoints/Stories/scopes.js +8 -0
- package/dist/endpoints/Stories/types.d.ts +45 -16
- package/dist/endpoints/Stories/types.js +43 -1
- package/dist/types/Story.d.ts +83 -12
- package/package.json +1 -1
package/dist/api/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DeferredJobsApiClient } from '../../api';
|
|
2
2
|
import type { ExtendedStory, Story } from '../../types';
|
|
3
|
-
import type { ListOptions, ListResponse, SearchOptions,
|
|
3
|
+
import type { AutosaveRequest, CreateRequest, IncludeOptions, ListOptions, ListResponse, PublishRequest, RevertRequest, ScheduleRequest, SearchOptions, UnpublishRequest, UnscheduleRequest, UpdateRequest } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* `uuid` is the preferred way of targeting a Story. Numeric `id` is considered deprecated.
|
|
6
6
|
*/
|
|
@@ -9,9 +9,39 @@ export declare class Client {
|
|
|
9
9
|
private readonly apiClient;
|
|
10
10
|
constructor(apiClient: DeferredJobsApiClient);
|
|
11
11
|
list<Include extends readonly (keyof Story.ExtraFields)[], Options extends ListOptions<Include>, StoryRecord extends Story = Options['include'] extends Include ? Story & Pick<Story.ExtraFields, Options['include'][number]> : Story>(options?: Options): Promise<ListResponse<StoryRecord>>;
|
|
12
|
-
search<Include extends readonly (keyof Story.ExtraFields)[], Options extends
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
search<Include extends readonly (keyof Story.ExtraFields)[], Options extends SearchOptions<Include>, StoryRecord extends Story = Options['include'] extends Include ? Story & Pick<Story.ExtraFields, Options['include'][number]> : Story>(options?: Options): Promise<ListResponse<StoryRecord>>;
|
|
13
|
+
/**
|
|
14
|
+
* Get story by UUID.
|
|
15
|
+
*/
|
|
16
|
+
get<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: Story['uuid'], options?: Options): Promise<StoryRecord>;
|
|
17
|
+
/**
|
|
18
|
+
* Get multiple stories by UUIDs.
|
|
19
|
+
*/
|
|
20
|
+
get<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(ids: Story['uuid'][], options?: Options): Promise<StoryRecord[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Get story by deprecated numeric ID, or UUID.
|
|
23
|
+
* @deprecated Please use UUID instead.
|
|
24
|
+
*/
|
|
25
|
+
get<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: Story['id'] | Story['uuid'], options?: Options): Promise<StoryRecord>;
|
|
26
|
+
/**
|
|
27
|
+
* Get multiple stories by numeric IDs.
|
|
28
|
+
* @deprecated Please use UUID instead.
|
|
29
|
+
*/
|
|
30
|
+
get<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(ids: Story['id'][], options?: Options): Promise<StoryRecord[]>;
|
|
31
|
+
create<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(payload: CreateRequest, options?: Options): Promise<StoryRecord>;
|
|
32
|
+
update<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload: UpdateRequest, options?: Options): Promise<StoryRecord>;
|
|
33
|
+
/**
|
|
34
|
+
* This operation is only allowed for V3 stories
|
|
35
|
+
*/
|
|
36
|
+
autosave<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload: AutosaveRequest, options?: Options): Promise<StoryRecord>;
|
|
37
|
+
/**
|
|
38
|
+
* This operation is only allowed for V3 stories
|
|
39
|
+
*/
|
|
40
|
+
revert<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload?: RevertRequest, options?: Options): Promise<StoryRecord>;
|
|
41
|
+
publish<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload?: PublishRequest, options?: Options): Promise<StoryRecord>;
|
|
42
|
+
unpublish<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload?: UnpublishRequest, options?: Options): Promise<StoryRecord>;
|
|
43
|
+
schedule<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload?: ScheduleRequest, options?: Options): Promise<StoryRecord>;
|
|
44
|
+
unschedule<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload?: UnscheduleRequest, options?: Options): Promise<StoryRecord>;
|
|
45
|
+
delete(id: StoryId): Promise<void>;
|
|
16
46
|
}
|
|
17
47
|
export {};
|
|
@@ -37,27 +37,171 @@ export class Client {
|
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Get story by UUID.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Implementation
|
|
47
|
+
*/
|
|
48
|
+
async get(arg, options) {
|
|
49
|
+
const include = options?.include;
|
|
50
|
+
const isArray = Array.isArray(arg);
|
|
51
|
+
if (isArray && arg.length === 0) {
|
|
52
|
+
// No need to call the API.
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
if (isArray && typeof arg[0] === 'number') {
|
|
56
|
+
const {
|
|
57
|
+
stories
|
|
58
|
+
} = await this.search({
|
|
59
|
+
limit: arg.length,
|
|
60
|
+
query: {
|
|
61
|
+
id: {
|
|
62
|
+
$in: arg
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
include
|
|
66
|
+
});
|
|
67
|
+
return stories;
|
|
68
|
+
}
|
|
69
|
+
if (isArray && typeof arg[0] === 'string') {
|
|
70
|
+
const {
|
|
71
|
+
stories
|
|
72
|
+
} = await this.search({
|
|
73
|
+
limit: arg.length,
|
|
74
|
+
query: {
|
|
75
|
+
uuid: {
|
|
76
|
+
$in: arg
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
include
|
|
80
|
+
});
|
|
81
|
+
return stories;
|
|
82
|
+
}
|
|
41
83
|
const {
|
|
42
84
|
story
|
|
43
|
-
} = await this.apiClient.get(`${routing.storiesUrl}/${
|
|
85
|
+
} = await this.apiClient.get(`${routing.storiesUrl}/${arg}`, {
|
|
86
|
+
query: {
|
|
87
|
+
include: include
|
|
88
|
+
}
|
|
89
|
+
});
|
|
44
90
|
return story;
|
|
45
91
|
}
|
|
46
|
-
async create(payload) {
|
|
92
|
+
async create(payload, options) {
|
|
93
|
+
const include = options?.include;
|
|
47
94
|
const {
|
|
48
95
|
story
|
|
49
96
|
} = await this.apiClient.post(routing.storiesUrl, {
|
|
50
|
-
payload
|
|
97
|
+
payload,
|
|
98
|
+
query: {
|
|
99
|
+
include: include
|
|
100
|
+
}
|
|
51
101
|
});
|
|
52
102
|
return story;
|
|
53
103
|
}
|
|
54
|
-
async update(id, payload) {
|
|
104
|
+
async update(id, payload, options) {
|
|
55
105
|
const url = `${routing.storiesUrl}/${id}`;
|
|
106
|
+
const include = options?.include;
|
|
107
|
+
const {
|
|
108
|
+
story
|
|
109
|
+
} = await this.apiClient.patch(url, {
|
|
110
|
+
payload,
|
|
111
|
+
query: {
|
|
112
|
+
include: include
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
return story;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* This operation is only allowed for V3 stories
|
|
120
|
+
*/
|
|
121
|
+
async autosave(id, payload, options) {
|
|
122
|
+
const url = `${routing.storiesUrl}/${id}/autosave`;
|
|
123
|
+
const include = options?.include;
|
|
56
124
|
const {
|
|
57
125
|
story
|
|
58
126
|
} = await this.apiClient.patch(url, {
|
|
59
|
-
payload
|
|
127
|
+
payload,
|
|
128
|
+
query: {
|
|
129
|
+
include: include
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
return story;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* This operation is only allowed for V3 stories
|
|
137
|
+
*/
|
|
138
|
+
async revert(id, payload, options) {
|
|
139
|
+
const url = `${routing.storiesUrl}/${id}/revert`;
|
|
140
|
+
const include = options?.include;
|
|
141
|
+
const {
|
|
142
|
+
story
|
|
143
|
+
} = await this.apiClient.post(url, {
|
|
144
|
+
payload,
|
|
145
|
+
query: {
|
|
146
|
+
include: include
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
return story;
|
|
150
|
+
}
|
|
151
|
+
async publish(id, payload, options) {
|
|
152
|
+
const url = `${routing.storiesUrl}/${id}/publish`;
|
|
153
|
+
const include = options?.include;
|
|
154
|
+
const {
|
|
155
|
+
story
|
|
156
|
+
} = await this.apiClient.post(url, {
|
|
157
|
+
payload,
|
|
158
|
+
query: {
|
|
159
|
+
include: include
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return story;
|
|
163
|
+
}
|
|
164
|
+
async unpublish(id, payload, options) {
|
|
165
|
+
const url = `${routing.storiesUrl}/${id}/unpublish`;
|
|
166
|
+
const include = options?.include;
|
|
167
|
+
const {
|
|
168
|
+
story
|
|
169
|
+
} = await this.apiClient.post(url, {
|
|
170
|
+
payload,
|
|
171
|
+
query: {
|
|
172
|
+
include: include
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
return story;
|
|
176
|
+
}
|
|
177
|
+
async schedule(id, payload, options) {
|
|
178
|
+
const url = `${routing.storiesUrl}/${id}/schedule`;
|
|
179
|
+
const include = options?.include;
|
|
180
|
+
const {
|
|
181
|
+
story
|
|
182
|
+
} = await this.apiClient.post(url, {
|
|
183
|
+
payload,
|
|
184
|
+
query: {
|
|
185
|
+
include: include
|
|
186
|
+
}
|
|
60
187
|
});
|
|
61
188
|
return story;
|
|
62
189
|
}
|
|
190
|
+
async unschedule(id, payload, options) {
|
|
191
|
+
const url = `${routing.storiesUrl}/${id}/unpublish`;
|
|
192
|
+
const include = options?.include;
|
|
193
|
+
const {
|
|
194
|
+
story
|
|
195
|
+
} = await this.apiClient.post(url, {
|
|
196
|
+
payload,
|
|
197
|
+
query: {
|
|
198
|
+
include: include
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
return story;
|
|
202
|
+
}
|
|
203
|
+
async delete(id) {
|
|
204
|
+
const url = `${routing.storiesUrl}/${id}`;
|
|
205
|
+
await this.apiClient.delete(url);
|
|
206
|
+
}
|
|
63
207
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Category, CultureRef,
|
|
1
|
+
import type { Category, CultureRef, Newsroom, Pagination, Query, Story } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Uploadcare image JSON string.
|
|
4
4
|
*/
|
|
@@ -12,6 +12,9 @@ declare type Html = string;
|
|
|
12
12
|
* String containing Prezly Content Format JSON structure.
|
|
13
13
|
*/
|
|
14
14
|
declare type PrezlyContentFormat = string;
|
|
15
|
+
export interface IncludeOptions<Include extends readonly (keyof Story.ExtraFields)[]> {
|
|
16
|
+
include?: Include;
|
|
17
|
+
}
|
|
15
18
|
export interface ListOptions<Include extends readonly (keyof Story.ExtraFields)[]> {
|
|
16
19
|
limit?: number;
|
|
17
20
|
offset?: number;
|
|
@@ -20,6 +23,7 @@ export interface ListOptions<Include extends readonly (keyof Story.ExtraFields)[
|
|
|
20
23
|
}
|
|
21
24
|
export interface SearchOptions<Include extends readonly (keyof Story.ExtraFields)[]> extends ListOptions<Include> {
|
|
22
25
|
query?: Query;
|
|
26
|
+
scope?: Query;
|
|
23
27
|
}
|
|
24
28
|
export interface ListResponse<S extends Story = Story> {
|
|
25
29
|
stories: S[];
|
|
@@ -27,18 +31,19 @@ export interface ListResponse<S extends Story = Story> {
|
|
|
27
31
|
sort: string;
|
|
28
32
|
}
|
|
29
33
|
interface GenericCreateRequest {
|
|
30
|
-
newsroom?:
|
|
34
|
+
newsroom?: Newsroom['id'] | Newsroom['uuid'];
|
|
31
35
|
title?: string;
|
|
32
36
|
subtitle?: string;
|
|
33
37
|
published_at?: Iso8601DateTime;
|
|
34
38
|
visibility?: Story.Visibility;
|
|
35
39
|
culture?: CultureRef['code'];
|
|
36
|
-
header_image?: UploadedImage;
|
|
37
|
-
preview_image?: UploadedImage;
|
|
38
|
-
social_image?: UploadedImage;
|
|
40
|
+
header_image?: UploadedImage | null;
|
|
41
|
+
preview_image?: UploadedImage | null;
|
|
42
|
+
social_image?: UploadedImage | null;
|
|
39
43
|
social_text?: string;
|
|
40
44
|
categories?: Category['id'][];
|
|
41
45
|
tags?: string[];
|
|
46
|
+
is_shared_to_prpro?: boolean;
|
|
42
47
|
}
|
|
43
48
|
interface GenericUpdateRequest {
|
|
44
49
|
title?: string;
|
|
@@ -46,20 +51,21 @@ interface GenericUpdateRequest {
|
|
|
46
51
|
published_at?: Iso8601DateTime;
|
|
47
52
|
visibility?: Story.Visibility;
|
|
48
53
|
culture?: CultureRef['code'];
|
|
49
|
-
header_image?: UploadedImage;
|
|
50
|
-
preview_image?: UploadedImage;
|
|
51
|
-
social_image?: UploadedImage;
|
|
54
|
+
header_image?: UploadedImage | null;
|
|
55
|
+
preview_image?: UploadedImage | null;
|
|
56
|
+
social_image?: UploadedImage | null;
|
|
52
57
|
social_text?: string;
|
|
53
58
|
categories?: Category['id'][];
|
|
54
59
|
tags?: string[];
|
|
60
|
+
is_shared_to_prpro?: boolean;
|
|
55
61
|
}
|
|
56
62
|
export interface HtmlStoryCreateRequest extends GenericCreateRequest {
|
|
57
63
|
/**
|
|
58
64
|
* If format version is omitted, license default editor version will be implied.
|
|
59
65
|
*/
|
|
60
66
|
format_version?: Story.FormatVersion.HTML;
|
|
61
|
-
intro
|
|
62
|
-
content
|
|
67
|
+
intro?: Html;
|
|
68
|
+
content?: Html;
|
|
63
69
|
/**
|
|
64
70
|
* Attached gallery slate content.
|
|
65
71
|
*/
|
|
@@ -73,12 +79,12 @@ export interface SlateStoryCreateRequest extends GenericCreateRequest {
|
|
|
73
79
|
/**
|
|
74
80
|
* Intro field is not supported for Prezly Content Format stories.
|
|
75
81
|
*/
|
|
76
|
-
intro
|
|
77
|
-
content
|
|
82
|
+
intro?: never;
|
|
83
|
+
content?: PrezlyContentFormat;
|
|
78
84
|
}
|
|
79
85
|
export interface HtmlStoryUpdateRequest extends GenericUpdateRequest {
|
|
80
|
-
intro
|
|
81
|
-
content
|
|
86
|
+
intro?: Html;
|
|
87
|
+
content?: Html;
|
|
82
88
|
/**
|
|
83
89
|
* Attached gallery slate content.
|
|
84
90
|
*/
|
|
@@ -88,9 +94,32 @@ export interface SlateStoryUpdateRequest extends GenericUpdateRequest {
|
|
|
88
94
|
/**
|
|
89
95
|
* Intro field is not supported for Prezly Content Format stories.
|
|
90
96
|
*/
|
|
91
|
-
intro
|
|
92
|
-
content
|
|
97
|
+
intro?: never;
|
|
98
|
+
content?: PrezlyContentFormat;
|
|
99
|
+
autosaved_content?: PrezlyContentFormat;
|
|
100
|
+
content_version?: number;
|
|
93
101
|
}
|
|
94
102
|
export declare type CreateRequest = HtmlStoryCreateRequest | SlateStoryCreateRequest;
|
|
95
103
|
export declare type UpdateRequest = HtmlStoryUpdateRequest | SlateStoryUpdateRequest;
|
|
104
|
+
export interface AutosaveRequest {
|
|
105
|
+
autosaved_content: PrezlyContentFormat;
|
|
106
|
+
content_version?: number;
|
|
107
|
+
}
|
|
108
|
+
export interface RevertRequest {
|
|
109
|
+
content_version?: number;
|
|
110
|
+
}
|
|
111
|
+
export interface PublishRequest {
|
|
112
|
+
published_at?: Iso8601DateTime;
|
|
113
|
+
visibility?: Story.Visibility.PUBLIC | Story.Visibility.PRIVATE | Story.Visibility.CONFIDENTIAL;
|
|
114
|
+
}
|
|
115
|
+
export interface UnpublishRequest {
|
|
116
|
+
visibility?: Story.Visibility.PUBLIC | Story.Visibility.PRIVATE | Story.Visibility.CONFIDENTIAL;
|
|
117
|
+
}
|
|
118
|
+
export interface ScheduleRequest {
|
|
119
|
+
publish_at?: Iso8601DateTime;
|
|
120
|
+
visibility?: Story.Visibility.PUBLIC | Story.Visibility.EMBARGO;
|
|
121
|
+
}
|
|
122
|
+
export declare type UnscheduleRequest = UnpublishRequest;
|
|
123
|
+
export declare const ALL_EXTRA_FIELDS: (keyof Story.ExtraFields)[];
|
|
124
|
+
export declare const EXTENDED_STORY_INCLUDED_EXTRA_FIELDS: ("content" | "thumbnail_image" | "header_image" | "preview_image" | "social_image" | "social_text" | "tag_names" | "attached_gallery_content" | "referenced_entities")[];
|
|
96
125
|
export {};
|
|
@@ -1 +1,43 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Uploadcare image JSON string.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Raw HTML string.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* String containing Prezly Content Format JSON structure.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const EXTENDED_STORY_INCLUDED_EXTRA_FIELDS_SHAPE = {
|
|
14
|
+
thumbnail_image: true,
|
|
15
|
+
header_image: true,
|
|
16
|
+
preview_image: true,
|
|
17
|
+
social_image: true,
|
|
18
|
+
social_text: true,
|
|
19
|
+
tag_names: true,
|
|
20
|
+
content: true,
|
|
21
|
+
attached_gallery_content: true,
|
|
22
|
+
referenced_entities: true
|
|
23
|
+
}; // satisfies Record<keyof Omit<ExtendedStory, keyof Story>, boolean>; // TODO: Use Typescript `satisfies` operator, when it's out of beta
|
|
24
|
+
|
|
25
|
+
const ALL_EXTRA_FIELDS_SHAPE = {
|
|
26
|
+
thumbnail_image: true,
|
|
27
|
+
header_image: true,
|
|
28
|
+
preview_image: true,
|
|
29
|
+
social_image: true,
|
|
30
|
+
social_text: true,
|
|
31
|
+
tag_names: true,
|
|
32
|
+
content: true,
|
|
33
|
+
autosaved_content: true,
|
|
34
|
+
content_version: true,
|
|
35
|
+
last_modifying_user: true,
|
|
36
|
+
attached_gallery_content: true,
|
|
37
|
+
referenced_entities: true,
|
|
38
|
+
'campaigns.count': true,
|
|
39
|
+
'pitches.count': true
|
|
40
|
+
}; // satisfies Record<keyof Story.OnDemandFields, boolean>; // TODO: Use Typescript `satisfies` operator, when it's out of beta
|
|
41
|
+
|
|
42
|
+
export const ALL_EXTRA_FIELDS = Object.keys(ALL_EXTRA_FIELDS_SHAPE);
|
|
43
|
+
export const EXTENDED_STORY_INCLUDED_EXTRA_FIELDS = Object.keys(EXTENDED_STORY_INCLUDED_EXTRA_FIELDS_SHAPE);
|
package/dist/types/Story.d.ts
CHANGED
|
@@ -12,6 +12,11 @@ export interface StoryRef {
|
|
|
12
12
|
id: number;
|
|
13
13
|
title: string;
|
|
14
14
|
slug: string;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Please use `lifecycle_status` instead.
|
|
17
|
+
* @see lifecycle_status
|
|
18
|
+
* @see Story.LifecycleStatus
|
|
19
|
+
*/
|
|
15
20
|
publication_status: Story.PublicationStatus;
|
|
16
21
|
lifecycle_status: Story.LifecycleStatus;
|
|
17
22
|
visibility: Story.Visibility;
|
|
@@ -73,22 +78,58 @@ export interface Story {
|
|
|
73
78
|
published_at: string | null;
|
|
74
79
|
scheduled_at: string | null;
|
|
75
80
|
lifecycle_status: Story.LifecycleStatus;
|
|
81
|
+
/**
|
|
82
|
+
* @deprecated Please use `newsroom.status` instead.
|
|
83
|
+
* @see newsroom
|
|
84
|
+
* @see Newsroom.Status
|
|
85
|
+
*/
|
|
76
86
|
is_archived: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* @deprecated Please use `lifecycle_status` instead.
|
|
89
|
+
* @see lifecycle_status
|
|
90
|
+
* @see Story.LifecycleStatus
|
|
91
|
+
*/
|
|
77
92
|
is_finalized: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* @deprecated Please use `lifecycle_status` instead.
|
|
95
|
+
* @see lifecycle_status
|
|
96
|
+
* @see Story.LifecycleStatus
|
|
97
|
+
*/
|
|
78
98
|
is_published: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* @deprecated Please use `lifecycle_status` instead.
|
|
101
|
+
* @see lifecycle_status
|
|
102
|
+
* @see Story.LifecycleStatus
|
|
103
|
+
*/
|
|
79
104
|
is_draft: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* @deprecated Please use `lifecycle_status` instead.
|
|
107
|
+
* @see lifecycle_status
|
|
108
|
+
* @see Story.LifecycleStatus
|
|
109
|
+
*/
|
|
80
110
|
is_embargo: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* @deprecated Please use `visibility` instead.
|
|
113
|
+
* @see visibility
|
|
114
|
+
* @see Story.Visibility
|
|
115
|
+
*/
|
|
81
116
|
is_private: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* @deprecated Please use `lifecycle_status` instead.
|
|
119
|
+
* @see lifecycle_status
|
|
120
|
+
* @see Story.LifecycleStatus
|
|
121
|
+
*/
|
|
82
122
|
is_scheduled: boolean;
|
|
83
123
|
is_sharable: boolean;
|
|
84
124
|
is_analytics_available: boolean;
|
|
85
|
-
|
|
86
|
-
visibility: Story.Visibility;
|
|
125
|
+
is_shared_to_prpro: boolean;
|
|
87
126
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
127
|
+
* @deprecated Please use `lifecycle_status` instead.
|
|
128
|
+
* @see lifecycle_status
|
|
129
|
+
* @see Story.LifecycleStatus
|
|
90
130
|
*/
|
|
91
|
-
|
|
131
|
+
publication_status: Story.PublicationStatus;
|
|
132
|
+
visibility: Story.Visibility;
|
|
92
133
|
}
|
|
93
134
|
export declare namespace Story {
|
|
94
135
|
enum FormatVersion {
|
|
@@ -102,6 +143,10 @@ export declare namespace Story {
|
|
|
102
143
|
EMBARGO = "embargo",
|
|
103
144
|
PUBLISHED = "published"
|
|
104
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Please use `LifecycleStatus` instead.
|
|
148
|
+
* @see LifecycleStatus
|
|
149
|
+
*/
|
|
105
150
|
enum PublicationStatus {
|
|
106
151
|
NEW = "new",
|
|
107
152
|
DRAFT = "draft",
|
|
@@ -114,12 +159,6 @@ export declare namespace Story {
|
|
|
114
159
|
CONFIDENTIAL = "confidential"
|
|
115
160
|
}
|
|
116
161
|
interface ExtraFields {
|
|
117
|
-
/**
|
|
118
|
-
* Depending on `format_version` this field can contain:
|
|
119
|
-
* - HTML content for v1 stories (deprecated)
|
|
120
|
-
* - JSON-encoded structured content for v3 stories (see Prezly Content Format).
|
|
121
|
-
*/
|
|
122
|
-
content: string;
|
|
123
162
|
/**
|
|
124
163
|
* Uploadcare image JSON.
|
|
125
164
|
*/
|
|
@@ -138,9 +177,41 @@ export declare namespace Story {
|
|
|
138
177
|
social_image: string | null;
|
|
139
178
|
social_text: string;
|
|
140
179
|
tag_names: string[];
|
|
180
|
+
/**
|
|
181
|
+
* Depending on `format_version` this field can contain:
|
|
182
|
+
* - HTML content for v1 stories (deprecated)
|
|
183
|
+
* - JSON-encoded structured content for v3 stories (see Prezly Content Format).
|
|
184
|
+
*/
|
|
185
|
+
content: string;
|
|
186
|
+
/**
|
|
187
|
+
* Only supported on v3 stories with JSON-encoded structured content.
|
|
188
|
+
*/
|
|
189
|
+
autosaved_content: string | null;
|
|
190
|
+
/**
|
|
191
|
+
* Auto-incrementing version number updated on every update.
|
|
192
|
+
* Used for detecting multiple users editing the same story simultaneously.
|
|
193
|
+
*/
|
|
194
|
+
content_version: number;
|
|
195
|
+
/**
|
|
196
|
+
* User who performed the latest update on the story.
|
|
197
|
+
*/
|
|
198
|
+
last_modifying_user: UserRef | null;
|
|
199
|
+
/**
|
|
200
|
+
* Contains attached gallery slate content.
|
|
201
|
+
* Always `null` for v3 stories.
|
|
202
|
+
*/
|
|
203
|
+
attached_gallery_content: string | null;
|
|
141
204
|
referenced_entities: {
|
|
142
205
|
stories: Record<string, OEmbedInfo>;
|
|
143
206
|
};
|
|
207
|
+
/**
|
|
208
|
+
* Number of campaigns linked to this story.
|
|
209
|
+
*/
|
|
210
|
+
'campaigns.count': number;
|
|
211
|
+
/**
|
|
212
|
+
* Number of pitches linked to this story.
|
|
213
|
+
*/
|
|
214
|
+
'pitches.count': number;
|
|
144
215
|
}
|
|
145
216
|
function isUninitialized(status: LifecycleStatus): boolean;
|
|
146
217
|
function isUninitialized(story: Pick<Story, 'lifecycle_status'>): boolean;
|
|
@@ -153,5 +224,5 @@ export declare namespace Story {
|
|
|
153
224
|
function isPublished(status: LifecycleStatus): boolean;
|
|
154
225
|
function isPublished(story: Pick<Story, 'lifecycle_status'>): boolean;
|
|
155
226
|
}
|
|
156
|
-
export interface ExtendedStory extends Story, Story.ExtraFields {
|
|
227
|
+
export interface ExtendedStory extends Story, Pick<Story.ExtraFields, 'thumbnail_image' | 'header_image' | 'preview_image' | 'social_image' | 'social_text' | 'tag_names' | 'content' | 'attached_gallery_content' | 'referenced_entities'> {
|
|
157
228
|
}
|