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>

318 lines (289 loc) 9.04 kB
/* * 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 ListDeploymentAliasesRequest = { /** * The ID of the deployment the aliases should be listed for */ id: 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; }; /** * The protection bypass for the alias */ export type ListDeploymentAliasesProtectionBypass4 = { createdAt: number; lastUpdatedAt: number; lastUpdatedBy: string; scope: "email_invite"; }; /** * The protection bypass for the alias */ export type ListDeploymentAliasesProtectionBypass3 = { createdAt: number; createdBy: string; scope: "alias-protection-override"; }; export const ListDeploymentAliasesProtectionBypassAccess = { Granted: "granted", Requested: "requested", } as const; export type ListDeploymentAliasesProtectionBypassAccess = ClosedEnum< typeof ListDeploymentAliasesProtectionBypassAccess >; /** * The protection bypass for the alias */ export type ListDeploymentAliasesProtectionBypass2 = { createdAt: number; lastUpdatedAt: number; lastUpdatedBy: string; access: ListDeploymentAliasesProtectionBypassAccess; scope: "user"; }; /** * The protection bypass for the alias */ export type ListDeploymentAliasesProtectionBypass1 = { createdAt: number; createdBy: string; scope: "shareable-link"; expires?: number | undefined; }; export type ListDeploymentAliasesProtectionBypass = | ListDeploymentAliasesProtectionBypass1 | ListDeploymentAliasesProtectionBypass2 | ListDeploymentAliasesProtectionBypass3 | ListDeploymentAliasesProtectionBypass4; /** * A list of the aliases assigned to the deployment */ export type Aliases = { /** * The unique identifier of the alias */ uid: string; /** * The alias name, it could be a `.vercel.app` subdomain or a custom domain */ alias: string; /** * The date when the alias was created */ created: Date; /** * Target destination domain for redirect when the alias is a redirect */ redirect?: string | null | undefined; /** * The protection bypass for the alias */ protectionBypass?: { [k: string]: | ListDeploymentAliasesProtectionBypass1 | ListDeploymentAliasesProtectionBypass2 | ListDeploymentAliasesProtectionBypass3 | ListDeploymentAliasesProtectionBypass4; } | undefined; }; /** * The list of aliases assigned to the deployment */ export type ListDeploymentAliasesResponseBody = { /** * A list of the aliases assigned to the deployment */ aliases: Array<Aliases>; }; /** @internal */ export type ListDeploymentAliasesRequest$Outbound = { id: string; teamId?: string | undefined; slug?: string | undefined; }; /** @internal */ export const ListDeploymentAliasesRequest$outboundSchema: z.ZodType< ListDeploymentAliasesRequest$Outbound, z.ZodTypeDef, ListDeploymentAliasesRequest > = z.object({ id: z.string(), teamId: z.string().optional(), slug: z.string().optional(), }); export function listDeploymentAliasesRequestToJSON( listDeploymentAliasesRequest: ListDeploymentAliasesRequest, ): string { return JSON.stringify( ListDeploymentAliasesRequest$outboundSchema.parse( listDeploymentAliasesRequest, ), ); } /** @internal */ export const ListDeploymentAliasesProtectionBypass4$inboundSchema: z.ZodType< ListDeploymentAliasesProtectionBypass4, z.ZodTypeDef, unknown > = z.object({ createdAt: types.number(), lastUpdatedAt: types.number(), lastUpdatedBy: types.string(), scope: types.literal("email_invite"), }); export function listDeploymentAliasesProtectionBypass4FromJSON( jsonString: string, ): SafeParseResult<ListDeploymentAliasesProtectionBypass4, SDKValidationError> { return safeParse( jsonString, (x) => ListDeploymentAliasesProtectionBypass4$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListDeploymentAliasesProtectionBypass4' from JSON`, ); } /** @internal */ export const ListDeploymentAliasesProtectionBypass3$inboundSchema: z.ZodType< ListDeploymentAliasesProtectionBypass3, z.ZodTypeDef, unknown > = z.object({ createdAt: types.number(), createdBy: types.string(), scope: types.literal("alias-protection-override"), }); export function listDeploymentAliasesProtectionBypass3FromJSON( jsonString: string, ): SafeParseResult<ListDeploymentAliasesProtectionBypass3, SDKValidationError> { return safeParse( jsonString, (x) => ListDeploymentAliasesProtectionBypass3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListDeploymentAliasesProtectionBypass3' from JSON`, ); } /** @internal */ export const ListDeploymentAliasesProtectionBypassAccess$inboundSchema: z.ZodNativeEnum<typeof ListDeploymentAliasesProtectionBypassAccess> = z .nativeEnum(ListDeploymentAliasesProtectionBypassAccess); /** @internal */ export const ListDeploymentAliasesProtectionBypass2$inboundSchema: z.ZodType< ListDeploymentAliasesProtectionBypass2, z.ZodTypeDef, unknown > = z.object({ createdAt: types.number(), lastUpdatedAt: types.number(), lastUpdatedBy: types.string(), access: ListDeploymentAliasesProtectionBypassAccess$inboundSchema, scope: types.literal("user"), }); export function listDeploymentAliasesProtectionBypass2FromJSON( jsonString: string, ): SafeParseResult<ListDeploymentAliasesProtectionBypass2, SDKValidationError> { return safeParse( jsonString, (x) => ListDeploymentAliasesProtectionBypass2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListDeploymentAliasesProtectionBypass2' from JSON`, ); } /** @internal */ export const ListDeploymentAliasesProtectionBypass1$inboundSchema: z.ZodType< ListDeploymentAliasesProtectionBypass1, z.ZodTypeDef, unknown > = z.object({ createdAt: types.number(), createdBy: types.string(), scope: types.literal("shareable-link"), expires: types.optional(types.number()), }); export function listDeploymentAliasesProtectionBypass1FromJSON( jsonString: string, ): SafeParseResult<ListDeploymentAliasesProtectionBypass1, SDKValidationError> { return safeParse( jsonString, (x) => ListDeploymentAliasesProtectionBypass1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListDeploymentAliasesProtectionBypass1' from JSON`, ); } /** @internal */ export const ListDeploymentAliasesProtectionBypass$inboundSchema: z.ZodType< ListDeploymentAliasesProtectionBypass, z.ZodTypeDef, unknown > = z.union([ z.lazy(() => ListDeploymentAliasesProtectionBypass1$inboundSchema), z.lazy(() => ListDeploymentAliasesProtectionBypass2$inboundSchema), z.lazy(() => ListDeploymentAliasesProtectionBypass3$inboundSchema), z.lazy(() => ListDeploymentAliasesProtectionBypass4$inboundSchema), ]); export function listDeploymentAliasesProtectionBypassFromJSON( jsonString: string, ): SafeParseResult<ListDeploymentAliasesProtectionBypass, SDKValidationError> { return safeParse( jsonString, (x) => ListDeploymentAliasesProtectionBypass$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListDeploymentAliasesProtectionBypass' from JSON`, ); } /** @internal */ export const Aliases$inboundSchema: z.ZodType<Aliases, z.ZodTypeDef, unknown> = z.object({ uid: types.string(), alias: types.string(), created: types.date(), redirect: z.nullable(types.string()).optional(), protectionBypass: types.optional( z.record(z.union([ z.lazy(() => ListDeploymentAliasesProtectionBypass1$inboundSchema), z.lazy(() => ListDeploymentAliasesProtectionBypass2$inboundSchema ), z.lazy(() => ListDeploymentAliasesProtectionBypass3$inboundSchema), z.lazy(() => ListDeploymentAliasesProtectionBypass4$inboundSchema), ])), ), }); export function aliasesFromJSON( jsonString: string, ): SafeParseResult<Aliases, SDKValidationError> { return safeParse( jsonString, (x) => Aliases$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Aliases' from JSON`, ); } /** @internal */ export const ListDeploymentAliasesResponseBody$inboundSchema: z.ZodType< ListDeploymentAliasesResponseBody, z.ZodTypeDef, unknown > = z.object({ aliases: z.array(z.lazy(() => Aliases$inboundSchema)), }); export function listDeploymentAliasesResponseBodyFromJSON( jsonString: string, ): SafeParseResult<ListDeploymentAliasesResponseBody, SDKValidationError> { return safeParse( jsonString, (x) => ListDeploymentAliasesResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListDeploymentAliasesResponseBody' from JSON`, ); }