Skip to content

Commit 769d578

Browse files
feat: add asset metadata schema (#323) (#552)
1 parent 0be8bb7 commit 769d578

File tree

5 files changed

+129
-10
lines changed

5 files changed

+129
-10
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 88
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mux%2Fmux-2eec862e75143314aec7ca531a90eecc404ce10a5038c2140810caaeb22cae43.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mux%2Fmux-18b648ff0f5b764df4ec2b2e313996cbc27a08a1516316a0368f3ca9786a7944.yml

src/resources/video/assets.ts

+103-9
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,8 @@ export interface Asset {
304304
*/
305305
max_stored_resolution?: 'Audio only' | 'SD' | 'HD' | 'FHD' | 'UHD';
306306

307+
meta?: Asset.Meta;
308+
307309
/**
308310
* @deprecated
309311
*/
@@ -325,7 +327,10 @@ export interface Asset {
325327
normalize_audio?: boolean;
326328

327329
/**
328-
* Arbitrary user-supplied metadata set for the asset. Max 255 characters.
330+
* You can set this field to anything you want. It will be included in the asset
331+
* details and related webhooks. If you're looking for more structured metadata,
332+
* such as `title` or `external_id` , you can use the `meta` object instead. **Max:
333+
* 255 characters**.
329334
*/
330335
passthrough?: string;
331336

@@ -430,6 +435,25 @@ export namespace Asset {
430435
url?: string;
431436
}
432437

438+
export interface Meta {
439+
/**
440+
* This is an identifier you provide to keep track of the creator of the video. Max
441+
* 128 code points.
442+
*/
443+
creator_id?: string;
444+
445+
/**
446+
* This is an identifier you provide to link the video to your own data. Max 128
447+
* code points.
448+
*/
449+
external_id?: string;
450+
451+
/**
452+
* The video title. Max 512 code points.
453+
*/
454+
title?: string;
455+
}
456+
433457
/**
434458
* An object containing one or more reasons the input file is non-standard. See
435459
* [the guide on minimizing processing time](https://docs.mux.com/guides/minimize-processing-time)
@@ -687,6 +711,8 @@ export interface AssetOptions {
687711
*/
688712
max_resolution_tier?: '1080p' | '1440p' | '2160p';
689713

714+
meta?: AssetOptions.Meta;
715+
690716
/**
691717
* @deprecated Deprecated. See the
692718
* [Static Renditions API](https://www.mux.com/docs/guides/enable-static-mp4-renditions)
@@ -728,9 +754,10 @@ export interface AssetOptions {
728754
normalize_audio?: boolean;
729755

730756
/**
731-
* Arbitrary user-supplied metadata that will be included in the asset details and
732-
* related webhooks. Can be used to store your own ID for a video along with the
733-
* asset. **Max: 255 characters**.
757+
* You can set this field to anything you want. It will be included in the asset
758+
* details and related webhooks. If you're looking for more structured metadata,
759+
* such as `title` or `external_id`, you can use the `meta` object instead. **Max:
760+
* 255 characters**.
734761
*/
735762
passthrough?: string;
736763

@@ -1011,6 +1038,25 @@ export namespace AssetOptions {
10111038
}
10121039
}
10131040

1041+
export interface Meta {
1042+
/**
1043+
* This is an identifier you provide to keep track of the creator of the video. Max
1044+
* 128 code points.
1045+
*/
1046+
creator_id?: string;
1047+
1048+
/**
1049+
* This is an identifier you provide to link the video to your own data. Max 128
1050+
* code points.
1051+
*/
1052+
external_id?: string;
1053+
1054+
/**
1055+
* The video title. Max 512 code points.
1056+
*/
1057+
title?: string;
1058+
}
1059+
10141060
export interface StaticRendition {
10151061
resolution:
10161062
| 'highest'
@@ -1450,6 +1496,8 @@ export interface AssetCreateParams {
14501496
*/
14511497
max_resolution_tier?: '1080p' | '1440p' | '2160p';
14521498

1499+
meta?: AssetCreateParams.Meta;
1500+
14531501
/**
14541502
* Deprecated. See the
14551503
* [Static Renditions API](https://www.mux.com/docs/guides/enable-static-mp4-renditions)
@@ -1491,9 +1539,10 @@ export interface AssetCreateParams {
14911539
normalize_audio?: boolean;
14921540

14931541
/**
1494-
* Arbitrary user-supplied metadata that will be included in the asset details and
1495-
* related webhooks. Can be used to store your own ID for a video along with the
1496-
* asset. **Max: 255 characters**.
1542+
* You can set this field to anything you want. It will be included in the asset
1543+
* details and related webhooks. If you're looking for more structured metadata,
1544+
* such as `title` or `external_id`, you can use the `meta` object instead. **Max:
1545+
* 255 characters**.
14971546
*/
14981547
passthrough?: string;
14991548

@@ -1771,6 +1820,25 @@ export namespace AssetCreateParams {
17711820
policy?: Shared.PlaybackPolicy;
17721821
}
17731822

1823+
export interface Meta {
1824+
/**
1825+
* This is an identifier you provide to keep track of the creator of the video. Max
1826+
* 128 code points.
1827+
*/
1828+
creator_id?: string;
1829+
1830+
/**
1831+
* This is an identifier you provide to link the video to your own data. Max 128
1832+
* code points.
1833+
*/
1834+
external_id?: string;
1835+
1836+
/**
1837+
* The video title. Max 512 code points.
1838+
*/
1839+
title?: string;
1840+
}
1841+
17741842
export interface StaticRendition {
17751843
resolution:
17761844
| 'highest'
@@ -1793,13 +1861,39 @@ export namespace AssetCreateParams {
17931861
}
17941862

17951863
export interface AssetUpdateParams {
1864+
meta?: AssetUpdateParams.Meta;
1865+
17961866
/**
1797-
* Arbitrary metadata set for the Asset. Max 255 characters. In order to clear this
1798-
* value, the field should be included with an empty string value.
1867+
* You can set this field to anything you want. It will be included in the asset
1868+
* details and related webhooks. If you're looking for more structured metadata,
1869+
* such as `title` or `external_id` , you can use the `meta` object instead. **Max:
1870+
* 255 characters**. In order to clear this value, the field should be included
1871+
* with an empty string value.
17991872
*/
18001873
passthrough?: string;
18011874
}
18021875

1876+
export namespace AssetUpdateParams {
1877+
export interface Meta {
1878+
/**
1879+
* This is an identifier you provide to keep track of the creator of the video. Max
1880+
* 128 code points.
1881+
*/
1882+
creator_id?: string;
1883+
1884+
/**
1885+
* This is an identifier you provide to link the video to your own data. Max 128
1886+
* code points.
1887+
*/
1888+
external_id?: string;
1889+
1890+
/**
1891+
* The video title. Max 512 code points.
1892+
*/
1893+
title?: string;
1894+
}
1895+
}
1896+
18031897
export interface AssetListParams extends BasePageParams {
18041898
/**
18051899
* Filter response to return all the assets for this live stream only

src/resources/video/live-streams.ts

+23
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,8 @@ export namespace LiveStreamUpdateParams {
864864
*/
865865
master_access?: 'temporary' | 'none';
866866

867+
meta?: NewAssetSettings.Meta;
868+
867869
/**
868870
* @deprecated Deprecated. See the
869871
* [Static Renditions API](https://www.mux.com/docs/guides/enable-static-mp4-renditions#during-live-stream-creation)
@@ -895,6 +897,27 @@ export namespace LiveStreamUpdateParams {
895897
*/
896898
video_quality?: 'plus' | 'premium';
897899
}
900+
901+
export namespace NewAssetSettings {
902+
export interface Meta {
903+
/**
904+
* This is an identifier you provide to keep track of the creator of the video. Max
905+
* 128 code points.
906+
*/
907+
creator_id?: string;
908+
909+
/**
910+
* This is an identifier you provide to link the video to your own data. Max 128
911+
* code points.
912+
*/
913+
external_id?: string;
914+
915+
/**
916+
* The video title. Max 512 code points.
917+
*/
918+
title?: string;
919+
}
920+
}
898921
}
899922

900923
export interface LiveStreamListParams extends BasePageParams {

tests/api-resources/video/assets.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ describe('resource assets', () => {
5050
encoding_tier: 'smart',
5151
master_access: 'none',
5252
max_resolution_tier: '1080p',
53+
meta: { creator_id: 'creator_id', external_id: 'external_id', title: 'title' },
5354
mp4_support: 'none',
5455
normalize_audio: true,
5556
passthrough: 'passthrough',

tests/api-resources/video/uploads.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ describe('resource uploads', () => {
5252
],
5353
master_access: 'none',
5454
max_resolution_tier: '1080p',
55+
meta: { creator_id: 'creator_id', external_id: 'external_id', title: 'title' },
5556
mp4_support: 'none',
5657
normalize_audio: true,
5758
passthrough: 'passthrough',

0 commit comments

Comments
 (0)