@datocms/cma-client 3.2.1 → 3.3.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 (29) hide show
  1. package/dist/cjs/generated/Client.js +2 -1
  2. package/dist/cjs/generated/Client.js.map +1 -1
  3. package/dist/cjs/generated/resources/UploadTrack.js +183 -0
  4. package/dist/cjs/generated/resources/UploadTrack.js.map +1 -0
  5. package/dist/cjs/generated/resources/index.js +3 -1
  6. package/dist/cjs/generated/resources/index.js.map +1 -1
  7. package/dist/esm/generated/Client.d.ts +1 -0
  8. package/dist/esm/generated/Client.js +2 -1
  9. package/dist/esm/generated/Client.js.map +1 -1
  10. package/dist/esm/generated/SchemaTypes.d.ts +191 -0
  11. package/dist/esm/generated/SimpleSchemaTypes.d.ts +181 -0
  12. package/dist/esm/generated/resources/UploadTrack.d.ts +82 -0
  13. package/dist/esm/generated/resources/UploadTrack.js +155 -0
  14. package/dist/esm/generated/resources/UploadTrack.js.map +1 -0
  15. package/dist/esm/generated/resources/index.d.ts +1 -0
  16. package/dist/esm/generated/resources/index.js +1 -0
  17. package/dist/esm/generated/resources/index.js.map +1 -1
  18. package/dist/types/generated/Client.d.ts +1 -0
  19. package/dist/types/generated/SchemaTypes.d.ts +191 -0
  20. package/dist/types/generated/SimpleSchemaTypes.d.ts +181 -0
  21. package/dist/types/generated/resources/UploadTrack.d.ts +82 -0
  22. package/dist/types/generated/resources/index.d.ts +1 -0
  23. package/package.json +4 -4
  24. package/resources.json +955 -153
  25. package/src/generated/Client.ts +3 -1
  26. package/src/generated/SchemaTypes.ts +204 -0
  27. package/src/generated/SimpleSchemaTypes.ts +186 -0
  28. package/src/generated/resources/UploadTrack.ts +186 -0
  29. package/src/generated/resources/index.ts +1 -0
@@ -58,6 +58,7 @@ export class Client {
58
58
  itemVersions: Resources.ItemVersion;
59
59
  uploads: Resources.Upload;
60
60
  uploadRequest: Resources.UploadRequest;
61
+ uploadTracks: Resources.UploadTrack;
61
62
  scheduledPublication: Resources.ScheduledPublication;
62
63
  scheduledUnpublishing: Resources.ScheduledUnpublishing;
63
64
  searchResults: Resources.SearchResult;
@@ -109,6 +110,7 @@ export class Client {
109
110
  this.itemVersions = new Resources.ItemVersion(this);
110
111
  this.uploads = new Resources.Upload(this);
111
112
  this.uploadRequest = new Resources.UploadRequest(this);
113
+ this.uploadTracks = new Resources.UploadTrack(this);
112
114
  this.scheduledPublication = new Resources.ScheduledPublication(this);
113
115
  this.scheduledUnpublishing = new Resources.ScheduledUnpublishing(this);
114
116
  this.searchResults = new Resources.SearchResult(this);
@@ -143,7 +145,7 @@ export class Client {
143
145
  ...this.config,
144
146
  ...options,
145
147
  logFn: this.config.logFn || console.log,
146
- userAgent: '@datocms/cma-client v3.2.1',
148
+ userAgent: '@datocms/cma-client v3.3.1',
147
149
  baseUrl: this.baseUrl,
148
150
  preCallStack: new Error().stack,
149
151
  extraHeaders: {
@@ -896,6 +896,21 @@ export type UploadRequestType = 'upload_request';
896
896
  * via the `definition` "id".
897
897
  */
898
898
  export type UploadRequestIdentity = string;
899
+ /**
900
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
901
+ * via the `definition` "type".
902
+ */
903
+ export type UploadTrackType = 'upload_track';
904
+ /**
905
+ * ID of the upload track
906
+ *
907
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
908
+ * via the `definition` "identity".
909
+ *
910
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
911
+ * via the `definition` "id".
912
+ */
913
+ export type UploadTrackIdentity = string;
899
914
  /**
900
915
  * This interface was referenced by `SearchResult`'s JSON-Schema
901
916
  * via the `definition` "type".
@@ -1390,6 +1405,7 @@ export type DatoApi = {
1390
1405
  item_version?: ItemVersion;
1391
1406
  upload?: Upload;
1392
1407
  upload_request?: UploadRequest;
1408
+ upload_track?: UploadTrack;
1393
1409
  scheduled_publication?: ScheduledPublication;
1394
1410
  scheduled_unpublishing?: ScheduledUnpublishing;
1395
1411
  search_result?: SearchResult;
@@ -8312,6 +8328,186 @@ export type UploadRequestCreateTargetSchema = {
8312
8328
  data: UploadRequest;
8313
8329
  };
8314
8330
 
8331
+ /**
8332
+ * If the asset linked to an Upload entity is a video file, you have the option to include additional audio tracks and subtitle tracks to it.
8333
+ *
8334
+ * This interface was referenced by `DatoApi`'s JSON-Schema
8335
+ * via the `definition` "upload_track".
8336
+ */
8337
+ export type UploadTrack = {
8338
+ type: UploadTrackType;
8339
+ id: UploadTrackIdentity;
8340
+ attributes: UploadTrackAttributes;
8341
+ relationships: UploadTrackRelationships;
8342
+ };
8343
+
8344
+ /**
8345
+ * JSON API attributes
8346
+ *
8347
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
8348
+ * via the `definition` "attributes".
8349
+ */
8350
+ export type UploadTrackAttributes = {
8351
+ /**
8352
+ * The type of track (audio or subtitles)
8353
+ */
8354
+ type: 'subtitles' | 'audio';
8355
+ /**
8356
+ * The human-readable name of the track
8357
+ */
8358
+ name: string;
8359
+ /**
8360
+ * A valid BCP 47 specification compliant language code
8361
+ */
8362
+ language_code: string;
8363
+ /**
8364
+ * When status is `errored`, explains the reason for the error
8365
+ */
8366
+ error: null | string;
8367
+ /**
8368
+ * The status of the asset
8369
+ */
8370
+ status: 'preparing' | 'ready' | 'errored';
8371
+ /**
8372
+ * Indicates if the track provides subtitles for the Deaf or Hard-of-hearing (SDH)
8373
+ */
8374
+ closed_captions: null | boolean;
8375
+ };
8376
+
8377
+ /**
8378
+ * JSON API links
8379
+ *
8380
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
8381
+ * via the `definition` "relationships".
8382
+ */
8383
+ export type UploadTrackRelationships = {
8384
+ /**
8385
+ * The upload containing the track
8386
+ */
8387
+ upload: {
8388
+ data: UploadData;
8389
+ };
8390
+ };
8391
+
8392
+ /**
8393
+ * JSON API data
8394
+ *
8395
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
8396
+ * via the `definition` "data".
8397
+ */
8398
+ export type UploadTrackData = {
8399
+ type: UploadTrackType;
8400
+ id: UploadTrackIdentity;
8401
+ };
8402
+
8403
+ /**
8404
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
8405
+ * via the `create.schema` link.
8406
+ */
8407
+ export type UploadTrackCreateSchema = {
8408
+ data: {
8409
+ type: UploadTrackType;
8410
+ attributes: {
8411
+ /**
8412
+ * Either an URL to download, or the ID of an upload request
8413
+ */
8414
+ url_or_upload_request_id: string;
8415
+ /**
8416
+ * The type of track (audio or subtitles)
8417
+ */
8418
+ type: 'subtitles' | 'audio';
8419
+ /**
8420
+ * The human-readable name of the track
8421
+ */
8422
+ name?: string;
8423
+ /**
8424
+ * A valid BCP 47 specification compliant language code
8425
+ */
8426
+ language_code: string;
8427
+ /**
8428
+ * Indicates if the track provides subtitles for the Deaf or Hard-of-hearing (SDH)
8429
+ */
8430
+ closed_captions?: null | boolean;
8431
+ };
8432
+ };
8433
+ };
8434
+
8435
+ /**
8436
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
8437
+ * via the `create.targetSchema` link.
8438
+ */
8439
+ export type UploadTrackCreateTargetSchema = {
8440
+ data: Job;
8441
+ };
8442
+
8443
+ /**
8444
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
8445
+ * via the `create.jobSchema` link.
8446
+ */
8447
+ export type UploadTrackCreateJobSchema = {
8448
+ data: UploadTrack;
8449
+ };
8450
+
8451
+ /**
8452
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
8453
+ * via the `instances.targetSchema` link.
8454
+ */
8455
+ export type UploadTrackInstancesTargetSchema = {
8456
+ data: UploadTrack[];
8457
+ };
8458
+
8459
+ /**
8460
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
8461
+ * via the `destroy.targetSchema` link.
8462
+ */
8463
+ export type UploadTrackDestroyTargetSchema = {
8464
+ data: Job;
8465
+ };
8466
+
8467
+ /**
8468
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
8469
+ * via the `destroy.jobSchema` link.
8470
+ */
8471
+ export type UploadTrackDestroyJobSchema = {
8472
+ data: UploadTrack;
8473
+ };
8474
+
8475
+ /**
8476
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
8477
+ * via the `generate_subtitles.schema` link.
8478
+ */
8479
+ export type UploadTrackGenerateSubtitlesSchema = {
8480
+ data: {
8481
+ type: UploadTrackType;
8482
+ attributes: {
8483
+ /**
8484
+ * The human-readable name of the track
8485
+ */
8486
+ name?: string;
8487
+ /**
8488
+ * A valid BCP 47 specification compliant language code
8489
+ */
8490
+ language_code: string;
8491
+ };
8492
+ };
8493
+ };
8494
+
8495
+ /**
8496
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
8497
+ * via the `generate_subtitles.targetSchema` link.
8498
+ */
8499
+ export type UploadTrackGenerateSubtitlesTargetSchema = {
8500
+ data: Job;
8501
+ };
8502
+
8503
+ /**
8504
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
8505
+ * via the `generate_subtitles.jobSchema` link.
8506
+ */
8507
+ export type UploadTrackGenerateSubtitlesJobSchema = {
8508
+ data: UploadTrack;
8509
+ };
8510
+
8315
8511
  /**
8316
8512
  * DatoCMS Site Search is a way to deliver tailored search results to your site visitors. This is the endpoint you can use to query for results.
8317
8513
  *
@@ -10384,6 +10580,10 @@ export type DailyUsageAttributes = {
10384
10580
  * Content delivery API traffic
10385
10581
  */
10386
10582
  cda_traffic_bytes: number;
10583
+ /**
10584
+ * Content management API traffic
10585
+ */
10586
+ cma_traffic_bytes: number;
10387
10587
  /**
10388
10588
  * Uploads requests traffic
10389
10589
  */
@@ -10392,6 +10592,10 @@ export type DailyUsageAttributes = {
10392
10592
  * Video streaming seconds
10393
10593
  */
10394
10594
  mux_delivered_seconds: number;
10595
+ /**
10596
+ * Video encoding seconds
10597
+ */
10598
+ mux_encoded_seconds: number;
10395
10599
  };
10396
10600
 
10397
10601
  /**
@@ -1068,6 +1068,26 @@ export type UploadRequestIdentity = string;
1068
1068
  * via the `definition` "type".
1069
1069
  */
1070
1070
  export type UploadRequestType = 'upload_request';
1071
+ /**
1072
+ * ID of the upload track
1073
+ *
1074
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
1075
+ * via the `definition` "identity".
1076
+ *
1077
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
1078
+ * via the `definition` "id".
1079
+ */
1080
+ export type UploadTrackIdentity = string;
1081
+ /**
1082
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
1083
+ * via the `definition` "type".
1084
+ */
1085
+ export type UploadTrackType = 'upload_track';
1086
+ /**
1087
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
1088
+ * via the `instances.targetSchema` link.
1089
+ */
1090
+ export type UploadTrackInstancesTargetSchema = UploadTrack[];
1071
1091
  /**
1072
1092
  * ID of result
1073
1093
  *
@@ -1681,6 +1701,7 @@ export type DatoApi = {
1681
1701
  item_version?: ItemVersion;
1682
1702
  upload?: Upload;
1683
1703
  upload_request?: UploadRequest;
1704
+ upload_track?: UploadTrack;
1684
1705
  scheduled_publication?: ScheduledPublication;
1685
1706
  scheduled_unpublishing?: ScheduledUnpublishing;
1686
1707
  search_result?: SearchResult;
@@ -4777,6 +4798,15 @@ export type ItemTypeUpdateSchema = {
4777
4798
  * This interface was referenced by `Upload`'s JSON-Schema
4778
4799
  * via the `bulk_destroy.targetSchema` link.
4779
4800
  *
4801
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
4802
+ * via the `create.targetSchema` link.
4803
+ *
4804
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
4805
+ * via the `destroy.targetSchema` link.
4806
+ *
4807
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
4808
+ * via the `generate_subtitles.targetSchema` link.
4809
+ *
4780
4810
  * This interface was referenced by `Site`'s JSON-Schema
4781
4811
  * via the `update.targetSchema` link.
4782
4812
  *
@@ -4812,6 +4842,9 @@ export type UploadBatchAddTagsTargetSchema = Job;
4812
4842
  export type UploadBatchDestroyTargetSchema = Job;
4813
4843
  export type UploadBulkTagTargetSchema = Job;
4814
4844
  export type UploadBulkDestroyTargetSchema = Job;
4845
+ export type UploadTrackCreateTargetSchema = Job;
4846
+ export type UploadTrackDestroyTargetSchema = Job;
4847
+ export type UploadTrackGenerateSubtitlesTargetSchema = Job;
4815
4848
  export type SiteUpdateTargetSchema = Job;
4816
4849
  export type SiteActivateImprovedTimezoneManagementTargetSchema = Job;
4817
4850
  /**
@@ -8072,6 +8105,143 @@ export type UploadRequestCreateSchema = {
8072
8105
  filename?: string;
8073
8106
  };
8074
8107
 
8108
+ /**
8109
+ * If the asset linked to an Upload entity is a video file, you have the option to include additional audio tracks and subtitle tracks to it.
8110
+ *
8111
+ * This interface was referenced by `DatoApi`'s JSON-Schema
8112
+ * via the `definition` "upload_track".
8113
+ */
8114
+ export type UploadTrack = {
8115
+ id: UploadTrackIdentity;
8116
+ /**
8117
+ * The type of track (audio or subtitles)
8118
+ */
8119
+ type: 'subtitles' | 'audio';
8120
+ /**
8121
+ * The human-readable name of the track
8122
+ */
8123
+ name: string;
8124
+ /**
8125
+ * A valid BCP 47 specification compliant language code
8126
+ */
8127
+ language_code: string;
8128
+ /**
8129
+ * When status is `errored`, explains the reason for the error
8130
+ */
8131
+ error: null | string;
8132
+ /**
8133
+ * The status of the asset
8134
+ */
8135
+ status: 'preparing' | 'ready' | 'errored';
8136
+ /**
8137
+ * Indicates if the track provides subtitles for the Deaf or Hard-of-hearing (SDH)
8138
+ */
8139
+ closed_captions: null | boolean;
8140
+ upload: UploadData;
8141
+ };
8142
+ export type UploadTrackCreateJobSchema = UploadTrack;
8143
+ export type UploadTrackDestroyJobSchema = UploadTrack;
8144
+ export type UploadTrackGenerateSubtitlesJobSchema = UploadTrack;
8145
+ /**
8146
+ * JSON API data
8147
+ *
8148
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
8149
+ * via the `definition` "data".
8150
+ */
8151
+ export type UploadTrackData = {
8152
+ /**
8153
+ * The type of track (audio or subtitles)
8154
+ */
8155
+ type: 'subtitles' | 'audio';
8156
+ id: UploadTrackIdentity;
8157
+ };
8158
+
8159
+ /**
8160
+ * JSON API attributes
8161
+ *
8162
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
8163
+ * via the `definition` "attributes".
8164
+ */
8165
+ export type UploadTrackAttributes = {
8166
+ /**
8167
+ * The type of track (audio or subtitles)
8168
+ */
8169
+ type: 'subtitles' | 'audio';
8170
+ /**
8171
+ * The human-readable name of the track
8172
+ */
8173
+ name: string;
8174
+ /**
8175
+ * A valid BCP 47 specification compliant language code
8176
+ */
8177
+ language_code: string;
8178
+ /**
8179
+ * When status is `errored`, explains the reason for the error
8180
+ */
8181
+ error: null | string;
8182
+ /**
8183
+ * The status of the asset
8184
+ */
8185
+ status: 'preparing' | 'ready' | 'errored';
8186
+ /**
8187
+ * Indicates if the track provides subtitles for the Deaf or Hard-of-hearing (SDH)
8188
+ */
8189
+ closed_captions: null | boolean;
8190
+ };
8191
+
8192
+ /**
8193
+ * JSON API links
8194
+ *
8195
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
8196
+ * via the `definition` "relationships".
8197
+ */
8198
+ export type UploadTrackRelationships = {
8199
+ upload: UploadData;
8200
+ };
8201
+
8202
+ /**
8203
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
8204
+ * via the `create.schema` link.
8205
+ */
8206
+ export type UploadTrackCreateSchema = {
8207
+ /**
8208
+ * The type of track (audio or subtitles)
8209
+ */
8210
+ type: 'subtitles' | 'audio';
8211
+ /**
8212
+ * Either an URL to download, or the ID of an upload request
8213
+ */
8214
+ url_or_upload_request_id: string;
8215
+ /**
8216
+ * The human-readable name of the track
8217
+ */
8218
+ name?: string;
8219
+ /**
8220
+ * A valid BCP 47 specification compliant language code
8221
+ */
8222
+ language_code: string;
8223
+ /**
8224
+ * Indicates if the track provides subtitles for the Deaf or Hard-of-hearing (SDH)
8225
+ */
8226
+ closed_captions?: null | boolean;
8227
+ };
8228
+
8229
+ /**
8230
+ * This interface was referenced by `UploadTrack`'s JSON-Schema
8231
+ * via the `generate_subtitles.schema` link.
8232
+ */
8233
+ export type UploadTrackGenerateSubtitlesSchema = {
8234
+ type?: UploadTrackType;
8235
+ /**
8236
+ * The human-readable name of the track
8237
+ */
8238
+ name?: string;
8239
+ /**
8240
+ * A valid BCP 47 specification compliant language code
8241
+ */
8242
+ language_code: string;
8243
+ };
8244
+
8075
8245
  /**
8076
8246
  * You can create scheduled publication to publish records in the future
8077
8247
  *
@@ -9986,6 +10156,10 @@ export type DailyUsage = {
9986
10156
  * Content delivery API traffic
9987
10157
  */
9988
10158
  cda_traffic_bytes: number;
10159
+ /**
10160
+ * Content management API traffic
10161
+ */
10162
+ cma_traffic_bytes: number;
9989
10163
  /**
9990
10164
  * Uploads requests traffic
9991
10165
  */
@@ -9994,6 +10168,10 @@ export type DailyUsage = {
9994
10168
  * Video streaming seconds
9995
10169
  */
9996
10170
  mux_delivered_seconds: number;
10171
+ /**
10172
+ * Video encoding seconds
10173
+ */
10174
+ mux_encoded_seconds: number;
9997
10175
  };
9998
10176
 
9999
10177
  /**
@@ -10030,6 +10208,10 @@ export type DailyUsageAttributes = {
10030
10208
  * Content delivery API traffic
10031
10209
  */
10032
10210
  cda_traffic_bytes: number;
10211
+ /**
10212
+ * Content management API traffic
10213
+ */
10214
+ cma_traffic_bytes: number;
10033
10215
  /**
10034
10216
  * Uploads requests traffic
10035
10217
  */
@@ -10038,6 +10220,10 @@ export type DailyUsageAttributes = {
10038
10220
  * Video streaming seconds
10039
10221
  */
10040
10222
  mux_delivered_seconds: number;
10223
+ /**
10224
+ * Video encoding seconds
10225
+ */
10226
+ mux_encoded_seconds: number;
10041
10227
  };
10042
10228
 
10043
10229
  /**
@@ -0,0 +1,186 @@
1
+ import * as Utils from '@datocms/rest-client-utils';
2
+ import BaseResource from '../../BaseResource';
3
+ import type * as SchemaTypes from '../SchemaTypes';
4
+ import type * as SimpleSchemaTypes from '../SimpleSchemaTypes';
5
+
6
+ export default class UploadTrack extends BaseResource {
7
+ static readonly TYPE = 'upload_track' as const;
8
+
9
+ /**
10
+ * Create a new upload track
11
+ *
12
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/upload-track/create
13
+ *
14
+ * @throws {ApiError}
15
+ * @throws {TimeoutError}
16
+ */
17
+ create(
18
+ uploadId: string | SimpleSchemaTypes.UploadData,
19
+ body: SimpleSchemaTypes.UploadTrackCreateSchema,
20
+ ) {
21
+ return this.rawCreate(
22
+ Utils.toId(uploadId),
23
+ Utils.serializeRequestBody<SchemaTypes.UploadTrackCreateSchema>(body, {
24
+ type: 'upload_track',
25
+ attributes: [
26
+ 'url_or_upload_request_id',
27
+ 'type',
28
+ 'name',
29
+ 'language_code',
30
+ 'closed_captions',
31
+ ],
32
+ relationships: [],
33
+ }),
34
+ ).then((body) =>
35
+ Utils.deserializeResponseBody<SimpleSchemaTypes.UploadTrackCreateJobSchema>(
36
+ body,
37
+ ),
38
+ );
39
+ }
40
+
41
+ /**
42
+ * Create a new upload track
43
+ *
44
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/upload-track/create
45
+ *
46
+ * @throws {ApiError}
47
+ * @throws {TimeoutError}
48
+ */
49
+ rawCreate(
50
+ uploadId: string,
51
+ body: SchemaTypes.UploadTrackCreateSchema,
52
+ ): Promise<SchemaTypes.UploadTrackCreateJobSchema> {
53
+ return this.client.request<SchemaTypes.UploadTrackCreateJobSchema>({
54
+ method: 'POST',
55
+ url: `/uploads/${uploadId}/tracks`,
56
+ body,
57
+ });
58
+ }
59
+
60
+ /**
61
+ * List upload tracks
62
+ *
63
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/upload-track/instances
64
+ *
65
+ * @throws {ApiError}
66
+ * @throws {TimeoutError}
67
+ */
68
+ list(uploadId: string | SimpleSchemaTypes.UploadData) {
69
+ return this.rawList(Utils.toId(uploadId)).then((body) =>
70
+ Utils.deserializeResponseBody<SimpleSchemaTypes.UploadTrackInstancesTargetSchema>(
71
+ body,
72
+ ),
73
+ );
74
+ }
75
+
76
+ /**
77
+ * List upload tracks
78
+ *
79
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/upload-track/instances
80
+ *
81
+ * @throws {ApiError}
82
+ * @throws {TimeoutError}
83
+ */
84
+ rawList(
85
+ uploadId: string,
86
+ ): Promise<SchemaTypes.UploadTrackInstancesTargetSchema> {
87
+ return this.client.request<SchemaTypes.UploadTrackInstancesTargetSchema>({
88
+ method: 'GET',
89
+ url: `/uploads/${uploadId}/tracks`,
90
+ });
91
+ }
92
+
93
+ /**
94
+ * Delete an upload track
95
+ *
96
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/upload-track/destroy
97
+ *
98
+ * @throws {ApiError}
99
+ * @throws {TimeoutError}
100
+ */
101
+ destroy(
102
+ uploadId: string | SimpleSchemaTypes.UploadData,
103
+ uploadTrackId: string | SimpleSchemaTypes.UploadTrackData,
104
+ ) {
105
+ return this.rawDestroy(
106
+ Utils.toId(uploadId),
107
+ Utils.toId(uploadTrackId),
108
+ ).then((body) =>
109
+ Utils.deserializeResponseBody<SimpleSchemaTypes.UploadTrackDestroyJobSchema>(
110
+ body,
111
+ ),
112
+ );
113
+ }
114
+
115
+ /**
116
+ * Delete an upload track
117
+ *
118
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/upload-track/destroy
119
+ *
120
+ * @throws {ApiError}
121
+ * @throws {TimeoutError}
122
+ */
123
+ rawDestroy(
124
+ uploadId: string,
125
+ uploadTrackId: string,
126
+ ): Promise<SchemaTypes.UploadTrackDestroyJobSchema> {
127
+ return this.client.request<SchemaTypes.UploadTrackDestroyJobSchema>({
128
+ method: 'DELETE',
129
+ url: `/uploads/${uploadId}/tracks/${uploadTrackId}`,
130
+ });
131
+ }
132
+
133
+ /**
134
+ * Automatically generate a subtitles track
135
+ *
136
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/upload-track/generate_subtitles
137
+ *
138
+ * @throws {ApiError}
139
+ * @throws {TimeoutError}
140
+ *
141
+ * @deprecated This API call is to be considered private and might change without notice
142
+ */
143
+ generateSubtitles(
144
+ uploadId: string | SimpleSchemaTypes.UploadData,
145
+ body: SimpleSchemaTypes.UploadTrackGenerateSubtitlesSchema,
146
+ ) {
147
+ return this.rawGenerateSubtitles(
148
+ Utils.toId(uploadId),
149
+ Utils.serializeRequestBody<SchemaTypes.UploadTrackGenerateSubtitlesSchema>(
150
+ body,
151
+ {
152
+ type: 'upload_track',
153
+ attributes: ['name', 'language_code'],
154
+ relationships: [],
155
+ },
156
+ ),
157
+ ).then((body) =>
158
+ Utils.deserializeResponseBody<SimpleSchemaTypes.UploadTrackGenerateSubtitlesJobSchema>(
159
+ body,
160
+ ),
161
+ );
162
+ }
163
+
164
+ /**
165
+ * Automatically generate a subtitles track
166
+ *
167
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/upload-track/generate_subtitles
168
+ *
169
+ * @throws {ApiError}
170
+ * @throws {TimeoutError}
171
+ *
172
+ * @deprecated This API call is to be considered private and might change without notice
173
+ */
174
+ rawGenerateSubtitles(
175
+ uploadId: string,
176
+ body: SchemaTypes.UploadTrackGenerateSubtitlesSchema,
177
+ ): Promise<SchemaTypes.UploadTrackGenerateSubtitlesJobSchema> {
178
+ return this.client.request<SchemaTypes.UploadTrackGenerateSubtitlesJobSchema>(
179
+ {
180
+ method: 'POST',
181
+ url: `/uploads/${uploadId}/tracks/generate-subtitles`,
182
+ body,
183
+ },
184
+ );
185
+ }
186
+ }
@@ -18,6 +18,7 @@ export { default as Item } from './Item';
18
18
  export { default as ItemVersion } from './ItemVersion';
19
19
  export { default as Upload } from './Upload';
20
20
  export { default as UploadRequest } from './UploadRequest';
21
+ export { default as UploadTrack } from './UploadTrack';
21
22
  export { default as ScheduledPublication } from './ScheduledPublication';
22
23
  export { default as ScheduledUnpublishing } from './ScheduledUnpublishing';
23
24
  export { default as SearchResult } from './SearchResult';