/* * 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 { Address, Address$inboundSchema, Address$Outbound, Address$outboundSchema, } from "./address.js"; import { Currency, Currency$inboundSchema, Currency$outboundSchema, } from "./currency.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"; export type LeadInput = { /** * Full name of the lead. */ name: string; /** * The name of the company the lead is associated with. */ companyName: string | null; /** * 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 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 | undefined; tags?: Array | 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 LeadInput$inboundSchema: z.ZodType< LeadInput, z.ZodTypeDef, unknown > = z.object({ name: z.string(), company_name: z.nullable(z.string()), owner_id: z.nullable(z.string()).optional(), owner_name: z.nullable(z.string()).optional(), company_id: z.nullable(z.string()).optional(), lead_id: z.nullable(z.string()).optional(), lead_source: z.nullable(z.string()).optional(), first_name: z.nullable(z.string()).optional(), last_name: z.nullable(z.string()).optional(), description: z.nullable(z.string()).optional(), prefix: z.nullable(z.string()).optional(), title: z.nullable(z.string()).optional(), language: z.nullable(z.string()).optional(), status: z.nullable(z.string()).optional(), monetary_amount: z.nullable(z.number()).optional(), currency: z.nullable(Currency$inboundSchema).optional(), fax: z.nullable(z.string()).optional(), websites: z.array(Website$inboundSchema).optional(), addresses: z.array(Address$inboundSchema).optional(), social_links: z.array(SocialLink$inboundSchema).optional(), phone_numbers: z.array(PhoneNumber$inboundSchema).optional(), emails: z.array(Email$inboundSchema).optional(), custom_fields: z.array(CustomField$inboundSchema).optional(), tags: z.nullable(z.array(z.string())).optional(), pass_through: z.array(PassThroughBody$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "company_name": "companyName", "owner_id": "ownerId", "owner_name": "ownerName", "company_id": "companyId", "lead_id": "leadId", "lead_source": "leadSource", "first_name": "firstName", "last_name": "lastName", "monetary_amount": "monetaryAmount", "social_links": "socialLinks", "phone_numbers": "phoneNumbers", "custom_fields": "customFields", "pass_through": "passThrough", }); }); /** @internal */ export type LeadInput$Outbound = { name: string; company_name: string | null; owner_id?: string | null | undefined; owner_name?: string | null | undefined; company_id?: string | null | undefined; lead_id?: string | null | undefined; lead_source?: string | null | undefined; first_name?: string | null | undefined; last_name?: string | null | undefined; description?: string | null | undefined; prefix?: string | null | undefined; title?: string | null | undefined; language?: string | null | undefined; status?: string | null | undefined; monetary_amount?: number | null | undefined; currency?: string | null | undefined; fax?: string | null | undefined; websites?: Array | undefined; addresses?: Array | undefined; social_links?: Array | undefined; phone_numbers?: Array | undefined; emails?: Array | undefined; custom_fields?: Array | undefined; tags?: Array | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const LeadInput$outboundSchema: z.ZodType< LeadInput$Outbound, z.ZodTypeDef, LeadInput > = z.object({ name: z.string(), companyName: z.nullable(z.string()), ownerId: z.nullable(z.string()).optional(), ownerName: z.nullable(z.string()).optional(), companyId: z.nullable(z.string()).optional(), leadId: z.nullable(z.string()).optional(), leadSource: z.nullable(z.string()).optional(), firstName: z.nullable(z.string()).optional(), lastName: z.nullable(z.string()).optional(), description: z.nullable(z.string()).optional(), prefix: z.nullable(z.string()).optional(), title: z.nullable(z.string()).optional(), language: z.nullable(z.string()).optional(), status: z.nullable(z.string()).optional(), monetaryAmount: z.nullable(z.number()).optional(), currency: z.nullable(Currency$outboundSchema).optional(), fax: z.nullable(z.string()).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(), customFields: z.array(CustomField$outboundSchema).optional(), tags: z.nullable(z.array(z.string())).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { companyName: "company_name", ownerId: "owner_id", ownerName: "owner_name", companyId: "company_id", leadId: "lead_id", leadSource: "lead_source", firstName: "first_name", lastName: "last_name", monetaryAmount: "monetary_amount", socialLinks: "social_links", phoneNumbers: "phone_numbers", customFields: "custom_fields", passThrough: "pass_through", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace LeadInput$ { /** @deprecated use `LeadInput$inboundSchema` instead. */ export const inboundSchema = LeadInput$inboundSchema; /** @deprecated use `LeadInput$outboundSchema` instead. */ export const outboundSchema = LeadInput$outboundSchema; /** @deprecated use `LeadInput$Outbound` instead. */ export type Outbound = LeadInput$Outbound; } export function leadInputToJSON(leadInput: LeadInput): string { return JSON.stringify(LeadInput$outboundSchema.parse(leadInput)); } export function leadInputFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LeadInput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LeadInput' from JSON`, ); }