-
Notifications
You must be signed in to change notification settings - Fork 60
/
delivery-usage.ts
162 lines (139 loc) · 5.02 KB
/
delivery-usage.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import * as Core from '@mux/mux-node/core';
import { APIResource } from '@mux/mux-node/resource';
import { isRequestOptions } from '@mux/mux-node/core';
import * as DeliveryUsageAPI from '@mux/mux-node/resources/video/delivery-usage';
import { PageWithTotal, type PageWithTotalParams } from '@mux/mux-node/pagination';
export class DeliveryUsage extends APIResource {
/**
* Returns a list of delivery usage records and their associated Asset IDs or Live
* Stream IDs.
*/
list(
query?: DeliveryUsageListParams,
options?: Core.RequestOptions,
): Core.PagePromise<DeliveryReportsPageWithTotal, DeliveryReport>;
list(options?: Core.RequestOptions): Core.PagePromise<DeliveryReportsPageWithTotal, DeliveryReport>;
list(
query: DeliveryUsageListParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.PagePromise<DeliveryReportsPageWithTotal, DeliveryReport> {
if (isRequestOptions(query)) {
return this.list({}, query);
}
return this._client.getAPIList('/video/v1/delivery-usage', DeliveryReportsPageWithTotal, {
query,
...options,
});
}
}
export class DeliveryReportsPageWithTotal extends PageWithTotal<DeliveryReport> {}
export interface DeliveryReport {
/**
* The duration of the asset in seconds.
*/
asset_duration: number;
/**
* The encoding tier that the asset was ingested at.
* [See the encoding tiers guide for more details.](https://docs.mux.com/guides/use-encoding-tiers)
*/
asset_encoding_tier: 'smart' | 'baseline';
/**
* Unique identifier for the asset.
*/
asset_id: string;
/**
* The resolution tier that the asset was ingested at, affecting billing for ingest
* & storage
*/
asset_resolution_tier: 'audio-only' | '720p' | '1080p' | '1440p' | '2160p';
/**
* The state of the asset.
*/
asset_state: 'ready' | 'errored' | 'deleted';
/**
* Time at which the asset was created. Measured in seconds since the Unix epoch.
*/
created_at: string;
/**
* Total number of delivered seconds during this time window.
*/
delivered_seconds: number;
/**
* Seconds delivered broken into resolution tiers. Each tier will only be displayed
* if there was content delivered in the tier.
*/
delivered_seconds_by_resolution: DeliveryReport.DeliveredSecondsByResolution;
/**
* If exists, time at which the asset was deleted. Measured in seconds since the
* Unix epoch.
*/
deleted_at?: string;
/**
* Unique identifier for the live stream that created the asset.
*/
live_stream_id?: string;
/**
* The `passthrough` value for the asset.
*/
passthrough?: string;
}
export namespace DeliveryReport {
/**
* Seconds delivered broken into resolution tiers. Each tier will only be displayed
* if there was content delivered in the tier.
*/
export interface DeliveredSecondsByResolution {
/**
* Total number of delivered seconds during this time window that had a resolution
* larger than the 720p tier but less than or equal to the 1440p tier (over 921,600
* and <= 2,073,600 pixels total).
*/
tier_1080p?: number;
/**
* Total number of delivered seconds during this time window that had a resolution
* larger than the 1080p tier but less than or equal to the 2160p tier (over
* 2,073,600 and <= 4,194,304 pixels total).
*/
tier_1440p?: number;
/**
* Total number of delivered seconds during this time window that had a resolution
* larger than the 1440p tier (over 4,194,304 pixels total).
*/
tier_2160p?: number;
/**
* Total number of delivered seconds during this time window that had a resolution
* within the 720p tier (up to 921,600 pixels total, based on typical 1280x720).
*/
tier_720p?: number;
/**
* Total number of delivered seconds during this time window that had a resolution
* of audio only.
*/
tier_audio_only?: number;
}
}
export interface DeliveryUsageListParams extends PageWithTotalParams {
/**
* Filter response to return delivery usage for this asset only. You cannot specify
* both the `asset_id` and `live_stream_id` parameters together.
*/
asset_id?: string;
/**
* Filter response to return delivery usage for assets for this live stream. You
* cannot specify both the `asset_id` and `live_stream_id` parameters together.
*/
live_stream_id?: string;
/**
* Time window to get delivery usage information. timeframe[0] indicates the start
* time, timeframe[1] indicates the end time in seconds since the Unix epoch.
* Default time window is 1 hour representing usage from 13th to 12th hour from
* when the request is made.
*/
timeframe?: Array<string>;
}
export namespace DeliveryUsage {
export import DeliveryReport = DeliveryUsageAPI.DeliveryReport;
export import DeliveryReportsPageWithTotal = DeliveryUsageAPI.DeliveryReportsPageWithTotal;
export import DeliveryUsageListParams = DeliveryUsageAPI.DeliveryUsageListParams;
}