export type DeleteApiApiV1WorkspacesSlugCollectionsIdArgs = {id: string, dry_run: string, expected_version: string}; export type DeleteApiApiV1WorkspacesSlugCollectionsIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * DELETE /api/v1/workspaces/{slug}/collections/{id} */ export const deleteApiApiV1WorkspacesSlugCollectionsId = async (args: DeleteApiApiV1WorkspacesSlugCollectionsIdArgs, options?: DeleteApiApiV1WorkspacesSlugCollectionsIdOptions) => { const {baseUrl = "https://api.trybrein.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.dry_run != null) query.append("dry_run", String(args.dry_run)) if (args.expected_version != null) query.append("expected_version", String(args.expected_version)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/workspaces/${encodeURIComponent(String(args.slug))}/collections/${encodeURIComponent(String(args.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 };