CircleCI
A CircleCI client for Node.js.
Installation
To install, go to your console/terminal and run:
npm install circleci
Usage
In your project, require the package:
var circleci = require("circleci");
Then you can run one of the following methods:
getUser()
API call: GET /me
Provides information about the signed in user.
Example:
circleci.getUser(function(err, user){
if (err) {
console.log(err);
} else {
console.log(user.username);
}
});
getRecentProjects()
API call: GET /projects
List of all the projects you're following on CircleCI, with build information organized by branch.
Options:
- limit - The number of builds to return. Maximum 100, defaults to 30.
- offset - The API returns builds starting from this offset, defaults to 0.
Example:
circleci.getProjects(function(err, projects){
if (err) {
console.log(err);
} else {
for (var i in projects) {
console.log(projects[i].username + "/" + projects[i].reponame);
}
}
});
getRecentProjects()
API call: GET /projects
List of all the projects you're following on CircleCI, with build information organized by branch.
Example:
circleci.getProjects(function(err, projects){
if (err) {
console.log(err);
} else {
for (var i in projects) {
console.log(projects[i].username + "/" + projects[i].reponame);
}
}
});
TODO:
Documentation:
Testing:
- Add additional tests for API methods
Include methods to wrap:
- Adding a CircleCI key to your Github User account (POST: /user/ssh-key)
- Adding a Heroku API key to CircleCI, takes apikey as form param name (POST: /user/heroku-key)
- Retrying a build using SSH (POST: /project/:username/:project/:build_num/ssh)