Skip to content

bylek/buddy-works-node-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Buddy Works APIs Node.js Client

Official Node.js client library for Buddy Continuous Integration tool.

Build

Installation

This library is distributed on npm. In order to add it as a dependency, run the following command:

$ npm install buddyworksapi --save

Usage of OAauth

First, you need to add the application in your Buddy ID.

You will then obtain clientId & clientSecret to execute this code:

var buddyworksapi = require('buddyworksapi');
buddyworksapi.useOAuth(clientId, clientSecret);

Next you can get AuthorizeUrl:

buddyworksapi.oauth.getAuthorizeUrl(scopes, state, redirectUrl);

scopes are arrays of strings - help

state should be an unguessable random string. It is used to protect against cross-site request forgery attacks.

redirectUrl is optional more

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)

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:

buddyworksapi.oauth.getAccessToken(code, redirectUrl, function(err, json){
	if (err) console.error(err);
	else{
		console.log(json.access_token);//token used to authenticate requests in API.
		console.log(json.expires_in);//time in seconds how long the token will be valid.
	}
});

Usage of direct tokens

You can also use API Tokens.

That functionality is provided for testing purposes and will only work for individual tokens generated per user.

All requests will be called on behalf of the user who provided token.

Numerous API client instances

If you need more instances of the client API you can create them with the following code:

var buddyworksapi = require('buddyworksapi');
var buddyworksapi2 = buddyworksapi.create();

API's

For detailed info what send for which method, error codes, rates & limits - check Buddy documentation

Profile

Get user

buddyworksapi.profile.getUser(accessToken, function(err, json){});

Edit user

buddyworksapi.profile.editUser(accessToken, data, function(err, json){});

Get emails

buddyworksapi.profile.getEmails(accessToken, function(err, json){});

Add email

buddyworksapi.profile.addEmail(accessToken, email, function(err, json){});

Delete email

buddyworksapi.profile.deleteEmail(accessToken, email, function(err, json){});

Get ssh keys

buddyworksapi.profile.getSshKeys(accessToken, function(err, json){});

Add ssh key

buddyworksapi.profile.addSshKey(accessToken, data, function(err, json){});

Delete ssh key

buddyworksapi.profile.deleteSshKey(accessToken, keyId, function(err, json){});

Get ssh key

buddyworksapi.profile.getSshKey(accessToken, keyId, function(err, json){});

Workspaces

Workspaces list

buddyworksapi.workspaces.getList(accessToken, function(err, json){});

Workspace details

buddyworksapi.workspaces.getWorkspace(accessToken, domain, function(err, json){});

Projects

Get projects list

buddyworksapi.projects.getList(accessToken, domain, filters, function(err, json){});

Add project

buddyworksapi.projects.addProject(accessToken, domain, data, function(err, json){});

Get project

buddyworksapi.projects.getProject(accessToken, domain, projectName, function(err, json){});

Edit project

buddyworksapi.projects.editProject(accessToken, domain, projectName, data, function(err, json){});

Delete project

buddyworksapi.projects.deleteProject(accessToken, domain, projectName, function(err, json){});

Get project members

buddyworksapi.projects.getProjectMembers(accessToken, domain, projectName, filters, function(err, json){});

Get project members

buddyworksapi.projects.addProjectMember(accessToken, domain, projectName, data, function(err, json){});

Get project member

buddyworksapi.projects.getProjectMember(accessToken, domain, projectName, memberId, function(err, json){});

Edit project member

buddyworksapi.projects.editProjectMember(accessToken, domain, projectName, memberId, permissionId, function(err, json){});

Delete project member

buddyworksapi.projects.deleteProjectMember(accessToken, domain, projectName, memberId, function(err, json){});

Workspace members

Get workspace members

buddyworksapi.members.getList(accessToken, domain, filters, function(err, json){});

Add workspace member

buddyworksapi.members.addMember(accessToken, domain, email, function(err, json){});

Get workspace member

buddyworksapi.members.getMember(accessToken, domain, memberId, function(err, json){});

Set member as administrator

buddyworksapi.members.updateAdministrator(accessToken, domain, memberId, isAdmin, function(err, json){});

Delete workspace member

buddyworksapi.members.deleteMember(accessToken, domain, memberId, function(err, json){});

Get member projects

buddyworksapi.members.getMemberProjects(accessToken, domain, memberId, filters, function(err, json){});

Groups

Get groups list

buddyworksapi.groups.getList(accessToken, domain, function(err, json){});

Add group

buddyworksapi.groups.addGroup(accessToken, domain, data, function(err, json){});

Get group

buddyworksapi.groups.getGroup(accessToken, domain, groupId, function(err, json){});

Edit group

buddyworksapi.groups.editGroup(accessToken, domain, groupId, data, function(err, json){});

Delete group

buddyworksapi.groups.deleteGroup(accessToken, domain, groupId, function(err, json){});

Get group members

buddyworksapi.groups.getGroupMembers(accessToken, domain, groupId, function(err, json){});

Add group member

buddyworksapi.groups.addGroupMember(accessToken, domain, groupId, memberId, function(err, json){});

Get group member

buddyworksapi.groups.getGroupMember(accessToken, domain, groupId, memberId, function(err, json){});

Delete group member

buddyworksapi.groups.deleteGroupMember(accessToken, domain, groupId, memberId, function(err, json){});

Permissions

Get permissions list

buddyworksapi.permissions.getList(accessToken, domain, function(err, json){});

Add permission

buddyworksapi.permissions.addPermission(accessToken, domain, data, function(err, json){});

Get permission

buddyworksapi.permissions.getPermission(accessToken, domain, permissionId, function(err, json){});

Edit permission

buddyworksapi.permissions.editPermission(accessToken, domain, permissionId, data, function(err, json){});

Delete permission

buddyworksapi.permissions.deletePermission(accessToken, domain, permissionId, function(err, json){});

Webhooks

Delete permission

buddyworksapi.webhooks.getList(accessToken, domain, function(err, json){});

Add webhook

buddyworksapi.webhooks.addWebhook(accessToken, domain, data, function(err, json){});

Get webhook

buddyworksapi.webhooks.getWebhook(accessToken, domain, webhookId, function(err, json){});

Edit webhook

buddyworksapi.webhooks.editWebhook(accessToken, domain, webhookId, data, function(err, json){});

Delete webhook

buddyworksapi.webhooks.deleteWebhook(accessToken, domain, webhookId, function(err, json){});

Source

Get contents

buddyworksapi.source.getContents(accessToken, domain, projectName, path, filters, function(err, json){});

Add file

buddyworksapi.source.addFile(accessToken, domain, projectName, data, function(err, json){});

Edit file

buddyworksapi.source.editFile(accessToken, domain, projectName, path, data, function(err, json){});

Delete file

buddyworksapi.source.deleteFile(accessToken, domain, projectName, path, data, function(err, json){});

Commits

Get commits

buddyworksapi.commits.getList(accessToken, domain, projectName, filters, function(err, json){});

Get commit

buddyworksapi.commits.getCommit(accessToken, domain, projectName, revision, function(err, json){});

Get compare

buddyworksapi.commits.getCompare(accessToken, domain, projectName, base, head, filters, function(err, json){});

Tags

Get tags

buddyworksapi.tags.getList(accessToken, domain, projectName, function(err, json){});

Get tag

buddyworksapi.tags.getTag(accessToken, domain, projectName, name, function(err, json){});

Branches

Get branches

buddyworksapi.branches.getList(accessToken, domain, projectName, function(err, json){});

Get branch revision

buddyworksapi.branches.getRevision(accessToken, domain, projectName, name, function(err, json){});

Add branch

buddyworksapi.branches.addBranch(accessToken, domain, projectName, data, function(err, json){});

Delete branch

buddyworksapi.branches.deleteBranch(accessToken, domain, projectName, name, force, function(err, json){});

Scenarios

Get scenarios

buddyworksapi.scenarios.getList(accessToken, domain, projectName, filters, function(err, json){});

Add scenario

buddyworksapi.scenarios.addScenario(accessToken, domain, projectName, data, function(err, json){});

Get scenario

buddyworksapi.scenarios.getScenario(accessToken, domain, projectName, scenarioId, function(err, json){});

Edit scenario

buddyworksapi.scenarios.editScenario(accessToken, domain, projectName, scenarioId, data, function(err, json){});

Delete scenario

buddyworksapi.scenarios.deleteScenario(accessToken, domain, projectName, scenarioId, function(err, json){});

Get scenario actions

buddyworksapi.scenarios.getScenarioActions(accessToken, domain, projectName, scenarioId, function(err, json){});

Add scenario action

buddyworksapi.scenarios.addScenarioAction(accessToken, domain, projectName, scenarioId, data, function(err, json){});

Reorder scenario actions

buddyworksapi.scenarios.reorderScenarioActions(accessToken, domain, projectName, scenarioId, order, function(err, json){});

order is an array of actions ids ie: [1, 100, 200, 50]

Get scenario action

buddyworksapi.scenarios.getScenarioAction(accessToken, domain, projectName, scenarioId, actionId, function(err, json){});

Edit scenario action

buddyworksapi.scenarios.editScenarioAction(accessToken, domain, projectName, scenarioId, actionId, data, function(err, json){});

Delete scenario action

buddyworksapi.scenarios.deleteScenarioAction(accessToken, domain, projectName, scenarioId, actionId, function(err, json){});

Releases

Get releases

buddyworksapi.releases.getList(accessToken, domain, projectName, scenarioId, filters, function(err, json){});

Run release

buddyworksapi.releases.runRelease(accessToken, domain, projectName, scenarioId, data, function(err, json){});

Get release

buddyworksapi.releases.getRelease(accessToken, domain, projectName, scenarioId, releaseId, function(err, json){});

Cancel release

buddyworksapi.releases.cancelRelease(accessToken, domain, projectName, scenarioId, releaseId, function(err, json){});

Retry release

buddyworksapi.releases.retryRelease(accessToken, domain, projectName, scenarioId, releaseId, function(err, json){});

About

Node.js for Buddy API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%