Skip to content

Latest commit

 

History

History
143 lines (97 loc) · 5.38 KB

File metadata and controls

143 lines (97 loc) · 5.38 KB

User

(user)

Available Operations

getCollaborations

Provides the set of organizations of which a user is a member or a collaborator.

The set of organizations that a user can collaborate on is composed of:

  • Organizations that the current user belongs to across VCS types (e.g. BitBucket, GitHub)
  • The parent organization of repository that the user can collaborate on, but is not necessarily a member of
  • The organization of the current user's account

Example Usage

import { Circleci } from "circleci-v2-sdk";

async function run() {
  const sdk = new Circleci({
    security: {
      apiKeyHeader: "<YOUR_API_KEY_HERE>",
    },
  });

  const res = await sdk.user.getCollaborations();

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.GetCollaborationsResponse>

Errors

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

getCurrentUser

Provides information about the user that is currently signed in.

Example Usage

import { Circleci } from "circleci-v2-sdk";

async function run() {
  const sdk = new Circleci({
    security: {
      apiKeyHeader: "<YOUR_API_KEY_HERE>",
    },
  });

  const res = await sdk.user.getCurrentUser();

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.GetCurrentUserResponse>

Errors

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

getUser

Provides information about the user with the given ID.

Example Usage

import { Circleci } from "circleci-v2-sdk";

async function run() {
  const sdk = new Circleci({
    security: {
      apiKeyHeader: "<YOUR_API_KEY_HERE>",
    },
  });

  const res = await sdk.user.getUser({
    id: "bf29e4e9-96b2-49f6-8980-3bb87b43bd7e",
  });

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetUserRequest ✔️ The request object to use for the request.
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.GetUserResponse>

Errors

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