/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: c087accad4e2 */ 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 { OCRBlockConfidenceScores, OCRBlockConfidenceScores$inboundSchema, } from "./ocrblockconfidencescores.js"; export type OCRTableBlock = { topLeftX: number; topLeftY: number; bottomRightX: number; bottomRightY: number; /** * Text/markdown/html content of this block */ content: string; /** * Confidence scores for this block. Populated when confidence_scores_granularity is set to 'block'. */ confidenceScores?: OCRBlockConfidenceScores | null | undefined; type: "table"; /** * References the corresponding entry in OCRPageObject.tables, when tables are extracted */ tableId?: string | null | undefined; }; /** @internal */ export const OCRTableBlock$inboundSchema: z.ZodType = z .object({ top_left_x: z.int(), top_left_y: z.int(), bottom_right_x: z.int(), bottom_right_y: z.int(), content: z.string(), confidence_scores: z.nullable(OCRBlockConfidenceScores$inboundSchema) .optional(), type: z.literal("table"), table_id: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "top_left_x": "topLeftX", "top_left_y": "topLeftY", "bottom_right_x": "bottomRightX", "bottom_right_y": "bottomRightY", "confidence_scores": "confidenceScores", "table_id": "tableId", }); }); export function ocrTableBlockFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OCRTableBlock$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OCRTableBlock' from JSON`, ); }