/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Hosting, Hosting$inboundSchema } from "./hosting.js"; import { Region, Region$inboundSchema } from "./region.js"; export const NodeV1Status = { Running: "running", Draining: "draining", Stopped: "stopped", } as const; export type NodeV1Status = OpenEnum; export type NodeV1 = { stoppedAt: Date | null; startedAt: Date; gpu: number | null; memoryMb: number; cpu: number; region: Region; status: NodeV1Status; hosting: Hosting; host: string; nodeId: string; }; /** @internal */ export const NodeV1Status$inboundSchema: z.ZodType< NodeV1Status, z.ZodTypeDef, unknown > = openEnums.inboundSchema(NodeV1Status); /** @internal */ export const NodeV1$inboundSchema: z.ZodType = z .object({ stoppedAt: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), startedAt: z.string().datetime({ offset: true }).transform(v => new Date(v) ), gpu: z.nullable(z.number()), memoryMb: z.number(), cpu: z.number(), region: Region$inboundSchema, status: NodeV1Status$inboundSchema, hosting: Hosting$inboundSchema, host: z.string(), nodeId: z.string(), }); export function nodeV1FromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => NodeV1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NodeV1' from JSON`, ); }