/* * 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 ExtrasWebIp2CountryResponseItem = { /** * The IP address that was checked. */ ipAddress?: string | undefined; /** * The 2 digit ISO code to the country matched to the IP address. Blank if the country was not found. */ iso2?: string | undefined; /** * The 3 digit ISO code to the country matched to the IP address. Blank if the country was not found. */ iso3?: string | undefined; /** * The full name of the country matching the IP address. Blank if the country was not found. */ country?: string | undefined; }; export type ExtrasWebIp2CountryResponse = { items?: Array | undefined; }; /** @internal */ export const ExtrasWebIp2CountryResponseItem$inboundSchema: z.ZodType< ExtrasWebIp2CountryResponseItem, z.ZodTypeDef, unknown > = z.object({ IpAddress: z.string().optional(), Iso2: z.string().optional(), Iso3: z.string().optional(), Country: z.string().optional(), }).transform((v) => { return remap$(v, { "IpAddress": "ipAddress", "Iso2": "iso2", "Iso3": "iso3", "Country": "country", }); }); export function extrasWebIp2CountryResponseItemFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ExtrasWebIp2CountryResponseItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtrasWebIp2CountryResponseItem' from JSON`, ); } /** @internal */ export const ExtrasWebIp2CountryResponse$inboundSchema: z.ZodType< ExtrasWebIp2CountryResponse, z.ZodTypeDef, unknown > = z.object({ Items: z.array(z.lazy(() => ExtrasWebIp2CountryResponseItem$inboundSchema)) .optional(), }).transform((v) => { return remap$(v, { "Items": "items", }); }); export function extrasWebIp2CountryResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ExtrasWebIp2CountryResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtrasWebIp2CountryResponse' from JSON`, ); }