/* * 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"; export const IncludeState = { Dissolved: "Dissolved", Dissolving: "Dissolving", NotDissolving: "NotDissolving", Spawning: "Spawning", Unknown: "Unknown", Unspecified: "Unspecified", } as const; export type IncludeState = ClosedEnum; export const IncludeType = { Gtc: "gtc", Known: "known", } as const; export type IncludeType = ClosedEnum; export const GetApiV3NeuronsFormat = { Json: "json", Csv: "csv", } as const; export type GetApiV3NeuronsFormat = ClosedEnum; export type GetApiV3NeuronsRequest = { includeState?: Array | undefined; includeType?: Array | undefined; limit?: number | undefined; maxNeuronIndex?: number | null | undefined; offset?: number | undefined; /** * Available values : id, name, state, age_seconds, dissolve_delay_seconds, voting_power, created_timestamp_seconds, stake_e8s, joined_community_fund_timestamp_seconds */ sortBy?: any | undefined; format?: GetApiV3NeuronsFormat | undefined; }; /** @internal */ export const IncludeState$inboundSchema: z.ZodNativeEnum = z.nativeEnum(IncludeState); /** @internal */ export const IncludeState$outboundSchema: z.ZodNativeEnum = IncludeState$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace IncludeState$ { /** @deprecated use `IncludeState$inboundSchema` instead. */ export const inboundSchema = IncludeState$inboundSchema; /** @deprecated use `IncludeState$outboundSchema` instead. */ export const outboundSchema = IncludeState$outboundSchema; } /** @internal */ export const IncludeType$inboundSchema: z.ZodNativeEnum = z .nativeEnum(IncludeType); /** @internal */ export const IncludeType$outboundSchema: z.ZodNativeEnum = IncludeType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace IncludeType$ { /** @deprecated use `IncludeType$inboundSchema` instead. */ export const inboundSchema = IncludeType$inboundSchema; /** @deprecated use `IncludeType$outboundSchema` instead. */ export const outboundSchema = IncludeType$outboundSchema; } /** @internal */ export const GetApiV3NeuronsFormat$inboundSchema: z.ZodNativeEnum< typeof GetApiV3NeuronsFormat > = z.nativeEnum(GetApiV3NeuronsFormat); /** @internal */ export const GetApiV3NeuronsFormat$outboundSchema: z.ZodNativeEnum< typeof GetApiV3NeuronsFormat > = GetApiV3NeuronsFormat$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetApiV3NeuronsFormat$ { /** @deprecated use `GetApiV3NeuronsFormat$inboundSchema` instead. */ export const inboundSchema = GetApiV3NeuronsFormat$inboundSchema; /** @deprecated use `GetApiV3NeuronsFormat$outboundSchema` instead. */ export const outboundSchema = GetApiV3NeuronsFormat$outboundSchema; } /** @internal */ export const GetApiV3NeuronsRequest$inboundSchema: z.ZodType< GetApiV3NeuronsRequest, z.ZodTypeDef, unknown > = z.object({ include_state: z.array(IncludeState$inboundSchema).optional(), include_type: z.array(IncludeType$inboundSchema).optional(), limit: z.number().int().default(50), max_neuron_index: z.nullable(z.number().int()).default(null), offset: z.number().int().default(0), sort_by: z.any(), format: GetApiV3NeuronsFormat$inboundSchema.default("json"), }).transform((v) => { return remap$(v, { "include_state": "includeState", "include_type": "includeType", "max_neuron_index": "maxNeuronIndex", "sort_by": "sortBy", }); }); /** @internal */ export type GetApiV3NeuronsRequest$Outbound = { include_state?: Array | undefined; include_type?: Array | undefined; limit: number; max_neuron_index: number | null; offset: number; sort_by?: any; format: string; }; /** @internal */ export const GetApiV3NeuronsRequest$outboundSchema: z.ZodType< GetApiV3NeuronsRequest$Outbound, z.ZodTypeDef, GetApiV3NeuronsRequest > = z.object({ includeState: z.array(IncludeState$outboundSchema).optional(), includeType: z.array(IncludeType$outboundSchema).optional(), limit: z.number().int().default(50), maxNeuronIndex: z.nullable(z.number().int()).default(null), offset: z.number().int().default(0), sortBy: z.any(), format: GetApiV3NeuronsFormat$outboundSchema.default("json"), }).transform((v) => { return remap$(v, { includeState: "include_state", includeType: "include_type", maxNeuronIndex: "max_neuron_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 GetApiV3NeuronsRequest$ { /** @deprecated use `GetApiV3NeuronsRequest$inboundSchema` instead. */ export const inboundSchema = GetApiV3NeuronsRequest$inboundSchema; /** @deprecated use `GetApiV3NeuronsRequest$outboundSchema` instead. */ export const outboundSchema = GetApiV3NeuronsRequest$outboundSchema; /** @deprecated use `GetApiV3NeuronsRequest$Outbound` instead. */ export type Outbound = GetApiV3NeuronsRequest$Outbound; } export function getApiV3NeuronsRequestToJSON( getApiV3NeuronsRequest: GetApiV3NeuronsRequest, ): string { return JSON.stringify( GetApiV3NeuronsRequest$outboundSchema.parse(getApiV3NeuronsRequest), ); } export function getApiV3NeuronsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetApiV3NeuronsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetApiV3NeuronsRequest' from JSON`, ); }