UNPKG

@unkey/api

Version:

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

51 lines (46 loc) 1.43 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Pagination metadata for list endpoints. Provides information necessary to traverse through large result sets efficiently using cursor-based pagination. */ export type Pagination = { /** * Opaque pagination token for retrieving the next page of results. * * @remarks * Include this exact value in the cursor field of subsequent requests. * Cursors are temporary and may expire after extended periods. */ cursor?: string | undefined; /** * Indicates whether additional results exist beyond this page. * * @remarks * When true, use the cursor to fetch the next page. * When false, you have reached the end of the result set. */ hasMore: boolean; }; /** @internal */ export const Pagination$inboundSchema: z.ZodType< Pagination, z.ZodTypeDef, unknown > = z.object({ cursor: z.string().optional(), hasMore: z.boolean(), }); export function paginationFromJSON( jsonString: string, ): SafeParseResult<Pagination, SDKValidationError> { return safeParse( jsonString, (x) => Pagination$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Pagination' from JSON`, ); }