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>

173 lines (153 loc) 4.67 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 GetEdgeConfigsRequest = { /** * 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; }; /** * Keeps track of the current state of the Edge Config while it gets transferred. */ export type Transfer = { fromAccountId: string; startedAt: number; doneAt: number | null; }; export type Schema = {}; export const GetEdgeConfigsType = { Flags: "flags", } as const; export type GetEdgeConfigsType = ClosedEnum<typeof GetEdgeConfigsType>; export type Purpose = { type: GetEdgeConfigsType; projectId: string; }; export type GetEdgeConfigsResponseBody = { id?: string | undefined; createdAt?: number | undefined; ownerId?: string | undefined; /** * Name for the Edge Config Names are not unique. Must start with an alphabetic character and can contain only alphanumeric characters and underscores). */ slug?: string | undefined; updatedAt?: number | undefined; digest?: string | undefined; /** * Keeps track of the current state of the Edge Config while it gets transferred. */ transfer?: Transfer | undefined; schema?: Schema | undefined; purpose?: Purpose | undefined; sizeInBytes: number; itemCount: number; }; /** @internal */ export type GetEdgeConfigsRequest$Outbound = { teamId?: string | undefined; slug?: string | undefined; }; /** @internal */ export const GetEdgeConfigsRequest$outboundSchema: z.ZodType< GetEdgeConfigsRequest$Outbound, z.ZodTypeDef, GetEdgeConfigsRequest > = z.object({ teamId: z.string().optional(), slug: z.string().optional(), }); export function getEdgeConfigsRequestToJSON( getEdgeConfigsRequest: GetEdgeConfigsRequest, ): string { return JSON.stringify( GetEdgeConfigsRequest$outboundSchema.parse(getEdgeConfigsRequest), ); } /** @internal */ export const Transfer$inboundSchema: z.ZodType< Transfer, z.ZodTypeDef, unknown > = z.object({ fromAccountId: types.string(), startedAt: types.number(), doneAt: types.nullable(types.number()), }); export function transferFromJSON( jsonString: string, ): SafeParseResult<Transfer, SDKValidationError> { return safeParse( jsonString, (x) => Transfer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Transfer' from JSON`, ); } /** @internal */ export const Schema$inboundSchema: z.ZodType<Schema, z.ZodTypeDef, unknown> = z .object({}); export function schemaFromJSON( jsonString: string, ): SafeParseResult<Schema, SDKValidationError> { return safeParse( jsonString, (x) => Schema$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Schema' from JSON`, ); } /** @internal */ export const GetEdgeConfigsType$inboundSchema: z.ZodNativeEnum< typeof GetEdgeConfigsType > = z.nativeEnum(GetEdgeConfigsType); /** @internal */ export const Purpose$inboundSchema: z.ZodType<Purpose, z.ZodTypeDef, unknown> = z.object({ type: GetEdgeConfigsType$inboundSchema, projectId: types.string(), }); export function purposeFromJSON( jsonString: string, ): SafeParseResult<Purpose, SDKValidationError> { return safeParse( jsonString, (x) => Purpose$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Purpose' from JSON`, ); } /** @internal */ export const GetEdgeConfigsResponseBody$inboundSchema: z.ZodType< GetEdgeConfigsResponseBody, z.ZodTypeDef, unknown > = z.object({ id: types.optional(types.string()), createdAt: types.optional(types.number()), ownerId: types.optional(types.string()), slug: types.optional(types.string()), updatedAt: types.optional(types.number()), digest: types.optional(types.string()), transfer: types.optional(z.lazy(() => Transfer$inboundSchema)), schema: types.optional(z.lazy(() => Schema$inboundSchema)), purpose: types.optional(z.lazy(() => Purpose$inboundSchema)), sizeInBytes: types.number(), itemCount: types.number(), }); export function getEdgeConfigsResponseBodyFromJSON( jsonString: string, ): SafeParseResult<GetEdgeConfigsResponseBody, SDKValidationError> { return safeParse( jsonString, (x) => GetEdgeConfigsResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetEdgeConfigsResponseBody' from JSON`, ); }