@datocms/cma-client 3.3.5 → 3.3.7

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.
@@ -664,7 +664,6 @@ export type ItemInstancesHrefSchema = {
664
664
  * The maximum number of entities to return (defaults to 30, maximum is 500)
665
665
  */
666
666
  limit?: number;
667
- [k: string]: unknown;
668
667
  };
669
668
  /**
670
669
  * 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.
@@ -918,7 +917,6 @@ export type ItemVersionInstancesHrefSchema = {
918
917
  * The maximum number of entities to return (defaults to 15, maximum is 50)
919
918
  */
920
919
  limit?: number;
921
- [k: string]: unknown;
922
920
  };
923
921
  [k: string]: unknown;
924
922
  };
@@ -987,7 +985,6 @@ export type UploadInstancesHrefSchema = {
987
985
  * The maximum number of entities to return (defaults to 30, maximum is 500)
988
986
  */
989
987
  limit?: number;
990
- [k: string]: unknown;
991
988
  };
992
989
  [k: string]: unknown;
993
990
  };
@@ -1125,7 +1122,6 @@ export type SearchResultInstancesHrefSchema = {
1125
1122
  * The maximum number of entities to return (defaults to 20, maximum is 100)
1126
1123
  */
1127
1124
  limit?: number;
1128
- [k: string]: unknown;
1129
1125
  };
1130
1126
  /**
1131
1127
  * Attributes to filter search results
@@ -1273,8 +1269,82 @@ export type WebhookCallInstancesHrefSchema = {
1273
1269
  * The maximum number of entities to return (defaults to 30, maximum is 500)
1274
1270
  */
1275
1271
  limit?: number;
1276
- [k: string]: unknown;
1277
1272
  };
1273
+ /**
1274
+ * Attributes to filter
1275
+ */
1276
+ filter?: {
1277
+ /**
1278
+ * IDs to fetch, comma separated
1279
+ */
1280
+ ids?: string;
1281
+ fields?: {
1282
+ webhook_id?: {
1283
+ eq?: string;
1284
+ };
1285
+ entity_type?: {
1286
+ /**
1287
+ * The subject of webhook triggering
1288
+ */
1289
+ eq?:
1290
+ | 'item_type'
1291
+ | 'item'
1292
+ | 'upload'
1293
+ | 'build_trigger'
1294
+ | 'environment'
1295
+ | 'maintenance_mode'
1296
+ | 'sso_user'
1297
+ | 'cda_cache_tags';
1298
+ };
1299
+ event_type?: {
1300
+ /**
1301
+ * The event that triggers the webhook call
1302
+ */
1303
+ eq?:
1304
+ | 'create'
1305
+ | 'update'
1306
+ | 'delete'
1307
+ | 'publish'
1308
+ | 'unpublish'
1309
+ | 'promote'
1310
+ | 'deploy_started'
1311
+ | 'deploy_succeeded'
1312
+ | 'deploy_failed'
1313
+ | 'change'
1314
+ | 'invalidate';
1315
+ };
1316
+ status?: {
1317
+ /**
1318
+ * The current status
1319
+ */
1320
+ eq?: 'pending' | 'success' | 'failed' | 'rescheduled';
1321
+ };
1322
+ last_sent_at?: {
1323
+ gt?: string;
1324
+ lt?: string;
1325
+ };
1326
+ next_retry_at?: {
1327
+ gt?: string;
1328
+ lt?: string;
1329
+ };
1330
+ created_at?: {
1331
+ gt?: string;
1332
+ lt?: string;
1333
+ };
1334
+ };
1335
+ };
1336
+ /**
1337
+ * Fields used to order results
1338
+ */
1339
+ order_by?:
1340
+ | 'webhook_id_asc'
1341
+ | 'webhook_id_desc'
1342
+ | 'created_at_asc'
1343
+ | 'created_at_desc'
1344
+ | 'last_sent_at_asc'
1345
+ | 'last_sent_at_desc'
1346
+ | 'next_retry_at_asc'
1347
+ | 'next_retry_at_desc';
1278
1348
  [k: string]: unknown;
1279
1349
  };
1280
1350
  /**
@@ -1588,7 +1658,6 @@ export type UploadTagInstancesHrefSchema = {
1588
1658
  * The maximum number of entities to return (defaults to 50, maximum is 500)
1589
1659
  */
1590
1660
  limit?: number;
1591
- [k: string]: unknown;
1592
1661
  };
1593
1662
  [k: string]: unknown;
1594
1663
  };
@@ -1639,7 +1708,6 @@ export type UploadSmartTagInstancesHrefSchema = {
1639
1708
  * The maximum number of entities to return (defaults to 50, maximum is 500)
1640
1709
  */
1641
1710
  limit?: number;
1642
- [k: string]: unknown;
1643
1711
  };
1644
1712
  [k: string]: unknown;
1645
1713
  };
@@ -8675,12 +8743,46 @@ export type Webhook = {
8675
8743
  * Additional headers that will be sent
8676
8744
  */
8677
8745
  headers: {
8678
- [k: string]: unknown;
8746
+ [k: string]: string;
8679
8747
  };
8680
- /**
8681
- * All the events you will be notified for
8682
- */
8683
- events: unknown[];
8748
+ events: {
8749
+ /**
8750
+ * The subject of webhook triggering
8751
+ */
8752
+ entity_type:
8753
+ | 'item_type'
8754
+ | 'item'
8755
+ | 'upload'
8756
+ | 'build_trigger'
8757
+ | 'environment'
8758
+ | 'maintenance_mode'
8759
+ | 'sso_user'
8760
+ | 'cda_cache_tags';
8761
+ event_types: (
8762
+ | 'create'
8763
+ | 'update'
8764
+ | 'delete'
8765
+ | 'publish'
8766
+ | 'unpublish'
8767
+ | 'promote'
8768
+ | 'deploy_started'
8769
+ | 'deploy_succeeded'
8770
+ | 'deploy_failed'
8771
+ | 'change'
8772
+ | 'invalidate'
8773
+ )[];
8774
+ filters?:
8775
+ | {
8776
+ entity_type:
8777
+ | 'item_type'
8778
+ | 'item'
8779
+ | 'build_trigger'
8780
+ | 'environment'
8781
+ | 'environment_type';
8782
+ entity_ids: [string, ...string[]];
8783
+ }[]
8784
+ | null;
8785
+ }[];
8684
8786
  /**
8685
8787
  * Specifies which API version to use when serializing entities in the webhook payload
8686
8788
  */
@@ -8689,6 +8791,10 @@ export type Webhook = {
8689
8791
  * Whether the you want records present in the payload to show blocks expanded or not
8690
8792
  */
8691
8793
  nested_items_in_payload: boolean;
8794
+ /**
8795
+ * If enabled, the system will attempt to retry the call several times when the webhook operation fails due to timeouts or errors.
8796
+ */
8797
+ auto_retry: boolean;
8692
8798
  };
8693
8799
  export type WebhookCreateTargetSchema = Webhook;
8694
8800
  export type WebhookUpdateTargetSchema = Webhook;
@@ -8740,12 +8846,46 @@ export type WebhookAttributes = {
8740
8846
  * Additional headers that will be sent
8741
8847
  */
8742
8848
  headers: {
8743
- [k: string]: unknown;
8849
+ [k: string]: string;
8744
8850
  };
8745
- /**
8746
- * All the events you will be notified for
8747
- */
8748
- events: unknown[];
8851
+ events: {
8852
+ /**
8853
+ * The subject of webhook triggering
8854
+ */
8855
+ entity_type:
8856
+ | 'item_type'
8857
+ | 'item'
8858
+ | 'upload'
8859
+ | 'build_trigger'
8860
+ | 'environment'
8861
+ | 'maintenance_mode'
8862
+ | 'sso_user'
8863
+ | 'cda_cache_tags';
8864
+ event_types: (
8865
+ | 'create'
8866
+ | 'update'
8867
+ | 'delete'
8868
+ | 'publish'
8869
+ | 'unpublish'
8870
+ | 'promote'
8871
+ | 'deploy_started'
8872
+ | 'deploy_succeeded'
8873
+ | 'deploy_failed'
8874
+ | 'change'
8875
+ | 'invalidate'
8876
+ )[];
8877
+ filters?:
8878
+ | {
8879
+ entity_type:
8880
+ | 'item_type'
8881
+ | 'item'
8882
+ | 'build_trigger'
8883
+ | 'environment'
8884
+ | 'environment_type';
8885
+ entity_ids: [string, ...string[]];
8886
+ }[]
8887
+ | null;
8888
+ }[];
8749
8889
  /**
8750
8890
  * Specifies which API version to use when serializing entities in the webhook payload
8751
8891
  */
@@ -8754,6 +8894,10 @@ export type WebhookAttributes = {
8754
8894
  * Whether the you want records present in the payload to show blocks expanded or not
8755
8895
  */
8756
8896
  nested_items_in_payload: boolean;
8897
+ /**
8898
+ * If enabled, the system will attempt to retry the call several times when the webhook operation fails due to timeouts or errors.
8899
+ */
8900
+ auto_retry: boolean;
8757
8901
  };
8758
8902
 
8759
8903
  /**
@@ -8778,12 +8922,46 @@ export type WebhookCreateSchema = {
8778
8922
  * Additional headers that will be sent
8779
8923
  */
8780
8924
  headers: {
8781
- [k: string]: unknown;
8925
+ [k: string]: string;
8782
8926
  };
8783
- /**
8784
- * All the events you will be notified for
8785
- */
8786
- events: unknown[];
8927
+ events: {
8928
+ /**
8929
+ * The subject of webhook triggering
8930
+ */
8931
+ entity_type:
8932
+ | 'item_type'
8933
+ | 'item'
8934
+ | 'upload'
8935
+ | 'build_trigger'
8936
+ | 'environment'
8937
+ | 'maintenance_mode'
8938
+ | 'sso_user'
8939
+ | 'cda_cache_tags';
8940
+ event_types: (
8941
+ | 'create'
8942
+ | 'update'
8943
+ | 'delete'
8944
+ | 'publish'
8945
+ | 'unpublish'
8946
+ | 'promote'
8947
+ | 'deploy_started'
8948
+ | 'deploy_succeeded'
8949
+ | 'deploy_failed'
8950
+ | 'change'
8951
+ | 'invalidate'
8952
+ )[];
8953
+ filters?:
8954
+ | {
8955
+ entity_type:
8956
+ | 'item_type'
8957
+ | 'item'
8958
+ | 'build_trigger'
8959
+ | 'environment'
8960
+ | 'environment_type';
8961
+ entity_ids: [string, ...string[]];
8962
+ }[]
8963
+ | null;
8964
+ }[];
8787
8965
  /**
8788
8966
  * HTTP Basic Authorization username
8789
8967
  */
@@ -8804,6 +8982,10 @@ export type WebhookCreateSchema = {
8804
8982
  * Whether the you want records present in the payload to show blocks expanded or not
8805
8983
  */
8806
8984
  nested_items_in_payload?: boolean;
8985
+ /**
8986
+ * If enabled, the system will attempt to retry the call several times when the webhook operation fails due to timeouts or errors.
8987
+ */
8988
+ auto_retry?: boolean;
8807
8989
  };
8808
8990
 
8809
8991
  /**
@@ -8829,12 +9011,46 @@ export type WebhookUpdateSchema = {
8829
9011
  * Additional headers that will be sent
8830
9012
  */
8831
9013
  headers?: {
8832
- [k: string]: unknown;
9014
+ [k: string]: string;
8833
9015
  };
8834
- /**
8835
- * All the events you will be notified for
8836
- */
8837
- events?: unknown[];
9016
+ events?: {
9017
+ /**
9018
+ * The subject of webhook triggering
9019
+ */
9020
+ entity_type:
9021
+ | 'item_type'
9022
+ | 'item'
9023
+ | 'upload'
9024
+ | 'build_trigger'
9025
+ | 'environment'
9026
+ | 'maintenance_mode'
9027
+ | 'sso_user'
9028
+ | 'cda_cache_tags';
9029
+ event_types: (
9030
+ | 'create'
9031
+ | 'update'
9032
+ | 'delete'
9033
+ | 'publish'
9034
+ | 'unpublish'
9035
+ | 'promote'
9036
+ | 'deploy_started'
9037
+ | 'deploy_succeeded'
9038
+ | 'deploy_failed'
9039
+ | 'change'
9040
+ | 'invalidate'
9041
+ )[];
9042
+ filters?:
9043
+ | {
9044
+ entity_type:
9045
+ | 'item_type'
9046
+ | 'item'
9047
+ | 'build_trigger'
9048
+ | 'environment'
9049
+ | 'environment_type';
9050
+ entity_ids: [string, ...string[]];
9051
+ }[]
9052
+ | null;
9053
+ }[];
8838
9054
  /**
8839
9055
  * HTTP Basic Authorization username
8840
9056
  */
@@ -8855,6 +9071,10 @@ export type WebhookUpdateSchema = {
8855
9071
  * Whether the you want records present in the payload to show blocks expanded or not
8856
9072
  */
8857
9073
  nested_items_in_payload?: boolean;
9074
+ /**
9075
+ * If enabled, the system will attempt to retry the call several times when the webhook operation fails due to timeouts or errors.
9076
+ */
9077
+ auto_retry?: boolean;
8858
9078
  };
8859
9079
 
8860
9080
  /**
@@ -8869,13 +9089,32 @@ export type WebhookCall = {
8869
9089
  /**
8870
9090
  * The subject of webhook triggering
8871
9091
  */
8872
- entity_type: 'item' | 'item_type' | 'upload';
9092
+ entity_type:
9093
+ | 'item_type'
9094
+ | 'item'
9095
+ | 'upload'
9096
+ | 'build_trigger'
9097
+ | 'environment'
9098
+ | 'maintenance_mode'
9099
+ | 'sso_user'
9100
+ | 'cda_cache_tags';
8873
9101
  /**
8874
9102
  * The event that triggers the webhook call
8875
9103
  */
8876
- event_type: 'create' | 'update' | 'delete' | 'publish' | 'unpublish';
8877
- /**
8878
- * The moment the call occurred
9104
+ event_type:
9105
+ | 'create'
9106
+ | 'update'
9107
+ | 'delete'
9108
+ | 'publish'
9109
+ | 'unpublish'
9110
+ | 'promote'
9111
+ | 'deploy_started'
9112
+ | 'deploy_succeeded'
9113
+ | 'deploy_failed'
9114
+ | 'change'
9115
+ | 'invalidate';
9116
+ /**
9117
+ * The moment the event was created
8879
9118
  */
8880
9119
  created_at: string;
8881
9120
  /**
@@ -8901,14 +9140,30 @@ export type WebhookCall = {
8901
9140
  */
8902
9141
  response_headers: {
8903
9142
  [k: string]: unknown;
8904
- };
9143
+ } | null;
8905
9144
  /**
8906
9145
  * The body of the response
8907
9146
  */
8908
9147
  response_payload: string | null;
9148
+ /**
9149
+ * The number of retries attempted so far
9150
+ */
9151
+ attempted_auto_retries_count: number;
9152
+ /**
9153
+ * The last moment the call occurred
9154
+ */
9155
+ last_sent_at: string;
9156
+ /**
9157
+ * The date when the next retry attempt is scheduled to run. If no retry attempt is scheduled, it is set to null
9158
+ */
9159
+ next_retry_at: string | null;
9160
+ /**
9161
+ * The current status
9162
+ */
9163
+ status: 'pending' | 'success' | 'failed' | 'rescheduled';
8909
9164
  webhook: WebhookData;
8910
9165
  };
8911
-
9166
+ export type WebhookCallSelfTargetSchema = WebhookCall;
8912
9167
  /**
8913
9168
  * JSON API data
8914
9169
  *
@@ -8930,13 +9185,32 @@ export type WebhookCallAttributes = {
8930
9185
  /**
8931
9186
  * The subject of webhook triggering
8932
9187
  */
8933
- entity_type: 'item' | 'item_type' | 'upload';
9188
+ entity_type:
9189
+ | 'item_type'
9190
+ | 'item'
9191
+ | 'upload'
9192
+ | 'build_trigger'
9193
+ | 'environment'
9194
+ | 'maintenance_mode'
9195
+ | 'sso_user'
9196
+ | 'cda_cache_tags';
8934
9197
  /**
8935
9198
  * The event that triggers the webhook call
8936
9199
  */
8937
- event_type: 'create' | 'update' | 'delete' | 'publish' | 'unpublish';
8938
- /**
8939
- * The moment the call occurred
9200
+ event_type:
9201
+ | 'create'
9202
+ | 'update'
9203
+ | 'delete'
9204
+ | 'publish'
9205
+ | 'unpublish'
9206
+ | 'promote'
9207
+ | 'deploy_started'
9208
+ | 'deploy_succeeded'
9209
+ | 'deploy_failed'
9210
+ | 'change'
9211
+ | 'invalidate';
9212
+ /**
9213
+ * The moment the event was created
8940
9214
  */
8941
9215
  created_at: string;
8942
9216
  /**
@@ -8962,11 +9236,27 @@ export type WebhookCallAttributes = {
8962
9236
  */
8963
9237
  response_headers: {
8964
9238
  [k: string]: unknown;
8965
- };
9239
+ } | null;
8966
9240
  /**
8967
9241
  * The body of the response
8968
9242
  */
8969
9243
  response_payload: string | null;
9244
+ /**
9245
+ * The number of retries attempted so far
9246
+ */
9247
+ attempted_auto_retries_count: number;
9248
+ /**
9249
+ * The last moment the call occurred
9250
+ */
9251
+ last_sent_at: string;
9252
+ /**
9253
+ * The date when the next retry attempt is scheduled to run. If no retry attempt is scheduled, it is set to null
9254
+ */
9255
+ next_retry_at: string | null;
9256
+ /**
9257
+ * The current status
9258
+ */
9259
+ status: 'pending' | 'success' | 'failed' | 'rescheduled';
8970
9260
  };
8971
9261
 
8972
9262
  /**
@@ -29,6 +29,7 @@ export default class Webhook extends BaseResource {
29
29
  'enabled',
30
30
  'payload_api_version',
31
31
  'nested_items_in_payload',
32
+ 'auto_retry',
32
33
  ],
33
34
  relationships: [],
34
35
  }),
@@ -85,6 +86,7 @@ export default class Webhook extends BaseResource {
85
86
  'enabled',
86
87
  'payload_api_version',
87
88
  'nested_items_in_payload',
89
+ 'auto_retry',
88
90
  ],
89
91
  relationships: [],
90
92
  }),
@@ -95,6 +95,39 @@ export default class WebhookCall extends BaseResource {
95
95
  );
96
96
  }
97
97
 
98
+ /**
99
+ * Retrieve a webhook call
100
+ *
101
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/webhook-call/self
102
+ *
103
+ * @throws {ApiError}
104
+ * @throws {TimeoutError}
105
+ */
106
+ find(webhookCallId: string | SimpleSchemaTypes.WebhookCallData) {
107
+ return this.rawFind(Utils.toId(webhookCallId)).then((body) =>
108
+ Utils.deserializeResponseBody<SimpleSchemaTypes.WebhookCallSelfTargetSchema>(
109
+ body,
110
+ ),
111
+ );
112
+ }
113
+
114
+ /**
115
+ * Retrieve a webhook call
116
+ *
117
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/webhook-call/self
118
+ *
119
+ * @throws {ApiError}
120
+ * @throws {TimeoutError}
121
+ */
122
+ rawFind(
123
+ webhookCallId: string,
124
+ ): Promise<SchemaTypes.WebhookCallSelfTargetSchema> {
125
+ return this.client.request<SchemaTypes.WebhookCallSelfTargetSchema>({
126
+ method: 'GET',
127
+ url: `/webhook_calls/${webhookCallId}`,
128
+ });
129
+ }
130
+
98
131
  /**
99
132
  * Re-send the webhook call
100
133
  *