/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; 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"; /** * Fields to update in the extraction schema. All fields are optional; only provided fields will be updated. */ export type UpdateExtractSchemaRequestBody = { /** * Optional new name for the extraction schema */ name?: string | undefined; /** * Optional new description for the schema */ description?: string | undefined; /** * Optional updated JSON Schema definition */ schema?: { [k: string]: any } | undefined; /** * Optional updated metadata */ metadata?: { [k: string]: any } | undefined; }; export type UpdateExtractSchemaRequest = { schemaId: string; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; requestBody: UpdateExtractSchemaRequestBody; }; /** @internal */ export const UpdateExtractSchemaRequestBody$inboundSchema: z.ZodType< UpdateExtractSchemaRequestBody, z.ZodTypeDef, unknown > = z.object({ name: z.string().optional(), description: z.string().optional(), schema: z.record(z.any()).optional(), metadata: z.record(z.any()).optional(), }); /** @internal */ export type UpdateExtractSchemaRequestBody$Outbound = { name?: string | undefined; description?: string | undefined; schema?: { [k: string]: any } | undefined; metadata?: { [k: string]: any } | undefined; }; /** @internal */ export const UpdateExtractSchemaRequestBody$outboundSchema: z.ZodType< UpdateExtractSchemaRequestBody$Outbound, z.ZodTypeDef, UpdateExtractSchemaRequestBody > = z.object({ name: z.string().optional(), description: z.string().optional(), schema: z.record(z.any()).optional(), metadata: z.record(z.any()).optional(), }); export function updateExtractSchemaRequestBodyToJSON( updateExtractSchemaRequestBody: UpdateExtractSchemaRequestBody, ): string { return JSON.stringify( UpdateExtractSchemaRequestBody$outboundSchema.parse( updateExtractSchemaRequestBody, ), ); } export function updateExtractSchemaRequestBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateExtractSchemaRequestBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateExtractSchemaRequestBody' from JSON`, ); } /** @internal */ export const UpdateExtractSchemaRequest$inboundSchema: z.ZodType< UpdateExtractSchemaRequest, z.ZodTypeDef, unknown > = z.object({ schema_id: z.string(), "X-On-Behalf-Of": z.string().optional(), RequestBody: z.lazy(() => UpdateExtractSchemaRequestBody$inboundSchema), }).transform((v) => { return remap$(v, { "schema_id": "schemaId", "X-On-Behalf-Of": "xOnBehalfOf", "RequestBody": "requestBody", }); }); /** @internal */ export type UpdateExtractSchemaRequest$Outbound = { schema_id: string; "X-On-Behalf-Of"?: string | undefined; RequestBody: UpdateExtractSchemaRequestBody$Outbound; }; /** @internal */ export const UpdateExtractSchemaRequest$outboundSchema: z.ZodType< UpdateExtractSchemaRequest$Outbound, z.ZodTypeDef, UpdateExtractSchemaRequest > = z.object({ schemaId: z.string(), xOnBehalfOf: z.string().optional(), requestBody: z.lazy(() => UpdateExtractSchemaRequestBody$outboundSchema), }).transform((v) => { return remap$(v, { schemaId: "schema_id", xOnBehalfOf: "X-On-Behalf-Of", requestBody: "RequestBody", }); }); export function updateExtractSchemaRequestToJSON( updateExtractSchemaRequest: UpdateExtractSchemaRequest, ): string { return JSON.stringify( UpdateExtractSchemaRequest$outboundSchema.parse(updateExtractSchemaRequest), ); } export function updateExtractSchemaRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateExtractSchemaRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateExtractSchemaRequest' from JSON`, ); }