/* * 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 return feedback entries in by creation date of the underlying request. 'asc' returns oldest first, 'desc' returns newest first. Defaults to 'desc' (newest first). */ export const ListResponseFeedbackQueryParamOrder = { Asc: "asc", Desc: "desc", } as const; /** * The order to return feedback entries in by creation date of the underlying request. 'asc' returns oldest first, 'desc' returns newest first. Defaults to 'desc' (newest first). */ export type ListResponseFeedbackQueryParamOrder = ClosedEnum< typeof ListResponseFeedbackQueryParamOrder >; /** * Only return feedback entries with this rating. Omit to return entries with any rating. */ export const ListResponseFeedbackQueryParamRating = { ThumbsUp: "thumbs_up", ThumbsDown: "thumbs_down", } as const; /** * Only return feedback entries with this rating. Omit to return entries with any rating. */ export type ListResponseFeedbackQueryParamRating = ClosedEnum< typeof ListResponseFeedbackQueryParamRating >; export type ListResponseFeedbackRequest = { after?: string | undefined; limit?: number | undefined; /** * The order to return feedback entries in by creation date of the underlying request. 'asc' returns oldest first, 'desc' returns newest first. Defaults to 'desc' (newest first). */ order?: ListResponseFeedbackQueryParamOrder | undefined; /** * Only return feedback entries with this rating. Omit to return entries with any rating. */ rating?: ListResponseFeedbackQueryParamRating | undefined; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; /** @internal */ export const ListResponseFeedbackQueryParamOrder$inboundSchema: z.ZodNativeEnum< typeof ListResponseFeedbackQueryParamOrder > = z.nativeEnum(ListResponseFeedbackQueryParamOrder); /** @internal */ export const ListResponseFeedbackQueryParamOrder$outboundSchema: z.ZodNativeEnum = ListResponseFeedbackQueryParamOrder$inboundSchema; /** @internal */ export const ListResponseFeedbackQueryParamRating$inboundSchema: z.ZodNativeEnum = z.nativeEnum( ListResponseFeedbackQueryParamRating, ); /** @internal */ export const ListResponseFeedbackQueryParamRating$outboundSchema: z.ZodNativeEnum = ListResponseFeedbackQueryParamRating$inboundSchema; /** @internal */ export const ListResponseFeedbackRequest$inboundSchema: z.ZodType< ListResponseFeedbackRequest, z.ZodTypeDef, unknown > = z.object({ after: z.string().optional(), limit: z.number().int().default(20), order: ListResponseFeedbackQueryParamOrder$inboundSchema.default("desc"), rating: ListResponseFeedbackQueryParamRating$inboundSchema.optional(), "X-On-Behalf-Of": z.string().optional(), }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", }); }); /** @internal */ export type ListResponseFeedbackRequest$Outbound = { after?: string | undefined; limit: number; order: string; rating?: string | undefined; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const ListResponseFeedbackRequest$outboundSchema: z.ZodType< ListResponseFeedbackRequest$Outbound, z.ZodTypeDef, ListResponseFeedbackRequest > = z.object({ after: z.string().optional(), limit: z.number().int().default(20), order: ListResponseFeedbackQueryParamOrder$outboundSchema.default("desc"), rating: ListResponseFeedbackQueryParamRating$outboundSchema.optional(), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", }); }); export function listResponseFeedbackRequestToJSON( listResponseFeedbackRequest: ListResponseFeedbackRequest, ): string { return JSON.stringify( ListResponseFeedbackRequest$outboundSchema.parse( listResponseFeedbackRequest, ), ); } export function listResponseFeedbackRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListResponseFeedbackRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListResponseFeedbackRequest' from JSON`, ); }