UNPKG

@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>

224 lines (206 loc) 6.91 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; 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 * as types from "../types/primitives.js"; import { SDKValidationError } from "./sdkvalidationerror.js"; /** * Status code for domain redirect */ export const AddProjectDomainRedirectStatusCode = { ThreeHundredAndOne: 301, ThreeHundredAndTwo: 302, ThreeHundredAndSeven: 307, ThreeHundredAndEight: 308, } as const; /** * Status code for domain redirect */ export type AddProjectDomainRedirectStatusCode = ClosedEnum< typeof AddProjectDomainRedirectStatusCode >; export type AddProjectDomainRequestBody = { /** * The project domain name */ name: string; /** * Git branch to link the project domain */ gitBranch?: string | null | undefined; /** * The unique custom environment identifier within the project */ customEnvironmentId?: string | undefined; /** * Target destination domain for redirect */ redirect?: string | null | undefined; /** * Status code for domain redirect */ redirectStatusCode?: AddProjectDomainRedirectStatusCode | null | undefined; }; export type AddProjectDomainRequest = { /** * The unique project identifier or the project name */ idOrName: string; /** * 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; requestBody: AddProjectDomainRequestBody; }; /** * A list of verification challenges, one of which must be completed to verify the domain for use on the project. After the challenge is complete `POST /projects/:idOrName/domains/:domain/verify` to verify the domain. Possible challenges: - If `verification.type = TXT` the `verification.domain` will be checked for a TXT record matching `verification.value`. */ export type AddProjectDomainVerification = { type: string; domain: string; value: string; reason: string; }; /** * The domain was successfully added to the project */ export type AddProjectDomainResponseBody = { name: string; apexName: string; projectId: string; redirect?: string | null | undefined; redirectStatusCode?: number | null | undefined; gitBranch?: string | null | undefined; customEnvironmentId?: string | null | undefined; updatedAt?: number | undefined; createdAt?: number | undefined; /** * `true` if the domain is verified for use with the project. If `false` it will not be used as an alias on this project until the challenge in `verification` is completed. */ verified: boolean; /** * A list of verification challenges, one of which must be completed to verify the domain for use on the project. After the challenge is complete `POST /projects/:idOrName/domains/:domain/verify` to verify the domain. Possible challenges: - If `verification.type = TXT` the `verification.domain` will be checked for a TXT record matching `verification.value`. */ verification?: Array<AddProjectDomainVerification> | undefined; }; /** @internal */ export const AddProjectDomainRedirectStatusCode$outboundSchema: z.ZodNativeEnum< typeof AddProjectDomainRedirectStatusCode > = z.nativeEnum(AddProjectDomainRedirectStatusCode); /** @internal */ export type AddProjectDomainRequestBody$Outbound = { name: string; gitBranch?: string | null | undefined; customEnvironmentId?: string | undefined; redirect?: string | null | undefined; redirectStatusCode?: number | null | undefined; }; /** @internal */ export const AddProjectDomainRequestBody$outboundSchema: z.ZodType< AddProjectDomainRequestBody$Outbound, z.ZodTypeDef, AddProjectDomainRequestBody > = z.object({ name: z.string(), gitBranch: z.nullable(z.string()).optional(), customEnvironmentId: z.string().optional(), redirect: z.nullable(z.string()).optional(), redirectStatusCode: z.nullable( AddProjectDomainRedirectStatusCode$outboundSchema, ).optional(), }); export function addProjectDomainRequestBodyToJSON( addProjectDomainRequestBody: AddProjectDomainRequestBody, ): string { return JSON.stringify( AddProjectDomainRequestBody$outboundSchema.parse( addProjectDomainRequestBody, ), ); } /** @internal */ export type AddProjectDomainRequest$Outbound = { idOrName: string; teamId?: string | undefined; slug?: string | undefined; RequestBody: AddProjectDomainRequestBody$Outbound; }; /** @internal */ export const AddProjectDomainRequest$outboundSchema: z.ZodType< AddProjectDomainRequest$Outbound, z.ZodTypeDef, AddProjectDomainRequest > = z.object({ idOrName: z.string(), teamId: z.string().optional(), slug: z.string().optional(), requestBody: z.lazy(() => AddProjectDomainRequestBody$outboundSchema), }).transform((v) => { return remap$(v, { requestBody: "RequestBody", }); }); export function addProjectDomainRequestToJSON( addProjectDomainRequest: AddProjectDomainRequest, ): string { return JSON.stringify( AddProjectDomainRequest$outboundSchema.parse(addProjectDomainRequest), ); } /** @internal */ export const AddProjectDomainVerification$inboundSchema: z.ZodType< AddProjectDomainVerification, z.ZodTypeDef, unknown > = z.object({ type: types.string(), domain: types.string(), value: types.string(), reason: types.string(), }); export function addProjectDomainVerificationFromJSON( jsonString: string, ): SafeParseResult<AddProjectDomainVerification, SDKValidationError> { return safeParse( jsonString, (x) => AddProjectDomainVerification$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AddProjectDomainVerification' from JSON`, ); } /** @internal */ export const AddProjectDomainResponseBody$inboundSchema: z.ZodType< AddProjectDomainResponseBody, z.ZodTypeDef, unknown > = z.object({ name: types.string(), apexName: types.string(), projectId: types.string(), redirect: z.nullable(types.string()).optional(), redirectStatusCode: z.nullable(types.number()).optional(), gitBranch: z.nullable(types.string()).optional(), customEnvironmentId: z.nullable(types.string()).optional(), updatedAt: types.optional(types.number()), createdAt: types.optional(types.number()), verified: types.boolean(), verification: types.optional( z.array(z.lazy(() => AddProjectDomainVerification$inboundSchema)), ), }); export function addProjectDomainResponseBodyFromJSON( jsonString: string, ): SafeParseResult<AddProjectDomainResponseBody, SDKValidationError> { return safeParse( jsonString, (x) => AddProjectDomainResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AddProjectDomainResponseBody' from JSON`, ); }