
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
circle-client
Advanced tools
A JavaScript client for CircleCI's v2 API.
First, go and get a CircleCI API Token.
Then all you need to do is import the client class and instantiate it with your token and optionally a project slug and default branch:
import CircleCI from 'circle-client';
const client = new CircleCI('2c818264d2557cd14b9fc3fa538df6ecbc6489f3', {
// this could also be "github/owner/repo"
slug: ['github', 'owner', 'repo'],
// methods that take a branch arg can override this
branch: 'main',
});
Your project slug consists of:
github
or bitbucket
)Below is a summary list of available methods. Check out the main client file for fully-typed method signatures.
Paginated results: any method that begins with list
returns a Paged<T>
object, with an items
property containing the API results, and a next_page_token
property. If next_page_token
is set, you can use it to call the method again with the pageToken
argument set to that value to retrieve the next page of results.
listContexts
- List all contexts for an owner.createContext
- Create a new context.deleteContext
- Delete a context.listContextEnvVars
- List information about environment variables in a context, not including their values.createContextEnvVar
- Create or update an environment variable within a context.deleteContextEnvVar
- Delete an environment variable from a context.listWorkflowMetrics
- Get summary metrics for a project's workflows.listWorkflowRuns
- Get recent runs of a workflow.listWorkflowJobMetrics
- Get summary metrics for a project workflow's jobs.listWorkflowJobRuns
- Get recent runs of a job within a workflow.š§ This set of endpoints are listed as Preview and may change without warning.
getMe
- Information about the user that is currently signed in.getCollaborations
- Provides the set of organizations of which the currently signed in user is a member or a collaborator.getUser
- Information about the user with the given ID.listPipelines
- Returns all pipelines for the most recently built projects you follow in an organization.getPipeline
- Returns a pipeline by ID.getPipelineConfig
- Returns a pipeline's configuration by ID.listPipelineWorkflows
- Returns a paginated list of workflows by pipeline ID.triggerProjectPipeline
- Triggers a new pipeline on the project.listProjectPipelines
- Returns all pipelines for this project.listOwnProjectPipelines
- Returns a sequence of all pipelines for this project triggered by the user.getProjectPipeline
- Returns a pipeline by number.š§ This set of endpoints are listed as Preview and may change without warning.
getJob
- Returns job details.cancelJob
- Cancel job with a given job number.listJobArtifacts
- Returns a job's artifacts.listJobTests
- Get test metadata for a build.getWorkflow
- Returns summary fields of a workflow by ID.approveWorkflowJob
- Approves a pending approval job in a workflow.cancelWorkflow
- Cancels a running workflow.listWorkflowJobs
- Returns a sequence of jobs for a workflow.rerunWorkflow
- Reruns a workflow.getProject
- Retrieves a project by project slug.listCheckoutKeys
- Returns a sequence of checkout keys for the project.createCheckoutKey
- Creates a new checkout key.deleteCheckoutKey
- Deletes the checkout key.getCheckoutKey
- Returns an individual checkout key.listEnvVars
- List all environment variables (masked).createEnvVar
- Creates a new environment variable.deleteEnvVar
- Deletes the environment variable named.getEnvVar
- Returns the masked value of an environment variable.downloadArtifact
- Download a job artifact and save it to disk.In addition to Fetch errors, the following errors can occur:
ProjectSlugError
if one is not set when the method is called.APIError
will be thrown. The object contains a message
(which might be generated by the client or the API), status
, and the response
object of the Fetch request.ArgumentError
if an invalid set of arguments is provided that cannot be caught by TypeScript.Development is pretty straightforward:
yarn build
to generate a new distribution build.yarn lint
and yarn format
are also available and do exactly what they say.Run tests:
yarn test
(optionally with --watchAll
)Run the CircleCI test job locally:
circleci config validate
circleci config process .circleci/config.yml > .circleci/local.yml
circleci local execute -c .circleci/local.yml --job test
FAQs
A JavaScript client for CircleCI v2 API
The npm package circle-client receives a total of 836 weekly downloads. As such, circle-client popularity was classified as not popular.
We found that circle-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.