0.0.4 • Published 7 years ago

wercker-client v0.0.4

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

wercker-client

License npm version

Overview

A Node.js API client for Wercker.

Installation

npm install wercker-client --save

Usage

var Wercker = require('wercker-client').default;
var wercker = new Wercker({
  token: 'your_token'
});

Available Methods

Applications

listUserApplications

List all applications owned by the user or organization.

Example Usage
wercker.Application
  .listUserApplications({
    username: "your_application_owner_name",
    limit: 10
  }).then((res) => {
    console.log(res);
  });
Options
NameDescription
usernameRequired The name of user or organization.
stacOptional Stack used by application. Currently supported: 1 (classic), 5 (Docker enabled)
limitOptional Limit the results that will get returned. Default: 20. Min: 1. Max: 100.
skipOptional Skip a certain amount of builds.
sortOptional Sort builds using this key. Default: nameAsc. Possible values: nameAsc, nameDesc, createdAtAsc, createdAtDesc, updatedAtAsc, updatedAtDesc.

Runs

getAllRuns

Get the last 20 runs for a given pipeline or application.

Example Usage
wercker.Runs
  .getAllRuns({applicationId: "your_application_id"})
  .then((res) => {
    console.log(res);
  });
Options

Either applicationId or pipelineId must be specified.

NametypeDescription
applicationIdStringOptional The id of the application.
limitIntegerOptional Specify how many run objects should be returned. Max: 20, default: 20
skipIntegerOptional Skip the first X runs. Min: 1, default: 0
sortStringOptional Valid values: creationDateAsc or creationDateDesc. Default creationDateDesc
statusStringOptional Filter by status. Valid values: notstarted, started, finished, running
resultStringOptional Filter by result. Valid values: aborted, unknown, passed, failed
branchStringOptional Filter by branch
pipelineIdStringOptional Filter by pipeline
commitStringOptional Filter by commit hash
sourceRunStringOptional Filter by source run
authorStringOptional Filter by Wercker username

triggerNewRun

Trigger a new run for an application.

Example Usage
wercker.Runs
  .triggerNewRun({
    pipelineId: "your_pipeline_id",
    branch: "branch_name"
  }).then((res) => {
    console.log(res);
  })
Options
NametypeDescription
pipelineIdStringRequired The id of the pipeline for which a run should be triggered.
sourceRunIdStringOptional The id of the run that should be used as input for this run, including artifacts. Thisis the same as chaining a pipeline.
branchStringOptional The Git branch that the run should use. If not specified, the default branch will be used.
commitHashStringOptional The Git commit hash that the run should used. Requires branch to be set. If notspecified, the latest commit is fetched
messageStringOptional The message to use for the run. If not specified, the Git commit message is used.
envVarsArray of objectsOptional Environment variables which should be added to run. Contains objects with keyand value properties.

Workflows

getAllWorkflows

Get the last 10 workflows.

Example Usage
wercker.Workflows
  .getAllWorkflows({applicationId: "your_application_id"})
  .then((res) => {
    console.log(res);
  });
Options
NametypeDescription
applicationIdStringRequired The id of the application.
limitIntegerOptional Specify how many workflow objects should be returned. Max: 20, default: 10
skipIntegerOptional Skip the first X runs. Min: 0, default: 0
sortStringOptional Valid values: creationDateAsc or creationDateDesc. Default creationDateDesc

getWorkflow

Get the details of a single workflow.

Example Usage
wercker.Workflows
  .getWorkflow({workflowId: "your_workflow_id"})
  .then((res) => {
    console.log(res);
  });
Options
NametypeDescription
workflowIdStringRequired The id of the workflow.

Contribute

Contributions are always welcome!

License

wercker-client is available under the MIT license. See the LICENSE file for more info.

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

8 years ago

0.0.1

8 years ago