Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ env:
- secure: Z8erqjVrrwFEa8d8UXcuaTOPlEw/sf5FTEZ0rzZgb3rMdfFikb0EhfQ99WrBvgNEKczEHc0LtrepEr5/A4GCXXdr6Amuj9+Edlg04+cBbrRJwACYoydOpFppiMg718Iq++VxCEReIlRBJLn4VSPbc2l83ylcYmg++ItnCSl/hyo=
- CIRCLE_USER=jpstevens
- CIRCLE_PROJECT=circleci
- CIRCLE_VCSTYPE=github
35 changes: 29 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ ci.getBuilds({ username: "jpstevens", project: "circleci" })
#### Options
- **username** [required] - The username for the project you wish to look up
- **project** [required] - The project (repo) name you wish to look up
- **vcsType** [required] - The vcsType github or bitbucket you wish to look up
- **limit** [optional] - The number of builds to return. Maximum 100, defaults to 30)
- **offset** [optional] - The API returns builds starting from this offset, defaults to 0)
- **filter** [optional] - Show only successful/failed/running/pending builds
Expand All @@ -113,6 +114,7 @@ ci.getBranchBuilds({ username: "jpstevens", project: "circleci", branch: "master
#### Options
- **username** [required] - The username for the project you wish to look up
- **project** [required] - The project (repo) name you wish to look up
- **vcsType** [required] - The vcsType github or bitbucket you wish to look up
- **branch** [required] - The branch name you wish to use as filter
- **limit** [optional] - The number of builds to return. Maximum 100, defaults to 30)
- **offset** [optional] - The API returns builds starting from this offset, defaults to 0)
Expand All @@ -128,6 +130,7 @@ Full details for a single build. The response includes all of the fields from th
ci.getBuild({
username: "jpstevens",
project: "circleci",
vcsType: "github",
build_num: 1
}).then(function(build){
console.log(build);
Expand All @@ -137,6 +140,7 @@ ci.getBuild({
#### Options
- **username** [required] - The username for the project you wish to look up
- **project** [required] - The project (repo) name you wish to look up
- **vcsType** [required] - The vcsType github or bitbucket you wish to look up
- **build_num** [required] - CircleCI build number

### startBuild
Expand All @@ -149,6 +153,7 @@ Triggers a new build, returns a summary of the build.
ci.startBuild({
username: "jpstevens",
project: "circleci",
vcsType: "github",
branch: "master"
}).then(function(build){
console.log(build);
Expand All @@ -158,6 +163,7 @@ ci.startBuild({
#### Options
- **username** [required] - The username for the project
- **project** [required] - The project (repo) name
- **vcsType** [required] - The vcsType github or bitbucket
- **branch** [required] - The branch you wish to start the build for
- **options** [optional] - Additional parameters you can pass in

Expand All @@ -167,17 +173,20 @@ ci.startBuild({
ci.startBuild({
username: "jpstevens",
project: "circleci",
vcsType: "github",
branch: "master",
body:
parallel: null
revision: null
build_parameters:
NODE_ENV: "production"
body:{
parallel: null,
revision: null,
build_parameters:{
NODE_ENV: "production",
FOO: "bar"
}
}
}).then(function(build){
console.log(build);
});
```
```

### cancelBuild

Expand All @@ -189,6 +198,7 @@ Cancels the build, returns a summary of the build.
ci.cancelBuild({
username: "jpstevens",
project: "circleci",
vcsType: "github",
build_num: 1
}).then(function(build){
console.log(build);
Expand All @@ -197,6 +207,7 @@ ci.cancelBuild({
#### Options
- **username** [required] - The username for the project you wish to look up
- **project** [required] - The project (repo) name you wish to look up
- **vcsType** [required] - The vcsType github or bitbucket you wish to look up
- **build_num** [required] - CircleCI build number

### retryBuild
Expand All @@ -207,6 +218,7 @@ ci.cancelBuild({
ci.retryBuild({
username: "jpstevens",
project: "circleci",
vcsType: "github",
build_num: 1
}).then(function(build){
console.log(build);
Expand All @@ -216,6 +228,7 @@ ci.retryBuild({
#### Options
- **username** [required] - The username for the project you wish to look up
- **project** [required] - The project (repo) name you wish to look up
- **vcsType** [required] - The vcsType github or bitbucket you wish to look up
- **build_num** [required] - CircleCI build number

### getBuildArtifacts
Expand All @@ -228,6 +241,7 @@ List the artifacts produced by a given build.
ci.getBuildArtifacts({
username: "jpstevens",
project: "circleci",
vcsType: "github",
build_num: 1
}).then(function(artifacts){
console.log(artifacts); // logs an array of artifacts
Expand All @@ -237,6 +251,7 @@ ci.getBuildArtifacts({
#### Options
- **username** [required] - The username for the project you wish to look up
- **project** [required] - The project (repo) name you wish to look up
- **vcsType** [required] - The vcsType github or bitbucket you wish to look up
- **build_num** [required] - CircleCI build number


Expand All @@ -258,6 +273,7 @@ ci.clearBuildCache({
#### Options
- **username** [required] - The username for the project you wish to look up
- **project** [required] - The project (repo) name you wish to look up
- **vcsType** [required] - The vcsType github or bitbucket you wish to look up


### getEnvVars
Expand All @@ -278,6 +294,7 @@ ci.getEnvVars({
#### Options
- **username** [required] - The username for the project you wish to look up
- **project** [required] - The project (repo) name you wish to look up
- **vcsType** [required] - The vcsType github or bitbucket you wish to look up


### getEnvVar
Expand All @@ -290,6 +307,7 @@ Get a single environment variable for a project by name
ci.getEnvVar({
username: "jpstevens",
project: "circleci",
vcsType: "github",
name: "NPM_TOKEN"
}).then(function(envvar){
console.log(envvar); // logs an object with the environment variable
Expand All @@ -299,6 +317,7 @@ ci.getEnvVar({
#### Options
- **username** [required] - The username for the project you wish to look up
- **project** [required] - The project (repo) name you wish to look up
- **vcsType** [required] - The vcsType github or bitbucket you wish to look up
- **name** [required] - The name of the environment variable you wish to look up


Expand All @@ -312,6 +331,7 @@ Set a environment variable for a project by name and value
ci.setEnvVar({
username: "jpstevens",
project: "circleci",
vcsType: "github",
body: {
name: "NPM_TOKEN",
value: "123-456-789",
Expand All @@ -324,6 +344,7 @@ ci.setEnvVar({
#### Options
- **username** [required] - The username for the project you wish to add the environment variable to
- **project** [required] - The project (repo) name you wish to add the environment variable to
- **vcsType** [required] - The vcsType github or bitbucket you wish to add the environment variable to
- **body** [required] - Object with the `name` and the `value` of the environment variable you wish to add to the project

### deleteEnvVar
Expand All @@ -336,6 +357,7 @@ Delete an environment variable from a project by name
ci.deleteEnvVar({
username: "jpstevens",
project: "circleci",
vcsType: "github",
name: "NPM_TOKEN"
}).then(function(envvar){
console.log(envvar); // logs an object with status of the deletion
Expand All @@ -345,6 +367,7 @@ ci.deleteEnvVar({
#### Options
- **username** [required] - The username for the project you wish to delete the environment variable from
- **project** [required] - The project (repo) name you wish to delete the environment variable from
- **vcsType** [required] - The vcsType github or bitbucket you wish to delete the environment variable from
- **name** [required] - The name of the environment variable you wish to delete from the project


Expand Down
2 changes: 1 addition & 1 deletion src/circleci-request.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CircleCIResponse = require "./circleci-response"
class CircleCIRequest

constructor: (config = {}) ->
@url = "https://circleci.com/api/v1/"
@url = "https://circleci.com/api/v1.1/"
@auth = config.auth
@request = require "request"

Expand Down
26 changes: 13 additions & 13 deletions src/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"getBuilds": {
"method": "GET",
"path": "\/project\/:username\/:project",
"path": "\/project\/:vcsType\/:username\/:project",
"options": [
"limit",
"offset",
Expand All @@ -26,55 +26,55 @@
},
"getBranchBuilds": {
"method": "GET",
"path": "\/project\/:username\/:project\/tree\/:branch",
"path": "\/project\/:vcsType\/:username\/:project\/tree\/:branch",
"options": [
"limit",
"offset",
"filter"
]
},
"getBuild": {
"path": "\/project\/:username\/:project\/:build_num",
"path": "\/project\/:vcsType\/:username\/:project\/:build_num",
"method": "GET"
},
"startBuild": {
"path": "\/project\/:username\/:project\/tree\/:branch",
"path": "\/project\/:vcsType\/:username\/:project\/tree\/:branch",
"method": "POST"
},
"cancelBuild": {
"path": "\/project\/:username\/:project\/:build_num\/cancel",
"path": "\/project\/:vcsType\/:username\/:project\/:build_num\/cancel",
"method": "POST"
},
"retryBuild": {
"path": "\/project\/:username\/:project\/:build_num\/retry",
"path": "\/project\/:vcsType\/:username\/:project\/:build_num\/retry",
"method": "POST"
},
"getBuildArtifacts": {
"path": "\/project\/:username\/:project\/:build_num\/artifacts",
"path": "\/project\/:vcsType\/:username\/:project\/:build_num\/artifacts",
"method": "GET"
},
"clearBuildCache": {
"path": "\/project\/:username\/:project\/build-cache",
"path": "\/project\/:vcsType\/:username\/:project\/build-cache",
"method": "DELETE"
},
"getTestMetadata": {
"path": "\/project\/:username\/:project\/:build_num\/tests",
"path": "\/project\/:vcsType\/:username\/:project\/:build_num\/tests",
"method": "GET"
},
"getEnvVars": {
"path": "\/project\/:username\/:project\/envvar",
"path": "\/project\/:vcsType\/:username\/:project\/envvar",
"method": "GET"
},
"getEnvVar": {
"path": "\/project\/:username\/:project\/envvar\/:name",
"path": "\/project\/:vcsType\/:username\/:project\/envvar\/:name",
"method": "GET"
},
"setEnvVar": {
"path": "\/project\/:username\/:project\/envvar",
"path": "\/project\/:vcsType\/:username\/:project\/envvar",
"method": "POST"
},
"deleteEnvVar": {
"path": "\/project\/:username\/:project\/envvar\/:name",
"path": "\/project\/:vcsType\/:username\/:project\/envvar\/:name",
"method": "DELETE"
}
}
2 changes: 1 addition & 1 deletion tests/helpers/api-helper.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
request = require "request"

baseUrl = "https://circleci.com/api/v1/project"
baseUrl = "https://circleci.com/api/v1.1/project"
projectUrl = "#{baseUrl}/#{process.env.CIRCLE_USER}/#{process.env.CIRCLE_PROJECT}"

exports.createBuild = (callback) ->
Expand Down
1 change: 1 addition & 0 deletions tests/integration/cancel-build-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe "cancelBuild", ->
@config =
username: process.env.CIRCLE_USER
project: process.env.CIRCLE_PROJECT
vcsType: process.env.CIRCLE_VCSTYPE
build_num: build_num
next()

Expand Down
1 change: 1 addition & 0 deletions tests/integration/clear-build-cache.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe "clearBuildCache", ->
@config =
username: process.env.CIRCLE_USER
project: process.env.CIRCLE_PROJECT
vcsType: process.env.CIRCLE_VCSTYPE

it "clears the build cache", (done) ->

Expand Down
1 change: 1 addition & 0 deletions tests/integration/delete-env-var-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe "deleteEnvVar", ->
@config =
username: process.env.CIRCLE_USER
project: process.env.CIRCLE_PROJECT
vcsType: process.env.CIRCLE_VCSTYPE
name: 'TEST_ENV_VAR'

it "returns an object of the status of deleting an env var for a given project", (done) ->
Expand Down
1 change: 1 addition & 0 deletions tests/integration/get-branch-builds-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe "getBranchBuilds", ->
@config =
username: process.env.CIRCLE_USER
project: process.env.CIRCLE_PROJECT
vcsType: process.env.CIRCLE_VCSTYPE
branch: "master"
limit: 1

Expand Down
1 change: 1 addition & 0 deletions tests/integration/get-build-artifacts-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe "getBuildArtifacts", ->
@config =
username: process.env.CIRCLE_USER
project: process.env.CIRCLE_PROJECT
vcsType: process.env.CIRCLE_VCSTYPE
build_num: "7"

it "returns the build artifacts", (done) ->
Expand Down
1 change: 1 addition & 0 deletions tests/integration/get-build-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe "getBuild", ->
@config =
username: process.env.CIRCLE_USER
project: process.env.CIRCLE_PROJECT
vcsType: process.env.CIRCLE_VCSTYPE
build_num: "7"

it "returns the build", (done) ->
Expand Down
1 change: 1 addition & 0 deletions tests/integration/get-builds-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe "getBuilds", ->
@config =
username: process.env.CIRCLE_USER
project: process.env.CIRCLE_PROJECT
vcsType: process.env.CIRCLE_VCSTYPE
limit: 1

it "returns an array of builds for a given project", (done) ->
Expand Down
1 change: 1 addition & 0 deletions tests/integration/get-env-var-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe "getEnvVar", ->
@config =
username: process.env.CIRCLE_USER
project: process.env.CIRCLE_PROJECT
vcsType: process.env.CIRCLE_VCSTYPE
name: process.env.CIRCLE_USER

it "returns an object of a given env var for a given project", (done) ->
Expand Down
1 change: 1 addition & 0 deletions tests/integration/get-env-vars-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe "getEnvVars", ->
@config =
username: process.env.CIRCLE_USER
project: process.env.CIRCLE_PROJECT
vcsType: process.env.CIRCLE_VCSTYPE

it "returns an array of the env vars for a given project", (done) ->

Expand Down
1 change: 1 addition & 0 deletions tests/integration/get-test-metadata-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe "getTestMetadata", ->
@config =
username: process.env.CIRCLE_USER
project: process.env.CIRCLE_PROJECT
vcsType: process.env.CIRCLE_VCSTYPE
build_num: "7"

it "returns an array of the test metadata for a given build", (done) ->
Expand Down
1 change: 1 addition & 0 deletions tests/integration/retry-build-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe "retryBuild", ->
@config =
username: process.env.CIRCLE_USER
project: process.env.CIRCLE_PROJECT
vcsType: process.env.CIRCLE_VCSTYPE
build_num: "7"

it "retries the build", (done) ->
Expand Down
1 change: 1 addition & 0 deletions tests/integration/set-env-var-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe "setEnvVar", ->
@config =
username: process.env.CIRCLE_USER
project: process.env.CIRCLE_PROJECT
vcsType: process.env.CIRCLE_VCSTYPE
body:
name: 'TEST_ENV_VAR'
value: 'TEST_ENV_VALUE'
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/start-build-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ describe "startBuild", ->
@config =
username: process.env.CIRCLE_USER
project: process.env.CIRCLE_PROJECT
vcsType: process.env.CIRCLE_VCSTYPE
vcsType: process.env.CIRCLE_VCSTYPE
branch: process.env.CIRCLE_BRANCH or "master"
body:
parallel: null
Expand Down
Loading