Skip to content

buddy-works/buddy-works-node-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Buddy Works APIs Node.js Client

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

buddy pipeline

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

Add email

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

Get emails

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

Delete email

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

Get profile

buddyworksapi.profile.getProfile(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){});

Get ssh keys

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

Integrations

Get integrations list

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

Get integration

buddyworksapi.integrations.getIntegration(accessToken, domain, integrationHash, function(err, json){});

Add integration

buddyworksapi.integrations.addIntegration(accessToken, domain, data, function(err, json){});

Edit integration

buddyworksapi.integrations.editIntegration(accessToken, domain, integrationHash, data, function(err, json){});

Delete integration

buddyworksapi.integrations.deleteIntegration(accessToken, domain, integrationHash, 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){});

Pipelines

Get pipelines

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

Add pipeline

buddyworksapi.pipelines.addPipeline(accessToken, domain, projectName, data, function(err, json){});

Get pipeline

buddyworksapi.pipelines.getPipeline(accessToken, domain, projectName, pipelineId, function(err, json){});

Edit pipeline

buddyworksapi.pipelines.editPipeline(accessToken, domain, projectName, pipelineId, data, function(err, json){});

Delete pipeline

buddyworksapi.pipelines.deletePipeline(accessToken, domain, projectName, pipelineId, function(err, json){});

Get pipeline actions

buddyworksapi.pipelines.getPipelineActions(accessToken, domain, projectName, pipelineId, filters, function(err, json){});

Add pipeline action

buddyworksapi.pipelines.addPipelineAction(accessToken, domain, projectName, pipelineId, data, function(err, json){});

Get pipeline action

buddyworksapi.pipelines.getPipelineAction(accessToken, domain, projectName, pipelineId, actionId, function(err, json){});

Edit pipeline action

buddyworksapi.pipelines.editPipelineAction(accessToken, domain, projectName, pipelineId, actionId, data, function(err, json){});

Delete pipeline action

buddyworksapi.pipelines.deletePipelineAction(accessToken, domain, projectName, pipelineId, actionId, function(err, json){});

Executions

Get executions

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

Run execution

buddyworksapi.executions.runExecution(accessToken, domain, projectName, pipelineId, data, function(err, json){});

Get execution

buddyworksapi.executions.getExecution(accessToken, domain, projectName, pipelineId, executionId, function(err, json){});

Cancel execution

buddyworksapi.executions.cancelExecution(accessToken, domain, projectName, pipelineId, executionId, function(err, json){});

Retry execution

buddyworksapi.executions.retryExecution(accessToken, domain, projectName, pipelineId, executionId, function(err, json){});