/* * 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 ListApiV2LedgersGetSortBy = { LedgerCanisterId: "ledger_canister_id", MinusLedgerCanisterId: "-ledger_canister_id", Icrc1Name: "icrc1_name", MinusIcrc1Name: "-icrc1_name", Icrc1Symbol: "icrc1_symbol", MinusIcrc1Symbol: "-icrc1_symbol", TotalTransactionsCountOverPast7d: "total_transactions_count_over_past_7d", MinusTotalTransactionsCountOverPast7d: "-total_transactions_count_over_past_7d", UniqueOwnersCount: "unique_owners_count", MinusUniqueOwnersCount: "-unique_owners_count", } as const; export type ListApiV2LedgersGetSortBy = ClosedEnum< typeof ListApiV2LedgersGetSortBy >; export type ListApiV2LedgersGetRequest = { /** * Only match values after this ledger_canister_id */ after?: Array | undefined; /** * Only match values before this ledger_canister_id */ before?: Array | undefined; network?: Array | undefined; tokenTypes?: Array | undefined; limit?: number | undefined; sortBy?: ListApiV2LedgersGetSortBy | undefined; includeTotalSupply7d?: boolean | undefined; /** * Search for a ledger by name or symbol */ query?: string | undefined; }; /** @internal */ export const ListApiV2LedgersGetSortBy$inboundSchema: z.ZodNativeEnum< typeof ListApiV2LedgersGetSortBy > = z.nativeEnum(ListApiV2LedgersGetSortBy); /** @internal */ export const ListApiV2LedgersGetSortBy$outboundSchema: z.ZodNativeEnum< typeof ListApiV2LedgersGetSortBy > = ListApiV2LedgersGetSortBy$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ListApiV2LedgersGetSortBy$ { /** @deprecated use `ListApiV2LedgersGetSortBy$inboundSchema` instead. */ export const inboundSchema = ListApiV2LedgersGetSortBy$inboundSchema; /** @deprecated use `ListApiV2LedgersGetSortBy$outboundSchema` instead. */ export const outboundSchema = ListApiV2LedgersGetSortBy$outboundSchema; } /** @internal */ export const ListApiV2LedgersGetRequest$inboundSchema: z.ZodType< ListApiV2LedgersGetRequest, z.ZodTypeDef, unknown > = z.object({ after: z.array(z.string()).optional(), before: z.array(z.string()).optional(), network: z.array(models.Network$inboundSchema).optional(), token_types: z.array(models.AppModelsLedgersTokenType$inboundSchema) .optional(), limit: z.number().int().default(20), sort_by: ListApiV2LedgersGetSortBy$inboundSchema.default( "ledger_canister_id", ), include_total_supply_7d: z.boolean().default(false), query: z.string().optional(), }).transform((v) => { return remap$(v, { "token_types": "tokenTypes", "sort_by": "sortBy", "include_total_supply_7d": "includeTotalSupply7d", }); }); /** @internal */ export type ListApiV2LedgersGetRequest$Outbound = { after?: Array | undefined; before?: Array | undefined; network?: Array | undefined; token_types?: Array | undefined; limit: number; sort_by: string; include_total_supply_7d: boolean; query?: string | undefined; }; /** @internal */ export const ListApiV2LedgersGetRequest$outboundSchema: z.ZodType< ListApiV2LedgersGetRequest$Outbound, z.ZodTypeDef, ListApiV2LedgersGetRequest > = z.object({ after: z.array(z.string()).optional(), before: z.array(z.string()).optional(), network: z.array(models.Network$outboundSchema).optional(), tokenTypes: z.array(models.AppModelsLedgersTokenType$outboundSchema) .optional(), limit: z.number().int().default(20), sortBy: ListApiV2LedgersGetSortBy$outboundSchema.default( "ledger_canister_id", ), includeTotalSupply7d: z.boolean().default(false), query: z.string().optional(), }).transform((v) => { return remap$(v, { tokenTypes: "token_types", sortBy: "sort_by", includeTotalSupply7d: "include_total_supply_7d", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ListApiV2LedgersGetRequest$ { /** @deprecated use `ListApiV2LedgersGetRequest$inboundSchema` instead. */ export const inboundSchema = ListApiV2LedgersGetRequest$inboundSchema; /** @deprecated use `ListApiV2LedgersGetRequest$outboundSchema` instead. */ export const outboundSchema = ListApiV2LedgersGetRequest$outboundSchema; /** @deprecated use `ListApiV2LedgersGetRequest$Outbound` instead. */ export type Outbound = ListApiV2LedgersGetRequest$Outbound; } export function listApiV2LedgersGetRequestToJSON( listApiV2LedgersGetRequest: ListApiV2LedgersGetRequest, ): string { return JSON.stringify( ListApiV2LedgersGetRequest$outboundSchema.parse(listApiV2LedgersGetRequest), ); } export function listApiV2LedgersGetRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListApiV2LedgersGetRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListApiV2LedgersGetRequest' from JSON`, ); }