/* * 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"; import { VantaDocumentLinkEvidence, VantaDocumentLinkEvidence$inboundSchema, } from "./vantadocumentlinkevidence.js"; import { VantaDocumentUploadedEvidence, VantaDocumentUploadedEvidence$inboundSchema, } from "./vantadocumentuploadedevidence.js"; /** * Information about the user who added this file version to the document. * * @remarks * Undefined if the user information is not available. */ export type AddedBy = { email: string; name: string; }; /** * The file or link associated with this document version. * * @remarks * Use the `type` discriminator to determine whether it's an uploaded file * or an external link. */ export type FileT = VantaDocumentUploadedEvidence | VantaDocumentLinkEvidence; /** * Evidence in the form of a Vanta Document. * * @remarks * Vanta Documents are managed documents with metadata like expiration dates * and versioning. They can either be uploaded files stored in Vanta or * links to external documentation. */ export type VantaDocumentEvidence = { /** * The title of the document as displayed in Vanta. */ title: string; /** * Optional description providing additional context about the document. */ description?: string | undefined; /** * The date when the document version expires and should be renewed. * * @remarks * Undefined if no expiration is set. * Format: ISO 8601 UTC timestamp. */ expirationDate?: Date | undefined; /** * Information about the user who added this file version to the document. * * @remarks * Undefined if the user information is not available. */ addedBy?: AddedBy | undefined; /** * The unique identifier of the document version submitted as evidence. */ documentVersionId: string; /** * The file or link associated with this document version. * * @remarks * Use the `type` discriminator to determine whether it's an uploaded file * or an external link. */ file: VantaDocumentUploadedEvidence | VantaDocumentLinkEvidence; }; /** @internal */ export const AddedBy$inboundSchema: z.ZodType = z.object({ email: z.string(), name: z.string(), }); export function addedByFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AddedBy$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AddedBy' from JSON`, ); } /** @internal */ export const FileT$inboundSchema: z.ZodType = z .union([ VantaDocumentUploadedEvidence$inboundSchema, VantaDocumentLinkEvidence$inboundSchema, ]); export function fileFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FileT$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FileT' from JSON`, ); } /** @internal */ export const VantaDocumentEvidence$inboundSchema: z.ZodType< VantaDocumentEvidence, z.ZodTypeDef, unknown > = z.object({ title: z.string(), description: z.string().optional(), expirationDate: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), addedBy: z.lazy(() => AddedBy$inboundSchema).optional(), documentVersionId: z.string(), file: z.union([ VantaDocumentUploadedEvidence$inboundSchema, VantaDocumentLinkEvidence$inboundSchema, ]), }); export function vantaDocumentEvidenceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => VantaDocumentEvidence$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VantaDocumentEvidence' from JSON`, ); }