@prezly/sdk 10.3.0 → 11.0.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/NotificationSubscriptions/Client.d.ts +2 -2
- package/dist/endpoints/NotificationSubscriptions/types.d.ts +3 -5
- package/dist/endpoints/Stories/Client.d.ts +4 -1
- package/dist/endpoints/Stories/Client.js +27 -0
- package/dist/endpoints/Stories/types.d.ts +40 -1
- package/dist/http/types.d.ts +1 -0
- package/dist/http/types.js +1 -0
- package/dist/types/Category.d.ts +4 -1
- package/dist/types/NewsroomContact.d.ts +4 -1
- package/dist/types/NotificationSubscription.d.ts +14 -2
- package/dist/types/NotificationSubscription.js +10 -1
- package/dist/types/index.d.ts +0 -2
- package/dist/types/index.js +1 -3
- package/package.json +1 -1
- package/dist/types/NotificationType.d.ts +0 -7
- package/dist/types/NotificationType.js +0 -1
- package/dist/types/NotificationTypeArea.d.ts +0 -5
- package/dist/types/NotificationTypeArea.js +0 -6
package/dist/api/constants.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { DeferredJobsApiClient } from '../../api';
|
|
2
2
|
import type { NotificationSubscription } from '../../types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { UpdateRequest } from './types';
|
|
4
4
|
export declare class Client {
|
|
5
5
|
private readonly apiClient;
|
|
6
6
|
constructor(apiClient: DeferredJobsApiClient);
|
|
7
7
|
list(): Promise<NotificationSubscription[]>;
|
|
8
|
-
update(payload:
|
|
8
|
+
update(payload: UpdateRequest): Promise<NotificationSubscription[]>;
|
|
9
9
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
is_email_subscribed: boolean;
|
|
5
|
-
}[];
|
|
1
|
+
import type { NotificationSubscription } from '../../types';
|
|
2
|
+
export interface UpdateRequest {
|
|
3
|
+
subscriptions: Pick<NotificationSubscription, 'notification_type' | 'is_email_subscribed'>[];
|
|
6
4
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DeferredJobsApiClient } from '../../api';
|
|
2
2
|
import type { ExtendedStory, Story } from '../../types';
|
|
3
|
-
import type { AutosaveRequest, CreateRequest, IncludeOptions, ListOptions, ListResponse, PublishRequest, RevertRequest, ScheduleRequest, SearchOptions, UnpublishRequest, UnscheduleRequest, UpdateRequest } from './types';
|
|
3
|
+
import type { AutosaveRequest, ChangeNewsroomSuccessResponse, ChangeNewsroomUnsafeResponse, CreateRequest, IncludeOptions, ListOptions, ListResponse, MoveRequest, 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
|
*/
|
|
@@ -30,6 +30,9 @@ export declare class Client {
|
|
|
30
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
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
32
|
duplicate<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, options?: Options): Promise<StoryRecord>;
|
|
33
|
+
move<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include> & {
|
|
34
|
+
force?: true;
|
|
35
|
+
}, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload: MoveRequest, options?: Options): Promise<ChangeNewsroomSuccessResponse<StoryRecord> | ChangeNewsroomUnsafeResponse>;
|
|
33
36
|
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>;
|
|
34
37
|
/**
|
|
35
38
|
* This operation is only allowed for V3 stories
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { HttpCodes } from "../../http/index.js";
|
|
2
|
+
import { ApiError } from "../../http/ApiError.js";
|
|
1
3
|
import { routing } from "../../routing.js";
|
|
2
4
|
export class Client {
|
|
3
5
|
constructor(apiClient) {
|
|
@@ -113,6 +115,31 @@ export class Client {
|
|
|
113
115
|
});
|
|
114
116
|
return story;
|
|
115
117
|
}
|
|
118
|
+
async move(id, payload, options) {
|
|
119
|
+
const include = options?.include;
|
|
120
|
+
const force = options?.force;
|
|
121
|
+
const url = `${routing.storiesUrl}/${id}/move`;
|
|
122
|
+
try {
|
|
123
|
+
const {
|
|
124
|
+
story
|
|
125
|
+
} = await this.apiClient.post(url, {
|
|
126
|
+
query: {
|
|
127
|
+
include: include,
|
|
128
|
+
force
|
|
129
|
+
},
|
|
130
|
+
payload
|
|
131
|
+
});
|
|
132
|
+
return {
|
|
133
|
+
status: 'success',
|
|
134
|
+
story
|
|
135
|
+
};
|
|
136
|
+
} catch (error) {
|
|
137
|
+
if (error instanceof ApiError && error.status === HttpCodes.CONFLICT) {
|
|
138
|
+
return error.payload;
|
|
139
|
+
}
|
|
140
|
+
throw error;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
116
143
|
async update(id, payload, options) {
|
|
117
144
|
const url = `${routing.storiesUrl}/${id}`;
|
|
118
145
|
const include = options?.include;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Category, CultureRef, Newsroom, Pagination, Query, Story } from '../../types';
|
|
1
|
+
import type { Category, CategoryRef, CultureRef, ExtendedStory, Newsroom, NewsroomContactRef, Pagination, Query, Story, Warning as BaseWarning } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Uploadcare image JSON string.
|
|
4
4
|
*/
|
|
@@ -12,6 +12,32 @@ declare type Html = string;
|
|
|
12
12
|
* String containing Prezly Content Format JSON structure.
|
|
13
13
|
*/
|
|
14
14
|
declare type PrezlyContentFormat = string;
|
|
15
|
+
interface ChangingNewsroomUnsafeOperationWarning extends BaseWarning {
|
|
16
|
+
scope: 'room_id';
|
|
17
|
+
field: 'room_id';
|
|
18
|
+
value: Newsroom['id'];
|
|
19
|
+
}
|
|
20
|
+
interface DestinationNewsroomMissingCategoriesWarning extends BaseWarning {
|
|
21
|
+
scope: 'room_id';
|
|
22
|
+
field: 'categories';
|
|
23
|
+
value: CategoryRef[];
|
|
24
|
+
}
|
|
25
|
+
interface DestinationNewsroomMissingCulturesWarning extends BaseWarning {
|
|
26
|
+
scope: 'room_id';
|
|
27
|
+
field: 'cultures';
|
|
28
|
+
value: CultureRef[];
|
|
29
|
+
}
|
|
30
|
+
interface StoryTranslationsWillMoveWarning extends BaseWarning {
|
|
31
|
+
scope: 'room_id';
|
|
32
|
+
field: 'translations';
|
|
33
|
+
value: CultureRef[];
|
|
34
|
+
}
|
|
35
|
+
interface StoryEmbeddedContactsWillBeRemovedWarning extends BaseWarning {
|
|
36
|
+
scope: 'room_id';
|
|
37
|
+
field: 'room_contacts';
|
|
38
|
+
value: NewsroomContactRef[];
|
|
39
|
+
}
|
|
40
|
+
export declare type ChangeNewsroomWarning = ChangingNewsroomUnsafeOperationWarning | DestinationNewsroomMissingCategoriesWarning | DestinationNewsroomMissingCulturesWarning | StoryEmbeddedContactsWillBeRemovedWarning | StoryTranslationsWillMoveWarning;
|
|
15
41
|
export interface IncludeOptions<Include extends readonly (keyof Story.ExtraFields)[]> {
|
|
16
42
|
include?: Include;
|
|
17
43
|
}
|
|
@@ -120,6 +146,19 @@ export interface ScheduleRequest {
|
|
|
120
146
|
visibility?: Story.Visibility.PUBLIC | Story.Visibility.EMBARGO;
|
|
121
147
|
}
|
|
122
148
|
export declare type UnscheduleRequest = UnpublishRequest;
|
|
149
|
+
export interface MoveRequest {
|
|
150
|
+
newsroom: Newsroom['uuid'] | Newsroom['id'];
|
|
151
|
+
}
|
|
152
|
+
export interface ChangeNewsroomSuccessResponse<T extends ExtendedStory> {
|
|
153
|
+
status: 'success';
|
|
154
|
+
story: T;
|
|
155
|
+
}
|
|
156
|
+
export interface ChangeNewsroomUnsafeResponse {
|
|
157
|
+
status: 'error';
|
|
158
|
+
code: 'unsafe';
|
|
159
|
+
message: string;
|
|
160
|
+
warnings: ChangeNewsroomWarning[];
|
|
161
|
+
}
|
|
123
162
|
export declare const ALL_EXTRA_FIELDS: (keyof Story.ExtraFields)[];
|
|
124
163
|
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")[];
|
|
125
164
|
export {};
|
package/dist/http/types.d.ts
CHANGED
package/dist/http/types.js
CHANGED
|
@@ -3,6 +3,7 @@ export let HttpCodes;
|
|
|
3
3
|
HttpCodes[HttpCodes["ACCEPTED"] = 202] = "ACCEPTED";
|
|
4
4
|
HttpCodes[HttpCodes["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
5
5
|
HttpCodes[HttpCodes["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
6
|
+
HttpCodes[HttpCodes["CONFLICT"] = 409] = "CONFLICT";
|
|
6
7
|
HttpCodes[HttpCodes["GONE"] = 410] = "GONE";
|
|
7
8
|
HttpCodes[HttpCodes["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
|
|
8
9
|
})(HttpCodes || (HttpCodes = {}));
|
package/dist/types/Category.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CultureRef } from './Culture';
|
|
2
|
-
export interface
|
|
2
|
+
export interface CategoryRef {
|
|
3
3
|
id: number;
|
|
4
4
|
display_name: string;
|
|
5
5
|
display_description: string | null;
|
|
@@ -13,3 +13,6 @@ export interface Category {
|
|
|
13
13
|
};
|
|
14
14
|
stories_number: number;
|
|
15
15
|
}
|
|
16
|
+
export interface Category extends CategoryRef {
|
|
17
|
+
stories_number: number;
|
|
18
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { UploadedImage } from '@prezly/uploads';
|
|
2
2
|
import type { CultureRef } from './Culture';
|
|
3
|
-
export interface
|
|
3
|
+
export interface NewsroomContactRef {
|
|
4
4
|
uuid: string;
|
|
5
5
|
/**
|
|
6
6
|
* @deprecated Please use `uuid` as identifier.
|
|
@@ -16,6 +16,9 @@ export interface NewsroomContact {
|
|
|
16
16
|
website: string | null;
|
|
17
17
|
twitter: string | null;
|
|
18
18
|
facebook: string | null;
|
|
19
|
+
avatar_url: string | null;
|
|
20
|
+
}
|
|
21
|
+
export interface NewsroomContact extends Omit<NewsroomContactRef, 'avatar_url'> {
|
|
19
22
|
avatar_image: UploadedImage | null;
|
|
20
23
|
/**
|
|
21
24
|
* Featured contacts are listed on the newsroom homepage.
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
import type { NotificationType } from './NotificationType';
|
|
2
1
|
export interface NotificationSubscription {
|
|
3
|
-
notification_type:
|
|
2
|
+
notification_type: NotificationSubscription.Type;
|
|
4
3
|
is_email_subscribed: boolean;
|
|
5
4
|
is_receiving: boolean;
|
|
6
5
|
missing_permissions: string[];
|
|
7
6
|
missing_features: string[];
|
|
8
7
|
}
|
|
8
|
+
export declare namespace NotificationSubscription {
|
|
9
|
+
interface Type {
|
|
10
|
+
id: string;
|
|
11
|
+
title: string;
|
|
12
|
+
description: string | null;
|
|
13
|
+
area: Area;
|
|
14
|
+
}
|
|
15
|
+
enum Area {
|
|
16
|
+
CAMPAIGNS = "Campaigns",
|
|
17
|
+
CONTACTS = "Contacts",
|
|
18
|
+
BILLING_AND_LEGAL = "Billing & Legal"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
export
|
|
1
|
+
export let NotificationSubscription;
|
|
2
|
+
(function (_NotificationSubscription) {
|
|
3
|
+
let Area;
|
|
4
|
+
(function (Area) {
|
|
5
|
+
Area["CAMPAIGNS"] = "Campaigns";
|
|
6
|
+
Area["CONTACTS"] = "Contacts";
|
|
7
|
+
Area["BILLING_AND_LEGAL"] = "Billing & Legal";
|
|
8
|
+
})(Area || (Area = {}));
|
|
9
|
+
_NotificationSubscription.Area = Area;
|
|
10
|
+
})(NotificationSubscription || (NotificationSubscription = {}));
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -28,6 +28,4 @@ export * from "./Snippet.js";
|
|
|
28
28
|
export * from "./Story.js";
|
|
29
29
|
export * from "./User.js";
|
|
30
30
|
export * from "./UserAccount.js";
|
|
31
|
-
export * from "./NotificationSubscription.js";
|
|
32
|
-
export * from "./NotificationType.js";
|
|
33
|
-
export * from "./NotificationTypeArea.js";
|
|
31
|
+
export * from "./NotificationSubscription.js";
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export let NotificationTypeArea;
|
|
2
|
-
(function (NotificationTypeArea) {
|
|
3
|
-
NotificationTypeArea["CAMPAIGNS"] = "Campaigns";
|
|
4
|
-
NotificationTypeArea["CONTACTS"] = "Contacts";
|
|
5
|
-
NotificationTypeArea["BILLING_AND_LEGAL"] = "Billing & Legal";
|
|
6
|
-
})(NotificationTypeArea || (NotificationTypeArea = {}));
|