UNPKG

71.6 kBJavaScriptView Raw
1"use strict";
2
3var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
5Object.defineProperty(exports, "__esModule", {
6 value: true
7});
8exports.default = void 0;
9
10var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
12var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
14var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread"));
15
16var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
17
18var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
19
20var _requestPromise = _interopRequireDefault(require("request-promise"));
21
22var _url = _interopRequireDefault(require("url"));
23
24/**
25 * @name JiraApi
26 * @class
27 * Wrapper for the JIRA Rest Api
28 * https://docs.atlassian.com/jira/REST/6.4.8/
29 */
30var JiraApi =
31/*#__PURE__*/
32function () {
33 /**
34 * @constructor
35 * @function
36 * @param {JiraApiOptions} options
37 */
38 function JiraApi(options) {
39 (0, _classCallCheck2.default)(this, JiraApi);
40 this.protocol = options.protocol || 'http';
41 this.host = options.host;
42 this.port = options.port || null;
43 this.apiVersion = options.apiVersion || '2';
44 this.base = options.base || '';
45 this.intermediatePath = options.intermediatePath;
46 this.strictSSL = options.hasOwnProperty('strictSSL') ? options.strictSSL : true; // This is so we can fake during unit tests
47
48 this.request = options.request || _requestPromise.default;
49 this.webhookVersion = options.webHookVersion || '1.0';
50 this.greenhopperVersion = options.greenhopperVersion || '1.0';
51 this.baseOptions = {};
52
53 if (options.oauth && options.oauth.consumer_key && options.oauth.access_token) {
54 this.baseOptions.oauth = {
55 consumer_key: options.oauth.consumer_key,
56 consumer_secret: options.oauth.consumer_secret,
57 token: options.oauth.access_token,
58 token_secret: options.oauth.access_token_secret,
59 signature_method: options.oauth.signature_method || 'RSA-SHA1'
60 };
61 } else if (options.bearer) {
62 this.baseOptions.auth = {
63 user: '',
64 pass: '',
65 sendImmediately: true,
66 bearer: options.bearer
67 };
68 } else if (options.username && options.password) {
69 this.baseOptions.auth = {
70 user: options.username,
71 pass: options.password
72 };
73 }
74
75 if (options.timeout) {
76 this.baseOptions.timeout = options.timeout;
77 }
78 }
79 /**
80 * @typedef JiraApiOptions
81 * @type {object}
82 * @property {string} [protocol=http] - What protocol to use to connect to
83 * jira? Ex: http|https
84 * @property {string} host - What host is this tool connecting to for the jira
85 * instance? Ex: jira.somehost.com
86 * @property {string} [port] - What port is this tool connecting to jira with? Only needed for
87 * none standard ports. Ex: 8080, 3000, etc
88 * @property {string} [username] - Specify a username for this tool to authenticate all
89 * requests with.
90 * @property {string} [password] - Specify a password for this tool to authenticate all
91 * requests with.
92 * @property {string} [apiVersion=2] - What version of the jira rest api is the instance the
93 * tool is connecting to?
94 * @property {string} [base] - What other url parts exist, if any, before the rest/api/
95 * section?
96 * @property {string} [intermediatePath] - If specified, overwrites the default rest/api/version
97 * section of the uri
98 * @property {boolean} [strictSSL=true] - Does this tool require each request to be
99 * authenticated? Defaults to true.
100 * @property {function} [request] - What method does this tool use to make its requests?
101 * Defaults to request from request-promise
102 * @property {number} [timeout] - Integer containing the number of milliseconds to wait for a
103 * server to send response headers (and start the response body) before aborting the request. Note
104 * that if the underlying TCP connection cannot be established, the OS-wide TCP connection timeout
105 * will overrule the timeout option ([the default in Linux can be anywhere from 20-120 *
106 * seconds](http://www.sekuda.com/overriding_the_default_linux_kernel_20_second_tcp_socket_connect_timeout)).
107 * @property {string} [webhookVersion=1.0] - What webhook version does this api wrapper need to
108 * hit?
109 * @property {string} [greenhopperVersion=1.0] - What webhook version does this api wrapper need
110 * to hit?
111 * @property {OAuth} - Specify an oauth object for this tool to authenticate all requests using
112 * OAuth.
113 */
114
115 /**
116 * @typedef OAuth
117 * @type {object}
118 * @property {string} consumer_key - The consumer entered in Jira Preferences.
119 * @property {string} consumer_secret - The private RSA file.
120 * @property {string} access_token - The generated access token.
121 * @property {string} access_token_secret - The generated access toke secret.
122 * @property {string} signature_method [signature_method=RSA-SHA1] - OAuth signurate methode
123 * Possible values RSA-SHA1, HMAC-SHA1, PLAINTEXT. Jira Cloud supports only RSA-SHA1.
124 */
125
126 /**
127 * @typedef {object} UriOptions
128 * @property {string} pathname - The url after the specific functions path
129 * @property {object} [query] - An object of all query parameters
130 * @property {string} [intermediatePath] - Overwrites with specified path
131 */
132
133 /**
134 * @name makeRequestHeader
135 * @function
136 * Creates a requestOptions object based on the default template for one
137 * @param {string} uri
138 * @param {object} [options] - an object containing fields and formatting how the
139 */
140
141
142 (0, _createClass2.default)(JiraApi, [{
143 key: "makeRequestHeader",
144 value: function makeRequestHeader(uri) {
145 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
146 return (0, _objectSpread2.default)({
147 rejectUnauthorized: this.strictSSL,
148 method: options.method || 'GET',
149 uri: uri,
150 json: true
151 }, options);
152 }
153 /**
154 * @typedef makeRequestHeaderOptions
155 * @type {object}
156 * @property {string} [method] - HTTP Request Method. ie GET, POST, PUT, DELETE
157 */
158
159 /**
160 * @name makeUri
161 * @function
162 * Creates a URI object for a given pathname
163 * @param {object} [options] - an object containing path information
164 */
165
166 }, {
167 key: "makeUri",
168 value: function makeUri(_ref) {
169 var pathname = _ref.pathname,
170 query = _ref.query,
171 intermediatePath = _ref.intermediatePath;
172 var intermediateToUse = this.intermediatePath || intermediatePath;
173 var tempPath = intermediateToUse || "/rest/api/".concat(this.apiVersion);
174
175 var uri = _url.default.format({
176 protocol: this.protocol,
177 hostname: this.host,
178 port: this.port,
179 pathname: "".concat(this.base).concat(tempPath).concat(pathname),
180 query: query
181 });
182
183 return decodeURIComponent(uri);
184 }
185 /**
186 * @typedef makeUriOptions
187 * @type {object}
188 * @property {string} pathname - The url after the /rest/api/version
189 * @property {object} query - a query object
190 * @property {string} intermediatePath - If specified will overwrite the /rest/api/version section
191 */
192
193 /**
194 * @name makeWebhookUri
195 * @function
196 * Creates a URI object for a given pathName
197 * @param {object} [options] - An options object specifying uri information
198 */
199
200 }, {
201 key: "makeWebhookUri",
202 value: function makeWebhookUri(_ref2) {
203 var pathname = _ref2.pathname,
204 intermediatePath = _ref2.intermediatePath;
205 var intermediateToUse = this.intermediatePath || intermediatePath;
206 var tempPath = intermediateToUse || "/rest/webhooks/".concat(this.webhookVersion);
207
208 var uri = _url.default.format({
209 protocol: this.protocol,
210 hostname: this.host,
211 port: this.port,
212 pathname: "".concat(this.base).concat(tempPath).concat(pathname)
213 });
214
215 return decodeURIComponent(uri);
216 }
217 /**
218 * @typedef makeWebhookUriOptions
219 * @type {object}
220 * @property {string} pathname - The url after the /rest/webhooks
221 * @property {string} intermediatePath - If specified will overwrite the /rest/webhooks section
222 */
223
224 /**
225 * @name makeSprintQueryUri
226 * @function
227 * Creates a URI object for a given pathName
228 * @param {object} [options] - The url after the /rest/
229 */
230
231 }, {
232 key: "makeSprintQueryUri",
233 value: function makeSprintQueryUri(_ref3) {
234 var pathname = _ref3.pathname,
235 query = _ref3.query,
236 intermediatePath = _ref3.intermediatePath;
237 var intermediateToUse = this.intermediatePath || intermediatePath;
238 var tempPath = intermediateToUse || "/rest/greenhopper/".concat(this.greenhopperVersion);
239
240 var uri = _url.default.format({
241 protocol: this.protocol,
242 hostname: this.host,
243 port: this.port,
244 pathname: "".concat(this.base).concat(tempPath).concat(pathname),
245 query: query
246 });
247
248 return decodeURIComponent(uri);
249 }
250 /**
251 * @typedef makeSprintQueryUriOptions
252 * @type {object}
253 * @property {string} pathname - The url after the /rest/api/version
254 * @property {object} query - a query object
255 * @property {string} intermediatePath - will overwrite the /rest/greenhopper/version section
256 */
257
258 /**
259 * @typedef makeDevStatusUri
260 * @function
261 * Creates a URI object for a given pathname
262 * @arg {pathname, query, intermediatePath} obj1
263 * @param {string} pathname obj1.pathname - The url after the /rest/api/version
264 * @param {object} query obj1.query - a query object
265 * @param {string} intermediatePath obj1.intermediatePath - If specified will overwrite the
266 * /rest/dev-status/latest/issue/detail section
267 */
268
269 }, {
270 key: "makeDevStatusUri",
271 value: function makeDevStatusUri(_ref4) {
272 var pathname = _ref4.pathname,
273 query = _ref4.query,
274 intermediatePath = _ref4.intermediatePath;
275 var intermediateToUse = this.intermediatePath || intermediatePath;
276 var tempPath = intermediateToUse || '/rest/dev-status/latest/issue';
277
278 var uri = _url.default.format({
279 protocol: this.protocol,
280 hostname: this.host,
281 port: this.port,
282 pathname: "".concat(this.base).concat(tempPath).concat(pathname),
283 query: query
284 });
285
286 return decodeURIComponent(uri);
287 }
288 /**
289 * @name makeAgile1Uri
290 * @function
291 * Creates a URI object for a given pathname
292 * @param {UriOptions} object
293 */
294
295 }, {
296 key: "makeAgileUri",
297 value: function makeAgileUri(object) {
298 var intermediateToUse = this.intermediatePath || object.intermediatePath;
299 var tempPath = intermediateToUse || '/rest/agile/1.0';
300
301 var uri = _url.default.format({
302 protocol: this.protocol,
303 hostname: this.host,
304 port: this.port,
305 pathname: "".concat(this.base).concat(tempPath).concat(object.pathname),
306 query: object.query
307 });
308
309 return decodeURIComponent(uri);
310 }
311 /**
312 * @name doRequest
313 * @function
314 * Does a request based on the requestOptions object
315 * @param {object} requestOptions - fields on this object get posted as a request header for
316 * requests to jira
317 */
318
319 }, {
320 key: "doRequest",
321 value: function () {
322 var _doRequest = (0, _asyncToGenerator2.default)(
323 /*#__PURE__*/
324 _regenerator.default.mark(function _callee(requestOptions) {
325 var options, response;
326 return _regenerator.default.wrap(function _callee$(_context) {
327 while (1) {
328 switch (_context.prev = _context.next) {
329 case 0:
330 options = (0, _objectSpread2.default)({}, this.baseOptions, requestOptions);
331 _context.next = 3;
332 return this.request(options);
333
334 case 3:
335 response = _context.sent;
336
337 if (!response) {
338 _context.next = 7;
339 break;
340 }
341
342 if (!(Array.isArray(response.errorMessages) && response.errorMessages.length > 0)) {
343 _context.next = 7;
344 break;
345 }
346
347 throw new Error(response.errorMessages.join(', '));
348
349 case 7:
350 return _context.abrupt("return", response);
351
352 case 8:
353 case "end":
354 return _context.stop();
355 }
356 }
357 }, _callee, this);
358 }));
359
360 function doRequest(_x) {
361 return _doRequest.apply(this, arguments);
362 }
363
364 return doRequest;
365 }()
366 /**
367 * @name findIssue
368 * @function
369 * Find an issue in jira
370 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id290709)
371 * @param {string} issueNumber - The issue number to search for including the project key
372 * @param {string} expand - The resource expansion to return additional fields in the response
373 * @param {string} fields - Comma separated list of field ids or keys to retrieve
374 * @param {string} properties - Comma separated list of properties to retrieve
375 * @param {boolean} fieldsByKeys - False by default, used to retrieve fields by key instead of id
376 */
377
378 }, {
379 key: "findIssue",
380 value: function findIssue(issueNumber, expand, fields, properties, fieldsByKeys) {
381 return this.doRequest(this.makeRequestHeader(this.makeUri({
382 pathname: "/issue/".concat(issueNumber),
383 query: {
384 expand: expand || '',
385 fields: fields || '*all',
386 properties: properties || '*all',
387 fieldsByKeys: fieldsByKeys || false
388 }
389 })));
390 }
391 /**
392 * @name getUnresolvedIssueCount
393 * @function
394 * Get the unresolved issue count
395 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id288524)
396 * @param {string} version - the version of your product you want to find the unresolved
397 * issues of.
398 */
399
400 }, {
401 key: "getUnresolvedIssueCount",
402 value: function () {
403 var _getUnresolvedIssueCount = (0, _asyncToGenerator2.default)(
404 /*#__PURE__*/
405 _regenerator.default.mark(function _callee2(version) {
406 var requestHeaders, response;
407 return _regenerator.default.wrap(function _callee2$(_context2) {
408 while (1) {
409 switch (_context2.prev = _context2.next) {
410 case 0:
411 requestHeaders = this.makeRequestHeader(this.makeUri({
412 pathname: "/version/".concat(version, "/unresolvedIssueCount")
413 }));
414 _context2.next = 3;
415 return this.doRequest(requestHeaders);
416
417 case 3:
418 response = _context2.sent;
419 return _context2.abrupt("return", response.issuesUnresolvedCount);
420
421 case 5:
422 case "end":
423 return _context2.stop();
424 }
425 }
426 }, _callee2, this);
427 }));
428
429 function getUnresolvedIssueCount(_x2) {
430 return _getUnresolvedIssueCount.apply(this, arguments);
431 }
432
433 return getUnresolvedIssueCount;
434 }()
435 /**
436 * @name getProject
437 * @function
438 * Get the Project by project key
439 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id289232)
440 * @param {string} project - key for the project
441 */
442
443 }, {
444 key: "getProject",
445 value: function getProject(project) {
446 return this.doRequest(this.makeRequestHeader(this.makeUri({
447 pathname: "/project/".concat(project)
448 })));
449 }
450 /**
451 * @name createProject
452 * @function
453 * Create a new Project
454 * [Jira Doc](https://docs.atlassian.com/jira/REST/latest/#api/2/project-createProject)
455 * @param {object} project - with specs
456 */
457
458 }, {
459 key: "createProject",
460 value: function createProject(project) {
461 return this.doRequest(this.makeRequestHeader(this.makeUri({
462 pathname: '/project/'
463 }), {
464 method: 'POST',
465 body: project
466 }));
467 }
468 /** Find the Rapid View for a specified project
469 * @name findRapidView
470 * @function
471 * @param {string} projectName - name for the project
472 */
473
474 }, {
475 key: "findRapidView",
476 value: function () {
477 var _findRapidView = (0, _asyncToGenerator2.default)(
478 /*#__PURE__*/
479 _regenerator.default.mark(function _callee3(projectName) {
480 var response, rapidViewResult;
481 return _regenerator.default.wrap(function _callee3$(_context3) {
482 while (1) {
483 switch (_context3.prev = _context3.next) {
484 case 0:
485 _context3.next = 2;
486 return this.doRequest(this.makeRequestHeader(this.makeSprintQueryUri({
487 pathname: '/rapidviews/list'
488 })));
489
490 case 2:
491 response = _context3.sent;
492
493 if (!(typeof projectName === 'undefined' || projectName === null)) {
494 _context3.next = 5;
495 break;
496 }
497
498 return _context3.abrupt("return", response.views);
499
500 case 5:
501 rapidViewResult = response.views.find(function (x) {
502 return x.name.toLowerCase() === projectName.toLowerCase();
503 });
504 return _context3.abrupt("return", rapidViewResult);
505
506 case 7:
507 case "end":
508 return _context3.stop();
509 }
510 }
511 }, _callee3, this);
512 }));
513
514 function findRapidView(_x3) {
515 return _findRapidView.apply(this, arguments);
516 }
517
518 return findRapidView;
519 }()
520 /** Get the most recent sprint for a given rapidViewId
521 * @name getLastSprintForRapidView
522 * @function
523 * @param {string} rapidViewId - the id for the rapid view
524 */
525
526 }, {
527 key: "getLastSprintForRapidView",
528 value: function () {
529 var _getLastSprintForRapidView = (0, _asyncToGenerator2.default)(
530 /*#__PURE__*/
531 _regenerator.default.mark(function _callee4(rapidViewId) {
532 var response;
533 return _regenerator.default.wrap(function _callee4$(_context4) {
534 while (1) {
535 switch (_context4.prev = _context4.next) {
536 case 0:
537 _context4.next = 2;
538 return this.doRequest(this.makeRequestHeader(this.makeSprintQueryUri({
539 pathname: "/sprintquery/".concat(rapidViewId)
540 })));
541
542 case 2:
543 response = _context4.sent;
544 return _context4.abrupt("return", response.sprints.pop());
545
546 case 4:
547 case "end":
548 return _context4.stop();
549 }
550 }
551 }, _callee4, this);
552 }));
553
554 function getLastSprintForRapidView(_x4) {
555 return _getLastSprintForRapidView.apply(this, arguments);
556 }
557
558 return getLastSprintForRapidView;
559 }()
560 /** Get the issues for a rapidView / sprint
561 * @name getSprintIssues
562 * @function
563 * @param {string} rapidViewId - the id for the rapid view
564 * @param {string} sprintId - the id for the sprint
565 */
566
567 }, {
568 key: "getSprintIssues",
569 value: function getSprintIssues(rapidViewId, sprintId) {
570 return this.doRequest(this.makeRequestHeader(this.makeSprintQueryUri({
571 pathname: '/rapid/charts/sprintreport',
572 query: {
573 rapidViewId: rapidViewId,
574 sprintId: sprintId
575 }
576 })));
577 }
578 /** Get a list of Sprints belonging to a Rapid View
579 * @name listSprints
580 * @function
581 * @param {string} rapidViewId - the id for the rapid view
582 */
583
584 }, {
585 key: "listSprints",
586 value: function listSprints(rapidViewId) {
587 return this.doRequest(this.makeRequestHeader(this.makeSprintQueryUri({
588 pathname: "/sprintquery/".concat(rapidViewId)
589 })));
590 }
591 /** Add an issue to the project's current sprint
592 * @name addIssueToSprint
593 * @function
594 * @param {string} issueId - the id of the existing issue
595 * @param {string} sprintId - the id of the sprint to add it to
596 */
597
598 }, {
599 key: "addIssueToSprint",
600 value: function addIssueToSprint(issueId, sprintId) {
601 return this.doRequest(this.makeRequestHeader(this.makeUri({
602 pathname: "/sprint/".concat(sprintId, "/issues/add")
603 }), {
604 method: 'PUT',
605 followAllRedirects: true,
606 body: {
607 issueKeys: [issueId]
608 }
609 }));
610 }
611 /** Create an issue link between two issues
612 * @name issueLink
613 * @function
614 * @param {object} link - a link object formatted how the Jira API specifies
615 */
616
617 }, {
618 key: "issueLink",
619 value: function issueLink(link) {
620 return this.doRequest(this.makeRequestHeader(this.makeUri({
621 pathname: '/issueLink'
622 }), {
623 method: 'POST',
624 followAllRedirects: true,
625 body: link
626 }));
627 }
628 /** Retrieves the remote links associated with the given issue.
629 * @name getRemoteLinks
630 * @function
631 * @param {string} issueNumber - the issue number to find remote links for.
632 */
633
634 }, {
635 key: "getRemoteLinks",
636 value: function getRemoteLinks(issueNumber) {
637 return this.doRequest(this.makeRequestHeader(this.makeUri({
638 pathname: "/issue/".concat(issueNumber, "/remotelink")
639 })));
640 }
641 /**
642 * @name createRemoteLink
643 * @function
644 * Creates a remote link associated with the given issue.
645 * @param {string} issueNumber - The issue number to create the remotelink under
646 * @param {object} remoteLink - the remotelink object as specified by the Jira API
647 */
648
649 }, {
650 key: "createRemoteLink",
651 value: function createRemoteLink(issueNumber, remoteLink) {
652 return this.doRequest(this.makeRequestHeader(this.makeUri({
653 pathname: "/issue/".concat(issueNumber, "/remotelink")
654 }), {
655 method: 'POST',
656 body: remoteLink
657 }));
658 }
659 /** Get Versions for a project
660 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id289653)
661 * @name getVersions
662 * @function
663 * @param {string} project - A project key to get versions for
664 */
665
666 }, {
667 key: "getVersions",
668 value: function getVersions(project) {
669 return this.doRequest(this.makeRequestHeader(this.makeUri({
670 pathname: "/project/".concat(project, "/versions")
671 })));
672 }
673 /** Create a version
674 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id288232)
675 * @name createVersion
676 * @function
677 * @param {string} version - an object of the new version
678 */
679
680 }, {
681 key: "createVersion",
682 value: function createVersion(version) {
683 return this.doRequest(this.makeRequestHeader(this.makeUri({
684 pathname: '/version'
685 }), {
686 method: 'POST',
687 followAllRedirects: true,
688 body: version
689 }));
690 }
691 /** Update a version
692 * [Jira Doc](https://docs.atlassian.com/jira/REST/latest/#d2e510)
693 * @name updateVersion
694 * @function
695 * @param {string} version - an new object of the version to update
696 */
697
698 }, {
699 key: "updateVersion",
700 value: function updateVersion(version) {
701 return this.doRequest(this.makeRequestHeader(this.makeUri({
702 pathname: "/version/".concat(version.id)
703 }), {
704 method: 'PUT',
705 followAllRedirects: true,
706 body: version
707 }));
708 }
709 /** Delete a version
710 * [Jira Doc](https://docs.atlassian.com/jira/REST/latest/#api/2/version-delete)
711 * @name deleteVersion
712 * @function
713 * @param {string} versionId - the ID of the version to delete
714 * @param {string} moveFixIssuesToId - when provided, existing fixVersions will be moved
715 * to this ID. Otherwise, the deleted version will be removed from all
716 * issue fixVersions.
717 * @param {string} moveAffectedIssuesToId - when provided, existing affectedVersions will
718 * be moved to this ID. Otherwise, the deleted version will be removed
719 * from all issue affectedVersions.
720 */
721
722 }, {
723 key: "deleteVersion",
724 value: function deleteVersion(versionId, moveFixIssuesToId, moveAffectedIssuesToId) {
725 return this.doRequest(this.makeRequestHeader(this.makeUri({
726 pathname: "/version/".concat(versionId)
727 }), {
728 method: 'DELETE',
729 followAllRedirects: true,
730 qs: {
731 moveFixIssuesTo: moveFixIssuesToId,
732 moveAffectedIssuesTo: moveAffectedIssuesToId
733 }
734 }));
735 }
736 /** Pass a search query to Jira
737 * [Jira Doc](https://docs.atlassian.com/jira/REST/latest/#d2e4424)
738 * @name searchJira
739 * @function
740 * @param {string} searchString - jira query string in JQL
741 * @param {object} optional - object containing any of the following properties
742 * @param {integer} [optional.startAt=0]: optional starting index number
743 * @param {integer} [optional.maxResults=50]: optional ending index number
744 * @param {array} [optional.fields]: optional array of string names of desired fields
745 */
746
747 }, {
748 key: "searchJira",
749 value: function searchJira(searchString) {
750 var optional = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
751 return this.doRequest(this.makeRequestHeader(this.makeUri({
752 pathname: '/search'
753 }), {
754 method: 'POST',
755 followAllRedirects: true,
756 body: (0, _objectSpread2.default)({
757 jql: searchString
758 }, optional)
759 }));
760 }
761 /** Create a Jira user
762 * [Jira Doc](https://docs.atlassian.com/jira/REST/cloud/#api/2/user-createUser)
763 * @name createUser
764 * @function
765 * @param {object} user - Properly Formatted User object
766 */
767
768 }, {
769 key: "createUser",
770 value: function createUser(user) {
771 return this.doRequest(this.makeRequestHeader(this.makeUri({
772 pathname: '/user'
773 }), {
774 method: 'POST',
775 followAllRedirects: true,
776 body: user
777 }));
778 }
779 /** Search user on Jira
780 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#d2e3756)
781 * @name searchUsers
782 * @function
783 * @param {SearchUserOptions} options
784 */
785
786 }, {
787 key: "searchUsers",
788 value: function searchUsers(_ref5) {
789 var username = _ref5.username,
790 startAt = _ref5.startAt,
791 maxResults = _ref5.maxResults,
792 includeActive = _ref5.includeActive,
793 includeInactive = _ref5.includeInactive;
794 return this.doRequest(this.makeRequestHeader(this.makeUri({
795 pathname: '/user/search',
796 query: {
797 username: username,
798 startAt: startAt || 0,
799 maxResults: maxResults || 50,
800 includeActive: includeActive || true,
801 includeInactive: includeInactive || false
802 }
803 }), {
804 followAllRedirects: true
805 }));
806 }
807 /**
808 * @typedef SearchUserOptions
809 * @type {object}
810 * @property {string} username - A query string used to search username, name or e-mail address
811 * @property {integer} [startAt=0] - The index of the first user to return (0-based)
812 * @property {integer} [maxResults=50] - The maximum number of users to return
813 * @property {boolean} [includeActive=true] - If true, then active users are included
814 * in the results
815 * @property {boolean} [includeInactive=false] - If true, then inactive users
816 * are included in the results
817 */
818
819 /** Get all users in group on Jira
820 * @name getUsersInGroup
821 * @function
822 * @param {string} groupname - A query string used to search users in group
823 * @param {integer} [startAt=0] - The index of the first user to return (0-based)
824 * @param {integer} [maxResults=50] - The maximum number of users to return (defaults to 50).
825 */
826
827 }, {
828 key: "getUsersInGroup",
829 value: function getUsersInGroup(groupname) {
830 var startAt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
831 var maxResults = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;
832 return this.doRequest(this.makeRequestHeader(this.makeUri({
833 pathname: '/group',
834 query: {
835 groupname: groupname,
836 expand: "users[".concat(startAt, ":").concat(maxResults, "]")
837 }
838 }), {
839 followAllRedirects: true
840 }));
841 }
842 /** Get issues related to a user
843 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id296043)
844 * @name getUsersIssues
845 * @function
846 * @param {string} username - username of user to search for
847 * @param {boolean} open - determines if only open issues should be returned
848 */
849
850 }, {
851 key: "getUsersIssues",
852 value: function getUsersIssues(username, open) {
853 var openJql = open ? ' AND status in (Open, \'In Progress\', Reopened)' : '';
854 return this.searchJira("assignee = ".concat(username.replace('@', "\\u0040")).concat(openJql), {});
855 }
856 /** Add issue to Jira
857 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id290028)
858 * @name addNewIssue
859 * @function
860 * @param {object} issue - Properly Formatted Issue object
861 */
862
863 }, {
864 key: "addNewIssue",
865 value: function addNewIssue(issue) {
866 return this.doRequest(this.makeRequestHeader(this.makeUri({
867 pathname: '/issue'
868 }), {
869 method: 'POST',
870 followAllRedirects: true,
871 body: issue
872 }));
873 }
874 /** Add a user as a watcher on an issue
875 * @name addWatcher
876 * @function
877 * @param {string} issueKey - the key of the existing issue
878 * @param {string} username - the jira username to add as a watcher to the issue
879 */
880
881 }, {
882 key: "addWatcher",
883 value: function addWatcher(issueKey, username) {
884 return this.doRequest(this.makeRequestHeader(this.makeUri({
885 pathname: "/issue/".concat(issueKey, "/watchers")
886 }), {
887 method: 'POST',
888 followAllRedirects: true,
889 body: username
890 }));
891 }
892 /** Delete issue from Jira
893 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id290791)
894 * @name deleteIssue
895 * @function
896 * @param {string} issueId - the Id of the issue to delete
897 */
898
899 }, {
900 key: "deleteIssue",
901 value: function deleteIssue(issueId) {
902 return this.doRequest(this.makeRequestHeader(this.makeUri({
903 pathname: "/issue/".concat(issueId)
904 }), {
905 method: 'DELETE',
906 followAllRedirects: true
907 }));
908 }
909 /** Update issue in Jira
910 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id290878)
911 * @name updateIssue
912 * @function
913 * @param {string} issueId - the Id of the issue to delete
914 * @param {object} issueUpdate - update Object as specified by the rest api
915 * @param {object} query - adds parameters to the query string
916 */
917
918 }, {
919 key: "updateIssue",
920 value: function updateIssue(issueId, issueUpdate) {
921 var query = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
922 return this.doRequest(this.makeRequestHeader(this.makeUri({
923 pathname: "/issue/".concat(issueId),
924 query: query
925 }), {
926 body: issueUpdate,
927 method: 'PUT',
928 followAllRedirects: true
929 }));
930 }
931 /** List Components
932 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id290489)
933 * @name listComponents
934 * @function
935 * @param {string} project - key for the project
936 */
937
938 }, {
939 key: "listComponents",
940 value: function listComponents(project) {
941 return this.doRequest(this.makeRequestHeader(this.makeUri({
942 pathname: "/project/".concat(project, "/components")
943 })));
944 }
945 /** Add component to Jira
946 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id290028)
947 * @name addNewComponent
948 * @function
949 * @param {object} component - Properly Formatted Component
950 */
951
952 }, {
953 key: "addNewComponent",
954 value: function addNewComponent(component) {
955 return this.doRequest(this.makeRequestHeader(this.makeUri({
956 pathname: '/component'
957 }), {
958 method: 'POST',
959 followAllRedirects: true,
960 body: component
961 }));
962 }
963 /** Update Jira component
964 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#api/2/component-updateComponent)
965 * @name updateComponent
966 * @function
967 * @param {string} componentId - the Id of the component to update
968 * @param {object} component - Properly Formatted Component
969 */
970
971 }, {
972 key: "updateComponent",
973 value: function updateComponent(componentId, component) {
974 return this.doRequest(this.makeRequestHeader(this.makeUri({
975 pathname: "/component/".concat(componentId)
976 }), {
977 method: 'PUT',
978 followAllRedirects: true,
979 body: component
980 }));
981 }
982 /** Delete component from Jira
983 * [Jira Doc](https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-api-2-component-id-delete)
984 * @name deleteComponent
985 * @function
986 * @param {string} id - The ID of the component.
987 * @param {string} moveIssuesTo - The ID of the component to replace the deleted component.
988 * If this value is null no replacement is made.
989 */
990
991 }, {
992 key: "deleteComponent",
993 value: function deleteComponent(id, moveIssuesTo) {
994 return this.doRequest(this.makeRequestHeader(this.makeUri({
995 pathname: "/component/".concat(id)
996 }), {
997 method: 'DELETE',
998 followAllRedirects: true,
999 qs: moveIssuesTo ? {
1000 moveIssuesTo: moveIssuesTo
1001 } : null
1002 }));
1003 }
1004 /** Create custom Jira field
1005 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#api/2/field-createCustomField)
1006 * @name createCustomField
1007 * @function
1008 * @param {object} field - Properly formatted Field object
1009 */
1010
1011 }, {
1012 key: "createCustomField",
1013 value: function createCustomField(field) {
1014 return this.doRequest(this.makeRequestHeader(this.makeUri({
1015 pathname: '/field'
1016 }), {
1017 method: 'POST',
1018 followAllRedirects: true,
1019 body: field
1020 }));
1021 }
1022 /** List all fields custom and not that jira knows about.
1023 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id290489)
1024 * @name listFields
1025 * @function
1026 */
1027
1028 }, {
1029 key: "listFields",
1030 value: function listFields() {
1031 return this.doRequest(this.makeRequestHeader(this.makeUri({
1032 pathname: '/field'
1033 })));
1034 }
1035 /** Add an option for a select list issue field.
1036 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#api/2/field/{fieldKey}/option-createOption)
1037 * @name createFieldOption
1038 * @function
1039 * @param {string} fieldKey - the key of the select list field
1040 * @param {object} option - properly formatted Option object
1041 */
1042
1043 }, {
1044 key: "createFieldOption",
1045 value: function createFieldOption(fieldKey, option) {
1046 return this.doRequest(this.makeRequestHeader(this.makeUri({
1047 pathname: "/field/".concat(fieldKey, "/option")
1048 }), {
1049 method: 'POST',
1050 followAllRedirects: true,
1051 body: option
1052 }));
1053 }
1054 /** Returns all options defined for a select list issue field.
1055 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#api/2/field/{fieldKey}/option-getAllOptions)
1056 * @name listFieldOptions
1057 * @function
1058 * @param {string} fieldKey - the key of the select list field
1059 */
1060
1061 }, {
1062 key: "listFieldOptions",
1063 value: function listFieldOptions(fieldKey) {
1064 return this.doRequest(this.makeRequestHeader(this.makeUri({
1065 pathname: "/field/".concat(fieldKey, "/option")
1066 })));
1067 }
1068 /** Creates or updates an option for a select list issue field.
1069 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#api/2/field/{fieldKey}/option-putOption)
1070 * @name upsertFieldOption
1071 * @function
1072 * @param {string} fieldKey - the key of the select list field
1073 * @param {string} optionId - the id of the modified option
1074 * @param {object} option - properly formatted Option object
1075 */
1076
1077 }, {
1078 key: "upsertFieldOption",
1079 value: function upsertFieldOption(fieldKey, optionId, option) {
1080 return this.doRequest(this.makeRequestHeader(this.makeUri({
1081 pathname: "/field/".concat(fieldKey, "/option/").concat(optionId)
1082 }), {
1083 method: 'PUT',
1084 followAllRedirects: true,
1085 body: option
1086 }));
1087 }
1088 /** Returns an option for a select list issue field.
1089 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#api/2/field/{fieldKey}/option-getOption)
1090 * @name getFieldOption
1091 * @function
1092 * @param {string} fieldKey - the key of the select list field
1093 * @param {string} optionId - the id of the option
1094 */
1095
1096 }, {
1097 key: "getFieldOption",
1098 value: function getFieldOption(fieldKey, optionId) {
1099 return this.doRequest(this.makeRequestHeader(this.makeUri({
1100 pathname: "/field/".concat(fieldKey, "/option/").concat(optionId)
1101 })));
1102 }
1103 /** Deletes an option from a select list issue field.
1104 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#api/2/field/{fieldKey}/option-delete)
1105 * @name deleteFieldOption
1106 * @function
1107 * @param {string} fieldKey - the key of the select list field
1108 * @param {string} optionId - the id of the deleted option
1109 */
1110
1111 }, {
1112 key: "deleteFieldOption",
1113 value: function deleteFieldOption(fieldKey, optionId) {
1114 return this.doRequest(this.makeRequestHeader(this.makeUri({
1115 pathname: "/field/".concat(fieldKey, "/option/").concat(optionId)
1116 }), {
1117 method: 'DELETE',
1118 followAllRedirects: true
1119 }));
1120 }
1121 /**
1122 * @name getIssueProperty
1123 * @function
1124 * Get Property of Issue by Issue and Property Id
1125 * [Jira Doc](https://docs.atlassian.com/jira/REST/cloud/#api/2/issue/{issueIdOrKey}/properties-getProperty)
1126 * @param {string} issueNumber - The issue number to search for including the project key
1127 * @param {string} property - The property key to search for
1128 */
1129
1130 }, {
1131 key: "getIssueProperty",
1132 value: function getIssueProperty(issueNumber, property) {
1133 return this.doRequest(this.makeRequestHeader(this.makeUri({
1134 pathname: "/issue/".concat(issueNumber, "/properties/").concat(property)
1135 })));
1136 }
1137 /** List all priorities jira knows about
1138 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id290489)
1139 * @name listPriorities
1140 * @function
1141 */
1142
1143 }, {
1144 key: "listPriorities",
1145 value: function listPriorities() {
1146 return this.doRequest(this.makeRequestHeader(this.makeUri({
1147 pathname: '/priority'
1148 })));
1149 }
1150 /** List Transitions for a specific issue that are available to the current user
1151 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id290489)
1152 * @name listTransitions
1153 * @function
1154 * @param {string} issueId - get transitions available for the issue
1155 */
1156
1157 }, {
1158 key: "listTransitions",
1159 value: function listTransitions(issueId) {
1160 return this.doRequest(this.makeRequestHeader(this.makeUri({
1161 pathname: "/issue/".concat(issueId, "/transitions"),
1162 query: {
1163 expand: 'transitions.fields'
1164 }
1165 })));
1166 }
1167 /** Transition issue in Jira
1168 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id290489)
1169 * @name transitionsIssue
1170 * @function
1171 * @param {string} issueId - the Id of the issue to delete
1172 * @param {object} issueTransition - transition object from the jira rest API
1173 */
1174
1175 }, {
1176 key: "transitionIssue",
1177 value: function transitionIssue(issueId, issueTransition) {
1178 return this.doRequest(this.makeRequestHeader(this.makeUri({
1179 pathname: "/issue/".concat(issueId, "/transitions")
1180 }), {
1181 body: issueTransition,
1182 method: 'POST',
1183 followAllRedirects: true
1184 }));
1185 }
1186 /** List all Viewable Projects
1187 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id289193)
1188 * @name listProjects
1189 * @function
1190 */
1191
1192 }, {
1193 key: "listProjects",
1194 value: function listProjects() {
1195 return this.doRequest(this.makeRequestHeader(this.makeUri({
1196 pathname: '/project'
1197 })));
1198 }
1199 /** Add a comment to an issue
1200 * [Jira Doc](https://docs.atlassian.com/jira/REST/latest/#id108798)
1201 * @name addComment
1202 * @function
1203 * @param {string} issueId - Issue to add a comment to
1204 * @param {string} comment - string containing comment
1205 */
1206
1207 }, {
1208 key: "addComment",
1209 value: function addComment(issueId, comment) {
1210 return this.doRequest(this.makeRequestHeader(this.makeUri({
1211 pathname: "/issue/".concat(issueId, "/comment")
1212 }), {
1213 body: {
1214 body: comment
1215 },
1216 method: 'POST',
1217 followAllRedirects: true
1218 }));
1219 }
1220 /** Update comment for an issue
1221 * [Jira Doc](https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-updateComment)
1222 * @name updateComment
1223 * @function
1224 * @param {string} issueId - Issue with the comment
1225 * @param {string} commentId - Comment that is updated
1226 * @param {string} comment - string containing new comment
1227 * @param {object} [options={}] - extra options
1228 */
1229
1230 }, {
1231 key: "updateComment",
1232 value: function updateComment(issueId, commentId, comment) {
1233 var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1234 return this.doRequest(this.makeRequestHeader(this.makeUri({
1235 pathname: "/issue/".concat(issueId, "/comment/").concat(commentId)
1236 }), {
1237 body: (0, _objectSpread2.default)({
1238 body: comment
1239 }, options),
1240 method: 'PUT',
1241 followAllRedirects: true
1242 }));
1243 }
1244 /** Add a worklog to a project
1245 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id291617)
1246 * @name addWorklog
1247 * @function
1248 * @param {string} issueId - Issue to add a worklog to
1249 * @param {object} worklog - worklog object from the rest API
1250 * @param {object} newEstimate - the new value for the remaining estimate field
1251 */
1252
1253 }, {
1254 key: "addWorklog",
1255 value: function addWorklog(issueId, worklog) {
1256 var newEstimate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
1257 var query = {
1258 adjustEstimate: 'auto'
1259 };
1260
1261 if (newEstimate) {
1262 query.adjustEstimate = 'new';
1263 query.newEstimate = newEstimate;
1264 }
1265
1266 var header = {
1267 uri: this.makeUri({
1268 pathname: "/issue/".concat(issueId, "/worklog"),
1269 query: query
1270 }),
1271 body: worklog,
1272 method: 'POST',
1273 'Content-Type': 'application/json',
1274 json: true
1275 };
1276 return this.doRequest(header);
1277 }
1278 /** Delete worklog from issue
1279 * [Jira Doc](https://docs.atlassian.com/jira/REST/latest/#d2e1673)
1280 * @name deleteWorklog
1281 * @function
1282 * @param {string} issueId - the Id of the issue to delete
1283 * @param {string} worklogId - the Id of the worklog in issue to delete
1284 */
1285
1286 }, {
1287 key: "deleteWorklog",
1288 value: function deleteWorklog(issueId, worklogId) {
1289 return this.doRequest(this.makeRequestHeader(this.makeUri({
1290 pathname: "/issue/".concat(issueId, "/worklog/").concat(worklogId)
1291 }), {
1292 method: 'DELETE',
1293 followAllRedirects: true
1294 }));
1295 }
1296 /** List all Issue Types jira knows about
1297 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id295946)
1298 * @name listIssueTypes
1299 * @function
1300 */
1301
1302 }, {
1303 key: "listIssueTypes",
1304 value: function listIssueTypes() {
1305 return this.doRequest(this.makeRequestHeader(this.makeUri({
1306 pathname: '/issuetype'
1307 })));
1308 }
1309 /** Register a webhook
1310 * [Jira Doc](https://developer.atlassian.com/display/JIRADEV/JIRA+Webhooks+Overview)
1311 * @name registerWebhook
1312 * @function
1313 * @param {object} webhook - properly formatted webhook
1314 */
1315
1316 }, {
1317 key: "registerWebhook",
1318 value: function registerWebhook(webhook) {
1319 return this.doRequest(this.makeRequestHeader(this.makeWebhookUri({
1320 pathname: '/webhook'
1321 }), {
1322 method: 'POST',
1323 body: webhook
1324 }));
1325 }
1326 /** List all registered webhooks
1327 * [Jira Doc](https://developer.atlassian.com/display/JIRADEV/JIRA+Webhooks+Overview)
1328 * @name listWebhooks
1329 * @function
1330 */
1331
1332 }, {
1333 key: "listWebhooks",
1334 value: function listWebhooks() {
1335 return this.doRequest(this.makeRequestHeader(this.makeWebhookUri({
1336 pathname: '/webhook'
1337 })));
1338 }
1339 /** Get a webhook by its ID
1340 * [Jira Doc](https://developer.atlassian.com/display/JIRADEV/JIRA+Webhooks+Overview)
1341 * @name getWebhook
1342 * @function
1343 * @param {string} webhookID - id of webhook to get
1344 */
1345
1346 }, {
1347 key: "getWebhook",
1348 value: function getWebhook(webhookID) {
1349 return this.doRequest(this.makeRequestHeader(this.makeWebhookUri({
1350 pathname: "/webhook/".concat(webhookID)
1351 })));
1352 }
1353 /** Delete a registered webhook
1354 * [Jira Doc](https://developer.atlassian.com/display/JIRADEV/JIRA+Webhooks+Overview)
1355 * @name issueLink
1356 * @function
1357 * @param {string} webhookID - id of the webhook to delete
1358 */
1359
1360 }, {
1361 key: "deleteWebhook",
1362 value: function deleteWebhook(webhookID) {
1363 return this.doRequest(this.makeRequestHeader(this.makeWebhookUri({
1364 pathname: "/webhook/".concat(webhookID)
1365 }), {
1366 method: 'DELETE'
1367 }));
1368 }
1369 /** Describe the currently authenticated user
1370 * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id2e865)
1371 * @name getCurrentUser
1372 * @function
1373 */
1374
1375 }, {
1376 key: "getCurrentUser",
1377 value: function getCurrentUser() {
1378 return this.doRequest(this.makeRequestHeader(this.makeUri({
1379 pathname: '/myself'
1380 })));
1381 }
1382 /** Retrieve the backlog of a certain Rapid View
1383 * @name getBacklogForRapidView
1384 * @function
1385 * @param {string} rapidViewId - rapid view id
1386 */
1387
1388 }, {
1389 key: "getBacklogForRapidView",
1390 value: function getBacklogForRapidView(rapidViewId) {
1391 return this.doRequest(this.makeRequestHeader(this.makeUri({
1392 pathname: '/xboard/plan/backlog/data',
1393 query: {
1394 rapidViewId: rapidViewId
1395 }
1396 })));
1397 }
1398 /** Add attachment to a Issue
1399 * [Jira Doc](https://docs.atlassian.com/jira/REST/latest/#api/2/issue/{issueIdOrKey}/attachments-addAttachment)
1400 * @name addAttachmentOnIssue
1401 * @function
1402 * @param {string} issueId - issue id
1403 * @param {object} readStream - readStream object from fs
1404 */
1405
1406 }, {
1407 key: "addAttachmentOnIssue",
1408 value: function addAttachmentOnIssue(issueId, readStream) {
1409 return this.doRequest(this.makeRequestHeader(this.makeUri({
1410 pathname: "/issue/".concat(issueId, "/attachments")
1411 }), {
1412 method: 'POST',
1413 headers: {
1414 'X-Atlassian-Token': 'nocheck'
1415 },
1416 formData: {
1417 file: readStream
1418 }
1419 }));
1420 }
1421 /** Notify people related to issue
1422 * [Jira Doc](https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-notify)
1423 * @name issueNotify
1424 * @function
1425 * @param {string} issueId - issue id
1426 * @param {object} notificationBody - properly formatted body
1427 */
1428
1429 }, {
1430 key: "issueNotify",
1431 value: function issueNotify(issueId, notificationBody) {
1432 return this.doRequest(this.makeRequestHeader(this.makeUri({
1433 pathname: "/issue/".concat(issueId, "/notify")
1434 }), {
1435 method: 'POST',
1436 body: notificationBody
1437 }));
1438 }
1439 /** Get list of possible statuses
1440 * [Jira Doc](https://docs.atlassian.com/jira/REST/latest/#api/2/status-getStatuses)
1441 * @name listStatus
1442 * @function
1443 */
1444
1445 }, {
1446 key: "listStatus",
1447 value: function listStatus() {
1448 return this.doRequest(this.makeRequestHeader(this.makeUri({
1449 pathname: '/status'
1450 })));
1451 }
1452 /** Get a Dev-Status summary by issue ID
1453 * @name getDevStatusSummary
1454 * @function
1455 * @param {string} issueId - id of issue to get
1456 */
1457
1458 }, {
1459 key: "getDevStatusSummary",
1460 value: function getDevStatusSummary(issueId) {
1461 return this.doRequest(this.makeRequestHeader(this.makeDevStatusUri({
1462 pathname: '/summary',
1463 query: {
1464 issueId: issueId
1465 }
1466 })));
1467 }
1468 /** Get a Dev-Status detail by issue ID
1469 * @name getDevStatusDetail
1470 * @function
1471 * @param {string} issueId - id of issue to get
1472 * @param {string} applicationType - type of application (stash, bitbucket)
1473 * @param {string} dataType - info to return (repository, pullrequest)
1474 */
1475
1476 }, {
1477 key: "getDevStatusDetail",
1478 value: function getDevStatusDetail(issueId, applicationType, dataType) {
1479 return this.doRequest(this.makeRequestHeader(this.makeDevStatusUri({
1480 pathname: '/detail',
1481 query: {
1482 issueId: issueId,
1483 applicationType: applicationType,
1484 dataType: dataType
1485 }
1486 })));
1487 }
1488 /** Move issues to backlog
1489 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/backlog-moveIssuesToBacklog)
1490 * @name moveToBacklog
1491 * @function
1492 * @param {array} issues - id or key of issues to get
1493 */
1494
1495 }, {
1496 key: "moveToBacklog",
1497 value: function moveToBacklog(issues) {
1498 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1499 pathname: '/backlog/issue'
1500 }), {
1501 method: 'POST',
1502 body: {
1503 issues: issues
1504 }
1505 }));
1506 }
1507 /** Get all boards
1508 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board-getAllBoards)
1509 * @name getAllBoards
1510 * @function
1511 * @param {number} [startAt=0] - The starting index of the returned boards.
1512 * @param {number} [maxResults=50] - The maximum number of boards to return per page.
1513 * @param {string} [type] - Filters results to boards of the specified type.
1514 * @param {string} [name] - Filters results to boards that match the specified name.
1515 * @param {string} [projectKeyOrId] - Filters results to boards that are relevant to a project.
1516 */
1517
1518 }, {
1519 key: "getAllBoards",
1520 value: function getAllBoards() {
1521 var startAt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1522 var maxResults = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 50;
1523 var type = arguments.length > 2 ? arguments[2] : undefined;
1524 var name = arguments.length > 3 ? arguments[3] : undefined;
1525 var projectKeyOrId = arguments.length > 4 ? arguments[4] : undefined;
1526 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1527 pathname: '/board',
1528 query: {
1529 startAt: startAt,
1530 maxResults: maxResults,
1531 type: type,
1532 name: name,
1533 projectKeyOrId: projectKeyOrId
1534 }
1535 })));
1536 }
1537 /** Create Board
1538 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board-createBoard)
1539 * @name createBoard
1540 * @function
1541 * @param {object} boardBody - Board name, type and filter Id is required.
1542 * @param {string} boardBody.type - Valid values: scrum, kanban
1543 * @param {string} boardBody.name - Must be less than 255 characters.
1544 * @param {string} boardBody.filterId - Id of a filter that the user has permissions to view.
1545 */
1546
1547 }, {
1548 key: "createBoard",
1549 value: function createBoard(boardBody) {
1550 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1551 pathname: '/board'
1552 }), {
1553 method: 'POST',
1554 body: boardBody
1555 }));
1556 }
1557 /** Get Board
1558 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board-getBoard)
1559 * @name getBoard
1560 * @function
1561 * @param {string} boardId - Id of board to retrieve
1562 */
1563
1564 }, {
1565 key: "getBoard",
1566 value: function getBoard(boardId) {
1567 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1568 pathname: "/board/".concat(boardId)
1569 })));
1570 }
1571 /** Delete Board
1572 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board-deleteBoard)
1573 * @name deleteBoard
1574 * @function
1575 * @param {string} boardId - Id of board to retrieve
1576 */
1577
1578 }, {
1579 key: "deleteBoard",
1580 value: function deleteBoard(boardId) {
1581 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1582 pathname: "/board/".concat(boardId)
1583 }), {
1584 method: 'DELETE'
1585 }));
1586 }
1587 /** Get issues for backlog
1588 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board-getIssuesForBacklog)
1589 * @name getIssuesForBacklog
1590 * @function
1591 * @param {string} boardId - Id of board to retrieve
1592 * @param {number} [startAt=0] - The starting index of the returned issues. Base index: 0.
1593 * @param {number} [maxResults=50] - The maximum number of issues to return per page. Default: 50.
1594 * @param {string} [jql] - Filters results using a JQL query.
1595 * @param {boolean} [validateQuery] - Specifies whether to validate the JQL query or not.
1596 * Default: true.
1597 * @param {string} [fields] - The list of fields to return for each issue.
1598 */
1599
1600 }, {
1601 key: "getIssuesForBacklog",
1602 value: function getIssuesForBacklog(boardId) {
1603 var startAt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1604 var maxResults = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;
1605 var jql = arguments.length > 3 ? arguments[3] : undefined;
1606 var validateQuery = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
1607 var fields = arguments.length > 5 ? arguments[5] : undefined;
1608 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1609 pathname: "/board/".concat(boardId, "/backlog"),
1610 query: {
1611 startAt: startAt,
1612 maxResults: maxResults,
1613 jql: jql,
1614 validateQuery: validateQuery,
1615 fields: fields
1616 }
1617 })));
1618 }
1619 /** Get Configuration
1620 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board-getConfiguration)
1621 * @name getConfiguration
1622 * @function
1623 * @param {string} boardId - Id of board to retrieve
1624 */
1625
1626 }, {
1627 key: "getConfiguration",
1628 value: function getConfiguration(boardId) {
1629 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1630 pathname: "/board/".concat(boardId, "/configuration")
1631 })));
1632 }
1633 /** Get issues for board
1634 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board-getIssuesForBoard)
1635 * @name getIssuesForBoard
1636 * @function
1637 * @param {string} boardId - Id of board to retrieve
1638 * @param {number} [startAt=0] - The starting index of the returned issues. Base index: 0.
1639 * @param {number} [maxResults=50] - The maximum number of issues to return per page. Default: 50.
1640 * @param {string} [jql] - Filters results using a JQL query.
1641 * @param {boolean} [validateQuery] - Specifies whether to validate the JQL query or not.
1642 * Default: true.
1643 * @param {string} [fields] - The list of fields to return for each issue.
1644 */
1645
1646 }, {
1647 key: "getIssuesForBoard",
1648 value: function getIssuesForBoard(boardId) {
1649 var startAt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1650 var maxResults = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;
1651 var jql = arguments.length > 3 ? arguments[3] : undefined;
1652 var validateQuery = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
1653 var fields = arguments.length > 5 ? arguments[5] : undefined;
1654 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1655 pathname: "/board/".concat(boardId, "/issue"),
1656 query: {
1657 startAt: startAt,
1658 maxResults: maxResults,
1659 jql: jql,
1660 validateQuery: validateQuery,
1661 fields: fields
1662 }
1663 })));
1664 }
1665 /** Get Epics
1666 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board/{boardId}/epic-getEpics)
1667 * @name getEpics
1668 * @function
1669 * @param {string} boardId - Id of board to retrieve
1670 * @param {number} [startAt=0] - The starting index of the returned epics. Base index: 0.
1671 * @param {number} [maxResults=50] - The maximum number of epics to return per page. Default: 50.
1672 * @param {string} [done] - Filters results to epics that are either done or not done.
1673 * Valid values: true, false.
1674 */
1675
1676 }, {
1677 key: "getEpics",
1678 value: function getEpics(boardId) {
1679 var startAt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1680 var maxResults = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;
1681 var done = arguments.length > 3 ? arguments[3] : undefined;
1682 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1683 pathname: "/board/".concat(boardId, "/epic"),
1684 query: {
1685 startAt: startAt,
1686 maxResults: maxResults,
1687 done: done
1688 }
1689 })));
1690 }
1691 /** Get board issues for epic
1692 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board/{boardId}/epic-getIssuesForEpic)
1693 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board/{boardId}/epic-getIssuesWithoutEpic)
1694 * @name getBoardIssuesForEpic
1695 * @function
1696 * @param {string} boardId - Id of board to retrieve
1697 * @param {string} epicId - Id of epic to retrieve, specify 'none' to get issues without an epic.
1698 * @param {number} [startAt=0] - The starting index of the returned issues. Base index: 0.
1699 * @param {number} [maxResults=50] - The maximum number of issues to return per page. Default: 50.
1700 * @param {string} [jql] - Filters results using a JQL query.
1701 * @param {boolean} [validateQuery] - Specifies whether to validate the JQL query or not.
1702 * Default: true.
1703 * @param {string} [fields] - The list of fields to return for each issue.
1704 */
1705
1706 }, {
1707 key: "getBoardIssuesForEpic",
1708 value: function getBoardIssuesForEpic(boardId, epicId) {
1709 var startAt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1710 var maxResults = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 50;
1711 var jql = arguments.length > 4 ? arguments[4] : undefined;
1712 var validateQuery = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
1713 var fields = arguments.length > 6 ? arguments[6] : undefined;
1714 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1715 pathname: "/board/".concat(boardId, "/epic/").concat(epicId, "/issue"),
1716 query: {
1717 startAt: startAt,
1718 maxResults: maxResults,
1719 jql: jql,
1720 validateQuery: validateQuery,
1721 fields: fields
1722 }
1723 })));
1724 }
1725 /** Get Projects
1726 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board/{boardId}/project-getProjects)
1727 * @name getProjects
1728 * @function
1729 * @param {string} boardId - Id of board to retrieve
1730 * @param {number} [startAt=0] - The starting index of the returned projects. Base index: 0.
1731 * @param {number} [maxResults=50] - The maximum number of projects to return per page.
1732 * Default: 50.
1733 */
1734
1735 }, {
1736 key: "getProjects",
1737 value: function getProjects(boardId) {
1738 var startAt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1739 var maxResults = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;
1740 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1741 pathname: "/board/".concat(boardId, "/project"),
1742 query: {
1743 startAt: startAt,
1744 maxResults: maxResults
1745 }
1746 })));
1747 }
1748 /** Get Projects Full
1749 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board/{boardId}/project-getProjectsFull)
1750 * @name getProjectsFull
1751 * @function
1752 * @param {string} boardId - Id of board to retrieve
1753 */
1754
1755 }, {
1756 key: "getProjectsFull",
1757 value: function getProjectsFull(boardId) {
1758 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1759 pathname: "/board/".concat(boardId, "/project/full")
1760 })));
1761 }
1762 /** Get Board Properties Keys
1763 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board/{boardId}/properties-getPropertiesKeys)
1764 * @name getBoardPropertiesKeys
1765 * @function
1766 * @param {string} boardId - Id of board to retrieve
1767 */
1768
1769 }, {
1770 key: "getBoardPropertiesKeys",
1771 value: function getBoardPropertiesKeys(boardId) {
1772 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1773 pathname: "/board/".concat(boardId, "/properties")
1774 })));
1775 }
1776 /** Delete Board Property
1777 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board/{boardId}/properties-deleteProperty)
1778 * @name deleteBoardProperty
1779 * @function
1780 * @param {string} boardId - Id of board to retrieve
1781 * @param {string} propertyKey - Id of property to delete
1782 */
1783
1784 }, {
1785 key: "deleteBoardProperty",
1786 value: function deleteBoardProperty(boardId, propertyKey) {
1787 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1788 pathname: "/board/".concat(boardId, "/properties/").concat(propertyKey)
1789 }), {
1790 method: 'DELETE'
1791 }));
1792 }
1793 /** Set Board Property
1794 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board/{boardId}/properties-setProperty)
1795 * @name setBoardProperty
1796 * @function
1797 * @param {string} boardId - Id of board to retrieve
1798 * @param {string} propertyKey - Id of property to delete
1799 * @param {string} body - value to set, for objects make sure to stringify first
1800 */
1801
1802 }, {
1803 key: "setBoardProperty",
1804 value: function setBoardProperty(boardId, propertyKey, body) {
1805 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1806 pathname: "/board/".concat(boardId, "/properties/").concat(propertyKey)
1807 }), {
1808 method: 'PUT',
1809 body: body
1810 }));
1811 }
1812 /** Get Board Property
1813 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board/{boardId}/properties-getProperty)
1814 * @name getBoardProperty
1815 * @function
1816 * @param {string} boardId - Id of board to retrieve
1817 * @param {string} propertyKey - Id of property to retrieve
1818 */
1819
1820 }, {
1821 key: "getBoardProperty",
1822 value: function getBoardProperty(boardId, propertyKey) {
1823 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1824 pathname: "/board/".concat(boardId, "/properties/").concat(propertyKey)
1825 })));
1826 }
1827 /** Get All Sprints
1828 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board/{boardId}/sprint-getAllSprints)
1829 * @name getAllSprints
1830 * @function
1831 * @param {string} boardId - Id of board to retrieve
1832 * @param {number} [startAt=0] - The starting index of the returned sprints. Base index: 0.
1833 * @param {number} [maxResults=50] - The maximum number of sprints to return per page.
1834 * Default: 50.
1835 * @param {string} [state] - Filters results to sprints in specified states.
1836 * Valid values: future, active, closed.
1837 */
1838
1839 }, {
1840 key: "getAllSprints",
1841 value: function getAllSprints(boardId) {
1842 var startAt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1843 var maxResults = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;
1844 var state = arguments.length > 3 ? arguments[3] : undefined;
1845 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1846 pathname: "/board/".concat(boardId, "/sprint"),
1847 query: {
1848 startAt: startAt,
1849 maxResults: maxResults,
1850 state: state
1851 }
1852 })));
1853 }
1854 /** Get Board issues for sprint
1855 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board/{boardId}/sprint-getIssuesForSprint)
1856 * @name getBoardIssuesForSprint
1857 * @function
1858 * @param {string} boardId - Id of board to retrieve
1859 * @param {string} sprintId - Id of sprint to retrieve
1860 * @param {number} [startAt=0] - The starting index of the returned issues. Base index: 0.
1861 * @param {number} [maxResults=50] - The maximum number of issues to return per page. Default: 50.
1862 * @param {string} [jql] - Filters results using a JQL query.
1863 * @param {boolean} [validateQuery] - Specifies whether to validate the JQL query or not.
1864 * Default: true.
1865 * @param {string} [fields] - The list of fields to return for each issue.
1866 */
1867
1868 }, {
1869 key: "getBoardIssuesForSprint",
1870 value: function getBoardIssuesForSprint(boardId, sprintId) {
1871 var startAt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1872 var maxResults = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 50;
1873 var jql = arguments.length > 4 ? arguments[4] : undefined;
1874 var validateQuery = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
1875 var fields = arguments.length > 6 ? arguments[6] : undefined;
1876 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1877 pathname: "/board/".concat(boardId, "/sprint/").concat(sprintId, "/issue"),
1878 query: {
1879 startAt: startAt,
1880 maxResults: maxResults,
1881 jql: jql,
1882 validateQuery: validateQuery,
1883 fields: fields
1884 }
1885 })));
1886 }
1887 /** Get All Versions
1888 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board/{boardId}/version-getAllVersions)
1889 * @name getAllVersions
1890 * @function
1891 * @param {string} boardId - Id of board to retrieve
1892 * @param {number} [startAt=0] - The starting index of the returned versions. Base index: 0.
1893 * @param {number} [maxResults=50] - The maximum number of versions to return per page.
1894 * Default: 50.
1895 * @param {string} [released] - Filters results to versions that are either released or
1896 * unreleased.Valid values: true, false.
1897 */
1898
1899 }, {
1900 key: "getAllVersions",
1901 value: function getAllVersions(boardId) {
1902 var startAt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1903 var maxResults = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;
1904 var released = arguments.length > 3 ? arguments[3] : undefined;
1905 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1906 pathname: "/board/".concat(boardId, "/version"),
1907 query: {
1908 startAt: startAt,
1909 maxResults: maxResults,
1910 released: released
1911 }
1912 })));
1913 }
1914 /** Get Epic
1915 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/epic-getEpic)
1916 * @name getEpic
1917 * @function
1918 * @param {string} epicIdOrKey - Id of epic to retrieve
1919 */
1920
1921 }, {
1922 key: "getEpic",
1923 value: function getEpic(epicIdOrKey) {
1924 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1925 pathname: "/epic/".concat(epicIdOrKey)
1926 })));
1927 }
1928 /** Partially update epic
1929 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/epic-partiallyUpdateEpic)
1930 * @name partiallyUpdateEpic
1931 * @function
1932 * @param {string} epicIdOrKey - Id of epic to retrieve
1933 * @param {string} body - value to set, for objects make sure to stringify first
1934 */
1935
1936 }, {
1937 key: "partiallyUpdateEpic",
1938 value: function partiallyUpdateEpic(epicIdOrKey, body) {
1939 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1940 pathname: "/epic/".concat(epicIdOrKey)
1941 }), {
1942 method: 'POST',
1943 body: body
1944 }));
1945 }
1946 /** Get issues for epic
1947 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/epic-getIssuesForEpic)
1948 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/epic-getIssuesWithoutEpic)
1949 * @name getIssuesForEpic
1950 * @function
1951 * @param {string} epicId - Id of epic to retrieve, specify 'none' to get issues without an epic.
1952 * @param {number} [startAt=0] - The starting index of the returned issues. Base index: 0.
1953 * @param {number} [maxResults=50] - The maximum number of issues to return per page. Default: 50.
1954 * @param {string} [jql] - Filters results using a JQL query.
1955 * @param {boolean} [validateQuery] - Specifies whether to validate the JQL query or not.
1956 * Default: true.
1957 * @param {string} [fields] - The list of fields to return for each issue.
1958 */
1959
1960 }, {
1961 key: "getIssuesForEpic",
1962 value: function getIssuesForEpic(epicId) {
1963 var startAt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1964 var maxResults = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;
1965 var jql = arguments.length > 3 ? arguments[3] : undefined;
1966 var validateQuery = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
1967 var fields = arguments.length > 5 ? arguments[5] : undefined;
1968 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1969 pathname: "/epic/".concat(epicId, "/issue"),
1970 query: {
1971 startAt: startAt,
1972 maxResults: maxResults,
1973 jql: jql,
1974 validateQuery: validateQuery,
1975 fields: fields
1976 }
1977 })));
1978 }
1979 /** Move Issues to Epic
1980 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/epic-moveIssuesToEpic)
1981 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/epic-removeIssuesFromEpic)
1982 * @name moveIssuesToEpic
1983 * @function
1984 * @param {string} epicIdOrKey - Id of epic to move issue to, or 'none' to remove from epic
1985 * @param {array} issues - array of issues to move
1986 */
1987
1988 }, {
1989 key: "moveIssuesToEpic",
1990 value: function moveIssuesToEpic(epicIdOrKey, issues) {
1991 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
1992 pathname: "/epic/".concat(epicIdOrKey, "/issue")
1993 }), {
1994 method: 'POST',
1995 body: {
1996 issues: issues
1997 }
1998 }));
1999 }
2000 /** Rank Epics
2001 * [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/epic-rankEpics)
2002 * @name rankEpics
2003 * @function
2004 * @param {string} epicIdOrKey - Id of epic
2005 * @param {string} body - value to set
2006 */
2007
2008 }, {
2009 key: "rankEpics",
2010 value: function rankEpics(epicIdOrKey, body) {
2011 return this.doRequest(this.makeRequestHeader(this.makeAgileUri({
2012 pathname: "/epic/".concat(epicIdOrKey, "/rank")
2013 }), {
2014 method: 'PUT',
2015 body: body
2016 }));
2017 }
2018 }]);
2019 return JiraApi;
2020}();
2021
2022exports.default = JiraApi;
2023module.exports = exports.default;
\No newline at end of file