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