/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: dfcc1846b961 */ import * as z from "zod/v4"; import { safeParse } from "../lib/schemas.js"; import { ClosedEnum } from "../types/enums.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { DomainEndpoint, DomainEndpoint$inboundSchema, } from "./domainendpoint.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; export const DomainWithUsageStatus = { PendingZoneCreation: "pending-zone-creation", PendingVerification: "pending-verification", Verified: "verified", LostVerification: "lost-verification", Failed: "failed", Deleting: "deleting", } as const; export type DomainWithUsageStatus = ClosedEnum; export type DeploymentUrlProject = { id: string; name: string; }; export type PortalBinding = { id: string; projectId: string | null; projectName: string | null; hostname: string; }; export type PackageDomain = { id: string; hostname: string; }; export type ManagerBinding = { id: string; managerId: string; managerName: string; hostname: string; }; export type DomainWithUsageUsage = { deploymentUrlProjects: Array; portalBindings: Array; packageDomains: Array; managerBindings: Array; }; export type DomainWithUsage = { /** * Unique identifier for the domain. */ id: string; /** * Unique identifier for the workspace. */ workspaceId: string; domain: string; isSystem: boolean; claimToken: string; hostedZoneId?: string | null | undefined; nameServers?: Array | null | undefined; status: DomainWithUsageStatus; error?: any | null | undefined; createdAt: Date; updatedAt: Date; verifiedAt?: Date | null | undefined; endpoints: Array; usage: DomainWithUsageUsage; }; /** @internal */ export const DomainWithUsageStatus$inboundSchema: z.ZodEnum< typeof DomainWithUsageStatus > = z.enum(DomainWithUsageStatus); /** @internal */ export const DeploymentUrlProject$inboundSchema: z.ZodType< DeploymentUrlProject, unknown > = z.object({ id: z.string(), name: z.string(), }); export function deploymentUrlProjectFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DeploymentUrlProject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DeploymentUrlProject' from JSON`, ); } /** @internal */ export const PortalBinding$inboundSchema: z.ZodType = z .object({ id: z.string(), projectId: z.nullable(z.string()), projectName: z.nullable(z.string()), hostname: z.string(), }); export function portalBindingFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PortalBinding$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PortalBinding' from JSON`, ); } /** @internal */ export const PackageDomain$inboundSchema: z.ZodType = z .object({ id: z.string(), hostname: z.string(), }); export function packageDomainFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PackageDomain$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PackageDomain' from JSON`, ); } /** @internal */ export const ManagerBinding$inboundSchema: z.ZodType = z.object({ id: z.string(), managerId: z.string(), managerName: z.string(), hostname: z.string(), }); export function managerBindingFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ManagerBinding$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ManagerBinding' from JSON`, ); } /** @internal */ export const DomainWithUsageUsage$inboundSchema: z.ZodType< DomainWithUsageUsage, unknown > = z.object({ deploymentUrlProjects: z.array( z.lazy(() => DeploymentUrlProject$inboundSchema), ), portalBindings: z.array(z.lazy(() => PortalBinding$inboundSchema)), packageDomains: z.array(z.lazy(() => PackageDomain$inboundSchema)), managerBindings: z.array(z.lazy(() => ManagerBinding$inboundSchema)), }); export function domainWithUsageUsageFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DomainWithUsageUsage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DomainWithUsageUsage' from JSON`, ); } /** @internal */ export const DomainWithUsage$inboundSchema: z.ZodType< DomainWithUsage, unknown > = z.object({ id: z.string(), workspaceId: z.string(), domain: z.string(), isSystem: z.boolean(), claimToken: z.string(), hostedZoneId: z.nullable(z.string()).optional(), nameServers: z.nullable(z.array(z.string())).optional(), status: DomainWithUsageStatus$inboundSchema, error: z.nullable(z.any()).optional(), createdAt: z.iso.datetime({ offset: true }).transform(v => new Date(v)), updatedAt: z.iso.datetime({ offset: true }).transform(v => new Date(v)), verifiedAt: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ).optional(), endpoints: z.array(z.nullable(DomainEndpoint$inboundSchema)), usage: z.lazy(() => DomainWithUsageUsage$inboundSchema), }); export function domainWithUsageFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DomainWithUsage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DomainWithUsage' from JSON`, ); }