export type GetApiV1AuthConfirmEmailArgs = {userId?: string | undefined, code?: string | undefined, redirectUrl?: string | undefined, domain?: string | undefined}; export type GetApiV1AuthConfirmEmailOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * GET /V1/auth/confirmEmail */ export const getApiV1AuthConfirmEmail = async (args: GetApiV1AuthConfirmEmailArgs, options: GetApiV1AuthConfirmEmailOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.userId != null) query.append("userId", String(args.userId)) if (args.code != null) query.append("code", String(args.code)) if (args.redirectUrl != null) query.append("redirectUrl", String(args.redirectUrl)) if (args.domain != null) query.append("domain", String(args.domain)) const url = `${baseUrl.replace(/\/+$/, '')}/V1/auth/confirmEmail${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };