Skip to content

Latest commit

 

History

History
260 lines (197 loc) · 18.4 KB

File metadata and controls

260 lines (197 loc) · 18.4 KB

ProjectMembers

Overview

Available Operations

getProjectMembers

Lists all members of a project.

Example Usage

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

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

async function run() {
  const result = await vercel.projectMembers.getProjectMembers({
    idOrName: "prj_pavWOn1iLObbXLRiwVvzmPrTWyTf",
    limit: 20,
    since: 1540095775951,
    until: 1540095775951,
    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 { projectMembersGetProjectMembers } from "@vercel/sdk/funcs/projectMembersGetProjectMembers.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 projectMembersGetProjectMembers(vercel, {
    idOrName: "prj_pavWOn1iLObbXLRiwVvzmPrTWyTf",
    limit: 20,
    since: 1540095775951,
    until: 1540095775951,
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("projectMembersGetProjectMembers failed:", res.error);
  }
}

run();

Parameters

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

Errors

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

addProjectMember

Adds a new member to the project.

Example Usage

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

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

async function run() {
  const result = await vercel.projectMembers.addProjectMember({
    idOrName: "prj_pavWOn1iLObbXLRiwVvzmPrTWyTf",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      uid: "ndlgr43fadlPyCtREAqxxdyFK",
      username: "example",
      email: "entity@example.com",
      role: "ADMIN",
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { projectMembersAddProjectMember } from "@vercel/sdk/funcs/projectMembersAddProjectMember.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 projectMembersAddProjectMember(vercel, {
    idOrName: "prj_pavWOn1iLObbXLRiwVvzmPrTWyTf",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      uid: "ndlgr43fadlPyCtREAqxxdyFK",
      username: "example",
      email: "entity@example.com",
      role: "ADMIN",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("projectMembersAddProjectMember failed:", res.error);
  }
}

run();

Parameters

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

Errors

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

removeProjectMember

Remove a member from a specific project

Example Usage

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

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

async function run() {
  const result = await vercel.projectMembers.removeProjectMember({
    idOrName: "prj_pavWOn1iLObbXLRiwVvzmPrTWyTf",
    uid: "ndlgr43fadlPyCtREAqxxdyFK",
    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 { projectMembersRemoveProjectMember } from "@vercel/sdk/funcs/projectMembersRemoveProjectMember.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 projectMembersRemoveProjectMember(vercel, {
    idOrName: "prj_pavWOn1iLObbXLRiwVvzmPrTWyTf",
    uid: "ndlgr43fadlPyCtREAqxxdyFK",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("projectMembersRemoveProjectMember failed:", res.error);
  }
}

run();

Parameters

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

Errors

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