/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: a8320e410684 */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { RFCDate } from "../../types/rfcdate.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type Company = { /** * User-friendly display name. */ name: string; /** * Link to internal company company profile. */ profileUrl?: string | undefined; /** * Link to company's associated websites. */ websiteUrls?: Array | undefined; /** * The URL of the company's logo. Public, Glean-authenticated and Base64 encoded data URLs are all valid (but not third-party-authenticated URLs). */ logoUrl?: string | undefined; /** * User facing string representing the company's location. */ location?: string | undefined; /** * Phone number as a number string. */ phone?: string | undefined; /** * Fax number as a number string. */ fax?: string | undefined; /** * User facing string representing the company's industry. */ industry?: string | undefined; /** * Average company's annual revenue for reference. */ annualRevenue?: number | undefined; /** * Average company's number of employees for reference. */ numberOfEmployees?: number | undefined; /** * Company's stock symbol if company is public. */ stockSymbol?: string | undefined; /** * The date when the company was founded. */ foundedDate?: RFCDate | undefined; /** * User facing description of company. */ about?: string | undefined; }; /** @internal */ export const Company$inboundSchema: z.ZodType = z.object({ name: z.string(), profileUrl: z.string().optional(), websiteUrls: z.array(z.string()).optional(), logoUrl: z.string().optional(), location: z.string().optional(), phone: z.string().optional(), fax: z.string().optional(), industry: z.string().optional(), annualRevenue: z.number().optional(), numberOfEmployees: z.number().int().optional(), stockSymbol: z.string().optional(), foundedDate: z.string().transform(v => new RFCDate(v)).optional(), about: z.string().optional(), }); /** @internal */ export type Company$Outbound = { name: string; profileUrl?: string | undefined; websiteUrls?: Array | undefined; logoUrl?: string | undefined; location?: string | undefined; phone?: string | undefined; fax?: string | undefined; industry?: string | undefined; annualRevenue?: number | undefined; numberOfEmployees?: number | undefined; stockSymbol?: string | undefined; foundedDate?: string | undefined; about?: string | undefined; }; /** @internal */ export const Company$outboundSchema: z.ZodType< Company$Outbound, z.ZodTypeDef, Company > = z.object({ name: z.string(), profileUrl: z.string().optional(), websiteUrls: z.array(z.string()).optional(), logoUrl: z.string().optional(), location: z.string().optional(), phone: z.string().optional(), fax: z.string().optional(), industry: z.string().optional(), annualRevenue: z.number().optional(), numberOfEmployees: z.number().int().optional(), stockSymbol: z.string().optional(), foundedDate: z.instanceof(RFCDate).transform(v => v.toString()).optional(), about: z.string().optional(), }); export function companyToJSON(company: Company): string { return JSON.stringify(Company$outboundSchema.parse(company)); } export function companyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Company$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Company' from JSON`, ); }