/* * 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 GetApiV4SubnetsSubnetSpecializationOrType = { European: "european", Fiduciary: "fiduciary", Application: "application", System: "system", } as const; export type GetApiV4SubnetsSubnetSpecializationOrType = ClosedEnum< typeof GetApiV4SubnetsSubnetSpecializationOrType >; export const GetApiV4SubnetsSubnetSpecialization = { European: "european", Fiduciary: "fiduciary", } as const; export type GetApiV4SubnetsSubnetSpecialization = ClosedEnum< typeof GetApiV4SubnetsSubnetSpecialization >; export const SortBy = { InstructionRate: "instruction_rate", MinusInstructionRate: "-instruction_rate", MemoryUsage: "memory_usage", MinusMemoryUsage: "-memory_usage", MessageExecutionRate: "message_execution_rate", MinusMessageExecutionRate: "-message_execution_rate", NakamotoCoefficientOverall: "nakamoto_coefficient_overall", MinusNakamotoCoefficientOverall: "-nakamoto_coefficient_overall", SubnetAuthorization: "subnet_authorization", MinusSubnetAuthorization: "-subnet_authorization", SubnetId: "subnet_id", MinusSubnetId: "-subnet_id", SubnetType: "subnet_type", MinusSubnetType: "-subnet_type", SubnetSpecialization: "subnet_specialization", MinusSubnetSpecialization: "-subnet_specialization", SubnetSpecializationOrType: "subnet_specialization_or_type", MinusSubnetSpecializationOrType: "-subnet_specialization_or_type", TotalNodes: "total_nodes", MinusTotalNodes: "-total_nodes", TotalCanisters: "total_canisters", MinusTotalCanisters: "-total_canisters", TotalCountries: "total_countries", MinusTotalCountries: "-total_countries", } as const; export type SortBy = ClosedEnum; export const GetApiV4SubnetsFormat = { Json: "json", Csv: "csv", } as const; export type GetApiV4SubnetsFormat = ClosedEnum; export const GetApiV4SubnetsSubnetAuthorization = { Public: "public", AuthorizedOnly: "authorized_only", } as const; export type GetApiV4SubnetsSubnetAuthorization = ClosedEnum< typeof GetApiV4SubnetsSubnetAuthorization >; export const GetApiV4SubnetsSubnetType = { Application: "application", System: "system", VerifiedApplication: "verified_application", } as const; export type GetApiV4SubnetsSubnetType = ClosedEnum< typeof GetApiV4SubnetsSubnetType >; export type GetApiV4SubnetsRequest = { /** * Only match values after this ledger_canister_id */ after?: Array | undefined; /** * Subnet Specialization or Type */ subnetSpecializationOrType?: | Array | undefined; limit?: number | undefined; /** * Subnet Specialization */ subnetSpecialization?: Array | undefined; sortBy?: SortBy | undefined; format?: GetApiV4SubnetsFormat | undefined; /** * Only match values before this ledger_canister_id */ before?: Array | undefined; /** * Subnet Authorization */ subnetAuthorization?: Array | undefined; /** * Include Replica Versions */ includeReplicaVersions?: boolean | undefined; /** * Subnet Type */ subnetType?: Array | undefined; /** * Data Center ID */ dcId?: string | null | undefined; }; export type GetApiV4SubnetsResponse = | models.ErrorT | models.ListSubnetsResponse; /** @internal */ export const GetApiV4SubnetsSubnetSpecializationOrType$inboundSchema: z.ZodNativeEnum = z .nativeEnum(GetApiV4SubnetsSubnetSpecializationOrType); /** @internal */ export const GetApiV4SubnetsSubnetSpecializationOrType$outboundSchema: z.ZodNativeEnum = GetApiV4SubnetsSubnetSpecializationOrType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetApiV4SubnetsSubnetSpecializationOrType$ { /** @deprecated use `GetApiV4SubnetsSubnetSpecializationOrType$inboundSchema` instead. */ export const inboundSchema = GetApiV4SubnetsSubnetSpecializationOrType$inboundSchema; /** @deprecated use `GetApiV4SubnetsSubnetSpecializationOrType$outboundSchema` instead. */ export const outboundSchema = GetApiV4SubnetsSubnetSpecializationOrType$outboundSchema; } /** @internal */ export const GetApiV4SubnetsSubnetSpecialization$inboundSchema: z.ZodNativeEnum< typeof GetApiV4SubnetsSubnetSpecialization > = z.nativeEnum(GetApiV4SubnetsSubnetSpecialization); /** @internal */ export const GetApiV4SubnetsSubnetSpecialization$outboundSchema: z.ZodNativeEnum = GetApiV4SubnetsSubnetSpecialization$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetApiV4SubnetsSubnetSpecialization$ { /** @deprecated use `GetApiV4SubnetsSubnetSpecialization$inboundSchema` instead. */ export const inboundSchema = GetApiV4SubnetsSubnetSpecialization$inboundSchema; /** @deprecated use `GetApiV4SubnetsSubnetSpecialization$outboundSchema` instead. */ export const outboundSchema = GetApiV4SubnetsSubnetSpecialization$outboundSchema; } /** @internal */ export const SortBy$inboundSchema: z.ZodNativeEnum = z .nativeEnum(SortBy); /** @internal */ export const SortBy$outboundSchema: z.ZodNativeEnum = SortBy$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace SortBy$ { /** @deprecated use `SortBy$inboundSchema` instead. */ export const inboundSchema = SortBy$inboundSchema; /** @deprecated use `SortBy$outboundSchema` instead. */ export const outboundSchema = SortBy$outboundSchema; } /** @internal */ export const GetApiV4SubnetsFormat$inboundSchema: z.ZodNativeEnum< typeof GetApiV4SubnetsFormat > = z.nativeEnum(GetApiV4SubnetsFormat); /** @internal */ export const GetApiV4SubnetsFormat$outboundSchema: z.ZodNativeEnum< typeof GetApiV4SubnetsFormat > = GetApiV4SubnetsFormat$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetApiV4SubnetsFormat$ { /** @deprecated use `GetApiV4SubnetsFormat$inboundSchema` instead. */ export const inboundSchema = GetApiV4SubnetsFormat$inboundSchema; /** @deprecated use `GetApiV4SubnetsFormat$outboundSchema` instead. */ export const outboundSchema = GetApiV4SubnetsFormat$outboundSchema; } /** @internal */ export const GetApiV4SubnetsSubnetAuthorization$inboundSchema: z.ZodNativeEnum< typeof GetApiV4SubnetsSubnetAuthorization > = z.nativeEnum(GetApiV4SubnetsSubnetAuthorization); /** @internal */ export const GetApiV4SubnetsSubnetAuthorization$outboundSchema: z.ZodNativeEnum< typeof GetApiV4SubnetsSubnetAuthorization > = GetApiV4SubnetsSubnetAuthorization$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetApiV4SubnetsSubnetAuthorization$ { /** @deprecated use `GetApiV4SubnetsSubnetAuthorization$inboundSchema` instead. */ export const inboundSchema = GetApiV4SubnetsSubnetAuthorization$inboundSchema; /** @deprecated use `GetApiV4SubnetsSubnetAuthorization$outboundSchema` instead. */ export const outboundSchema = GetApiV4SubnetsSubnetAuthorization$outboundSchema; } /** @internal */ export const GetApiV4SubnetsSubnetType$inboundSchema: z.ZodNativeEnum< typeof GetApiV4SubnetsSubnetType > = z.nativeEnum(GetApiV4SubnetsSubnetType); /** @internal */ export const GetApiV4SubnetsSubnetType$outboundSchema: z.ZodNativeEnum< typeof GetApiV4SubnetsSubnetType > = GetApiV4SubnetsSubnetType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetApiV4SubnetsSubnetType$ { /** @deprecated use `GetApiV4SubnetsSubnetType$inboundSchema` instead. */ export const inboundSchema = GetApiV4SubnetsSubnetType$inboundSchema; /** @deprecated use `GetApiV4SubnetsSubnetType$outboundSchema` instead. */ export const outboundSchema = GetApiV4SubnetsSubnetType$outboundSchema; } /** @internal */ export const GetApiV4SubnetsRequest$inboundSchema: z.ZodType< GetApiV4SubnetsRequest, z.ZodTypeDef, unknown > = z.object({ after: z.array(z.string()).optional(), subnet_specialization_or_type: z.array( GetApiV4SubnetsSubnetSpecializationOrType$inboundSchema, ).optional(), limit: z.number().int().default(20), subnet_specialization: z.array( GetApiV4SubnetsSubnetSpecialization$inboundSchema, ).optional(), sort_by: SortBy$inboundSchema.default("subnet_id"), format: GetApiV4SubnetsFormat$inboundSchema.default("json"), before: z.array(z.string()).optional(), subnet_authorization: z.array( GetApiV4SubnetsSubnetAuthorization$inboundSchema, ).optional(), include_replica_versions: z.boolean().default(false), subnet_type: z.array(GetApiV4SubnetsSubnetType$inboundSchema).optional(), dc_id: z.nullable(z.string()).default(null), }).transform((v) => { return remap$(v, { "subnet_specialization_or_type": "subnetSpecializationOrType", "subnet_specialization": "subnetSpecialization", "sort_by": "sortBy", "subnet_authorization": "subnetAuthorization", "include_replica_versions": "includeReplicaVersions", "subnet_type": "subnetType", "dc_id": "dcId", }); }); /** @internal */ export type GetApiV4SubnetsRequest$Outbound = { after?: Array | undefined; subnet_specialization_or_type?: Array | undefined; limit: number; subnet_specialization?: Array | undefined; sort_by: string; format: string; before?: Array | undefined; subnet_authorization?: Array | undefined; include_replica_versions: boolean; subnet_type?: Array | undefined; dc_id: string | null; }; /** @internal */ export const GetApiV4SubnetsRequest$outboundSchema: z.ZodType< GetApiV4SubnetsRequest$Outbound, z.ZodTypeDef, GetApiV4SubnetsRequest > = z.object({ after: z.array(z.string()).optional(), subnetSpecializationOrType: z.array( GetApiV4SubnetsSubnetSpecializationOrType$outboundSchema, ).optional(), limit: z.number().int().default(20), subnetSpecialization: z.array( GetApiV4SubnetsSubnetSpecialization$outboundSchema, ).optional(), sortBy: SortBy$outboundSchema.default("subnet_id"), format: GetApiV4SubnetsFormat$outboundSchema.default("json"), before: z.array(z.string()).optional(), subnetAuthorization: z.array( GetApiV4SubnetsSubnetAuthorization$outboundSchema, ).optional(), includeReplicaVersions: z.boolean().default(false), subnetType: z.array(GetApiV4SubnetsSubnetType$outboundSchema).optional(), dcId: z.nullable(z.string()).default(null), }).transform((v) => { return remap$(v, { subnetSpecializationOrType: "subnet_specialization_or_type", subnetSpecialization: "subnet_specialization", sortBy: "sort_by", subnetAuthorization: "subnet_authorization", includeReplicaVersions: "include_replica_versions", subnetType: "subnet_type", dcId: "dc_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetApiV4SubnetsRequest$ { /** @deprecated use `GetApiV4SubnetsRequest$inboundSchema` instead. */ export const inboundSchema = GetApiV4SubnetsRequest$inboundSchema; /** @deprecated use `GetApiV4SubnetsRequest$outboundSchema` instead. */ export const outboundSchema = GetApiV4SubnetsRequest$outboundSchema; /** @deprecated use `GetApiV4SubnetsRequest$Outbound` instead. */ export type Outbound = GetApiV4SubnetsRequest$Outbound; } export function getApiV4SubnetsRequestToJSON( getApiV4SubnetsRequest: GetApiV4SubnetsRequest, ): string { return JSON.stringify( GetApiV4SubnetsRequest$outboundSchema.parse(getApiV4SubnetsRequest), ); } export function getApiV4SubnetsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetApiV4SubnetsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetApiV4SubnetsRequest' from JSON`, ); } /** @internal */ export const GetApiV4SubnetsResponse$inboundSchema: z.ZodType< GetApiV4SubnetsResponse, z.ZodTypeDef, unknown > = z.union([ models.ErrorT$inboundSchema, models.ListSubnetsResponse$inboundSchema, ]); /** @internal */ export type GetApiV4SubnetsResponse$Outbound = | models.ErrorT$Outbound | models.ListSubnetsResponse$Outbound; /** @internal */ export const GetApiV4SubnetsResponse$outboundSchema: z.ZodType< GetApiV4SubnetsResponse$Outbound, z.ZodTypeDef, GetApiV4SubnetsResponse > = z.union([ models.ErrorT$outboundSchema, models.ListSubnetsResponse$outboundSchema, ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetApiV4SubnetsResponse$ { /** @deprecated use `GetApiV4SubnetsResponse$inboundSchema` instead. */ export const inboundSchema = GetApiV4SubnetsResponse$inboundSchema; /** @deprecated use `GetApiV4SubnetsResponse$outboundSchema` instead. */ export const outboundSchema = GetApiV4SubnetsResponse$outboundSchema; /** @deprecated use `GetApiV4SubnetsResponse$Outbound` instead. */ export type Outbound = GetApiV4SubnetsResponse$Outbound; } export function getApiV4SubnetsResponseToJSON( getApiV4SubnetsResponse: GetApiV4SubnetsResponse, ): string { return JSON.stringify( GetApiV4SubnetsResponse$outboundSchema.parse(getApiV4SubnetsResponse), ); } export function getApiV4SubnetsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetApiV4SubnetsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetApiV4SubnetsResponse' from JSON`, ); }