@datocms/cma-client 1.0.1 → 1.1.2

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 (51) hide show
  1. package/dist/cjs/generated/resources/Item.js +3 -1
  2. package/dist/cjs/generated/resources/Item.js.map +1 -1
  3. package/dist/cjs/generated/resources/ItemVersion.js +3 -1
  4. package/dist/cjs/generated/resources/ItemVersion.js.map +1 -1
  5. package/dist/cjs/generated/resources/SearchResult.js +118 -0
  6. package/dist/cjs/generated/resources/SearchResult.js.map +1 -1
  7. package/dist/cjs/generated/resources/Upload.js +3 -1
  8. package/dist/cjs/generated/resources/Upload.js.map +1 -1
  9. package/dist/cjs/generated/resources/UploadSmartTag.js +3 -1
  10. package/dist/cjs/generated/resources/UploadSmartTag.js.map +1 -1
  11. package/dist/cjs/generated/resources/UploadTag.js +3 -1
  12. package/dist/cjs/generated/resources/UploadTag.js.map +1 -1
  13. package/dist/cjs/generated/resources/WebhookCall.js +3 -1
  14. package/dist/cjs/generated/resources/WebhookCall.js.map +1 -1
  15. package/dist/esm/buildBlockRecord.d.ts +2 -0
  16. package/dist/esm/generated/SchemaTypes.d.ts +70 -25
  17. package/dist/esm/generated/SimpleSchemaTypes.d.ts +82 -28
  18. package/dist/esm/generated/resources/DailyUsage.d.ts +1 -1
  19. package/dist/esm/generated/resources/Item.d.ts +6 -6
  20. package/dist/esm/generated/resources/Item.js +3 -1
  21. package/dist/esm/generated/resources/Item.js.map +1 -1
  22. package/dist/esm/generated/resources/ItemVersion.js +3 -1
  23. package/dist/esm/generated/resources/ItemVersion.js.map +1 -1
  24. package/dist/esm/generated/resources/SearchResult.d.ts +15 -2
  25. package/dist/esm/generated/resources/SearchResult.js +118 -0
  26. package/dist/esm/generated/resources/SearchResult.js.map +1 -1
  27. package/dist/esm/generated/resources/Upload.js +3 -1
  28. package/dist/esm/generated/resources/Upload.js.map +1 -1
  29. package/dist/esm/generated/resources/UploadSmartTag.js +3 -1
  30. package/dist/esm/generated/resources/UploadSmartTag.js.map +1 -1
  31. package/dist/esm/generated/resources/UploadTag.js +3 -1
  32. package/dist/esm/generated/resources/UploadTag.js.map +1 -1
  33. package/dist/esm/generated/resources/WebhookCall.js +3 -1
  34. package/dist/esm/generated/resources/WebhookCall.js.map +1 -1
  35. package/dist/types/buildBlockRecord.d.ts +2 -0
  36. package/dist/types/generated/SchemaTypes.d.ts +70 -25
  37. package/dist/types/generated/SimpleSchemaTypes.d.ts +82 -28
  38. package/dist/types/generated/resources/DailyUsage.d.ts +1 -1
  39. package/dist/types/generated/resources/Item.d.ts +6 -6
  40. package/dist/types/generated/resources/SearchResult.d.ts +15 -2
  41. package/package.json +4 -4
  42. package/resources.json +4 -0
  43. package/src/generated/SchemaTypes.ts +70 -25
  44. package/src/generated/SimpleSchemaTypes.ts +83 -28
  45. package/src/generated/resources/Item.ts +8 -7
  46. package/src/generated/resources/ItemVersion.ts +2 -1
  47. package/src/generated/resources/SearchResult.ts +43 -2
  48. package/src/generated/resources/Upload.ts +2 -1
  49. package/src/generated/resources/UploadSmartTag.ts +2 -1
  50. package/src/generated/resources/UploadTag.ts +2 -1
  51. package/src/generated/resources/WebhookCall.ts +2 -1
@@ -520,7 +520,7 @@ export type ItemInstancesHrefSchema = {
520
520
  [k: string]: unknown;
521
521
  };
522
522
  /**
523
- * Fields used to order results. You _must_ specify also `filter[type]` with one element only to be able use this option. Format: `<field_name>_<DIRECTION(ASC|DESC)>`. You can pass multiple comma separated rules
523
+ * Fields used to order results. You **must** specify also `filter[type]` with one element only to be able use this option. Format: `<field_name>_(ASC|DESC)`, where `<field_name>` can be either the API key of a model's field, or one of the following meta columns: `id`, `_updated_at`, `_created_at`, `_status`, `_published_at`, `_first_published_at`, `_publication_scheduled_at`, `_unpublishing_scheduled_at`, `_is_valid`, `position` (only for sortable models). You can pass multiple comma separated rules.
524
524
  */
525
525
  order_by?: string;
526
526
  /**
@@ -830,25 +830,41 @@ export type SearchResultIdentity = string;
830
830
  */
831
831
  export type SearchResultInstancesHrefSchema = {
832
832
  /**
833
- * The query string to search
834
- */
835
- q: string;
836
- /**
837
- * The build trigger ID on which the search will be performed
838
- */
839
- build_trigger_id?: string;
840
- /**
841
- * Restrict the search on one locale
842
- */
843
- locale?: string;
844
- /**
845
- * Maximum number of results to return (defaults to 20, maximum is 100)
833
+ * Attributes to manage results pagination
846
834
  */
847
- limit?: number;
835
+ page?: {
836
+ /**
837
+ * Index of first element to fetch (defaults to 0)
838
+ */
839
+ offset?: number;
840
+ /**
841
+ * Number of elements to fetch (defaults to 20, maximum is 100)
842
+ */
843
+ limit?: number;
844
+ [k: string]: unknown;
845
+ };
848
846
  /**
849
- * Number of records to offset for the search
847
+ * Attributes to filter search results
850
848
  */
851
- offset?: string;
849
+ filter: {
850
+ /**
851
+ * When any value is passed, it enables the fuzzy search: the Levenshtein Edit Distance is used to match more results.
852
+ */
853
+ fuzzy?: string;
854
+ /**
855
+ * Text to search
856
+ */
857
+ query: string;
858
+ /**
859
+ * The build trigger ID on which the search will be performed. Required if more than one build trigger is present in a project
860
+ */
861
+ build_trigger_id?: string;
862
+ /**
863
+ * Restrict the search on pages in a specific locale
864
+ */
865
+ locale?: string;
866
+ [k: string]: unknown;
867
+ };
852
868
  [k: string]: unknown;
853
869
  };
854
870
  /**
@@ -3179,6 +3195,10 @@ export type SitePlanAttributes = {
3179
3195
  * Whether or not use a static IP when sending webhooks
3180
3196
  */
3181
3197
  static_webhooks_ip: boolean;
3198
+ /**
3199
+ * Maximum size in bytes for a single file upload
3200
+ */
3201
+ maximum_single_upload_bytes: number;
3182
3202
  /**
3183
3203
  * Available extra packets
3184
3204
  */
@@ -6089,6 +6109,14 @@ export type ItemMeta = {
6089
6109
  * Whether the current record is valid or not
6090
6110
  */
6091
6111
  is_valid: boolean;
6112
+ /**
6113
+ * Whether the current version of the record is valid or not
6114
+ */
6115
+ is_current_version_valid: null | boolean;
6116
+ /**
6117
+ * Whether the published version of record is valid or not
6118
+ */
6119
+ is_published_version_valid: null | boolean;
6092
6120
  /**
6093
6121
  * The ID of the current record version
6094
6122
  */
@@ -6210,6 +6238,14 @@ export type ItemCreateSchema = {
6210
6238
  * Whether the current record is valid or not
6211
6239
  */
6212
6240
  is_valid?: boolean;
6241
+ /**
6242
+ * Whether the current version of the record is valid or not
6243
+ */
6244
+ is_current_version_valid?: null | boolean;
6245
+ /**
6246
+ * Whether the published version of the record is valid or not
6247
+ */
6248
+ is_published_version_valid?: null | boolean;
6213
6249
  /**
6214
6250
  * The ID of the current record version
6215
6251
  */
@@ -6306,6 +6342,14 @@ export type ItemUpdateSchema = {
6306
6342
  * The ID of the current record version (for optimistic locking, see the example)
6307
6343
  */
6308
6344
  current_version?: string;
6345
+ /**
6346
+ * Whether the current version of the record is valid or not
6347
+ */
6348
+ is_current_version_valid?: null | boolean;
6349
+ /**
6350
+ * Whether the published version of record is valid or not
6351
+ */
6352
+ is_published_version_valid?: null | boolean;
6309
6353
  /**
6310
6354
  * The new stage to move the record to
6311
6355
  */
@@ -7551,11 +7595,11 @@ export type SearchResult = {
7551
7595
  */
7552
7596
  export type SearchResultAttributes = {
7553
7597
  /**
7554
- * Page title
7598
+ * Title of the page
7555
7599
  */
7556
7600
  title: string;
7557
7601
  /**
7558
- * First lines of body
7602
+ * First 200 characters of page body, unformatted
7559
7603
  */
7560
7604
  body_excerpt: string;
7561
7605
  /**
@@ -7563,7 +7607,7 @@ export type SearchResultAttributes = {
7563
7607
  */
7564
7608
  url: string;
7565
7609
  /**
7566
- * Score
7610
+ * Search score
7567
7611
  */
7568
7612
  score: number;
7569
7613
  highlight: {
@@ -7589,7 +7633,7 @@ export type SearchResultData = {
7589
7633
  */
7590
7634
  export type SearchResultInstancesTargetSchema = {
7591
7635
  data: SearchResult[];
7592
- meta?: {
7636
+ meta: {
7593
7637
  total_count: number;
7594
7638
  };
7595
7639
  };
@@ -8326,7 +8370,7 @@ export type ItemTypeFilterAttributes = {
8326
8370
  */
8327
8371
  name: string;
8328
8372
  /**
8329
- * The actual filter
8373
+ * The actual filter. It follows the form of the `filter` query parameter of the [List all records](https://www.datocms.com/docs/content-management-api/resources/item/instances) endpoint.
8330
8374
  */
8331
8375
  filter: {
8332
8376
  [k: string]: unknown;
@@ -8376,7 +8420,7 @@ export type ItemTypeFilterCreateSchema = {
8376
8420
  */
8377
8421
  name: string;
8378
8422
  /**
8379
- * The actual filter
8423
+ * The actual filter. It follows the form of the `filter` query parameter of the [List all records](https://www.datocms.com/docs/content-management-api/resources/item/instances) endpoint.
8380
8424
  */
8381
8425
  filter: {
8382
8426
  [k: string]: unknown;
@@ -8426,7 +8470,7 @@ export type ItemTypeFilterUpdateSchema = {
8426
8470
  */
8427
8471
  shared?: boolean;
8428
8472
  /**
8429
- * The actual filter
8473
+ * The actual filter. It follows the form of the `filter` query parameter of the [List all records](https://www.datocms.com/docs/content-management-api/resources/item/instances) endpoint.
8430
8474
  */
8431
8475
  filter: {
8432
8476
  [k: string]: unknown;
@@ -9298,6 +9342,7 @@ export type PublicInfoAttributes = {
9298
9342
  extras: null | {
9299
9343
  blocks_depth: number;
9300
9344
  blocks_per_item: number;
9345
+ maximum_single_upload_bytes: number;
9301
9346
  [k: string]: unknown;
9302
9347
  };
9303
9348
  };
@@ -9382,7 +9427,7 @@ export type DailyUsageData = {
9382
9427
  * via the `instances.targetSchema` link.
9383
9428
  */
9384
9429
  export type DailyUsageInstancesTargetSchema = {
9385
- data: DailyUsage;
9430
+ data: DailyUsage[];
9386
9431
  };
9387
9432
 
9388
9433
  /**
@@ -615,7 +615,7 @@ export type ItemInstancesHrefSchema = {
615
615
  [k: string]: unknown;
616
616
  };
617
617
  /**
618
- * Fields used to order results. You _must_ specify also `filter[type]` with one element only to be able use this option. Format: `<field_name>_<DIRECTION(ASC|DESC)>`. You can pass multiple comma separated rules
618
+ * Fields used to order results. You **must** specify also `filter[type]` with one element only to be able use this option. Format: `<field_name>_(ASC|DESC)`, where `<field_name>` can be either the API key of a model's field, or one of the following meta columns: `id`, `_updated_at`, `_created_at`, `_status`, `_published_at`, `_first_published_at`, `_publication_scheduled_at`, `_unpublishing_scheduled_at`, `_is_valid`, `position` (only for sortable models). You can pass multiple comma separated rules.
619
619
  */
620
620
  order_by?: string;
621
621
  /**
@@ -1010,25 +1010,41 @@ export type SearchResultInstancesTargetSchema = SearchResult[];
1010
1010
  */
1011
1011
  export type SearchResultInstancesHrefSchema = {
1012
1012
  /**
1013
- * The query string to search
1014
- */
1015
- q: string;
1016
- /**
1017
- * The build trigger ID on which the search will be performed
1018
- */
1019
- build_trigger_id?: string;
1020
- /**
1021
- * Restrict the search on one locale
1022
- */
1023
- locale?: string;
1024
- /**
1025
- * Maximum number of results to return (defaults to 20, maximum is 100)
1013
+ * Attributes to manage results pagination
1026
1014
  */
1027
- limit?: number;
1015
+ page?: {
1016
+ /**
1017
+ * Index of first element to fetch (defaults to 0)
1018
+ */
1019
+ offset?: number;
1020
+ /**
1021
+ * Number of elements to fetch (defaults to 20, maximum is 100)
1022
+ */
1023
+ limit?: number;
1024
+ [k: string]: unknown;
1025
+ };
1028
1026
  /**
1029
- * Number of records to offset for the search
1027
+ * Attributes to filter search results
1030
1028
  */
1031
- offset?: string;
1029
+ filter: {
1030
+ /**
1031
+ * When any value is passed, it enables the fuzzy search: the Levenshtein Edit Distance is used to match more results.
1032
+ */
1033
+ fuzzy?: string;
1034
+ /**
1035
+ * Text to search
1036
+ */
1037
+ query: string;
1038
+ /**
1039
+ * The build trigger ID on which the search will be performed. Required if more than one build trigger is present in a project
1040
+ */
1041
+ build_trigger_id?: string;
1042
+ /**
1043
+ * Restrict the search on pages in a specific locale
1044
+ */
1045
+ locale?: string;
1046
+ [k: string]: unknown;
1047
+ };
1032
1048
  [k: string]: unknown;
1033
1049
  };
1034
1050
  /**
@@ -1348,6 +1364,11 @@ export type DailyUsageIdentity = string;
1348
1364
  * via the `definition` "type".
1349
1365
  */
1350
1366
  export type DailyUsageType = 'daily_usage';
1367
+ /**
1368
+ * This interface was referenced by `DailyUsage`'s JSON-Schema
1369
+ * via the `instances.targetSchema` link.
1370
+ */
1371
+ export type DailyUsageInstancesTargetSchema = DailyUsage[];
1351
1372
  /**
1352
1373
  * Name of the counter
1353
1374
  *
@@ -3568,6 +3589,10 @@ export type SitePlan = {
3568
3589
  * Whether or not use a static IP when sending webhooks
3569
3590
  */
3570
3591
  static_webhooks_ip: boolean;
3592
+ /**
3593
+ * Maximum size in bytes for a single file upload
3594
+ */
3595
+ maximum_single_upload_bytes: number;
3571
3596
  /**
3572
3597
  * Available extra packets
3573
3598
  */
@@ -3790,6 +3815,10 @@ export type SitePlanAttributes = {
3790
3815
  * Whether or not use a static IP when sending webhooks
3791
3816
  */
3792
3817
  static_webhooks_ip: boolean;
3818
+ /**
3819
+ * Maximum size in bytes for a single file upload
3820
+ */
3821
+ maximum_single_upload_bytes: number;
3793
3822
  /**
3794
3823
  * Available extra packets
3795
3824
  */
@@ -6501,6 +6530,14 @@ export type ItemMeta = {
6501
6530
  * Whether the current record is valid or not
6502
6531
  */
6503
6532
  is_valid: boolean;
6533
+ /**
6534
+ * Whether the current version of the record is valid or not
6535
+ */
6536
+ is_current_version_valid: null | boolean;
6537
+ /**
6538
+ * Whether the published version of record is valid or not
6539
+ */
6540
+ is_published_version_valid: null | boolean;
6504
6541
  /**
6505
6542
  * The ID of the current record version
6506
6543
  */
@@ -6593,6 +6630,14 @@ export type ItemCreateSchema = {
6593
6630
  * Whether the current record is valid or not
6594
6631
  */
6595
6632
  is_valid?: boolean;
6633
+ /**
6634
+ * Whether the current version of the record is valid or not
6635
+ */
6636
+ is_current_version_valid?: null | boolean;
6637
+ /**
6638
+ * Whether the published version of the record is valid or not
6639
+ */
6640
+ is_published_version_valid?: null | boolean;
6596
6641
  /**
6597
6642
  * The ID of the current record version
6598
6643
  */
@@ -6650,6 +6695,14 @@ export type ItemUpdateSchema = {
6650
6695
  * The ID of the current record version (for optimistic locking, see the example)
6651
6696
  */
6652
6697
  current_version?: string;
6698
+ /**
6699
+ * Whether the current version of the record is valid or not
6700
+ */
6701
+ is_current_version_valid?: null | boolean;
6702
+ /**
6703
+ * Whether the published version of record is valid or not
6704
+ */
6705
+ is_published_version_valid?: null | boolean;
6653
6706
  /**
6654
6707
  * The new stage to move the record to
6655
6708
  */
@@ -7498,11 +7551,11 @@ export type SearchResult = {
7498
7551
  id: SearchResultIdentity;
7499
7552
  type: SearchResultType;
7500
7553
  /**
7501
- * Page title
7554
+ * Title of the page
7502
7555
  */
7503
7556
  title: string;
7504
7557
  /**
7505
- * First lines of body
7558
+ * First 200 characters of page body, unformatted
7506
7559
  */
7507
7560
  body_excerpt: string;
7508
7561
  /**
@@ -7510,7 +7563,7 @@ export type SearchResult = {
7510
7563
  */
7511
7564
  url: string;
7512
7565
  /**
7513
- * Score
7566
+ * Search score
7514
7567
  */
7515
7568
  score: number;
7516
7569
  highlight: {
@@ -7538,11 +7591,11 @@ export type SearchResultData = {
7538
7591
  */
7539
7592
  export type SearchResultAttributes = {
7540
7593
  /**
7541
- * Page title
7594
+ * Title of the page
7542
7595
  */
7543
7596
  title: string;
7544
7597
  /**
7545
- * First lines of body
7598
+ * First 200 characters of page body, unformatted
7546
7599
  */
7547
7600
  body_excerpt: string;
7548
7601
  /**
@@ -7550,7 +7603,7 @@ export type SearchResultAttributes = {
7550
7603
  */
7551
7604
  url: string;
7552
7605
  /**
7553
- * Score
7606
+ * Search score
7554
7607
  */
7555
7608
  score: number;
7556
7609
  highlight: {
@@ -8226,7 +8279,7 @@ export type ItemTypeFilter = {
8226
8279
  */
8227
8280
  name: string;
8228
8281
  /**
8229
- * The actual filter
8282
+ * The actual filter. It follows the form of the `filter` query parameter of the [List all records](https://www.datocms.com/docs/content-management-api/resources/item/instances) endpoint.
8230
8283
  */
8231
8284
  filter: {
8232
8285
  [k: string]: unknown;
@@ -8264,7 +8317,7 @@ export type ItemTypeFilterAttributes = {
8264
8317
  */
8265
8318
  name: string;
8266
8319
  /**
8267
- * The actual filter
8320
+ * The actual filter. It follows the form of the `filter` query parameter of the [List all records](https://www.datocms.com/docs/content-management-api/resources/item/instances) endpoint.
8268
8321
  */
8269
8322
  filter: {
8270
8323
  [k: string]: unknown;
@@ -8296,7 +8349,7 @@ export type ItemTypeFilterCreateSchema = {
8296
8349
  */
8297
8350
  name: string;
8298
8351
  /**
8299
- * The actual filter
8352
+ * The actual filter. It follows the form of the `filter` query parameter of the [List all records](https://www.datocms.com/docs/content-management-api/resources/item/instances) endpoint.
8300
8353
  */
8301
8354
  filter: {
8302
8355
  [k: string]: unknown;
@@ -8324,7 +8377,7 @@ export type ItemTypeFilterUpdateSchema = {
8324
8377
  */
8325
8378
  shared?: boolean;
8326
8379
  /**
8327
- * The actual filter
8380
+ * The actual filter. It follows the form of the `filter` query parameter of the [List all records](https://www.datocms.com/docs/content-management-api/resources/item/instances) endpoint.
8328
8381
  */
8329
8382
  filter: {
8330
8383
  [k: string]: unknown;
@@ -8897,6 +8950,7 @@ export type PublicInfo = {
8897
8950
  extras: null | {
8898
8951
  blocks_depth: number;
8899
8952
  blocks_per_item: number;
8953
+ maximum_single_upload_bytes: number;
8900
8954
  [k: string]: unknown;
8901
8955
  };
8902
8956
  };
@@ -8979,6 +9033,7 @@ export type PublicInfoAttributes = {
8979
9033
  extras: null | {
8980
9034
  blocks_depth: number;
8981
9035
  blocks_per_item: number;
9036
+ maximum_single_upload_bytes: number;
8982
9037
  [k: string]: unknown;
8983
9038
  };
8984
9039
  };
@@ -9017,7 +9072,7 @@ export type DailyUsage = {
9017
9072
  */
9018
9073
  mux_delivered_seconds: number;
9019
9074
  };
9020
- export type DailyUsageInstancesTargetSchema = DailyUsage;
9075
+
9021
9076
  /**
9022
9077
  * JSON API data
9023
9078
  *
@@ -69,7 +69,8 @@ export default class Item extends BaseResource {
69
69
  defaultLimit: 30,
70
70
  maxLimit: 500,
71
71
  },
72
- (page) => this.rawList({ ...queryParams, page }),
72
+ (page: SchemaTypes.ItemInstancesHrefSchema['page']) =>
73
+ this.rawList({ ...queryParams, page }),
73
74
  iteratorOptions,
74
75
  );
75
76
  }
@@ -341,7 +342,7 @@ export default class Item extends BaseResource {
341
342
  *
342
343
  * @deprecated This API call is to be considered private and might change without notice
343
344
  */
344
- batchDestroy(queryParams?: SimpleSchemaTypes.ItemBatchDestroyHrefSchema) {
345
+ batchDestroy(queryParams: SimpleSchemaTypes.ItemBatchDestroyHrefSchema) {
345
346
  return this.rawBatchDestroy(queryParams).then((body) =>
346
347
  Utils.deserializeResponseBody<SimpleSchemaTypes.ItemBatchDestroyJobSchema>(
347
348
  body,
@@ -357,7 +358,7 @@ export default class Item extends BaseResource {
357
358
  * @deprecated This API call is to be considered private and might change without notice
358
359
  */
359
360
  rawBatchDestroy(
360
- queryParams?: SchemaTypes.ItemBatchDestroyHrefSchema,
361
+ queryParams: SchemaTypes.ItemBatchDestroyHrefSchema,
361
362
  ): Promise<SchemaTypes.ItemBatchDestroyJobSchema> {
362
363
  return this.client.request<SchemaTypes.ItemBatchDestroyJobSchema>({
363
364
  method: 'DELETE',
@@ -373,7 +374,7 @@ export default class Item extends BaseResource {
373
374
  *
374
375
  * @deprecated This API call is to be considered private and might change without notice
375
376
  */
376
- batchPublish(queryParams?: SimpleSchemaTypes.ItemBatchPublishHrefSchema) {
377
+ batchPublish(queryParams: SimpleSchemaTypes.ItemBatchPublishHrefSchema) {
377
378
  return this.rawBatchPublish(queryParams).then((body) =>
378
379
  Utils.deserializeResponseBody<SimpleSchemaTypes.ItemBatchPublishJobSchema>(
379
380
  body,
@@ -389,7 +390,7 @@ export default class Item extends BaseResource {
389
390
  * @deprecated This API call is to be considered private and might change without notice
390
391
  */
391
392
  rawBatchPublish(
392
- queryParams?: SchemaTypes.ItemBatchPublishHrefSchema,
393
+ queryParams: SchemaTypes.ItemBatchPublishHrefSchema,
393
394
  ): Promise<SchemaTypes.ItemBatchPublishJobSchema> {
394
395
  return this.client.request<SchemaTypes.ItemBatchPublishJobSchema>({
395
396
  method: 'PUT',
@@ -405,7 +406,7 @@ export default class Item extends BaseResource {
405
406
  *
406
407
  * @deprecated This API call is to be considered private and might change without notice
407
408
  */
408
- batchUnpublish(queryParams?: SimpleSchemaTypes.ItemBatchUnpublishHrefSchema) {
409
+ batchUnpublish(queryParams: SimpleSchemaTypes.ItemBatchUnpublishHrefSchema) {
409
410
  return this.rawBatchUnpublish(queryParams).then((body) =>
410
411
  Utils.deserializeResponseBody<SimpleSchemaTypes.ItemBatchUnpublishJobSchema>(
411
412
  body,
@@ -421,7 +422,7 @@ export default class Item extends BaseResource {
421
422
  * @deprecated This API call is to be considered private and might change without notice
422
423
  */
423
424
  rawBatchUnpublish(
424
- queryParams?: SchemaTypes.ItemBatchUnpublishHrefSchema,
425
+ queryParams: SchemaTypes.ItemBatchUnpublishHrefSchema,
425
426
  ): Promise<SchemaTypes.ItemBatchUnpublishJobSchema> {
426
427
  return this.client.request<SchemaTypes.ItemBatchUnpublishJobSchema>({
427
428
  method: 'PUT',
@@ -103,7 +103,8 @@ export default class ItemVersion extends BaseResource {
103
103
  defaultLimit: 15,
104
104
  maxLimit: 50,
105
105
  },
106
- (page) => this.rawList(itemId, { ...queryParams, page }),
106
+ (page: SchemaTypes.ItemVersionInstancesHrefSchema['page']) =>
107
+ this.rawList(itemId, { ...queryParams, page }),
107
108
  iteratorOptions,
108
109
  );
109
110
  }
@@ -11,7 +11,7 @@ export default class SearchResult extends BaseResource {
11
11
  *
12
12
  * Read more: https://www.datocms.com/docs/content-management-api/resources/search-result/instances
13
13
  */
14
- list(queryParams?: SimpleSchemaTypes.SearchResultInstancesHrefSchema) {
14
+ list(queryParams: SimpleSchemaTypes.SearchResultInstancesHrefSchema) {
15
15
  return this.rawList(queryParams).then((body) =>
16
16
  Utils.deserializeResponseBody<SimpleSchemaTypes.SearchResultInstancesTargetSchema>(
17
17
  body,
@@ -25,7 +25,7 @@ export default class SearchResult extends BaseResource {
25
25
  * Read more: https://www.datocms.com/docs/content-management-api/resources/search-result/instances
26
26
  */
27
27
  rawList(
28
- queryParams?: SchemaTypes.SearchResultInstancesHrefSchema,
28
+ queryParams: SchemaTypes.SearchResultInstancesHrefSchema,
29
29
  ): Promise<SchemaTypes.SearchResultInstancesTargetSchema> {
30
30
  return this.client.request<SchemaTypes.SearchResultInstancesTargetSchema>({
31
31
  method: 'GET',
@@ -33,4 +33,45 @@ export default class SearchResult extends BaseResource {
33
33
  queryParams,
34
34
  });
35
35
  }
36
+
37
+ /**
38
+ * Async iterator to auto-paginate over elements returned by list()
39
+ *
40
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/search-result/instances
41
+ */
42
+ async *listPagedIterator(
43
+ queryParams: SimpleSchemaTypes.SearchResultInstancesHrefSchema,
44
+ iteratorOptions?: Utils.IteratorOptions,
45
+ ) {
46
+ for await (const element of this.rawListPagedIterator(
47
+ queryParams,
48
+ iteratorOptions,
49
+ )) {
50
+ yield Utils.deserializeJsonEntity<
51
+ SimpleSchemaTypes.SearchResultInstancesTargetSchema[0]
52
+ >(element);
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Async iterator to auto-paginate over elements returned by rawList()
58
+ *
59
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/search-result/instances
60
+ */
61
+ rawListPagedIterator(
62
+ queryParams: SchemaTypes.SearchResultInstancesHrefSchema,
63
+ iteratorOptions?: Utils.IteratorOptions,
64
+ ) {
65
+ return Utils.rawPageIterator<
66
+ SchemaTypes.SearchResultInstancesTargetSchema['data'][0]
67
+ >(
68
+ {
69
+ defaultLimit: 20,
70
+ maxLimit: 100,
71
+ },
72
+ (page: SchemaTypes.SearchResultInstancesHrefSchema['page']) =>
73
+ this.rawList({ ...queryParams, page }),
74
+ iteratorOptions,
75
+ );
76
+ }
36
77
  }
@@ -110,7 +110,8 @@ export default class Upload extends BaseResource {
110
110
  defaultLimit: 30,
111
111
  maxLimit: 500,
112
112
  },
113
- (page) => this.rawList({ ...queryParams, page }),
113
+ (page: SchemaTypes.UploadInstancesHrefSchema['page']) =>
114
+ this.rawList({ ...queryParams, page }),
114
115
  iteratorOptions,
115
116
  );
116
117
  }
@@ -71,7 +71,8 @@ export default class UploadSmartTag extends BaseResource {
71
71
  defaultLimit: 50,
72
72
  maxLimit: 500,
73
73
  },
74
- (page) => this.rawList({ ...queryParams, page }),
74
+ (page: SchemaTypes.UploadSmartTagInstancesHrefSchema['page']) =>
75
+ this.rawList({ ...queryParams, page }),
75
76
  iteratorOptions,
76
77
  );
77
78
  }
@@ -69,7 +69,8 @@ export default class UploadTag extends BaseResource {
69
69
  defaultLimit: 50,
70
70
  maxLimit: 500,
71
71
  },
72
- (page) => this.rawList({ ...queryParams, page }),
72
+ (page: SchemaTypes.UploadTagInstancesHrefSchema['page']) =>
73
+ this.rawList({ ...queryParams, page }),
73
74
  iteratorOptions,
74
75
  );
75
76
  }
@@ -69,7 +69,8 @@ export default class WebhookCall extends BaseResource {
69
69
  defaultLimit: 30,
70
70
  maxLimit: 500,
71
71
  },
72
- (page) => this.rawList({ ...queryParams, page }),
72
+ (page: SchemaTypes.WebhookCallInstancesHrefSchema['page']) =>
73
+ this.rawList({ ...queryParams, page }),
73
74
  iteratorOptions,
74
75
  );
75
76
  }