Skip to content

Latest commit

 

History

History
938 lines (715 loc) · 68 KB

File metadata and controls

938 lines (715 loc) · 68 KB

Environment

Overview

Available Operations

createSharedEnvVariable

Creates shared environment variable(s) for a team.

Example Usage

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

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

async function run() {
  const result = await vercel.environment.createSharedEnvVariable({
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      evs: [],
      type: "encrypted",
      target: [
        "production",
        "preview",
      ],
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { environmentCreateSharedEnvVariable } from "@vercel/sdk/funcs/environmentCreateSharedEnvVariable.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 environmentCreateSharedEnvVariable(vercel, {
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      evs: [],
      type: "encrypted",
      target: [
        "production",
        "preview",
      ],
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("environmentCreateSharedEnvVariable failed:", res.error);
  }
}

run();

Parameters

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

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

listSharedEnvVariable

Lists all Shared Environment Variables for a team, taking into account optional filters.

Example Usage

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

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

async function run() {
  const result = await vercel.environment.listSharedEnvVariable({
    projectId: "prj_2WjyKQmM8ZnGcJsPWMrHRHrE",
    ids: "env_2WjyKQmM8ZnGcJsPWMrHRHrE,env_2WjyKQmM8ZnGcJsPWMrHRCRV",
    excludeIdsQueryParameter: "env_2WjyKQmM8ZnGcJsPWMrHRHrE,env_2WjyKQmM8ZnGcJsPWMrHRCRV",
    excludeIdsQueryParameter1: "env_2WjyKQmM8ZnGcJsPWMrHRHrE,env_2WjyKQmM8ZnGcJsPWMrHRCRV",
    excludeProjectIdQueryParameter: "prj_2WjyKQmM8ZnGcJsPWMrHRHrE",
    excludeProjectIdQueryParameter1: "prj_2WjyKQmM8ZnGcJsPWMrHRHrE",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { environmentListSharedEnvVariable } from "@vercel/sdk/funcs/environmentListSharedEnvVariable.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 environmentListSharedEnvVariable(vercel, {
    projectId: "prj_2WjyKQmM8ZnGcJsPWMrHRHrE",
    ids: "env_2WjyKQmM8ZnGcJsPWMrHRHrE,env_2WjyKQmM8ZnGcJsPWMrHRCRV",
    excludeIdsQueryParameter: "env_2WjyKQmM8ZnGcJsPWMrHRHrE,env_2WjyKQmM8ZnGcJsPWMrHRCRV",
    excludeIdsQueryParameter1: "env_2WjyKQmM8ZnGcJsPWMrHRHrE,env_2WjyKQmM8ZnGcJsPWMrHRCRV",
    excludeProjectIdQueryParameter: "prj_2WjyKQmM8ZnGcJsPWMrHRHrE",
    excludeProjectIdQueryParameter1: "prj_2WjyKQmM8ZnGcJsPWMrHRHrE",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("environmentListSharedEnvVariable failed:", res.error);
  }
}

run();

Parameters

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

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

updateSharedEnvVariable

Updates a given Shared Environment Variable for a Team.

Example Usage

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

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

async function run() {
  const result = await vercel.environment.updateSharedEnvVariable({
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      updates: {
        "env_2WjyKQmM8ZnGcJsPWMrHRHrE": {
          key: "API_URL",
          value: "https://api.vercel.com",
          target: [
            "production",
            "preview",
          ],
          projectIdUpdates: {
            link: [
              "prj_2WjyKQmM8ZnGcJsPWMrHRHrE",
            ],
          },
        },
      },
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { environmentUpdateSharedEnvVariable } from "@vercel/sdk/funcs/environmentUpdateSharedEnvVariable.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 environmentUpdateSharedEnvVariable(vercel, {
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      updates: {
        "env_2WjyKQmM8ZnGcJsPWMrHRHrE": {
          key: "API_URL",
          value: "https://api.vercel.com",
          target: [
            "production",
            "preview",
          ],
          projectIdUpdates: {
            link: [
              "prj_2WjyKQmM8ZnGcJsPWMrHRHrE",
            ],
          },
        },
      },
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("environmentUpdateSharedEnvVariable failed:", res.error);
  }
}

run();

Parameters

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

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

deleteSharedEnvVariable

Deletes one or many Shared Environment Variables for a given team.

Example Usage

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

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

async function run() {
  const result = await vercel.environment.deleteSharedEnvVariable({
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      ids: [
        "env_abc123",
        "env_abc124",
      ],
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { environmentDeleteSharedEnvVariable } from "@vercel/sdk/funcs/environmentDeleteSharedEnvVariable.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 environmentDeleteSharedEnvVariable(vercel, {
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      ids: [
        "env_abc123",
        "env_abc124",
      ],
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("environmentDeleteSharedEnvVariable failed:", res.error);
  }
}

run();

Parameters

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

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

getSharedEnvVar

Retrieve the decrypted value of a Shared Environment Variable by id.

Example Usage

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

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

async function run() {
  const result = await vercel.environment.getSharedEnvVar({
    id: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { environmentGetSharedEnvVar } from "@vercel/sdk/funcs/environmentGetSharedEnvVar.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 environmentGetSharedEnvVar(vercel, {
    id: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("environmentGetSharedEnvVar failed:", res.error);
  }
}

run();

Parameters

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

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

unlinkSharedEnvVariable

Disconnects a shared environment variable for a given project

Example Usage

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

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

async function run() {
  const result = await vercel.environment.unlinkSharedEnvVariable({
    id: "<id>",
    projectId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { environmentUnlinkSharedEnvVariable } from "@vercel/sdk/funcs/environmentUnlinkSharedEnvVariable.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 environmentUnlinkSharedEnvVariable(vercel, {
    id: "<id>",
    projectId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("environmentUnlinkSharedEnvVariable failed:", res.error);
  }
}

run();

Parameters

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

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

createCustomEnvironment

Creates a custom environment for the current project. Cannot be named 'Production' or 'Preview'.

Example Usage

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

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

async function run() {
  const result = await vercel.environment.createCustomEnvironment({
    idOrName: "<value>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { environmentCreateCustomEnvironment } from "@vercel/sdk/funcs/environmentCreateCustomEnvironment.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 environmentCreateCustomEnvironment(vercel, {
    idOrName: "<value>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("environmentCreateCustomEnvironment failed:", res.error);
  }
}

run();

Parameters

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

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

getProjectsByIdOrNameCustomEnvironments

Retrieve custom environments for the project. Must not be named 'Production' or 'Preview'.

Example Usage

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

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

async function run() {
  const result = await vercel.environment.getProjectsByIdOrNameCustomEnvironments({
    idOrName: "<value>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { environmentGetProjectsByIdOrNameCustomEnvironments } from "@vercel/sdk/funcs/environmentGetProjectsByIdOrNameCustomEnvironments.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 environmentGetProjectsByIdOrNameCustomEnvironments(vercel, {
    idOrName: "<value>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("environmentGetProjectsByIdOrNameCustomEnvironments failed:", res.error);
  }
}

run();

Parameters

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

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

getCustomEnvironment

Retrieve a custom environment for the project. Must not be named 'Production' or 'Preview'.

Example Usage

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

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

async function run() {
  const result = await vercel.environment.getCustomEnvironment({
    idOrName: "<value>",
    environmentSlugOrId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { environmentGetCustomEnvironment } from "@vercel/sdk/funcs/environmentGetCustomEnvironment.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 environmentGetCustomEnvironment(vercel, {
    idOrName: "<value>",
    environmentSlugOrId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("environmentGetCustomEnvironment failed:", res.error);
  }
}

run();

Parameters

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

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

updateCustomEnvironment

Update a custom environment for the project. Must not be named 'Production' or 'Preview'.

Example Usage

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

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

async function run() {
  const result = await vercel.environment.updateCustomEnvironment({
    idOrName: "<value>",
    environmentSlugOrId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { environmentUpdateCustomEnvironment } from "@vercel/sdk/funcs/environmentUpdateCustomEnvironment.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 environmentUpdateCustomEnvironment(vercel, {
    idOrName: "<value>",
    environmentSlugOrId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("environmentUpdateCustomEnvironment failed:", res.error);
  }
}

run();

Parameters

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

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

removeCustomEnvironment

Remove a custom environment for the project. Must not be named 'Production' or 'Preview'.

Example Usage

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

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

async function run() {
  const result = await vercel.environment.removeCustomEnvironment({
    idOrName: "<value>",
    environmentSlugOrId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { environmentRemoveCustomEnvironment } from "@vercel/sdk/funcs/environmentRemoveCustomEnvironment.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 environmentRemoveCustomEnvironment(vercel, {
    idOrName: "<value>",
    environmentSlugOrId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("environmentRemoveCustomEnvironment failed:", res.error);
  }
}

run();

Parameters

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

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*