Menu Close

circleci-node

CircleCI API Node SDK

The CircleCI API Node SDK is a NPM library for accessing the resources that make up the CircleCI API V2.

SDK Installation

NPM

npm add circleci-v2-sdk

Yarn

yarn add circleci-v2-sdk
import { SDK, withSecurity} from "circleci-v2-sdk"; import { AddEnvironmentVariableToContextRequest, AddEnvironmentVariableToContextResponse } from "circleci-v2-sdk/src/sdk/models/operations"; import { AxiosError } from "axios"; const sdk = new SDK(withSecurity( security: { apiKeyHeader: { apiKey: "YOUR_API_KEY_HERE", }, } )); const req: AddEnvironmentVariableToContextRequest = { pathParams: { contextId: "sit", envVarName: "voluptas", }, request: { value: "culpa", }, }; sdk.context.addEnvironmentVariableToContext(req).then((res: AddEnvironmentVariableToContextResponse | AxiosError) => { // handle response });

SDK Available Operations

Context

  • addEnvironmentVariableToContext – Add or update an environment variable
  • createContext – Create a new context
  • deleteContext – Delete a context
  • deleteEnvironmentVariableFromContext – Remove an environment variable
  • getContext – Get a context
  • listContexts – List contexts
  • listEnvironmentVariablesFromContext – List environment variables

Insights

  • getAllInsightsBranches – Get all branches for a project
  • getFlakyTests – Get flaky tests for a project
  • getJobTimeseries – Job timeseries data
  • getOrgSummaryData – Get summary metrics with trends for the entire org, and for each project.
  • getProjectWorkflowJobMetrics – Get summary metrics for a project workflow’s jobs.
  • getProjectWorkflowMetrics – Get summary metrics for a project’s workflows
  • getProjectWorkflowRuns – Get recent runs of a workflow
  • getProjectWorkflowTestMetrics – Get test metrics for a project’s workflows
  • getProjectWorkflowsPageData – Get summary metrics and trends for a project across it’s workflows and branches
  • getWorkflowSummary – Get metrics and trends for workflows

Job

  • cancelJob – Cancel job
  • getJobArtifacts – Get a job’s artifacts
  • getJobDetails – Get job details
  • getTests – Get test metadata

Pipeline

  • continuePipeline – Continue a pipeline
  • getPipelineById – Get a pipeline by ID
  • getPipelineByNumber – Get a pipeline by pipeline number
  • getPipelineConfigById – Get a pipeline’s configuration
  • listMyPipelines – Get your pipelines
  • listPipelines – Get a list of pipelines
  • listPipelinesForProject – Get all pipelines
  • listWorkflowsByPipelineId – Get a pipeline’s workflows
  • triggerPipeline – Trigger a new pipeline

Project

  • createCheckoutKey – Create a new checkout key
  • createEnvVar – Create an environment variable
  • deleteCheckoutKey – Delete a checkout key
  • deleteEnvVar – Delete an environment variable
  • getCheckoutKey – Get a checkout key
  • getEnvVar – Get a masked environment variable
  • getProjectBySlug – Get a project
  • listCheckoutKeys – Get all checkout keys
  • listEnvVars – List all environment variables

Schedule

  • createSchedule – Create a schedule
  • deleteScheduleById – Delete a schedule
  • getScheduleById – Get a schedule
  • listSchedulesForProject – Get all schedules
  • updateSchedule – Update a schedule

User

  • getCollaborations – Collaborations
  • getCurrentUser – User Information
  • getUser – User Information

Webhook

  • createWebhook – Create a webhook
  • deleteWebhook – Delete a webhook
  • getWebhookById – Get a webhook
  • getWebhooks – List webhooks
  • updateWebhook – Update a webhook

Workflow

  • approvePendingApprovalJobById – Approve a job
  • cancelWorkflow – Cancel a workflow
  • getWorkflowById – Get a workflow
  • listWorkflowJobs – Get a workflow’s jobs
  • rerunWorkflow – Rerun a workflow

SDK Generated by Speakeasy

View Source Code
Posted in Development