export type DeleteApiClientsExternalTenantIdArgs = {externalTenantId: string}; export type DeleteApiClientsExternalTenantIdOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reset a client (test environment only) * * DELETE /clients/{externalTenantId} */ export const deleteApiClientsExternalTenantId = async (args: DeleteApiClientsExternalTenantIdArgs, options?: DeleteApiClientsExternalTenantIdOptions) => { const {baseUrl = "https://referral-api.debitura.com", fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (ApiKey !== undefined) headers.set("XApiKey", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/clients/${encodeURIComponent(String(args.externalTenantId))}${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 };