export type BulkTranscodeSchema = {format_name?: string | undefined, object_ids: Array, object_type: 'assets' | 'collections' | 'playlists' | 'saved_searches', prefer_any_cloud?: boolean | undefined, preferred_storage_id?: string | undefined, preferred_storage_method?: ('FILE' | 'HTTP' | 'FTP' | 'SFTP' | 'S3' | 'B2' | 'GCS' | 'PORTAL' | 'CUSTOM' | 'AZURE' | 'DROPBOX') | undefined, priority?: number | undefined}; export type CreateApiV1AssetsBulkKeyframesArgs = {'Auth-Token': string, 'App-ID': string, body: BulkTranscodeSchema}; export type CreateApiV1AssetsBulkKeyframesOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Create a transcode job for proxy and keyframes generation of multiple assets * * POST /v1/assets/bulk/keyframes/ */ export const createApiV1AssetsBulkKeyframes = async (args: CreateApiV1AssetsBulkKeyframesArgs, options: CreateApiV1AssetsBulkKeyframesOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Auth-Token'] != null) headers.set("Auth-Token", String(args['Auth-Token'])) if (args['App-ID'] != null) headers.set("App-ID", String(args['App-ID'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/assets/bulk/keyframes/${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };