/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; 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"; import * as models from "../index.js"; export const ListApiV1LedgersGetSortBy = { LedgerCanisterId: "ledger_canister_id", MinusLedgerCanisterId: "-ledger_canister_id", Icrc1Name: "icrc1_name", MinusIcrc1Name: "-icrc1_name", Icrc1Symbol: "icrc1_symbol", MinusIcrc1Symbol: "-icrc1_symbol", } as const; export type ListApiV1LedgersGetSortBy = ClosedEnum< typeof ListApiV1LedgersGetSortBy >; export type ListApiV1LedgersGetRequest = { tokenTypes?: Array | undefined; offset?: number | undefined; limit?: number | undefined; maxIndex?: number | undefined; sortBy?: Array | undefined; }; /** @internal */ export const ListApiV1LedgersGetSortBy$inboundSchema: z.ZodNativeEnum< typeof ListApiV1LedgersGetSortBy > = z.nativeEnum(ListApiV1LedgersGetSortBy); /** @internal */ export const ListApiV1LedgersGetSortBy$outboundSchema: z.ZodNativeEnum< typeof ListApiV1LedgersGetSortBy > = ListApiV1LedgersGetSortBy$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ListApiV1LedgersGetSortBy$ { /** @deprecated use `ListApiV1LedgersGetSortBy$inboundSchema` instead. */ export const inboundSchema = ListApiV1LedgersGetSortBy$inboundSchema; /** @deprecated use `ListApiV1LedgersGetSortBy$outboundSchema` instead. */ export const outboundSchema = ListApiV1LedgersGetSortBy$outboundSchema; } /** @internal */ export const ListApiV1LedgersGetRequest$inboundSchema: z.ZodType< ListApiV1LedgersGetRequest, z.ZodTypeDef, unknown > = z.object({ token_types: z.array(models.AppSchemasLedgersTokenType$inboundSchema) .optional(), offset: z.number().int().default(0), limit: z.number().int().default(20), max_index: z.number().int().optional(), sort_by: z.array(ListApiV1LedgersGetSortBy$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "token_types": "tokenTypes", "max_index": "maxIndex", "sort_by": "sortBy", }); }); /** @internal */ export type ListApiV1LedgersGetRequest$Outbound = { token_types?: Array | undefined; offset: number; limit: number; max_index?: number | undefined; sort_by?: Array | undefined; }; /** @internal */ export const ListApiV1LedgersGetRequest$outboundSchema: z.ZodType< ListApiV1LedgersGetRequest$Outbound, z.ZodTypeDef, ListApiV1LedgersGetRequest > = z.object({ tokenTypes: z.array(models.AppSchemasLedgersTokenType$outboundSchema) .optional(), offset: z.number().int().default(0), limit: z.number().int().default(20), maxIndex: z.number().int().optional(), sortBy: z.array(ListApiV1LedgersGetSortBy$outboundSchema).optional(), }).transform((v) => { return remap$(v, { tokenTypes: "token_types", maxIndex: "max_index", sortBy: "sort_by", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ListApiV1LedgersGetRequest$ { /** @deprecated use `ListApiV1LedgersGetRequest$inboundSchema` instead. */ export const inboundSchema = ListApiV1LedgersGetRequest$inboundSchema; /** @deprecated use `ListApiV1LedgersGetRequest$outboundSchema` instead. */ export const outboundSchema = ListApiV1LedgersGetRequest$outboundSchema; /** @deprecated use `ListApiV1LedgersGetRequest$Outbound` instead. */ export type Outbound = ListApiV1LedgersGetRequest$Outbound; } export function listApiV1LedgersGetRequestToJSON( listApiV1LedgersGetRequest: ListApiV1LedgersGetRequest, ): string { return JSON.stringify( ListApiV1LedgersGetRequest$outboundSchema.parse(listApiV1LedgersGetRequest), ); } export function listApiV1LedgersGetRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListApiV1LedgersGetRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListApiV1LedgersGetRequest' from JSON`, ); }