/* * 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 PhoneNumberValidationInteractiveValidateResponseItem = { /** * The recipient phone number in international format. */ phoneNumber?: string | undefined; /** * Returns true if we managed to process the request on the network or false if the validation attempt was unsuccessful. */ requestProcessed?: boolean | undefined; /** * Whether the number is valid or not (Maybe is returned if full validation couldn't be performed. Cellular network issues can cause temporary failures in the validation procedure). ([Yes|No|Maybe]) */ isValid?: string | undefined; /** * The current operator serving the supplied number. */ networkCode?: string | undefined; /** * The name of the current operator serving the supplied number. */ networkName?: string | undefined; /** * The country code of the operator. */ networkCountry?: string | undefined; /** * The domestic network format (useful for dialling from within the same country). */ nationalFormat?: string | undefined; /** * The country prefix that must be prepended to the number when dialling internationally. */ countryPrefix?: number | undefined; /** * The type of number that was detected in the request (MOBILE, LANDLINE OR VOIP). */ numberType?: string | undefined; /** * (Optional) The mobile country code and mobile network code concatenated. */ mccMnc?: string | undefined; /** * (Optional) Returns True if the number has been ported to another network. */ ported?: string | undefined; /** * (Optional) The ported network name that the mobile number is registered with. */ portedNetworkName?: string | undefined; /** * (Optional) The country code of the network that the mobile number has been ported to. */ portedNetworkCountry?: string | undefined; /** * (Optional) Returns True if the number is currently roaming in another country. */ roaming?: string | undefined; /** * (Optional) The network name that the mobile number is currently registered with whilst roaming. */ roamingNetworkName?: string | undefined; /** * (Optional) The network country that the mobile number is currently in whilst roaming. */ roamingNetworkCountry?: string | undefined; /** * (Optional) The original network name that the mobile number was registered with. */ originalNetworkName?: string | undefined; /** * (Optional) The original country code that the phone was registered with. */ originalNetworkCountry?: string | undefined; }; export type PhoneNumberValidationInteractiveValidateResponse = { items?: | Array | undefined; }; /** @internal */ export const PhoneNumberValidationInteractiveValidateResponseItem$inboundSchema: z.ZodType< PhoneNumberValidationInteractiveValidateResponseItem, z.ZodTypeDef, unknown > = z.object({ PhoneNumber: z.string().optional(), RequestProcessed: z.boolean().optional(), IsValid: z.string().optional(), NetworkCode: z.string().optional(), NetworkName: z.string().optional(), NetworkCountry: z.string().optional(), NationalFormat: z.string().optional(), CountryPrefix: z.number().int().optional(), NumberType: z.string().optional(), MccMnc: z.string().optional(), Ported: z.string().optional(), PortedNetworkName: z.string().optional(), PortedNetworkCountry: z.string().optional(), Roaming: z.string().optional(), RoamingNetworkName: z.string().optional(), RoamingNetworkCountry: z.string().optional(), OriginalNetworkName: z.string().optional(), OriginalNetworkCountry: z.string().optional(), }).transform((v) => { return remap$(v, { "PhoneNumber": "phoneNumber", "RequestProcessed": "requestProcessed", "IsValid": "isValid", "NetworkCode": "networkCode", "NetworkName": "networkName", "NetworkCountry": "networkCountry", "NationalFormat": "nationalFormat", "CountryPrefix": "countryPrefix", "NumberType": "numberType", "MccMnc": "mccMnc", "Ported": "ported", "PortedNetworkName": "portedNetworkName", "PortedNetworkCountry": "portedNetworkCountry", "Roaming": "roaming", "RoamingNetworkName": "roamingNetworkName", "RoamingNetworkCountry": "roamingNetworkCountry", "OriginalNetworkName": "originalNetworkName", "OriginalNetworkCountry": "originalNetworkCountry", }); }); export function phoneNumberValidationInteractiveValidateResponseItemFromJSON( jsonString: string, ): SafeParseResult< PhoneNumberValidationInteractiveValidateResponseItem, SDKValidationError > { return safeParse( jsonString, (x) => PhoneNumberValidationInteractiveValidateResponseItem$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PhoneNumberValidationInteractiveValidateResponseItem' from JSON`, ); } /** @internal */ export const PhoneNumberValidationInteractiveValidateResponse$inboundSchema: z.ZodType< PhoneNumberValidationInteractiveValidateResponse, z.ZodTypeDef, unknown > = z.object({ Items: z.array( z.lazy(() => PhoneNumberValidationInteractiveValidateResponseItem$inboundSchema ), ).optional(), }).transform((v) => { return remap$(v, { "Items": "items", }); }); export function phoneNumberValidationInteractiveValidateResponseFromJSON( jsonString: string, ): SafeParseResult< PhoneNumberValidationInteractiveValidateResponse, SDKValidationError > { return safeParse( jsonString, (x) => PhoneNumberValidationInteractiveValidateResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PhoneNumberValidationInteractiveValidateResponse' from JSON`, ); }