/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Address, Address$inboundSchema } from "./address.js"; import { Currency, Currency$inboundSchema } from "./currency.js"; import { CustomField, CustomField$inboundSchema } from "./customfield.js"; import { Email, Email$inboundSchema } from "./email.js"; import { PassThroughBody, PassThroughBody$inboundSchema, } from "./passthroughbody.js"; import { PhoneNumber, PhoneNumber$inboundSchema } from "./phonenumber.js"; import { SocialLink, SocialLink$inboundSchema } from "./sociallink.js"; import { Website, Website$inboundSchema } from "./website.js"; export type Lead = { /** * Unique identifier for the contact. */ id?: string | undefined; /** * Full name of the lead. */ name: string; /** * The name of the company the lead is associated with. */ companyName?: string | null | undefined; /** * The owner of the lead. */ ownerId?: string | null | undefined; /** * The name of the owner of the lead. */ ownerName?: string | null | undefined; /** * The company the lead is associated with. */ companyId?: string | null | undefined; /** * The contact the lead is associated with. */ contactId?: string | null | undefined; /** * The identifier of the lead. */ leadId?: string | null | undefined; /** * The source of the lead. */ leadSource?: string | null | undefined; /** * The first name of the lead. */ firstName?: string | null | undefined; /** * The last name of the lead. */ lastName?: string | null | undefined; /** * The description of the lead. */ description?: string | null | undefined; /** * The prefix of the lead. */ prefix?: string | null | undefined; /** * The job title of the lead. */ title?: string | null | undefined; /** * language code according to ISO 639-1. For the United States - EN */ language?: string | null | undefined; status?: string | null | undefined; /** * The monetary amount of the lead. */ monetaryAmount?: number | null | undefined; /** * Indicates the associated currency for an amount of money. Values correspond to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). */ currency?: Currency | null | undefined; /** * The fax number of the lead. */ fax?: string | null | undefined; websites?: Array | undefined; addresses?: Array
| undefined; socialLinks?: Array | undefined; phoneNumbers?: Array | undefined; emails?: Array | undefined; customFields?: Array | null | undefined; tags?: Array | null | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: { [k: string]: any } | null | undefined; /** * Date updated in ISO 8601 format */ updatedAt?: string | null | undefined; /** * Date created in ISO 8601 format */ createdAt?: string | null | 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 Lead$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), name: types.string(), company_name: z.nullable(types.string()).optional(), owner_id: z.nullable(types.string()).optional(), owner_name: z.nullable(types.string()).optional(), company_id: z.nullable(types.string()).optional(), contact_id: z.nullable(types.string()).optional(), lead_id: z.nullable(types.string()).optional(), lead_source: z.nullable(types.string()).optional(), first_name: z.nullable(types.string()).optional(), last_name: z.nullable(types.string()).optional(), description: z.nullable(types.string()).optional(), prefix: z.nullable(types.string()).optional(), title: z.nullable(types.string()).optional(), language: z.nullable(types.string()).optional(), status: z.nullable(types.string()).optional(), monetary_amount: z.nullable(types.number()).optional(), currency: z.nullable(Currency$inboundSchema).optional(), fax: z.nullable(types.string()).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)), custom_fields: z.nullable(z.array(CustomField$inboundSchema)).optional(), tags: z.nullable(z.array(types.string())).optional(), custom_mappings: z.nullable(z.record(z.any())).optional(), updated_at: z.nullable(types.string()).optional(), created_at: z.nullable(types.string()).optional(), pass_through: types.optional(z.array(PassThroughBody$inboundSchema)), }).transform((v) => { return remap$(v, { "company_name": "companyName", "owner_id": "ownerId", "owner_name": "ownerName", "company_id": "companyId", "contact_id": "contactId", "lead_id": "leadId", "lead_source": "leadSource", "first_name": "firstName", "last_name": "lastName", "monetary_amount": "monetaryAmount", "social_links": "socialLinks", "phone_numbers": "phoneNumbers", "custom_fields": "customFields", "custom_mappings": "customMappings", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", }); }) ); export function leadFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Lead$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Lead' from JSON`, ); }