/* * 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 GeocodingUKReverseGeocodeResponseItem = { /** * 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 GeocodingUKReverseGeocodeResponse = { items?: Array | undefined; }; /** @internal */ export const GeocodingUKReverseGeocodeResponseItem$inboundSchema: z.ZodType< GeocodingUKReverseGeocodeResponseItem, 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 geocodingUKReverseGeocodeResponseItemFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GeocodingUKReverseGeocodeResponseItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GeocodingUKReverseGeocodeResponseItem' from JSON`, ); } /** @internal */ export const GeocodingUKReverseGeocodeResponse$inboundSchema: z.ZodType< GeocodingUKReverseGeocodeResponse, z.ZodTypeDef, unknown > = z.object({ Items: z.array( z.lazy(() => GeocodingUKReverseGeocodeResponseItem$inboundSchema), ).optional(), }).transform((v) => { return remap$(v, { "Items": "items", }); }); export function geocodingUKReverseGeocodeResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GeocodingUKReverseGeocodeResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GeocodingUKReverseGeocodeResponse' from JSON`, ); }