/* * 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, Address$Outbound, Address$outboundSchema, } from "./address.js"; import { BankAccount1, BankAccount1$inboundSchema, BankAccount1$Outbound, BankAccount1$outboundSchema, } from "./bankaccount1.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 CompanyRowType = { id?: string | null | undefined; name?: string | null | undefined; }; export type Company1 = { /** * Unique identifier for the company */ id?: string | undefined; /** * Name of the company */ name: string | null; /** * Number of interactions */ interactionCount?: number | null | undefined; /** * Owner ID */ ownerId?: string | null | undefined; /** * The Image URL of the company */ image?: string | null | undefined; /** * A description of the company */ description?: string | null | undefined; /** * The VAT number of the company */ vatNumber?: string | 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 status of the company */ status?: string | null | undefined; /** * The fax number of the company */ fax?: string | null | undefined; /** * The annual revenue of the company */ annualRevenue?: string | null | undefined; /** * Number of employees */ numberOfEmployees?: string | null | undefined; /** * The industry represents the type of business the company is in. */ industry?: string | null | undefined; /** * The ownership indicates the type of ownership of the company. */ ownership?: string | null | undefined; /** * A sales tax number is a unique number that identifies a company for tax purposes. */ salesTaxNumber?: string | null | undefined; /** * A payee number is a unique number that identifies a payee for tax purposes. */ payeeNumber?: string | null | undefined; /** * An ABN is necessary for operating a business, while a TFN (Tax File Number) is required for any person working in Australia. */ abnOrTfn?: string | null | undefined; /** * An ABN Branch (also known as a GST Branch) is used if part of your business needs to account for GST separately from its parent entity. */ abnBranch?: string | null | undefined; /** * The Australian Company Number (ACN) is a nine digit number with the last digit being a check digit calculated using a modified modulus 10 calculation. ASIC has adopted a convention of always printing and displaying the ACN in the format XXX XXX XXX; three blocks of three characters, each block separated by a blank. */ acn?: string | null | undefined; /** * The first name of the person. */ firstName?: string | null | undefined; /** * The last name of the person. */ lastName?: string | null | undefined; /** * Parent ID */ parentId?: string | null | undefined; bankAccounts?: Array | undefined; websites?: Array | undefined; addresses?: Array
| undefined; socialLinks?: Array | undefined; phoneNumbers?: Array | undefined; emails?: Array | undefined; rowType?: CompanyRowType | undefined; customFields?: Array | undefined; tags?: Array | null | undefined; /** * Whether the company is read-only or not */ readOnly?: boolean | null | undefined; /** * Last activity date */ lastActivityAt?: Date | null | undefined; /** * Whether the company is deleted or not */ deleted?: boolean | undefined; /** * A formal salutation for the person. For example, 'Mr', 'Mrs' */ salutation?: string | null | undefined; /** * The date of birth of the person. */ birthday?: Date | null | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: { [k: string]: any } | null | undefined; /** * Updated by user ID */ updatedBy?: string | null | undefined; /** * Created by user ID */ createdBy?: string | null | undefined; /** * Last updated date */ updatedAt?: Date | null | undefined; /** * Creation date */ createdAt?: Date | 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; }; export type Company1Input = { /** * Name of the company */ name: string | null; /** * Owner ID */ ownerId?: string | null | undefined; /** * The Image URL of the company */ image?: string | null | undefined; /** * A description of the company */ description?: string | null | undefined; /** * The VAT number of the company */ vatNumber?: string | 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 status of the company */ status?: string | null | undefined; /** * The fax number of the company */ fax?: string | null | undefined; /** * The annual revenue of the company */ annualRevenue?: string | null | undefined; /** * Number of employees */ numberOfEmployees?: string | null | undefined; /** * The industry represents the type of business the company is in. */ industry?: string | null | undefined; /** * The ownership indicates the type of ownership of the company. */ ownership?: string | null | undefined; /** * A sales tax number is a unique number that identifies a company for tax purposes. */ salesTaxNumber?: string | null | undefined; /** * A payee number is a unique number that identifies a payee for tax purposes. */ payeeNumber?: string | null | undefined; /** * An ABN is necessary for operating a business, while a TFN (Tax File Number) is required for any person working in Australia. */ abnOrTfn?: string | null | undefined; /** * An ABN Branch (also known as a GST Branch) is used if part of your business needs to account for GST separately from its parent entity. */ abnBranch?: string | null | undefined; /** * The Australian Company Number (ACN) is a nine digit number with the last digit being a check digit calculated using a modified modulus 10 calculation. ASIC has adopted a convention of always printing and displaying the ACN in the format XXX XXX XXX; three blocks of three characters, each block separated by a blank. */ acn?: string | null | undefined; /** * The first name of the person. */ firstName?: string | null | undefined; /** * The last name of the person. */ lastName?: string | null | undefined; /** * Parent ID */ parentId?: string | null | undefined; bankAccounts?: Array | undefined; websites?: Array | undefined; addresses?: Array
| undefined; socialLinks?: Array | undefined; phoneNumbers?: Array | undefined; emails?: Array | undefined; rowType?: CompanyRowType | undefined; customFields?: Array | undefined; tags?: Array | null | undefined; /** * Whether the company is read-only or not */ readOnly?: boolean | null | undefined; /** * A formal salutation for the person. For example, 'Mr', 'Mrs' */ salutation?: string | null | undefined; /** * The date of birth of the person. */ birthday?: Date | 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 CompanyRowType$inboundSchema: z.ZodType< CompanyRowType, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.nullable(types.string()).optional(), name: z.nullable(types.string()).optional(), }) ); /** @internal */ export type CompanyRowType$Outbound = { id?: string | null | undefined; name?: string | null | undefined; }; /** @internal */ export const CompanyRowType$outboundSchema: z.ZodType< CompanyRowType$Outbound, z.ZodTypeDef, CompanyRowType > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.nullable(z.string()).optional(), name: z.nullable(z.string()).optional(), }) ); export function companyRowTypeToJSON(companyRowType: CompanyRowType): string { return JSON.stringify(CompanyRowType$outboundSchema.parse(companyRowType)); } export function companyRowTypeFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CompanyRowType$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CompanyRowType' from JSON`, ); } /** @internal */ export const Company1$inboundSchema: z.ZodType< Company1, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), name: types.nullable(types.string()), interaction_count: z.nullable(types.number()).optional(), owner_id: z.nullable(types.string()).optional(), image: z.nullable(types.string()).optional(), description: z.nullable(types.string()).optional(), vat_number: z.nullable(types.string()).optional(), currency: z.nullable(Currency$inboundSchema).optional(), status: z.nullable(types.string()).optional(), fax: z.nullable(types.string()).optional(), annual_revenue: z.nullable(types.string()).optional(), number_of_employees: z.nullable(types.string()).optional(), industry: z.nullable(types.string()).optional(), ownership: z.nullable(types.string()).optional(), sales_tax_number: z.nullable(types.string()).optional(), payee_number: z.nullable(types.string()).optional(), abn_or_tfn: z.nullable(types.string()).optional(), abn_branch: z.nullable(types.string()).optional(), acn: z.nullable(types.string()).optional(), first_name: z.nullable(types.string()).optional(), last_name: z.nullable(types.string()).optional(), parent_id: z.nullable(types.string()).optional(), bank_accounts: types.optional(z.array(BankAccount1$inboundSchema)), 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)), row_type: types.optional(z.lazy(() => CompanyRowType$inboundSchema)), custom_fields: types.optional(z.array(CustomField$inboundSchema)), tags: z.nullable(z.array(types.string())).optional(), read_only: z.nullable(types.boolean()).optional(), last_activity_at: z.nullable(types.date()).optional(), deleted: types.optional(types.boolean()), salutation: z.nullable(types.string()).optional(), birthday: z.nullable(types.date()).optional(), custom_mappings: z.nullable(z.record(z.any())).optional(), updated_by: z.nullable(types.string()).optional(), created_by: z.nullable(types.string()).optional(), updated_at: z.nullable(types.date()).optional(), created_at: z.nullable(types.date()).optional(), pass_through: types.optional(z.array(PassThroughBody$inboundSchema)), }).transform((v) => { return remap$(v, { "interaction_count": "interactionCount", "owner_id": "ownerId", "vat_number": "vatNumber", "annual_revenue": "annualRevenue", "number_of_employees": "numberOfEmployees", "sales_tax_number": "salesTaxNumber", "payee_number": "payeeNumber", "abn_or_tfn": "abnOrTfn", "abn_branch": "abnBranch", "first_name": "firstName", "last_name": "lastName", "parent_id": "parentId", "bank_accounts": "bankAccounts", "social_links": "socialLinks", "phone_numbers": "phoneNumbers", "row_type": "rowType", "custom_fields": "customFields", "read_only": "readOnly", "last_activity_at": "lastActivityAt", "custom_mappings": "customMappings", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", }); }) ); export function company1FromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Company1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Company1' from JSON`, ); } /** @internal */ export type Company1Input$Outbound = { name: string | null; owner_id?: string | null | undefined; image?: string | null | undefined; description?: string | null | undefined; vat_number?: string | null | undefined; currency?: string | null | undefined; status?: string | null | undefined; fax?: string | null | undefined; annual_revenue?: string | null | undefined; number_of_employees?: string | null | undefined; industry?: string | null | undefined; ownership?: string | null | undefined; sales_tax_number?: string | null | undefined; payee_number?: string | null | undefined; abn_or_tfn?: string | null | undefined; abn_branch?: string | null | undefined; acn?: string | null | undefined; first_name?: string | null | undefined; last_name?: string | null | undefined; parent_id?: string | null | undefined; bank_accounts?: Array | undefined; websites?: Array | undefined; addresses?: Array | undefined; social_links?: Array | undefined; phone_numbers?: Array | undefined; emails?: Array | undefined; row_type?: CompanyRowType$Outbound | undefined; custom_fields?: Array | undefined; tags?: Array | null | undefined; read_only?: boolean | null | undefined; salutation?: string | null | undefined; birthday?: string | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const Company1Input$outboundSchema: z.ZodType< Company1Input$Outbound, z.ZodTypeDef, Company1Input > = /* @__PURE__ */ lazySchema$(() => z.object({ name: z.nullable(z.string()), ownerId: z.nullable(z.string()).optional(), image: z.nullable(z.string()).optional(), description: z.nullable(z.string()).optional(), vatNumber: z.nullable(z.string()).optional(), currency: z.nullable(Currency$outboundSchema).optional(), status: z.nullable(z.string()).optional(), fax: z.nullable(z.string()).optional(), annualRevenue: z.nullable(z.string()).optional(), numberOfEmployees: z.nullable(z.string()).optional(), industry: z.nullable(z.string()).optional(), ownership: z.nullable(z.string()).optional(), salesTaxNumber: z.nullable(z.string()).optional(), payeeNumber: z.nullable(z.string()).optional(), abnOrTfn: z.nullable(z.string()).optional(), abnBranch: z.nullable(z.string()).optional(), acn: z.nullable(z.string()).optional(), firstName: z.nullable(z.string()).optional(), lastName: z.nullable(z.string()).optional(), parentId: z.nullable(z.string()).optional(), bankAccounts: z.array(BankAccount1$outboundSchema).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(), rowType: z.lazy(() => CompanyRowType$outboundSchema).optional(), customFields: z.array(CustomField$outboundSchema).optional(), tags: z.nullable(z.array(z.string())).optional(), readOnly: z.nullable(z.boolean()).optional(), salutation: z.nullable(z.string()).optional(), birthday: z.nullable( z.date().transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length)), ).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { ownerId: "owner_id", vatNumber: "vat_number", annualRevenue: "annual_revenue", numberOfEmployees: "number_of_employees", salesTaxNumber: "sales_tax_number", payeeNumber: "payee_number", abnOrTfn: "abn_or_tfn", abnBranch: "abn_branch", firstName: "first_name", lastName: "last_name", parentId: "parent_id", bankAccounts: "bank_accounts", socialLinks: "social_links", phoneNumbers: "phone_numbers", rowType: "row_type", customFields: "custom_fields", readOnly: "read_only", passThrough: "pass_through", }); }) ); export function company1InputToJSON(company1Input: Company1Input): string { return JSON.stringify(Company1Input$outboundSchema.parse(company1Input)); }