Skip to content
This repository has been archived by the owner on Jan 21, 2019. It is now read-only.

Commit

Permalink
Merge branch 'release/1.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzuya committed Feb 19, 2014
2 parents 57d6faa + 55bbd58 commit 26fa9da
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 2 deletions.
84 changes: 84 additions & 0 deletions examples/admin_custom_field_crud.js
@@ -0,0 +1,84 @@
#!/usr/bin/env node

// custom field CRUD

var util = require('util');
var backlogApi = require('../');

var backlog = backlogApi();

var projectKey = '*** your project key ***';
var projectId;
var issueTypeIds;
var fieldId;

backlog.getProject({ projectKey: projectKey })
.then(function(project) {
projectId = project.id;
})
.then(function() {
// READ
return backlog.getCustomFields({ projectId: projectId });
})
.then(function(fields) {
console.log(fields);
})
.then(function() {
return backlog.getIssueTypes({ projectId: projectId });
})
.then(function(issueTypes) {
issueTypeIds = issueTypes.map(function(i) { return i.id; });
})
.then(function() {
// CREATE
return backlog.admin.addCustomField({
projectId: projectId,
typeId: 3,
name: 'foo',
issueTypes: issueTypeIds,
min: 0.0,
max: 100.0,
initial_value: 50.0,
unit: '%'
});
})
.then(function(field) {
fieldId = field.id;
console.log('created: ' + util.inspect(field));
})
.then(function() {
return backlog.getCustomFields({ projectId: projectId });
})
.then(function(fields) { console.log(fields); })
.then(function() {
// UPDATE
return backlog.admin.updateCustomField({
id: fieldId,
name: 'bar',
issueTypes: issueTypeIds,
min: 20.0,
max: 80.0,
initial_value: 50.0,
unit: '%'
});
})
.then(function(field) {
console.log('updated: ' + util.inspect(field));
})
.then(function() {
return backlog.getCustomFields({ projectId: projectId });
})
.then(function(fields) { console.log(fields); })
.then(function() {
// DELETE
return backlog.admin.deleteCustomField({ id: fieldId });
})
.then(function(field) {
console.log('deleted: ' + util.inspect(field));
})
.then(function() {
return backlog.getCustomFields({ projectId: projectId });
})
.then(function(fields) { console.log(fields); })
.catch(function(err) { console.error(err); });

19 changes: 19 additions & 0 deletions examples/get_child_issues.js
@@ -0,0 +1,19 @@
#!/usr/bin/env node

var backlogApi = require('../');

var backlog = backlogApi();

var issueKey = 'NBAPI-1';

backlog.getIssue({ issueKey: issueKey })
.then(function(issue) {
return backlog.getChildIssues({ parent_issue_id: issue.id });
})
.then(function(issues) {
console.log(issues);
})
.catch(function(err) {
console.error(err);
});

3 changes: 2 additions & 1 deletion lib/backlog/get_child_issues.js
Expand Up @@ -3,5 +3,6 @@ module.exports = {
name: 'backlog.getChildIssues',
params: {
parent_issue_id: { required: true }
}
},
parseParams: function(params) { return [params.parent_issue_id]; }
};
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "backlog-api",
"version": "1.0.0",
"version": "1.0.1",
"description": "Backlog API wrapper for Node.js",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 26fa9da

Please sign in to comment.