export type DeleteApiConsentsConsentIdArgs = {consentId: string}; export type DeleteApiConsentsConsentIdOptions = {baseUrl: string, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete consent * * DELETE /consents/{consentId} */ export const deleteApiConsentsConsentId = async (args: DeleteApiConsentsConsentIdArgs, options: DeleteApiConsentsConsentIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, xApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (xApiKey !== undefined) headers.set("x-api-key", xApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/consents/${encodeURIComponent(String(args.consentId))}${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 };