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>

384 lines (348 loc) 11.1 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 { smartUnion } from "../types/smartUnion.js"; import { SDKValidationError } from "./sdkvalidationerror.js"; export type GetIntegrationResourcesRequest = { integrationConfigurationId: string; }; /** * The current status of the resource */ export const GetIntegrationResourcesStatus = { Error: "error", Onboarding: "onboarding", Pending: "pending", Ready: "ready", Resumed: "resumed", Suspended: "suspended", Uninstalled: "uninstalled", } as const; /** * The current status of the resource */ export type GetIntegrationResourcesStatus = ClosedEnum< typeof GetIntegrationResourcesStatus >; export type GetIntegrationResourcesExperimentation = { edgeConfigSyncingEnabled?: boolean | undefined; edgeConfigId?: string | undefined; globalConfigId?: string | undefined; globalConfigSyncingEnabled?: boolean | undefined; edgeConfigTokenId?: string | undefined; }; export const GetIntegrationResourcesTarget = { Development: "development", Preview: "preview", Production: "production", } as const; export type GetIntegrationResourcesTarget = ClosedEnum< typeof GetIntegrationResourcesTarget >; export type GetIntegrationResourcesAppUrls = { url: string; target: GetIntegrationResourcesTarget; }; export type GetIntegrationResourcesAuthentication = { appUrls?: Array<GetIntegrationResourcesAppUrls> | undefined; }; /** * Any settings provided for the resource to support its product's protocols */ export type GetIntegrationResourcesProtocolSettings = { experimentation?: GetIntegrationResourcesExperimentation | undefined; authentication?: GetIntegrationResourcesAuthentication | undefined; }; export const GetIntegrationResourcesLevel = { Error: "error", Info: "info", Warn: "warn", } as const; export type GetIntegrationResourcesLevel = ClosedEnum< typeof GetIntegrationResourcesLevel >; /** * The notification, if set, displayed to the user when viewing the resource in Vercel */ export type GetIntegrationResourcesNotification = { title: string; level: GetIntegrationResourcesLevel; message?: string | undefined; href?: string | undefined; }; export type GetIntegrationResourcesMetadata = | string | number | Array<string> | Array<number> | boolean; export type GetIntegrationResourcesResources = { /** * The ID provided by the partner for the given resource */ partnerId: string; /** * The ID assigned by Vercel for the given resource */ internalId: string; /** * The name of the resource as it is recorded in Vercel */ name: string; /** * The current status of the resource */ status?: GetIntegrationResourcesStatus | undefined; /** * The ID of the product the resource is derived from */ productId: string; /** * Any settings provided for the resource to support its product's protocols */ protocolSettings?: GetIntegrationResourcesProtocolSettings | undefined; /** * The notification, if set, displayed to the user when viewing the resource in Vercel */ notification?: GetIntegrationResourcesNotification | undefined; /** * The ID of the billing plan the resource is subscribed to, if applicable */ billingPlanId?: string | undefined; /** * The configured metadata for the resource as defined by its product's Metadata Schema */ metadata?: { [k: string]: string | number | Array<string> | Array<number> | boolean; } | undefined; }; export type GetIntegrationResourcesResponseBody = { resources: Array<GetIntegrationResourcesResources>; }; /** @internal */ export type GetIntegrationResourcesRequest$Outbound = { integrationConfigurationId: string; }; /** @internal */ export const GetIntegrationResourcesRequest$outboundSchema: z.ZodType< GetIntegrationResourcesRequest$Outbound, z.ZodTypeDef, GetIntegrationResourcesRequest > = z.object({ integrationConfigurationId: z.string(), }); export function getIntegrationResourcesRequestToJSON( getIntegrationResourcesRequest: GetIntegrationResourcesRequest, ): string { return JSON.stringify( GetIntegrationResourcesRequest$outboundSchema.parse( getIntegrationResourcesRequest, ), ); } /** @internal */ export const GetIntegrationResourcesStatus$inboundSchema: z.ZodNativeEnum< typeof GetIntegrationResourcesStatus > = z.nativeEnum(GetIntegrationResourcesStatus); /** @internal */ export const GetIntegrationResourcesExperimentation$inboundSchema: z.ZodType< GetIntegrationResourcesExperimentation, z.ZodTypeDef, unknown > = z.object({ edgeConfigSyncingEnabled: types.optional(types.boolean()), edgeConfigId: types.optional(types.string()), globalConfigId: types.optional(types.string()), globalConfigSyncingEnabled: types.optional(types.boolean()), edgeConfigTokenId: types.optional(types.string()), }); export function getIntegrationResourcesExperimentationFromJSON( jsonString: string, ): SafeParseResult<GetIntegrationResourcesExperimentation, SDKValidationError> { return safeParse( jsonString, (x) => GetIntegrationResourcesExperimentation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetIntegrationResourcesExperimentation' from JSON`, ); } /** @internal */ export const GetIntegrationResourcesTarget$inboundSchema: z.ZodNativeEnum< typeof GetIntegrationResourcesTarget > = z.nativeEnum(GetIntegrationResourcesTarget); /** @internal */ export const GetIntegrationResourcesAppUrls$inboundSchema: z.ZodType< GetIntegrationResourcesAppUrls, z.ZodTypeDef, unknown > = z.object({ url: types.string(), target: GetIntegrationResourcesTarget$inboundSchema, }); export function getIntegrationResourcesAppUrlsFromJSON( jsonString: string, ): SafeParseResult<GetIntegrationResourcesAppUrls, SDKValidationError> { return safeParse( jsonString, (x) => GetIntegrationResourcesAppUrls$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetIntegrationResourcesAppUrls' from JSON`, ); } /** @internal */ export const GetIntegrationResourcesAuthentication$inboundSchema: z.ZodType< GetIntegrationResourcesAuthentication, z.ZodTypeDef, unknown > = z.object({ appUrls: types.optional( z.array(z.lazy(() => GetIntegrationResourcesAppUrls$inboundSchema)), ), }); export function getIntegrationResourcesAuthenticationFromJSON( jsonString: string, ): SafeParseResult<GetIntegrationResourcesAuthentication, SDKValidationError> { return safeParse( jsonString, (x) => GetIntegrationResourcesAuthentication$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetIntegrationResourcesAuthentication' from JSON`, ); } /** @internal */ export const GetIntegrationResourcesProtocolSettings$inboundSchema: z.ZodType< GetIntegrationResourcesProtocolSettings, z.ZodTypeDef, unknown > = z.object({ experimentation: types.optional( z.lazy(() => GetIntegrationResourcesExperimentation$inboundSchema), ), authentication: types.optional( z.lazy(() => GetIntegrationResourcesAuthentication$inboundSchema), ), }); export function getIntegrationResourcesProtocolSettingsFromJSON( jsonString: string, ): SafeParseResult< GetIntegrationResourcesProtocolSettings, SDKValidationError > { return safeParse( jsonString, (x) => GetIntegrationResourcesProtocolSettings$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'GetIntegrationResourcesProtocolSettings' from JSON`, ); } /** @internal */ export const GetIntegrationResourcesLevel$inboundSchema: z.ZodNativeEnum< typeof GetIntegrationResourcesLevel > = z.nativeEnum(GetIntegrationResourcesLevel); /** @internal */ export const GetIntegrationResourcesNotification$inboundSchema: z.ZodType< GetIntegrationResourcesNotification, z.ZodTypeDef, unknown > = z.object({ title: types.string(), level: GetIntegrationResourcesLevel$inboundSchema, message: types.optional(types.string()), href: types.optional(types.string()), }); export function getIntegrationResourcesNotificationFromJSON( jsonString: string, ): SafeParseResult<GetIntegrationResourcesNotification, SDKValidationError> { return safeParse( jsonString, (x) => GetIntegrationResourcesNotification$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetIntegrationResourcesNotification' from JSON`, ); } /** @internal */ export const GetIntegrationResourcesMetadata$inboundSchema: z.ZodType< GetIntegrationResourcesMetadata, z.ZodTypeDef, unknown > = smartUnion([ types.string(), types.number(), z.array(types.string()), z.array(types.number()), types.boolean(), ]); export function getIntegrationResourcesMetadataFromJSON( jsonString: string, ): SafeParseResult<GetIntegrationResourcesMetadata, SDKValidationError> { return safeParse( jsonString, (x) => GetIntegrationResourcesMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetIntegrationResourcesMetadata' from JSON`, ); } /** @internal */ export const GetIntegrationResourcesResources$inboundSchema: z.ZodType< GetIntegrationResourcesResources, z.ZodTypeDef, unknown > = z.object({ partnerId: types.string(), internalId: types.string(), name: types.string(), status: types.optional(GetIntegrationResourcesStatus$inboundSchema), productId: types.string(), protocolSettings: types.optional( z.lazy(() => GetIntegrationResourcesProtocolSettings$inboundSchema), ), notification: types.optional( z.lazy(() => GetIntegrationResourcesNotification$inboundSchema), ), billingPlanId: types.optional(types.string()), metadata: types.optional( z.record( smartUnion([ types.string(), types.number(), z.array(types.string()), z.array(types.number()), types.boolean(), ]), ), ), }); export function getIntegrationResourcesResourcesFromJSON( jsonString: string, ): SafeParseResult<GetIntegrationResourcesResources, SDKValidationError> { return safeParse( jsonString, (x) => GetIntegrationResourcesResources$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetIntegrationResourcesResources' from JSON`, ); } /** @internal */ export const GetIntegrationResourcesResponseBody$inboundSchema: z.ZodType< GetIntegrationResourcesResponseBody, z.ZodTypeDef, unknown > = z.object({ resources: z.array( z.lazy(() => GetIntegrationResourcesResources$inboundSchema), ), }); export function getIntegrationResourcesResponseBodyFromJSON( jsonString: string, ): SafeParseResult<GetIntegrationResourcesResponseBody, SDKValidationError> { return safeParse( jsonString, (x) => GetIntegrationResourcesResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetIntegrationResourcesResponseBody' from JSON`, ); }