@prezly/sdk 11.8.1-cjs → 11.9.1
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/Client.cjs +45 -0
- package/dist/Client.js +27 -33
- package/dist/api/ApiClient.cjs +95 -0
- package/dist/api/ApiClient.js +12 -19
- package/dist/api/DeferredJobsApiClient.cjs +99 -0
- package/dist/api/DeferredJobsApiClient.js +12 -19
- package/dist/api/constants.cjs +10 -0
- package/dist/api/constants.js +2 -9
- package/dist/api/index.cjs +19 -0
- package/dist/api/index.js +2 -19
- package/dist/endpoints/Accounts/Client.cjs +29 -0
- package/dist/endpoints/Accounts/Client.js +6 -13
- package/dist/endpoints/Accounts/index.cjs +25 -0
- package/dist/endpoints/Accounts/index.js +2 -25
- package/dist/endpoints/Accounts/types.cjs +1 -0
- package/dist/endpoints/Accounts/types.js +1 -1
- package/dist/endpoints/Billing/Client.cjs +19 -0
- package/dist/endpoints/Billing/Client.js +4 -11
- package/dist/endpoints/Billing/index.cjs +25 -0
- package/dist/endpoints/Billing/index.js +2 -25
- package/dist/endpoints/Billing/types.cjs +25 -0
- package/dist/endpoints/Billing/types.js +6 -15
- package/dist/endpoints/CampaignRecipients/Client.cjs +85 -0
- package/dist/endpoints/CampaignRecipients/Client.js +12 -19
- package/dist/endpoints/CampaignRecipients/index.cjs +37 -0
- package/dist/endpoints/CampaignRecipients/index.js +3 -37
- package/dist/endpoints/CampaignRecipients/types.cjs +1 -0
- package/dist/endpoints/CampaignRecipients/types.js +1 -1
- package/dist/endpoints/Campaigns/Client.cjs +92 -0
- package/dist/endpoints/Campaigns/Client.js +18 -25
- package/dist/endpoints/Campaigns/index.cjs +25 -0
- package/dist/endpoints/Campaigns/index.js +2 -25
- package/dist/endpoints/Campaigns/types.cjs +1 -0
- package/dist/endpoints/Campaigns/types.js +1 -1
- package/dist/endpoints/ContactsExports/Client.cjs +98 -0
- package/dist/endpoints/ContactsExports/Client.js +8 -15
- package/dist/endpoints/ContactsExports/index.cjs +37 -0
- package/dist/endpoints/ContactsExports/index.js +3 -37
- package/dist/endpoints/ContactsExports/types.cjs +1 -0
- package/dist/endpoints/ContactsExports/types.js +1 -1
- package/dist/endpoints/Coverage/Client.cjs +109 -0
- package/dist/endpoints/Coverage/Client.js +12 -19
- package/dist/endpoints/Coverage/index.cjs +25 -0
- package/dist/endpoints/Coverage/index.js +2 -25
- package/dist/endpoints/Coverage/types.cjs +1 -0
- package/dist/endpoints/Coverage/types.js +1 -1
- package/dist/endpoints/Jobs/Client.cjs +19 -0
- package/dist/endpoints/Jobs/Client.js +4 -11
- package/dist/endpoints/Jobs/index.cjs +25 -0
- package/dist/endpoints/Jobs/index.js +2 -25
- package/dist/endpoints/Jobs/types.cjs +1 -0
- package/dist/endpoints/Jobs/types.js +1 -1
- package/dist/endpoints/Licenses/Client.cjs +20 -0
- package/dist/endpoints/Licenses/Client.js +4 -11
- package/dist/endpoints/Licenses/index.cjs +15 -0
- package/dist/endpoints/Licenses/index.js +1 -15
- package/dist/endpoints/NewsroomCategories/Client.cjs +55 -0
- package/dist/endpoints/NewsroomCategories/Client.js +8 -15
- package/dist/endpoints/NewsroomCategories/index.cjs +25 -0
- package/dist/endpoints/NewsroomCategories/index.js +2 -25
- package/dist/endpoints/NewsroomCategories/types.cjs +1 -0
- package/dist/endpoints/NewsroomCategories/types.js +1 -1
- package/dist/endpoints/NewsroomContacts/Client.cjs +76 -0
- package/dist/endpoints/NewsroomContacts/Client.js +11 -18
- package/dist/endpoints/NewsroomContacts/index.cjs +25 -0
- package/dist/endpoints/NewsroomContacts/index.js +2 -25
- package/dist/endpoints/NewsroomContacts/types.cjs +1 -0
- package/dist/endpoints/NewsroomContacts/types.js +1 -1
- package/dist/endpoints/NewsroomDomains/Client.cjs +48 -0
- package/dist/endpoints/NewsroomDomains/Client.js +9 -16
- package/dist/endpoints/NewsroomDomains/index.cjs +25 -0
- package/dist/endpoints/NewsroomDomains/index.js +2 -25
- package/dist/endpoints/NewsroomDomains/types.cjs +1 -0
- package/dist/endpoints/NewsroomDomains/types.js +1 -1
- package/dist/endpoints/NewsroomGalleries/Client.cjs +82 -0
- package/dist/endpoints/NewsroomGalleries/Client.js +13 -20
- package/dist/endpoints/NewsroomGalleries/index.cjs +25 -0
- package/dist/endpoints/NewsroomGalleries/index.js +2 -25
- package/dist/endpoints/NewsroomGalleries/types.cjs +1 -0
- package/dist/endpoints/NewsroomGalleries/types.js +1 -1
- package/dist/endpoints/NewsroomLanguages/Client.cjs +100 -0
- package/dist/endpoints/NewsroomLanguages/Client.js +10 -17
- package/dist/endpoints/NewsroomLanguages/index.cjs +25 -0
- package/dist/endpoints/NewsroomLanguages/index.js +2 -25
- package/dist/endpoints/NewsroomLanguages/lib.cjs +9 -0
- package/dist/endpoints/NewsroomLanguages/lib.js +1 -7
- package/dist/endpoints/NewsroomLanguages/types.cjs +1 -0
- package/dist/endpoints/NewsroomLanguages/types.js +1 -1
- package/dist/endpoints/NewsroomPrivacyRequests/Client.cjs +29 -0
- package/dist/endpoints/NewsroomPrivacyRequests/Client.js +5 -12
- package/dist/endpoints/NewsroomPrivacyRequests/index.cjs +25 -0
- package/dist/endpoints/NewsroomPrivacyRequests/index.js +2 -25
- package/dist/endpoints/NewsroomPrivacyRequests/types.cjs +1 -0
- package/dist/endpoints/NewsroomPrivacyRequests/types.js +1 -1
- package/dist/endpoints/NewsroomSubscriptions/Client.cjs +22 -0
- package/dist/endpoints/NewsroomSubscriptions/Client.js +4 -11
- package/dist/endpoints/NewsroomSubscriptions/index.cjs +25 -0
- package/dist/endpoints/NewsroomSubscriptions/index.js +2 -25
- package/dist/endpoints/NewsroomSubscriptions/types.cjs +1 -0
- package/dist/endpoints/NewsroomSubscriptions/types.js +1 -1
- package/dist/endpoints/NewsroomThemes/Client.cjs +43 -0
- package/dist/endpoints/NewsroomThemes/Client.js +7 -14
- package/dist/endpoints/NewsroomThemes/index.cjs +15 -0
- package/dist/endpoints/NewsroomThemes/index.js +1 -15
- package/dist/endpoints/NewsroomWebhooks/Client.cjs +49 -0
- package/dist/endpoints/NewsroomWebhooks/Client.js +8 -15
- package/dist/endpoints/NewsroomWebhooks/index.cjs +25 -0
- package/dist/endpoints/NewsroomWebhooks/index.js +2 -25
- package/dist/endpoints/NewsroomWebhooks/types.cjs +1 -0
- package/dist/endpoints/NewsroomWebhooks/types.js +1 -1
- package/dist/endpoints/Newsrooms/Client.cjs +97 -0
- package/dist/endpoints/Newsrooms/Client.js +15 -22
- package/dist/endpoints/Newsrooms/index.cjs +25 -0
- package/dist/endpoints/Newsrooms/index.js +2 -25
- package/dist/endpoints/Newsrooms/types.cjs +1 -0
- package/dist/endpoints/Newsrooms/types.js +1 -1
- package/dist/endpoints/NotificationSubscriptions/Client.cjs +29 -0
- package/dist/endpoints/NotificationSubscriptions/Client.js +5 -12
- package/dist/endpoints/NotificationSubscriptions/index.cjs +25 -0
- package/dist/endpoints/NotificationSubscriptions/index.js +2 -25
- package/dist/endpoints/NotificationSubscriptions/types.cjs +1 -0
- package/dist/endpoints/NotificationSubscriptions/types.js +1 -1
- package/dist/endpoints/SenderAddresses/Client.cjs +44 -0
- package/dist/endpoints/SenderAddresses/Client.js +8 -15
- package/dist/endpoints/SenderAddresses/index.cjs +25 -0
- package/dist/endpoints/SenderAddresses/index.js +2 -25
- package/dist/endpoints/SenderAddresses/types.cjs +1 -0
- package/dist/endpoints/SenderAddresses/types.js +1 -1
- package/dist/endpoints/Signup/Client.cjs +21 -0
- package/dist/endpoints/Signup/Client.js +4 -11
- package/dist/endpoints/Signup/index.cjs +25 -0
- package/dist/endpoints/Signup/index.js +2 -25
- package/dist/endpoints/Signup/types.cjs +12 -0
- package/dist/endpoints/Signup/types.js +2 -9
- package/dist/endpoints/Snippets/Client.cjs +49 -0
- package/dist/endpoints/Snippets/Client.js +8 -15
- package/dist/endpoints/Snippets/index.cjs +25 -0
- package/dist/endpoints/Snippets/index.js +2 -25
- package/dist/endpoints/Snippets/types.cjs +1 -0
- package/dist/endpoints/Snippets/types.js +1 -1
- package/dist/endpoints/Stories/Client.cjs +290 -0
- package/dist/endpoints/Stories/Client.d.ts +25 -20
- package/dist/endpoints/Stories/Client.js +22 -30
- package/dist/endpoints/Stories/index.cjs +35 -0
- package/dist/endpoints/Stories/index.js +3 -35
- package/dist/endpoints/Stories/scopes.cjs +15 -0
- package/dist/endpoints/Stories/scopes.js +4 -11
- package/dist/endpoints/Stories/types.cjs +51 -0
- package/dist/endpoints/Stories/types.js +2 -10
- package/dist/endpoints/Subscriptions/Client.cjs +58 -0
- package/dist/endpoints/Subscriptions/Client.js +8 -15
- package/dist/endpoints/Subscriptions/index.cjs +25 -0
- package/dist/endpoints/Subscriptions/index.js +2 -25
- package/dist/endpoints/Subscriptions/types.cjs +15 -0
- package/dist/endpoints/Subscriptions/types.js +2 -9
- package/dist/endpoints/index.cjs +56 -0
- package/dist/endpoints/index.js +24 -56
- package/dist/http/ApiError.cjs +21 -0
- package/dist/http/ApiError.js +2 -9
- package/dist/http/Http.cjs +69 -0
- package/dist/http/Http.js +14 -21
- package/dist/http/constants.cjs +12 -0
- package/dist/http/constants.js +3 -12
- package/dist/http/createRequest.cjs +106 -0
- package/dist/http/createRequest.js +13 -20
- package/dist/http/index.cjs +39 -0
- package/dist/http/index.js +4 -39
- package/dist/http/lib.cjs +39 -0
- package/dist/http/lib.js +6 -16
- package/dist/http/types.cjs +25 -0
- package/dist/http/types.js +4 -12
- package/dist/index.cjs +56 -0
- package/dist/index.js +5 -56
- package/dist/routing.cjs +38 -0
- package/dist/routing.js +2 -9
- package/dist/types/Campaign.cjs +69 -0
- package/dist/types/Campaign.js +4 -11
- package/dist/types/Category.cjs +1 -0
- package/dist/types/Category.js +1 -1
- package/dist/types/Contact.cjs +82 -0
- package/dist/types/Contact.js +2 -9
- package/dist/types/ContactDuplicateSuggestion.cjs +17 -0
- package/dist/types/ContactDuplicateSuggestion.js +2 -9
- package/dist/types/ContactsExport.cjs +17 -0
- package/dist/types/ContactsExport.js +2 -9
- package/dist/types/ContactsScope.cjs +19 -0
- package/dist/types/ContactsScope.js +2 -9
- package/dist/types/Country.cjs +1 -0
- package/dist/types/Country.js +1 -1
- package/dist/types/CoverageEntry.cjs +32 -0
- package/dist/types/CoverageEntry.js +2 -9
- package/dist/types/Culture.cjs +16 -0
- package/dist/types/Culture.js +2 -9
- package/dist/types/Currency.cjs +13 -0
- package/dist/types/Currency.js +2 -9
- package/dist/types/DnsConfigurationInstruction.cjs +1 -0
- package/dist/types/DnsConfigurationInstruction.js +1 -1
- package/dist/types/EmailRecipient.cjs +18 -0
- package/dist/types/EmailRecipient.js +2 -9
- package/dist/types/EmailSubscription.cjs +1 -0
- package/dist/types/EmailSubscription.js +1 -1
- package/dist/types/JobState.cjs +13 -0
- package/dist/types/JobState.js +2 -9
- package/dist/types/License.cjs +31 -0
- package/dist/types/License.js +2 -9
- package/dist/types/Newsroom.cjs +30 -0
- package/dist/types/Newsroom.js +2 -9
- package/dist/types/NewsroomCompanyInformation.cjs +1 -0
- package/dist/types/NewsroomCompanyInformation.js +1 -1
- package/dist/types/NewsroomContact.cjs +1 -0
- package/dist/types/NewsroomContact.js +1 -1
- package/dist/types/NewsroomDomain.cjs +24 -0
- package/dist/types/NewsroomDomain.js +2 -9
- package/dist/types/NewsroomGallery.cjs +16 -0
- package/dist/types/NewsroomGallery.js +2 -9
- package/dist/types/NewsroomLanguageSettings.cjs +1 -0
- package/dist/types/NewsroomLanguageSettings.js +1 -1
- package/dist/types/NewsroomTheme.cjs +38 -0
- package/dist/types/NewsroomTheme.js +4 -12
- package/dist/types/NewsroomWebhook.cjs +20 -0
- package/dist/types/NewsroomWebhook.js +2 -9
- package/dist/types/NotificationSubscription.cjs +17 -0
- package/dist/types/NotificationSubscription.js +2 -9
- package/dist/types/Permissions.cjs +18 -0
- package/dist/types/Permissions.js +2 -9
- package/dist/types/Plan.cjs +18 -0
- package/dist/types/Plan.js +2 -9
- package/dist/types/PrivacyRequest.cjs +24 -0
- package/dist/types/PrivacyRequest.js +2 -9
- package/dist/types/SEOSettings.cjs +1 -0
- package/dist/types/SEOSettings.js +1 -1
- package/dist/types/SenderAddress.cjs +16 -0
- package/dist/types/SenderAddress.js +2 -9
- package/dist/types/SenderDomain.cjs +18 -0
- package/dist/types/SenderDomain.js +2 -9
- package/dist/types/Snippet.cjs +1 -0
- package/dist/types/Snippet.js +1 -1
- package/dist/types/Story.cjs +89 -0
- package/dist/types/Story.js +2 -9
- package/dist/types/User.cjs +28 -0
- package/dist/types/User.js +2 -9
- package/dist/types/UserAccount.cjs +1 -0
- package/dist/types/UserAccount.js +1 -1
- package/dist/types/common/Notification.cjs +18 -0
- package/dist/types/common/Notification.js +2 -9
- package/dist/types/common/OEmbedInfo.cjs +18 -0
- package/dist/types/common/OEmbedInfo.js +2 -9
- package/dist/types/common/Pagination.cjs +15 -0
- package/dist/types/common/Pagination.js +4 -9
- package/dist/types/common/Query.cjs +21 -0
- package/dist/types/common/Query.js +3 -9
- package/dist/types/common/Utm.cjs +1 -0
- package/dist/types/common/Utm.js +1 -1
- package/dist/types/common/Warning.cjs +1 -0
- package/dist/types/common/Warning.js +1 -1
- package/dist/types/common/index.cjs +65 -0
- package/dist/types/common/index.js +6 -65
- package/dist/types/index.cjs +325 -0
- package/dist/types/index.js +33 -325
- package/dist/utils.cjs +30 -0
- package/dist/utils.js +2 -9
- package/package.json +16 -6
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Client = void 0;
|
|
7
|
+
var _index = require("../../http/index.cjs");
|
|
8
|
+
var _routing = require("../../routing.cjs");
|
|
9
|
+
class Client {
|
|
10
|
+
constructor(apiClient) {
|
|
11
|
+
this.apiClient = apiClient;
|
|
12
|
+
}
|
|
13
|
+
async list(options) {
|
|
14
|
+
const {
|
|
15
|
+
limit,
|
|
16
|
+
offset,
|
|
17
|
+
sortOrder,
|
|
18
|
+
include
|
|
19
|
+
} = options ?? {};
|
|
20
|
+
return this.apiClient.get(_routing.routing.storiesUrl, {
|
|
21
|
+
query: {
|
|
22
|
+
limit,
|
|
23
|
+
offset,
|
|
24
|
+
sort: sortOrder,
|
|
25
|
+
include: include ? include.join(',') : undefined
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async search(options) {
|
|
30
|
+
const {
|
|
31
|
+
limit,
|
|
32
|
+
offset,
|
|
33
|
+
sortOrder,
|
|
34
|
+
include,
|
|
35
|
+
query
|
|
36
|
+
} = options ?? {};
|
|
37
|
+
return this.apiClient.post(_routing.routing.storiesSearchUrl, {
|
|
38
|
+
payload: {
|
|
39
|
+
query,
|
|
40
|
+
limit,
|
|
41
|
+
offset,
|
|
42
|
+
sort: sortOrder,
|
|
43
|
+
include: include ? include.join(',') : undefined
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get story by UUID.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Implementation
|
|
54
|
+
*/
|
|
55
|
+
async get(arg, options) {
|
|
56
|
+
const include = options?.include;
|
|
57
|
+
const isArray = Array.isArray(arg);
|
|
58
|
+
if (isArray && arg.length === 0) {
|
|
59
|
+
// No need to call the API.
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
if (isArray && typeof arg[0] === 'number') {
|
|
63
|
+
const {
|
|
64
|
+
stories
|
|
65
|
+
} = await this.search({
|
|
66
|
+
limit: arg.length,
|
|
67
|
+
query: {
|
|
68
|
+
id: {
|
|
69
|
+
$in: arg
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
include
|
|
73
|
+
});
|
|
74
|
+
return stories;
|
|
75
|
+
}
|
|
76
|
+
if (isArray && typeof arg[0] === 'string') {
|
|
77
|
+
const {
|
|
78
|
+
stories
|
|
79
|
+
} = await this.search({
|
|
80
|
+
limit: arg.length,
|
|
81
|
+
query: {
|
|
82
|
+
uuid: {
|
|
83
|
+
$in: arg
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
include
|
|
87
|
+
});
|
|
88
|
+
return stories;
|
|
89
|
+
}
|
|
90
|
+
const {
|
|
91
|
+
story
|
|
92
|
+
} = await this.apiClient.get(`${_routing.routing.storiesUrl}/${arg}`, {
|
|
93
|
+
query: {
|
|
94
|
+
include: include
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return story;
|
|
98
|
+
}
|
|
99
|
+
async create(payload, options) {
|
|
100
|
+
const include = options?.include;
|
|
101
|
+
const {
|
|
102
|
+
story
|
|
103
|
+
} = await this.apiClient.post(_routing.routing.storiesUrl, {
|
|
104
|
+
payload,
|
|
105
|
+
query: {
|
|
106
|
+
include: include
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
return story;
|
|
110
|
+
}
|
|
111
|
+
async duplicate(id, options) {
|
|
112
|
+
const include = options?.include;
|
|
113
|
+
const url = `${_routing.routing.storiesUrl}/${id}/duplicate`;
|
|
114
|
+
const {
|
|
115
|
+
story
|
|
116
|
+
} = await this.apiClient.post(url, {
|
|
117
|
+
query: {
|
|
118
|
+
include: include
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
return story;
|
|
122
|
+
}
|
|
123
|
+
async translate(id, payload, options) {
|
|
124
|
+
const include = options?.include;
|
|
125
|
+
const url = `${_routing.routing.storiesUrl}/${id}/translate`;
|
|
126
|
+
const {
|
|
127
|
+
story
|
|
128
|
+
} = await this.apiClient.post(url, {
|
|
129
|
+
query: {
|
|
130
|
+
include: include
|
|
131
|
+
},
|
|
132
|
+
payload
|
|
133
|
+
});
|
|
134
|
+
return story;
|
|
135
|
+
}
|
|
136
|
+
async move(id, payload, options) {
|
|
137
|
+
const include = options?.include;
|
|
138
|
+
const force = options?.force;
|
|
139
|
+
const url = `${_routing.routing.storiesUrl}/${id}/move`;
|
|
140
|
+
try {
|
|
141
|
+
const {
|
|
142
|
+
story
|
|
143
|
+
} = await this.apiClient.post(url, {
|
|
144
|
+
query: {
|
|
145
|
+
include: include,
|
|
146
|
+
force
|
|
147
|
+
},
|
|
148
|
+
payload
|
|
149
|
+
});
|
|
150
|
+
return {
|
|
151
|
+
status: 'success',
|
|
152
|
+
story
|
|
153
|
+
};
|
|
154
|
+
} catch (error) {
|
|
155
|
+
if (error instanceof _index.ApiError && error.status === _index.HttpCodes.CONFLICT) {
|
|
156
|
+
return error.payload;
|
|
157
|
+
}
|
|
158
|
+
throw error;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
async update(id, payload, options) {
|
|
162
|
+
const url = `${_routing.routing.storiesUrl}/${id}`;
|
|
163
|
+
const include = options?.include;
|
|
164
|
+
const {
|
|
165
|
+
story
|
|
166
|
+
} = await this.apiClient.patch(url, {
|
|
167
|
+
payload,
|
|
168
|
+
query: {
|
|
169
|
+
include: include
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
return story;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* This operation is only allowed for V3 stories
|
|
177
|
+
*/
|
|
178
|
+
async autosave(id, payload, options) {
|
|
179
|
+
const url = `${_routing.routing.storiesUrl}/${id}/autosave`;
|
|
180
|
+
const include = options?.include;
|
|
181
|
+
const {
|
|
182
|
+
story
|
|
183
|
+
} = await this.apiClient.patch(url, {
|
|
184
|
+
payload,
|
|
185
|
+
query: {
|
|
186
|
+
include: include
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
return story;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* This operation is only allowed for V3 stories
|
|
194
|
+
*/
|
|
195
|
+
async revert(id, payload, options) {
|
|
196
|
+
const url = `${_routing.routing.storiesUrl}/${id}/revert`;
|
|
197
|
+
const include = options?.include;
|
|
198
|
+
const {
|
|
199
|
+
story
|
|
200
|
+
} = await this.apiClient.post(url, {
|
|
201
|
+
payload,
|
|
202
|
+
query: {
|
|
203
|
+
include: include
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
return story;
|
|
207
|
+
}
|
|
208
|
+
async publish(id, payload, options) {
|
|
209
|
+
const url = `${_routing.routing.storiesUrl}/${id}/publish`;
|
|
210
|
+
const include = options?.include;
|
|
211
|
+
const {
|
|
212
|
+
story
|
|
213
|
+
} = await this.apiClient.post(url, {
|
|
214
|
+
payload,
|
|
215
|
+
query: {
|
|
216
|
+
include: include
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
return story;
|
|
220
|
+
}
|
|
221
|
+
async unpublish(id, payload, options) {
|
|
222
|
+
const url = `${_routing.routing.storiesUrl}/${id}/unpublish`;
|
|
223
|
+
const include = options?.include;
|
|
224
|
+
const {
|
|
225
|
+
story
|
|
226
|
+
} = await this.apiClient.post(url, {
|
|
227
|
+
payload,
|
|
228
|
+
query: {
|
|
229
|
+
include: include
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
return story;
|
|
233
|
+
}
|
|
234
|
+
async schedule(id, payload, options) {
|
|
235
|
+
const url = `${_routing.routing.storiesUrl}/${id}/schedule`;
|
|
236
|
+
const include = options?.include;
|
|
237
|
+
const {
|
|
238
|
+
story
|
|
239
|
+
} = await this.apiClient.post(url, {
|
|
240
|
+
payload,
|
|
241
|
+
query: {
|
|
242
|
+
include: include
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
return story;
|
|
246
|
+
}
|
|
247
|
+
async unschedule(id, payload, options) {
|
|
248
|
+
const url = `${_routing.routing.storiesUrl}/${id}/unpublish`;
|
|
249
|
+
const include = options?.include;
|
|
250
|
+
const {
|
|
251
|
+
story
|
|
252
|
+
} = await this.apiClient.post(url, {
|
|
253
|
+
payload,
|
|
254
|
+
query: {
|
|
255
|
+
include: include
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
return story;
|
|
259
|
+
}
|
|
260
|
+
async pin(id, options) {
|
|
261
|
+
const url = `${_routing.routing.storiesUrl}/${id}/pin`;
|
|
262
|
+
const include = options?.include;
|
|
263
|
+
const {
|
|
264
|
+
story
|
|
265
|
+
} = await this.apiClient.post(url, {
|
|
266
|
+
query: {
|
|
267
|
+
include: include,
|
|
268
|
+
force: options?.force || undefined
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
return story;
|
|
272
|
+
}
|
|
273
|
+
async unpin(id, options) {
|
|
274
|
+
const url = `${_routing.routing.storiesUrl}/${id}/unpin`;
|
|
275
|
+
const include = options?.include;
|
|
276
|
+
const {
|
|
277
|
+
story
|
|
278
|
+
} = await this.apiClient.post(url, {
|
|
279
|
+
query: {
|
|
280
|
+
include: include
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
return story;
|
|
284
|
+
}
|
|
285
|
+
async delete(id) {
|
|
286
|
+
const url = `${_routing.routing.storiesUrl}/${id}`;
|
|
287
|
+
await this.apiClient.delete(url);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
exports.Client = Client;
|
|
@@ -5,52 +5,57 @@ import type { AutosaveRequest, ChangeNewsroomSuccessResponse, ChangeNewsroomUnsa
|
|
|
5
5
|
* `uuid` is the preferred way of targeting a Story. Numeric `id` is considered deprecated.
|
|
6
6
|
*/
|
|
7
7
|
declare type StoryId = Story['uuid'] | Story['id'];
|
|
8
|
+
/**
|
|
9
|
+
* Utility type to forbid arbitrary ad-hoc extensions of generic parameters.
|
|
10
|
+
* @see https://stackoverflow.com/a/69666350
|
|
11
|
+
*/
|
|
12
|
+
declare type Exactly<T, X> = T & Record<Exclude<keyof X, keyof T>, never>;
|
|
8
13
|
export declare class Client {
|
|
9
14
|
private readonly apiClient;
|
|
10
15
|
constructor(apiClient: DeferredJobsApiClient);
|
|
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 SearchOptions<Include>, StoryRecord extends Story = Options['include'] extends Include ? Story & Pick<Story.ExtraFields, Options['include'][number]> : Story>(options?: Options): Promise<ListResponse<StoryRecord>>;
|
|
16
|
+
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?: Exactly<ListOptions<Include>, Options>): Promise<ListResponse<StoryRecord>>;
|
|
17
|
+
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?: Exactly<SearchOptions<Include>, Options>): Promise<ListResponse<StoryRecord>>;
|
|
13
18
|
/**
|
|
14
19
|
* Get story by UUID.
|
|
15
20
|
*/
|
|
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>;
|
|
21
|
+
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?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
|
|
17
22
|
/**
|
|
18
23
|
* Get multiple stories by UUIDs.
|
|
19
24
|
*/
|
|
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[]>;
|
|
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>(ids: Story['uuid'][], options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord[]>;
|
|
21
26
|
/**
|
|
22
27
|
* Get story by deprecated numeric ID, or UUID.
|
|
23
28
|
* @deprecated Please use UUID instead.
|
|
24
29
|
*/
|
|
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>;
|
|
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>(id: Story['id'] | Story['uuid'], options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
|
|
26
31
|
/**
|
|
27
32
|
* Get multiple stories by numeric IDs.
|
|
28
33
|
* @deprecated Please use UUID instead.
|
|
29
34
|
*/
|
|
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
|
-
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
|
-
translate<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: TranslateRequest, options?: Options): Promise<StoryRecord>;
|
|
34
|
-
move<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include> & {
|
|
35
|
+
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?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord[]>;
|
|
36
|
+
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?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
|
|
37
|
+
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?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
|
|
38
|
+
translate<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: TranslateRequest, options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
|
|
39
|
+
move<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: MoveRequest, options?: Exactly<IncludeOptions<Include>, Options> & {
|
|
35
40
|
force?: true;
|
|
36
|
-
}
|
|
37
|
-
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>;
|
|
41
|
+
}): Promise<ChangeNewsroomSuccessResponse<StoryRecord> | ChangeNewsroomUnsafeResponse>;
|
|
42
|
+
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?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
|
|
38
43
|
/**
|
|
39
44
|
* This operation is only allowed for V3 stories
|
|
40
45
|
*/
|
|
41
|
-
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>;
|
|
46
|
+
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?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
|
|
42
47
|
/**
|
|
43
48
|
* This operation is only allowed for V3 stories
|
|
44
49
|
*/
|
|
45
|
-
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>;
|
|
46
|
-
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>;
|
|
47
|
-
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>;
|
|
48
|
-
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>;
|
|
49
|
-
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>;
|
|
50
|
-
pin<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 & {
|
|
50
|
+
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?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
|
|
51
|
+
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?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
|
|
52
|
+
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?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
|
|
53
|
+
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?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
|
|
54
|
+
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?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
|
|
55
|
+
pin<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?: Exactly<IncludeOptions<Include>, Options> & {
|
|
51
56
|
force?: boolean;
|
|
52
57
|
}): Promise<StoryRecord>;
|
|
53
|
-
unpin<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>;
|
|
58
|
+
unpin<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?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
|
|
54
59
|
delete(id: StoryId): Promise<void>;
|
|
55
60
|
}
|
|
56
61
|
export {};
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Client = void 0;
|
|
7
|
-
var _index = require("../../http/index.js");
|
|
8
|
-
var _ApiError = require("../../http/ApiError.js");
|
|
9
|
-
var _routing = require("../../routing.js");
|
|
10
|
-
class Client {
|
|
1
|
+
import { ApiError, HttpCodes } from "../../http/index.js";
|
|
2
|
+
import { routing } from "../../routing.js";
|
|
3
|
+
export class Client {
|
|
11
4
|
constructor(apiClient) {
|
|
12
5
|
this.apiClient = apiClient;
|
|
13
6
|
}
|
|
@@ -18,7 +11,7 @@ class Client {
|
|
|
18
11
|
sortOrder,
|
|
19
12
|
include
|
|
20
13
|
} = options ?? {};
|
|
21
|
-
return this.apiClient.get(
|
|
14
|
+
return this.apiClient.get(routing.storiesUrl, {
|
|
22
15
|
query: {
|
|
23
16
|
limit,
|
|
24
17
|
offset,
|
|
@@ -35,7 +28,7 @@ class Client {
|
|
|
35
28
|
include,
|
|
36
29
|
query
|
|
37
30
|
} = options ?? {};
|
|
38
|
-
return this.apiClient.post(
|
|
31
|
+
return this.apiClient.post(routing.storiesSearchUrl, {
|
|
39
32
|
payload: {
|
|
40
33
|
query,
|
|
41
34
|
limit,
|
|
@@ -90,7 +83,7 @@ class Client {
|
|
|
90
83
|
}
|
|
91
84
|
const {
|
|
92
85
|
story
|
|
93
|
-
} = await this.apiClient.get(`${
|
|
86
|
+
} = await this.apiClient.get(`${routing.storiesUrl}/${arg}`, {
|
|
94
87
|
query: {
|
|
95
88
|
include: include
|
|
96
89
|
}
|
|
@@ -101,7 +94,7 @@ class Client {
|
|
|
101
94
|
const include = options?.include;
|
|
102
95
|
const {
|
|
103
96
|
story
|
|
104
|
-
} = await this.apiClient.post(
|
|
97
|
+
} = await this.apiClient.post(routing.storiesUrl, {
|
|
105
98
|
payload,
|
|
106
99
|
query: {
|
|
107
100
|
include: include
|
|
@@ -111,7 +104,7 @@ class Client {
|
|
|
111
104
|
}
|
|
112
105
|
async duplicate(id, options) {
|
|
113
106
|
const include = options?.include;
|
|
114
|
-
const url = `${
|
|
107
|
+
const url = `${routing.storiesUrl}/${id}/duplicate`;
|
|
115
108
|
const {
|
|
116
109
|
story
|
|
117
110
|
} = await this.apiClient.post(url, {
|
|
@@ -123,7 +116,7 @@ class Client {
|
|
|
123
116
|
}
|
|
124
117
|
async translate(id, payload, options) {
|
|
125
118
|
const include = options?.include;
|
|
126
|
-
const url = `${
|
|
119
|
+
const url = `${routing.storiesUrl}/${id}/translate`;
|
|
127
120
|
const {
|
|
128
121
|
story
|
|
129
122
|
} = await this.apiClient.post(url, {
|
|
@@ -137,7 +130,7 @@ class Client {
|
|
|
137
130
|
async move(id, payload, options) {
|
|
138
131
|
const include = options?.include;
|
|
139
132
|
const force = options?.force;
|
|
140
|
-
const url = `${
|
|
133
|
+
const url = `${routing.storiesUrl}/${id}/move`;
|
|
141
134
|
try {
|
|
142
135
|
const {
|
|
143
136
|
story
|
|
@@ -153,14 +146,14 @@ class Client {
|
|
|
153
146
|
story
|
|
154
147
|
};
|
|
155
148
|
} catch (error) {
|
|
156
|
-
if (error instanceof
|
|
149
|
+
if (error instanceof ApiError && error.status === HttpCodes.CONFLICT) {
|
|
157
150
|
return error.payload;
|
|
158
151
|
}
|
|
159
152
|
throw error;
|
|
160
153
|
}
|
|
161
154
|
}
|
|
162
155
|
async update(id, payload, options) {
|
|
163
|
-
const url = `${
|
|
156
|
+
const url = `${routing.storiesUrl}/${id}`;
|
|
164
157
|
const include = options?.include;
|
|
165
158
|
const {
|
|
166
159
|
story
|
|
@@ -177,7 +170,7 @@ class Client {
|
|
|
177
170
|
* This operation is only allowed for V3 stories
|
|
178
171
|
*/
|
|
179
172
|
async autosave(id, payload, options) {
|
|
180
|
-
const url = `${
|
|
173
|
+
const url = `${routing.storiesUrl}/${id}/autosave`;
|
|
181
174
|
const include = options?.include;
|
|
182
175
|
const {
|
|
183
176
|
story
|
|
@@ -194,7 +187,7 @@ class Client {
|
|
|
194
187
|
* This operation is only allowed for V3 stories
|
|
195
188
|
*/
|
|
196
189
|
async revert(id, payload, options) {
|
|
197
|
-
const url = `${
|
|
190
|
+
const url = `${routing.storiesUrl}/${id}/revert`;
|
|
198
191
|
const include = options?.include;
|
|
199
192
|
const {
|
|
200
193
|
story
|
|
@@ -207,7 +200,7 @@ class Client {
|
|
|
207
200
|
return story;
|
|
208
201
|
}
|
|
209
202
|
async publish(id, payload, options) {
|
|
210
|
-
const url = `${
|
|
203
|
+
const url = `${routing.storiesUrl}/${id}/publish`;
|
|
211
204
|
const include = options?.include;
|
|
212
205
|
const {
|
|
213
206
|
story
|
|
@@ -220,7 +213,7 @@ class Client {
|
|
|
220
213
|
return story;
|
|
221
214
|
}
|
|
222
215
|
async unpublish(id, payload, options) {
|
|
223
|
-
const url = `${
|
|
216
|
+
const url = `${routing.storiesUrl}/${id}/unpublish`;
|
|
224
217
|
const include = options?.include;
|
|
225
218
|
const {
|
|
226
219
|
story
|
|
@@ -233,7 +226,7 @@ class Client {
|
|
|
233
226
|
return story;
|
|
234
227
|
}
|
|
235
228
|
async schedule(id, payload, options) {
|
|
236
|
-
const url = `${
|
|
229
|
+
const url = `${routing.storiesUrl}/${id}/schedule`;
|
|
237
230
|
const include = options?.include;
|
|
238
231
|
const {
|
|
239
232
|
story
|
|
@@ -246,7 +239,7 @@ class Client {
|
|
|
246
239
|
return story;
|
|
247
240
|
}
|
|
248
241
|
async unschedule(id, payload, options) {
|
|
249
|
-
const url = `${
|
|
242
|
+
const url = `${routing.storiesUrl}/${id}/unpublish`;
|
|
250
243
|
const include = options?.include;
|
|
251
244
|
const {
|
|
252
245
|
story
|
|
@@ -259,7 +252,7 @@ class Client {
|
|
|
259
252
|
return story;
|
|
260
253
|
}
|
|
261
254
|
async pin(id, options) {
|
|
262
|
-
const url = `${
|
|
255
|
+
const url = `${routing.storiesUrl}/${id}/pin`;
|
|
263
256
|
const include = options?.include;
|
|
264
257
|
const {
|
|
265
258
|
story
|
|
@@ -272,7 +265,7 @@ class Client {
|
|
|
272
265
|
return story;
|
|
273
266
|
}
|
|
274
267
|
async unpin(id, options) {
|
|
275
|
-
const url = `${
|
|
268
|
+
const url = `${routing.storiesUrl}/${id}/unpin`;
|
|
276
269
|
const include = options?.include;
|
|
277
270
|
const {
|
|
278
271
|
story
|
|
@@ -284,8 +277,7 @@ class Client {
|
|
|
284
277
|
return story;
|
|
285
278
|
}
|
|
286
279
|
async delete(id) {
|
|
287
|
-
const url = `${
|
|
280
|
+
const url = `${routing.storiesUrl}/${id}`;
|
|
288
281
|
await this.apiClient.delete(url);
|
|
289
282
|
}
|
|
290
|
-
}
|
|
291
|
-
exports.Client = Client;
|
|
283
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _Client = require("./Client.cjs");
|
|
7
|
+
Object.keys(_Client).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
Object.defineProperty(exports, key, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _Client[key];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
var _types = require("./types.cjs");
|
|
17
|
+
Object.keys(_types).forEach(function (key) {
|
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
|
19
|
+
Object.defineProperty(exports, key, {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _types[key];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
var _scopes = require("./scopes.cjs");
|
|
27
|
+
Object.keys(_scopes).forEach(function (key) {
|
|
28
|
+
if (key === "default" || key === "__esModule") return;
|
|
29
|
+
Object.defineProperty(exports, key, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () {
|
|
32
|
+
return _scopes[key];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -1,35 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _Client = require("./Client.js");
|
|
7
|
-
Object.keys(_Client).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
Object.defineProperty(exports, key, {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function () {
|
|
12
|
-
return _Client[key];
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
var _types = require("./types.js");
|
|
17
|
-
Object.keys(_types).forEach(function (key) {
|
|
18
|
-
if (key === "default" || key === "__esModule") return;
|
|
19
|
-
Object.defineProperty(exports, key, {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () {
|
|
22
|
-
return _types[key];
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
var _scopes = require("./scopes.js");
|
|
27
|
-
Object.keys(_scopes).forEach(function (key) {
|
|
28
|
-
if (key === "default" || key === "__esModule") return;
|
|
29
|
-
Object.defineProperty(exports, key, {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
get: function () {
|
|
32
|
-
return _scopes[key];
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
});
|
|
1
|
+
export * from "./Client.js";
|
|
2
|
+
export * from "./types.js";
|
|
3
|
+
export * from "./scopes.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Scope = void 0;
|
|
7
|
+
var _index = require("../../types/index.cjs");
|
|
8
|
+
const Scope = {
|
|
9
|
+
EXCLUDE_ARCHIVED_NEWSROOMS: {
|
|
10
|
+
'newsroom.status': {
|
|
11
|
+
$nin: [_index.Newsroom.Status.ARCHIVED]
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
exports.Scope = Scope;
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Scope = void 0;
|
|
7
|
-
var _index = require("../../types/index.js");
|
|
8
|
-
const Scope = {
|
|
1
|
+
import { Newsroom } from "../../types/index.js";
|
|
2
|
+
export const Scope = {
|
|
9
3
|
EXCLUDE_ARCHIVED_NEWSROOMS: {
|
|
10
4
|
'newsroom.status': {
|
|
11
|
-
$nin: [
|
|
5
|
+
$nin: [Newsroom.Status.ARCHIVED]
|
|
12
6
|
}
|
|
13
7
|
}
|
|
14
|
-
};
|
|
15
|
-
exports.Scope = Scope;
|
|
8
|
+
};
|