/* * 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"; /** * The customer this entity is linked to. */ export type LinkedCustomer = { /** * The ID of the customer this entity is linked to. */ id?: string | undefined; /** * The display ID of the customer. */ displayId?: string | null | undefined; /** * The display name of the customer. */ displayName?: string | null | undefined; /** * The name of the customer. Deprecated, use display_name instead. * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ name?: string | undefined; /** * The company name of the customer. */ companyName?: string | null | undefined; /** * The email address of the customer. */ email?: string | undefined; }; /** @internal */ export const LinkedCustomer$inboundSchema: z.ZodType< LinkedCustomer, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), display_id: z.nullable(z.string()).optional(), display_name: z.nullable(z.string()).optional(), name: z.string().optional(), company_name: z.nullable(z.string()).optional(), email: z.string().optional(), }).transform((v) => { return remap$(v, { "display_id": "displayId", "display_name": "displayName", "company_name": "companyName", }); }); /** @internal */ export type LinkedCustomer$Outbound = { id?: string | undefined; display_id?: string | null | undefined; display_name?: string | null | undefined; name?: string | undefined; company_name?: string | null | undefined; email?: string | undefined; }; /** @internal */ export const LinkedCustomer$outboundSchema: z.ZodType< LinkedCustomer$Outbound, z.ZodTypeDef, LinkedCustomer > = z.object({ id: z.string().optional(), displayId: z.nullable(z.string()).optional(), displayName: z.nullable(z.string()).optional(), name: z.string().optional(), companyName: z.nullable(z.string()).optional(), email: z.string().optional(), }).transform((v) => { return remap$(v, { displayId: "display_id", displayName: "display_name", companyName: "company_name", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace LinkedCustomer$ { /** @deprecated use `LinkedCustomer$inboundSchema` instead. */ export const inboundSchema = LinkedCustomer$inboundSchema; /** @deprecated use `LinkedCustomer$outboundSchema` instead. */ export const outboundSchema = LinkedCustomer$outboundSchema; /** @deprecated use `LinkedCustomer$Outbound` instead. */ export type Outbound = LinkedCustomer$Outbound; } export function linkedCustomerToJSON(linkedCustomer: LinkedCustomer): string { return JSON.stringify(LinkedCustomer$outboundSchema.parse(linkedCustomer)); } export function linkedCustomerFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LinkedCustomer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LinkedCustomer' from JSON`, ); }