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>

409 lines (362 loc) 11.5 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 { 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 GetAllChecksRequest = { /** * The deployment to get all checks for */ deploymentId: 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 const GetAllChecksConclusion = { Canceled: "canceled", Failed: "failed", Neutral: "neutral", Skipped: "skipped", Stale: "stale", Succeeded: "succeeded", } as const; export type GetAllChecksConclusion = ClosedEnum<typeof GetAllChecksConclusion>; export const GetAllChecksSource = { WebVitals: "web-vitals", } as const; export type GetAllChecksSource = ClosedEnum<typeof GetAllChecksSource>; export type GetAllChecksFCP = { value: number | null; previousValue?: number | undefined; source: GetAllChecksSource; }; export const GetAllChecksChecksSource = { WebVitals: "web-vitals", } as const; export type GetAllChecksChecksSource = ClosedEnum< typeof GetAllChecksChecksSource >; export type GetAllChecksLCP = { value: number | null; previousValue?: number | undefined; source: GetAllChecksChecksSource; }; export const GetAllChecksChecksResponseSource = { WebVitals: "web-vitals", } as const; export type GetAllChecksChecksResponseSource = ClosedEnum< typeof GetAllChecksChecksResponseSource >; export type GetAllChecksCLS = { value: number | null; previousValue?: number | undefined; source: GetAllChecksChecksResponseSource; }; export const GetAllChecksChecksResponse200Source = { WebVitals: "web-vitals", } as const; export type GetAllChecksChecksResponse200Source = ClosedEnum< typeof GetAllChecksChecksResponse200Source >; export type GetAllChecksTBT = { value: number | null; previousValue?: number | undefined; source: GetAllChecksChecksResponse200Source; }; export const GetAllChecksChecksResponse200ApplicationJSONSource = { WebVitals: "web-vitals", } as const; export type GetAllChecksChecksResponse200ApplicationJSONSource = ClosedEnum< typeof GetAllChecksChecksResponse200ApplicationJSONSource >; export type GetAllChecksVirtualExperienceScore = { value: number | null; previousValue?: number | undefined; source: GetAllChecksChecksResponse200ApplicationJSONSource; }; export type GetAllChecksMetrics = { fcp: GetAllChecksFCP; lcp: GetAllChecksLCP; cls: GetAllChecksCLS; tbt: GetAllChecksTBT; virtualExperienceScore?: GetAllChecksVirtualExperienceScore | undefined; }; export type GetAllChecksOutput = { metrics?: GetAllChecksMetrics | undefined; }; export const GetAllChecksStatus = { Completed: "completed", Registered: "registered", Running: "running", } as const; export type GetAllChecksStatus = ClosedEnum<typeof GetAllChecksStatus>; export type GetAllChecksChecks = { completedAt?: number | undefined; conclusion?: GetAllChecksConclusion | undefined; createdAt: number; detailsUrl?: string | undefined; id: string; integrationId: string; name: string; output?: GetAllChecksOutput | undefined; path?: string | undefined; rerequestable: boolean; blocking: boolean; startedAt?: number | undefined; status: GetAllChecksStatus; updatedAt: number; }; export type GetAllChecksResponseBody = { checks: Array<GetAllChecksChecks>; }; /** @internal */ export type GetAllChecksRequest$Outbound = { deploymentId: string; teamId?: string | undefined; slug?: string | undefined; }; /** @internal */ export const GetAllChecksRequest$outboundSchema: z.ZodType< GetAllChecksRequest$Outbound, z.ZodTypeDef, GetAllChecksRequest > = z.object({ deploymentId: z.string(), teamId: z.string().optional(), slug: z.string().optional(), }); export function getAllChecksRequestToJSON( getAllChecksRequest: GetAllChecksRequest, ): string { return JSON.stringify( GetAllChecksRequest$outboundSchema.parse(getAllChecksRequest), ); } /** @internal */ export const GetAllChecksConclusion$inboundSchema: z.ZodNativeEnum< typeof GetAllChecksConclusion > = z.nativeEnum(GetAllChecksConclusion); /** @internal */ export const GetAllChecksSource$inboundSchema: z.ZodNativeEnum< typeof GetAllChecksSource > = z.nativeEnum(GetAllChecksSource); /** @internal */ export const GetAllChecksFCP$inboundSchema: z.ZodType< GetAllChecksFCP, z.ZodTypeDef, unknown > = z.object({ value: types.nullable(types.number()), previousValue: types.optional(types.number()), source: GetAllChecksSource$inboundSchema, }); export function getAllChecksFCPFromJSON( jsonString: string, ): SafeParseResult<GetAllChecksFCP, SDKValidationError> { return safeParse( jsonString, (x) => GetAllChecksFCP$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetAllChecksFCP' from JSON`, ); } /** @internal */ export const GetAllChecksChecksSource$inboundSchema: z.ZodNativeEnum< typeof GetAllChecksChecksSource > = z.nativeEnum(GetAllChecksChecksSource); /** @internal */ export const GetAllChecksLCP$inboundSchema: z.ZodType< GetAllChecksLCP, z.ZodTypeDef, unknown > = z.object({ value: types.nullable(types.number()), previousValue: types.optional(types.number()), source: GetAllChecksChecksSource$inboundSchema, }); export function getAllChecksLCPFromJSON( jsonString: string, ): SafeParseResult<GetAllChecksLCP, SDKValidationError> { return safeParse( jsonString, (x) => GetAllChecksLCP$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetAllChecksLCP' from JSON`, ); } /** @internal */ export const GetAllChecksChecksResponseSource$inboundSchema: z.ZodNativeEnum< typeof GetAllChecksChecksResponseSource > = z.nativeEnum(GetAllChecksChecksResponseSource); /** @internal */ export const GetAllChecksCLS$inboundSchema: z.ZodType< GetAllChecksCLS, z.ZodTypeDef, unknown > = z.object({ value: types.nullable(types.number()), previousValue: types.optional(types.number()), source: GetAllChecksChecksResponseSource$inboundSchema, }); export function getAllChecksCLSFromJSON( jsonString: string, ): SafeParseResult<GetAllChecksCLS, SDKValidationError> { return safeParse( jsonString, (x) => GetAllChecksCLS$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetAllChecksCLS' from JSON`, ); } /** @internal */ export const GetAllChecksChecksResponse200Source$inboundSchema: z.ZodNativeEnum< typeof GetAllChecksChecksResponse200Source > = z.nativeEnum(GetAllChecksChecksResponse200Source); /** @internal */ export const GetAllChecksTBT$inboundSchema: z.ZodType< GetAllChecksTBT, z.ZodTypeDef, unknown > = z.object({ value: types.nullable(types.number()), previousValue: types.optional(types.number()), source: GetAllChecksChecksResponse200Source$inboundSchema, }); export function getAllChecksTBTFromJSON( jsonString: string, ): SafeParseResult<GetAllChecksTBT, SDKValidationError> { return safeParse( jsonString, (x) => GetAllChecksTBT$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetAllChecksTBT' from JSON`, ); } /** @internal */ export const GetAllChecksChecksResponse200ApplicationJSONSource$inboundSchema: z.ZodNativeEnum<typeof GetAllChecksChecksResponse200ApplicationJSONSource> = z .nativeEnum(GetAllChecksChecksResponse200ApplicationJSONSource); /** @internal */ export const GetAllChecksVirtualExperienceScore$inboundSchema: z.ZodType< GetAllChecksVirtualExperienceScore, z.ZodTypeDef, unknown > = z.object({ value: types.nullable(types.number()), previousValue: types.optional(types.number()), source: GetAllChecksChecksResponse200ApplicationJSONSource$inboundSchema, }); export function getAllChecksVirtualExperienceScoreFromJSON( jsonString: string, ): SafeParseResult<GetAllChecksVirtualExperienceScore, SDKValidationError> { return safeParse( jsonString, (x) => GetAllChecksVirtualExperienceScore$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetAllChecksVirtualExperienceScore' from JSON`, ); } /** @internal */ export const GetAllChecksMetrics$inboundSchema: z.ZodType< GetAllChecksMetrics, z.ZodTypeDef, unknown > = z.object({ FCP: z.lazy(() => GetAllChecksFCP$inboundSchema), LCP: z.lazy(() => GetAllChecksLCP$inboundSchema), CLS: z.lazy(() => GetAllChecksCLS$inboundSchema), TBT: z.lazy(() => GetAllChecksTBT$inboundSchema), virtualExperienceScore: types.optional( z.lazy(() => GetAllChecksVirtualExperienceScore$inboundSchema), ), }).transform((v) => { return remap$(v, { "FCP": "fcp", "LCP": "lcp", "CLS": "cls", "TBT": "tbt", }); }); export function getAllChecksMetricsFromJSON( jsonString: string, ): SafeParseResult<GetAllChecksMetrics, SDKValidationError> { return safeParse( jsonString, (x) => GetAllChecksMetrics$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetAllChecksMetrics' from JSON`, ); } /** @internal */ export const GetAllChecksOutput$inboundSchema: z.ZodType< GetAllChecksOutput, z.ZodTypeDef, unknown > = z.object({ metrics: types.optional(z.lazy(() => GetAllChecksMetrics$inboundSchema)), }); export function getAllChecksOutputFromJSON( jsonString: string, ): SafeParseResult<GetAllChecksOutput, SDKValidationError> { return safeParse( jsonString, (x) => GetAllChecksOutput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetAllChecksOutput' from JSON`, ); } /** @internal */ export const GetAllChecksStatus$inboundSchema: z.ZodNativeEnum< typeof GetAllChecksStatus > = z.nativeEnum(GetAllChecksStatus); /** @internal */ export const GetAllChecksChecks$inboundSchema: z.ZodType< GetAllChecksChecks, z.ZodTypeDef, unknown > = z.object({ completedAt: types.optional(types.number()), conclusion: types.optional(GetAllChecksConclusion$inboundSchema), createdAt: types.number(), detailsUrl: types.optional(types.string()), id: types.string(), integrationId: types.string(), name: types.string(), output: types.optional(z.lazy(() => GetAllChecksOutput$inboundSchema)), path: types.optional(types.string()), rerequestable: types.boolean(), blocking: types.boolean(), startedAt: types.optional(types.number()), status: GetAllChecksStatus$inboundSchema, updatedAt: types.number(), }); export function getAllChecksChecksFromJSON( jsonString: string, ): SafeParseResult<GetAllChecksChecks, SDKValidationError> { return safeParse( jsonString, (x) => GetAllChecksChecks$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetAllChecksChecks' from JSON`, ); } /** @internal */ export const GetAllChecksResponseBody$inboundSchema: z.ZodType< GetAllChecksResponseBody, z.ZodTypeDef, unknown > = z.object({ checks: z.array(z.lazy(() => GetAllChecksChecks$inboundSchema)), }); export function getAllChecksResponseBodyFromJSON( jsonString: string, ): SafeParseResult<GetAllChecksResponseBody, SDKValidationError> { return safeParse( jsonString, (x) => GetAllChecksResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetAllChecksResponseBody' from JSON`, ); }