export type Identifier = string; export type DeleteApiV3WorkspacesIdentifierArgs = {identifier: Identifier}; export type DeleteApiV3WorkspacesIdentifierOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a workspace * * DELETE /v3/workspaces/{identifier} */ export const deleteApiV3WorkspacesIdentifier = async (args: DeleteApiV3WorkspacesIdentifierArgs, options?: DeleteApiV3WorkspacesIdentifierOptions) => { const {baseUrl = "https://api.affinda.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (ApiKeyAuth !== undefined) headers.set('authorization', `Bearer ${ApiKeyAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v3/workspaces/${encodeURIComponent(String(args.identifier))}${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 };