@cloudflare/workers-types 4.20260312.1 → 4.20260316.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.
- package/2021-11-03/index.d.ts +762 -0
- package/2021-11-03/index.ts +762 -0
- package/2022-01-31/index.d.ts +762 -0
- package/2022-01-31/index.ts +762 -0
- package/2022-03-21/index.d.ts +762 -0
- package/2022-03-21/index.ts +762 -0
- package/2022-08-04/index.d.ts +762 -0
- package/2022-08-04/index.ts +762 -0
- package/2022-10-31/index.d.ts +762 -0
- package/2022-10-31/index.ts +762 -0
- package/2022-11-30/index.d.ts +762 -0
- package/2022-11-30/index.ts +762 -0
- package/2023-03-01/index.d.ts +762 -0
- package/2023-03-01/index.ts +762 -0
- package/2023-07-01/index.d.ts +762 -0
- package/2023-07-01/index.ts +762 -0
- package/experimental/index.d.ts +762 -0
- package/experimental/index.ts +762 -0
- package/index.d.ts +762 -0
- package/index.ts +762 -0
- package/latest/index.d.ts +762 -0
- package/latest/index.ts +762 -0
- package/oldest/index.d.ts +762 -0
- package/oldest/index.ts +762 -0
- package/package.json +1 -1
package/2021-11-03/index.d.ts
CHANGED
|
@@ -3736,6 +3736,7 @@ interface WorkerLoader {
|
|
|
3736
3736
|
name: string | null,
|
|
3737
3737
|
getCode: () => WorkerLoaderWorkerCode | Promise<WorkerLoaderWorkerCode>,
|
|
3738
3738
|
): WorkerStub;
|
|
3739
|
+
load(code: WorkerLoaderWorkerCode): WorkerStub;
|
|
3739
3740
|
}
|
|
3740
3741
|
interface WorkerLoaderModule {
|
|
3741
3742
|
js?: string;
|
|
@@ -11961,6 +11962,767 @@ declare module "cloudflare:sockets" {
|
|
|
11961
11962
|
): Socket;
|
|
11962
11963
|
export { _connect as connect };
|
|
11963
11964
|
}
|
|
11965
|
+
/**
|
|
11966
|
+
* Binding entrypoint for Cloudflare Stream.
|
|
11967
|
+
*
|
|
11968
|
+
* Usage:
|
|
11969
|
+
* - Binding-level operations:
|
|
11970
|
+
* `await env.STREAM.videos.upload`
|
|
11971
|
+
* `await env.STREAM.videos.createDirectUpload`
|
|
11972
|
+
* `await env.STREAM.videos.*`
|
|
11973
|
+
* `await env.STREAM.watermarks.*`
|
|
11974
|
+
* - Per-video operations:
|
|
11975
|
+
* `await env.STREAM.video(id).downloads.*`
|
|
11976
|
+
* `await env.STREAM.video(id).captions.*`
|
|
11977
|
+
*
|
|
11978
|
+
* Example usage:
|
|
11979
|
+
* ```ts
|
|
11980
|
+
* await env.STREAM.video(id).downloads.generate();
|
|
11981
|
+
*
|
|
11982
|
+
* const video = env.STREAM.video(id)
|
|
11983
|
+
* const captions = video.captions.list();
|
|
11984
|
+
* const videoDetails = video.details()
|
|
11985
|
+
* ```
|
|
11986
|
+
*/
|
|
11987
|
+
interface StreamBinding {
|
|
11988
|
+
/**
|
|
11989
|
+
* Returns a handle scoped to a single video for per-video operations.
|
|
11990
|
+
* @param id The unique identifier for the video.
|
|
11991
|
+
* @returns A handle for per-video operations.
|
|
11992
|
+
*/
|
|
11993
|
+
video(id: string): StreamVideoHandle;
|
|
11994
|
+
/**
|
|
11995
|
+
* Uploads a new video from a File.
|
|
11996
|
+
* @param file The video file to upload.
|
|
11997
|
+
* @returns The uploaded video details.
|
|
11998
|
+
* @throws {BadRequestError} if the upload parameter is invalid
|
|
11999
|
+
* @throws {QuotaReachedError} if the account storage capacity is exceeded
|
|
12000
|
+
* @throws {MaxFileSizeError} if the file size is too large
|
|
12001
|
+
* @throws {RateLimitedError} if the server received too many requests
|
|
12002
|
+
* @throws {InternalError} if an unexpected error occurs
|
|
12003
|
+
*/
|
|
12004
|
+
upload(file: File): Promise<StreamVideo>;
|
|
12005
|
+
/**
|
|
12006
|
+
* Uploads a new video from a provided URL.
|
|
12007
|
+
* @param url The URL to upload from.
|
|
12008
|
+
* @param params Optional upload parameters.
|
|
12009
|
+
* @returns The uploaded video details.
|
|
12010
|
+
* @throws {BadRequestError} if the upload parameter is invalid or the URL is invalid
|
|
12011
|
+
* @throws {QuotaReachedError} if the account storage capacity is exceeded
|
|
12012
|
+
* @throws {MaxFileSizeError} if the file size is too large
|
|
12013
|
+
* @throws {RateLimitedError} if the server received too many requests
|
|
12014
|
+
* @throws {AlreadyUploadedError} if a video was already uploaded to this URL
|
|
12015
|
+
* @throws {InternalError} if an unexpected error occurs
|
|
12016
|
+
*/
|
|
12017
|
+
upload(url: string, params?: StreamUrlUploadParams): Promise<StreamVideo>;
|
|
12018
|
+
/**
|
|
12019
|
+
* Creates a direct upload that allows video uploads without an API key.
|
|
12020
|
+
* @param params Parameters for the direct upload
|
|
12021
|
+
* @returns The direct upload details.
|
|
12022
|
+
* @throws {BadRequestError} if the parameters are invalid
|
|
12023
|
+
* @throws {RateLimitedError} if the server received too many requests
|
|
12024
|
+
* @throws {InternalError} if an unexpected error occurs
|
|
12025
|
+
*/
|
|
12026
|
+
createDirectUpload(
|
|
12027
|
+
params: StreamDirectUploadCreateParams,
|
|
12028
|
+
): Promise<StreamDirectUpload>;
|
|
12029
|
+
videos: StreamVideos;
|
|
12030
|
+
watermarks: StreamWatermarks;
|
|
12031
|
+
}
|
|
12032
|
+
/**
|
|
12033
|
+
* Handle for operations scoped to a single Stream video.
|
|
12034
|
+
*/
|
|
12035
|
+
interface StreamVideoHandle {
|
|
12036
|
+
/**
|
|
12037
|
+
* The unique identifier for the video.
|
|
12038
|
+
*/
|
|
12039
|
+
id: string;
|
|
12040
|
+
/**
|
|
12041
|
+
* Get a full videos details
|
|
12042
|
+
* @returns The full video details.
|
|
12043
|
+
* @throws {NotFoundError} if the video is not found
|
|
12044
|
+
* @throws {InternalError} if an unexpected error occurs
|
|
12045
|
+
*/
|
|
12046
|
+
details(): Promise<StreamVideo>;
|
|
12047
|
+
/**
|
|
12048
|
+
* Update details for a single video.
|
|
12049
|
+
* @param params The fields to update for the video.
|
|
12050
|
+
* @returns The updated video details.
|
|
12051
|
+
* @throws {NotFoundError} if the video is not found
|
|
12052
|
+
* @throws {BadRequestError} if the parameters are invalid
|
|
12053
|
+
* @throws {InternalError} if an unexpected error occurs
|
|
12054
|
+
*/
|
|
12055
|
+
update(params: StreamUpdateVideoParams): Promise<StreamVideo>;
|
|
12056
|
+
/**
|
|
12057
|
+
* Deletes a video and its copies from Cloudflare Stream.
|
|
12058
|
+
* @returns A promise that resolves when deletion completes.
|
|
12059
|
+
* @throws {NotFoundError} if the video is not found
|
|
12060
|
+
* @throws {InternalError} if an unexpected error occurs
|
|
12061
|
+
*/
|
|
12062
|
+
delete(): Promise<void>;
|
|
12063
|
+
/**
|
|
12064
|
+
* Creates a signed URL token for a video.
|
|
12065
|
+
* @returns The signed token that was created.
|
|
12066
|
+
* @throws {InternalError} if the signing key cannot be retrieved or the token cannot be signed
|
|
12067
|
+
*/
|
|
12068
|
+
generateToken(): Promise<string>;
|
|
12069
|
+
downloads: StreamScopedDownloads;
|
|
12070
|
+
captions: StreamScopedCaptions;
|
|
12071
|
+
}
|
|
12072
|
+
interface StreamVideo {
|
|
12073
|
+
/**
|
|
12074
|
+
* The unique identifier for the video.
|
|
12075
|
+
*/
|
|
12076
|
+
id: string;
|
|
12077
|
+
/**
|
|
12078
|
+
* A user-defined identifier for the media creator.
|
|
12079
|
+
*/
|
|
12080
|
+
creator: string | null;
|
|
12081
|
+
/**
|
|
12082
|
+
* The thumbnail URL for the video.
|
|
12083
|
+
*/
|
|
12084
|
+
thumbnail: string;
|
|
12085
|
+
/**
|
|
12086
|
+
* The thumbnail timestamp percentage.
|
|
12087
|
+
*/
|
|
12088
|
+
thumbnailTimestampPct: number;
|
|
12089
|
+
/**
|
|
12090
|
+
* Indicates whether the video is ready to stream.
|
|
12091
|
+
*/
|
|
12092
|
+
readyToStream: boolean;
|
|
12093
|
+
/**
|
|
12094
|
+
* The date and time the video became ready to stream.
|
|
12095
|
+
*/
|
|
12096
|
+
readyToStreamAt: string | null;
|
|
12097
|
+
/**
|
|
12098
|
+
* Processing status information.
|
|
12099
|
+
*/
|
|
12100
|
+
status: StreamVideoStatus;
|
|
12101
|
+
/**
|
|
12102
|
+
* A user modifiable key-value store.
|
|
12103
|
+
*/
|
|
12104
|
+
meta: Record<string, string>;
|
|
12105
|
+
/**
|
|
12106
|
+
* The date and time the video was created.
|
|
12107
|
+
*/
|
|
12108
|
+
created: string;
|
|
12109
|
+
/**
|
|
12110
|
+
* The date and time the video was last modified.
|
|
12111
|
+
*/
|
|
12112
|
+
modified: string;
|
|
12113
|
+
/**
|
|
12114
|
+
* The date and time at which the video will be deleted.
|
|
12115
|
+
*/
|
|
12116
|
+
scheduledDeletion: string | null;
|
|
12117
|
+
/**
|
|
12118
|
+
* The size of the video in bytes.
|
|
12119
|
+
*/
|
|
12120
|
+
size: number;
|
|
12121
|
+
/**
|
|
12122
|
+
* The preview URL for the video.
|
|
12123
|
+
*/
|
|
12124
|
+
preview?: string;
|
|
12125
|
+
/**
|
|
12126
|
+
* Origins allowed to display the video.
|
|
12127
|
+
*/
|
|
12128
|
+
allowedOrigins: Array<string>;
|
|
12129
|
+
/**
|
|
12130
|
+
* Indicates whether signed URLs are required.
|
|
12131
|
+
*/
|
|
12132
|
+
requireSignedURLs: boolean | null;
|
|
12133
|
+
/**
|
|
12134
|
+
* The date and time the video was uploaded.
|
|
12135
|
+
*/
|
|
12136
|
+
uploaded: string | null;
|
|
12137
|
+
/**
|
|
12138
|
+
* The date and time when the upload URL expires.
|
|
12139
|
+
*/
|
|
12140
|
+
uploadExpiry: string | null;
|
|
12141
|
+
/**
|
|
12142
|
+
* The maximum size in bytes for direct uploads.
|
|
12143
|
+
*/
|
|
12144
|
+
maxSizeBytes: number | null;
|
|
12145
|
+
/**
|
|
12146
|
+
* The maximum duration in seconds for direct uploads.
|
|
12147
|
+
*/
|
|
12148
|
+
maxDurationSeconds: number | null;
|
|
12149
|
+
/**
|
|
12150
|
+
* The video duration in seconds. -1 indicates unknown.
|
|
12151
|
+
*/
|
|
12152
|
+
duration: number;
|
|
12153
|
+
/**
|
|
12154
|
+
* Input metadata for the original upload.
|
|
12155
|
+
*/
|
|
12156
|
+
input: StreamVideoInput;
|
|
12157
|
+
/**
|
|
12158
|
+
* Playback URLs for the video.
|
|
12159
|
+
*/
|
|
12160
|
+
hlsPlaybackUrl: string;
|
|
12161
|
+
dashPlaybackUrl: string;
|
|
12162
|
+
/**
|
|
12163
|
+
* The watermark applied to the video, if any.
|
|
12164
|
+
*/
|
|
12165
|
+
watermark: StreamWatermark | null;
|
|
12166
|
+
/**
|
|
12167
|
+
* The live input id associated with the video, if any.
|
|
12168
|
+
*/
|
|
12169
|
+
liveInputId?: string | null;
|
|
12170
|
+
/**
|
|
12171
|
+
* The source video id if this is a clip.
|
|
12172
|
+
*/
|
|
12173
|
+
clippedFromId: string | null;
|
|
12174
|
+
/**
|
|
12175
|
+
* Public details associated with the video.
|
|
12176
|
+
*/
|
|
12177
|
+
publicDetails: StreamPublicDetails | null;
|
|
12178
|
+
}
|
|
12179
|
+
type StreamVideoStatus = {
|
|
12180
|
+
/**
|
|
12181
|
+
* The current processing state.
|
|
12182
|
+
*/
|
|
12183
|
+
state: string;
|
|
12184
|
+
/**
|
|
12185
|
+
* The current processing step.
|
|
12186
|
+
*/
|
|
12187
|
+
step?: string;
|
|
12188
|
+
/**
|
|
12189
|
+
* The percent complete as a string.
|
|
12190
|
+
*/
|
|
12191
|
+
pctComplete?: string;
|
|
12192
|
+
/**
|
|
12193
|
+
* An error reason code, if applicable.
|
|
12194
|
+
*/
|
|
12195
|
+
errorReasonCode: string;
|
|
12196
|
+
/**
|
|
12197
|
+
* An error reason text, if applicable.
|
|
12198
|
+
*/
|
|
12199
|
+
errorReasonText: string;
|
|
12200
|
+
};
|
|
12201
|
+
type StreamVideoInput = {
|
|
12202
|
+
/**
|
|
12203
|
+
* The input width in pixels.
|
|
12204
|
+
*/
|
|
12205
|
+
width: number;
|
|
12206
|
+
/**
|
|
12207
|
+
* The input height in pixels.
|
|
12208
|
+
*/
|
|
12209
|
+
height: number;
|
|
12210
|
+
};
|
|
12211
|
+
type StreamPublicDetails = {
|
|
12212
|
+
/**
|
|
12213
|
+
* The public title for the video.
|
|
12214
|
+
*/
|
|
12215
|
+
title: string | null;
|
|
12216
|
+
/**
|
|
12217
|
+
* The public share link.
|
|
12218
|
+
*/
|
|
12219
|
+
share_link: string | null;
|
|
12220
|
+
/**
|
|
12221
|
+
* The public channel link.
|
|
12222
|
+
*/
|
|
12223
|
+
channel_link: string | null;
|
|
12224
|
+
/**
|
|
12225
|
+
* The public logo URL.
|
|
12226
|
+
*/
|
|
12227
|
+
logo: string | null;
|
|
12228
|
+
};
|
|
12229
|
+
type StreamDirectUpload = {
|
|
12230
|
+
/**
|
|
12231
|
+
* The URL an unauthenticated upload can use for a single multipart request.
|
|
12232
|
+
*/
|
|
12233
|
+
uploadURL: string;
|
|
12234
|
+
/**
|
|
12235
|
+
* A Cloudflare-generated unique identifier for a media item.
|
|
12236
|
+
*/
|
|
12237
|
+
id: string;
|
|
12238
|
+
/**
|
|
12239
|
+
* The watermark profile applied to the upload.
|
|
12240
|
+
*/
|
|
12241
|
+
watermark: StreamWatermark | null;
|
|
12242
|
+
/**
|
|
12243
|
+
* The scheduled deletion time, if any.
|
|
12244
|
+
*/
|
|
12245
|
+
scheduledDeletion: string | null;
|
|
12246
|
+
};
|
|
12247
|
+
type StreamDirectUploadCreateParams = {
|
|
12248
|
+
/**
|
|
12249
|
+
* The maximum duration in seconds for a video upload.
|
|
12250
|
+
*/
|
|
12251
|
+
maxDurationSeconds: number;
|
|
12252
|
+
/**
|
|
12253
|
+
* The date and time after upload when videos will not be accepted.
|
|
12254
|
+
*/
|
|
12255
|
+
expiry?: string;
|
|
12256
|
+
/**
|
|
12257
|
+
* A user-defined identifier for the media creator.
|
|
12258
|
+
*/
|
|
12259
|
+
creator?: string;
|
|
12260
|
+
/**
|
|
12261
|
+
* A user modifiable key-value store used to reference other systems of record for
|
|
12262
|
+
* managing videos.
|
|
12263
|
+
*/
|
|
12264
|
+
meta?: Record<string, string>;
|
|
12265
|
+
/**
|
|
12266
|
+
* Lists the origins allowed to display the video.
|
|
12267
|
+
*/
|
|
12268
|
+
allowedOrigins?: Array<string>;
|
|
12269
|
+
/**
|
|
12270
|
+
* Indicates whether the video can be accessed using the id. When set to `true`,
|
|
12271
|
+
* a signed token must be generated with a signing key to view the video.
|
|
12272
|
+
*/
|
|
12273
|
+
requireSignedURLs?: boolean;
|
|
12274
|
+
/**
|
|
12275
|
+
* The thumbnail timestamp percentage.
|
|
12276
|
+
*/
|
|
12277
|
+
thumbnailTimestampPct?: number;
|
|
12278
|
+
/**
|
|
12279
|
+
* The date and time at which the video will be deleted. Include `null` to remove
|
|
12280
|
+
* a scheduled deletion.
|
|
12281
|
+
*/
|
|
12282
|
+
scheduledDeletion?: string | null;
|
|
12283
|
+
/**
|
|
12284
|
+
* The watermark profile to apply.
|
|
12285
|
+
*/
|
|
12286
|
+
watermark?: StreamDirectUploadWatermark;
|
|
12287
|
+
};
|
|
12288
|
+
type StreamDirectUploadWatermark = {
|
|
12289
|
+
/**
|
|
12290
|
+
* The unique identifier for the watermark profile.
|
|
12291
|
+
*/
|
|
12292
|
+
id: string;
|
|
12293
|
+
};
|
|
12294
|
+
type StreamUrlUploadParams = {
|
|
12295
|
+
/**
|
|
12296
|
+
* Lists the origins allowed to display the video. Enter allowed origin
|
|
12297
|
+
* domains in an array and use `*` for wildcard subdomains. Empty arrays allow the
|
|
12298
|
+
* video to be viewed on any origin.
|
|
12299
|
+
*/
|
|
12300
|
+
allowedOrigins?: Array<string>;
|
|
12301
|
+
/**
|
|
12302
|
+
* A user-defined identifier for the media creator.
|
|
12303
|
+
*/
|
|
12304
|
+
creator?: string;
|
|
12305
|
+
/**
|
|
12306
|
+
* A user modifiable key-value store used to reference other systems of
|
|
12307
|
+
* record for managing videos.
|
|
12308
|
+
*/
|
|
12309
|
+
meta?: Record<string, string>;
|
|
12310
|
+
/**
|
|
12311
|
+
* Indicates whether the video can be a accessed using the id. When
|
|
12312
|
+
* set to `true`, a signed token must be generated with a signing key to view the
|
|
12313
|
+
* video.
|
|
12314
|
+
*/
|
|
12315
|
+
requireSignedURLs?: boolean;
|
|
12316
|
+
/**
|
|
12317
|
+
* Indicates the date and time at which the video will be deleted. Omit
|
|
12318
|
+
* the field to indicate no change, or include with a `null` value to remove an
|
|
12319
|
+
* existing scheduled deletion. If specified, must be at least 30 days from upload
|
|
12320
|
+
* time.
|
|
12321
|
+
*/
|
|
12322
|
+
scheduledDeletion?: string | null;
|
|
12323
|
+
/**
|
|
12324
|
+
* The timestamp for a thumbnail image calculated as a percentage value
|
|
12325
|
+
* of the video's duration. To convert from a second-wise timestamp to a
|
|
12326
|
+
* percentage, divide the desired timestamp by the total duration of the video. If
|
|
12327
|
+
* this value is not set, the default thumbnail image is taken from 0s of the
|
|
12328
|
+
* video.
|
|
12329
|
+
*/
|
|
12330
|
+
thumbnailTimestampPct?: number;
|
|
12331
|
+
/**
|
|
12332
|
+
* The identifier for the watermark profile
|
|
12333
|
+
*/
|
|
12334
|
+
watermarkId?: string;
|
|
12335
|
+
};
|
|
12336
|
+
interface StreamScopedCaptions {
|
|
12337
|
+
/**
|
|
12338
|
+
* Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.
|
|
12339
|
+
* One caption or subtitle file per language is allowed.
|
|
12340
|
+
* @param language The BCP 47 language tag for the caption or subtitle.
|
|
12341
|
+
* @param file The caption or subtitle file to upload.
|
|
12342
|
+
* @returns The created caption entry.
|
|
12343
|
+
* @throws {NotFoundError} if the video is not found
|
|
12344
|
+
* @throws {BadRequestError} if the language or file is invalid
|
|
12345
|
+
* @throws {MaxFileSizeError} if the file size is too large
|
|
12346
|
+
* @throws {InternalError} if an unexpected error occurs
|
|
12347
|
+
*/
|
|
12348
|
+
upload(language: string, file: File): Promise<StreamCaption>;
|
|
12349
|
+
/**
|
|
12350
|
+
* Generate captions or subtitles for the provided language via AI.
|
|
12351
|
+
* @param language The BCP 47 language tag to generate.
|
|
12352
|
+
* @returns The generated caption entry.
|
|
12353
|
+
* @throws {NotFoundError} if the video is not found
|
|
12354
|
+
* @throws {BadRequestError} if the language is invalid
|
|
12355
|
+
* @throws {StreamError} if a generated caption already exists
|
|
12356
|
+
* @throws {StreamError} if the video duration is too long
|
|
12357
|
+
* @throws {StreamError} if the video is missing audio
|
|
12358
|
+
* @throws {StreamError} if the requested language is not supported
|
|
12359
|
+
* @throws {InternalError} if an unexpected error occurs
|
|
12360
|
+
*/
|
|
12361
|
+
generate(language: string): Promise<StreamCaption>;
|
|
12362
|
+
/**
|
|
12363
|
+
* Lists the captions or subtitles.
|
|
12364
|
+
* Use the language parameter to filter by a specific language.
|
|
12365
|
+
* @param language The optional BCP 47 language tag to filter by.
|
|
12366
|
+
* @returns The list of captions or subtitles.
|
|
12367
|
+
* @throws {NotFoundError} if the video or caption is not found
|
|
12368
|
+
* @throws {InternalError} if an unexpected error occurs
|
|
12369
|
+
*/
|
|
12370
|
+
list(language?: string): Promise<StreamCaption[]>;
|
|
12371
|
+
/**
|
|
12372
|
+
* Removes the captions or subtitles from a video.
|
|
12373
|
+
* @param language The BCP 47 language tag to remove.
|
|
12374
|
+
* @returns A promise that resolves when deletion completes.
|
|
12375
|
+
* @throws {NotFoundError} if the video or caption is not found
|
|
12376
|
+
* @throws {InternalError} if an unexpected error occurs
|
|
12377
|
+
*/
|
|
12378
|
+
delete(language: string): Promise<void>;
|
|
12379
|
+
}
|
|
12380
|
+
interface StreamScopedDownloads {
|
|
12381
|
+
/**
|
|
12382
|
+
* Generates a download for a video when a video is ready to view. Available
|
|
12383
|
+
* types are `default` and `audio`. Defaults to `default` when omitted.
|
|
12384
|
+
* @param downloadType The download type to create.
|
|
12385
|
+
* @returns The current downloads for the video.
|
|
12386
|
+
* @throws {NotFoundError} if the video is not found
|
|
12387
|
+
* @throws {BadRequestError} if the download type is invalid
|
|
12388
|
+
* @throws {StreamError} if the video duration is too long to generate a download
|
|
12389
|
+
* @throws {StreamError} if the video is not ready to stream
|
|
12390
|
+
* @throws {InternalError} if an unexpected error occurs
|
|
12391
|
+
*/
|
|
12392
|
+
generate(
|
|
12393
|
+
downloadType?: StreamDownloadType,
|
|
12394
|
+
): Promise<StreamDownloadGetResponse>;
|
|
12395
|
+
/**
|
|
12396
|
+
* Lists the downloads created for a video.
|
|
12397
|
+
* @returns The current downloads for the video.
|
|
12398
|
+
* @throws {NotFoundError} if the video or downloads are not found
|
|
12399
|
+
* @throws {InternalError} if an unexpected error occurs
|
|
12400
|
+
*/
|
|
12401
|
+
get(): Promise<StreamDownloadGetResponse>;
|
|
12402
|
+
/**
|
|
12403
|
+
* Delete the downloads for a video. Available types are `default` and `audio`.
|
|
12404
|
+
* Defaults to `default` when omitted.
|
|
12405
|
+
* @param downloadType The download type to delete.
|
|
12406
|
+
* @returns A promise that resolves when deletion completes.
|
|
12407
|
+
* @throws {NotFoundError} if the video or downloads are not found
|
|
12408
|
+
* @throws {InternalError} if an unexpected error occurs
|
|
12409
|
+
*/
|
|
12410
|
+
delete(downloadType?: StreamDownloadType): Promise<void>;
|
|
12411
|
+
}
|
|
12412
|
+
interface StreamVideos {
|
|
12413
|
+
/**
|
|
12414
|
+
* Lists all videos in a users account.
|
|
12415
|
+
* @returns The list of videos.
|
|
12416
|
+
* @throws {BadRequestError} if the parameters are invalid
|
|
12417
|
+
* @throws {InternalError} if an unexpected error occurs
|
|
12418
|
+
*/
|
|
12419
|
+
list(params?: StreamVideosListParams): Promise<StreamVideo[]>;
|
|
12420
|
+
}
|
|
12421
|
+
interface StreamWatermarks {
|
|
12422
|
+
/**
|
|
12423
|
+
* Generate a new watermark profile
|
|
12424
|
+
* @param file The image file to upload
|
|
12425
|
+
* @param params The watermark creation parameters.
|
|
12426
|
+
* @returns The created watermark profile.
|
|
12427
|
+
* @throws {BadRequestError} if the parameters are invalid
|
|
12428
|
+
* @throws {InvalidURLError} if the URL is invalid
|
|
12429
|
+
* @throws {MaxFileSizeError} if the file size is too large
|
|
12430
|
+
* @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
|
|
12431
|
+
* @throws {InternalError} if an unexpected error occurs
|
|
12432
|
+
*/
|
|
12433
|
+
generate(
|
|
12434
|
+
file: File,
|
|
12435
|
+
params: StreamWatermarkCreateParams,
|
|
12436
|
+
): Promise<StreamWatermark>;
|
|
12437
|
+
/**
|
|
12438
|
+
* Generate a new watermark profile
|
|
12439
|
+
* @param url The image url to upload
|
|
12440
|
+
* @param params The watermark creation parameters.
|
|
12441
|
+
* @returns The created watermark profile.
|
|
12442
|
+
* @throws {BadRequestError} if the parameters are invalid
|
|
12443
|
+
* @throws {InvalidURLError} if the URL is invalid
|
|
12444
|
+
* @throws {MaxFileSizeError} if the file size is too large
|
|
12445
|
+
* @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
|
|
12446
|
+
* @throws {InternalError} if an unexpected error occurs
|
|
12447
|
+
*/
|
|
12448
|
+
generate(
|
|
12449
|
+
url: string,
|
|
12450
|
+
params: StreamWatermarkCreateParams,
|
|
12451
|
+
): Promise<StreamWatermark>;
|
|
12452
|
+
/**
|
|
12453
|
+
* Lists all watermark profiles for an account.
|
|
12454
|
+
* @returns The list of watermark profiles.
|
|
12455
|
+
* @throws {InternalError} if an unexpected error occurs
|
|
12456
|
+
*/
|
|
12457
|
+
list(): Promise<StreamWatermark[]>;
|
|
12458
|
+
/**
|
|
12459
|
+
* Retrieves details for a single watermark profile.
|
|
12460
|
+
* @param watermarkId The watermark profile identifier.
|
|
12461
|
+
* @returns The watermark profile details.
|
|
12462
|
+
* @throws {NotFoundError} if the watermark is not found
|
|
12463
|
+
* @throws {InternalError} if an unexpected error occurs
|
|
12464
|
+
*/
|
|
12465
|
+
get(watermarkId: string): Promise<StreamWatermark>;
|
|
12466
|
+
/**
|
|
12467
|
+
* Deletes a watermark profile.
|
|
12468
|
+
* @param watermarkId The watermark profile identifier.
|
|
12469
|
+
* @returns A promise that resolves when deletion completes.
|
|
12470
|
+
* @throws {NotFoundError} if the watermark is not found
|
|
12471
|
+
* @throws {InternalError} if an unexpected error occurs
|
|
12472
|
+
*/
|
|
12473
|
+
delete(watermarkId: string): Promise<void>;
|
|
12474
|
+
}
|
|
12475
|
+
type StreamUpdateVideoParams = {
|
|
12476
|
+
/**
|
|
12477
|
+
* Lists the origins allowed to display the video. Enter allowed origin
|
|
12478
|
+
* domains in an array and use `*` for wildcard subdomains. Empty arrays allow the
|
|
12479
|
+
* video to be viewed on any origin.
|
|
12480
|
+
*/
|
|
12481
|
+
allowedOrigins?: Array<string>;
|
|
12482
|
+
/**
|
|
12483
|
+
* A user-defined identifier for the media creator.
|
|
12484
|
+
*/
|
|
12485
|
+
creator?: string;
|
|
12486
|
+
/**
|
|
12487
|
+
* The maximum duration in seconds for a video upload. Can be set for a
|
|
12488
|
+
* video that is not yet uploaded to limit its duration. Uploads that exceed the
|
|
12489
|
+
* specified duration will fail during processing. A value of `-1` means the value
|
|
12490
|
+
* is unknown.
|
|
12491
|
+
*/
|
|
12492
|
+
maxDurationSeconds?: number;
|
|
12493
|
+
/**
|
|
12494
|
+
* A user modifiable key-value store used to reference other systems of
|
|
12495
|
+
* record for managing videos.
|
|
12496
|
+
*/
|
|
12497
|
+
meta?: Record<string, string>;
|
|
12498
|
+
/**
|
|
12499
|
+
* Indicates whether the video can be a accessed using the id. When
|
|
12500
|
+
* set to `true`, a signed token must be generated with a signing key to view the
|
|
12501
|
+
* video.
|
|
12502
|
+
*/
|
|
12503
|
+
requireSignedURLs?: boolean;
|
|
12504
|
+
/**
|
|
12505
|
+
* Indicates the date and time at which the video will be deleted. Omit
|
|
12506
|
+
* the field to indicate no change, or include with a `null` value to remove an
|
|
12507
|
+
* existing scheduled deletion. If specified, must be at least 30 days from upload
|
|
12508
|
+
* time.
|
|
12509
|
+
*/
|
|
12510
|
+
scheduledDeletion?: string | null;
|
|
12511
|
+
/**
|
|
12512
|
+
* The timestamp for a thumbnail image calculated as a percentage value
|
|
12513
|
+
* of the video's duration. To convert from a second-wise timestamp to a
|
|
12514
|
+
* percentage, divide the desired timestamp by the total duration of the video. If
|
|
12515
|
+
* this value is not set, the default thumbnail image is taken from 0s of the
|
|
12516
|
+
* video.
|
|
12517
|
+
*/
|
|
12518
|
+
thumbnailTimestampPct?: number;
|
|
12519
|
+
};
|
|
12520
|
+
type StreamCaption = {
|
|
12521
|
+
/**
|
|
12522
|
+
* Whether the caption was generated via AI.
|
|
12523
|
+
*/
|
|
12524
|
+
generated?: boolean;
|
|
12525
|
+
/**
|
|
12526
|
+
* The language label displayed in the native language to users.
|
|
12527
|
+
*/
|
|
12528
|
+
label: string;
|
|
12529
|
+
/**
|
|
12530
|
+
* The language tag in BCP 47 format.
|
|
12531
|
+
*/
|
|
12532
|
+
language: string;
|
|
12533
|
+
/**
|
|
12534
|
+
* The status of a generated caption.
|
|
12535
|
+
*/
|
|
12536
|
+
status?: "ready" | "inprogress" | "error";
|
|
12537
|
+
};
|
|
12538
|
+
type StreamDownloadStatus = "ready" | "inprogress" | "error";
|
|
12539
|
+
type StreamDownloadType = "default" | "audio";
|
|
12540
|
+
type StreamDownload = {
|
|
12541
|
+
/**
|
|
12542
|
+
* Indicates the progress as a percentage between 0 and 100.
|
|
12543
|
+
*/
|
|
12544
|
+
percentComplete: number;
|
|
12545
|
+
/**
|
|
12546
|
+
* The status of a generated download.
|
|
12547
|
+
*/
|
|
12548
|
+
status: StreamDownloadStatus;
|
|
12549
|
+
/**
|
|
12550
|
+
* The URL to access the generated download.
|
|
12551
|
+
*/
|
|
12552
|
+
url?: string;
|
|
12553
|
+
};
|
|
12554
|
+
/**
|
|
12555
|
+
* An object with download type keys. Each key is optional and only present if that
|
|
12556
|
+
* download type has been created.
|
|
12557
|
+
*/
|
|
12558
|
+
type StreamDownloadGetResponse = {
|
|
12559
|
+
/**
|
|
12560
|
+
* The audio-only download. Only present if this download type has been created.
|
|
12561
|
+
*/
|
|
12562
|
+
audio?: StreamDownload;
|
|
12563
|
+
/**
|
|
12564
|
+
* The default video download. Only present if this download type has been created.
|
|
12565
|
+
*/
|
|
12566
|
+
default?: StreamDownload;
|
|
12567
|
+
};
|
|
12568
|
+
type StreamWatermarkPosition =
|
|
12569
|
+
| "upperRight"
|
|
12570
|
+
| "upperLeft"
|
|
12571
|
+
| "lowerLeft"
|
|
12572
|
+
| "lowerRight"
|
|
12573
|
+
| "center";
|
|
12574
|
+
type StreamWatermark = {
|
|
12575
|
+
/**
|
|
12576
|
+
* The unique identifier for a watermark profile.
|
|
12577
|
+
*/
|
|
12578
|
+
id: string;
|
|
12579
|
+
/**
|
|
12580
|
+
* The size of the image in bytes.
|
|
12581
|
+
*/
|
|
12582
|
+
size: number;
|
|
12583
|
+
/**
|
|
12584
|
+
* The height of the image in pixels.
|
|
12585
|
+
*/
|
|
12586
|
+
height: number;
|
|
12587
|
+
/**
|
|
12588
|
+
* The width of the image in pixels.
|
|
12589
|
+
*/
|
|
12590
|
+
width: number;
|
|
12591
|
+
/**
|
|
12592
|
+
* The date and a time a watermark profile was created.
|
|
12593
|
+
*/
|
|
12594
|
+
created: string;
|
|
12595
|
+
/**
|
|
12596
|
+
* The source URL for a downloaded image. If the watermark profile was created via
|
|
12597
|
+
* direct upload, this field is null.
|
|
12598
|
+
*/
|
|
12599
|
+
downloadedFrom: string | null;
|
|
12600
|
+
/**
|
|
12601
|
+
* A short description of the watermark profile.
|
|
12602
|
+
*/
|
|
12603
|
+
name: string;
|
|
12604
|
+
/**
|
|
12605
|
+
* The translucency of the image. A value of `0.0` makes the image completely
|
|
12606
|
+
* transparent, and `1.0` makes the image completely opaque. Note that if the image
|
|
12607
|
+
* is already semi-transparent, setting this to `1.0` will not make the image
|
|
12608
|
+
* completely opaque.
|
|
12609
|
+
*/
|
|
12610
|
+
opacity: number;
|
|
12611
|
+
/**
|
|
12612
|
+
* The whitespace between the adjacent edges (determined by position) of the video
|
|
12613
|
+
* and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded
|
|
12614
|
+
* video width or length, as determined by the algorithm.
|
|
12615
|
+
*/
|
|
12616
|
+
padding: number;
|
|
12617
|
+
/**
|
|
12618
|
+
* The size of the image relative to the overall size of the video. This parameter
|
|
12619
|
+
* will adapt to horizontal and vertical videos automatically. `0.0` indicates no
|
|
12620
|
+
* scaling (use the size of the image as-is), and `1.0 `fills the entire video.
|
|
12621
|
+
*/
|
|
12622
|
+
scale: number;
|
|
12623
|
+
/**
|
|
12624
|
+
* The location of the image. Valid positions are: `upperRight`, `upperLeft`,
|
|
12625
|
+
* `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the
|
|
12626
|
+
* `padding` parameter.
|
|
12627
|
+
*/
|
|
12628
|
+
position: StreamWatermarkPosition;
|
|
12629
|
+
};
|
|
12630
|
+
type StreamWatermarkCreateParams = {
|
|
12631
|
+
/**
|
|
12632
|
+
* A short description of the watermark profile.
|
|
12633
|
+
*/
|
|
12634
|
+
name?: string;
|
|
12635
|
+
/**
|
|
12636
|
+
* The translucency of the image. A value of `0.0` makes the image completely
|
|
12637
|
+
* transparent, and `1.0` makes the image completely opaque. Note that if the
|
|
12638
|
+
* image is already semi-transparent, setting this to `1.0` will not make the
|
|
12639
|
+
* image completely opaque.
|
|
12640
|
+
*/
|
|
12641
|
+
opacity?: number;
|
|
12642
|
+
/**
|
|
12643
|
+
* The whitespace between the adjacent edges (determined by position) of the
|
|
12644
|
+
* video and the image. `0.0` indicates no padding, and `1.0` indicates a fully
|
|
12645
|
+
* padded video width or length, as determined by the algorithm.
|
|
12646
|
+
*/
|
|
12647
|
+
padding?: number;
|
|
12648
|
+
/**
|
|
12649
|
+
* The size of the image relative to the overall size of the video. This
|
|
12650
|
+
* parameter will adapt to horizontal and vertical videos automatically. `0.0`
|
|
12651
|
+
* indicates no scaling (use the size of the image as-is), and `1.0 `fills the
|
|
12652
|
+
* entire video.
|
|
12653
|
+
*/
|
|
12654
|
+
scale?: number;
|
|
12655
|
+
/**
|
|
12656
|
+
* The location of the image.
|
|
12657
|
+
*/
|
|
12658
|
+
position?: StreamWatermarkPosition;
|
|
12659
|
+
};
|
|
12660
|
+
type StreamVideosListParams = {
|
|
12661
|
+
/**
|
|
12662
|
+
* The maximum number of videos to return.
|
|
12663
|
+
*/
|
|
12664
|
+
limit?: number;
|
|
12665
|
+
/**
|
|
12666
|
+
* Return videos created before this timestamp.
|
|
12667
|
+
* (RFC3339/RFC3339Nano)
|
|
12668
|
+
*/
|
|
12669
|
+
before?: string;
|
|
12670
|
+
/**
|
|
12671
|
+
* Comparison operator for the `before` field.
|
|
12672
|
+
* @default 'lt'
|
|
12673
|
+
*/
|
|
12674
|
+
beforeComp?: StreamPaginationComparison;
|
|
12675
|
+
/**
|
|
12676
|
+
* Return videos created after this timestamp.
|
|
12677
|
+
* (RFC3339/RFC3339Nano)
|
|
12678
|
+
*/
|
|
12679
|
+
after?: string;
|
|
12680
|
+
/**
|
|
12681
|
+
* Comparison operator for the `after` field.
|
|
12682
|
+
* @default 'gte'
|
|
12683
|
+
*/
|
|
12684
|
+
afterComp?: StreamPaginationComparison;
|
|
12685
|
+
};
|
|
12686
|
+
type StreamPaginationComparison = "eq" | "gt" | "gte" | "lt" | "lte";
|
|
12687
|
+
/**
|
|
12688
|
+
* Error object for Stream binding operations.
|
|
12689
|
+
*/
|
|
12690
|
+
interface StreamError extends Error {
|
|
12691
|
+
readonly code: number;
|
|
12692
|
+
readonly statusCode: number;
|
|
12693
|
+
readonly message: string;
|
|
12694
|
+
readonly stack?: string;
|
|
12695
|
+
}
|
|
12696
|
+
interface InternalError extends StreamError {
|
|
12697
|
+
name: "InternalError";
|
|
12698
|
+
}
|
|
12699
|
+
interface BadRequestError extends StreamError {
|
|
12700
|
+
name: "BadRequestError";
|
|
12701
|
+
}
|
|
12702
|
+
interface NotFoundError extends StreamError {
|
|
12703
|
+
name: "NotFoundError";
|
|
12704
|
+
}
|
|
12705
|
+
interface ForbiddenError extends StreamError {
|
|
12706
|
+
name: "ForbiddenError";
|
|
12707
|
+
}
|
|
12708
|
+
interface RateLimitedError extends StreamError {
|
|
12709
|
+
name: "RateLimitedError";
|
|
12710
|
+
}
|
|
12711
|
+
interface QuotaReachedError extends StreamError {
|
|
12712
|
+
name: "QuotaReachedError";
|
|
12713
|
+
}
|
|
12714
|
+
interface MaxFileSizeError extends StreamError {
|
|
12715
|
+
name: "MaxFileSizeError";
|
|
12716
|
+
}
|
|
12717
|
+
interface InvalidURLError extends StreamError {
|
|
12718
|
+
name: "InvalidURLError";
|
|
12719
|
+
}
|
|
12720
|
+
interface AlreadyUploadedError extends StreamError {
|
|
12721
|
+
name: "AlreadyUploadedError";
|
|
12722
|
+
}
|
|
12723
|
+
interface TooManyWatermarksError extends StreamError {
|
|
12724
|
+
name: "TooManyWatermarksError";
|
|
12725
|
+
}
|
|
11964
12726
|
type MarkdownDocument = {
|
|
11965
12727
|
name: string;
|
|
11966
12728
|
blob: Blob;
|