/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * A collection of links for the company. */ export type CompanyReferenceLinks = { /** * Link to the company page in the portal. */ portal?: string | undefined; }; export type CompanyReference = { /** * Unique identifier for your SMB in Codat. */ id?: string | undefined; /** * The name of the company */ name?: string | undefined; /** * Additional information about the company. This can be used to store foreign IDs, references, etc. */ description?: string | undefined; /** * A collection of links for the company. */ links?: CompanyReferenceLinks | undefined; /** * A collection of user-defined key-value pairs that store custom metadata against the company. */ tags?: { [k: string]: string } | undefined; }; /** @internal */ export const CompanyReferenceLinks$inboundSchema: z.ZodType< CompanyReferenceLinks, z.ZodTypeDef, unknown > = z.object({ portal: z.string().optional(), }); /** @internal */ export type CompanyReferenceLinks$Outbound = { portal?: string | undefined; }; /** @internal */ export const CompanyReferenceLinks$outboundSchema: z.ZodType< CompanyReferenceLinks$Outbound, z.ZodTypeDef, CompanyReferenceLinks > = z.object({ portal: z.string().optional(), }); export function companyReferenceLinksToJSON( companyReferenceLinks: CompanyReferenceLinks, ): string { return JSON.stringify( CompanyReferenceLinks$outboundSchema.parse(companyReferenceLinks), ); } export function companyReferenceLinksFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CompanyReferenceLinks$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CompanyReferenceLinks' from JSON`, ); } /** @internal */ export const CompanyReference$inboundSchema: z.ZodType< CompanyReference, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), name: z.string().optional(), description: z.string().optional(), links: z.lazy(() => CompanyReferenceLinks$inboundSchema).optional(), tags: z.record(z.string()).optional(), }); /** @internal */ export type CompanyReference$Outbound = { id?: string | undefined; name?: string | undefined; description?: string | undefined; links?: CompanyReferenceLinks$Outbound | undefined; tags?: { [k: string]: string } | undefined; }; /** @internal */ export const CompanyReference$outboundSchema: z.ZodType< CompanyReference$Outbound, z.ZodTypeDef, CompanyReference > = z.object({ id: z.string().optional(), name: z.string().optional(), description: z.string().optional(), links: z.lazy(() => CompanyReferenceLinks$outboundSchema).optional(), tags: z.record(z.string()).optional(), }); export function companyReferenceToJSON( companyReference: CompanyReference, ): string { return JSON.stringify( CompanyReference$outboundSchema.parse(companyReference), ); } export function companyReferenceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CompanyReference$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CompanyReference' from JSON`, ); }