/* * 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"; export const ListFilesQueryParamOrder = { Asc: "asc", Desc: "desc", } as const; export type ListFilesQueryParamOrder = ClosedEnum< typeof ListFilesQueryParamOrder >; export const QueryParamPurpose = { Assistants: "assistants", Batch: "batch", FineTune: "fine-tune", Vision: "vision", UserData: "user_data", Evals: "evals", } as const; export type QueryParamPurpose = ClosedEnum; export type ListFilesRequest = { after?: string | undefined; limit?: number | undefined; order?: ListFilesQueryParamOrder | undefined; purpose?: QueryParamPurpose | undefined; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; /** @internal */ export const ListFilesQueryParamOrder$inboundSchema: z.ZodNativeEnum< typeof ListFilesQueryParamOrder > = z.nativeEnum(ListFilesQueryParamOrder); /** @internal */ export const ListFilesQueryParamOrder$outboundSchema: z.ZodNativeEnum< typeof ListFilesQueryParamOrder > = ListFilesQueryParamOrder$inboundSchema; /** @internal */ export const QueryParamPurpose$inboundSchema: z.ZodNativeEnum< typeof QueryParamPurpose > = z.nativeEnum(QueryParamPurpose); /** @internal */ export const QueryParamPurpose$outboundSchema: z.ZodNativeEnum< typeof QueryParamPurpose > = QueryParamPurpose$inboundSchema; /** @internal */ export const ListFilesRequest$inboundSchema: z.ZodType< ListFilesRequest, z.ZodTypeDef, unknown > = z.object({ after: z.string().optional(), limit: z.number().int().default(10000), order: ListFilesQueryParamOrder$inboundSchema.default("desc"), purpose: QueryParamPurpose$inboundSchema.optional(), "X-On-Behalf-Of": z.string().optional(), }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", }); }); /** @internal */ export type ListFilesRequest$Outbound = { after?: string | undefined; limit: number; order: string; purpose?: string | undefined; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const ListFilesRequest$outboundSchema: z.ZodType< ListFilesRequest$Outbound, z.ZodTypeDef, ListFilesRequest > = z.object({ after: z.string().optional(), limit: z.number().int().default(10000), order: ListFilesQueryParamOrder$outboundSchema.default("desc"), purpose: QueryParamPurpose$outboundSchema.optional(), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", }); }); export function listFilesRequestToJSON( listFilesRequest: ListFilesRequest, ): string { return JSON.stringify( ListFilesRequest$outboundSchema.parse(listFilesRequest), ); } export function listFilesRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListFilesRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListFilesRequest' from JSON`, ); }