export type DeleteApiApiV1ConnectionsConnectionIdArgs = {connection_id: string}; export type DeleteApiApiV1ConnectionsConnectionIdOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a connection * * DELETE /api/v1/connections/{connection_id} */ export const deleteApiApiV1ConnectionsConnectionId = async (args: DeleteApiApiV1ConnectionsConnectionIdArgs, options?: DeleteApiApiV1ConnectionsConnectionIdOptions) => { const {baseUrl = "https://$SCALEKIT_ENVIRONMENT_URL", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/connections/${encodeURIComponent(String(args.connection_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 };