/* * 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 GovernmentDataPostzonRetrieveByPostcodeOrPlaceResponseItem = { /** * The name of the location. */ location?: string | 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; /** * The ONS country code for the location. */ countryCode?: string | undefined; /** * The name corresponding to CountryCode. */ countryName?: string | undefined; /** * The ONS county code for the location. For locations without 2 tier local administration, this will be 00. */ countyCode?: string | undefined; /** * The name corresponding to CountyCode. */ countyName?: string | undefined; /** * The ONS district code for the location. */ districtCode?: string | undefined; /** * The name corresponding to DistrictCode. */ districtName?: string | undefined; /** * The ONS ward code for the location. */ wardCode?: string | undefined; /** * The name corresponding to WardCode. */ wardName?: string | undefined; /** * The ONS code for the NHS Strategic Health Authority for the location. */ nhsShaCode?: string | undefined; /** * The name corresponding to NhsShaCode. */ nhsShaName?: string | undefined; /** * The ONS code for the NHS Primary Care Trust for the location. */ nhsPctCode?: string | undefined; /** * The name corresponding to NhsPctCode. */ nhsPctName?: string | undefined; /** * The ONS code for the Local Education Authority for the location. */ leaCode?: string | undefined; /** * The name corresponding to LeaCode. */ leaName?: string | undefined; /** * The ONS code for the Government Office for the location. */ governmentOfficeCode?: string | undefined; /** * The name corresponding to GovernmentOfficeCode. */ governmentOfficeName?: string | undefined; /** * The ONS code for the Westminster parliamentary constituency for the location. */ westminsterConstituencyCode?: string | undefined; /** * The name corresponding to WestminsterConstituencyCode. */ westminsterConstituencyName?: string | undefined; /** * The name of the Westminster Member of Parliament for the location. */ westminsterMP?: string | undefined; /** * The party for WestminsterMP. */ westminsterParty?: string | undefined; /** * The ONS code (or temporary if > 900) for the Westminster parliamentary constituency for the location in 2010. */ westminsterConstituencyCode2010?: string | undefined; /** * The name corresponding to WestminsterConstituencyCode2010. */ westminsterConstituencyName2010?: string | undefined; }; export type GovernmentDataPostzonRetrieveByPostcodeOrPlaceResponse = { items?: | Array | undefined; }; /** @internal */ export const GovernmentDataPostzonRetrieveByPostcodeOrPlaceResponseItem$inboundSchema: z.ZodType< GovernmentDataPostzonRetrieveByPostcodeOrPlaceResponseItem, z.ZodTypeDef, unknown > = z.object({ Location: z.string().optional(), Easting: z.number().int().optional(), Northing: z.number().int().optional(), Latitude: z.number().optional(), Longitude: z.number().optional(), OsGrid: z.string().optional(), CountryCode: z.string().optional(), CountryName: z.string().optional(), CountyCode: z.string().optional(), CountyName: z.string().optional(), DistrictCode: z.string().optional(), DistrictName: z.string().optional(), WardCode: z.string().optional(), WardName: z.string().optional(), NhsShaCode: z.string().optional(), NhsShaName: z.string().optional(), NhsPctCode: z.string().optional(), NhsPctName: z.string().optional(), LeaCode: z.string().optional(), LeaName: z.string().optional(), GovernmentOfficeCode: z.string().optional(), GovernmentOfficeName: z.string().optional(), WestminsterConstituencyCode: z.string().optional(), WestminsterConstituencyName: z.string().optional(), WestminsterMP: z.string().optional(), WestminsterParty: z.string().optional(), WestminsterConstituencyCode2010: z.string().optional(), WestminsterConstituencyName2010: z.string().optional(), }).transform((v) => { return remap$(v, { "Location": "location", "Easting": "easting", "Northing": "northing", "Latitude": "latitude", "Longitude": "longitude", "OsGrid": "osGrid", "CountryCode": "countryCode", "CountryName": "countryName", "CountyCode": "countyCode", "CountyName": "countyName", "DistrictCode": "districtCode", "DistrictName": "districtName", "WardCode": "wardCode", "WardName": "wardName", "NhsShaCode": "nhsShaCode", "NhsShaName": "nhsShaName", "NhsPctCode": "nhsPctCode", "NhsPctName": "nhsPctName", "LeaCode": "leaCode", "LeaName": "leaName", "GovernmentOfficeCode": "governmentOfficeCode", "GovernmentOfficeName": "governmentOfficeName", "WestminsterConstituencyCode": "westminsterConstituencyCode", "WestminsterConstituencyName": "westminsterConstituencyName", "WestminsterMP": "westminsterMP", "WestminsterParty": "westminsterParty", "WestminsterConstituencyCode2010": "westminsterConstituencyCode2010", "WestminsterConstituencyName2010": "westminsterConstituencyName2010", }); }); export function governmentDataPostzonRetrieveByPostcodeOrPlaceResponseItemFromJSON( jsonString: string, ): SafeParseResult< GovernmentDataPostzonRetrieveByPostcodeOrPlaceResponseItem, SDKValidationError > { return safeParse( jsonString, (x) => GovernmentDataPostzonRetrieveByPostcodeOrPlaceResponseItem$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'GovernmentDataPostzonRetrieveByPostcodeOrPlaceResponseItem' from JSON`, ); } /** @internal */ export const GovernmentDataPostzonRetrieveByPostcodeOrPlaceResponse$inboundSchema: z.ZodType< GovernmentDataPostzonRetrieveByPostcodeOrPlaceResponse, z.ZodTypeDef, unknown > = z.object({ Items: z.array( z.lazy(() => GovernmentDataPostzonRetrieveByPostcodeOrPlaceResponseItem$inboundSchema ), ).optional(), }).transform((v) => { return remap$(v, { "Items": "items", }); }); export function governmentDataPostzonRetrieveByPostcodeOrPlaceResponseFromJSON( jsonString: string, ): SafeParseResult< GovernmentDataPostzonRetrieveByPostcodeOrPlaceResponse, SDKValidationError > { return safeParse( jsonString, (x) => GovernmentDataPostzonRetrieveByPostcodeOrPlaceResponse$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'GovernmentDataPostzonRetrieveByPostcodeOrPlaceResponse' from JSON`, ); }