/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; import { HistoryResource, HistoryResource$inboundSchema, HistoryResource$Outbound, HistoryResource$outboundSchema, } from "./historyresource.js"; import { SortDirection, SortDirection$inboundSchema, SortDirection$outboundSchema, } from "./sortdirection.js"; export type HistoryResourcePagingResource = { page?: number | undefined; pageSize?: number | undefined; sortKey?: string | null | undefined; sortDirection?: SortDirection | undefined; totalRecords?: number | undefined; records?: Array | null | undefined; }; /** @internal */ export const HistoryResourcePagingResource$inboundSchema: z.ZodType< HistoryResourcePagingResource, z.ZodTypeDef, unknown > = z.object({ page: z.number().int().optional(), pageSize: z.number().int().optional(), sortKey: z.nullable(z.string()).optional(), sortDirection: SortDirection$inboundSchema.optional(), totalRecords: z.number().int().optional(), records: z.nullable(z.array(HistoryResource$inboundSchema)).optional(), }); /** @internal */ export type HistoryResourcePagingResource$Outbound = { page?: number | undefined; pageSize?: number | undefined; sortKey?: string | null | undefined; sortDirection?: string | undefined; totalRecords?: number | undefined; records?: Array | null | undefined; }; /** @internal */ export const HistoryResourcePagingResource$outboundSchema: z.ZodType< HistoryResourcePagingResource$Outbound, z.ZodTypeDef, HistoryResourcePagingResource > = z.object({ page: z.number().int().optional(), pageSize: z.number().int().optional(), sortKey: z.nullable(z.string()).optional(), sortDirection: SortDirection$outboundSchema.optional(), totalRecords: z.number().int().optional(), records: z.nullable(z.array(HistoryResource$outboundSchema)).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace HistoryResourcePagingResource$ { /** @deprecated use `HistoryResourcePagingResource$inboundSchema` instead. */ export const inboundSchema = HistoryResourcePagingResource$inboundSchema; /** @deprecated use `HistoryResourcePagingResource$outboundSchema` instead. */ export const outboundSchema = HistoryResourcePagingResource$outboundSchema; /** @deprecated use `HistoryResourcePagingResource$Outbound` instead. */ export type Outbound = HistoryResourcePagingResource$Outbound; } export function historyResourcePagingResourceToJSON( historyResourcePagingResource: HistoryResourcePagingResource, ): string { return JSON.stringify( HistoryResourcePagingResource$outboundSchema.parse( historyResourcePagingResource, ), ); } export function historyResourcePagingResourceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => HistoryResourcePagingResource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'HistoryResourcePagingResource' from JSON`, ); }