export type SegmentAttributeMatch = {name: string, operator?: ('eq' | 'lt' | 'gt') | undefined, value: unknown}; export type DeleteSegmentsSchema = {attributes?: Array | undefined, segment_ids?: Array | undefined, segment_type?: ('MARKER' | 'QC' | 'GENERIC' | 'COMMENT' | 'TAG' | 'TRANSCRIPTION' | 'SCENE' | 'SHOT' | 'PERSON' | 'SEMANTIC_TRANSCRIPTION') | undefined, version_id?: (string | null) | undefined}; export type DeleteApiV1AssetsAssetIdSegmentsBulkArgs = {'App-ID': string, 'Auth-Token': string, asset_id: string, immediately?: boolean | undefined, ignore_reindexing?: boolean | undefined, body: DeleteSegmentsSchema}; export type DeleteApiV1AssetsAssetIdSegmentsBulkOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Delete segments with either ids or by type * * DELETE /v1/assets/{asset_id}/segments/bulk/ */ export const deleteApiV1AssetsAssetIdSegmentsBulk = async (args: DeleteApiV1AssetsAssetIdSegmentsBulkArgs, options: DeleteApiV1AssetsAssetIdSegmentsBulkOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['App-ID'] != null) headers.set("App-ID", String(args['App-ID'])) if (args['Auth-Token'] != null) headers.set("Auth-Token", String(args['Auth-Token'])) if (args.immediately != null) query.append("immediately", String(args.immediately)) if (args.ignore_reindexing != null) query.append("ignore_reindexing", String(args.ignore_reindexing)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/assets/${encodeURIComponent(String(args.asset_id))}/segments/bulk/${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", 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 };