@datocms/cma-client 1.0.0 → 1.1.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.
Files changed (49) 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/generated/SchemaTypes.d.ts +45 -64
  16. package/dist/esm/generated/SimpleSchemaTypes.d.ts +60 -82
  17. package/dist/esm/generated/resources/DailyUsage.d.ts +1 -1
  18. package/dist/esm/generated/resources/Item.d.ts +6 -6
  19. package/dist/esm/generated/resources/Item.js +3 -1
  20. package/dist/esm/generated/resources/Item.js.map +1 -1
  21. package/dist/esm/generated/resources/ItemVersion.js +3 -1
  22. package/dist/esm/generated/resources/ItemVersion.js.map +1 -1
  23. package/dist/esm/generated/resources/SearchResult.d.ts +15 -2
  24. package/dist/esm/generated/resources/SearchResult.js +118 -0
  25. package/dist/esm/generated/resources/SearchResult.js.map +1 -1
  26. package/dist/esm/generated/resources/Upload.js +3 -1
  27. package/dist/esm/generated/resources/Upload.js.map +1 -1
  28. package/dist/esm/generated/resources/UploadSmartTag.js +3 -1
  29. package/dist/esm/generated/resources/UploadSmartTag.js.map +1 -1
  30. package/dist/esm/generated/resources/UploadTag.js +3 -1
  31. package/dist/esm/generated/resources/UploadTag.js.map +1 -1
  32. package/dist/esm/generated/resources/WebhookCall.js +3 -1
  33. package/dist/esm/generated/resources/WebhookCall.js.map +1 -1
  34. package/dist/types/generated/SchemaTypes.d.ts +45 -64
  35. package/dist/types/generated/SimpleSchemaTypes.d.ts +60 -82
  36. package/dist/types/generated/resources/DailyUsage.d.ts +1 -1
  37. package/dist/types/generated/resources/Item.d.ts +6 -6
  38. package/dist/types/generated/resources/SearchResult.d.ts +15 -2
  39. package/package.json +4 -4
  40. package/resources.json +4 -0
  41. package/src/generated/SchemaTypes.ts +45 -75
  42. package/src/generated/SimpleSchemaTypes.ts +61 -82
  43. package/src/generated/resources/Item.ts +8 -7
  44. package/src/generated/resources/ItemVersion.ts +2 -1
  45. package/src/generated/resources/SearchResult.ts +43 -2
  46. package/src/generated/resources/Upload.ts +2 -1
  47. package/src/generated/resources/UploadSmartTag.ts +2 -1
  48. package/src/generated/resources/UploadTag.ts +2 -1
  49. package/src/generated/resources/WebhookCall.ts +2 -1
@@ -830,25 +830,37 @@ 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
+ * Text to search
852
+ */
853
+ query: string;
854
+ /**
855
+ * The build trigger ID on which the search will be performed. Required if more than one build trigger is present in a project
856
+ */
857
+ build_trigger_id?: string;
858
+ /**
859
+ * Restrict the search on pages in a specific locale
860
+ */
861
+ locale?: string;
862
+ [k: string]: unknown;
863
+ };
852
864
  [k: string]: unknown;
853
865
  };
854
866
  /**
@@ -3175,6 +3187,14 @@ export type SitePlanAttributes = {
3175
3187
  * Whether translator roles are enabled or not
3176
3188
  */
3177
3189
  translator_roles: boolean;
3190
+ /**
3191
+ * Whether or not use a static IP when sending webhooks
3192
+ */
3193
+ static_webhooks_ip: boolean;
3194
+ /**
3195
+ * Maximum size in bytes for a single file upload
3196
+ */
3197
+ maximum_single_upload_bytes: number;
3178
3198
  /**
3179
3199
  * Available extra packets
3180
3200
  */
@@ -4310,7 +4330,7 @@ export type ItemTypeDestroyJobSchema = {
4310
4330
  * | Parameter | Type | Required | Description |
4311
4331
  * | ----------------- | ----------------------------------------- | -------- | ------------------------------ |
4312
4332
  * | `extensions` | `Array<String>` | | Set of allowed file extensions |
4313
- * | `predefined_list` | one of `"image"`, `"video"`, `"document"` | | Allowed file type |
4333
+ * | `predefined_list` | one of `"image"`, `"transformable_image"`, `"video"`, `"document"` | | Allowed file type |
4314
4334
  *
4315
4335
  * Only one of the parameters must be specified.
4316
4336
  *
@@ -7547,11 +7567,11 @@ export type SearchResult = {
7547
7567
  */
7548
7568
  export type SearchResultAttributes = {
7549
7569
  /**
7550
- * Page title
7570
+ * Title of the page
7551
7571
  */
7552
7572
  title: string;
7553
7573
  /**
7554
- * First lines of body
7574
+ * First 200 characters of page body, unformatted
7555
7575
  */
7556
7576
  body_excerpt: string;
7557
7577
  /**
@@ -7559,7 +7579,7 @@ export type SearchResultAttributes = {
7559
7579
  */
7560
7580
  url: string;
7561
7581
  /**
7562
- * Score
7582
+ * Search score
7563
7583
  */
7564
7584
  score: number;
7565
7585
  highlight: {
@@ -7585,7 +7605,7 @@ export type SearchResultData = {
7585
7605
  */
7586
7606
  export type SearchResultInstancesTargetSchema = {
7587
7607
  data: SearchResult[];
7588
- meta?: {
7608
+ meta: {
7589
7609
  total_count: number;
7590
7610
  };
7591
7611
  };
@@ -9294,6 +9314,7 @@ export type PublicInfoAttributes = {
9294
9314
  extras: null | {
9295
9315
  blocks_depth: number;
9296
9316
  blocks_per_item: number;
9317
+ maximum_single_upload_bytes: number;
9297
9318
  [k: string]: unknown;
9298
9319
  };
9299
9320
  };
@@ -9378,7 +9399,7 @@ export type DailyUsageData = {
9378
9399
  * via the `instances.targetSchema` link.
9379
9400
  */
9380
9401
  export type DailyUsageInstancesTargetSchema = {
9381
- data: DailyUsage;
9402
+ data: DailyUsage[];
9382
9403
  };
9383
9404
 
9384
9405
  /**
@@ -9610,10 +9631,6 @@ export type SiteAttributes = {
9610
9631
  * Specifies the last time when a change of data occurred
9611
9632
  */
9612
9633
  last_data_change_at: null | string;
9613
- /**
9614
- * Frontend website url
9615
- */
9616
- frontend_url: string | null;
9617
9634
  /**
9618
9635
  * Specifies whether all users of this site need to authenticate using two-factor authentication
9619
9636
  */
@@ -9707,48 +9724,12 @@ export type SiteRelationships = {
9707
9724
  account: {
9708
9725
  data: AccountData;
9709
9726
  };
9710
- build_triggers?: {
9711
- /**
9712
- * The list of build trigger
9713
- */
9714
- data: BuildTriggerData[];
9715
- };
9716
- menu_items: {
9717
- /**
9718
- * The list of site menu items
9719
- */
9720
- data: MenuItemData[];
9721
- };
9722
- sso_users: {
9723
- /**
9724
- * The list of site SSO users
9725
- */
9726
- data: SsoUserData[];
9727
- };
9728
- users: {
9729
- /**
9730
- * The list of site users
9731
- */
9732
- data: UserData[];
9733
- };
9734
9727
  item_types: {
9735
9728
  /**
9736
- * The list of site item types
9729
+ * The list item types for the site
9737
9730
  */
9738
9731
  data: ItemTypeData[];
9739
9732
  };
9740
- sso_default_role?: {
9741
- /**
9742
- * Specifies the default role for newly created identity providers users
9743
- */
9744
- data: RoleData[];
9745
- };
9746
- roles: {
9747
- /**
9748
- * The list of site roles
9749
- */
9750
- data: RoleData[];
9751
- };
9752
9733
  };
9753
9734
 
9754
9735
  /**
@@ -9781,18 +9762,7 @@ export type SiteData = {
9781
9762
  */
9782
9763
  export type SiteSelfTargetSchema = {
9783
9764
  data: Site;
9784
- included?: (
9785
- | MenuItem
9786
- | User
9787
- | ItemType
9788
- | Role
9789
- | Field
9790
- | Upload
9791
- | SsoUser
9792
- | Fieldset
9793
- | Item
9794
- | Account
9795
- )[];
9765
+ included?: (ItemType | Field | Upload | Fieldset | Item | Account)[];
9796
9766
  };
9797
9767
 
9798
9768
  /**
@@ -1010,25 +1010,37 @@ 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
+ * Text to search
1032
+ */
1033
+ query: string;
1034
+ /**
1035
+ * The build trigger ID on which the search will be performed. Required if more than one build trigger is present in a project
1036
+ */
1037
+ build_trigger_id?: string;
1038
+ /**
1039
+ * Restrict the search on pages in a specific locale
1040
+ */
1041
+ locale?: string;
1042
+ [k: string]: unknown;
1043
+ };
1032
1044
  [k: string]: unknown;
1033
1045
  };
1034
1046
  /**
@@ -1348,6 +1360,11 @@ export type DailyUsageIdentity = string;
1348
1360
  * via the `definition` "type".
1349
1361
  */
1350
1362
  export type DailyUsageType = 'daily_usage';
1363
+ /**
1364
+ * This interface was referenced by `DailyUsage`'s JSON-Schema
1365
+ * via the `instances.targetSchema` link.
1366
+ */
1367
+ export type DailyUsageInstancesTargetSchema = DailyUsage[];
1351
1368
  /**
1352
1369
  * Name of the counter
1353
1370
  *
@@ -3564,6 +3581,14 @@ export type SitePlan = {
3564
3581
  * Whether translator roles are enabled or not
3565
3582
  */
3566
3583
  translator_roles: boolean;
3584
+ /**
3585
+ * Whether or not use a static IP when sending webhooks
3586
+ */
3587
+ static_webhooks_ip: boolean;
3588
+ /**
3589
+ * Maximum size in bytes for a single file upload
3590
+ */
3591
+ maximum_single_upload_bytes: number;
3567
3592
  /**
3568
3593
  * Available extra packets
3569
3594
  */
@@ -3782,6 +3807,14 @@ export type SitePlanAttributes = {
3782
3807
  * Whether translator roles are enabled or not
3783
3808
  */
3784
3809
  translator_roles: boolean;
3810
+ /**
3811
+ * Whether or not use a static IP when sending webhooks
3812
+ */
3813
+ static_webhooks_ip: boolean;
3814
+ /**
3815
+ * Maximum size in bytes for a single file upload
3816
+ */
3817
+ maximum_single_upload_bytes: number;
3785
3818
  /**
3786
3819
  * Available extra packets
3787
3820
  */
@@ -4826,7 +4859,7 @@ export type JobData = {
4826
4859
  * | Parameter | Type | Required | Description |
4827
4860
  * | ----------------- | ----------------------------------------- | -------- | ------------------------------ |
4828
4861
  * | `extensions` | `Array<String>` | | Set of allowed file extensions |
4829
- * | `predefined_list` | one of `"image"`, `"video"`, `"document"` | | Allowed file type |
4862
+ * | `predefined_list` | one of `"image"`, `"transformable_image"`, `"video"`, `"document"` | | Allowed file type |
4830
4863
  *
4831
4864
  * Only one of the parameters must be specified.
4832
4865
  *
@@ -7490,11 +7523,11 @@ export type SearchResult = {
7490
7523
  id: SearchResultIdentity;
7491
7524
  type: SearchResultType;
7492
7525
  /**
7493
- * Page title
7526
+ * Title of the page
7494
7527
  */
7495
7528
  title: string;
7496
7529
  /**
7497
- * First lines of body
7530
+ * First 200 characters of page body, unformatted
7498
7531
  */
7499
7532
  body_excerpt: string;
7500
7533
  /**
@@ -7502,7 +7535,7 @@ export type SearchResult = {
7502
7535
  */
7503
7536
  url: string;
7504
7537
  /**
7505
- * Score
7538
+ * Search score
7506
7539
  */
7507
7540
  score: number;
7508
7541
  highlight: {
@@ -7530,11 +7563,11 @@ export type SearchResultData = {
7530
7563
  */
7531
7564
  export type SearchResultAttributes = {
7532
7565
  /**
7533
- * Page title
7566
+ * Title of the page
7534
7567
  */
7535
7568
  title: string;
7536
7569
  /**
7537
- * First lines of body
7570
+ * First 200 characters of page body, unformatted
7538
7571
  */
7539
7572
  body_excerpt: string;
7540
7573
  /**
@@ -7542,7 +7575,7 @@ export type SearchResultAttributes = {
7542
7575
  */
7543
7576
  url: string;
7544
7577
  /**
7545
- * Score
7578
+ * Search score
7546
7579
  */
7547
7580
  score: number;
7548
7581
  highlight: {
@@ -8889,6 +8922,7 @@ export type PublicInfo = {
8889
8922
  extras: null | {
8890
8923
  blocks_depth: number;
8891
8924
  blocks_per_item: number;
8925
+ maximum_single_upload_bytes: number;
8892
8926
  [k: string]: unknown;
8893
8927
  };
8894
8928
  };
@@ -8971,6 +9005,7 @@ export type PublicInfoAttributes = {
8971
9005
  extras: null | {
8972
9006
  blocks_depth: number;
8973
9007
  blocks_per_item: number;
9008
+ maximum_single_upload_bytes: number;
8974
9009
  [k: string]: unknown;
8975
9010
  };
8976
9011
  };
@@ -9009,7 +9044,7 @@ export type DailyUsage = {
9009
9044
  */
9010
9045
  mux_delivered_seconds: number;
9011
9046
  };
9012
- export type DailyUsageInstancesTargetSchema = DailyUsage;
9047
+
9013
9048
  /**
9014
9049
  * JSON API data
9015
9050
  *
@@ -9244,10 +9279,6 @@ export type Site = {
9244
9279
  * Specifies the last time when a change of data occurred
9245
9280
  */
9246
9281
  last_data_change_at: null | string;
9247
- /**
9248
- * Frontend website url
9249
- */
9250
- frontend_url: string | null;
9251
9282
  /**
9252
9283
  * Specifies whether all users of this site need to authenticate using two-factor authentication
9253
9284
  */
@@ -9331,33 +9362,9 @@ export type Site = {
9331
9362
  } | null;
9332
9363
  account: AccountData;
9333
9364
  /**
9334
- * The list of build trigger
9335
- */
9336
- build_triggers?: BuildTriggerData[];
9337
- /**
9338
- * The list of site menu items
9339
- */
9340
- menu_items: MenuItemData[];
9341
- /**
9342
- * The list of site SSO users
9343
- */
9344
- sso_users: SsoUserData[];
9345
- /**
9346
- * The list of site users
9347
- */
9348
- users: UserData[];
9349
- /**
9350
- * The list of site item types
9365
+ * The list item types for the site
9351
9366
  */
9352
9367
  item_types: ItemTypeData[];
9353
- /**
9354
- * Specifies the default role for newly created identity providers users
9355
- */
9356
- sso_default_role?: RoleData[];
9357
- /**
9358
- * The list of site roles
9359
- */
9360
- roles: RoleData[];
9361
9368
  meta: SiteMeta;
9362
9369
  };
9363
9370
  export type SiteSelfTargetSchema = Site;
@@ -9434,10 +9441,6 @@ export type SiteAttributes = {
9434
9441
  * Specifies the last time when a change of data occurred
9435
9442
  */
9436
9443
  last_data_change_at: null | string;
9437
- /**
9438
- * Frontend website url
9439
- */
9440
- frontend_url: string | null;
9441
9444
  /**
9442
9445
  * Specifies whether all users of this site need to authenticate using two-factor authentication
9443
9446
  */
@@ -9530,33 +9533,9 @@ export type SiteAttributes = {
9530
9533
  export type SiteRelationships = {
9531
9534
  account: AccountData;
9532
9535
  /**
9533
- * The list of build trigger
9534
- */
9535
- build_triggers?: BuildTriggerData[];
9536
- /**
9537
- * The list of site menu items
9538
- */
9539
- menu_items: MenuItemData[];
9540
- /**
9541
- * The list of site SSO users
9542
- */
9543
- sso_users: SsoUserData[];
9544
- /**
9545
- * The list of site users
9546
- */
9547
- users: UserData[];
9548
- /**
9549
- * The list of site item types
9536
+ * The list item types for the site
9550
9537
  */
9551
9538
  item_types: ItemTypeData[];
9552
- /**
9553
- * Specifies the default role for newly created identity providers users
9554
- */
9555
- sso_default_role?: RoleData[];
9556
- /**
9557
- * The list of site roles
9558
- */
9559
- roles: RoleData[];
9560
9539
  };
9561
9540
 
9562
9541
  /**
@@ -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
  }