/* * 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 * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ClassifyTextRequest = { /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; classificationRequest: components.ClassificationRequest; }; /** @internal */ export const ClassifyTextRequest$inboundSchema: z.ZodType< ClassifyTextRequest, z.ZodTypeDef, unknown > = z.object({ "X-On-Behalf-Of": z.string().optional(), ClassificationRequest: components.ClassificationRequest$inboundSchema, }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", "ClassificationRequest": "classificationRequest", }); }); /** @internal */ export type ClassifyTextRequest$Outbound = { "X-On-Behalf-Of"?: string | undefined; ClassificationRequest: components.ClassificationRequest$Outbound; }; /** @internal */ export const ClassifyTextRequest$outboundSchema: z.ZodType< ClassifyTextRequest$Outbound, z.ZodTypeDef, ClassifyTextRequest > = z.object({ xOnBehalfOf: z.string().optional(), classificationRequest: components.ClassificationRequest$outboundSchema, }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", classificationRequest: "ClassificationRequest", }); }); export function classifyTextRequestToJSON( classifyTextRequest: ClassifyTextRequest, ): string { return JSON.stringify( ClassifyTextRequest$outboundSchema.parse(classifyTextRequest), ); } export function classifyTextRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ClassifyTextRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ClassifyTextRequest' from JSON`, ); }