@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>
188 lines (173 loc) • 6.04 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 { Result as SafeParseResult } from "../types/fp.js";
import * as types from "../types/primitives.js";
import { Pagination, Pagination$inboundSchema } from "./pagination.js";
import { SDKValidationError } from "./sdkvalidationerror.js";
export type GetDomainProjectDomainsRequest = {
/**
* The apex domain name.
*/
domain: string;
/**
* Maximum number of project domains to list from a request.
*/
limit?: number | undefined;
/**
* Get project domains created after this JavaScript timestamp.
*/
since?: number | undefined;
/**
* Get project domains created before this JavaScript timestamp.
*/
until?: number | 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;
};
/**
* 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 GetDomainProjectDomainsVerification = {
type: string;
domain: string;
value: string;
reason: string;
};
export type ProjectDomains = {
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<GetDomainProjectDomainsVerification> | undefined;
};
/**
* Successful response retrieving project domains for an apex domain.
*/
export type GetDomainProjectDomainsResponseBody = {
projectDomains: Array<ProjectDomains>;
/**
* This object contains information related to the pagination of the current request, including the necessary parameters to get the next or previous page of data.
*/
pagination: Pagination;
};
/** @internal */
export type GetDomainProjectDomainsRequest$Outbound = {
domain: string;
limit?: number | undefined;
since?: number | undefined;
until?: number | undefined;
teamId?: string | undefined;
slug?: string | undefined;
};
/** @internal */
export const GetDomainProjectDomainsRequest$outboundSchema: z.ZodType<
GetDomainProjectDomainsRequest$Outbound,
z.ZodTypeDef,
GetDomainProjectDomainsRequest
> = z.object({
domain: z.string(),
limit: z.number().optional(),
since: z.number().optional(),
until: z.number().optional(),
teamId: z.string().optional(),
slug: z.string().optional(),
});
export function getDomainProjectDomainsRequestToJSON(
getDomainProjectDomainsRequest: GetDomainProjectDomainsRequest,
): string {
return JSON.stringify(
GetDomainProjectDomainsRequest$outboundSchema.parse(
getDomainProjectDomainsRequest,
),
);
}
/** @internal */
export const GetDomainProjectDomainsVerification$inboundSchema: z.ZodType<
GetDomainProjectDomainsVerification,
z.ZodTypeDef,
unknown
> = z.object({
type: types.string(),
domain: types.string(),
value: types.string(),
reason: types.string(),
});
export function getDomainProjectDomainsVerificationFromJSON(
jsonString: string,
): SafeParseResult<GetDomainProjectDomainsVerification, SDKValidationError> {
return safeParse(
jsonString,
(x) =>
GetDomainProjectDomainsVerification$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetDomainProjectDomainsVerification' from JSON`,
);
}
/** @internal */
export const ProjectDomains$inboundSchema: z.ZodType<
ProjectDomains,
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(() => GetDomainProjectDomainsVerification$inboundSchema)),
),
});
export function projectDomainsFromJSON(
jsonString: string,
): SafeParseResult<ProjectDomains, SDKValidationError> {
return safeParse(
jsonString,
(x) => ProjectDomains$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ProjectDomains' from JSON`,
);
}
/** @internal */
export const GetDomainProjectDomainsResponseBody$inboundSchema: z.ZodType<
GetDomainProjectDomainsResponseBody,
z.ZodTypeDef,
unknown
> = z.object({
projectDomains: z.array(z.lazy(() => ProjectDomains$inboundSchema)),
pagination: Pagination$inboundSchema,
});
export function getDomainProjectDomainsResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<GetDomainProjectDomainsResponseBody, SDKValidationError> {
return safeParse(
jsonString,
(x) =>
GetDomainProjectDomainsResponseBody$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetDomainProjectDomainsResponseBody' from JSON`,
);
}