export type CreateApiAuthSendEmailConfirmationArgs = {cookie_name?: (string | null) | undefined}; export type CreateApiAuthSendEmailConfirmationOptions = {baseUrl?: string | undefined, APIKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Send an email confirmation * * POST /auth/send-email-confirmation */ export const createApiAuthSendEmailConfirmation = async (args: CreateApiAuthSendEmailConfirmationArgs, options?: CreateApiAuthSendEmailConfirmationOptions) => { const {baseUrl = "https://api.your-domain.com", fetch: fetchFn = fetch, APIKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.cookie_name != null) query.append("cookie_name", String(args.cookie_name)) if (APIKeyHeader !== undefined) headers.set("X-API-KEY", APIKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/auth/send-email-confirmation${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 };