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>

177 lines (161 loc) 4.43 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../lib/primitives.js"; 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 DeleteRoutesRequestBody = { /** * The IDs of the routes to delete */ routeIds: Array<string>; }; export type DeleteRoutesRequest = { 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; requestBody?: DeleteRoutesRequestBody | undefined; }; /** * A version of routing rules stored in S3. */ export type DeleteRoutesVersion = { /** * 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 DeleteRoutesResponseBody = { deletedCount: number; /** * A version of routing rules stored in S3. */ version: DeleteRoutesVersion; }; /** @internal */ export type DeleteRoutesRequestBody$Outbound = { routeIds: Array<string>; }; /** @internal */ export const DeleteRoutesRequestBody$outboundSchema: z.ZodType< DeleteRoutesRequestBody$Outbound, z.ZodTypeDef, DeleteRoutesRequestBody > = z.object({ routeIds: z.array(z.string()), }); export function deleteRoutesRequestBodyToJSON( deleteRoutesRequestBody: DeleteRoutesRequestBody, ): string { return JSON.stringify( DeleteRoutesRequestBody$outboundSchema.parse(deleteRoutesRequestBody), ); } /** @internal */ export type DeleteRoutesRequest$Outbound = { projectId: string; teamId?: string | undefined; slug?: string | undefined; RequestBody?: DeleteRoutesRequestBody$Outbound | undefined; }; /** @internal */ export const DeleteRoutesRequest$outboundSchema: z.ZodType< DeleteRoutesRequest$Outbound, z.ZodTypeDef, DeleteRoutesRequest > = z.object({ projectId: z.string(), teamId: z.string().optional(), slug: z.string().optional(), requestBody: z.lazy(() => DeleteRoutesRequestBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { requestBody: "RequestBody", }); }); export function deleteRoutesRequestToJSON( deleteRoutesRequest: DeleteRoutesRequest, ): string { return JSON.stringify( DeleteRoutesRequest$outboundSchema.parse(deleteRoutesRequest), ); } /** @internal */ export const DeleteRoutesVersion$inboundSchema: z.ZodType< DeleteRoutesVersion, 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 deleteRoutesVersionFromJSON( jsonString: string, ): SafeParseResult<DeleteRoutesVersion, SDKValidationError> { return safeParse( jsonString, (x) => DeleteRoutesVersion$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DeleteRoutesVersion' from JSON`, ); } /** @internal */ export const DeleteRoutesResponseBody$inboundSchema: z.ZodType< DeleteRoutesResponseBody, z.ZodTypeDef, unknown > = z.object({ deletedCount: types.number(), version: z.lazy(() => DeleteRoutesVersion$inboundSchema), }); export function deleteRoutesResponseBodyFromJSON( jsonString: string, ): SafeParseResult<DeleteRoutesResponseBody, SDKValidationError> { return safeParse( jsonString, (x) => DeleteRoutesResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DeleteRoutesResponseBody' from JSON`, ); }