/* * 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 GovernmentDataPostzonRetrieveByPostcodeResponseItem = { /** * 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 new ONS country code for the location. */ newCountryCode?: 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 ONS new county code for the location. For locations without 2 tier local administration, this will be 00. */ newCountyCode?: string | undefined; /** * The name corresponding to CountyCode. */ countyName?: string | undefined; /** * The ONS district code for the location. */ districtCode?: string | undefined; /** * The new ONS district code for the location. */ newDistrictCode?: string | undefined; /** * The name corresponding to DistrictCode. */ districtName?: string | undefined; /** * The ONS ward code for the location. */ wardCode?: string | undefined; /** * The new ONS ward code for the location. */ newWardCode?: 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 new ONS code for the NHS Strategic Health Authority for the location. */ newNhsShaCode?: 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 new ONS code for the NHS Primary Care Trust for the location. */ newNhsPctCode?: 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; /** * The LSOA code for this area. */ lsoaCode?: string | undefined; /** * The LSOA name for this area. */ lsoaName?: string | undefined; /** * The MSOA code for this area. */ msoaCode?: string | undefined; /** * The MSOA name for this area. */ msoaName?: string | undefined; /** * The Clinical Commissioning Group code for this area. */ ccgCode?: string | undefined; /** * The Clinical Commissioning Group name for this area. */ ccgName?: string | undefined; /** * The Clinical Commissioning Group area code for this area. */ ccgAreaCode?: string | undefined; /** * The Clinical Commissioning Group area name for this area. */ ccgAreaName?: string | undefined; /** * The Clinical Commissioning Group region code for this area. */ ccgRegionCode?: string | undefined; /** * The Clinical Commissioning Group region name for this area. */ ccgRegionName?: string | undefined; }; export type GovernmentDataPostzonRetrieveByPostcodeResponse = { items?: | Array | undefined; }; /** @internal */ export const GovernmentDataPostzonRetrieveByPostcodeResponseItem$inboundSchema: z.ZodType< GovernmentDataPostzonRetrieveByPostcodeResponseItem, z.ZodTypeDef, unknown > = z.object({ 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(), NewCountryCode: z.string().optional(), CountryName: z.string().optional(), CountyCode: z.string().optional(), NewCountyCode: z.string().optional(), CountyName: z.string().optional(), DistrictCode: z.string().optional(), NewDistrictCode: z.string().optional(), DistrictName: z.string().optional(), WardCode: z.string().optional(), NewWardCode: z.string().optional(), WardName: z.string().optional(), NhsShaCode: z.string().optional(), NewNhsShaCode: z.string().optional(), NhsShaName: z.string().optional(), NhsPctCode: z.string().optional(), NewNhsPctCode: 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(), LSOACode: z.string().optional(), LSOAName: z.string().optional(), MSOACode: z.string().optional(), MSOAName: z.string().optional(), CCGCode: z.string().optional(), CCGName: z.string().optional(), CCGAreaCode: z.string().optional(), CCGAreaName: z.string().optional(), CCGRegionCode: z.string().optional(), CCGRegionName: z.string().optional(), }).transform((v) => { return remap$(v, { "Easting": "easting", "Northing": "northing", "Latitude": "latitude", "Longitude": "longitude", "OsGrid": "osGrid", "CountryCode": "countryCode", "NewCountryCode": "newCountryCode", "CountryName": "countryName", "CountyCode": "countyCode", "NewCountyCode": "newCountyCode", "CountyName": "countyName", "DistrictCode": "districtCode", "NewDistrictCode": "newDistrictCode", "DistrictName": "districtName", "WardCode": "wardCode", "NewWardCode": "newWardCode", "WardName": "wardName", "NhsShaCode": "nhsShaCode", "NewNhsShaCode": "newNhsShaCode", "NhsShaName": "nhsShaName", "NhsPctCode": "nhsPctCode", "NewNhsPctCode": "newNhsPctCode", "NhsPctName": "nhsPctName", "LeaCode": "leaCode", "LeaName": "leaName", "GovernmentOfficeCode": "governmentOfficeCode", "GovernmentOfficeName": "governmentOfficeName", "WestminsterConstituencyCode": "westminsterConstituencyCode", "WestminsterConstituencyName": "westminsterConstituencyName", "WestminsterMP": "westminsterMP", "WestminsterParty": "westminsterParty", "WestminsterConstituencyCode2010": "westminsterConstituencyCode2010", "WestminsterConstituencyName2010": "westminsterConstituencyName2010", "LSOACode": "lsoaCode", "LSOAName": "lsoaName", "MSOACode": "msoaCode", "MSOAName": "msoaName", "CCGCode": "ccgCode", "CCGName": "ccgName", "CCGAreaCode": "ccgAreaCode", "CCGAreaName": "ccgAreaName", "CCGRegionCode": "ccgRegionCode", "CCGRegionName": "ccgRegionName", }); }); export function governmentDataPostzonRetrieveByPostcodeResponseItemFromJSON( jsonString: string, ): SafeParseResult< GovernmentDataPostzonRetrieveByPostcodeResponseItem, SDKValidationError > { return safeParse( jsonString, (x) => GovernmentDataPostzonRetrieveByPostcodeResponseItem$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'GovernmentDataPostzonRetrieveByPostcodeResponseItem' from JSON`, ); } /** @internal */ export const GovernmentDataPostzonRetrieveByPostcodeResponse$inboundSchema: z.ZodType< GovernmentDataPostzonRetrieveByPostcodeResponse, z.ZodTypeDef, unknown > = z.object({ Items: z.array( z.lazy(() => GovernmentDataPostzonRetrieveByPostcodeResponseItem$inboundSchema ), ).optional(), }).transform((v) => { return remap$(v, { "Items": "items", }); }); export function governmentDataPostzonRetrieveByPostcodeResponseFromJSON( jsonString: string, ): SafeParseResult< GovernmentDataPostzonRetrieveByPostcodeResponse, SDKValidationError > { return safeParse( jsonString, (x) => GovernmentDataPostzonRetrieveByPostcodeResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'GovernmentDataPostzonRetrieveByPostcodeResponse' from JSON`, ); }