/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type AccountAddressCreateRequest = { /** * The publicly shareable identifier used to identify your Bolt merchant division. */ xPublishableKey: string; /** * A unique identifier for a shopper's device, generated by Bolt. The value is retrieved with `Bolt.state.merchantClientId` in your frontend context, per-shopper. This header is required for proper attribution of this operation to your analytics reports. Omitting this header may result in incorrect statistics. */ xMerchantClientId?: string | undefined; addressListing: components.AddressListingInput; }; export type AccountAddressCreateResponse = { /** * HTTP response content type for this operation */ contentType: string; /** * HTTP response status code for this operation */ statusCode: number; /** * Raw HTTP response; suitable for custom response parsing */ rawResponse: Response; /** * The address was successfully added */ addressListing?: components.AddressListing | undefined; }; /** @internal */ export const AccountAddressCreateRequest$inboundSchema: z.ZodType< AccountAddressCreateRequest, z.ZodTypeDef, unknown > = z.object({ "X-Publishable-Key": z.string(), "X-Merchant-Client-Id": z.string().optional(), "address-listing": components.AddressListingInput$inboundSchema, }).transform((v) => { return remap$(v, { "X-Publishable-Key": "xPublishableKey", "X-Merchant-Client-Id": "xMerchantClientId", "address-listing": "addressListing", }); }); /** @internal */ export type AccountAddressCreateRequest$Outbound = { "X-Publishable-Key": string; "X-Merchant-Client-Id"?: string | undefined; "address-listing": components.AddressListingInput$Outbound; }; /** @internal */ export const AccountAddressCreateRequest$outboundSchema: z.ZodType< AccountAddressCreateRequest$Outbound, z.ZodTypeDef, AccountAddressCreateRequest > = z.object({ xPublishableKey: z.string(), xMerchantClientId: z.string().optional(), addressListing: components.AddressListingInput$outboundSchema, }).transform((v) => { return remap$(v, { xPublishableKey: "X-Publishable-Key", xMerchantClientId: "X-Merchant-Client-Id", addressListing: "address-listing", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountAddressCreateRequest$ { /** @deprecated use `AccountAddressCreateRequest$inboundSchema` instead. */ export const inboundSchema = AccountAddressCreateRequest$inboundSchema; /** @deprecated use `AccountAddressCreateRequest$outboundSchema` instead. */ export const outboundSchema = AccountAddressCreateRequest$outboundSchema; /** @deprecated use `AccountAddressCreateRequest$Outbound` instead. */ export type Outbound = AccountAddressCreateRequest$Outbound; } export function accountAddressCreateRequestToJSON( accountAddressCreateRequest: AccountAddressCreateRequest, ): string { return JSON.stringify( AccountAddressCreateRequest$outboundSchema.parse( accountAddressCreateRequest, ), ); } export function accountAddressCreateRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountAddressCreateRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountAddressCreateRequest' from JSON`, ); } /** @internal */ export const AccountAddressCreateResponse$inboundSchema: z.ZodType< AccountAddressCreateResponse, z.ZodTypeDef, unknown > = z.object({ ContentType: z.string(), StatusCode: z.number().int(), RawResponse: z.instanceof(Response), "address-listing": components.AddressListing$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "ContentType": "contentType", "StatusCode": "statusCode", "RawResponse": "rawResponse", "address-listing": "addressListing", }); }); /** @internal */ export type AccountAddressCreateResponse$Outbound = { ContentType: string; StatusCode: number; RawResponse: never; "address-listing"?: components.AddressListing$Outbound | undefined; }; /** @internal */ export const AccountAddressCreateResponse$outboundSchema: z.ZodType< AccountAddressCreateResponse$Outbound, z.ZodTypeDef, AccountAddressCreateResponse > = z.object({ contentType: z.string(), statusCode: z.number().int(), rawResponse: z.instanceof(Response).transform(() => { throw new Error("Response cannot be serialized"); }), addressListing: components.AddressListing$outboundSchema.optional(), }).transform((v) => { return remap$(v, { contentType: "ContentType", statusCode: "StatusCode", rawResponse: "RawResponse", addressListing: "address-listing", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountAddressCreateResponse$ { /** @deprecated use `AccountAddressCreateResponse$inboundSchema` instead. */ export const inboundSchema = AccountAddressCreateResponse$inboundSchema; /** @deprecated use `AccountAddressCreateResponse$outboundSchema` instead. */ export const outboundSchema = AccountAddressCreateResponse$outboundSchema; /** @deprecated use `AccountAddressCreateResponse$Outbound` instead. */ export type Outbound = AccountAddressCreateResponse$Outbound; } export function accountAddressCreateResponseToJSON( accountAddressCreateResponse: AccountAddressCreateResponse, ): string { return JSON.stringify( AccountAddressCreateResponse$outboundSchema.parse( accountAddressCreateResponse, ), ); } export function accountAddressCreateResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountAddressCreateResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountAddressCreateResponse' from JSON`, ); }