export type DeleteApiV1CollectionsCollectionIdArgs = {'App-ID': string, 'Auth-Token': string, collection_id: string, trigger_storage_event?: boolean | undefined}; export type DeleteApiV1CollectionsCollectionIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Delete a particular collection by id * * DELETE /v1/collections/{collection_id}/ */ export const deleteApiV1CollectionsCollectionId = async (args: DeleteApiV1CollectionsCollectionIdArgs, options: DeleteApiV1CollectionsCollectionIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() 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'])) if (args.trigger_storage_event != null) query.append("trigger_storage_event", String(args.trigger_storage_event)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/collections/${encodeURIComponent(String(args.collection_id))}/${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };