- createConnector - Create a connector
Create a connector and optionally link it to a project. Use type with complete provider data, or use service with connectionMethod so Connect can supply the type, endpoints, templates, and defaults.
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.connect.createConnector({
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
console.log(result);
}
run();The standalone function version of this method:
import { VercelCore } from "@vercel/sdk/core.js";
import { connectCreateConnector } from "@vercel/sdk/funcs/connectCreateConnector.js";
// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await connectCreateConnector(vercel, {
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("connectCreateConnector failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
models.CreateConnectorRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<models.ConnectConnectorCreateResult>
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ConnectError | 400, 401, 403, 404, 409, 410, 422 | application/json |
| models.ConnectError | 500, 502 | application/json |
| models.SDKError | 4XX, 5XX | */* |