/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The order to export feedback entries in by creation date of the underlying request. 'asc' exports oldest first, 'desc' exports newest first. Defaults to 'desc' (newest first). */ export const ExportCompletionFeedbackQueryParamOrder = { Asc: "asc", Desc: "desc", } as const; /** * The order to export feedback entries in by creation date of the underlying request. 'asc' exports oldest first, 'desc' exports newest first. Defaults to 'desc' (newest first). */ export type ExportCompletionFeedbackQueryParamOrder = ClosedEnum< typeof ExportCompletionFeedbackQueryParamOrder >; /** * Only export feedback entries with this rating. Omit to export entries with any rating. */ export const ExportCompletionFeedbackQueryParamRating = { ThumbsUp: "thumbs_up", ThumbsDown: "thumbs_down", } as const; /** * Only export feedback entries with this rating. Omit to export entries with any rating. */ export type ExportCompletionFeedbackQueryParamRating = ClosedEnum< typeof ExportCompletionFeedbackQueryParamRating >; export type ExportCompletionFeedbackRequest = { /** * The order to export feedback entries in by creation date of the underlying request. 'asc' exports oldest first, 'desc' exports newest first. Defaults to 'desc' (newest first). */ order?: ExportCompletionFeedbackQueryParamOrder | undefined; /** * Only export feedback entries with this rating. Omit to export entries with any rating. */ rating?: ExportCompletionFeedbackQueryParamRating | undefined; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; export type ExportCompletionFeedbackResponse = { headers: { [k: string]: Array }; result: ReadableStream; }; /** @internal */ export const ExportCompletionFeedbackQueryParamOrder$inboundSchema: z.ZodNativeEnum = z .nativeEnum(ExportCompletionFeedbackQueryParamOrder); /** @internal */ export const ExportCompletionFeedbackQueryParamOrder$outboundSchema: z.ZodNativeEnum = ExportCompletionFeedbackQueryParamOrder$inboundSchema; /** @internal */ export const ExportCompletionFeedbackQueryParamRating$inboundSchema: z.ZodNativeEnum = z .nativeEnum(ExportCompletionFeedbackQueryParamRating); /** @internal */ export const ExportCompletionFeedbackQueryParamRating$outboundSchema: z.ZodNativeEnum = ExportCompletionFeedbackQueryParamRating$inboundSchema; /** @internal */ export const ExportCompletionFeedbackRequest$inboundSchema: z.ZodType< ExportCompletionFeedbackRequest, z.ZodTypeDef, unknown > = z.object({ order: ExportCompletionFeedbackQueryParamOrder$inboundSchema.default("desc"), rating: ExportCompletionFeedbackQueryParamRating$inboundSchema.optional(), "X-On-Behalf-Of": z.string().optional(), }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", }); }); /** @internal */ export type ExportCompletionFeedbackRequest$Outbound = { order: string; rating?: string | undefined; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const ExportCompletionFeedbackRequest$outboundSchema: z.ZodType< ExportCompletionFeedbackRequest$Outbound, z.ZodTypeDef, ExportCompletionFeedbackRequest > = z.object({ order: ExportCompletionFeedbackQueryParamOrder$outboundSchema.default("desc"), rating: ExportCompletionFeedbackQueryParamRating$outboundSchema.optional(), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", }); }); export function exportCompletionFeedbackRequestToJSON( exportCompletionFeedbackRequest: ExportCompletionFeedbackRequest, ): string { return JSON.stringify( ExportCompletionFeedbackRequest$outboundSchema.parse( exportCompletionFeedbackRequest, ), ); } export function exportCompletionFeedbackRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ExportCompletionFeedbackRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExportCompletionFeedbackRequest' from JSON`, ); } /** @internal */ export const ExportCompletionFeedbackResponse$inboundSchema: z.ZodType< ExportCompletionFeedbackResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: z.instanceof(ReadableStream), }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); /** @internal */ export type ExportCompletionFeedbackResponse$Outbound = { Headers: { [k: string]: Array }; Result: ReadableStream; }; /** @internal */ export const ExportCompletionFeedbackResponse$outboundSchema: z.ZodType< ExportCompletionFeedbackResponse$Outbound, z.ZodTypeDef, ExportCompletionFeedbackResponse > = z.object({ headers: z.record(z.array(z.string())), result: z.instanceof(ReadableStream), }).transform((v) => { return remap$(v, { headers: "Headers", result: "Result", }); }); export function exportCompletionFeedbackResponseToJSON( exportCompletionFeedbackResponse: ExportCompletionFeedbackResponse, ): string { return JSON.stringify( ExportCompletionFeedbackResponse$outboundSchema.parse( exportCompletionFeedbackResponse, ), ); } export function exportCompletionFeedbackResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ExportCompletionFeedbackResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExportCompletionFeedbackResponse' from JSON`, ); }