(workflow)
- approvePendingApprovalJobById - Approve a job
- cancelWorkflow - Cancel a workflow
- getWorkflowById - Get a workflow
- listWorkflowJobs - Get a workflow's jobs
- rerunWorkflow - Rerun a workflow
Approves a pending approval job in a workflow.
import { Circleci } from "circleci-v2-sdk";
async function run() {
const sdk = new Circleci({
security: {
apiKeyHeader: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.workflow.approvePendingApprovalJobById({
approvalRequestId: "afd4e8a2-73f4-4706-8fed-d209a62dd146",
id: "5034460f-c7c4-4c43-9457-de07e2029e7b",
});
if (res.statusCode == 200) {
// handle response
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.ApprovePendingApprovalJobByIdRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.ApprovePendingApprovalJobByIdResponse>
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
Cancels a running workflow.
import { Circleci } from "circleci-v2-sdk";
async function run() {
const sdk = new Circleci({
security: {
apiKeyHeader: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.workflow.cancelWorkflow({
id: "5034460f-c7c4-4c43-9457-de07e2029e7b",
});
if (res.statusCode == 200) {
// handle response
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CancelWorkflowRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.CancelWorkflowResponse>
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
Returns summary fields of a workflow by ID.
import { Circleci } from "circleci-v2-sdk";
async function run() {
const sdk = new Circleci({
security: {
apiKeyHeader: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.workflow.getWorkflowById({
id: "5034460f-c7c4-4c43-9457-de07e2029e7b",
});
if (res.statusCode == 200) {
// handle response
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetWorkflowByIdRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.GetWorkflowByIdResponse>
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
Returns a sequence of jobs for a workflow.
import { Circleci } from "circleci-v2-sdk";
async function run() {
const sdk = new Circleci({
security: {
apiKeyHeader: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.workflow.listWorkflowJobs({
id: "5034460f-c7c4-4c43-9457-de07e2029e7b",
});
if (res.statusCode == 200) {
// handle response
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.ListWorkflowJobsRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.ListWorkflowJobsResponse>
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
Reruns a workflow.
import { Circleci } from "circleci-v2-sdk";
async function run() {
const sdk = new Circleci({
security: {
apiKeyHeader: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.workflow.rerunWorkflow({
requestBody: {
enableSsh: false,
fromFailed: false,
jobs: [
"c65b68ef-e73b-4bf2-be9a-7a322a9df150",
"5e957edd-5e8c-4985-9178-5d0d69561822",
],
sparseTree: false,
},
id: "5034460f-c7c4-4c43-9457-de07e2029e7b",
});
if (res.statusCode == 200) {
// handle response
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.RerunWorkflowRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.RerunWorkflowResponse>
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |