/* * 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 { catchUnrecognizedEnum, OpenEnum, Unrecognized, } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The date the Pre IPO Company Research Document was published. */ export type PublishDate = { /** * Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant. */ day?: number | undefined; /** * Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */ month?: number | undefined; /** * Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */ year?: number | undefined; }; /** * The relation of the Research Document to the Pre IPO Company. - `SUBJECT`: The Research Document is directly related to the Pre IPO Company. - `CONNECTED`: The Research Document is not directly related to the Pre IPO Company but is related to another company in a "connected" field or industry. */ export enum Relation { RelationUnspecified = "RELATION_UNSPECIFIED", Subject = "SUBJECT", Connected = "CONNECTED", } /** * The relation of the Research Document to the Pre IPO Company. - `SUBJECT`: The Research Document is directly related to the Pre IPO Company. - `CONNECTED`: The Research Document is not directly related to the Pre IPO Company but is related to another company in a "connected" field or industry. */ export type RelationOpen = OpenEnum; /** * The type of Pre IPO Company Research Document. */ export enum PreIpoCompanyResearchDocumentType { TypeUnspecified = "TYPE_UNSPECIFIED", Interview = "INTERVIEW", Market = "MARKET", Company = "COMPANY", } /** * The type of Pre IPO Company Research Document. */ export type PreIpoCompanyResearchDocumentTypeOpen = OpenEnum< typeof PreIpoCompanyResearchDocumentType >; /** * A Pre IPO Company Research Document. */ export type PreIpoCompanyResearchDocument = { /** * The name of the Pre IPO Company Document. Format: preIpoCompanies/{pre_ipo_company}/researchDocuments/{research_document} */ name?: string | undefined; /** * The ID of the Pre IPO Company. */ preIpoCompanyId?: string | undefined; /** * The date the Pre IPO Company Research Document was published. */ publishDate?: PublishDate | null | undefined; /** * The relation of the Research Document to the Pre IPO Company. - `SUBJECT`: The Research Document is directly related to the Pre IPO Company. - `CONNECTED`: The Research Document is not directly related to the Pre IPO Company but is related to another company in a "connected" field or industry. */ relation?: RelationOpen | undefined; /** * The ID of the Pre IPO Company Research Document. */ researchDocumentId?: string | undefined; /** * The title of the Pre IPO Company Research Document. */ title?: string | undefined; /** * The type of Pre IPO Company Research Document. */ type?: PreIpoCompanyResearchDocumentTypeOpen | undefined; }; /** @internal */ export const PublishDate$inboundSchema: z.ZodType< PublishDate, z.ZodTypeDef, unknown > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** @internal */ export type PublishDate$Outbound = { day?: number | undefined; month?: number | undefined; year?: number | undefined; }; /** @internal */ export const PublishDate$outboundSchema: z.ZodType< PublishDate$Outbound, z.ZodTypeDef, PublishDate > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PublishDate$ { /** @deprecated use `PublishDate$inboundSchema` instead. */ export const inboundSchema = PublishDate$inboundSchema; /** @deprecated use `PublishDate$outboundSchema` instead. */ export const outboundSchema = PublishDate$outboundSchema; /** @deprecated use `PublishDate$Outbound` instead. */ export type Outbound = PublishDate$Outbound; } export function publishDateToJSON(publishDate: PublishDate): string { return JSON.stringify(PublishDate$outboundSchema.parse(publishDate)); } export function publishDateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PublishDate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PublishDate' from JSON`, ); } /** @internal */ export const Relation$inboundSchema: z.ZodType< RelationOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(Relation), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const Relation$outboundSchema: z.ZodType< RelationOpen, z.ZodTypeDef, RelationOpen > = z.union([ z.nativeEnum(Relation), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Relation$ { /** @deprecated use `Relation$inboundSchema` instead. */ export const inboundSchema = Relation$inboundSchema; /** @deprecated use `Relation$outboundSchema` instead. */ export const outboundSchema = Relation$outboundSchema; } /** @internal */ export const PreIpoCompanyResearchDocumentType$inboundSchema: z.ZodType< PreIpoCompanyResearchDocumentTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(PreIpoCompanyResearchDocumentType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const PreIpoCompanyResearchDocumentType$outboundSchema: z.ZodType< PreIpoCompanyResearchDocumentTypeOpen, z.ZodTypeDef, PreIpoCompanyResearchDocumentTypeOpen > = z.union([ z.nativeEnum(PreIpoCompanyResearchDocumentType), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PreIpoCompanyResearchDocumentType$ { /** @deprecated use `PreIpoCompanyResearchDocumentType$inboundSchema` instead. */ export const inboundSchema = PreIpoCompanyResearchDocumentType$inboundSchema; /** @deprecated use `PreIpoCompanyResearchDocumentType$outboundSchema` instead. */ export const outboundSchema = PreIpoCompanyResearchDocumentType$outboundSchema; } /** @internal */ export const PreIpoCompanyResearchDocument$inboundSchema: z.ZodType< PreIpoCompanyResearchDocument, z.ZodTypeDef, unknown > = z.object({ name: z.string().optional(), pre_ipo_company_id: z.string().optional(), publish_date: z.nullable(z.lazy(() => PublishDate$inboundSchema)).optional(), relation: Relation$inboundSchema.optional(), research_document_id: z.string().optional(), title: z.string().optional(), type: PreIpoCompanyResearchDocumentType$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "pre_ipo_company_id": "preIpoCompanyId", "publish_date": "publishDate", "research_document_id": "researchDocumentId", }); }); /** @internal */ export type PreIpoCompanyResearchDocument$Outbound = { name?: string | undefined; pre_ipo_company_id?: string | undefined; publish_date?: PublishDate$Outbound | null | undefined; relation?: string | undefined; research_document_id?: string | undefined; title?: string | undefined; type?: string | undefined; }; /** @internal */ export const PreIpoCompanyResearchDocument$outboundSchema: z.ZodType< PreIpoCompanyResearchDocument$Outbound, z.ZodTypeDef, PreIpoCompanyResearchDocument > = z.object({ name: z.string().optional(), preIpoCompanyId: z.string().optional(), publishDate: z.nullable(z.lazy(() => PublishDate$outboundSchema)).optional(), relation: Relation$outboundSchema.optional(), researchDocumentId: z.string().optional(), title: z.string().optional(), type: PreIpoCompanyResearchDocumentType$outboundSchema.optional(), }).transform((v) => { return remap$(v, { preIpoCompanyId: "pre_ipo_company_id", publishDate: "publish_date", researchDocumentId: "research_document_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PreIpoCompanyResearchDocument$ { /** @deprecated use `PreIpoCompanyResearchDocument$inboundSchema` instead. */ export const inboundSchema = PreIpoCompanyResearchDocument$inboundSchema; /** @deprecated use `PreIpoCompanyResearchDocument$outboundSchema` instead. */ export const outboundSchema = PreIpoCompanyResearchDocument$outboundSchema; /** @deprecated use `PreIpoCompanyResearchDocument$Outbound` instead. */ export type Outbound = PreIpoCompanyResearchDocument$Outbound; } export function preIpoCompanyResearchDocumentToJSON( preIpoCompanyResearchDocument: PreIpoCompanyResearchDocument, ): string { return JSON.stringify( PreIpoCompanyResearchDocument$outboundSchema.parse( preIpoCompanyResearchDocument, ), ); } export function preIpoCompanyResearchDocumentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PreIpoCompanyResearchDocument$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PreIpoCompanyResearchDocument' from JSON`, ); }