/* * 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 { smartUnion } from "../../types/smartUnion.js"; import { AddressInput, AddressInput$Outbound, AddressInput$outboundSchema, } from "./addressinput.js"; import { CustomerType, CustomerType$outboundSchema } from "./customertype.js"; export type CustomerUpdateMetadata = string | number | number | boolean; export type CustomerUpdate = { /** * Key-value object allowing you to store additional information. * * @remarks * * The key must be a string with a maximum length of **40 characters**. * The value must be either: * * * A string with a maximum length of **500 characters** * * An integer * * A floating-point number * * A boolean * * You can store up to **50 key-value pairs**. */ metadata?: { [k: string]: string | number | number | boolean } | undefined; /** * The email address of the customer. This must be unique within the organization. */ email?: string | null | undefined; name?: string | null | undefined; billingAddress?: AddressInput | null | undefined; taxId?: string | null | undefined; locale?: string | null | undefined; /** * The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated. */ externalId?: string | null | undefined; /** * The customer type. Can only be upgraded from 'individual' to 'team', never downgraded. */ type?: CustomerType | null | undefined; }; /** @internal */ export type CustomerUpdateMetadata$Outbound = | string | number | number | boolean; /** @internal */ export const CustomerUpdateMetadata$outboundSchema: z.ZodMiniType< CustomerUpdateMetadata$Outbound, CustomerUpdateMetadata > = smartUnion([z.string(), z.int(), z.number(), z.boolean()]); export function customerUpdateMetadataToJSON( customerUpdateMetadata: CustomerUpdateMetadata, ): string { return JSON.stringify( CustomerUpdateMetadata$outboundSchema.parse(customerUpdateMetadata), ); } /** @internal */ export type CustomerUpdate$Outbound = { metadata?: { [k: string]: string | number | number | boolean } | undefined; email?: string | null | undefined; name?: string | null | undefined; billing_address?: AddressInput$Outbound | null | undefined; tax_id?: string | null | undefined; locale?: string | null | undefined; external_id?: string | null | undefined; type?: string | null | undefined; }; /** @internal */ export const CustomerUpdate$outboundSchema: z.ZodMiniType< CustomerUpdate$Outbound, CustomerUpdate > = z.pipe( z.object({ metadata: z.optional( z.record( z.string(), smartUnion([z.string(), z.int(), z.number(), z.boolean()]), ), ), email: z.optional(z.nullable(z.string())), name: z.optional(z.nullable(z.string())), billingAddress: z.optional(z.nullable(AddressInput$outboundSchema)), taxId: z.optional(z.nullable(z.string())), locale: z.optional(z.nullable(z.string())), externalId: z.optional(z.nullable(z.string())), type: z.optional(z.nullable(CustomerType$outboundSchema)), }), z.transform((v) => { return remap$(v, { billingAddress: "billing_address", taxId: "tax_id", externalId: "external_id", }); }), ); export function customerUpdateToJSON(customerUpdate: CustomerUpdate): string { return JSON.stringify(CustomerUpdate$outboundSchema.parse(customerUpdate)); }