UNPKG

@unkey/api

Version:

Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@unkey/api* API.

73 lines (64 loc) 1.97 kB
/* * 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"; export type Pagination = { /** * Opaque token for retrieving the next set of results */ cursor?: string | undefined; /** * Indicates if more results exist beyond this page */ hasMore?: boolean | undefined; }; /** @internal */ export const Pagination$inboundSchema: z.ZodType< Pagination, z.ZodTypeDef, unknown > = z.object({ cursor: z.string().optional(), hasMore: z.boolean().optional(), }); /** @internal */ export type Pagination$Outbound = { cursor?: string | undefined; hasMore?: boolean | undefined; }; /** @internal */ export const Pagination$outboundSchema: z.ZodType< Pagination$Outbound, z.ZodTypeDef, Pagination > = z.object({ cursor: z.string().optional(), hasMore: z.boolean().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Pagination$ { /** @deprecated use `Pagination$inboundSchema` instead. */ export const inboundSchema = Pagination$inboundSchema; /** @deprecated use `Pagination$outboundSchema` instead. */ export const outboundSchema = Pagination$outboundSchema; /** @deprecated use `Pagination$Outbound` instead. */ export type Outbound = Pagination$Outbound; } export function paginationToJSON(pagination: Pagination): string { return JSON.stringify(Pagination$outboundSchema.parse(pagination)); } export function paginationFromJSON( jsonString: string, ): SafeParseResult<Pagination, SDKValidationError> { return safeParse( jsonString, (x) => Pagination$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Pagination' from JSON`, ); }