export type StorageSchema = {default?: boolean | undefined, description?: (string | null) | undefined, id?: string | undefined, last_scanned?: (string | null) | undefined, method: 'FILE' | 'HTTP' | 'FTP' | 'SFTP' | 'S3' | 'B2' | 'GCS' | 'PORTAL' | 'CUSTOM' | 'AZURE' | 'DROPBOX', name: string, purpose: 'KEYFRAMES' | 'FILES' | 'PROXIES' | 'EXPORTS' | 'ARCHIVE' | 'FACES', scanner_status?: (string | null) | undefined, settings: {[key: string]: unknown}, status?: ('ACTIVE' | 'INACTIVE' | 'FAILING') | undefined, status_message?: (string | null) | undefined, version?: string | undefined}; export type UpdateApiV1StoragesStorageIdSearchDocumentArgs = {'App-ID': string, 'Auth-Token': string, storage_id: string, body: StorageSchema}; export type UpdateApiV1StoragesStorageIdSearchDocumentOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Update search document for storage * * PUT /v1/storages/{storage_id}/search_document/ */ export const updateApiV1StoragesStorageIdSearchDocument = async (args: UpdateApiV1StoragesStorageIdSearchDocumentArgs, options: UpdateApiV1StoragesStorageIdSearchDocumentOptions) => { 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'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/storages/${encodeURIComponent(String(args.storage_id))}/search_document/${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };