/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Address, Address$inboundSchema, Address$Outbound, Address$outboundSchema, } from "./address.js"; import { CustomField, CustomField$inboundSchema, CustomField$Outbound, CustomField$outboundSchema, } from "./customfield.js"; import { Email, Email$inboundSchema, Email$Outbound, Email$outboundSchema, } from "./email.js"; import { PassThroughBody, PassThroughBody$inboundSchema, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; import { PhoneNumber, PhoneNumber$inboundSchema, PhoneNumber$Outbound, PhoneNumber$outboundSchema, } from "./phonenumber.js"; import { SocialLink, SocialLink$inboundSchema, SocialLink$Outbound, SocialLink$outboundSchema, } from "./sociallink.js"; import { Website, Website$inboundSchema, Website$Outbound, Website$outboundSchema, } from "./website.js"; /** * The type of the contact. */ export const ContactType = { Customer: "customer", Supplier: "supplier", Employee: "employee", Personal: "personal", } as const; /** * The type of the contact. */ export type ContactType = OpenEnum; /** * The gender of the contact. */ export const ContactGender = { Male: "male", Female: "female", Unisex: "unisex", } as const; /** * The gender of the contact. */ export type ContactGender = OpenEnum; export type Contact = { /** * Unique identifier for the contact. */ id?: string | undefined; /** * Full name of the contact. */ name?: string | null | undefined; /** * The owner of the contact. */ ownerId?: string | null | undefined; /** * The type of the contact. */ type?: ContactType | null | undefined; /** * The company the contact is associated with. */ companyId?: string | null | undefined; /** * The name of the company the contact is associated with. */ companyName?: string | null | undefined; /** * The lead the contact is associated with. */ leadId?: string | null | undefined; /** * The first name of the contact. */ firstName?: string | null | undefined; /** * The middle name of the contact. */ middleName?: string | null | undefined; /** * The last name of the contact. */ lastName?: string | null | undefined; /** * The prefix of the contact. */ prefix?: string | null | undefined; /** * The suffix of the contact. */ suffix?: string | null | undefined; /** * The job title of the contact. */ title?: string | null | undefined; /** * The department of the contact. */ department?: string | null | undefined; /** * language code according to ISO 639-1. For the United States - EN */ language?: string | null | undefined; /** * The gender of the contact. */ gender?: ContactGender | null | undefined; /** * The birthday of the contact. */ birthday?: string | null | undefined; /** * @deprecated field: This field is deprecated and may be removed in a future version.. */ image?: string | null | undefined; /** * The URL of the photo of a person. */ photoUrl?: string | null | undefined; /** * The lead source of the contact. */ leadSource?: string | null | undefined; /** * The fax number of the contact. */ fax?: string | null | undefined; /** * The description of the contact. */ description?: string | null | undefined; /** * The current balance of the contact. */ currentBalance?: number | null | undefined; /** * The status of the contact. */ status?: string | null | undefined; /** * The active status of the contact. */ active?: boolean | null | undefined; websites?: Array | undefined; addresses?: Array
| undefined; socialLinks?: Array | undefined; phoneNumbers?: Array | undefined; emails?: Array | undefined; emailDomain?: string | null | undefined; customFields?: Array | null | undefined; tags?: Array | null | undefined; /** * The first call date of the contact. */ firstCallAt?: Date | null | undefined; /** * The first email date of the contact. */ firstEmailAt?: Date | null | undefined; /** * The last activity date of the contact. */ lastActivityAt?: Date | null | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: { [k: string]: any } | null | undefined; /** * The last update date of the contact. */ updatedAt?: Date | null | undefined; /** * The creation date of the contact. */ createdAt?: Date | null | undefined; /** * The opportunity ids of the contact. */ opportunityIds?: Array | undefined; /** * The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. */ passThrough?: Array | undefined; }; export type ContactInput = { /** * Full name of the contact. */ name?: string | null | undefined; /** * The owner of the contact. */ ownerId?: string | null | undefined; /** * The type of the contact. */ type?: ContactType | null | undefined; /** * The company the contact is associated with. */ companyId?: string | null | undefined; /** * The name of the company the contact is associated with. */ companyName?: string | null | undefined; /** * The lead the contact is associated with. */ leadId?: string | null | undefined; /** * The first name of the contact. */ firstName?: string | null | undefined; /** * The middle name of the contact. */ middleName?: string | null | undefined; /** * The last name of the contact. */ lastName?: string | null | undefined; /** * The prefix of the contact. */ prefix?: string | null | undefined; /** * The suffix of the contact. */ suffix?: string | null | undefined; /** * The job title of the contact. */ title?: string | null | undefined; /** * The department of the contact. */ department?: string | null | undefined; /** * language code according to ISO 639-1. For the United States - EN */ language?: string | null | undefined; /** * The gender of the contact. */ gender?: ContactGender | null | undefined; /** * The birthday of the contact. */ birthday?: string | null | undefined; /** * @deprecated field: This field is deprecated and may be removed in a future version.. */ image?: string | null | undefined; /** * The URL of the photo of a person. */ photoUrl?: string | null | undefined; /** * The lead source of the contact. */ leadSource?: string | null | undefined; /** * The fax number of the contact. */ fax?: string | null | undefined; /** * The description of the contact. */ description?: string | null | undefined; /** * The current balance of the contact. */ currentBalance?: number | null | undefined; /** * The status of the contact. */ status?: string | null | undefined; /** * The active status of the contact. */ active?: boolean | null | undefined; websites?: Array | undefined; addresses?: Array
| undefined; socialLinks?: Array | undefined; phoneNumbers?: Array | undefined; emails?: Array | undefined; emailDomain?: string | null | undefined; customFields?: Array | null | undefined; tags?: Array | null | undefined; /** * The opportunity ids of the contact. */ opportunityIds?: Array | undefined; /** * The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. */ passThrough?: Array | undefined; }; /** @internal */ export const ContactType$inboundSchema: z.ZodType< ContactType, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(ContactType)); /** @internal */ export const ContactType$outboundSchema: z.ZodType< string, z.ZodTypeDef, ContactType > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(ContactType)); /** @internal */ export const ContactGender$inboundSchema: z.ZodType< ContactGender, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(ContactGender)); /** @internal */ export const ContactGender$outboundSchema: z.ZodType< string, z.ZodTypeDef, ContactGender > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(ContactGender)); /** @internal */ export const Contact$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), name: z.nullable(types.string()).optional(), owner_id: z.nullable(types.string()).optional(), type: z.nullable(ContactType$inboundSchema).optional(), company_id: z.nullable(types.string()).optional(), company_name: z.nullable(types.string()).optional(), lead_id: z.nullable(types.string()).optional(), first_name: z.nullable(types.string()).optional(), middle_name: z.nullable(types.string()).optional(), last_name: z.nullable(types.string()).optional(), prefix: z.nullable(types.string()).optional(), suffix: z.nullable(types.string()).optional(), title: z.nullable(types.string()).optional(), department: z.nullable(types.string()).optional(), language: z.nullable(types.string()).optional(), gender: z.nullable(ContactGender$inboundSchema).optional(), birthday: z.nullable(types.string()).optional(), image: z.nullable(types.string()).optional(), photo_url: z.nullable(types.string()).optional(), lead_source: z.nullable(types.string()).optional(), fax: z.nullable(types.string()).optional(), description: z.nullable(types.string()).optional(), current_balance: z.nullable(types.number()).optional(), status: z.nullable(types.string()).optional(), active: z.nullable(types.boolean()).optional(), websites: types.optional(z.array(Website$inboundSchema)), addresses: types.optional(z.array(Address$inboundSchema)), social_links: types.optional(z.array(SocialLink$inboundSchema)), phone_numbers: types.optional(z.array(PhoneNumber$inboundSchema)), emails: types.optional(z.array(Email$inboundSchema)), email_domain: z.nullable(types.string()).optional(), custom_fields: z.nullable(z.array(CustomField$inboundSchema)).optional(), tags: z.nullable(z.array(types.string())).optional(), first_call_at: z.nullable(types.date()).optional(), first_email_at: z.nullable(types.date()).optional(), last_activity_at: z.nullable(types.date()).optional(), custom_mappings: z.nullable(z.record(z.any())).optional(), updated_at: z.nullable(types.date()).optional(), created_at: z.nullable(types.date()).optional(), opportunity_ids: types.optional(z.array(types.string())), pass_through: types.optional(z.array(PassThroughBody$inboundSchema)), }).transform((v) => { return remap$(v, { "owner_id": "ownerId", "company_id": "companyId", "company_name": "companyName", "lead_id": "leadId", "first_name": "firstName", "middle_name": "middleName", "last_name": "lastName", "photo_url": "photoUrl", "lead_source": "leadSource", "current_balance": "currentBalance", "social_links": "socialLinks", "phone_numbers": "phoneNumbers", "email_domain": "emailDomain", "custom_fields": "customFields", "first_call_at": "firstCallAt", "first_email_at": "firstEmailAt", "last_activity_at": "lastActivityAt", "custom_mappings": "customMappings", "updated_at": "updatedAt", "created_at": "createdAt", "opportunity_ids": "opportunityIds", "pass_through": "passThrough", }); }) ); export function contactFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Contact$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Contact' from JSON`, ); } /** @internal */ export type ContactInput$Outbound = { name?: string | null | undefined; owner_id?: string | null | undefined; type?: string | null | undefined; company_id?: string | null | undefined; company_name?: string | null | undefined; lead_id?: string | null | undefined; first_name?: string | null | undefined; middle_name?: string | null | undefined; last_name?: string | null | undefined; prefix?: string | null | undefined; suffix?: string | null | undefined; title?: string | null | undefined; department?: string | null | undefined; language?: string | null | undefined; gender?: string | null | undefined; birthday?: string | null | undefined; image?: string | null | undefined; photo_url?: string | null | undefined; lead_source?: string | null | undefined; fax?: string | null | undefined; description?: string | null | undefined; current_balance?: number | null | undefined; status?: string | null | undefined; active?: boolean | null | undefined; websites?: Array | undefined; addresses?: Array | undefined; social_links?: Array | undefined; phone_numbers?: Array | undefined; emails?: Array | undefined; email_domain?: string | null | undefined; custom_fields?: Array | null | undefined; tags?: Array | null | undefined; opportunity_ids?: Array | undefined; pass_through?: Array | undefined; }; /** @internal */ export const ContactInput$outboundSchema: z.ZodType< ContactInput$Outbound, z.ZodTypeDef, ContactInput > = /* @__PURE__ */ lazySchema$(() => z.object({ name: z.nullable(z.string()).optional(), ownerId: z.nullable(z.string()).optional(), type: z.nullable(ContactType$outboundSchema).optional(), companyId: z.nullable(z.string()).optional(), companyName: z.nullable(z.string()).optional(), leadId: z.nullable(z.string()).optional(), firstName: z.nullable(z.string()).optional(), middleName: z.nullable(z.string()).optional(), lastName: z.nullable(z.string()).optional(), prefix: z.nullable(z.string()).optional(), suffix: z.nullable(z.string()).optional(), title: z.nullable(z.string()).optional(), department: z.nullable(z.string()).optional(), language: z.nullable(z.string()).optional(), gender: z.nullable(ContactGender$outboundSchema).optional(), birthday: z.nullable(z.string()).optional(), image: z.nullable(z.string()).optional(), photoUrl: z.nullable(z.string()).optional(), leadSource: z.nullable(z.string()).optional(), fax: z.nullable(z.string()).optional(), description: z.nullable(z.string()).optional(), currentBalance: z.nullable(z.number()).optional(), status: z.nullable(z.string()).optional(), active: z.nullable(z.boolean()).optional(), websites: z.array(Website$outboundSchema).optional(), addresses: z.array(Address$outboundSchema).optional(), socialLinks: z.array(SocialLink$outboundSchema).optional(), phoneNumbers: z.array(PhoneNumber$outboundSchema).optional(), emails: z.array(Email$outboundSchema).optional(), emailDomain: z.nullable(z.string()).optional(), customFields: z.nullable(z.array(CustomField$outboundSchema)).optional(), tags: z.nullable(z.array(z.string())).optional(), opportunityIds: z.array(z.string()).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { ownerId: "owner_id", companyId: "company_id", companyName: "company_name", leadId: "lead_id", firstName: "first_name", middleName: "middle_name", lastName: "last_name", photoUrl: "photo_url", leadSource: "lead_source", currentBalance: "current_balance", socialLinks: "social_links", phoneNumbers: "phone_numbers", emailDomain: "email_domain", customFields: "custom_fields", opportunityIds: "opportunity_ids", passThrough: "pass_through", }); }) ); export function contactInputToJSON(contactInput: ContactInput): string { return JSON.stringify(ContactInput$outboundSchema.parse(contactInput)); }