/* * 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 CreateCompletionFeedbackRequest = { /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; createFeedbackRequest: components.CreateFeedbackRequest; }; /** @internal */ export const CreateCompletionFeedbackRequest$inboundSchema: z.ZodType< CreateCompletionFeedbackRequest, z.ZodTypeDef, unknown > = z.object({ "X-On-Behalf-Of": z.string().optional(), CreateFeedbackRequest: components.CreateFeedbackRequest$inboundSchema, }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", "CreateFeedbackRequest": "createFeedbackRequest", }); }); /** @internal */ export type CreateCompletionFeedbackRequest$Outbound = { "X-On-Behalf-Of"?: string | undefined; CreateFeedbackRequest: components.CreateFeedbackRequest$Outbound; }; /** @internal */ export const CreateCompletionFeedbackRequest$outboundSchema: z.ZodType< CreateCompletionFeedbackRequest$Outbound, z.ZodTypeDef, CreateCompletionFeedbackRequest > = z.object({ xOnBehalfOf: z.string().optional(), createFeedbackRequest: components.CreateFeedbackRequest$outboundSchema, }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", createFeedbackRequest: "CreateFeedbackRequest", }); }); export function createCompletionFeedbackRequestToJSON( createCompletionFeedbackRequest: CreateCompletionFeedbackRequest, ): string { return JSON.stringify( CreateCompletionFeedbackRequest$outboundSchema.parse( createCompletionFeedbackRequest, ), ); } export function createCompletionFeedbackRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateCompletionFeedbackRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateCompletionFeedbackRequest' from JSON`, ); }