@prezly/sdk 19.9.0 → 20.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.
Files changed (93) hide show
  1. package/dist/Client.cjs +28 -28
  2. package/dist/Client.d.ts +2 -1
  3. package/dist/Client.js +29 -29
  4. package/dist/api/ApiClient.cjs +36 -34
  5. package/dist/api/ApiClient.d.ts +8 -12
  6. package/dist/api/ApiClient.js +34 -31
  7. package/dist/api/DeferredJobsApiClient.cjs +20 -18
  8. package/dist/api/DeferredJobsApiClient.d.ts +8 -10
  9. package/dist/api/DeferredJobsApiClient.js +18 -15
  10. package/dist/api/constants.cjs +1 -1
  11. package/dist/api/constants.js +1 -1
  12. package/dist/api/index.cjs +4 -4
  13. package/dist/api/index.d.ts +2 -2
  14. package/dist/api/index.js +2 -2
  15. package/dist/endpoints/Accounts/Client.cjs +14 -13
  16. package/dist/endpoints/Accounts/Client.d.ts +6 -7
  17. package/dist/endpoints/Accounts/Client.js +12 -10
  18. package/dist/endpoints/Billing/Client.cjs +11 -11
  19. package/dist/endpoints/Billing/Client.d.ts +5 -6
  20. package/dist/endpoints/Billing/Client.js +9 -8
  21. package/dist/endpoints/CampaignRecipients/Client.cjs +26 -21
  22. package/dist/endpoints/CampaignRecipients/Client.d.ts +13 -14
  23. package/dist/endpoints/CampaignRecipients/Client.js +24 -18
  24. package/dist/endpoints/Campaigns/Client.cjs +38 -29
  25. package/dist/endpoints/Campaigns/Client.d.ts +14 -15
  26. package/dist/endpoints/Campaigns/Client.js +36 -26
  27. package/dist/endpoints/Contacts/Client.cjs +41 -32
  28. package/dist/endpoints/Contacts/Client.d.ts +15 -22
  29. package/dist/endpoints/Contacts/Client.js +39 -29
  30. package/dist/endpoints/ContactsExports/Client.cjs +20 -18
  31. package/dist/endpoints/ContactsExports/Client.d.ts +8 -31
  32. package/dist/endpoints/ContactsExports/Client.js +18 -15
  33. package/dist/endpoints/Coverage/Client.cjs +29 -23
  34. package/dist/endpoints/Coverage/Client.d.ts +12 -13
  35. package/dist/endpoints/Coverage/Client.js +27 -20
  36. package/dist/endpoints/Jobs/Client.cjs +8 -9
  37. package/dist/endpoints/Jobs/Client.d.ts +4 -5
  38. package/dist/endpoints/Jobs/Client.js +6 -6
  39. package/dist/endpoints/Licenses/Client.cjs +8 -9
  40. package/dist/endpoints/Licenses/Client.d.ts +4 -5
  41. package/dist/endpoints/Licenses/Client.js +6 -6
  42. package/dist/endpoints/NewsroomCategories/Client.cjs +20 -17
  43. package/dist/endpoints/NewsroomCategories/Client.d.ts +8 -9
  44. package/dist/endpoints/NewsroomCategories/Client.js +18 -14
  45. package/dist/endpoints/NewsroomContacts/Client.cjs +23 -19
  46. package/dist/endpoints/NewsroomContacts/Client.d.ts +9 -10
  47. package/dist/endpoints/NewsroomContacts/Client.js +21 -16
  48. package/dist/endpoints/NewsroomDomains/Client.cjs +23 -19
  49. package/dist/endpoints/NewsroomDomains/Client.d.ts +9 -10
  50. package/dist/endpoints/NewsroomDomains/Client.js +21 -16
  51. package/dist/endpoints/NewsroomGalleries/Client.cjs +26 -21
  52. package/dist/endpoints/NewsroomGalleries/Client.d.ts +10 -11
  53. package/dist/endpoints/NewsroomGalleries/Client.js +24 -18
  54. package/dist/endpoints/NewsroomHub/Client.cjs +26 -23
  55. package/dist/endpoints/NewsroomHub/Client.d.ts +8 -9
  56. package/dist/endpoints/NewsroomHub/Client.js +25 -21
  57. package/dist/endpoints/NewsroomLanguages/Client.cjs +26 -21
  58. package/dist/endpoints/NewsroomLanguages/Client.d.ts +16 -24
  59. package/dist/endpoints/NewsroomLanguages/Client.js +24 -18
  60. package/dist/endpoints/NewsroomPrivacyRequests/Client.cjs +11 -11
  61. package/dist/endpoints/NewsroomPrivacyRequests/Client.d.ts +5 -6
  62. package/dist/endpoints/NewsroomPrivacyRequests/Client.js +9 -8
  63. package/dist/endpoints/NewsroomSubscriptions/Client.cjs +24 -13
  64. package/dist/endpoints/NewsroomSubscriptions/Client.d.ts +8 -9
  65. package/dist/endpoints/NewsroomSubscriptions/Client.js +23 -11
  66. package/dist/endpoints/NewsroomThemes/Client.cjs +17 -15
  67. package/dist/endpoints/NewsroomThemes/Client.d.ts +7 -8
  68. package/dist/endpoints/NewsroomThemes/Client.js +15 -12
  69. package/dist/endpoints/NewsroomWebhooks/Client.cjs +20 -17
  70. package/dist/endpoints/NewsroomWebhooks/Client.d.ts +8 -9
  71. package/dist/endpoints/NewsroomWebhooks/Client.js +18 -14
  72. package/dist/endpoints/Newsrooms/Client.cjs +35 -27
  73. package/dist/endpoints/Newsrooms/Client.d.ts +13 -14
  74. package/dist/endpoints/Newsrooms/Client.js +33 -24
  75. package/dist/endpoints/NotificationSubscriptions/Client.cjs +11 -11
  76. package/dist/endpoints/NotificationSubscriptions/Client.d.ts +5 -6
  77. package/dist/endpoints/NotificationSubscriptions/Client.js +9 -8
  78. package/dist/endpoints/PricingTables/Client.cjs +11 -11
  79. package/dist/endpoints/PricingTables/Client.d.ts +5 -6
  80. package/dist/endpoints/PricingTables/Client.js +9 -8
  81. package/dist/endpoints/SenderAddresses/Client.cjs +20 -17
  82. package/dist/endpoints/SenderAddresses/Client.d.ts +8 -9
  83. package/dist/endpoints/SenderAddresses/Client.js +18 -14
  84. package/dist/endpoints/Snippets/Client.cjs +20 -17
  85. package/dist/endpoints/Snippets/Client.d.ts +8 -9
  86. package/dist/endpoints/Snippets/Client.js +18 -14
  87. package/dist/endpoints/Stories/Client.cjs +63 -46
  88. package/dist/endpoints/Stories/Client.d.ts +109 -128
  89. package/dist/endpoints/Stories/Client.js +62 -44
  90. package/dist/endpoints/Subscriptions/Client.cjs +20 -17
  91. package/dist/endpoints/Subscriptions/Client.d.ts +8 -9
  92. package/dist/endpoints/Subscriptions/Client.js +18 -14
  93. package/package.json +1 -1
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Client = void 0;
6
+ exports.createClient = createClient;
7
7
  var _index = require("../../http/index.cjs");
8
8
  var _routing = require("../../routing.cjs");
9
9
  var _index2 = require("../../types/index.cjs");
@@ -17,11 +17,8 @@ var _types = require("./types.cjs");
17
17
  * @see https://stackoverflow.com/a/69666350
18
18
  */
19
19
 
20
- class Client {
21
- constructor(apiClient) {
22
- this.apiClient = apiClient;
23
- }
24
- async list(options) {
20
+ function createClient(api) {
21
+ async function list(options) {
25
22
  const {
26
23
  search,
27
24
  limit,
@@ -30,7 +27,7 @@ class Client {
30
27
  include,
31
28
  formats
32
29
  } = options ?? {};
33
- return this.apiClient.get(_routing.routing.storiesUrl, {
30
+ return api.get(_routing.routing.storiesUrl, {
34
31
  headers: acceptedFormatsHeader(formats),
35
32
  query: {
36
33
  search,
@@ -41,7 +38,7 @@ class Client {
41
38
  }
42
39
  });
43
40
  }
44
- async search(options) {
41
+ async function search(options) {
45
42
  const {
46
43
  search,
47
44
  limit,
@@ -51,7 +48,7 @@ class Client {
51
48
  query,
52
49
  formats
53
50
  } = options ?? {};
54
- return this.apiClient.post(_routing.routing.storiesSearchUrl, {
51
+ return api.post(_routing.routing.storiesSearchUrl, {
55
52
  headers: acceptedFormatsHeader(formats),
56
53
  payload: {
57
54
  search,
@@ -85,7 +82,7 @@ class Client {
85
82
  /**
86
83
  * Implementation
87
84
  */
88
- async get(arg, options) {
85
+ async function get(arg, options) {
89
86
  const {
90
87
  include,
91
88
  formats
@@ -98,7 +95,7 @@ class Client {
98
95
  if (isArray && typeof arg[0] === 'number') {
99
96
  const {
100
97
  stories
101
- } = await this.search({
98
+ } = await search({
102
99
  limit: arg.length,
103
100
  query: {
104
101
  id: {
@@ -113,7 +110,7 @@ class Client {
113
110
  if (isArray && typeof arg[0] === 'string') {
114
111
  const {
115
112
  stories
116
- } = await this.search({
113
+ } = await search({
117
114
  limit: arg.length,
118
115
  query: {
119
116
  uuid: {
@@ -127,7 +124,7 @@ class Client {
127
124
  }
128
125
  const {
129
126
  story
130
- } = await this.apiClient.get(`${_routing.routing.storiesUrl}/${arg}`, {
127
+ } = await api.get(`${_routing.routing.storiesUrl}/${arg}`, {
131
128
  headers: acceptedFormatsHeader(formats),
132
129
  query: {
133
130
  include
@@ -135,7 +132,7 @@ class Client {
135
132
  });
136
133
  return story;
137
134
  }
138
- async getBySlug(slug, options) {
135
+ async function getBySlug(slug, options) {
139
136
  if (slug.includes('/') || slug.includes('\\')) {
140
137
  throw new Error('Story slugs cannot contain slashes.');
141
138
  }
@@ -146,7 +143,7 @@ class Client {
146
143
  } = options ?? {};
147
144
  const {
148
145
  story
149
- } = await this.apiClient.post(`${_routing.routing.storiesUrl}/by-slug/${slug}`, {
146
+ } = await api.post(`${_routing.routing.storiesUrl}/by-slug/${slug}`, {
150
147
  headers: acceptedFormatsHeader(formats),
151
148
  query: {
152
149
  include
@@ -157,7 +154,7 @@ class Client {
157
154
  });
158
155
  return story;
159
156
  }
160
- async create(payload, options) {
157
+ async function create(payload, options) {
161
158
  const {
162
159
  include,
163
160
  formats,
@@ -165,7 +162,7 @@ class Client {
165
162
  } = options ?? {};
166
163
  const {
167
164
  story
168
- } = await this.apiClient.post(_routing.routing.storiesUrl, {
165
+ } = await api.post(_routing.routing.storiesUrl, {
169
166
  headers: acceptedFormatsHeader(formats),
170
167
  query: {
171
168
  include,
@@ -175,7 +172,7 @@ class Client {
175
172
  });
176
173
  return story;
177
174
  }
178
- async duplicate(id, options) {
175
+ async function duplicate(id, options) {
179
176
  const {
180
177
  include,
181
178
  formats
@@ -183,7 +180,7 @@ class Client {
183
180
  const url = `${_routing.routing.storiesUrl}/${id}/duplicate`;
184
181
  const {
185
182
  story
186
- } = await this.apiClient.post(url, {
183
+ } = await api.post(url, {
187
184
  headers: acceptedFormatsHeader(formats),
188
185
  query: {
189
186
  include
@@ -191,7 +188,7 @@ class Client {
191
188
  });
192
189
  return story;
193
190
  }
194
- async translate(id, payload = {}, options) {
191
+ async function translate(id, payload = {}, options) {
195
192
  const {
196
193
  culture
197
194
  } = payload ?? {};
@@ -202,7 +199,7 @@ class Client {
202
199
  const url = `${_routing.routing.storiesUrl}/${id}/translate`;
203
200
  const {
204
201
  story
205
- } = await this.apiClient.post(url, {
202
+ } = await api.post(url, {
206
203
  headers: acceptedFormatsHeader(formats),
207
204
  query: {
208
205
  include
@@ -213,7 +210,7 @@ class Client {
213
210
  });
214
211
  return story;
215
212
  }
216
- async move(id, payload, options) {
213
+ async function move(id, payload, options) {
217
214
  const {
218
215
  include,
219
216
  formats,
@@ -223,7 +220,7 @@ class Client {
223
220
  try {
224
221
  const {
225
222
  story
226
- } = await this.apiClient.post(url, {
223
+ } = await api.post(url, {
227
224
  headers: acceptedFormatsHeader(formats),
228
225
  query: {
229
226
  include,
@@ -242,7 +239,7 @@ class Client {
242
239
  throw error;
243
240
  }
244
241
  }
245
- async update(id, payload, options) {
242
+ async function update(id, payload, options) {
246
243
  const url = `${_routing.routing.storiesUrl}/${id}`;
247
244
  const {
248
245
  include,
@@ -251,7 +248,7 @@ class Client {
251
248
  } = options ?? {};
252
249
  const {
253
250
  story
254
- } = await this.apiClient.patch(url, {
251
+ } = await api.patch(url, {
255
252
  headers: acceptedFormatsHeader(formats),
256
253
  query: {
257
254
  include,
@@ -265,7 +262,7 @@ class Client {
265
262
  /**
266
263
  * This operation is only allowed for V3 stories
267
264
  */
268
- async autosave(id, payload, options) {
265
+ async function autosave(id, payload, options) {
269
266
  const url = `${_routing.routing.storiesUrl}/${id}/autosave`;
270
267
  const {
271
268
  include,
@@ -273,7 +270,7 @@ class Client {
273
270
  } = options ?? {};
274
271
  const {
275
272
  story
276
- } = await this.apiClient.patch(url, {
273
+ } = await api.patch(url, {
277
274
  headers: acceptedFormatsHeader(formats),
278
275
  payload,
279
276
  query: {
@@ -286,7 +283,7 @@ class Client {
286
283
  /**
287
284
  * This operation is only allowed for V3 stories
288
285
  */
289
- async revert(id, payload, options) {
286
+ async function revert(id, payload, options) {
290
287
  const url = `${_routing.routing.storiesUrl}/${id}/revert`;
291
288
  const {
292
289
  include,
@@ -294,7 +291,7 @@ class Client {
294
291
  } = options ?? {};
295
292
  const {
296
293
  story
297
- } = await this.apiClient.post(url, {
294
+ } = await api.post(url, {
298
295
  headers: acceptedFormatsHeader(formats),
299
296
  payload,
300
297
  query: {
@@ -303,7 +300,7 @@ class Client {
303
300
  });
304
301
  return story;
305
302
  }
306
- async publish(id, payload, options) {
303
+ async function publish(id, payload, options) {
307
304
  const url = `${_routing.routing.storiesUrl}/${id}/publish`;
308
305
  const {
309
306
  include,
@@ -311,7 +308,7 @@ class Client {
311
308
  } = options ?? {};
312
309
  const {
313
310
  story
314
- } = await this.apiClient.post(url, {
311
+ } = await api.post(url, {
315
312
  headers: acceptedFormatsHeader(formats),
316
313
  payload,
317
314
  query: {
@@ -320,7 +317,7 @@ class Client {
320
317
  });
321
318
  return story;
322
319
  }
323
- async unpublish(id, payload, options) {
320
+ async function unpublish(id, payload, options) {
324
321
  const url = `${_routing.routing.storiesUrl}/${id}/unpublish`;
325
322
  const {
326
323
  include,
@@ -328,7 +325,7 @@ class Client {
328
325
  } = options ?? {};
329
326
  const {
330
327
  story
331
- } = await this.apiClient.post(url, {
328
+ } = await api.post(url, {
332
329
  headers: acceptedFormatsHeader(formats),
333
330
  payload,
334
331
  query: {
@@ -337,7 +334,7 @@ class Client {
337
334
  });
338
335
  return story;
339
336
  }
340
- async schedule(id, payload, options) {
337
+ async function schedule(id, payload, options) {
341
338
  const url = `${_routing.routing.storiesUrl}/${id}/schedule`;
342
339
  const {
343
340
  include,
@@ -345,7 +342,7 @@ class Client {
345
342
  } = options ?? {};
346
343
  const {
347
344
  story
348
- } = await this.apiClient.post(url, {
345
+ } = await api.post(url, {
349
346
  headers: acceptedFormatsHeader(formats),
350
347
  payload,
351
348
  query: {
@@ -354,7 +351,7 @@ class Client {
354
351
  });
355
352
  return story;
356
353
  }
357
- async unschedule(id, payload, options) {
354
+ async function unschedule(id, payload, options) {
358
355
  const url = `${_routing.routing.storiesUrl}/${id}/unpublish`;
359
356
  const {
360
357
  include,
@@ -362,7 +359,7 @@ class Client {
362
359
  } = options ?? {};
363
360
  const {
364
361
  story
365
- } = await this.apiClient.post(url, {
362
+ } = await api.post(url, {
366
363
  headers: acceptedFormatsHeader(formats),
367
364
  payload,
368
365
  query: {
@@ -371,7 +368,7 @@ class Client {
371
368
  });
372
369
  return story;
373
370
  }
374
- async pin(id, options) {
371
+ async function pin(id, options) {
375
372
  const url = `${_routing.routing.storiesUrl}/${id}/pin`;
376
373
  const {
377
374
  include,
@@ -380,7 +377,7 @@ class Client {
380
377
  } = options ?? {};
381
378
  const {
382
379
  story
383
- } = await this.apiClient.post(url, {
380
+ } = await api.post(url, {
384
381
  headers: acceptedFormatsHeader(formats),
385
382
  query: {
386
383
  include: include,
@@ -389,7 +386,7 @@ class Client {
389
386
  });
390
387
  return story;
391
388
  }
392
- async unpin(id, options) {
389
+ async function unpin(id, options) {
393
390
  const url = `${_routing.routing.storiesUrl}/${id}/unpin`;
394
391
  const {
395
392
  include,
@@ -397,7 +394,7 @@ class Client {
397
394
  } = options ?? {};
398
395
  const {
399
396
  story
400
- } = await this.apiClient.post(url, {
397
+ } = await api.post(url, {
401
398
  headers: acceptedFormatsHeader(formats),
402
399
  query: {
403
400
  include: include
@@ -405,15 +402,15 @@ class Client {
405
402
  });
406
403
  return story;
407
404
  }
408
- async delete(id) {
405
+ async function doDelete(id) {
409
406
  const url = `${_routing.routing.storiesUrl}/${id}`;
410
- await this.apiClient.delete(url);
407
+ await api.delete(url);
411
408
  }
412
- async preview(id, options) {
409
+ async function preview(id, options) {
413
410
  const url = `${_routing.routing.storiesUrl}/${id}/preview`;
414
411
  const {
415
412
  preview
416
- } = await this.apiClient.get(url, {
413
+ } = await api.get(url, {
417
414
  query: {
418
415
  alignment: options?.alignment,
419
416
  appearance: options?.appearance,
@@ -422,8 +419,28 @@ class Client {
422
419
  });
423
420
  return preview;
424
421
  }
422
+ return {
423
+ list,
424
+ search,
425
+ get,
426
+ getBySlug,
427
+ create,
428
+ duplicate,
429
+ translate,
430
+ move,
431
+ update,
432
+ autosave,
433
+ revert,
434
+ publish,
435
+ unpublish,
436
+ schedule,
437
+ unschedule,
438
+ pin,
439
+ unpin,
440
+ delete: doDelete,
441
+ preview
442
+ };
425
443
  }
426
- exports.Client = Client;
427
444
  function acceptedFormatsHeader(formats = []) {
428
445
  if (formats.length === 0) {
429
446
  return {};
@@ -12,132 +12,113 @@ type Formats = Story.FormatVersion[];
12
12
  */
13
13
  type Exactly<Concrete, Abstract> = Concrete & Record<Exclude<keyof Concrete, keyof Abstract>, never>;
14
14
  type InferExtraFields<T> = T extends Required<IncludeOptions<infer I>> ? Pick<Story.ExtraFields, I> : unknown;
15
- export declare class Client {
16
- private readonly apiClient;
17
- constructor(apiClient: DeferredJobsApiClient);
18
- list<Options extends ListOptions>(options?: Exactly<Options, ListOptions>): Promise<ListResponse<Story & InferExtraFields<Options>>>;
19
- search<Options extends SearchOptions>(options?: Exactly<Options, SearchOptions>): Promise<ListResponse<Story & InferExtraFields<Options>>>;
20
- /**
21
- * Get story by UUID.
22
- */
23
- get<Options extends IncludeOptions & {
24
- formats?: Formats;
25
- }>(id: Story['uuid'], options?: Exactly<Options, IncludeOptions & {
26
- formats?: Formats;
27
- }>): Promise<ExtendedStory & InferExtraFields<Options>>;
28
- /**
29
- * Get multiple stories by UUIDs.
30
- */
31
- get<Options extends IncludeOptions & {
32
- formats?: Formats;
33
- }>(ids: Story['uuid'][], options?: Exactly<Options, IncludeOptions & {
34
- formats?: Formats;
35
- }>): Promise<(ExtendedStory & InferExtraFields<Options>)[]>;
36
- /**
37
- * Get story by deprecated numeric ID, or UUID.
38
- * @deprecated Please use UUID instead.
39
- */
40
- get<Options extends IncludeOptions & {
41
- formats?: Formats;
42
- }>(id: Story['id'] | Story['uuid'], options?: Exactly<Options, IncludeOptions & {
43
- formats?: Formats;
44
- }>): Promise<ExtendedStory & InferExtraFields<Options>>;
45
- /**
46
- * Get multiple stories by numeric IDs.
47
- * @deprecated Please use UUID instead.
48
- */
49
- get<Options extends IncludeOptions & {
50
- formats?: Formats;
51
- }>(ids: Story['id'][], options?: Exactly<Options, IncludeOptions & {
52
- formats?: Formats;
53
- }>): Promise<(ExtendedStory & InferExtraFields<Options>)[]>;
54
- getBySlug<Options extends IncludeOptions & {
55
- formats?: Formats;
56
- query?: Query;
57
- }>(slug: Story['slug'], options?: Exactly<Options, IncludeOptions & {
58
- formats?: Formats;
59
- query?: Query;
60
- }>): Promise<ExtendedStory & InferExtraFields<Options>>;
61
- create<Options extends IncludeOptions & {
62
- formats?: Formats;
63
- force?: boolean;
64
- }>(payload: CreateRequest, options?: Exactly<Options, IncludeOptions & {
65
- formats?: Formats;
66
- force?: boolean;
67
- }>): Promise<ExtendedStory & InferExtraFields<Options>>;
68
- duplicate<Options extends IncludeOptions & {
69
- formats?: Formats;
70
- }>(id: StoryId, options?: Exactly<Options, IncludeOptions & {
71
- formats?: Formats;
72
- }>): Promise<ExtendedStory & InferExtraFields<Options>>;
73
- translate<Options extends IncludeOptions & {
74
- formats?: Formats;
75
- }>(id: StoryId, payload?: TranslateRequest, options?: Exactly<Options, IncludeOptions & {
76
- formats?: Formats;
77
- }>): Promise<ExtendedStory & InferExtraFields<Options>>;
78
- move<Options extends IncludeOptions & {
79
- formats?: Formats;
80
- force?: boolean;
81
- }>(id: StoryId, payload: MoveRequest, options?: Exactly<Options, IncludeOptions & {
82
- formats?: Formats;
83
- force?: boolean;
84
- }>): Promise<ChangeNewsroomSuccessResponse<ExtendedStory & InferExtraFields<Options>> | ChangeNewsroomUnsafeResponse>;
85
- update<Options extends IncludeOptions & {
86
- formats?: Formats;
87
- force?: boolean;
88
- }>(id: StoryId, payload: UpdateRequest, options?: Exactly<Options, IncludeOptions & {
89
- formats?: Formats;
90
- force?: boolean;
91
- }>): Promise<ExtendedStory & InferExtraFields<Options>>;
92
- /**
93
- * This operation is only allowed for V3 stories
94
- */
95
- autosave<Options extends IncludeOptions & {
96
- formats?: Formats;
97
- }>(id: StoryId, payload: AutosaveRequest, options?: Exactly<Options, IncludeOptions & {
98
- formats?: Formats;
99
- }>): Promise<ExtendedStory & InferExtraFields<Options>>;
100
- /**
101
- * This operation is only allowed for V3 stories
102
- */
103
- revert<Options extends IncludeOptions & {
104
- formats?: Formats;
105
- }>(id: StoryId, payload?: RevertRequest, options?: Exactly<Options, IncludeOptions & {
106
- formats?: Formats;
107
- }>): Promise<ExtendedStory & InferExtraFields<Options>>;
108
- publish<Options extends IncludeOptions & {
109
- formats?: Formats;
110
- }>(id: StoryId, payload?: PublishRequest, options?: Exactly<Options, IncludeOptions & {
111
- formats?: Formats;
112
- }>): Promise<ExtendedStory & InferExtraFields<Options>>;
113
- unpublish<Options extends IncludeOptions & {
114
- formats?: Formats;
115
- }>(id: StoryId, payload?: UnpublishRequest, options?: Exactly<Options, IncludeOptions & {
116
- formats?: Formats;
117
- }>): Promise<ExtendedStory & InferExtraFields<Options>>;
118
- schedule<Options extends IncludeOptions & {
119
- formats?: Formats;
120
- }>(id: StoryId, payload?: ScheduleRequest, options?: Exactly<Options, IncludeOptions & {
121
- formats?: Formats;
122
- }>): Promise<ExtendedStory & InferExtraFields<Options>>;
123
- unschedule<Options extends IncludeOptions & {
124
- formats?: Formats;
125
- }>(id: StoryId, payload?: UnscheduleRequest, options?: Exactly<Options, IncludeOptions & {
126
- formats?: Formats;
127
- }>): Promise<ExtendedStory & InferExtraFields<Options>>;
128
- pin<Options extends IncludeOptions & {
129
- formats?: Formats;
130
- force?: boolean;
131
- }>(id: StoryId, options?: Exactly<Options, IncludeOptions & {
132
- formats?: Formats;
133
- force?: boolean;
134
- }>): Promise<ExtendedStory & InferExtraFields<Options>>;
135
- unpin<Options extends IncludeOptions & {
136
- formats?: Formats;
137
- }>(id: StoryId, options?: Exactly<Options, IncludeOptions & {
138
- formats?: Formats;
139
- }>): Promise<ExtendedStory & InferExtraFields<Options>>;
140
- delete(id: StoryId): Promise<void>;
141
- preview(id: StoryId, options?: PreviewOptions): Promise<PreviewResponse>;
142
- }
15
+ export type Client = ReturnType<typeof createClient>;
16
+ export declare function createClient(api: DeferredJobsApiClient): {
17
+ list: <Options extends ListOptions<keyof Story.ExtraFields>>(options?: Exactly<Options, ListOptions<keyof Story.ExtraFields>> | undefined) => Promise<ListResponse<Story & InferExtraFields<Options>>>;
18
+ search: <Options_1 extends SearchOptions<keyof Story.ExtraFields>>(options?: Exactly<Options_1, SearchOptions<keyof Story.ExtraFields>> | undefined) => Promise<ListResponse<Story & InferExtraFields<Options_1>>>;
19
+ get: {
20
+ <Options_2 extends IncludeOptions<keyof Story.ExtraFields> & {
21
+ formats?: Formats | undefined;
22
+ }>(id: Story['uuid'], options?: Exactly<Options_2, IncludeOptions<keyof Story.ExtraFields> & {
23
+ formats?: Formats | undefined;
24
+ }> | undefined): Promise<ExtendedStory & InferExtraFields<Options_2>>;
25
+ <Options_3 extends IncludeOptions<keyof Story.ExtraFields> & {
26
+ formats?: Formats | undefined;
27
+ }>(ids: Story['uuid'][], options?: Exactly<Options_3, IncludeOptions<keyof Story.ExtraFields> & {
28
+ formats?: Formats | undefined;
29
+ }> | undefined): Promise<(ExtendedStory & InferExtraFields<Options_3>)[]>;
30
+ <Options_4 extends IncludeOptions<keyof Story.ExtraFields> & {
31
+ formats?: Formats | undefined;
32
+ }>(id: Story['id'] | Story['uuid'], options?: Exactly<Options_4, IncludeOptions<keyof Story.ExtraFields> & {
33
+ formats?: Formats | undefined;
34
+ }> | undefined): Promise<ExtendedStory & InferExtraFields<Options_4>>;
35
+ <Options_5 extends IncludeOptions<keyof Story.ExtraFields> & {
36
+ formats?: Formats | undefined;
37
+ }>(ids: Story['id'][], options?: Exactly<Options_5, IncludeOptions<keyof Story.ExtraFields> & {
38
+ formats?: Formats | undefined;
39
+ }> | undefined): Promise<(ExtendedStory & InferExtraFields<Options_5>)[]>;
40
+ };
41
+ getBySlug: <Options_6 extends IncludeOptions<keyof Story.ExtraFields> & {
42
+ formats?: Formats | undefined;
43
+ query?: Query | undefined;
44
+ }>(slug: Story['slug'], options?: Exactly<Options_6, IncludeOptions<keyof Story.ExtraFields> & {
45
+ formats?: Formats | undefined;
46
+ query?: Query | undefined;
47
+ }> | undefined) => Promise<ExtendedStory & InferExtraFields<Options_6>>;
48
+ create: <Options_7 extends IncludeOptions<keyof Story.ExtraFields> & {
49
+ formats?: Formats | undefined;
50
+ force?: boolean | undefined;
51
+ }>(payload: CreateRequest, options?: Exactly<Options_7, IncludeOptions<keyof Story.ExtraFields> & {
52
+ formats?: Formats | undefined;
53
+ force?: boolean | undefined;
54
+ }> | undefined) => Promise<ExtendedStory & InferExtraFields<Options_7>>;
55
+ duplicate: <Options_8 extends IncludeOptions<keyof Story.ExtraFields> & {
56
+ formats?: Formats | undefined;
57
+ }>(id: StoryId, options?: Exactly<Options_8, IncludeOptions<keyof Story.ExtraFields> & {
58
+ formats?: Formats | undefined;
59
+ }> | undefined) => Promise<ExtendedStory & InferExtraFields<Options_8>>;
60
+ translate: <Options_9 extends IncludeOptions<keyof Story.ExtraFields> & {
61
+ formats?: Formats | undefined;
62
+ }>(id: StoryId, payload?: TranslateRequest, options?: Exactly<Options_9, IncludeOptions<keyof Story.ExtraFields> & {
63
+ formats?: Formats | undefined;
64
+ }> | undefined) => Promise<ExtendedStory & InferExtraFields<Options_9>>;
65
+ move: <Options_10 extends IncludeOptions<keyof Story.ExtraFields> & {
66
+ formats?: Formats | undefined;
67
+ force?: boolean | undefined;
68
+ }>(id: StoryId, payload: MoveRequest, options?: Exactly<Options_10, IncludeOptions<keyof Story.ExtraFields> & {
69
+ formats?: Formats | undefined;
70
+ force?: boolean | undefined;
71
+ }> | undefined) => Promise<ChangeNewsroomUnsafeResponse | ChangeNewsroomSuccessResponse<ExtendedStory & InferExtraFields<Options_10>>>;
72
+ update: <Options_11 extends IncludeOptions<keyof Story.ExtraFields> & {
73
+ formats?: Formats | undefined;
74
+ force?: boolean | undefined;
75
+ }>(id: StoryId, payload: UpdateRequest, options?: Exactly<Options_11, IncludeOptions<keyof Story.ExtraFields> & {
76
+ formats?: Formats | undefined;
77
+ force?: boolean | undefined;
78
+ }> | undefined) => Promise<ExtendedStory & InferExtraFields<Options_11>>;
79
+ autosave: <Options_12 extends IncludeOptions<keyof Story.ExtraFields> & {
80
+ formats?: Formats | undefined;
81
+ }>(id: StoryId, payload: AutosaveRequest, options?: Exactly<Options_12, IncludeOptions<keyof Story.ExtraFields> & {
82
+ formats?: Formats | undefined;
83
+ }> | undefined) => Promise<ExtendedStory & InferExtraFields<Options_12>>;
84
+ revert: <Options_13 extends IncludeOptions<keyof Story.ExtraFields> & {
85
+ formats?: Formats | undefined;
86
+ }>(id: StoryId, payload?: RevertRequest, options?: Exactly<Options_13, IncludeOptions<keyof Story.ExtraFields> & {
87
+ formats?: Formats | undefined;
88
+ }> | undefined) => Promise<ExtendedStory & InferExtraFields<Options_13>>;
89
+ publish: <Options_14 extends IncludeOptions<keyof Story.ExtraFields> & {
90
+ formats?: Formats | undefined;
91
+ }>(id: StoryId, payload?: PublishRequest, options?: Exactly<Options_14, IncludeOptions<keyof Story.ExtraFields> & {
92
+ formats?: Formats | undefined;
93
+ }> | undefined) => Promise<ExtendedStory & InferExtraFields<Options_14>>;
94
+ unpublish: <Options_15 extends IncludeOptions<keyof Story.ExtraFields> & {
95
+ formats?: Formats | undefined;
96
+ }>(id: StoryId, payload?: UnpublishRequest, options?: Exactly<Options_15, IncludeOptions<keyof Story.ExtraFields> & {
97
+ formats?: Formats | undefined;
98
+ }> | undefined) => Promise<ExtendedStory & InferExtraFields<Options_15>>;
99
+ schedule: <Options_16 extends IncludeOptions<keyof Story.ExtraFields> & {
100
+ formats?: Formats | undefined;
101
+ }>(id: StoryId, payload?: ScheduleRequest, options?: Exactly<Options_16, IncludeOptions<keyof Story.ExtraFields> & {
102
+ formats?: Formats | undefined;
103
+ }> | undefined) => Promise<ExtendedStory & InferExtraFields<Options_16>>;
104
+ unschedule: <Options_17 extends IncludeOptions<keyof Story.ExtraFields> & {
105
+ formats?: Formats | undefined;
106
+ }>(id: StoryId, payload?: UnscheduleRequest, options?: Exactly<Options_17, IncludeOptions<keyof Story.ExtraFields> & {
107
+ formats?: Formats | undefined;
108
+ }> | undefined) => Promise<ExtendedStory & InferExtraFields<Options_17>>;
109
+ pin: <Options_18 extends IncludeOptions<keyof Story.ExtraFields> & {
110
+ formats?: Formats | undefined;
111
+ force?: boolean | undefined;
112
+ }>(id: StoryId, options?: Exactly<Options_18, IncludeOptions<keyof Story.ExtraFields> & {
113
+ formats?: Formats | undefined;
114
+ force?: boolean | undefined;
115
+ }> | undefined) => Promise<ExtendedStory & InferExtraFields<Options_18>>;
116
+ unpin: <Options_19 extends IncludeOptions<keyof Story.ExtraFields> & {
117
+ formats?: Formats | undefined;
118
+ }>(id: StoryId, options?: Exactly<Options_19, IncludeOptions<keyof Story.ExtraFields> & {
119
+ formats?: Formats | undefined;
120
+ }> | undefined) => Promise<ExtendedStory & InferExtraFields<Options_19>>;
121
+ delete: (id: StoryId) => Promise<void>;
122
+ preview: (id: StoryId, options?: PreviewOptions) => Promise<PreviewResponse>;
123
+ };
143
124
  export {};