/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AddressCompleteCreateRequest, AddressCompleteCreateRequest$inboundSchema, AddressCompleteCreateRequest$Outbound, AddressCompleteCreateRequest$outboundSchema, } from "./addresscompletecreaterequest.js"; /** * Where your parcels will be available for pickup. "Security Deck" and "Shipping Dock" are only * * @remarks * supported for DHL Express. */ export const BuildingLocationType = { BackDoor: "Back Door", RingBell: "Ring Bell", SecurityDeck: "Security Deck", ShippingDock: "Shipping Dock", FrontDoor: "Front Door", KnockOnDoor: "Knock on Door", InAtMailbox: "In/At Mailbox", MailRoom: "Mail Room", Office: "Office", Other: "Other", Reception: "Reception", SideDoor: "Side Door", } as const; /** * Where your parcels will be available for pickup. "Security Deck" and "Shipping Dock" are only * * @remarks * supported for DHL Express. */ export type BuildingLocationType = ClosedEnum; /** * The type of building where the pickup is located. */ export const BuildingType = { Apartment: "apartment", Building: "building", Department: "department", Floor: "floor", Room: "room", Suite: "suite", } as const; /** * The type of building where the pickup is located. */ export type BuildingType = ClosedEnum; /** * Location where the parcel(s) will be picked up. */ export type Location = { /** * The pickup address, which includes your name, company name, street address, city, state, zip code, * * @remarks * country, phone number, and email address (strings). Special characters should not be included in * any address element, especially name, company, and email. */ address: AddressCompleteCreateRequest; /** * Where your parcels will be available for pickup. "Security Deck" and "Shipping Dock" are only * * @remarks * supported for DHL Express. */ buildingLocationType: BuildingLocationType; /** * The type of building where the pickup is located. */ buildingType?: BuildingType | undefined; /** * Pickup instructions for the courier. This is a mandatory field if the building_location_type is "Other". */ instructions?: string | undefined; }; /** @internal */ export const BuildingLocationType$inboundSchema: z.ZodMiniEnum< typeof BuildingLocationType > = z.enum(BuildingLocationType); /** @internal */ export const BuildingLocationType$outboundSchema: z.ZodMiniEnum< typeof BuildingLocationType > = BuildingLocationType$inboundSchema; /** @internal */ export const BuildingType$inboundSchema: z.ZodMiniEnum = z .enum(BuildingType); /** @internal */ export const BuildingType$outboundSchema: z.ZodMiniEnum = BuildingType$inboundSchema; /** @internal */ export const Location$inboundSchema: z.ZodMiniType = z.pipe( z.object({ address: AddressCompleteCreateRequest$inboundSchema, building_location_type: BuildingLocationType$inboundSchema, building_type: z.optional(BuildingType$inboundSchema), instructions: z.optional(z.string()), }), z.transform((v) => { return remap$(v, { "building_location_type": "buildingLocationType", "building_type": "buildingType", }); }), ); /** @internal */ export type Location$Outbound = { address: AddressCompleteCreateRequest$Outbound; building_location_type: string; building_type?: string | undefined; instructions?: string | undefined; }; /** @internal */ export const Location$outboundSchema: z.ZodMiniType< Location$Outbound, Location > = z.pipe( z.object({ address: AddressCompleteCreateRequest$outboundSchema, buildingLocationType: BuildingLocationType$outboundSchema, buildingType: z.optional(BuildingType$outboundSchema), instructions: z.optional(z.string()), }), z.transform((v) => { return remap$(v, { buildingLocationType: "building_location_type", buildingType: "building_type", }); }), ); export function locationToJSON(location: Location): string { return JSON.stringify(Location$outboundSchema.parse(location)); } export function locationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Location$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Location' from JSON`, ); }