@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>
396 lines (368 loc) • 11.9 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";
export type GetProjectsByIdOrNameCustomEnvironmentsRequest = {
/**
* The unique project identifier or the project name
*/
idOrName: string;
/**
* Fetch custom environments for a specific git branch
*/
gitBranch?: string | 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;
};
/**
* The maximum number of custom environments allowed either by the team's plan type or a custom override.
*/
export type AccountLimit = {
total: number;
};
/**
* The type of environment (production, preview, or development)
*/
export const GetProjectsByIdOrNameCustomEnvironmentsType = {
Development: "development",
Preview: "preview",
Production: "production",
} as const;
/**
* The type of environment (production, preview, or development)
*/
export type GetProjectsByIdOrNameCustomEnvironmentsType = ClosedEnum<
typeof GetProjectsByIdOrNameCustomEnvironmentsType
>;
/**
* 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 GetProjectsByIdOrNameCustomEnvironmentsVerification = {
type: string;
domain: string;
value: string;
reason: string;
};
/**
* List of domains associated with this environment
*/
export type GetProjectsByIdOrNameCustomEnvironmentsDomains = {
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<GetProjectsByIdOrNameCustomEnvironmentsVerification>
| undefined;
};
/**
* The type of matching to perform
*/
export const GetProjectsByIdOrNameCustomEnvironmentsEnvironmentType = {
EndsWith: "endsWith",
Equals: "equals",
StartsWith: "startsWith",
} as const;
/**
* The type of matching to perform
*/
export type GetProjectsByIdOrNameCustomEnvironmentsEnvironmentType = ClosedEnum<
typeof GetProjectsByIdOrNameCustomEnvironmentsEnvironmentType
>;
/**
* Configuration for matching git branches to this environment
*/
export type GetProjectsByIdOrNameCustomEnvironmentsBranchMatcher = {
/**
* The type of matching to perform
*/
type: GetProjectsByIdOrNameCustomEnvironmentsEnvironmentType;
/**
* The pattern to match against branch names
*/
pattern: string;
};
export type GetProjectsByIdOrNameCustomEnvironmentsEnvironments = {
/**
* The type of environment (production, preview, or development)
*/
type: GetProjectsByIdOrNameCustomEnvironmentsType;
/**
* Optional description of the environment's purpose
*/
description?: string | undefined;
/**
* Timestamp when the environment was created
*/
createdAt: number;
/**
* Timestamp when the environment was last updated
*/
updatedAt: number;
/**
* URL-friendly name of the environment
*/
slug: string;
/**
* Unique identifier for the custom environment (format: env_*)
*/
id: string;
/**
* List of domains associated with this environment
*/
domains?: Array<GetProjectsByIdOrNameCustomEnvironmentsDomains> | undefined;
/**
* Configuration for matching git branches to this environment
*/
branchMatcher?:
| GetProjectsByIdOrNameCustomEnvironmentsBranchMatcher
| undefined;
/**
* List of aliases for the current deployment
*/
currentDeploymentAliases?: Array<string> | undefined;
};
export type GetProjectsByIdOrNameCustomEnvironmentsResponseBody = {
/**
* The maximum number of custom environments allowed either by the team's plan type or a custom override.
*/
accountLimit: AccountLimit;
environments: Array<GetProjectsByIdOrNameCustomEnvironmentsEnvironments>;
};
/** @internal */
export type GetProjectsByIdOrNameCustomEnvironmentsRequest$Outbound = {
idOrName: string;
gitBranch?: string | undefined;
teamId?: string | undefined;
slug?: string | undefined;
};
/** @internal */
export const GetProjectsByIdOrNameCustomEnvironmentsRequest$outboundSchema:
z.ZodType<
GetProjectsByIdOrNameCustomEnvironmentsRequest$Outbound,
z.ZodTypeDef,
GetProjectsByIdOrNameCustomEnvironmentsRequest
> = z.object({
idOrName: z.string(),
gitBranch: z.string().optional(),
teamId: z.string().optional(),
slug: z.string().optional(),
});
export function getProjectsByIdOrNameCustomEnvironmentsRequestToJSON(
getProjectsByIdOrNameCustomEnvironmentsRequest:
GetProjectsByIdOrNameCustomEnvironmentsRequest,
): string {
return JSON.stringify(
GetProjectsByIdOrNameCustomEnvironmentsRequest$outboundSchema.parse(
getProjectsByIdOrNameCustomEnvironmentsRequest,
),
);
}
/** @internal */
export const AccountLimit$inboundSchema: z.ZodType<
AccountLimit,
z.ZodTypeDef,
unknown
> = z.object({
total: types.number(),
});
export function accountLimitFromJSON(
jsonString: string,
): SafeParseResult<AccountLimit, SDKValidationError> {
return safeParse(
jsonString,
(x) => AccountLimit$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AccountLimit' from JSON`,
);
}
/** @internal */
export const GetProjectsByIdOrNameCustomEnvironmentsType$inboundSchema:
z.ZodNativeEnum<typeof GetProjectsByIdOrNameCustomEnvironmentsType> = z
.nativeEnum(GetProjectsByIdOrNameCustomEnvironmentsType);
/** @internal */
export const GetProjectsByIdOrNameCustomEnvironmentsVerification$inboundSchema:
z.ZodType<
GetProjectsByIdOrNameCustomEnvironmentsVerification,
z.ZodTypeDef,
unknown
> = z.object({
type: types.string(),
domain: types.string(),
value: types.string(),
reason: types.string(),
});
export function getProjectsByIdOrNameCustomEnvironmentsVerificationFromJSON(
jsonString: string,
): SafeParseResult<
GetProjectsByIdOrNameCustomEnvironmentsVerification,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
GetProjectsByIdOrNameCustomEnvironmentsVerification$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'GetProjectsByIdOrNameCustomEnvironmentsVerification' from JSON`,
);
}
/** @internal */
export const GetProjectsByIdOrNameCustomEnvironmentsDomains$inboundSchema:
z.ZodType<
GetProjectsByIdOrNameCustomEnvironmentsDomains,
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(() =>
GetProjectsByIdOrNameCustomEnvironmentsVerification$inboundSchema
)),
),
});
export function getProjectsByIdOrNameCustomEnvironmentsDomainsFromJSON(
jsonString: string,
): SafeParseResult<
GetProjectsByIdOrNameCustomEnvironmentsDomains,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
GetProjectsByIdOrNameCustomEnvironmentsDomains$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'GetProjectsByIdOrNameCustomEnvironmentsDomains' from JSON`,
);
}
/** @internal */
export const GetProjectsByIdOrNameCustomEnvironmentsEnvironmentType$inboundSchema:
z.ZodNativeEnum<
typeof GetProjectsByIdOrNameCustomEnvironmentsEnvironmentType
> = z.nativeEnum(GetProjectsByIdOrNameCustomEnvironmentsEnvironmentType);
/** @internal */
export const GetProjectsByIdOrNameCustomEnvironmentsBranchMatcher$inboundSchema:
z.ZodType<
GetProjectsByIdOrNameCustomEnvironmentsBranchMatcher,
z.ZodTypeDef,
unknown
> = z.object({
type: GetProjectsByIdOrNameCustomEnvironmentsEnvironmentType$inboundSchema,
pattern: types.string(),
});
export function getProjectsByIdOrNameCustomEnvironmentsBranchMatcherFromJSON(
jsonString: string,
): SafeParseResult<
GetProjectsByIdOrNameCustomEnvironmentsBranchMatcher,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
GetProjectsByIdOrNameCustomEnvironmentsBranchMatcher$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'GetProjectsByIdOrNameCustomEnvironmentsBranchMatcher' from JSON`,
);
}
/** @internal */
export const GetProjectsByIdOrNameCustomEnvironmentsEnvironments$inboundSchema:
z.ZodType<
GetProjectsByIdOrNameCustomEnvironmentsEnvironments,
z.ZodTypeDef,
unknown
> = z.object({
type: GetProjectsByIdOrNameCustomEnvironmentsType$inboundSchema,
description: types.optional(types.string()),
createdAt: types.number(),
updatedAt: types.number(),
slug: types.string(),
id: types.string(),
domains: types.optional(
z.array(z.lazy(() =>
GetProjectsByIdOrNameCustomEnvironmentsDomains$inboundSchema
)),
),
branchMatcher: types.optional(
z.lazy(() =>
GetProjectsByIdOrNameCustomEnvironmentsBranchMatcher$inboundSchema
),
),
currentDeploymentAliases: types.optional(z.array(types.string())),
});
export function getProjectsByIdOrNameCustomEnvironmentsEnvironmentsFromJSON(
jsonString: string,
): SafeParseResult<
GetProjectsByIdOrNameCustomEnvironmentsEnvironments,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
GetProjectsByIdOrNameCustomEnvironmentsEnvironments$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'GetProjectsByIdOrNameCustomEnvironmentsEnvironments' from JSON`,
);
}
/** @internal */
export const GetProjectsByIdOrNameCustomEnvironmentsResponseBody$inboundSchema:
z.ZodType<
GetProjectsByIdOrNameCustomEnvironmentsResponseBody,
z.ZodTypeDef,
unknown
> = z.object({
accountLimit: z.lazy(() => AccountLimit$inboundSchema),
environments: z.array(
z.lazy(() =>
GetProjectsByIdOrNameCustomEnvironmentsEnvironments$inboundSchema
),
),
});
export function getProjectsByIdOrNameCustomEnvironmentsResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<
GetProjectsByIdOrNameCustomEnvironmentsResponseBody,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
GetProjectsByIdOrNameCustomEnvironmentsResponseBody$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'GetProjectsByIdOrNameCustomEnvironmentsResponseBody' from JSON`,
);
}