/* * 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"; import { BatchEndpoint, BatchEndpoint$inboundSchema, BatchEndpoint$outboundSchema, } from "./batchendpoint.js"; export type CreateBatchRequest = { inputFileId: string; endpoint: BatchEndpoint; completionWindow: "24h"; metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const CreateBatchRequest$inboundSchema: z.ZodType< CreateBatchRequest, z.ZodTypeDef, unknown > = z.object({ input_file_id: z.string(), endpoint: BatchEndpoint$inboundSchema, completion_window: z.literal("24h"), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { "input_file_id": "inputFileId", "completion_window": "completionWindow", }); }); /** @internal */ export type CreateBatchRequest$Outbound = { input_file_id: string; endpoint: string; completion_window: "24h"; metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const CreateBatchRequest$outboundSchema: z.ZodType< CreateBatchRequest$Outbound, z.ZodTypeDef, CreateBatchRequest > = z.object({ inputFileId: z.string(), endpoint: BatchEndpoint$outboundSchema, completionWindow: z.literal("24h"), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { inputFileId: "input_file_id", completionWindow: "completion_window", }); }); export function createBatchRequestToJSON( createBatchRequest: CreateBatchRequest, ): string { return JSON.stringify( CreateBatchRequest$outboundSchema.parse(createBatchRequest), ); } export function createBatchRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateBatchRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateBatchRequest' from JSON`, ); }