/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../lib/primitives.js"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; export type EmailValidationInteractiveValidateResponseItem = { /** * @remarks * Valid - The email address has been fully validated (including the account portion) * Valid_CatchAll - The domain has been validated but the account could not be validated * Invalid - The email address is invalid and shouldn't be accepted * Timeout - The validation could not be completed within the timeout specified (try increasing the timeout value) */ responseCode?: string | undefined; /** * A textual description of the ResponseCode returned */ responseMessage?: string | undefined; /** * The email address that verification was attempted on. */ emailAddress?: string | undefined; /** * The account portion of the email address provided. */ userAccount?: string | undefined; /** * The domain portion of the email address provided. */ domain?: string | undefined; /** * Whether the email address provided is a disposable mailbox (some companies create temporary mailboxes which shouldn't be used for marketing communications). */ isDisposableOrTemporary?: boolean | undefined; /** * This field is no longer valid and will always return False */ isComplainerOrFraudRisk?: boolean | undefined; /** * The duration (in seconds) that the email validation took (maximum timeout enforced at 15 seconds). We recommend a high timeout (at least 5 seconds) value as it will minimise the number of "Timeout" responses returned. */ duration?: number | undefined; /** * The Reason the email wasnt valid */ reason?: string | undefined; /** * High, Medium, Low or Unknown. This score is an aggregated analysis of all the email fields returned and gives an indication of whether mail should be sent to that address. Higher risk indicates a greater likelihood that the email will bounce. */ risk?: string | undefined; }; export type EmailValidationInteractiveValidateResponse = { items?: Array | undefined; }; /** @internal */ export const EmailValidationInteractiveValidateResponseItem$inboundSchema: z.ZodType< EmailValidationInteractiveValidateResponseItem, z.ZodTypeDef, unknown > = z.object({ ResponseCode: z.string().optional(), ResponseMessage: z.string().optional(), EmailAddress: z.string().optional(), UserAccount: z.string().optional(), Domain: z.string().optional(), IsDisposableOrTemporary: z.boolean().optional(), IsComplainerOrFraudRisk: z.boolean().optional(), Duration: z.number().optional(), Reason: z.string().optional(), Risk: z.string().optional(), }).transform((v) => { return remap$(v, { "ResponseCode": "responseCode", "ResponseMessage": "responseMessage", "EmailAddress": "emailAddress", "UserAccount": "userAccount", "Domain": "domain", "IsDisposableOrTemporary": "isDisposableOrTemporary", "IsComplainerOrFraudRisk": "isComplainerOrFraudRisk", "Duration": "duration", "Reason": "reason", "Risk": "risk", }); }); export function emailValidationInteractiveValidateResponseItemFromJSON( jsonString: string, ): SafeParseResult< EmailValidationInteractiveValidateResponseItem, SDKValidationError > { return safeParse( jsonString, (x) => EmailValidationInteractiveValidateResponseItem$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'EmailValidationInteractiveValidateResponseItem' from JSON`, ); } /** @internal */ export const EmailValidationInteractiveValidateResponse$inboundSchema: z.ZodType = z.object({ Items: z.array( z.lazy(() => EmailValidationInteractiveValidateResponseItem$inboundSchema ), ).optional(), }).transform((v) => { return remap$(v, { "Items": "items", }); }); export function emailValidationInteractiveValidateResponseFromJSON( jsonString: string, ): SafeParseResult< EmailValidationInteractiveValidateResponse, SDKValidationError > { return safeParse( jsonString, (x) => EmailValidationInteractiveValidateResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'EmailValidationInteractiveValidateResponse' from JSON`, ); }