@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>
135 lines (123 loc) • 3.46 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 GetRouteVersionsRequest = {
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;
};
/**
* A version of routing rules stored in S3.
*/
export type GetRouteVersionsVersions = {
/**
* Unique identifier for the version.
*/
id: string;
/**
* The S3 key where the routing rules are stored.
*/
s3Key: string;
/**
* Timestamp of when this version was last modified.
*/
lastModified: number;
/**
* The user who created this version.
*/
createdBy: string;
/**
* Whether this version is staged and not yet promoted to production.
*/
isStaging?: boolean | undefined;
/**
* Whether this version is currently live in production.
*/
isLive?: boolean | undefined;
/**
* The number of routing rules in this version.
*/
ruleCount?: number | undefined;
/**
* The staging alias for previewing this version.
*/
alias?: string | undefined;
};
export type GetRouteVersionsResponseBody = {
versions: Array<GetRouteVersionsVersions>;
};
/** @internal */
export type GetRouteVersionsRequest$Outbound = {
projectId: string;
teamId?: string | undefined;
slug?: string | undefined;
};
/** @internal */
export const GetRouteVersionsRequest$outboundSchema: z.ZodType<
GetRouteVersionsRequest$Outbound,
z.ZodTypeDef,
GetRouteVersionsRequest
> = z.object({
projectId: z.string(),
teamId: z.string().optional(),
slug: z.string().optional(),
});
export function getRouteVersionsRequestToJSON(
getRouteVersionsRequest: GetRouteVersionsRequest,
): string {
return JSON.stringify(
GetRouteVersionsRequest$outboundSchema.parse(getRouteVersionsRequest),
);
}
/** @internal */
export const GetRouteVersionsVersions$inboundSchema: z.ZodType<
GetRouteVersionsVersions,
z.ZodTypeDef,
unknown
> = z.object({
id: types.string(),
s3Key: types.string(),
lastModified: types.number(),
createdBy: types.string(),
isStaging: types.optional(types.boolean()),
isLive: types.optional(types.boolean()),
ruleCount: types.optional(types.number()),
alias: types.optional(types.string()),
});
export function getRouteVersionsVersionsFromJSON(
jsonString: string,
): SafeParseResult<GetRouteVersionsVersions, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetRouteVersionsVersions$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetRouteVersionsVersions' from JSON`,
);
}
/** @internal */
export const GetRouteVersionsResponseBody$inboundSchema: z.ZodType<
GetRouteVersionsResponseBody,
z.ZodTypeDef,
unknown
> = z.object({
versions: z.array(z.lazy(() => GetRouteVersionsVersions$inboundSchema)),
});
export function getRouteVersionsResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<GetRouteVersionsResponseBody, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetRouteVersionsResponseBody$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetRouteVersionsResponseBody' from JSON`,
);
}