@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>
445 lines • 22.9 kB
TypeScript
import * as z from "zod/v3";
import { ClosedEnum } from "../types/enums.js";
import { ConnectConnectorCreateData, ConnectConnectorCreateData$Outbound } from "./connectconnectorcreatedata.js";
export declare const ConnectCreateConnectorRequestEnvironments1: {
readonly Development: "development";
readonly Preview: "preview";
readonly Production: "production";
};
export type ConnectCreateConnectorRequestEnvironments1 = ClosedEnum<typeof ConnectCreateConnectorRequestEnvironments1>;
/**
* A built-in environment name or the stable env_* ID of a custom environment.
*/
export type ConnectCreateConnectorRequestEnvironments = ConnectCreateConnectorRequestEnvironments1 | string;
export type TriggerDestinationCustomEnvironment = {
/**
* Project that receives triggers. During connector creation, omit it to use the top-level projectId.
*/
projectId?: string | undefined;
/**
* Stable custom environment ID that belongs to the destination project.
*/
customEnvironmentId: string;
/**
* Route path on the linked project that receives forwarded trigger requests.
*/
path?: string | undefined;
};
export type TriggerDestinationBranch = {
/**
* Project that receives triggers. During connector creation, omit it to use the top-level projectId.
*/
projectId?: string | undefined;
/**
* Git branch used to select a preview deployment.
*/
branch: string;
/**
* Route path on the linked project that receives forwarded trigger requests.
*/
path?: string | undefined;
};
export type TriggerDestinationDefaultDeployment = {
/**
* Project that receives triggers. During connector creation, omit it to use the top-level projectId.
*/
projectId?: string | undefined;
/**
* Route path on the linked project that receives forwarded trigger requests.
*/
path?: string | undefined;
};
/**
* Initial trigger destination. Requires triggers to be enabled and a projectId here or at the top level. Connector responses expose the resulting set as triggerDestinations. Replace the complete set with PATCH /v1/connect/connectors/{connector}/trigger-destinations.
*/
export type ConnectCreateConnectorRequestTriggerDestination = TriggerDestinationBranch | TriggerDestinationCustomEnvironment | TriggerDestinationDefaultDeployment;
export type PresetConfiguration = {
/**
* Provider configuration. With type, provide the complete configuration for that type. With service and connectionMethod, provide only credentials and preferences; Connect supplies the type, endpoints, templates, and defaults. Other connector types accept an arbitrary object.
*/
data: ConnectConnectorCreateData;
/**
* SHA-1 digest of a PNG or JPEG icon that is at least 640 by 640 pixels. This field does not accept a URL or image bytes.
*
* @remarks
*
* First compute the digest and upload the raw image with [POST /v2/files](https://vercel.com/docs/rest-api/deployments/upload-deployment-files). Send `Content-Length` and the same 40-character digest in `x-vercel-digest`. Then set `icon` to that digest.
*
* ```js
* import { createHash } from 'node:crypto';
* import { readFile } from 'node:fs/promises';
*
* const VERCEL_TOKEN = process.env.VERCEL_TOKEN;
* const connectorId = 'scl_...';
* const bytes = await readFile('icon.png');
* const digest = createHash('sha1').update(bytes).digest('hex');
*
* await fetch('https://api.vercel.com/v2/files', {
* method: 'POST',
* headers: {
* Authorization: `Bearer ${VERCEL_TOKEN}`,
* 'Content-Type': 'application/octet-stream',
* 'Content-Length': String(bytes.length),
* 'x-vercel-digest': digest,
* },
* body: bytes,
* });
*
* await fetch(`https://api.vercel.com/v2/connect/connectors/${connectorId}`, {
* method: 'PATCH',
* headers: {
* Authorization: `Bearer ${VERCEL_TOKEN}`,
* 'Content-Type': 'application/json',
* },
* body: JSON.stringify({ icon: digest }),
* });
* ```
*/
icon?: string | undefined;
/**
* Branding background color (6-digit hex, for example
*/
backgroundColor?: string | undefined;
/**
* Branding accent color (6-digit hex, for example
*/
accentColor?: string | undefined;
/**
* Connector implementation type for full configuration. Known types: api-key, discord, github, linear, linq, microsoft-entra, oauth, photon, salesforce, sendblue, slack, snowflake, snowflake-wif. Optional when service and connectionMethod select the type.
*/
type?: string | undefined;
/**
* Service slug or URL for which the connector is used. Required when connectionMethod is set. Service alone does not enable preset configuration.
*/
service: string;
/**
* Connection method slug of the service. Use it with service to select preset configuration.
*/
connectionMethod: string;
/**
* Values for the selected connection method's template fields. Requires connectionMethod.
*/
params?: {
[k: string]: string;
} | undefined;
/**
* Which of the service's targets this connector is for. Requires \"connectionMethod\" and must be one that method serves. Optional.
*/
target?: string | undefined;
/**
* Optional team-scoped unique identifier for the connector. If omitted or empty, Connect generates a value.
*/
uid?: string | undefined;
/**
* Connector name. The value is trimmed and cannot contain control characters. If omitted or empty, the project name is used. A name or projectId is required. API key connectors require name.
*/
name?: string | undefined;
/**
* Project to connect during creation. If environments is omitted, the connection uses development, preview, and production.
*/
projectId?: string | undefined;
/**
* Environments for the project connection. Requires projectId. Use one or more built-in environment names or stable custom environment IDs that belong to the project. Duplicate values are accepted and removed.
*/
environments?: Array<ConnectCreateConnectorRequestEnvironments1 | string> | undefined;
/**
* Whether the triggers are enabled for this connector.
*/
triggers?: boolean | undefined;
/**
* Initial trigger destination. Requires triggers to be enabled and a projectId here or at the top level. Connector responses expose the resulting set as triggerDestinations. Replace the complete set with PATCH /v1/connect/connectors/{connector}/trigger-destinations.
*/
triggerDestination?: TriggerDestinationBranch | TriggerDestinationCustomEnvironment | TriggerDestinationDefaultDeployment | undefined;
/**
* Default trigger events for this connector.
*/
events?: Array<string> | undefined;
};
export declare const ConnectCreateConnectorRequestEnvironments11: {
readonly Development: "development";
readonly Preview: "preview";
readonly Production: "production";
};
export type ConnectCreateConnectorRequestEnvironments11 = ClosedEnum<typeof ConnectCreateConnectorRequestEnvironments11>;
/**
* A built-in environment name or the stable env_* ID of a custom environment.
*/
export type ConnectCreateConnectorRequest1Environments = ConnectCreateConnectorRequestEnvironments11 | string;
export type ConnectCreateConnectorRequestTriggerDestinationCustomEnvironment = {
/**
* Project that receives triggers. During connector creation, omit it to use the top-level projectId.
*/
projectId?: string | undefined;
/**
* Stable custom environment ID that belongs to the destination project.
*/
customEnvironmentId: string;
/**
* Route path on the linked project that receives forwarded trigger requests.
*/
path?: string | undefined;
};
export type ConnectCreateConnectorRequestTriggerDestinationBranch = {
/**
* Project that receives triggers. During connector creation, omit it to use the top-level projectId.
*/
projectId?: string | undefined;
/**
* Git branch used to select a preview deployment.
*/
branch: string;
/**
* Route path on the linked project that receives forwarded trigger requests.
*/
path?: string | undefined;
};
export type ConnectCreateConnectorRequestTriggerDestinationDefaultDeployment = {
/**
* Project that receives triggers. During connector creation, omit it to use the top-level projectId.
*/
projectId?: string | undefined;
/**
* Route path on the linked project that receives forwarded trigger requests.
*/
path?: string | undefined;
};
/**
* Initial trigger destination. Requires triggers to be enabled and a projectId here or at the top level. Connector responses expose the resulting set as triggerDestinations. Replace the complete set with PATCH /v1/connect/connectors/{connector}/trigger-destinations.
*/
export type TriggerDestination = ConnectCreateConnectorRequestTriggerDestinationBranch | ConnectCreateConnectorRequestTriggerDestinationCustomEnvironment | ConnectCreateConnectorRequestTriggerDestinationDefaultDeployment;
export type FullConfiguration = {
/**
* Provider configuration. With type, provide the complete configuration for that type. With service and connectionMethod, provide only credentials and preferences; Connect supplies the type, endpoints, templates, and defaults. Other connector types accept an arbitrary object.
*/
data: ConnectConnectorCreateData;
/**
* SHA-1 digest of a PNG or JPEG icon that is at least 640 by 640 pixels. This field does not accept a URL or image bytes.
*
* @remarks
*
* First compute the digest and upload the raw image with [POST /v2/files](https://vercel.com/docs/rest-api/deployments/upload-deployment-files). Send `Content-Length` and the same 40-character digest in `x-vercel-digest`. Then set `icon` to that digest.
*
* ```js
* import { createHash } from 'node:crypto';
* import { readFile } from 'node:fs/promises';
*
* const VERCEL_TOKEN = process.env.VERCEL_TOKEN;
* const connectorId = 'scl_...';
* const bytes = await readFile('icon.png');
* const digest = createHash('sha1').update(bytes).digest('hex');
*
* await fetch('https://api.vercel.com/v2/files', {
* method: 'POST',
* headers: {
* Authorization: `Bearer ${VERCEL_TOKEN}`,
* 'Content-Type': 'application/octet-stream',
* 'Content-Length': String(bytes.length),
* 'x-vercel-digest': digest,
* },
* body: bytes,
* });
*
* await fetch(`https://api.vercel.com/v2/connect/connectors/${connectorId}`, {
* method: 'PATCH',
* headers: {
* Authorization: `Bearer ${VERCEL_TOKEN}`,
* 'Content-Type': 'application/json',
* },
* body: JSON.stringify({ icon: digest }),
* });
* ```
*/
icon?: string | undefined;
/**
* Branding background color (6-digit hex, for example
*/
backgroundColor?: string | undefined;
/**
* Branding accent color (6-digit hex, for example
*/
accentColor?: string | undefined;
/**
* Connector implementation type for full configuration. Known types: api-key, discord, github, linear, linq, microsoft-entra, oauth, photon, salesforce, sendblue, slack, snowflake, snowflake-wif. Optional when service and connectionMethod select the type.
*/
type: string;
/**
* Service slug or URL for which the connector is used. Required when connectionMethod is set. Service alone does not enable preset configuration.
*/
service?: string | undefined;
/**
* Connection method slug of the service. Use it with service to select preset configuration.
*/
connectionMethod?: string | undefined;
/**
* Values for the selected connection method's template fields. Requires connectionMethod.
*/
params?: {
[k: string]: string;
} | undefined;
/**
* Which of the service's targets this connector is for. Requires \"connectionMethod\" and must be one that method serves. Optional.
*/
target?: string | undefined;
/**
* Optional team-scoped unique identifier for the connector. If omitted or empty, Connect generates a value.
*/
uid?: string | undefined;
/**
* Connector name. The value is trimmed and cannot contain control characters. If omitted or empty, the project name is used. A name or projectId is required. API key connectors require name.
*/
name?: string | undefined;
/**
* Project to connect during creation. If environments is omitted, the connection uses development, preview, and production.
*/
projectId?: string | undefined;
/**
* Environments for the project connection. Requires projectId. Use one or more built-in environment names or stable custom environment IDs that belong to the project. Duplicate values are accepted and removed.
*/
environments?: Array<ConnectCreateConnectorRequestEnvironments11 | string> | undefined;
/**
* Whether the triggers are enabled for this connector.
*/
triggers?: boolean | undefined;
/**
* Initial trigger destination. Requires triggers to be enabled and a projectId here or at the top level. Connector responses expose the resulting set as triggerDestinations. Replace the complete set with PATCH /v1/connect/connectors/{connector}/trigger-destinations.
*/
triggerDestination?: ConnectCreateConnectorRequestTriggerDestinationBranch | ConnectCreateConnectorRequestTriggerDestinationCustomEnvironment | ConnectCreateConnectorRequestTriggerDestinationDefaultDeployment | undefined;
/**
* Default trigger events for this connector.
*/
events?: Array<string> | undefined;
};
/**
* Create a connector with full provider configuration or with a known service connection method.
*/
export type ConnectCreateConnectorRequest = PresetConfiguration | FullConfiguration;
/** @internal */
export declare const ConnectCreateConnectorRequestEnvironments1$outboundSchema: z.ZodNativeEnum<typeof ConnectCreateConnectorRequestEnvironments1>;
/** @internal */
export type ConnectCreateConnectorRequestEnvironments$Outbound = string | string;
/** @internal */
export declare const ConnectCreateConnectorRequestEnvironments$outboundSchema: z.ZodType<ConnectCreateConnectorRequestEnvironments$Outbound, z.ZodTypeDef, ConnectCreateConnectorRequestEnvironments>;
export declare function connectCreateConnectorRequestEnvironmentsToJSON(connectCreateConnectorRequestEnvironments: ConnectCreateConnectorRequestEnvironments): string;
/** @internal */
export type TriggerDestinationCustomEnvironment$Outbound = {
projectId?: string | undefined;
customEnvironmentId: string;
path?: string | undefined;
};
/** @internal */
export declare const TriggerDestinationCustomEnvironment$outboundSchema: z.ZodType<TriggerDestinationCustomEnvironment$Outbound, z.ZodTypeDef, TriggerDestinationCustomEnvironment>;
export declare function triggerDestinationCustomEnvironmentToJSON(triggerDestinationCustomEnvironment: TriggerDestinationCustomEnvironment): string;
/** @internal */
export type TriggerDestinationBranch$Outbound = {
projectId?: string | undefined;
branch: string;
path?: string | undefined;
};
/** @internal */
export declare const TriggerDestinationBranch$outboundSchema: z.ZodType<TriggerDestinationBranch$Outbound, z.ZodTypeDef, TriggerDestinationBranch>;
export declare function triggerDestinationBranchToJSON(triggerDestinationBranch: TriggerDestinationBranch): string;
/** @internal */
export type TriggerDestinationDefaultDeployment$Outbound = {
projectId?: string | undefined;
path?: string | undefined;
};
/** @internal */
export declare const TriggerDestinationDefaultDeployment$outboundSchema: z.ZodType<TriggerDestinationDefaultDeployment$Outbound, z.ZodTypeDef, TriggerDestinationDefaultDeployment>;
export declare function triggerDestinationDefaultDeploymentToJSON(triggerDestinationDefaultDeployment: TriggerDestinationDefaultDeployment): string;
/** @internal */
export type ConnectCreateConnectorRequestTriggerDestination$Outbound = TriggerDestinationBranch$Outbound | TriggerDestinationCustomEnvironment$Outbound | TriggerDestinationDefaultDeployment$Outbound;
/** @internal */
export declare const ConnectCreateConnectorRequestTriggerDestination$outboundSchema: z.ZodType<ConnectCreateConnectorRequestTriggerDestination$Outbound, z.ZodTypeDef, ConnectCreateConnectorRequestTriggerDestination>;
export declare function connectCreateConnectorRequestTriggerDestinationToJSON(connectCreateConnectorRequestTriggerDestination: ConnectCreateConnectorRequestTriggerDestination): string;
/** @internal */
export type PresetConfiguration$Outbound = {
data: ConnectConnectorCreateData$Outbound;
icon?: string | undefined;
backgroundColor?: string | undefined;
accentColor?: string | undefined;
type?: string | undefined;
service: string;
connectionMethod: string;
params?: {
[k: string]: string;
} | undefined;
target?: string | undefined;
uid?: string | undefined;
name?: string | undefined;
projectId?: string | undefined;
environments?: Array<string | string> | undefined;
triggers?: boolean | undefined;
triggerDestination?: TriggerDestinationBranch$Outbound | TriggerDestinationCustomEnvironment$Outbound | TriggerDestinationDefaultDeployment$Outbound | undefined;
events?: Array<string> | undefined;
};
/** @internal */
export declare const PresetConfiguration$outboundSchema: z.ZodType<PresetConfiguration$Outbound, z.ZodTypeDef, PresetConfiguration>;
export declare function presetConfigurationToJSON(presetConfiguration: PresetConfiguration): string;
/** @internal */
export declare const ConnectCreateConnectorRequestEnvironments11$outboundSchema: z.ZodNativeEnum<typeof ConnectCreateConnectorRequestEnvironments11>;
/** @internal */
export type ConnectCreateConnectorRequest1Environments$Outbound = string | string;
/** @internal */
export declare const ConnectCreateConnectorRequest1Environments$outboundSchema: z.ZodType<ConnectCreateConnectorRequest1Environments$Outbound, z.ZodTypeDef, ConnectCreateConnectorRequest1Environments>;
export declare function connectCreateConnectorRequest1EnvironmentsToJSON(connectCreateConnectorRequest1Environments: ConnectCreateConnectorRequest1Environments): string;
/** @internal */
export type ConnectCreateConnectorRequestTriggerDestinationCustomEnvironment$Outbound = {
projectId?: string | undefined;
customEnvironmentId: string;
path?: string | undefined;
};
/** @internal */
export declare const ConnectCreateConnectorRequestTriggerDestinationCustomEnvironment$outboundSchema: z.ZodType<ConnectCreateConnectorRequestTriggerDestinationCustomEnvironment$Outbound, z.ZodTypeDef, ConnectCreateConnectorRequestTriggerDestinationCustomEnvironment>;
export declare function connectCreateConnectorRequestTriggerDestinationCustomEnvironmentToJSON(connectCreateConnectorRequestTriggerDestinationCustomEnvironment: ConnectCreateConnectorRequestTriggerDestinationCustomEnvironment): string;
/** @internal */
export type ConnectCreateConnectorRequestTriggerDestinationBranch$Outbound = {
projectId?: string | undefined;
branch: string;
path?: string | undefined;
};
/** @internal */
export declare const ConnectCreateConnectorRequestTriggerDestinationBranch$outboundSchema: z.ZodType<ConnectCreateConnectorRequestTriggerDestinationBranch$Outbound, z.ZodTypeDef, ConnectCreateConnectorRequestTriggerDestinationBranch>;
export declare function connectCreateConnectorRequestTriggerDestinationBranchToJSON(connectCreateConnectorRequestTriggerDestinationBranch: ConnectCreateConnectorRequestTriggerDestinationBranch): string;
/** @internal */
export type ConnectCreateConnectorRequestTriggerDestinationDefaultDeployment$Outbound = {
projectId?: string | undefined;
path?: string | undefined;
};
/** @internal */
export declare const ConnectCreateConnectorRequestTriggerDestinationDefaultDeployment$outboundSchema: z.ZodType<ConnectCreateConnectorRequestTriggerDestinationDefaultDeployment$Outbound, z.ZodTypeDef, ConnectCreateConnectorRequestTriggerDestinationDefaultDeployment>;
export declare function connectCreateConnectorRequestTriggerDestinationDefaultDeploymentToJSON(connectCreateConnectorRequestTriggerDestinationDefaultDeployment: ConnectCreateConnectorRequestTriggerDestinationDefaultDeployment): string;
/** @internal */
export type TriggerDestination$Outbound = ConnectCreateConnectorRequestTriggerDestinationBranch$Outbound | ConnectCreateConnectorRequestTriggerDestinationCustomEnvironment$Outbound | ConnectCreateConnectorRequestTriggerDestinationDefaultDeployment$Outbound;
/** @internal */
export declare const TriggerDestination$outboundSchema: z.ZodType<TriggerDestination$Outbound, z.ZodTypeDef, TriggerDestination>;
export declare function triggerDestinationToJSON(triggerDestination: TriggerDestination): string;
/** @internal */
export type FullConfiguration$Outbound = {
data: ConnectConnectorCreateData$Outbound;
icon?: string | undefined;
backgroundColor?: string | undefined;
accentColor?: string | undefined;
type: string;
service?: string | undefined;
connectionMethod?: string | undefined;
params?: {
[k: string]: string;
} | undefined;
target?: string | undefined;
uid?: string | undefined;
name?: string | undefined;
projectId?: string | undefined;
environments?: Array<string | string> | undefined;
triggers?: boolean | undefined;
triggerDestination?: ConnectCreateConnectorRequestTriggerDestinationBranch$Outbound | ConnectCreateConnectorRequestTriggerDestinationCustomEnvironment$Outbound | ConnectCreateConnectorRequestTriggerDestinationDefaultDeployment$Outbound | undefined;
events?: Array<string> | undefined;
};
/** @internal */
export declare const FullConfiguration$outboundSchema: z.ZodType<FullConfiguration$Outbound, z.ZodTypeDef, FullConfiguration>;
export declare function fullConfigurationToJSON(fullConfiguration: FullConfiguration): string;
/** @internal */
export type ConnectCreateConnectorRequest$Outbound = PresetConfiguration$Outbound | FullConfiguration$Outbound;
/** @internal */
export declare const ConnectCreateConnectorRequest$outboundSchema: z.ZodType<ConnectCreateConnectorRequest$Outbound, z.ZodTypeDef, ConnectCreateConnectorRequest>;
export declare function connectCreateConnectorRequestToJSON(connectCreateConnectorRequest: ConnectCreateConnectorRequest): string;
//# sourceMappingURL=connectcreateconnectorrequest.d.ts.map