/* * 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 GeocodingUKRetrieveNearestPlacesResponseItem = { /** * The postcode that is nearest to the given location. */ postcode?: string | undefined; /** * The distance in metres from the CentrePoint to this record. */ distance?: number | undefined; /** * The easting coordinate of the location. Represents a distance in meters east from the most south westerly position of the GB mapping grid. */ easting?: number | undefined; /** * The northing coordinate of the location. Represents a distance in meters north from the most south westerly position of the GB mapping grid. */ northing?: number | undefined; /** * The WGS84 latitude coordinate of the location. */ latitude?: number | undefined; /** * The WGS84 longitude coordinate of the location. */ longitude?: number | undefined; /** * The OS grid reference for the location. */ osGrid?: string | undefined; }; export type GeocodingUKRetrieveNearestPlacesResponse = { items?: Array | undefined; }; /** @internal */ export const GeocodingUKRetrieveNearestPlacesResponseItem$inboundSchema: z.ZodType< GeocodingUKRetrieveNearestPlacesResponseItem, z.ZodTypeDef, unknown > = z.object({ Postcode: z.string().optional(), Distance: z.number().optional(), Easting: z.number().int().optional(), Northing: z.number().int().optional(), Latitude: z.number().optional(), Longitude: z.number().optional(), OsGrid: z.string().optional(), }).transform((v) => { return remap$(v, { "Postcode": "postcode", "Distance": "distance", "Easting": "easting", "Northing": "northing", "Latitude": "latitude", "Longitude": "longitude", "OsGrid": "osGrid", }); }); export function geocodingUKRetrieveNearestPlacesResponseItemFromJSON( jsonString: string, ): SafeParseResult< GeocodingUKRetrieveNearestPlacesResponseItem, SDKValidationError > { return safeParse( jsonString, (x) => GeocodingUKRetrieveNearestPlacesResponseItem$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'GeocodingUKRetrieveNearestPlacesResponseItem' from JSON`, ); } /** @internal */ export const GeocodingUKRetrieveNearestPlacesResponse$inboundSchema: z.ZodType< GeocodingUKRetrieveNearestPlacesResponse, z.ZodTypeDef, unknown > = z.object({ Items: z.array( z.lazy(() => GeocodingUKRetrieveNearestPlacesResponseItem$inboundSchema), ).optional(), }).transform((v) => { return remap$(v, { "Items": "items", }); }); export function geocodingUKRetrieveNearestPlacesResponseFromJSON( jsonString: string, ): SafeParseResult< GeocodingUKRetrieveNearestPlacesResponse, SDKValidationError > { return safeParse( jsonString, (x) => GeocodingUKRetrieveNearestPlacesResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'GeocodingUKRetrieveNearestPlacesResponse' from JSON`, ); }