/* * 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 GeocodingInternationalRetrieveNearestPlacesResponseItem = { /** * The postcode that is nearest to the given location. */ location?: string | undefined; /** * The distance in KM from the CentrePoint to this record. */ distance?: number | undefined; /** * The WGS84 latitude coordinate of the location. */ latitude?: number | undefined; /** * The WGS84 longitude coordinate of the location. */ longitude?: number | undefined; }; export type GeocodingInternationalRetrieveNearestPlacesResponse = { items?: | Array | undefined; }; /** @internal */ export const GeocodingInternationalRetrieveNearestPlacesResponseItem$inboundSchema: z.ZodType< GeocodingInternationalRetrieveNearestPlacesResponseItem, z.ZodTypeDef, unknown > = z.object({ Location: z.string().optional(), Distance: z.number().optional(), Latitude: z.number().optional(), Longitude: z.number().optional(), }).transform((v) => { return remap$(v, { "Location": "location", "Distance": "distance", "Latitude": "latitude", "Longitude": "longitude", }); }); export function geocodingInternationalRetrieveNearestPlacesResponseItemFromJSON( jsonString: string, ): SafeParseResult< GeocodingInternationalRetrieveNearestPlacesResponseItem, SDKValidationError > { return safeParse( jsonString, (x) => GeocodingInternationalRetrieveNearestPlacesResponseItem$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'GeocodingInternationalRetrieveNearestPlacesResponseItem' from JSON`, ); } /** @internal */ export const GeocodingInternationalRetrieveNearestPlacesResponse$inboundSchema: z.ZodType< GeocodingInternationalRetrieveNearestPlacesResponse, z.ZodTypeDef, unknown > = z.object({ Items: z.array( z.lazy(() => GeocodingInternationalRetrieveNearestPlacesResponseItem$inboundSchema ), ).optional(), }).transform((v) => { return remap$(v, { "Items": "items", }); }); export function geocodingInternationalRetrieveNearestPlacesResponseFromJSON( jsonString: string, ): SafeParseResult< GeocodingInternationalRetrieveNearestPlacesResponse, SDKValidationError > { return safeParse( jsonString, (x) => GeocodingInternationalRetrieveNearestPlacesResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'GeocodingInternationalRetrieveNearestPlacesResponse' from JSON`, ); }