export type UUID4 = unknown; export type DeleteApiEmailsIdArgs = {id: UUID4}; export type DeleteApiEmailsIdOptions = {baseUrl?: string | undefined, CookieAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete an email address * * DELETE /emails/{id} * * Also accepts auth: BearerTokenAuth */ export const deleteApiEmailsId = async (args: DeleteApiEmailsIdArgs, options?: DeleteApiEmailsIdOptions) => { const {baseUrl = "https://.hanko.io/admin", fetch: fetchFn = fetch, CookieAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (CookieAuth !== undefined) cookies.push("hanko=" + encodeURIComponent(CookieAuth)) const url = `${baseUrl.replace(/\/+$/, '')}/emails/${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 };