/* * 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 GetApiV3NodesIncludeStatus = { Down: "DOWN", Up: "UP", Unassigned: "UNASSIGNED", Disabled: "DISABLED", Degraded: "DEGRADED", } as const; export type GetApiV3NodesIncludeStatus = ClosedEnum< typeof GetApiV3NodesIncludeStatus >; export const GetApiV3NodesIncludeNodeType = { ApiBoundary: "API_BOUNDARY", Replica: "REPLICA", } as const; export type GetApiV3NodesIncludeNodeType = ClosedEnum< typeof GetApiV3NodesIncludeNodeType >; export const GetApiV3NodesFormat = { Json: "json", Csv: "csv", } as const; export type GetApiV3NodesFormat = ClosedEnum; export type GetApiV3NodesRequest = { /** * Node Statuses */ includeStatus?: Array | undefined; /** * Subnet ID */ subnet?: string | null | undefined; /** * Node Types */ includeNodeType?: Array | undefined; format?: GetApiV3NodesFormat | undefined; /** * Data Center ID */ dcId?: string | null | undefined; /** * Node Provider ID */ nodeProviderId?: string | null | undefined; }; /** @internal */ export const GetApiV3NodesIncludeStatus$inboundSchema: z.ZodNativeEnum< typeof GetApiV3NodesIncludeStatus > = z.nativeEnum(GetApiV3NodesIncludeStatus); /** @internal */ export const GetApiV3NodesIncludeStatus$outboundSchema: z.ZodNativeEnum< typeof GetApiV3NodesIncludeStatus > = GetApiV3NodesIncludeStatus$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetApiV3NodesIncludeStatus$ { /** @deprecated use `GetApiV3NodesIncludeStatus$inboundSchema` instead. */ export const inboundSchema = GetApiV3NodesIncludeStatus$inboundSchema; /** @deprecated use `GetApiV3NodesIncludeStatus$outboundSchema` instead. */ export const outboundSchema = GetApiV3NodesIncludeStatus$outboundSchema; } /** @internal */ export const GetApiV3NodesIncludeNodeType$inboundSchema: z.ZodNativeEnum< typeof GetApiV3NodesIncludeNodeType > = z.nativeEnum(GetApiV3NodesIncludeNodeType); /** @internal */ export const GetApiV3NodesIncludeNodeType$outboundSchema: z.ZodNativeEnum< typeof GetApiV3NodesIncludeNodeType > = GetApiV3NodesIncludeNodeType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetApiV3NodesIncludeNodeType$ { /** @deprecated use `GetApiV3NodesIncludeNodeType$inboundSchema` instead. */ export const inboundSchema = GetApiV3NodesIncludeNodeType$inboundSchema; /** @deprecated use `GetApiV3NodesIncludeNodeType$outboundSchema` instead. */ export const outboundSchema = GetApiV3NodesIncludeNodeType$outboundSchema; } /** @internal */ export const GetApiV3NodesFormat$inboundSchema: z.ZodNativeEnum< typeof GetApiV3NodesFormat > = z.nativeEnum(GetApiV3NodesFormat); /** @internal */ export const GetApiV3NodesFormat$outboundSchema: z.ZodNativeEnum< typeof GetApiV3NodesFormat > = GetApiV3NodesFormat$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetApiV3NodesFormat$ { /** @deprecated use `GetApiV3NodesFormat$inboundSchema` instead. */ export const inboundSchema = GetApiV3NodesFormat$inboundSchema; /** @deprecated use `GetApiV3NodesFormat$outboundSchema` instead. */ export const outboundSchema = GetApiV3NodesFormat$outboundSchema; } /** @internal */ export const GetApiV3NodesRequest$inboundSchema: z.ZodType< GetApiV3NodesRequest, z.ZodTypeDef, unknown > = z.object({ include_status: z.array(GetApiV3NodesIncludeStatus$inboundSchema).optional(), subnet: z.nullable(z.string()).default(null), include_node_type: z.array(GetApiV3NodesIncludeNodeType$inboundSchema) .optional(), format: GetApiV3NodesFormat$inboundSchema.default("json"), dc_id: z.nullable(z.string()).default(null), node_provider_id: z.nullable(z.string()).default(null), }).transform((v) => { return remap$(v, { "include_status": "includeStatus", "include_node_type": "includeNodeType", "dc_id": "dcId", "node_provider_id": "nodeProviderId", }); }); /** @internal */ export type GetApiV3NodesRequest$Outbound = { include_status?: Array | undefined; subnet: string | null; include_node_type?: Array | undefined; format: string; dc_id: string | null; node_provider_id: string | null; }; /** @internal */ export const GetApiV3NodesRequest$outboundSchema: z.ZodType< GetApiV3NodesRequest$Outbound, z.ZodTypeDef, GetApiV3NodesRequest > = z.object({ includeStatus: z.array(GetApiV3NodesIncludeStatus$outboundSchema).optional(), subnet: z.nullable(z.string()).default(null), includeNodeType: z.array(GetApiV3NodesIncludeNodeType$outboundSchema) .optional(), format: GetApiV3NodesFormat$outboundSchema.default("json"), dcId: z.nullable(z.string()).default(null), nodeProviderId: z.nullable(z.string()).default(null), }).transform((v) => { return remap$(v, { includeStatus: "include_status", includeNodeType: "include_node_type", dcId: "dc_id", nodeProviderId: "node_provider_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetApiV3NodesRequest$ { /** @deprecated use `GetApiV3NodesRequest$inboundSchema` instead. */ export const inboundSchema = GetApiV3NodesRequest$inboundSchema; /** @deprecated use `GetApiV3NodesRequest$outboundSchema` instead. */ export const outboundSchema = GetApiV3NodesRequest$outboundSchema; /** @deprecated use `GetApiV3NodesRequest$Outbound` instead. */ export type Outbound = GetApiV3NodesRequest$Outbound; } export function getApiV3NodesRequestToJSON( getApiV3NodesRequest: GetApiV3NodesRequest, ): string { return JSON.stringify( GetApiV3NodesRequest$outboundSchema.parse(getApiV3NodesRequest), ); } export function getApiV3NodesRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetApiV3NodesRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetApiV3NodesRequest' from JSON`, ); }