@datocms/cma-client 5.1.9 → 5.1.10
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/cjs/generated/Client.js +1 -1
- package/dist/cjs/generated/Client.js.map +1 -1
- package/dist/cjs/generated/resources/Item.js.map +1 -1
- package/dist/cjs/generated/resources/Upload.js.map +1 -1
- package/dist/cjs/utilities/buildBlockRecord.js.map +1 -1
- package/dist/esm/fieldTypes/single_block.d.ts +2 -2
- package/dist/esm/generated/Client.js +1 -1
- package/dist/esm/generated/Client.js.map +1 -1
- package/dist/esm/generated/resources/Item.d.ts +46 -28
- package/dist/esm/generated/resources/Item.js.map +1 -1
- package/dist/esm/generated/resources/ScheduledPublication.d.ts +3 -3
- package/dist/esm/generated/resources/ScheduledUnpublishing.d.ts +3 -3
- package/dist/esm/generated/resources/Upload.d.ts +10 -4
- package/dist/esm/generated/resources/Upload.js.map +1 -1
- package/dist/esm/utilities/buildBlockRecord.d.ts +3 -3
- package/dist/esm/utilities/buildBlockRecord.js.map +1 -1
- package/dist/esm/utilities/itemDefinition.d.ts +9 -9
- package/dist/types/fieldTypes/single_block.d.ts +2 -2
- package/dist/types/generated/resources/Item.d.ts +46 -28
- package/dist/types/generated/resources/ScheduledPublication.d.ts +3 -3
- package/dist/types/generated/resources/ScheduledUnpublishing.d.ts +3 -3
- package/dist/types/generated/resources/Upload.d.ts +10 -4
- package/dist/types/utilities/buildBlockRecord.d.ts +3 -3
- package/dist/types/utilities/itemDefinition.d.ts +9 -9
- package/package.json +3 -3
- package/src/fieldTypes/single_block.ts +2 -2
- package/src/generated/Client.ts +1 -1
- package/src/generated/resources/Item.ts +129 -92
- package/src/generated/resources/ScheduledPublication.ts +6 -6
- package/src/generated/resources/ScheduledUnpublishing.ts +6 -6
- package/src/generated/resources/Upload.ts +36 -10
- package/src/utilities/buildBlockRecord.ts +8 -16
- package/src/utilities/itemDefinition.ts +23 -32
|
@@ -2,9 +2,9 @@ import * as Utils from '@datocms/rest-client-utils';
|
|
|
2
2
|
import BaseResource from '../../BaseResource';
|
|
3
3
|
import type {
|
|
4
4
|
ItemTypeDefinition,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
ToItemDefinition,
|
|
6
|
+
ToItemDefinitionAsRequest,
|
|
7
|
+
ToItemDefinitionWithNestedBlocks,
|
|
8
8
|
} from '../../utilities/itemDefinition';
|
|
9
9
|
import type * as ApiTypes from '../ApiTypes';
|
|
10
10
|
import type * as RawApiTypes from '../RawApiTypes';
|
|
@@ -26,18 +26,14 @@ export default class Item extends BaseResource {
|
|
|
26
26
|
queryParams: ApiTypes.ItemInstancesHrefSchema & { nested: true },
|
|
27
27
|
): Promise<
|
|
28
28
|
ApiTypes.ItemInstancesTargetSchema<
|
|
29
|
-
|
|
29
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
30
30
|
>
|
|
31
31
|
>;
|
|
32
32
|
list<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
33
33
|
queryParams?: ApiTypes.ItemInstancesHrefSchema & {
|
|
34
34
|
nested?: false | undefined;
|
|
35
35
|
},
|
|
36
|
-
): Promise<
|
|
37
|
-
ApiTypes.ItemInstancesTargetSchema<
|
|
38
|
-
ItemTypeDefinitionToItemDefinition<NoInfer<D>>
|
|
39
|
-
>
|
|
40
|
-
>;
|
|
36
|
+
): Promise<ApiTypes.ItemInstancesTargetSchema<ToItemDefinition<NoInfer<D>>>>;
|
|
41
37
|
/**
|
|
42
38
|
* List all records
|
|
43
39
|
*
|
|
@@ -62,13 +58,38 @@ export default class Item extends BaseResource {
|
|
|
62
58
|
* @throws {ApiError}
|
|
63
59
|
* @throws {TimeoutError}
|
|
64
60
|
*/
|
|
61
|
+
rawList<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
62
|
+
queryParams: RawApiTypes.ItemInstancesHrefSchema & { nested: true },
|
|
63
|
+
): Promise<
|
|
64
|
+
RawApiTypes.ItemInstancesTargetSchema<
|
|
65
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
66
|
+
>
|
|
67
|
+
>;
|
|
68
|
+
rawList<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
69
|
+
queryParams?: RawApiTypes.ItemInstancesHrefSchema & {
|
|
70
|
+
nested?: false | undefined;
|
|
71
|
+
},
|
|
72
|
+
): Promise<
|
|
73
|
+
RawApiTypes.ItemInstancesTargetSchema<ToItemDefinition<NoInfer<D>>>
|
|
74
|
+
>;
|
|
65
75
|
rawList<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
66
76
|
queryParams?: RawApiTypes.ItemInstancesHrefSchema,
|
|
67
77
|
): Promise<
|
|
68
78
|
RawApiTypes.ItemInstancesTargetSchema<
|
|
69
|
-
|
|
79
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
70
80
|
>
|
|
71
|
-
|
|
81
|
+
>;
|
|
82
|
+
/**
|
|
83
|
+
* List all records
|
|
84
|
+
*
|
|
85
|
+
* Read more: https://www.datocms.com/docs/content-management-api/resources/item/instances
|
|
86
|
+
*
|
|
87
|
+
* @throws {ApiError}
|
|
88
|
+
* @throws {TimeoutError}
|
|
89
|
+
*/
|
|
90
|
+
rawList<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
91
|
+
queryParams?: RawApiTypes.ItemInstancesHrefSchema,
|
|
92
|
+
) {
|
|
72
93
|
return this.client
|
|
73
94
|
.request({
|
|
74
95
|
method: 'GET',
|
|
@@ -77,7 +98,7 @@ export default class Item extends BaseResource {
|
|
|
77
98
|
})
|
|
78
99
|
.then<
|
|
79
100
|
RawApiTypes.ItemInstancesTargetSchema<
|
|
80
|
-
|
|
101
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
81
102
|
>
|
|
82
103
|
>(Utils.deserializeRawResponseBodyWithItems);
|
|
83
104
|
}
|
|
@@ -103,7 +124,7 @@ export default class Item extends BaseResource {
|
|
|
103
124
|
)) {
|
|
104
125
|
yield Utils.deserializeJsonEntity<
|
|
105
126
|
ApiTypes.ItemInstancesTargetSchema<
|
|
106
|
-
|
|
127
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
107
128
|
>[0]
|
|
108
129
|
>(element);
|
|
109
130
|
}
|
|
@@ -128,7 +149,7 @@ export default class Item extends BaseResource {
|
|
|
128
149
|
|
|
129
150
|
return Utils.rawPageIterator<
|
|
130
151
|
RawApiTypes.ItemInstancesTargetSchema<
|
|
131
|
-
|
|
152
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
132
153
|
>['data'][0]
|
|
133
154
|
>(
|
|
134
155
|
{
|
|
@@ -155,14 +176,14 @@ export default class Item extends BaseResource {
|
|
|
155
176
|
validateExisting<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
156
177
|
itemId: string | ApiTypes.ItemData,
|
|
157
178
|
body: ApiTypes.ItemValidateExistingSchema<
|
|
158
|
-
|
|
179
|
+
ToItemDefinitionAsRequest<NoInfer<D>>
|
|
159
180
|
>,
|
|
160
181
|
) {
|
|
161
182
|
return this.rawValidateExisting(
|
|
162
183
|
Utils.toId(itemId),
|
|
163
184
|
Utils.serializeRequestBody<
|
|
164
185
|
RawApiTypes.ItemValidateExistingSchema<
|
|
165
|
-
|
|
186
|
+
ToItemDefinitionAsRequest<NoInfer<D>>
|
|
166
187
|
>
|
|
167
188
|
>(body, {
|
|
168
189
|
id: Utils.toId(itemId),
|
|
@@ -186,7 +207,7 @@ export default class Item extends BaseResource {
|
|
|
186
207
|
rawValidateExisting<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
187
208
|
itemId: string,
|
|
188
209
|
body: RawApiTypes.ItemValidateExistingSchema<
|
|
189
|
-
|
|
210
|
+
ToItemDefinitionAsRequest<NoInfer<D>>
|
|
190
211
|
>,
|
|
191
212
|
): Promise<void> {
|
|
192
213
|
return this.client.request<void>({
|
|
@@ -207,15 +228,11 @@ export default class Item extends BaseResource {
|
|
|
207
228
|
* @deprecated This API call is to be considered private and might change without notice
|
|
208
229
|
*/
|
|
209
230
|
validateNew<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
210
|
-
body: ApiTypes.ItemValidateNewSchema<
|
|
211
|
-
ItemTypeDefinitionToItemDefinitionAsRequest<NoInfer<D>>
|
|
212
|
-
>,
|
|
231
|
+
body: ApiTypes.ItemValidateNewSchema<ToItemDefinitionAsRequest<NoInfer<D>>>,
|
|
213
232
|
) {
|
|
214
233
|
return this.rawValidateNew(
|
|
215
234
|
Utils.serializeRequestBody<
|
|
216
|
-
RawApiTypes.ItemValidateNewSchema<
|
|
217
|
-
ItemTypeDefinitionToItemDefinitionAsRequest<NoInfer<D>>
|
|
218
|
-
>
|
|
235
|
+
RawApiTypes.ItemValidateNewSchema<ToItemDefinitionAsRequest<NoInfer<D>>>
|
|
219
236
|
>(body, {
|
|
220
237
|
type: 'item',
|
|
221
238
|
attributes: '*',
|
|
@@ -236,7 +253,7 @@ export default class Item extends BaseResource {
|
|
|
236
253
|
*/
|
|
237
254
|
rawValidateNew<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
238
255
|
body: RawApiTypes.ItemValidateNewSchema<
|
|
239
|
-
|
|
256
|
+
ToItemDefinitionAsRequest<NoInfer<D>>
|
|
240
257
|
>,
|
|
241
258
|
): Promise<void> {
|
|
242
259
|
return this.client.request<void>({
|
|
@@ -255,15 +272,11 @@ export default class Item extends BaseResource {
|
|
|
255
272
|
* @throws {TimeoutError}
|
|
256
273
|
*/
|
|
257
274
|
create<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
258
|
-
body: ApiTypes.ItemCreateSchema<
|
|
259
|
-
ItemTypeDefinitionToItemDefinitionAsRequest<NoInfer<D>>
|
|
260
|
-
>,
|
|
275
|
+
body: ApiTypes.ItemCreateSchema<ToItemDefinitionAsRequest<NoInfer<D>>>,
|
|
261
276
|
) {
|
|
262
277
|
return this.rawCreate<D>(
|
|
263
278
|
Utils.serializeRequestBody<
|
|
264
|
-
RawApiTypes.ItemCreateSchema<
|
|
265
|
-
ItemTypeDefinitionToItemDefinitionAsRequest<NoInfer<D>>
|
|
266
|
-
>
|
|
279
|
+
RawApiTypes.ItemCreateSchema<ToItemDefinitionAsRequest<NoInfer<D>>>
|
|
267
280
|
>(body, {
|
|
268
281
|
type: 'item',
|
|
269
282
|
attributes: '*',
|
|
@@ -271,9 +284,7 @@ export default class Item extends BaseResource {
|
|
|
271
284
|
}),
|
|
272
285
|
).then((body) =>
|
|
273
286
|
Utils.deserializeResponseBody<
|
|
274
|
-
ApiTypes.ItemCreateTargetSchema<
|
|
275
|
-
ItemTypeDefinitionToItemDefinition<NoInfer<D>>
|
|
276
|
-
>
|
|
287
|
+
ApiTypes.ItemCreateTargetSchema<ToItemDefinition<NoInfer<D>>>
|
|
277
288
|
>(body),
|
|
278
289
|
);
|
|
279
290
|
}
|
|
@@ -287,12 +298,10 @@ export default class Item extends BaseResource {
|
|
|
287
298
|
* @throws {TimeoutError}
|
|
288
299
|
*/
|
|
289
300
|
rawCreate<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
290
|
-
body: RawApiTypes.ItemCreateSchema<
|
|
291
|
-
ItemTypeDefinitionToItemDefinitionAsRequest<NoInfer<D>>
|
|
292
|
-
>,
|
|
301
|
+
body: RawApiTypes.ItemCreateSchema<ToItemDefinitionAsRequest<NoInfer<D>>>,
|
|
293
302
|
): Promise<
|
|
294
303
|
RawApiTypes.ItemCreateTargetSchema<
|
|
295
|
-
|
|
304
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
296
305
|
>
|
|
297
306
|
> {
|
|
298
307
|
return this.client
|
|
@@ -303,7 +312,7 @@ export default class Item extends BaseResource {
|
|
|
303
312
|
})
|
|
304
313
|
.then<
|
|
305
314
|
RawApiTypes.ItemCreateTargetSchema<
|
|
306
|
-
|
|
315
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
307
316
|
>
|
|
308
317
|
>(Utils.deserializeRawResponseBodyWithItems);
|
|
309
318
|
}
|
|
@@ -321,9 +330,7 @@ export default class Item extends BaseResource {
|
|
|
321
330
|
) {
|
|
322
331
|
return this.rawDuplicate<D>(Utils.toId(itemId)).then((body) =>
|
|
323
332
|
Utils.deserializeResponseBody<
|
|
324
|
-
ApiTypes.ItemDuplicateJobSchema<
|
|
325
|
-
ItemTypeDefinitionToItemDefinition<NoInfer<D>>
|
|
326
|
-
>
|
|
333
|
+
ApiTypes.ItemDuplicateJobSchema<ToItemDefinition<NoInfer<D>>>
|
|
327
334
|
>(body),
|
|
328
335
|
);
|
|
329
336
|
}
|
|
@@ -340,7 +347,7 @@ export default class Item extends BaseResource {
|
|
|
340
347
|
itemId: string,
|
|
341
348
|
): Promise<
|
|
342
349
|
RawApiTypes.ItemDuplicateJobSchema<
|
|
343
|
-
|
|
350
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
344
351
|
>
|
|
345
352
|
> {
|
|
346
353
|
return this.client
|
|
@@ -350,7 +357,7 @@ export default class Item extends BaseResource {
|
|
|
350
357
|
})
|
|
351
358
|
.then<
|
|
352
359
|
RawApiTypes.ItemDuplicateJobSchema<
|
|
353
|
-
|
|
360
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
354
361
|
>
|
|
355
362
|
>(Utils.deserializeRawResponseBodyWithItems);
|
|
356
363
|
}
|
|
@@ -365,16 +372,12 @@ export default class Item extends BaseResource {
|
|
|
365
372
|
*/
|
|
366
373
|
update<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
367
374
|
itemId: string | ApiTypes.ItemData,
|
|
368
|
-
body: ApiTypes.ItemUpdateSchema<
|
|
369
|
-
ItemTypeDefinitionToItemDefinitionAsRequest<NoInfer<D>>
|
|
370
|
-
>,
|
|
375
|
+
body: ApiTypes.ItemUpdateSchema<ToItemDefinitionAsRequest<NoInfer<D>>>,
|
|
371
376
|
) {
|
|
372
377
|
return this.rawUpdate<D>(
|
|
373
378
|
Utils.toId(itemId),
|
|
374
379
|
Utils.serializeRequestBody<
|
|
375
|
-
RawApiTypes.ItemUpdateSchema<
|
|
376
|
-
ItemTypeDefinitionToItemDefinitionAsRequest<NoInfer<D>>
|
|
377
|
-
>
|
|
380
|
+
RawApiTypes.ItemUpdateSchema<ToItemDefinitionAsRequest<NoInfer<D>>>
|
|
378
381
|
>(body, {
|
|
379
382
|
id: Utils.toId(itemId),
|
|
380
383
|
type: 'item',
|
|
@@ -383,9 +386,7 @@ export default class Item extends BaseResource {
|
|
|
383
386
|
}),
|
|
384
387
|
).then((body) =>
|
|
385
388
|
Utils.deserializeResponseBody<
|
|
386
|
-
ApiTypes.ItemUpdateTargetSchema<
|
|
387
|
-
ItemTypeDefinitionToItemDefinition<NoInfer<D>>
|
|
388
|
-
>
|
|
389
|
+
ApiTypes.ItemUpdateTargetSchema<ToItemDefinition<NoInfer<D>>>
|
|
389
390
|
>(body),
|
|
390
391
|
);
|
|
391
392
|
}
|
|
@@ -400,12 +401,10 @@ export default class Item extends BaseResource {
|
|
|
400
401
|
*/
|
|
401
402
|
rawUpdate<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
402
403
|
itemId: string,
|
|
403
|
-
body: RawApiTypes.ItemUpdateSchema<
|
|
404
|
-
ItemTypeDefinitionToItemDefinitionAsRequest<NoInfer<D>>
|
|
405
|
-
>,
|
|
404
|
+
body: RawApiTypes.ItemUpdateSchema<ToItemDefinitionAsRequest<NoInfer<D>>>,
|
|
406
405
|
): Promise<
|
|
407
406
|
RawApiTypes.ItemUpdateTargetSchema<
|
|
408
|
-
|
|
407
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
409
408
|
>
|
|
410
409
|
> {
|
|
411
410
|
return this.client
|
|
@@ -416,7 +415,7 @@ export default class Item extends BaseResource {
|
|
|
416
415
|
})
|
|
417
416
|
.then<
|
|
418
417
|
RawApiTypes.ItemUpdateTargetSchema<
|
|
419
|
-
|
|
418
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
420
419
|
>
|
|
421
420
|
>(Utils.deserializeRawResponseBodyWithItems);
|
|
422
421
|
}
|
|
@@ -434,7 +433,7 @@ export default class Item extends BaseResource {
|
|
|
434
433
|
queryParams: ApiTypes.ItemReferencesHrefSchema & { nested: true },
|
|
435
434
|
): Promise<
|
|
436
435
|
ApiTypes.ItemReferencesTargetSchema<
|
|
437
|
-
|
|
436
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
438
437
|
>
|
|
439
438
|
>;
|
|
440
439
|
references<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
@@ -442,11 +441,7 @@ export default class Item extends BaseResource {
|
|
|
442
441
|
queryParams?: ApiTypes.ItemReferencesHrefSchema & {
|
|
443
442
|
nested?: false | undefined;
|
|
444
443
|
},
|
|
445
|
-
): Promise<
|
|
446
|
-
ApiTypes.ItemReferencesTargetSchema<
|
|
447
|
-
ItemTypeDefinitionToItemDefinition<NoInfer<D>>
|
|
448
|
-
>
|
|
449
|
-
>;
|
|
444
|
+
): Promise<ApiTypes.ItemReferencesTargetSchema<ToItemDefinition<NoInfer<D>>>>;
|
|
450
445
|
/**
|
|
451
446
|
* Referenced records
|
|
452
447
|
*
|
|
@@ -472,14 +467,42 @@ export default class Item extends BaseResource {
|
|
|
472
467
|
* @throws {ApiError}
|
|
473
468
|
* @throws {TimeoutError}
|
|
474
469
|
*/
|
|
470
|
+
rawReferences<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
471
|
+
itemId: string,
|
|
472
|
+
queryParams: RawApiTypes.ItemReferencesHrefSchema & { nested: true },
|
|
473
|
+
): Promise<
|
|
474
|
+
RawApiTypes.ItemReferencesTargetSchema<
|
|
475
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
476
|
+
>
|
|
477
|
+
>;
|
|
478
|
+
rawReferences<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
479
|
+
itemId: string,
|
|
480
|
+
queryParams?: RawApiTypes.ItemReferencesHrefSchema & {
|
|
481
|
+
nested?: false | undefined;
|
|
482
|
+
},
|
|
483
|
+
): Promise<
|
|
484
|
+
RawApiTypes.ItemReferencesTargetSchema<ToItemDefinition<NoInfer<D>>>
|
|
485
|
+
>;
|
|
475
486
|
rawReferences<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
476
487
|
itemId: string,
|
|
477
488
|
queryParams?: RawApiTypes.ItemReferencesHrefSchema,
|
|
478
489
|
): Promise<
|
|
479
490
|
RawApiTypes.ItemReferencesTargetSchema<
|
|
480
|
-
|
|
491
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
481
492
|
>
|
|
482
|
-
|
|
493
|
+
>;
|
|
494
|
+
/**
|
|
495
|
+
* Referenced records
|
|
496
|
+
*
|
|
497
|
+
* Read more: https://www.datocms.com/docs/content-management-api/resources/item/references
|
|
498
|
+
*
|
|
499
|
+
* @throws {ApiError}
|
|
500
|
+
* @throws {TimeoutError}
|
|
501
|
+
*/
|
|
502
|
+
rawReferences<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
503
|
+
itemId: string,
|
|
504
|
+
queryParams?: RawApiTypes.ItemReferencesHrefSchema,
|
|
505
|
+
) {
|
|
483
506
|
return this.client
|
|
484
507
|
.request({
|
|
485
508
|
method: 'GET',
|
|
@@ -488,7 +511,7 @@ export default class Item extends BaseResource {
|
|
|
488
511
|
})
|
|
489
512
|
.then<
|
|
490
513
|
RawApiTypes.ItemReferencesTargetSchema<
|
|
491
|
-
|
|
514
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
492
515
|
>
|
|
493
516
|
>(Utils.deserializeRawResponseBodyWithItems);
|
|
494
517
|
}
|
|
@@ -505,18 +528,12 @@ export default class Item extends BaseResource {
|
|
|
505
528
|
itemId: string | ApiTypes.ItemData,
|
|
506
529
|
queryParams: ApiTypes.ItemSelfHrefSchema & { nested: true },
|
|
507
530
|
): Promise<
|
|
508
|
-
ApiTypes.ItemSelfTargetSchema<
|
|
509
|
-
ItemTypeDefinitionToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
510
|
-
>
|
|
531
|
+
ApiTypes.ItemSelfTargetSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>
|
|
511
532
|
>;
|
|
512
533
|
find<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
513
534
|
itemId: string | ApiTypes.ItemData,
|
|
514
535
|
queryParams?: ApiTypes.ItemSelfHrefSchema & { nested?: false | undefined },
|
|
515
|
-
): Promise<
|
|
516
|
-
ApiTypes.ItemSelfTargetSchema<
|
|
517
|
-
ItemTypeDefinitionToItemDefinition<NoInfer<D>>
|
|
518
|
-
>
|
|
519
|
-
>;
|
|
536
|
+
): Promise<ApiTypes.ItemSelfTargetSchema<ToItemDefinition<NoInfer<D>>>>;
|
|
520
537
|
/**
|
|
521
538
|
* Retrieve a record
|
|
522
539
|
*
|
|
@@ -542,14 +559,40 @@ export default class Item extends BaseResource {
|
|
|
542
559
|
* @throws {ApiError}
|
|
543
560
|
* @throws {TimeoutError}
|
|
544
561
|
*/
|
|
562
|
+
rawFind<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
563
|
+
itemId: string,
|
|
564
|
+
queryParams: RawApiTypes.ItemSelfHrefSchema & { nested: true },
|
|
565
|
+
): Promise<
|
|
566
|
+
RawApiTypes.ItemSelfTargetSchema<
|
|
567
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
568
|
+
>
|
|
569
|
+
>;
|
|
570
|
+
rawFind<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
571
|
+
itemId: string,
|
|
572
|
+
queryParams?: RawApiTypes.ItemSelfHrefSchema & {
|
|
573
|
+
nested?: false | undefined;
|
|
574
|
+
},
|
|
575
|
+
): Promise<RawApiTypes.ItemSelfTargetSchema<ToItemDefinition<NoInfer<D>>>>;
|
|
545
576
|
rawFind<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
546
577
|
itemId: string,
|
|
547
578
|
queryParams?: RawApiTypes.ItemSelfHrefSchema,
|
|
548
579
|
): Promise<
|
|
549
580
|
RawApiTypes.ItemSelfTargetSchema<
|
|
550
|
-
|
|
581
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
551
582
|
>
|
|
552
|
-
|
|
583
|
+
>;
|
|
584
|
+
/**
|
|
585
|
+
* Retrieve a record
|
|
586
|
+
*
|
|
587
|
+
* Read more: https://www.datocms.com/docs/content-management-api/resources/item/self
|
|
588
|
+
*
|
|
589
|
+
* @throws {ApiError}
|
|
590
|
+
* @throws {TimeoutError}
|
|
591
|
+
*/
|
|
592
|
+
rawFind<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
593
|
+
itemId: string,
|
|
594
|
+
queryParams?: RawApiTypes.ItemSelfHrefSchema,
|
|
595
|
+
) {
|
|
553
596
|
return this.client
|
|
554
597
|
.request({
|
|
555
598
|
method: 'GET',
|
|
@@ -558,7 +601,7 @@ export default class Item extends BaseResource {
|
|
|
558
601
|
})
|
|
559
602
|
.then<
|
|
560
603
|
RawApiTypes.ItemSelfTargetSchema<
|
|
561
|
-
|
|
604
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
562
605
|
>
|
|
563
606
|
>(Utils.deserializeRawResponseBodyWithItems);
|
|
564
607
|
}
|
|
@@ -615,9 +658,7 @@ export default class Item extends BaseResource {
|
|
|
615
658
|
) {
|
|
616
659
|
return this.rawDestroy<D>(Utils.toId(itemId)).then((body) =>
|
|
617
660
|
Utils.deserializeResponseBody<
|
|
618
|
-
ApiTypes.ItemDestroyJobSchema<
|
|
619
|
-
ItemTypeDefinitionToItemDefinition<NoInfer<D>>
|
|
620
|
-
>
|
|
661
|
+
ApiTypes.ItemDestroyJobSchema<ToItemDefinition<NoInfer<D>>>
|
|
621
662
|
>(body),
|
|
622
663
|
);
|
|
623
664
|
}
|
|
@@ -634,7 +675,7 @@ export default class Item extends BaseResource {
|
|
|
634
675
|
itemId: string,
|
|
635
676
|
): Promise<
|
|
636
677
|
RawApiTypes.ItemDestroyJobSchema<
|
|
637
|
-
|
|
678
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
638
679
|
>
|
|
639
680
|
> {
|
|
640
681
|
return this.client
|
|
@@ -644,7 +685,7 @@ export default class Item extends BaseResource {
|
|
|
644
685
|
})
|
|
645
686
|
.then<
|
|
646
687
|
RawApiTypes.ItemDestroyJobSchema<
|
|
647
|
-
|
|
688
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
648
689
|
>
|
|
649
690
|
>(Utils.deserializeRawResponseBodyWithItems);
|
|
650
691
|
}
|
|
@@ -674,9 +715,7 @@ export default class Item extends BaseResource {
|
|
|
674
715
|
queryParams,
|
|
675
716
|
).then((body) =>
|
|
676
717
|
Utils.deserializeResponseBody<
|
|
677
|
-
ApiTypes.ItemPublishTargetSchema<
|
|
678
|
-
ItemTypeDefinitionToItemDefinition<NoInfer<D>>
|
|
679
|
-
>
|
|
718
|
+
ApiTypes.ItemPublishTargetSchema<ToItemDefinition<NoInfer<D>>>
|
|
680
719
|
>(body),
|
|
681
720
|
);
|
|
682
721
|
}
|
|
@@ -695,7 +734,7 @@ export default class Item extends BaseResource {
|
|
|
695
734
|
queryParams?: RawApiTypes.ItemPublishHrefSchema,
|
|
696
735
|
): Promise<
|
|
697
736
|
RawApiTypes.ItemPublishTargetSchema<
|
|
698
|
-
|
|
737
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
699
738
|
>
|
|
700
739
|
> {
|
|
701
740
|
return this.client
|
|
@@ -707,7 +746,7 @@ export default class Item extends BaseResource {
|
|
|
707
746
|
})
|
|
708
747
|
.then<
|
|
709
748
|
RawApiTypes.ItemPublishTargetSchema<
|
|
710
|
-
|
|
749
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
711
750
|
>
|
|
712
751
|
>(Utils.deserializeRawResponseBodyWithItems);
|
|
713
752
|
}
|
|
@@ -737,9 +776,7 @@ export default class Item extends BaseResource {
|
|
|
737
776
|
queryParams,
|
|
738
777
|
).then((body) =>
|
|
739
778
|
Utils.deserializeResponseBody<
|
|
740
|
-
ApiTypes.ItemUnpublishTargetSchema<
|
|
741
|
-
ItemTypeDefinitionToItemDefinition<NoInfer<D>>
|
|
742
|
-
>
|
|
779
|
+
ApiTypes.ItemUnpublishTargetSchema<ToItemDefinition<NoInfer<D>>>
|
|
743
780
|
>(body),
|
|
744
781
|
);
|
|
745
782
|
}
|
|
@@ -758,7 +795,7 @@ export default class Item extends BaseResource {
|
|
|
758
795
|
queryParams?: RawApiTypes.ItemUnpublishHrefSchema,
|
|
759
796
|
): Promise<
|
|
760
797
|
RawApiTypes.ItemUnpublishTargetSchema<
|
|
761
|
-
|
|
798
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
762
799
|
>
|
|
763
800
|
> {
|
|
764
801
|
return this.client
|
|
@@ -770,7 +807,7 @@ export default class Item extends BaseResource {
|
|
|
770
807
|
})
|
|
771
808
|
.then<
|
|
772
809
|
RawApiTypes.ItemUnpublishTargetSchema<
|
|
773
|
-
|
|
810
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
774
811
|
>
|
|
775
812
|
>(Utils.deserializeRawResponseBodyWithItems);
|
|
776
813
|
}
|
|
@@ -2,9 +2,9 @@ import * as Utils from '@datocms/rest-client-utils';
|
|
|
2
2
|
import BaseResource from '../../BaseResource';
|
|
3
3
|
import type {
|
|
4
4
|
ItemTypeDefinition,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
ToItemDefinition,
|
|
6
|
+
ToItemDefinitionAsRequest,
|
|
7
|
+
ToItemDefinitionWithNestedBlocks,
|
|
8
8
|
} from '../../utilities/itemDefinition';
|
|
9
9
|
import type * as ApiTypes from '../ApiTypes';
|
|
10
10
|
import type * as RawApiTypes from '../RawApiTypes';
|
|
@@ -78,7 +78,7 @@ export default class ScheduledPublication extends BaseResource {
|
|
|
78
78
|
return this.rawDestroy<D>(Utils.toId(itemId)).then((body) =>
|
|
79
79
|
Utils.deserializeResponseBody<
|
|
80
80
|
ApiTypes.ScheduledPublicationDestroyTargetSchema<
|
|
81
|
-
|
|
81
|
+
ToItemDefinition<NoInfer<D>>
|
|
82
82
|
>
|
|
83
83
|
>(body),
|
|
84
84
|
);
|
|
@@ -96,7 +96,7 @@ export default class ScheduledPublication extends BaseResource {
|
|
|
96
96
|
itemId: string,
|
|
97
97
|
): Promise<
|
|
98
98
|
RawApiTypes.ScheduledPublicationDestroyTargetSchema<
|
|
99
|
-
|
|
99
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
100
100
|
>
|
|
101
101
|
> {
|
|
102
102
|
return this.client
|
|
@@ -106,7 +106,7 @@ export default class ScheduledPublication extends BaseResource {
|
|
|
106
106
|
})
|
|
107
107
|
.then<
|
|
108
108
|
RawApiTypes.ScheduledPublicationDestroyTargetSchema<
|
|
109
|
-
|
|
109
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
110
110
|
>
|
|
111
111
|
>(Utils.deserializeRawResponseBodyWithItems);
|
|
112
112
|
}
|
|
@@ -2,9 +2,9 @@ import * as Utils from '@datocms/rest-client-utils';
|
|
|
2
2
|
import BaseResource from '../../BaseResource';
|
|
3
3
|
import type {
|
|
4
4
|
ItemTypeDefinition,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
ToItemDefinition,
|
|
6
|
+
ToItemDefinitionAsRequest,
|
|
7
|
+
ToItemDefinitionWithNestedBlocks,
|
|
8
8
|
} from '../../utilities/itemDefinition';
|
|
9
9
|
import type * as ApiTypes from '../ApiTypes';
|
|
10
10
|
import type * as RawApiTypes from '../RawApiTypes';
|
|
@@ -78,7 +78,7 @@ export default class ScheduledUnpublishing extends BaseResource {
|
|
|
78
78
|
return this.rawDestroy<D>(Utils.toId(itemId)).then((body) =>
|
|
79
79
|
Utils.deserializeResponseBody<
|
|
80
80
|
ApiTypes.ScheduledUnpublishingDestroyTargetSchema<
|
|
81
|
-
|
|
81
|
+
ToItemDefinition<NoInfer<D>>
|
|
82
82
|
>
|
|
83
83
|
>(body),
|
|
84
84
|
);
|
|
@@ -96,7 +96,7 @@ export default class ScheduledUnpublishing extends BaseResource {
|
|
|
96
96
|
itemId: string,
|
|
97
97
|
): Promise<
|
|
98
98
|
RawApiTypes.ScheduledUnpublishingDestroyTargetSchema<
|
|
99
|
-
|
|
99
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
100
100
|
>
|
|
101
101
|
> {
|
|
102
102
|
return this.client
|
|
@@ -106,7 +106,7 @@ export default class ScheduledUnpublishing extends BaseResource {
|
|
|
106
106
|
})
|
|
107
107
|
.then<
|
|
108
108
|
RawApiTypes.ScheduledUnpublishingDestroyTargetSchema<
|
|
109
|
-
|
|
109
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
110
110
|
>
|
|
111
111
|
>(Utils.deserializeRawResponseBodyWithItems);
|
|
112
112
|
}
|
|
@@ -2,9 +2,9 @@ import * as Utils from '@datocms/rest-client-utils';
|
|
|
2
2
|
import BaseResource from '../../BaseResource';
|
|
3
3
|
import type {
|
|
4
4
|
ItemTypeDefinition,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
ToItemDefinition,
|
|
6
|
+
ToItemDefinitionAsRequest,
|
|
7
|
+
ToItemDefinitionWithNestedBlocks,
|
|
8
8
|
} from '../../utilities/itemDefinition';
|
|
9
9
|
import type * as ApiTypes from '../ApiTypes';
|
|
10
10
|
import type * as RawApiTypes from '../RawApiTypes';
|
|
@@ -269,7 +269,7 @@ export default class Upload extends BaseResource {
|
|
|
269
269
|
queryParams: ApiTypes.UploadReferencesHrefSchema & { nested: true },
|
|
270
270
|
): Promise<
|
|
271
271
|
ApiTypes.UploadReferencesTargetSchema<
|
|
272
|
-
|
|
272
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
273
273
|
>
|
|
274
274
|
>;
|
|
275
275
|
references<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
@@ -278,9 +278,7 @@ export default class Upload extends BaseResource {
|
|
|
278
278
|
nested?: false | undefined;
|
|
279
279
|
},
|
|
280
280
|
): Promise<
|
|
281
|
-
ApiTypes.UploadReferencesTargetSchema<
|
|
282
|
-
ItemTypeDefinitionToItemDefinition<NoInfer<D>>
|
|
283
|
-
>
|
|
281
|
+
ApiTypes.UploadReferencesTargetSchema<ToItemDefinition<NoInfer<D>>>
|
|
284
282
|
>;
|
|
285
283
|
/**
|
|
286
284
|
* Referenced records
|
|
@@ -307,14 +305,42 @@ export default class Upload extends BaseResource {
|
|
|
307
305
|
* @throws {ApiError}
|
|
308
306
|
* @throws {TimeoutError}
|
|
309
307
|
*/
|
|
308
|
+
rawReferences<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
309
|
+
uploadId: string,
|
|
310
|
+
queryParams: RawApiTypes.UploadReferencesHrefSchema & { nested: true },
|
|
311
|
+
): Promise<
|
|
312
|
+
RawApiTypes.UploadReferencesTargetSchema<
|
|
313
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
314
|
+
>
|
|
315
|
+
>;
|
|
316
|
+
rawReferences<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
317
|
+
uploadId: string,
|
|
318
|
+
queryParams?: RawApiTypes.UploadReferencesHrefSchema & {
|
|
319
|
+
nested?: false | undefined;
|
|
320
|
+
},
|
|
321
|
+
): Promise<
|
|
322
|
+
RawApiTypes.UploadReferencesTargetSchema<ToItemDefinition<NoInfer<D>>>
|
|
323
|
+
>;
|
|
310
324
|
rawReferences<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
311
325
|
uploadId: string,
|
|
312
326
|
queryParams?: RawApiTypes.UploadReferencesHrefSchema,
|
|
313
327
|
): Promise<
|
|
314
328
|
RawApiTypes.UploadReferencesTargetSchema<
|
|
315
|
-
|
|
329
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
316
330
|
>
|
|
317
|
-
|
|
331
|
+
>;
|
|
332
|
+
/**
|
|
333
|
+
* Referenced records
|
|
334
|
+
*
|
|
335
|
+
* Read more: https://www.datocms.com/docs/content-management-api/resources/upload/references
|
|
336
|
+
*
|
|
337
|
+
* @throws {ApiError}
|
|
338
|
+
* @throws {TimeoutError}
|
|
339
|
+
*/
|
|
340
|
+
rawReferences<D extends ItemTypeDefinition = ItemTypeDefinition>(
|
|
341
|
+
uploadId: string,
|
|
342
|
+
queryParams?: RawApiTypes.UploadReferencesHrefSchema,
|
|
343
|
+
) {
|
|
318
344
|
return this.client
|
|
319
345
|
.request({
|
|
320
346
|
method: 'GET',
|
|
@@ -323,7 +349,7 @@ export default class Upload extends BaseResource {
|
|
|
323
349
|
})
|
|
324
350
|
.then<
|
|
325
351
|
RawApiTypes.UploadReferencesTargetSchema<
|
|
326
|
-
|
|
352
|
+
ToItemDefinitionWithNestedBlocks<NoInfer<D>>
|
|
327
353
|
>
|
|
328
354
|
>(Utils.deserializeRawResponseBodyWithItems);
|
|
329
355
|
}
|