export type BulkShareDeleteSchema = {share_ids: Array}; export type DeleteApiV1SharesBulkArgs = {'App-ID': string, 'Auth-Token': string, body: BulkShareDeleteSchema}; export type DeleteApiV1SharesBulkOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Delete current user's multiple shares by ids * * DELETE /v1/shares/bulk/ */ export const deleteApiV1SharesBulk = async (args: DeleteApiV1SharesBulkArgs, options: DeleteApiV1SharesBulkOptions) => { 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/shares/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 };