/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 851c92a59244 */ 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"; export type OCRImageObject = { /** * Image ID for extracted image in a page */ id: string; /** * X coordinate of top-left corner of the extracted image */ topLeftX: number | null; /** * Y coordinate of top-left corner of the extracted image */ topLeftY: number | null; /** * X coordinate of bottom-right corner of the extracted image */ bottomRightX: number | null; /** * Y coordinate of bottom-right corner of the extracted image */ bottomRightY: number | null; /** * Base64 string of the extracted image */ imageBase64?: string | null | undefined; /** * Annotation of the extracted image in json str */ imageAnnotation?: string | null | undefined; }; /** @internal */ export const OCRImageObject$inboundSchema: z.ZodType = z.object({ id: z.string(), top_left_x: z.nullable(z.int()), top_left_y: z.nullable(z.int()), bottom_right_x: z.nullable(z.int()), bottom_right_y: z.nullable(z.int()), image_base64: z.nullable(z.string()).optional(), image_annotation: 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", "image_base64": "imageBase64", "image_annotation": "imageAnnotation", }); }); export function ocrImageObjectFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OCRImageObject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OCRImageObject' from JSON`, ); }