export type DeleteApiApiV1WorkspacesSlugCollectionsIdViewsViewIdArgs = {id: string, viewId: string, expected_version: string}; export type DeleteApiApiV1WorkspacesSlugCollectionsIdViewsViewIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * DELETE /api/v1/workspaces/{slug}/collections/{id}/views/{viewId} */ export const deleteApiApiV1WorkspacesSlugCollectionsIdViewsViewId = async (args: DeleteApiApiV1WorkspacesSlugCollectionsIdViewsViewIdArgs, options?: DeleteApiApiV1WorkspacesSlugCollectionsIdViewsViewIdOptions) => { const {baseUrl = "https://api.trybrein.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() 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))}/views/${encodeURIComponent(String(args.viewId))}${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 };