Skip to content

Latest commit

 

History

History
431 lines (303 loc) · 22.2 KB

README.md

File metadata and controls

431 lines (303 loc) · 22.2 KB

Pipeline

(pipeline)

Available Operations

continuePipeline

Continue a pipeline from the setup phase. For information on using pipeline parameters with dynamic configuration, see the Pipeline values and parameters docs.

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.pipeline.continuePipeline({
    configuration: "<value>",
    continuationKey: "<value>",
    parameters: {
      "deploy_prod": true,
    },
  });

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

run();

Parameters

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

Response

Promise<operations.ContinuePipelineResponse>

Errors

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

getPipelineById

Returns a pipeline by the pipeline 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.pipeline.getPipelineById({
    pipelineId: "5034460f-c7c4-4c43-9457-de07e2029e7b",
  });

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

run();

Parameters

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

Response

Promise<operations.GetPipelineByIdResponse>

Errors

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

getPipelineByNumber

Returns a pipeline by the pipeline number.

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.pipeline.getPipelineByNumber({
    pipelineNumber: "123",
    projectSlug: "gh/CircleCI-Public/api-preview-docs",
  });

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

run();

Parameters

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

Response

Promise<operations.GetPipelineByNumberResponse>

Errors

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

getPipelineConfigById

Returns a pipeline's configuration by 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.pipeline.getPipelineConfigById({
    pipelineId: "5034460f-c7c4-4c43-9457-de07e2029e7b",
  });

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

run();

Parameters

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

Response

Promise<operations.GetPipelineConfigByIdResponse>

Errors

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

listMyPipelines

Returns a sequence of all pipelines for this project triggered by the user.

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.pipeline.listMyPipelines({
    projectSlug: "gh/CircleCI-Public/api-preview-docs",
  });

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

run();

Parameters

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

Response

Promise<operations.ListMyPipelinesResponse>

Errors

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

listPipelines

Returns all pipelines for the most recently built projects (max 250) you follow in an organization.

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.pipeline.listPipelines({
    orgSlug: "gh/CircleCI-Public",
  });

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

run();

Parameters

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

Response

Promise<operations.ListPipelinesResponse>

Errors

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

listPipelinesForProject

Returns all pipelines for this project.

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.pipeline.listPipelinesForProject({
    projectSlug: "gh/CircleCI-Public/api-preview-docs",
  });

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

run();

Parameters

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

Response

Promise<operations.ListPipelinesForProjectResponse>

Errors

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

listWorkflowsByPipelineId

Returns a paginated list of workflows by pipeline 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.pipeline.listWorkflowsByPipelineId({
    pipelineId: "5034460f-c7c4-4c43-9457-de07e2029e7b",
  });

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

run();

Parameters

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

Response

Promise<operations.ListWorkflowsByPipelineIdResponse>

Errors

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

triggerPipeline

Not yet available to projects that use GitLab or GitHub App. Triggers a new pipeline on the project.

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.pipeline.triggerPipeline({
    requestBody: {
      branch: "feature/design-new-api",
      parameters: {
        "deploy_prod": true,
      },
      tag: "v3.1.4159",
    },
    projectSlug: "gh/CircleCI-Public/api-preview-docs",
  });

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

run();

Parameters

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

Response

Promise<operations.TriggerPipelineResponse>

Errors

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