buddyworksapi
Advanced tools
Comparing version 1.0.8 to 1.0.10
@@ -109,2 +109,22 @@ /** | ||
/** | ||
* @param {String} accessToken | ||
* @param {Function} done | ||
*/ | ||
You.prototype.getIntegrations = function(accessToken, done){ | ||
this.client.getJson(accessToken, this.client.createUrl('/user/integrations'), done); | ||
}; | ||
/** | ||
* @param {String} accessToken | ||
* @param {Number} integrationId | ||
* @param {Function} done | ||
*/ | ||
You.prototype.getIntegration = function(accessToken, integrationId, done){ | ||
this.client.getJson(accessToken, this.client.createUrl('/user/integrations/:integration_id', { | ||
'integration_id': integrationId | ||
}), done); | ||
}; | ||
module.exports = You; |
@@ -26,5 +26,6 @@ /** | ||
this.SCOPE_REPOSITORY_WRITE = 'REPOSITORY_WRITE';//Permission to write in the repository. File deletion is allowed, too (contains REPOSITORY_READ rights). | ||
this.SCOPE_RELEASE_INFO = 'RELEASE_INFO';//Access to release history. | ||
this.SCOPE_RELEASE_RUN = 'RELEASE_RUN';//Permission to run and stop releases (contains RELEASE_INFO rights). | ||
this.SCOPE_RELEASE_MANAGE = 'RELEASE_MANAGE';//Permission to add/edit release scenarios (contains RELEASE_RUN rights). | ||
this.SCOPE_EXECUTION_INFO = 'EXECUTION_INFO';//Access to executions history. | ||
this.SCOPE_EXECUTION_RUN = 'EXECUTION_RUN';//Permission to run and stop executions (contains EXECUTION_INFO rights). | ||
this.SCOPE_EXECUTION_MANAGE = 'EXECUTION_MANAGE';//Permission to add/edit pipelines (contains EXECUTION_RUN rights). | ||
this.SCOPE_INTEGRATION_INFO = 'INTEGRATION_INFO';//Access to integration list of authorized user. | ||
this.SCOPE_USER_INFO = 'USER_INFO';//Access to base information of authorized user. | ||
@@ -31,0 +32,0 @@ this.SCOPE_USER_KEY = 'USER_KEY';//Access to public SSH keys of authorized user (contains USER_INFO rights). |
{ | ||
"name": "buddyworksapi", | ||
"version": "1.0.8", | ||
"version": "1.0.10", | ||
"author": "Buddy Works", | ||
@@ -17,3 +17,3 @@ "description": "Buddy Works APIs Client Library for Node.js", | ||
"engines": { | ||
"node": ">=0.10" | ||
"node": ">=4" | ||
}, | ||
@@ -43,6 +43,5 @@ "main": "./lib/buddyworksapi", | ||
"lint": "jshint lib test", | ||
"test": "mocha --reporter spec --timeout 4000", | ||
"prepare": "npm test && npm run lint && npm version patch" | ||
"test": "mocha --reporter spec --timeout 4000" | ||
}, | ||
"license": "Apache-2.0" | ||
} |
117
README.md
# Buddy Works APIs Node.js Client | ||
Buddy's officially supported node.js client library. | ||
Official Node.js client library for [Buddy Continuous Integration](https://buddy.works) tool. | ||
@@ -14,5 +14,5 @@ [](https://api.travis-ci.org/buddy-works/buddy-works-node-api) | ||
## Usage of OAUTH | ||
## Usage of OAauth | ||
First you need to add application in your [Buddy ID](https://app.buddy.works/my-apps). | ||
First, you need to add the application in your [Buddy ID](https://app.buddy.works/my-apps). | ||
@@ -26,3 +26,3 @@ You will then obtain clientId & clientSecret to execute this code: | ||
Next you can get authorize url: | ||
Next you can get AuthorizeUrl: | ||
@@ -32,16 +32,12 @@ ```javascript | ||
``` | ||
scopes is array of strings - [help](https://buddy.works/api/reference/getting-started/oauth#supported-scopes) | ||
`scopes` are arrays of strings - [help](https://buddy.works/api/reference/getting-started/oauth#supported-scopes) | ||
state should be an unguessable random string. It is used to protect against cross-site request forgery attacks. | ||
`state` should be an unguessable random string. It is used to protect against cross-site request forgery attacks. | ||
redirectUrl is optional [more](https://buddy.works/api/reference/getting-started/oauth#web-application-flow) | ||
`redirectUrl` is optional [more](https://buddy.works/api/reference/getting-started/oauth#web-application-flow) | ||
You should redirect your user to created url, after authorization he should get back to your page (configured in application or passed to the method) | ||
You should redirect the user to the created URL. Upon authorization, the user should get back to your page (configured in application or passed to the method) | ||
In query params you will get code & state. | ||
`query params` will get you the code & state. State should be the same as you passed before. Code is used in next step to exchange for access token: | ||
State should be the same as you passed before. | ||
Code is used in next step to exchange for access token: | ||
```javascript | ||
@@ -59,11 +55,11 @@ buddyworksapi.oauth.getAccessToken(code, redirectUrl, function(err, json){ | ||
You can also use [api tokens](https://app.buddy.works/api-tokens). | ||
You can also use [API Tokens](https://app.buddy.works/api-tokens). | ||
That functionality is provided for testing purpose and will only work for individual tokens generated per user. | ||
That functionality is provided for testing purposes and will only work for individual tokens generated per user. | ||
All requests will be called in behalf of the user whom provided token | ||
All requests will be called on behalf of the user who provided token. | ||
## Many api client instances | ||
## Numerous API client instances | ||
If you need more instances of client api you can create new with provided code: | ||
If you need more instances of the client API you can create them with the following code: | ||
@@ -75,5 +71,5 @@ ```javascript | ||
## Apis | ||
## API's | ||
For detailed info what send for which method, error codes, rates & limits - check [our documentation](https://buddy.works/api/reference/getting-started/overview) | ||
For detailed info what send for which method, error codes, rates & limits - check [Buddy documentation](https://buddy.works/api/reference/getting-started/overview) | ||
@@ -127,2 +123,12 @@ ### Profile | ||
Get integrations | ||
```javascript | ||
buddyworksapi.profile.getIntegrations(accessToken, function(err, json){}); | ||
``` | ||
Get integration | ||
```javascript | ||
buddyworksapi.profile.getIntegration(accessToken, integrationId, function(err, json){}); | ||
``` | ||
### Workspaces | ||
@@ -398,86 +404,79 @@ | ||
### Scenarios | ||
### Pipelines | ||
Get scenarios | ||
Get pipelines | ||
```javascript | ||
buddyworksapi.scenarios.getList(accessToken, domain, projectName, filters, function(err, json){}); | ||
buddyworksapi.pipelines.getList(accessToken, domain, projectName, filters, function(err, json){}); | ||
``` | ||
Add scenario | ||
Add pipeline | ||
```javascript | ||
buddyworksapi.scenarios.addScenario(accessToken, domain, projectName, data, function(err, json){}); | ||
buddyworksapi.pipelines.addPipeline(accessToken, domain, projectName, data, function(err, json){}); | ||
``` | ||
Get scenario | ||
Get pipeline | ||
```javascript | ||
buddyworksapi.scenarios.getScenario(accessToken, domain, projectName, scenarioId, function(err, json){}); | ||
buddyworksapi.pipelines.getPipeline(accessToken, domain, projectName, pipelineId, function(err, json){}); | ||
``` | ||
Edit scenario | ||
Edit pipeline | ||
```javascript | ||
buddyworksapi.scenarios.editScenario(accessToken, domain, projectName, scenarioId, data, function(err, json){}); | ||
buddyworksapi.pipelines.editPipeline(accessToken, domain, projectName, pipelineId, data, function(err, json){}); | ||
``` | ||
Delete scenario | ||
Delete pipeline | ||
```javascript | ||
buddyworksapi.scenarios.deleteScenario(accessToken, domain, projectName, scenarioId, function(err, json){}); | ||
buddyworksapi.pipelines.deletePipeline(accessToken, domain, projectName, pipelineId, function(err, json){}); | ||
``` | ||
Get scenario actions | ||
Get pipeline actions | ||
```javascript | ||
buddyworksapi.scenarios.getScenarioActions(accessToken, domain, projectName, scenarioId, function(err, json){}); | ||
buddyworksapi.pipelines.getPipelineActions(accessToken, domain, projectName, pipelineId, filters, function(err, json){}); | ||
``` | ||
Add scenario action | ||
Add pipeline action | ||
```javascript | ||
buddyworksapi.scenarios.addScenarioAction(accessToken, domain, projectName, scenarioId, data, function(err, json){}); | ||
buddyworksapi.pipelines.addPipelineAction(accessToken, domain, projectName, pipelineId, data, function(err, json){}); | ||
``` | ||
Reorder scenario actions | ||
Get pipeline action | ||
```javascript | ||
buddyworksapi.scenarios.reorderScenarioActions(accessToken, domain, projectName, scenarioId, order, function(err, json){}); | ||
buddyworksapi.pipelines.getPipelineAction(accessToken, domain, projectName, pipelineId, actionId, function(err, json){}); | ||
``` | ||
order is an array of actions ids ie: [1, 100, 200, 50] | ||
Get scenario action | ||
Edit pipeline action | ||
```javascript | ||
buddyworksapi.scenarios.getScenarioAction(accessToken, domain, projectName, scenarioId, actionId, function(err, json){}); | ||
buddyworksapi.pipelines.editPipelineAction(accessToken, domain, projectName, pipelineId, actionId, data, function(err, json){}); | ||
``` | ||
Edit scenario action | ||
Delete pipeline action | ||
```javascript | ||
buddyworksapi.scenarios.editScenarioAction(accessToken, domain, projectName, scenarioId, actionId, data, function(err, json){}); | ||
buddyworksapi.pipelines.deletePipelineAction(accessToken, domain, projectName, pipelineId, actionId, function(err, json){}); | ||
``` | ||
Delete scenario action | ||
```javascript | ||
buddyworksapi.scenarios.deleteScenarioAction(accessToken, domain, projectName, scenarioId, actionId, function(err, json){}); | ||
``` | ||
### Executions | ||
### Releases | ||
Get releases | ||
Get executions | ||
```javascript | ||
buddyworksapi.releases.getList(accessToken, domain, projectName, scenarioId, filters, function(err, json){}); | ||
buddyworksapi.executions.getList(accessToken, domain, projectName, pipelineId, filters, function(err, json){}); | ||
``` | ||
Run release | ||
Run execution | ||
```javascript | ||
buddyworksapi.releases.runRelease(accessToken, domain, projectName, scenarioId, data, function(err, json){}); | ||
buddyworksapi.executions.runExecution(accessToken, domain, projectName, pipelineId, data, function(err, json){}); | ||
``` | ||
Get release | ||
Get execution | ||
```javascript | ||
buddyworksapi.releases.getRelease(accessToken, domain, projectName, scenarioId, releaseId, function(err, json){}); | ||
buddyworksapi.executions.getExecution(accessToken, domain, projectName, pipelineId, executionId, function(err, json){}); | ||
``` | ||
Cancel release | ||
Cancel execution | ||
```javascript | ||
buddyworksapi.releases.cancelRelease(accessToken, domain, projectName, scenarioId, releaseId, function(err, json){}); | ||
buddyworksapi.executions.cancelExecution(accessToken, domain, projectName, pipelineId, executionId, function(err, json){}); | ||
``` | ||
Retry release | ||
Retry execution | ||
```javascript | ||
buddyworksapi.releases.retryRelease(accessToken, domain, projectName, scenarioId, releaseId, function(err, json){}); | ||
buddyworksapi.executions.retryExecution(accessToken, domain, projectName, pipelineId, executionId, function(err, json){}); | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
110206
30
1482
476