/* * 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 ExportResponseFeedbackQueryParamOrder = { 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 ExportResponseFeedbackQueryParamOrder = ClosedEnum< typeof ExportResponseFeedbackQueryParamOrder >; /** * Only export feedback entries with this rating. Omit to export entries with any rating. */ export const ExportResponseFeedbackQueryParamRating = { ThumbsUp: "thumbs_up", ThumbsDown: "thumbs_down", } as const; /** * Only export feedback entries with this rating. Omit to export entries with any rating. */ export type ExportResponseFeedbackQueryParamRating = ClosedEnum< typeof ExportResponseFeedbackQueryParamRating >; export type ExportResponseFeedbackRequest = { /** * 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?: ExportResponseFeedbackQueryParamOrder | undefined; /** * Only export feedback entries with this rating. Omit to export entries with any rating. */ rating?: ExportResponseFeedbackQueryParamRating | undefined; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; export type ExportResponseFeedbackResponse = { headers: { [k: string]: Array }; result: ReadableStream; }; /** @internal */ export const ExportResponseFeedbackQueryParamOrder$inboundSchema: z.ZodNativeEnum = z.nativeEnum( ExportResponseFeedbackQueryParamOrder, ); /** @internal */ export const ExportResponseFeedbackQueryParamOrder$outboundSchema: z.ZodNativeEnum = ExportResponseFeedbackQueryParamOrder$inboundSchema; /** @internal */ export const ExportResponseFeedbackQueryParamRating$inboundSchema: z.ZodNativeEnum = z.nativeEnum( ExportResponseFeedbackQueryParamRating, ); /** @internal */ export const ExportResponseFeedbackQueryParamRating$outboundSchema: z.ZodNativeEnum = ExportResponseFeedbackQueryParamRating$inboundSchema; /** @internal */ export const ExportResponseFeedbackRequest$inboundSchema: z.ZodType< ExportResponseFeedbackRequest, z.ZodTypeDef, unknown > = z.object({ order: ExportResponseFeedbackQueryParamOrder$inboundSchema.default("desc"), rating: ExportResponseFeedbackQueryParamRating$inboundSchema.optional(), "X-On-Behalf-Of": z.string().optional(), }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", }); }); /** @internal */ export type ExportResponseFeedbackRequest$Outbound = { order: string; rating?: string | undefined; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const ExportResponseFeedbackRequest$outboundSchema: z.ZodType< ExportResponseFeedbackRequest$Outbound, z.ZodTypeDef, ExportResponseFeedbackRequest > = z.object({ order: ExportResponseFeedbackQueryParamOrder$outboundSchema.default("desc"), rating: ExportResponseFeedbackQueryParamRating$outboundSchema.optional(), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", }); }); export function exportResponseFeedbackRequestToJSON( exportResponseFeedbackRequest: ExportResponseFeedbackRequest, ): string { return JSON.stringify( ExportResponseFeedbackRequest$outboundSchema.parse( exportResponseFeedbackRequest, ), ); } export function exportResponseFeedbackRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ExportResponseFeedbackRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExportResponseFeedbackRequest' from JSON`, ); } /** @internal */ export const ExportResponseFeedbackResponse$inboundSchema: z.ZodType< ExportResponseFeedbackResponse, 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 ExportResponseFeedbackResponse$Outbound = { Headers: { [k: string]: Array }; Result: ReadableStream; }; /** @internal */ export const ExportResponseFeedbackResponse$outboundSchema: z.ZodType< ExportResponseFeedbackResponse$Outbound, z.ZodTypeDef, ExportResponseFeedbackResponse > = z.object({ headers: z.record(z.array(z.string())), result: z.instanceof(ReadableStream), }).transform((v) => { return remap$(v, { headers: "Headers", result: "Result", }); }); export function exportResponseFeedbackResponseToJSON( exportResponseFeedbackResponse: ExportResponseFeedbackResponse, ): string { return JSON.stringify( ExportResponseFeedbackResponse$outboundSchema.parse( exportResponseFeedbackResponse, ), ); } export function exportResponseFeedbackResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ExportResponseFeedbackResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExportResponseFeedbackResponse' from JSON`, ); }