export type RestoreSavedSearchToStorageRequest = {all_versions?: boolean | undefined, destination_directory_path?: (string | null) | undefined, formats?: Array | undefined, id: string, preferred_original_storage_id?: (string | null) | undefined, restore_priority?: ('LOW' | 'MID' | 'HIGH' | 'null' | null) | undefined, version_ids?: Array | undefined}; export type BulkRestoreSavedSearchRequestSchema = {destination_storage_id?: (string | null) | undefined, objects?: Array | undefined}; export type CreateApiV2SavedSearchesBulkRestoreArgs = {'Auth-Token': string, 'App-ID': string, allow_host_transfer?: boolean | undefined, body: BulkRestoreSavedSearchRequestSchema}; export type CreateApiV2SavedSearchesBulkRestoreOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Restore multiple saved searches. * * POST /v2/saved_searches/bulk/restore/ */ export const createApiV2SavedSearchesBulkRestore = async (args: CreateApiV2SavedSearchesBulkRestoreArgs, options: CreateApiV2SavedSearchesBulkRestoreOptions) => { 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(/\/+$/, '')}/v2/saved_searches/bulk/restore/${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 };