jira-cli
Version:
A JIRA Command Line Interface
37 lines (28 loc) • 841 B
JavaScript
/*global requirejs,console,define,fs*/
define([
'superagent',
'../../lib/config'
], function (request, config) {
var assign = {
query: null,
table: null,
to: function (ticket, assignee) {
this.query = 'rest/api/2/issue/' + ticket + '/assignee';
request
.put(config.auth.url + this.query)
.send({ 'accountId': assignee })
.set('Content-Type', 'application/json')
.set('Authorization', 'Basic ' + config.auth.token)
.end(function (res) {
if (!res.ok) {
return console.log((res.body.errorMessages || [res.error]).join('\n'));
}
return console.log('Issue [' + ticket + '] assigned to ' + assignee + '.');
});
},
me: function (ticket) {
this.to(ticket, config.auth.user);
}
};
return assign;
});