/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Email, Email$inboundSchema, Email$Outbound, Email$outboundSchema, } from "./email.js"; import { PhoneNumber, PhoneNumber$inboundSchema, PhoneNumber$Outbound, PhoneNumber$outboundSchema, } from "./phonenumber.js"; /** * The customer this entity is linked to. */ export type LinkedEcommerceCustomer = { /** * The ID of the customer this entity is linked to. */ id: string | null; /** * Full name of the customer */ name?: string | null | undefined; /** * First name of the customer */ firstName?: string | null | undefined; /** * Last name of the customer */ lastName?: string | null | undefined; /** * Company name of the customer */ companyName?: string | null | undefined; phoneNumbers?: Array | undefined; emails?: Array | undefined; }; /** @internal */ export const LinkedEcommerceCustomer$inboundSchema: z.ZodType< LinkedEcommerceCustomer, z.ZodTypeDef, unknown > = z.object({ id: z.nullable(z.string()), name: z.nullable(z.string()).optional(), first_name: z.nullable(z.string()).optional(), last_name: z.nullable(z.string()).optional(), company_name: z.nullable(z.string()).optional(), phone_numbers: z.array(PhoneNumber$inboundSchema).optional(), emails: z.array(Email$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "first_name": "firstName", "last_name": "lastName", "company_name": "companyName", "phone_numbers": "phoneNumbers", }); }); /** @internal */ export type LinkedEcommerceCustomer$Outbound = { id: string | null; name?: string | null | undefined; first_name?: string | null | undefined; last_name?: string | null | undefined; company_name?: string | null | undefined; phone_numbers?: Array | undefined; emails?: Array | undefined; }; /** @internal */ export const LinkedEcommerceCustomer$outboundSchema: z.ZodType< LinkedEcommerceCustomer$Outbound, z.ZodTypeDef, LinkedEcommerceCustomer > = z.object({ id: z.nullable(z.string()), name: z.nullable(z.string()).optional(), firstName: z.nullable(z.string()).optional(), lastName: z.nullable(z.string()).optional(), companyName: z.nullable(z.string()).optional(), phoneNumbers: z.array(PhoneNumber$outboundSchema).optional(), emails: z.array(Email$outboundSchema).optional(), }).transform((v) => { return remap$(v, { firstName: "first_name", lastName: "last_name", companyName: "company_name", phoneNumbers: "phone_numbers", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace LinkedEcommerceCustomer$ { /** @deprecated use `LinkedEcommerceCustomer$inboundSchema` instead. */ export const inboundSchema = LinkedEcommerceCustomer$inboundSchema; /** @deprecated use `LinkedEcommerceCustomer$outboundSchema` instead. */ export const outboundSchema = LinkedEcommerceCustomer$outboundSchema; /** @deprecated use `LinkedEcommerceCustomer$Outbound` instead. */ export type Outbound = LinkedEcommerceCustomer$Outbound; } export function linkedEcommerceCustomerToJSON( linkedEcommerceCustomer: LinkedEcommerceCustomer, ): string { return JSON.stringify( LinkedEcommerceCustomer$outboundSchema.parse(linkedEcommerceCustomer), ); } export function linkedEcommerceCustomerFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LinkedEcommerceCustomer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LinkedEcommerceCustomer' from JSON`, ); }