/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 908fbd640ca2 */ import * as z from "zod/v4"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ProcessStatus, ProcessStatus$inboundSchema } from "./processstatus.js"; export type Document = { id: string; libraryId: string; hash: string | null; mimeType: string | null; extension: string | null; size: number | null; name: string; summary?: string | null | undefined; createdAt: Date; lastProcessedAt?: Date | null | undefined; numberOfPages?: number | null | undefined; processStatus: ProcessStatus; uploadedById: string | null; uploadedByType: string; tokensProcessingMainContent?: number | null | undefined; tokensProcessingSummary?: number | null | undefined; url?: string | null | undefined; attributes?: { [k: string]: any } | null | undefined; processingStatus: string; tokensProcessingTotal: number; }; /** @internal */ export const Document$inboundSchema: z.ZodType = z.object({ id: z.string(), library_id: z.string(), hash: z.nullable(z.string()), mime_type: z.nullable(z.string()), extension: z.nullable(z.string()), size: z.nullable(z.int()), name: z.string(), summary: z.nullable(z.string()).optional(), created_at: z.iso.datetime({ offset: true }).transform(v => new Date(v)), last_processed_at: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ).optional(), number_of_pages: z.nullable(z.int()).optional(), process_status: ProcessStatus$inboundSchema, uploaded_by_id: z.nullable(z.string()), uploaded_by_type: z.string(), tokens_processing_main_content: z.nullable(z.int()).optional(), tokens_processing_summary: z.nullable(z.int()).optional(), url: z.nullable(z.string()).optional(), attributes: z.nullable(z.record(z.string(), z.any())).optional(), processing_status: z.string(), tokens_processing_total: z.int(), }).transform((v) => { return remap$(v, { "library_id": "libraryId", "mime_type": "mimeType", "created_at": "createdAt", "last_processed_at": "lastProcessedAt", "number_of_pages": "numberOfPages", "process_status": "processStatus", "uploaded_by_id": "uploadedById", "uploaded_by_type": "uploadedByType", "tokens_processing_main_content": "tokensProcessingMainContent", "tokens_processing_summary": "tokensProcessingSummary", "processing_status": "processingStatus", "tokens_processing_total": "tokensProcessingTotal", }); }); export function documentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Document$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Document' from JSON`, ); }