export type DeleteApiV2ClientsIdArgs = {id: string}; export type DeleteApiV2ClientsIdOptions = {baseUrl: string, JWTAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deactivate client * * DELETE /v2/clients/{id} */ export const deleteApiV2ClientsId = async (args: DeleteApiV2ClientsIdArgs, options: DeleteApiV2ClientsIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, JWTAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (JWTAuth !== undefined) headers.set('authorization', `Bearer ${JWTAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/clients/${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 };