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