export type BulkFilesetArchiveSchema = {allow_duplicate_transfers?: boolean | undefined, delete_only_from_source_folder?: boolean | undefined, delete_original?: boolean | undefined, destination_directory_path?: (string | null) | undefined, destination_storage_id?: (string | null) | undefined, keep_collection_structure?: boolean | undefined, keep_parent_collection_structure?: boolean | undefined, object_ids: Array, object_type: 'assets' | 'collections' | 'playlists' | 'saved_searches', preferred_original_storage_id?: (string | null) | undefined}; export type CreateApiV1FormatsFormatNameArchiveBulkArgs = {'Auth-Token': string, 'App-ID': string, format_name: string, allow_host_transfer?: boolean | undefined, body: BulkFilesetArchiveSchema}; export type CreateApiV1FormatsFormatNameArchiveBulkOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Queue bulk archiving of assets, collections and saved_searches * * POST /v1/formats/{format_name}/archive/bulk/ */ export const createApiV1FormatsFormatNameArchiveBulk = async (args: CreateApiV1FormatsFormatNameArchiveBulkArgs, options: CreateApiV1FormatsFormatNameArchiveBulkOptions) => { 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'])) if (args.allow_host_transfer != null) query.append("allow_host_transfer", String(args.allow_host_transfer)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/formats/${encodeURIComponent(String(args.format_name))}/archive/bulk/${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 };