export type BulkDeleteSchema = {content_only?: boolean | undefined, object_ids: Array, object_type: 'assets' | 'collections' | 'saved_searches'}; export type CreateApiV1DeleteQueueBulkArgs = {'App-ID': string, 'Auth-Token': string, body: BulkDeleteSchema}; export type CreateApiV1DeleteQueueBulkOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Bulk delete objects * * POST /v1/delete_queue/bulk/ */ export const createApiV1DeleteQueueBulk = async (args: CreateApiV1DeleteQueueBulkArgs, options: CreateApiV1DeleteQueueBulkOptions) => { 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/delete_queue/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 };