export type GetApiV2PartitionPartitionIdAccountAccountIdUserPrevalidateEmailEmailArgs = {accountId: string, email: string, partitionId: string, userId?: string | undefined}; export type GetApiV2PartitionPartitionIdAccountAccountIdUserPrevalidateEmailEmailOptions = {baseUrl?: string | undefined, XAuthToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Prevalidate the end user's email address before saving the end user * * GET /v2/partition/{partitionId}/account/{accountId}/user/prevalidate/email/{email} */ export const getApiV2PartitionPartitionIdAccountAccountIdUserPrevalidateEmailEmail = async (args: GetApiV2PartitionPartitionIdAccountAccountIdUserPrevalidateEmailEmailArgs, options?: GetApiV2PartitionPartitionIdAccountAccountIdUserPrevalidateEmailEmailOptions) => { const {baseUrl = "https://api.alianza.com", fetch: fetchFn = fetch, XAuthToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.userId != null) query.append("userId", String(args.userId)) if (XAuthToken !== undefined) headers.set("X-AUTH-TOKEN", XAuthToken) const url = `${baseUrl.replace(/\/+$/, '')}/v2/partition/${encodeURIComponent(String(args.partitionId))}/account/${encodeURIComponent(String(args.accountId))}/user/prevalidate/email/${encodeURIComponent(String(args.email))}${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 };