@datocms/cma-client 3.4.4 → 4.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.
@@ -540,6 +540,69 @@ export type BuildEventIdentity = string;
540
540
  * via the `definition` "type".
541
541
  */
542
542
  export type BuildTriggerType = 'build_trigger';
543
+ /**
544
+ * This interface was referenced by `BuildEvent`'s JSON-Schema
545
+ * via the `instances.hrefSchema` link.
546
+ */
547
+ export type BuildEventInstancesHrefSchema = {
548
+ /**
549
+ * Parameters to control offset-based pagination
550
+ */
551
+ page?: {
552
+ /**
553
+ * The (zero-based) offset of the first entity returned in the collection (defaults to 0)
554
+ */
555
+ offset?: number;
556
+ /**
557
+ * The maximum number of entities to return (defaults to 30, maximum is 500)
558
+ */
559
+ limit?: number;
560
+ };
561
+ /**
562
+ * Attributes to filter
563
+ */
564
+ filter?: {
565
+ /**
566
+ * IDs to fetch, comma separated
567
+ */
568
+ ids?: string;
569
+ fields?: {
570
+ build_trigger_id?: {
571
+ eq?: string;
572
+ };
573
+ event_type?: {
574
+ /**
575
+ * The type of activity
576
+ */
577
+ eq?:
578
+ | 'request_success'
579
+ | 'request_failure'
580
+ | 'response_success'
581
+ | 'response_failure'
582
+ | 'request_aborted'
583
+ | 'response_unprocessable'
584
+ | 'indexing_started'
585
+ | 'indexing_success'
586
+ | 'indexing_failure';
587
+ };
588
+ created_at?: {
589
+ gt?: string;
590
+ lt?: string;
591
+ };
592
+ };
593
+ };
594
+ /**
595
+ * Fields used to order results
596
+ */
597
+ order_by?:
598
+ | 'build_trigger_id_asc'
599
+ | 'build_trigger_id_desc'
600
+ | 'created_at_asc'
601
+ | 'created_at_desc'
602
+ | 'event_type_asc'
603
+ | 'event_type_desc';
604
+ [k: string]: unknown;
605
+ };
543
606
  /**
544
607
  * This interface was referenced by `Item`'s JSON-Schema
545
608
  * via the `instances.hrefSchema` link.
@@ -4442,13 +4505,25 @@ export type ItemTypeRelationships = {
4442
4505
  data: FieldsetData[];
4443
4506
  };
4444
4507
  /**
4445
- * The field to use as display title
4508
+ * The field to use as presentation title
4509
+ */
4510
+ presentation_title_field: {
4511
+ data: FieldData | null;
4512
+ };
4513
+ /**
4514
+ * The field to use as presentation image
4515
+ */
4516
+ presentation_image_field: {
4517
+ data: FieldData | null;
4518
+ };
4519
+ /**
4520
+ * The field to use as fallback title for SEO purposes
4446
4521
  */
4447
4522
  title_field: {
4448
4523
  data: FieldData | null;
4449
4524
  };
4450
4525
  /**
4451
- * The field to use as preview image
4526
+ * The field to use as fallback image for SEO purposes
4452
4527
  */
4453
4528
  image_preview_field: {
4454
4529
  data: FieldData | null;
@@ -4616,13 +4691,25 @@ export type ItemTypeCreateSchema = {
4616
4691
  data: FieldData | null;
4617
4692
  };
4618
4693
  /**
4619
- * The field to use as display title
4694
+ * The field to use as presentation title
4695
+ */
4696
+ presentation_title_field?: {
4697
+ data: FieldData | null;
4698
+ };
4699
+ /**
4700
+ * The field to use as presentation image
4701
+ */
4702
+ presentation_image_field?: {
4703
+ data: FieldData | null;
4704
+ };
4705
+ /**
4706
+ * The field to use as fallback title for SEO purposes
4620
4707
  */
4621
4708
  title_field?: {
4622
4709
  data: FieldData | null;
4623
4710
  };
4624
4711
  /**
4625
- * The field to use as preview image
4712
+ * The field to use as fallback image for SEO purposes
4626
4713
  */
4627
4714
  image_preview_field?: {
4628
4715
  data: FieldData | null;
@@ -4742,13 +4829,25 @@ export type ItemTypeUpdateSchema = {
4742
4829
  data: FieldData | null;
4743
4830
  };
4744
4831
  /**
4745
- * The field to use as display title
4832
+ * The field to use as presentation title
4833
+ */
4834
+ presentation_title_field?: {
4835
+ data: FieldData | null;
4836
+ };
4837
+ /**
4838
+ * The field to use as presentation image
4839
+ */
4840
+ presentation_image_field?: {
4841
+ data: FieldData | null;
4842
+ };
4843
+ /**
4844
+ * The field to use as fallback title for SEO purposes
4746
4845
  */
4747
4846
  title_field?: {
4748
4847
  data: FieldData | null;
4749
4848
  };
4750
4849
  /**
4751
- * The field to use as preview image
4850
+ * The field to use as fallback image for SEO purposes
4752
4851
  */
4753
4852
  image_preview_field?: {
4754
4853
  data: FieldData | null;
@@ -7122,6 +7221,9 @@ export type BuildEventData = {
7122
7221
  */
7123
7222
  export type BuildEventInstancesTargetSchema = {
7124
7223
  data: BuildEvent[];
7224
+ meta: {
7225
+ total_count: number;
7226
+ };
7125
7227
  };
7126
7228
 
7127
7229
  /**
@@ -722,6 +722,69 @@ export type BuildTriggerType = 'build_trigger';
722
722
  * via the `instances.targetSchema` link.
723
723
  */
724
724
  export type BuildEventInstancesTargetSchema = BuildEvent[];
725
+ /**
726
+ * This interface was referenced by `BuildEvent`'s JSON-Schema
727
+ * via the `instances.hrefSchema` link.
728
+ */
729
+ export type BuildEventInstancesHrefSchema = {
730
+ /**
731
+ * Parameters to control offset-based pagination
732
+ */
733
+ page?: {
734
+ /**
735
+ * The (zero-based) offset of the first entity returned in the collection (defaults to 0)
736
+ */
737
+ offset?: number;
738
+ /**
739
+ * The maximum number of entities to return (defaults to 30, maximum is 500)
740
+ */
741
+ limit?: number;
742
+ };
743
+ /**
744
+ * Attributes to filter
745
+ */
746
+ filter?: {
747
+ /**
748
+ * IDs to fetch, comma separated
749
+ */
750
+ ids?: string;
751
+ fields?: {
752
+ build_trigger_id?: {
753
+ eq?: string;
754
+ };
755
+ event_type?: {
756
+ /**
757
+ * The type of activity
758
+ */
759
+ eq?:
760
+ | 'request_success'
761
+ | 'request_failure'
762
+ | 'response_success'
763
+ | 'response_failure'
764
+ | 'request_aborted'
765
+ | 'response_unprocessable'
766
+ | 'indexing_started'
767
+ | 'indexing_success'
768
+ | 'indexing_failure';
769
+ };
770
+ created_at?: {
771
+ gt?: string;
772
+ lt?: string;
773
+ };
774
+ };
775
+ };
776
+ /**
777
+ * Fields used to order results
778
+ */
779
+ order_by?:
780
+ | 'build_trigger_id_asc'
781
+ | 'build_trigger_id_desc'
782
+ | 'created_at_asc'
783
+ | 'created_at_desc'
784
+ | 'event_type_asc'
785
+ | 'event_type_desc';
786
+ [k: string]: unknown;
787
+ };
725
788
  /**
726
789
  * This interface was referenced by `Item`'s JSON-Schema
727
790
  * via the `instances.targetSchema` link.
@@ -4873,6 +4936,8 @@ export type ItemType = {
4873
4936
  singleton_item: ItemData | null;
4874
4937
  fields: FieldData[];
4875
4938
  fieldsets: FieldsetData[];
4939
+ presentation_title_field: FieldData | null;
4940
+ presentation_image_field: FieldData | null;
4876
4941
  title_field: FieldData | null;
4877
4942
  image_preview_field: FieldData | null;
4878
4943
  excerpt_field: FieldData | null;
@@ -5030,6 +5095,8 @@ export type ItemTypeRelationships = {
5030
5095
  singleton_item: ItemData | null;
5031
5096
  fields: FieldData[];
5032
5097
  fieldsets: FieldsetData[];
5098
+ presentation_title_field: FieldData | null;
5099
+ presentation_image_field: FieldData | null;
5033
5100
  title_field: FieldData | null;
5034
5101
  image_preview_field: FieldData | null;
5035
5102
  excerpt_field: FieldData | null;
@@ -5110,6 +5177,8 @@ export type ItemTypeCreateSchema = {
5110
5177
  */
5111
5178
  inverse_relationships_enabled?: boolean;
5112
5179
  ordering_field?: FieldData | null;
5180
+ presentation_title_field?: FieldData | null;
5181
+ presentation_image_field?: FieldData | null;
5113
5182
  title_field?: FieldData | null;
5114
5183
  image_preview_field?: FieldData | null;
5115
5184
  excerpt_field?: FieldData | null;
@@ -5193,6 +5262,8 @@ export type ItemTypeUpdateSchema = {
5193
5262
  */
5194
5263
  inverse_relationships_enabled?: boolean;
5195
5264
  ordering_field?: FieldData | null;
5265
+ presentation_title_field?: FieldData | null;
5266
+ presentation_image_field?: FieldData | null;
5196
5267
  title_field?: FieldData | null;
5197
5268
  image_preview_field?: FieldData | null;
5198
5269
  excerpt_field?: FieldData | null;
@@ -14,8 +14,8 @@ export default class BuildEvent extends BaseResource {
14
14
  * @throws {ApiError}
15
15
  * @throws {TimeoutError}
16
16
  */
17
- list() {
18
- return this.rawList().then((body) =>
17
+ list(queryParams?: SimpleSchemaTypes.BuildEventInstancesHrefSchema) {
18
+ return this.rawList(queryParams).then((body) =>
19
19
  Utils.deserializeResponseBody<SimpleSchemaTypes.BuildEventInstancesTargetSchema>(
20
20
  body,
21
21
  ),
@@ -30,13 +30,71 @@ export default class BuildEvent extends BaseResource {
30
30
  * @throws {ApiError}
31
31
  * @throws {TimeoutError}
32
32
  */
33
- rawList(): Promise<SchemaTypes.BuildEventInstancesTargetSchema> {
33
+ rawList(
34
+ queryParams?: SchemaTypes.BuildEventInstancesHrefSchema,
35
+ ): Promise<SchemaTypes.BuildEventInstancesTargetSchema> {
34
36
  return this.client.request<SchemaTypes.BuildEventInstancesTargetSchema>({
35
37
  method: 'GET',
36
38
  url: '/build-events',
39
+ queryParams,
37
40
  });
38
41
  }
39
42
 
43
+ /**
44
+ * Async iterator to auto-paginate over elements returned by list()
45
+ *
46
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/build-event/instances
47
+ *
48
+ * @throws {ApiError}
49
+ * @throws {TimeoutError}
50
+ */
51
+ async *listPagedIterator(
52
+ queryParams?: Utils.OmitFromKnownKeys<
53
+ SimpleSchemaTypes.BuildEventInstancesHrefSchema,
54
+ 'page'
55
+ >,
56
+ iteratorOptions?: Utils.IteratorOptions,
57
+ ) {
58
+ for await (const element of this.rawListPagedIterator(
59
+ queryParams,
60
+ iteratorOptions,
61
+ )) {
62
+ yield Utils.deserializeJsonEntity<
63
+ SimpleSchemaTypes.BuildEventInstancesTargetSchema[0]
64
+ >(element);
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Async iterator to auto-paginate over elements returned by rawList()
70
+ *
71
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/build-event/instances
72
+ *
73
+ * @throws {ApiError}
74
+ * @throws {TimeoutError}
75
+ */
76
+ rawListPagedIterator(
77
+ queryParams?: Utils.OmitFromKnownKeys<
78
+ SchemaTypes.BuildEventInstancesHrefSchema,
79
+ 'page'
80
+ >,
81
+ iteratorOptions?: Utils.IteratorOptions,
82
+ ) {
83
+ Utils.warnOnPageQueryParam(queryParams);
84
+
85
+ return Utils.rawPageIterator<
86
+ SchemaTypes.BuildEventInstancesTargetSchema['data'][0]
87
+ >(
88
+ {
89
+ defaultLimit: 30,
90
+ maxLimit: 500,
91
+ },
92
+ (page: SchemaTypes.BuildEventInstancesHrefSchema['page']) =>
93
+ this.rawList({ ...queryParams, page }),
94
+ iteratorOptions,
95
+ );
96
+ }
97
+
40
98
  /**
41
99
  * Retrieve a deploy event
42
100
  *
@@ -40,6 +40,8 @@ export default class ItemType extends BaseResource {
40
40
  ],
41
41
  relationships: [
42
42
  'ordering_field',
43
+ 'presentation_title_field',
44
+ 'presentation_image_field',
43
45
  'title_field',
44
46
  'image_preview_field',
45
47
  'excerpt_field',
@@ -111,6 +113,8 @@ export default class ItemType extends BaseResource {
111
113
  ],
112
114
  relationships: [
113
115
  'ordering_field',
116
+ 'presentation_title_field',
117
+ 'presentation_image_field',
114
118
  'title_field',
115
119
  'image_preview_field',
116
120
  'excerpt_field',