@datocms/cma-client 1.0.1 → 1.1.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.
@@ -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
  /**
@@ -3568,6 +3580,10 @@ export type SitePlan = {
3568
3580
  * Whether or not use a static IP when sending webhooks
3569
3581
  */
3570
3582
  static_webhooks_ip: boolean;
3583
+ /**
3584
+ * Maximum size in bytes for a single file upload
3585
+ */
3586
+ maximum_single_upload_bytes: number;
3571
3587
  /**
3572
3588
  * Available extra packets
3573
3589
  */
@@ -3790,6 +3806,10 @@ export type SitePlanAttributes = {
3790
3806
  * Whether or not use a static IP when sending webhooks
3791
3807
  */
3792
3808
  static_webhooks_ip: boolean;
3809
+ /**
3810
+ * Maximum size in bytes for a single file upload
3811
+ */
3812
+ maximum_single_upload_bytes: number;
3793
3813
  /**
3794
3814
  * Available extra packets
3795
3815
  */
@@ -7498,11 +7518,11 @@ export type SearchResult = {
7498
7518
  id: SearchResultIdentity;
7499
7519
  type: SearchResultType;
7500
7520
  /**
7501
- * Page title
7521
+ * Title of the page
7502
7522
  */
7503
7523
  title: string;
7504
7524
  /**
7505
- * First lines of body
7525
+ * First 200 characters of page body, unformatted
7506
7526
  */
7507
7527
  body_excerpt: string;
7508
7528
  /**
@@ -7510,7 +7530,7 @@ export type SearchResult = {
7510
7530
  */
7511
7531
  url: string;
7512
7532
  /**
7513
- * Score
7533
+ * Search score
7514
7534
  */
7515
7535
  score: number;
7516
7536
  highlight: {
@@ -7538,11 +7558,11 @@ export type SearchResultData = {
7538
7558
  */
7539
7559
  export type SearchResultAttributes = {
7540
7560
  /**
7541
- * Page title
7561
+ * Title of the page
7542
7562
  */
7543
7563
  title: string;
7544
7564
  /**
7545
- * First lines of body
7565
+ * First 200 characters of page body, unformatted
7546
7566
  */
7547
7567
  body_excerpt: string;
7548
7568
  /**
@@ -7550,7 +7570,7 @@ export type SearchResultAttributes = {
7550
7570
  */
7551
7571
  url: string;
7552
7572
  /**
7553
- * Score
7573
+ * Search score
7554
7574
  */
7555
7575
  score: number;
7556
7576
  highlight: {
@@ -8897,6 +8917,7 @@ export type PublicInfo = {
8897
8917
  extras: null | {
8898
8918
  blocks_depth: number;
8899
8919
  blocks_per_item: number;
8920
+ maximum_single_upload_bytes: number;
8900
8921
  [k: string]: unknown;
8901
8922
  };
8902
8923
  };
@@ -8979,6 +9000,7 @@ export type PublicInfoAttributes = {
8979
9000
  extras: null | {
8980
9001
  blocks_depth: number;
8981
9002
  blocks_per_item: number;
9003
+ maximum_single_upload_bytes: number;
8982
9004
  [k: string]: unknown;
8983
9005
  };
8984
9006
  };
@@ -341,7 +341,7 @@ export default class Item extends BaseResource {
341
341
  *
342
342
  * @deprecated This API call is to be considered private and might change without notice
343
343
  */
344
- batchDestroy(queryParams?: SimpleSchemaTypes.ItemBatchDestroyHrefSchema) {
344
+ batchDestroy(queryParams: SimpleSchemaTypes.ItemBatchDestroyHrefSchema) {
345
345
  return this.rawBatchDestroy(queryParams).then((body) =>
346
346
  Utils.deserializeResponseBody<SimpleSchemaTypes.ItemBatchDestroyJobSchema>(
347
347
  body,
@@ -357,7 +357,7 @@ export default class Item extends BaseResource {
357
357
  * @deprecated This API call is to be considered private and might change without notice
358
358
  */
359
359
  rawBatchDestroy(
360
- queryParams?: SchemaTypes.ItemBatchDestroyHrefSchema,
360
+ queryParams: SchemaTypes.ItemBatchDestroyHrefSchema,
361
361
  ): Promise<SchemaTypes.ItemBatchDestroyJobSchema> {
362
362
  return this.client.request<SchemaTypes.ItemBatchDestroyJobSchema>({
363
363
  method: 'DELETE',
@@ -373,7 +373,7 @@ export default class Item extends BaseResource {
373
373
  *
374
374
  * @deprecated This API call is to be considered private and might change without notice
375
375
  */
376
- batchPublish(queryParams?: SimpleSchemaTypes.ItemBatchPublishHrefSchema) {
376
+ batchPublish(queryParams: SimpleSchemaTypes.ItemBatchPublishHrefSchema) {
377
377
  return this.rawBatchPublish(queryParams).then((body) =>
378
378
  Utils.deserializeResponseBody<SimpleSchemaTypes.ItemBatchPublishJobSchema>(
379
379
  body,
@@ -389,7 +389,7 @@ export default class Item extends BaseResource {
389
389
  * @deprecated This API call is to be considered private and might change without notice
390
390
  */
391
391
  rawBatchPublish(
392
- queryParams?: SchemaTypes.ItemBatchPublishHrefSchema,
392
+ queryParams: SchemaTypes.ItemBatchPublishHrefSchema,
393
393
  ): Promise<SchemaTypes.ItemBatchPublishJobSchema> {
394
394
  return this.client.request<SchemaTypes.ItemBatchPublishJobSchema>({
395
395
  method: 'PUT',
@@ -405,7 +405,7 @@ export default class Item extends BaseResource {
405
405
  *
406
406
  * @deprecated This API call is to be considered private and might change without notice
407
407
  */
408
- batchUnpublish(queryParams?: SimpleSchemaTypes.ItemBatchUnpublishHrefSchema) {
408
+ batchUnpublish(queryParams: SimpleSchemaTypes.ItemBatchUnpublishHrefSchema) {
409
409
  return this.rawBatchUnpublish(queryParams).then((body) =>
410
410
  Utils.deserializeResponseBody<SimpleSchemaTypes.ItemBatchUnpublishJobSchema>(
411
411
  body,
@@ -421,7 +421,7 @@ export default class Item extends BaseResource {
421
421
  * @deprecated This API call is to be considered private and might change without notice
422
422
  */
423
423
  rawBatchUnpublish(
424
- queryParams?: SchemaTypes.ItemBatchUnpublishHrefSchema,
424
+ queryParams: SchemaTypes.ItemBatchUnpublishHrefSchema,
425
425
  ): Promise<SchemaTypes.ItemBatchUnpublishJobSchema> {
426
426
  return this.client.request<SchemaTypes.ItemBatchUnpublishJobSchema>({
427
427
  method: 'PUT',
@@ -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,44 @@ 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) => this.rawList({ ...queryParams, page }),
73
+ iteratorOptions,
74
+ );
75
+ }
36
76
  }