@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>
131 lines (119 loc) • 3.35 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 { SDKValidationError } from "./sdkvalidationerror.js";
export type GetVersionsRequest = {
projectId: 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;
};
export type Versions = {
/**
* The unique identifier for the version.
*/
id: string;
/**
* The key of the version. The key may be duplicated across versions if the contents are the same as a different version.
*/
key: string;
lastModified: number;
createdBy: string;
/**
* Optional name for the version. If not provided, defaults to an ISO timestamp string.
*/
name?: string | undefined;
/**
* Whether this version has not been promoted to production yet and is not serving end users.
*/
isStaging?: boolean | undefined;
/**
* Whether this version is currently live in production.
*/
isLive?: boolean | undefined;
/**
* The number of redirects in this version.
*/
redirectCount?: number | undefined;
/**
* The staging link for previewing redirects in this version.
*/
alias?: string | undefined;
};
export type GetVersionsResponseBody = {
versions: Array<Versions>;
};
/** @internal */
export type GetVersionsRequest$Outbound = {
projectId: string;
teamId?: string | undefined;
slug?: string | undefined;
};
/** @internal */
export const GetVersionsRequest$outboundSchema: z.ZodType<
GetVersionsRequest$Outbound,
z.ZodTypeDef,
GetVersionsRequest
> = z.object({
projectId: z.string(),
teamId: z.string().optional(),
slug: z.string().optional(),
});
export function getVersionsRequestToJSON(
getVersionsRequest: GetVersionsRequest,
): string {
return JSON.stringify(
GetVersionsRequest$outboundSchema.parse(getVersionsRequest),
);
}
/** @internal */
export const Versions$inboundSchema: z.ZodType<
Versions,
z.ZodTypeDef,
unknown
> = z.object({
id: types.string(),
key: types.string(),
lastModified: types.number(),
createdBy: types.string(),
name: types.optional(types.string()),
isStaging: types.optional(types.boolean()),
isLive: types.optional(types.boolean()),
redirectCount: types.optional(types.number()),
alias: types.optional(types.string()),
});
export function versionsFromJSON(
jsonString: string,
): SafeParseResult<Versions, SDKValidationError> {
return safeParse(
jsonString,
(x) => Versions$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Versions' from JSON`,
);
}
/** @internal */
export const GetVersionsResponseBody$inboundSchema: z.ZodType<
GetVersionsResponseBody,
z.ZodTypeDef,
unknown
> = z.object({
versions: z.array(z.lazy(() => Versions$inboundSchema)),
});
export function getVersionsResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<GetVersionsResponseBody, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetVersionsResponseBody$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetVersionsResponseBody' from JSON`,
);
}