A Node.js API client for Wercker.
npm install wercker-client --save
var Wercker = require('wercker-client').default;
var wercker = new Wercker({
token: 'your_token'
});
List all applications owned by the user or organization.
wercker.Application
.listUserApplications({
username: "your_application_owner_name",
limit: 10
}).then((res) => {
console.log(res);
});
Name | Description |
---|---|
username | Required The name of user or organization. |
stac | Optional Stack used by application. Currently supported: 1 (classic), 5 (Docker enabled) |
limit | Optional Limit the results that will get returned. Default: 20. Min: 1. Max: 100. |
skip | Optional Skip a certain amount of builds. |
sort | Optional Sort builds using this key. Default: nameAsc. Possible values: nameAsc, nameDesc, createdAtAsc, createdAtDesc, updatedAtAsc, updatedAtDesc. |
Get the last 20 runs for a given pipeline or application.
wercker.Runs
.getAllRuns({applicationId: "your_application_id"})
.then((res) => {
console.log(res);
});
Either applicationId or pipelineId must be specified.
Name | type | Description |
---|---|---|
applicationId | String | Optional The id of the application. |
limit | Integer | Optional Specify how many run objects should be returned. Max: 20, default: 20 |
skip | Integer | Optional Skip the first X runs. Min: 1, default: 0 |
sort | String | Optional Valid values: creationDateAsc or creationDateDesc. Default creationDateDesc |
status | String | Optional Filter by status. Valid values: notstarted, started, finished, running |
result | String | Optional Filter by result. Valid values: aborted, unknown, passed, failed |
branch | String | Optional Filter by branch |
pipelineId | String | Optional Filter by pipeline |
commit | String | Optional Filter by commit hash |
sourceRun | String | Optional Filter by source run |
author | String | Optional Filter by Wercker username |
Trigger a new run for an application.
wercker.Runs
.triggerNewRun({
pipelineId: "your_pipeline_id",
branch: "branch_name"
}).then((res) => {
console.log(res);
})
Name | type | Description |
---|---|---|
pipelineId | String | Required The id of the pipeline for which a run should be triggered. |
sourceRunId | String | Optional The id of the run that should be used as input for this run, including artifacts. This |
branch | String | Optional The Git branch that the run should use. If not specified, the default branch will be used. |
commitHash | String | Optional The Git commit hash that the run should used. Requires branch to be set. If not |
message | String | Optional The message to use for the run. If not specified, the Git commit message is used. |
envVars | Array of objects | Optional Environment variables which should be added to run. Contains objects with keyand value properties. |
Get the last 10 workflows.
wercker.Workflows
.getAllWorkflows({applicationId: "your_application_id"})
.then((res) => {
console.log(res);
});
Name | type | Description |
---|---|---|
applicationId | String | Required The id of the application. |
limit | Integer | Optional Specify how many workflow objects should be returned. Max: 20, default: 10 |
skip | Integer | Optional Skip the first X runs. Min: 0, default: 0 |
sort | String | Optional Valid values: creationDateAsc or creationDateDesc. Default creationDateDesc |
Get the details of a single workflow.
wercker.Workflows
.getWorkflow({workflowId: "your_workflow_id"})
.then((res) => {
console.log(res);
});
Name | type | Description |
---|---|---|
workflowId | String | Required The id of the workflow. |
Contributions are always welcome!
wercker-client is available under the MIT license. See the LICENSE file for more info.