@vercel/sdk
Version:
<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>
217 lines (196 loc) • 7.22 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { safeParse } from "../lib/schemas.js";
import { ClosedEnum } from "../types/enums.js";
import { Result as SafeParseResult } from "../types/fp.js";
import * as types from "../types/primitives.js";
import { SDKValidationError } from "./sdkvalidationerror.js";
/**
* When true, the response will only include the nameservers assigned directly to the specified domain. When false and there are no nameservers assigned directly to the specified domain, the response will include the nameservers of the domain's parent zone.
*/
export const Strict = {
True: "true",
False: "false",
} as const;
/**
* When true, the response will only include the nameservers assigned directly to the specified domain. When false and there are no nameservers assigned directly to the specified domain, the response will include the nameservers of the domain's parent zone.
*/
export type Strict = ClosedEnum<typeof Strict>;
export type GetDomainConfigRequest = {
/**
* The name of the domain.
*/
domain: string;
/**
* The project id or name that will be associated with the domain. Use this when the domain is not yet associated with a project.
*/
projectIdOrName?: string | undefined;
/**
* When true, the response will only include the nameservers assigned directly to the specified domain. When false and there are no nameservers assigned directly to the specified domain, the response will include the nameservers of the domain's parent zone.
*/
strict?: Strict | undefined;
/**
* The Team identifier to perform the request on behalf of.
*/
teamId?: string | undefined;
/**
* The Team slug to perform the request on behalf of.
*/
slug?: string | undefined;
};
/**
* How we see the domain's configuration. - `CNAME`: Domain has a CNAME pointing to Vercel. - `A`: Domain's A record is resolving to Vercel. - `http`: Domain is resolving to Vercel but may be behind a Proxy. - `dns-01`: Domain is not resolving to Vercel but dns-01 challenge is enabled. - `null`: Domain is not resolving to Vercel.
*/
export const ConfiguredBy = {
A: "A",
Cname: "CNAME",
Dns01: "dns-01",
Http: "http",
} as const;
/**
* How we see the domain's configuration. - `CNAME`: Domain has a CNAME pointing to Vercel. - `A`: Domain's A record is resolving to Vercel. - `http`: Domain is resolving to Vercel but may be behind a Proxy. - `dns-01`: Domain is not resolving to Vercel but dns-01 challenge is enabled. - `null`: Domain is not resolving to Vercel.
*/
export type ConfiguredBy = ClosedEnum<typeof ConfiguredBy>;
/**
* Which challenge types the domain can use for issuing certs.
*/
export const AcceptedChallenges = {
Dns01: "dns-01",
Http01: "http-01",
} as const;
/**
* Which challenge types the domain can use for issuing certs.
*/
export type AcceptedChallenges = ClosedEnum<typeof AcceptedChallenges>;
/**
* Recommended IPv4s for the domain. rank=1 is the preferred value(s) to use. Only using 1 ip value is acceptable.
*/
export type RecommendedIPv4 = {
rank: number;
value: Array<string>;
};
/**
* Recommended CNAMEs for the domain. rank=1 is the preferred value to use.
*/
export type RecommendedCNAME = {
rank: number;
value: string;
};
export type GetDomainConfigResponseBody = {
/**
* How we see the domain's configuration. - `CNAME`: Domain has a CNAME pointing to Vercel. - `A`: Domain's A record is resolving to Vercel. - `http`: Domain is resolving to Vercel but may be behind a Proxy. - `dns-01`: Domain is not resolving to Vercel but dns-01 challenge is enabled. - `null`: Domain is not resolving to Vercel.
*/
configuredBy: ConfiguredBy | null;
/**
* Which challenge types the domain can use for issuing certs.
*/
acceptedChallenges: Array<AcceptedChallenges>;
/**
* Recommended IPv4s for the domain. rank=1 is the preferred value(s) to use. Only using 1 ip value is acceptable.
*/
recommendedIPv4: Array<RecommendedIPv4>;
/**
* Recommended CNAMEs for the domain. rank=1 is the preferred value to use.
*/
recommendedCNAME: Array<RecommendedCNAME>;
/**
* Whether or not the domain is configured AND we can automatically generate a TLS certificate.
*/
misconfigured: boolean;
};
/** @internal */
export const Strict$outboundSchema: z.ZodNativeEnum<typeof Strict> = z
.nativeEnum(Strict);
/** @internal */
export type GetDomainConfigRequest$Outbound = {
domain: string;
projectIdOrName?: string | undefined;
strict?: string | undefined;
teamId?: string | undefined;
slug?: string | undefined;
};
/** @internal */
export const GetDomainConfigRequest$outboundSchema: z.ZodType<
GetDomainConfigRequest$Outbound,
z.ZodTypeDef,
GetDomainConfigRequest
> = z.object({
domain: z.string(),
projectIdOrName: z.string().optional(),
strict: Strict$outboundSchema.optional(),
teamId: z.string().optional(),
slug: z.string().optional(),
});
export function getDomainConfigRequestToJSON(
getDomainConfigRequest: GetDomainConfigRequest,
): string {
return JSON.stringify(
GetDomainConfigRequest$outboundSchema.parse(getDomainConfigRequest),
);
}
/** @internal */
export const ConfiguredBy$inboundSchema: z.ZodNativeEnum<typeof ConfiguredBy> =
z.nativeEnum(ConfiguredBy);
/** @internal */
export const AcceptedChallenges$inboundSchema: z.ZodNativeEnum<
typeof AcceptedChallenges
> = z.nativeEnum(AcceptedChallenges);
/** @internal */
export const RecommendedIPv4$inboundSchema: z.ZodType<
RecommendedIPv4,
z.ZodTypeDef,
unknown
> = z.object({
rank: types.number(),
value: z.array(types.string()),
});
export function recommendedIPv4FromJSON(
jsonString: string,
): SafeParseResult<RecommendedIPv4, SDKValidationError> {
return safeParse(
jsonString,
(x) => RecommendedIPv4$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'RecommendedIPv4' from JSON`,
);
}
/** @internal */
export const RecommendedCNAME$inboundSchema: z.ZodType<
RecommendedCNAME,
z.ZodTypeDef,
unknown
> = z.object({
rank: types.number(),
value: types.string(),
});
export function recommendedCNAMEFromJSON(
jsonString: string,
): SafeParseResult<RecommendedCNAME, SDKValidationError> {
return safeParse(
jsonString,
(x) => RecommendedCNAME$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'RecommendedCNAME' from JSON`,
);
}
/** @internal */
export const GetDomainConfigResponseBody$inboundSchema: z.ZodType<
GetDomainConfigResponseBody,
z.ZodTypeDef,
unknown
> = z.object({
configuredBy: types.nullable(ConfiguredBy$inboundSchema),
acceptedChallenges: z.array(AcceptedChallenges$inboundSchema),
recommendedIPv4: z.array(z.lazy(() => RecommendedIPv4$inboundSchema)),
recommendedCNAME: z.array(z.lazy(() => RecommendedCNAME$inboundSchema)),
misconfigured: types.boolean(),
});
export function getDomainConfigResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<GetDomainConfigResponseBody, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetDomainConfigResponseBody$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetDomainConfigResponseBody' from JSON`,
);
}