export type UUID4 = unknown; export type CreateApiEmailsIdSetPrimaryArgs = {id: UUID4}; export type CreateApiEmailsIdSetPrimaryOptions = {baseUrl?: string | undefined, CookieAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Marks the email address as primary email * * POST /emails/{id}/set_primary * * Also accepts auth: BearerTokenAuth */ export const createApiEmailsIdSetPrimary = async (args: CreateApiEmailsIdSetPrimaryArgs, options?: CreateApiEmailsIdSetPrimaryOptions) => { 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))}/set_primary${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };