Skip to content

Latest commit

 

History

History
383 lines (260 loc) · 37.8 KB

README.md

File metadata and controls

383 lines (260 loc) · 37.8 KB

Integrations

(integrations)

Overview

Integrations

Available Operations

getConfigurations

Allows to retrieve all configurations for an authenticated integration. When the project view is used, configurations generated for the authorization flow will be filtered out of the results.

Example Usage

import { Vercel } from "@simplesagar/vercel";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.integrations.getConfigurations("account");
  
  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@simplesagar/vercel/core.js";
import { integrationsGetConfigurations } from "@simplesagar/vercel/funcs/integrationsGetConfigurations.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 integrationsGetConfigurations(vercel, "account");

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
view models.View ✔️ N/A
teamId string The Team identifier to perform the request on behalf of.
slug string The Team slug to perform the request on behalf of.
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.

Response

Promise<models.GetConfigurationsResponseBody>

Errors

Error Object Status Code Content Type
models.SDKError 4xx-5xx /

getConfiguration

Allows to retrieve a the configuration with the provided id in case it exists. The authenticated user or team must be the owner of the config in order to access it.

Example Usage

import { Vercel } from "@simplesagar/vercel";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.integrations.getConfiguration("icfg_cuwj0AdCdH3BwWT4LPijCC7t");
  
  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@simplesagar/vercel/core.js";
import { integrationsGetConfiguration } from "@simplesagar/vercel/funcs/integrationsGetConfiguration.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 integrationsGetConfiguration(vercel, "icfg_cuwj0AdCdH3BwWT4LPijCC7t");

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description Example
id string ✔️ ID of the configuration to check [object Object]
teamId string The Team identifier to perform the request on behalf of.
slug string The Team slug to perform the request on behalf of.
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.

Response

Promise<models.GetConfigurationResponseBody>

Errors

Error Object Status Code Content Type
models.SDKError 4xx-5xx /

deleteConfiguration

Allows to remove the configuration with the id provided in the parameters. The configuration and all of its resources will be removed. This includes Webhooks, LogDrains and Project Env variables.

Example Usage

import { Vercel } from "@simplesagar/vercel";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  await vercel.integrations.deleteConfiguration("<id>");
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@simplesagar/vercel/core.js";
import { integrationsDeleteConfiguration } from "@simplesagar/vercel/funcs/integrationsDeleteConfiguration.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 integrationsDeleteConfiguration(vercel, "<id>");

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  
}

run();

Parameters

Parameter Type Required Description
id string ✔️ N/A
teamId string The Team identifier to perform the request on behalf of.
slug string The Team slug to perform the request on behalf of.
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.

Response

Promise<void>

Errors

Error Object Status Code Content Type
models.SDKError 4xx-5xx /

getGitNamespaces

Lists git namespaces for a supported provider. Supported providers are github, gitlab and bitbucket. If the provider is not provided, it will try to obtain it from the user that authenticated the request.

Example Usage

import { Vercel } from "@simplesagar/vercel";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.integrations.getGitNamespaces();
  
  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@simplesagar/vercel/core.js";
import { integrationsGetGitNamespaces } from "@simplesagar/vercel/funcs/integrationsGetGitNamespaces.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 integrationsGetGitNamespaces(vercel);

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description Example
host string The custom Git host if using a custom Git provider, like GitHub Enterprise Server [object Object]
provider models.Provider N/A
teamId string The Team identifier to perform the request on behalf of.
slug string The Team slug to perform the request on behalf of.
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.

Response

Promise<models.GitNamespacesResponseBody[]>

Errors

Error Object Status Code Content Type
models.SDKError 4xx-5xx /

searchRepos

Lists git repositories linked to a namespace id for a supported provider. A specific namespace id can be obtained via the git-namespaces endpoint. Supported providers are github, gitlab and bitbucket. If the provider or namespace is not provided, it will try to obtain it from the user that authenticated the request.

Example Usage

import { Vercel } from "@simplesagar/vercel";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.integrations.searchRepos({});
  
  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@simplesagar/vercel/core.js";
import { integrationsSearchRepos } from "@simplesagar/vercel/funcs/integrationsSearchRepos.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 integrationsSearchRepos(vercel, {});

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request models.SearchRepoRequest ✔️ 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.

Response

Promise<models.SearchRepoResponseBody>

Errors

Error Object Status Code Content Type
models.SDKError 4xx-5xx /