Skip to content

Latest commit

 

History

History
238 lines (164 loc) · 24.1 KB

README.md

File metadata and controls

238 lines (164 loc) · 24.1 KB

ProjectMembers

(projectMembers)

Overview

Available Operations

  • get - List project members
  • add - Adds a new member to a project.
  • remove - Remove a Project Member

get

Lists all members of a project.

Example Usage

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

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

async function run() {
  const result = await vercel.projectMembers.get({
    idOrName: "prj_pavWOn1iLObbXLRiwVvzmPrTWyTf",
  });
  
  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

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

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

  const { value: result } = res;

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

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 Object Status Code Content Type
models.SDKError 4xx-5xx /

add

Adds a new member to the project.

Example Usage

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

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

async function run() {
  const result = await vercel.projectMembers.add("prj_pavWOn1iLObbXLRiwVvzmPrTWyTf");
  
  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

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

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description Example
idOrName string ✔️ The ID or name of the Project. [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.
requestBody models.AddProjectMemberRequestBody N/A
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 Object Status Code Content Type
models.SDKError 4xx-5xx /

remove

Remove a member from a specific project

Example Usage

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

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

async function run() {
  const result = await vercel.projectMembers.remove("prj_pavWOn1iLObbXLRiwVvzmPrTWyTf", "ndlgr43fadlPyCtREAqxxdyFK");
  
  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

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

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description Example
idOrName string ✔️ The ID or name of the Project. [object Object]
uid string ✔️ The user ID of the member. [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.RemoveProjectMemberResponseBody>

Errors

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