/* * 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"; /** * Sort order by version number */ export const ListPromptVersionsQueryParamOrder = { Asc: "asc", Desc: "desc", } as const; /** * Sort order by version number */ export type ListPromptVersionsQueryParamOrder = ClosedEnum< typeof ListPromptVersionsQueryParamOrder >; export type ListPromptVersionsRequest = { id: string; limit?: number | undefined; /** * Sort order by version number */ order?: ListPromptVersionsQueryParamOrder | undefined; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; /** @internal */ export const ListPromptVersionsQueryParamOrder$inboundSchema: z.ZodNativeEnum< typeof ListPromptVersionsQueryParamOrder > = z.nativeEnum(ListPromptVersionsQueryParamOrder); /** @internal */ export const ListPromptVersionsQueryParamOrder$outboundSchema: z.ZodNativeEnum< typeof ListPromptVersionsQueryParamOrder > = ListPromptVersionsQueryParamOrder$inboundSchema; /** @internal */ export const ListPromptVersionsRequest$inboundSchema: z.ZodType< ListPromptVersionsRequest, z.ZodTypeDef, unknown > = z.object({ id: z.string(), limit: z.number().int().default(20), order: ListPromptVersionsQueryParamOrder$inboundSchema.default("desc"), "X-On-Behalf-Of": z.string().optional(), }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", }); }); /** @internal */ export type ListPromptVersionsRequest$Outbound = { id: string; limit: number; order: string; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const ListPromptVersionsRequest$outboundSchema: z.ZodType< ListPromptVersionsRequest$Outbound, z.ZodTypeDef, ListPromptVersionsRequest > = z.object({ id: z.string(), limit: z.number().int().default(20), order: ListPromptVersionsQueryParamOrder$outboundSchema.default("desc"), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", }); }); export function listPromptVersionsRequestToJSON( listPromptVersionsRequest: ListPromptVersionsRequest, ): string { return JSON.stringify( ListPromptVersionsRequest$outboundSchema.parse(listPromptVersionsRequest), ); } export function listPromptVersionsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListPromptVersionsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListPromptVersionsRequest' from JSON`, ); }