"use strict";
const baseResource_1 = require('./baseResource');
/**
* Issue
*
* @constructor Issue
* @property {IConnector} connector the jira connector instance
*/
class Issue extends baseResource_1.baseResource {
constructor(connector, Model, settings) {
super(connector, Model, settings);
/**
* Adds a new comment to an issue.optional flags: renderedBody (provides body rendered in HTML)
*
* @method addComment
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.expand expand optional flags: renderedBody (provides body rendered in HTML)
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.addComment = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"expand": args[1],
"token": args[2]
};
return this.makeRequest('addComment', 'POST', 'rest/api/2/issue/:issueIdOrKey/comment', options, callback);
};
/**
* Cast your vote in favour of an issue.
*
* @method addVote
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.addVote = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"token": args[1]
};
return this.makeRequest('addVote', 'POST', 'rest/api/2/issue/:issueIdOrKey/votes', options, callback);
};
/**
* Adds a user to an issue's watcher list.
*
* @method addWatcher
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.addWatcher = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"token": args[1]
};
return this.makeRequest('addWatcher', 'POST', 'rest/api/2/issue/:issueIdOrKey/watchers', options, callback);
};
/**
* Adds a new worklog entry to an issue.(optional) allows you to provide specific instructions to update the remaining time estimate of the issue. Valid values are
*
* "new" - sets the estimate to a specific value
* "leave"- leaves the estimate as is
* "manual" - specify a specific amount to increase remaining estimate by
* "auto"- Default option. Will automatically adjust the value based on the new timeSpent specified on the worklog (required when "new" is selected for adjustEstimate) the new value for the remaining estimate field. e.g. "2d"(required when "manual" is selected for adjustEstimate) the amount to reduce the remaining estimate by e.g. "2d"
*
* @method addWorklog
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.adjustEstimate adjustEstimate (optional) allows you to provide specific instructions to update the remaining time estimate of the issue. Valid values are
"new" - sets the estimate to a specific value
"leave"- leaves the estimate as is
"manual" - specify a specific amount to increase remaining estimate by
"auto"- Default option. Will automatically adjust the value based on the new timeSpent specified on the worklog
* @param {string} options.newEstimate newEstimate (required when "new" is selected for adjustEstimate) the new value for the remaining estimate field. e.g. "2d"
* @param {string} options.reduceBy reduceBy (required when "manual" is selected for adjustEstimate) the amount to reduce the remaining estimate by e.g. "2d"
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.addWorklog = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"adjustEstimate": args[1],
"newEstimate": args[2],
"reduceBy": args[3],
"token": args[4]
};
return this.makeRequest('addWorklog', 'POST', 'rest/api/2/issue/:issueIdOrKey/worklog', options, callback);
};
/**
* Assigns an issue to a user.
* You can use this resource to assign issues when the user submitting the request has the assign permission but not the
* edit issue permission.
* If the name is "-1" automatic assignee is used. A null name will remove the assignee.
*
* @method assign
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.key key
* @param {string} options.name name
* @param {string} options.emailAddress emailAddress
* @param {string} options.avatarUrls avatarUrls
* @param {string} options.displayName displayName
* @param {string} options.active active
* @param {string} options.timeZone timeZone
* @param {string} options.locale locale
* @param {string} options.groups groups
* @param {string} options.applicationRoles applicationRoles
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.assign = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"data": args[1]
};
return this.makeRequest('assign', 'PUT', 'rest/api/2/issue/:issueIdOrKey/assignee', options, callback);
};
/**
* Creates an issue or a sub-task from a JSON representation.
*
* The fields that can be set on create, in either the fields parameter or the update parameter can be determined
* using the /rest/api/2/issue/createmeta resource.
* If a field is not configured to appear on the create screen, then it will not be in the createmeta, and a field
* validation error will occur if it is submitted.
*
* Creating a sub-task is similar to creating a regular issue, with two important differences:
*
* the issueType field must correspond to a sub-task issue type (you can use
* /issue/createmeta to discover sub-task issue types), and
* you must provide a parent field in the issue create request containing the id or key of the
* parent issue.
*
*
* @method create
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.transition transition
* @param {string} options.fields fields
* @param {string} options.update update
* @param {string} options.historyMetadata historyMetadata
* @param {string} options.properties properties
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.create = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"data": args[0]
};
return this.makeRequest('create', 'POST', 'rest/api/2/issue', options, callback);
};
/**
* Creates issues or sub-tasks from a JSON representation.
*
* Creates many issues in one bulk operation.
*
* Creating a sub-task is similar to creating a regular issue. More details can be found in createIssue section:
* {@link IssueResource#createIssue(IssueUpdateBean)}}
*
* @method createIssues
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueUpdates issueUpdates
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.createIssues = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"data": args[0]
};
return this.makeRequest('createIssues', 'POST', 'rest/api/2/issue/bulk', options, callback);
};
/**
* Creates or updates a remote issue link from a JSON representation. If a globalId is provided and a remote issue link
* exists with that globalId, the remote issue link is updated. Otherwise, the remote issue link is created.
*
* @method createOrUpdateRemoteIssueLink
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.globalId globalId
* @param {string} options.application application
* @param {string} options.relationship relationship
* @param {string} options.object object
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.createOrUpdateRemoteIssueLink = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"data": args[1]
};
return this.makeRequest('createOrUpdateRemoteIssueLink', 'POST', 'rest/api/2/issue/:issueIdOrKey/remotelink', options, callback);
};
/**
* Delete an issue.
*
* If the issue has subtasks you must set the parameter deleteSubtasks=true to delete the issue.
* You cannot delete an issue without its subtasks also being deleted.a String of true or false indicating that any subtasks should also be deleted. If the
* issue has no subtasks this parameter is ignored. If the issue has subtasks and this parameter is missing or false,
* then the issue will not be deleted and an error will be returned.
*
* @method deleteById
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.deleteSubtasks deleteSubtasks a String of true or false indicating that any subtasks should also be deleted. If the
issue has no subtasks this parameter is ignored. If the issue has subtasks and this parameter is missing or false,
then the issue will not be deleted and an error will be returned.
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.deleteById = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"deleteSubtasks": args[1],
"token": args[2]
};
return this.makeRequest('deleteById', 'DELETE', 'rest/api/2/issue/:issueIdOrKey', options, callback);
};
/**
* Deletes an existing comment .
*
* @method deleteComment
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.id id
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.deleteComment = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"id": args[1],
"token": args[2]
};
return this.makeRequest('deleteComment', 'DELETE', 'rest/api/2/issue/:issueIdOrKey/comment/:id', options, callback);
};
/**
* Delete the remote issue link with the given global id on the issue.the global id of the remote issue link
*
* @method deleteRemoteIssueLinkByGlobalId
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.globalId globalId the global id of the remote issue link
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.deleteRemoteIssueLinkByGlobalId = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"globalId": args[1],
"token": args[2]
};
return this.makeRequest('deleteRemoteIssueLinkByGlobalId', 'DELETE', 'rest/api/2/issue/:issueIdOrKey/remotelink', options, callback);
};
/**
* Delete the remote issue link with the given id on the issue.
*
* @method deleteRemoteIssueLinkById
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.linkId linkId
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.deleteRemoteIssueLinkById = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"linkId": args[1],
"token": args[2]
};
return this.makeRequest('deleteRemoteIssueLinkById', 'DELETE', 'rest/api/2/issue/:issueIdOrKey/remotelink/:linkId', options, callback);
};
/**
* Deletes an existing worklog entry.(optional) allows you to provide specific instructions to update the remaining time estimate of the issue. Valid values are
*
* "new" - sets the estimate to a specific value
* "leave"- leaves the estimate as is
* "manual" - specify a specific amount to increase remaining estimate by
* "auto"- Default option. Will automatically adjust the value based on the new timeSpent specified on the worklog (required when "new" is selected for adjustEstimate) the new value for the remaining estimate field. e.g. "2d"(required when "manual" is selected for adjustEstimate) the amount to increase the remaining estimate by e.g. "2d"
*
* @method deleteWorklog
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.id id
* @param {string} options.adjustEstimate adjustEstimate (optional) allows you to provide specific instructions to update the remaining time estimate of the issue. Valid values are
"new" - sets the estimate to a specific value
"leave"- leaves the estimate as is
"manual" - specify a specific amount to increase remaining estimate by
"auto"- Default option. Will automatically adjust the value based on the new timeSpent specified on the worklog
* @param {string} options.newEstimate newEstimate (required when "new" is selected for adjustEstimate) the new value for the remaining estimate field. e.g. "2d"
* @param {string} options.increaseBy increaseBy (required when "manual" is selected for adjustEstimate) the amount to increase the remaining estimate by e.g. "2d"
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.deleteWorklog = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"id": args[1],
"adjustEstimate": args[2],
"newEstimate": args[3],
"increaseBy": args[4],
"token": args[5]
};
return this.makeRequest('deleteWorklog', 'DELETE', 'rest/api/2/issue/:issueIdOrKey/worklog/:id', options, callback);
};
/**
* Perform a transition on an issue.
* When performing the transition you can update or set other issue fields.
*
* The fields that can be set on transtion, in either the fields parameter or the update parameter can be determined
* using the /rest/api/2/issue/{issueIdOrKey}/transitions?expand=transitions.fields resource.
* If a field is not configured to appear on the transition screen, then it will not be in the transition metadata, and a field
* validation error will occur if it is submitted.
*
* @method doTransition
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.transition transition
* @param {string} options.fields fields
* @param {string} options.update update
* @param {string} options.historyMetadata historyMetadata
* @param {string} options.properties properties
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.doTransition = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"data": args[1]
};
return this.makeRequest('doTransition', 'POST', 'rest/api/2/issue/:issueIdOrKey/transitions', options, callback);
};
/**
* Edits an issue from a JSON representation.
*
* The issue can either be updated by setting explicit the field value(s)
* or by using an operation to change the field value.
*
* The fields that can be updated, in either the fields parameter or the update parameter, can be determined
* using the /rest/api/2/issue/{issueIdOrKey}/editmeta resource.
* If a field is not configured to appear on the edit screen, then it will not be in the editmeta, and a field
* validation error will occur if it is submitted.
*
* Specifying a "field_id": field_value in the "fields" is a shorthand for a "set" operation in the "update" section.
* Field should appear either in "fields" or "update", not in both.Default: truesend the email with notification that the issue was updated to users that watch it.
* Admin or project admin permissions are required to disable the notification.
*
* @method editIssue
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.notifyUsers notifyUsers Default: truesend the email with notification that the issue was updated to users that watch it.
Admin or project admin permissions are required to disable the notification.
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.editIssue = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"notifyUsers": args[1],
"token": args[2]
};
return this.makeRequest('editIssue', 'PUT', 'rest/api/2/issue/:issueIdOrKey', options, callback);
};
/**
* Returns a full representation of the issue for the given issue key.
*
* An issue JSON consists of the issue key, a collection of fields,
* a link to the workflow transition sub-resource, and (optionally) the HTML rendered values of any fields that support it
* (e.g. if wiki syntax is enabled for the description or comments).
*
* The fields param (which can be specified multiple times) gives a comma-separated list of fields
* to include in the response. This can be used to retrieve a subset of fields.
* A particular field can be excluded by prefixing it with a minus.
*
* By default, all (*all) fields are returned in this get-issue resource. Note: the default is different
* when doing a jql search -- the default there is just navigable fields (*navigable).
*
* *all - include all fields
* *navigable - include just navigable fields
* summary,comment - include just the summary and comments
* -comment - include everything except comments (the default is *all for get-issue)
* *all,-comment - include everything except comments
*
*
* The {@code properties} param is similar to {@code fields} and specifies a comma-separated list of issue
* properties to include. Unlike {@code fields}, properties are not included by default. To include them all
* send {@code ?properties=*all}. You can also include only specified properties or exclude some properties
* with a minus (-) sign.
*
*
* {@code *all} - include all properties
* {@code *all, -prop1} - include all properties except {@code prop1}
* {@code prop1, prop1} - include {@code prop1} and {@code prop2} properties
*
*
* JIRA will attempt to identify the issue by the issueIdOrKey path parameter. This can be an issue id,
* or an issue key. If the issue cannot be found via an exact match, JIRA will also look for the issue in a case-insensitive way, or
* by looking to see if the issue was moved. In either of these cases, the request will proceed as normal (a 302 or other redirect
* will not be returned). The issue key contained in the response will indicate the current value of issue's key.
*
* The expand param is used to include, hidden by default, parts of response. This can be used to include:
*
* renderedFields - field values in HTML format
* names - display name of each field
* schema - schema for each field which describes a type of the field
* transitions - all possible transitions for the given issue
* operations - all possibles operations which may be applied on issue
* editmeta - information about how each field may be edited. It contains field's schema as well.
* changelog - history of all changes of the given issue
* versionedRepresentations -
* REST representations of all fields. Some field may contain more recent versions. RESET representations are numbered.
* The greatest number always represents the most recent version. It is recommended that the most recent version is used.
* version for these fields which provide a more recent REST representation.
* After including versionedRepresentations "fields" field become hidden.
* the list of fields to return for the issue. By default, all fields are returned.the list of properties to return for the issue. By default no properties are returned.
*
* @method findById
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.fields fields the list of fields to return for the issue. By default, all fields are returned.
* @param {string} options.expand expand
* @param {string} options.properties properties the list of properties to return for the issue. By default no properties are returned.
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.findById = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"fields": args[1],
"expand": args[2],
"properties": args[3],
"token": args[4]
};
return this.makeRequest('findById', 'GET', 'rest/api/2/issue/:issueIdOrKey', options, callback);
};
/**
* Returns a single comment.optional flags: renderedBody (provides body rendered in HTML)
*
* @method getComment
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.id id
* @param {string} options.expand expand optional flags: renderedBody (provides body rendered in HTML)
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.getComment = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"id": args[1],
"expand": args[2],
"token": args[3]
};
return this.makeRequest('getComment', 'GET', 'rest/api/2/issue/:issueIdOrKey/comment/:id', options, callback);
};
/**
* Returns all comments for an issue.
*
* Results can be ordered by the "created" field which means the date a comment was added.
* the page offset, if not specified then defaults to 0how many results on the page should be included. Defaults to 50.ordering of the results.optional flags: renderedBody (provides body rendered in HTML)
*
* @method getComments
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.startAt startAt the page offset, if not specified then defaults to 0
* @param {string} options.maxResults maxResults how many results on the page should be included. Defaults to 50.
* @param {string} options.orderBy orderBy ordering of the results.
* @param {string} options.expand expand optional flags: renderedBody (provides body rendered in HTML)
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.getComments = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"startAt": args[1],
"maxResults": args[2],
"orderBy": args[3],
"expand": args[4],
"token": args[5]
};
return this.makeRequest('getComments', 'GET', 'rest/api/2/issue/:issueIdOrKey/comment', options, callback);
};
/**
* Returns the meta data for creating issues. This includes the available projects, issue types and fields,
* including field types and whether or not those fields are required.
* Projects will not be returned if the user does not have permission to create issues in that project.
*
* The fields in the createmeta correspond to the fields in the create screen for the project/issuetype.
* Fields not in the screen will not be in the createmeta.
*
* Fields will only be returned if expand=projects.issuetypes.fields.
*
* The results can be filtered by project and/or issue type, given by the query params.combined with the projectKeys param, lists the projects with which to filter the results. If absent, all projects are returned.
* This parameter can be specified multiple times, and/or be a comma-separated list.
* Specifiying a project that does not exist (or that you cannot create issues in) is not an error, but it will not be in the results.combined with the projectIds param, lists the projects with which to filter the results. If null, all projects are returned.
* This parameter can be specified multiple times, and/or be a comma-separated list.
* Specifiying a project that does not exist (or that you cannot create issues in) is not an error, but it will not be in the results.combinded with issuetypeNames, lists the issue types with which to filter the results. If null, all issue types are returned.
* This parameter can be specified multiple times, and/or be a comma-separated list.
* Specifiying an issue type that does not exist is not an error.combinded with issuetypeIds, lists the issue types with which to filter the results. If null, all issue types are returned.
* This parameter can be specified multiple times, but is NOT interpreted as a comma-separated list.
* Specifiying an issue type that does not exist is not an error.
*
* @method getCreateIssueMeta
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.projectIds projectIds combined with the projectKeys param, lists the projects with which to filter the results. If absent, all projects are returned.
This parameter can be specified multiple times, and/or be a comma-separated list.
Specifiying a project that does not exist (or that you cannot create issues in) is not an error, but it will not be in the results.
* @param {string} options.projectKeys projectKeys combined with the projectIds param, lists the projects with which to filter the results. If null, all projects are returned.
This parameter can be specified multiple times, and/or be a comma-separated list.
Specifiying a project that does not exist (or that you cannot create issues in) is not an error, but it will not be in the results.
* @param {string} options.issuetypeIds issuetypeIds combinded with issuetypeNames, lists the issue types with which to filter the results. If null, all issue types are returned.
This parameter can be specified multiple times, and/or be a comma-separated list.
Specifiying an issue type that does not exist is not an error.
* @param {string} options.issuetypeNames issuetypeNames combinded with issuetypeIds, lists the issue types with which to filter the results. If null, all issue types are returned.
This parameter can be specified multiple times, but is NOT interpreted as a comma-separated list.
Specifiying an issue type that does not exist is not an error.
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.getCreateIssueMeta = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"projectIds": args[0],
"projectKeys": args[1],
"issuetypeIds": args[2],
"issuetypeNames": args[3],
"token": args[4]
};
return this.makeRequest('getCreateIssueMeta', 'GET', 'rest/api/2/issue/createmeta', options, callback);
};
/**
* Returns the meta data for editing an issue.
*
* The fields in the editmeta correspond to the fields in the edit screen for the issue.
* Fields not in the screen will not be in the editmeta.
*
* @method getEditIssueMeta
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.getEditIssueMeta = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"token": args[1]
};
return this.makeRequest('getEditIssueMeta', 'GET', 'rest/api/2/issue/:issueIdOrKey/editmeta', options, callback);
};
/**
* Returns suggested issues which match the auto-completion query for the user which executes this request. This REST
* method will check the user's history and the user's browsing context and select this issues, which match the query.the query.the JQL in context of which the request is executed. Only issues which match this JQL query will be included in results.the key of the issue in context of which the request is executed. The issue which is in context will not be included in the auto-completion result, even if it matches the query.the id of the project in context of which the request is executed. Suggested issues will be only from this project.if set to false, subtasks will not be included in the list.if set to false and request is executed in context of a subtask, the parent issue will not be included in the auto-completion result, even if it matches the query.
*
* @method getIssuePickerResource
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.query query the query.
* @param {string} options.currentJQL currentJQL the JQL in context of which the request is executed. Only issues which match this JQL query will be included in results.
* @param {string} options.currentIssueKey currentIssueKey the key of the issue in context of which the request is executed. The issue which is in context will not be included in the auto-completion result, even if it matches the query.
* @param {string} options.currentProjectId currentProjectId the id of the project in context of which the request is executed. Suggested issues will be only from this project.
* @param {string} options.showSubTasks showSubTasks if set to false, subtasks will not be included in the list.
* @param {string} options.showSubTaskParent showSubTaskParent if set to false and request is executed in context of a subtask, the parent issue will not be included in the auto-completion result, even if it matches the query.
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.getIssuePickerResource = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"query": args[0],
"currentJQL": args[1],
"currentIssueKey": args[2],
"currentProjectId": args[3],
"showSubTasks": args[4],
"showSubTaskParent": args[5],
"token": args[6]
};
return this.makeRequest('getIssuePickerResource', 'GET', 'rest/api/2/issue/picker', options, callback);
};
/**
* Returns the list of watchers for the issue with the given key.
*
* @method getIssueWatchers
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.getIssueWatchers = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"token": args[1]
};
return this.makeRequest('getIssueWatchers', 'GET', 'rest/api/2/issue/:issueIdOrKey/watchers', options, callback);
};
/**
* Returns all work logs for an issue.
* Note: Work logs won't be returned if the Log work field is hidden for the project.
*
* @method getIssueWorklog
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.getIssueWorklog = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"token": args[1]
};
return this.makeRequest('getIssueWorklog', 'GET', 'rest/api/2/issue/:issueIdOrKey/worklog', options, callback);
};
/**
* Get the remote issue link with the given id on the issue.
*
* @method getRemoteIssueLinkById
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.linkId linkId
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.getRemoteIssueLinkById = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"linkId": args[1],
"token": args[2]
};
return this.makeRequest('getRemoteIssueLinkById', 'GET', 'rest/api/2/issue/:issueIdOrKey/remotelink/:linkId', options, callback);
};
/**
* A REST sub-resource representing the remote issue links on the issue.The id of the remote issue link to be returned. If null (not provided) all remote links for the
* issue are returned.
* For a fullexplanation of Issue Link fields please refer to
* https://developer.atlassian.com/display/JIRADEV/Fields+in+Remote+Issue+Links
*
* @method getRemoteIssueLinks
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.globalId globalId The id of the remote issue link to be returned. If null (not provided) all remote links for the
issue are returned.
For a fullexplanation of Issue Link fields please refer to
https://developer.atlassian.com/display/JIRADEV/Fields+in+Remote+Issue+Links
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.getRemoteIssueLinks = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"globalId": args[1],
"token": args[2]
};
return this.makeRequest('getRemoteIssueLinks', 'GET', 'rest/api/2/issue/:issueIdOrKey/remotelink', options, callback);
};
/**
* Get a list of the transitions possible for this issue by the current user, along with fields that are required and their types.
*
* Fields will only be returned if expand=transitions.fields.
*
* The fields in the metadata correspond to the fields in the transition screen for that transition.
* Fields not in the screen will not be in the metadata.
*
* @method getTransitions
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.transitionId transitionId
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.getTransitions = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"transitionId": args[1],
"token": args[2]
};
return this.makeRequest('getTransitions', 'GET', 'rest/api/2/issue/:issueIdOrKey/transitions', options, callback);
};
/**
* A REST sub-resource representing the voters on the issue.
*
* @method getVotes
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.getVotes = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"token": args[1]
};
return this.makeRequest('getVotes', 'GET', 'rest/api/2/issue/:issueIdOrKey/votes', options, callback);
};
/**
* Returns a specific worklog.
* Note: The work log won't be returned if the Log work field is hidden for the project.
*
* @method getWorklog
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.id id
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.getWorklog = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"id": args[1],
"token": args[2]
};
return this.makeRequest('getWorklog', 'GET', 'rest/api/2/issue/:issueIdOrKey/worklog/:id', options, callback);
};
/**
* Sends a notification (email) to the list or recipients defined in the request.
*
* @method notify
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.subject subject
* @param {string} options.textBody textBody
* @param {string} options.htmlBody htmlBody
* @param {string} options.to to
* @param {string} options.restrict restrict
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.notify = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"data": args[1]
};
return this.makeRequest('notify', 'POST', 'rest/api/2/issue/:issueIdOrKey/notify', options, callback);
};
/**
* Remove your vote from an issue. (i.e. "unvote")
*
* @method removeVote
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.removeVote = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"token": args[1]
};
return this.makeRequest('removeVote', 'DELETE', 'rest/api/2/issue/:issueIdOrKey/votes', options, callback);
};
/**
* Removes a user from an issue's watcher list.a String containing the name of the user to remove from the watcher list. Must not be null.
*
* @method removeWatcher
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.username username a String containing the name of the user to remove from the watcher list. Must not be null.
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.removeWatcher = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"username": args[1],
"token": args[2]
};
return this.makeRequest('removeWatcher', 'DELETE', 'rest/api/2/issue/:issueIdOrKey/watchers', options, callback);
};
/**
* Updates an existing comment using its JSON representation.optional flags: renderedBody (provides body rendered in HTML)
*
* @method updateComment
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.id id
* @param {string} options.expand expand optional flags: renderedBody (provides body rendered in HTML)
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.updateComment = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"id": args[1],
"expand": args[2],
"token": args[3]
};
return this.makeRequest('updateComment', 'PUT', 'rest/api/2/issue/:issueIdOrKey/comment/:id', options, callback);
};
/**
* Updates a remote issue link from a JSON representation. Any fields not provided are set to null.
*
* @method updateRemoteIssueLink
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.linkId linkId
* @param {string} options.globalId globalId
* @param {string} options.application application
* @param {string} options.relationship relationship
* @param {string} options.object object
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.updateRemoteIssueLink = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"linkId": args[1],
"data": args[2]
};
return this.makeRequest('updateRemoteIssueLink', 'PUT', 'rest/api/2/issue/:issueIdOrKey/remotelink/:linkId', options, callback);
};
/**
* Updates an existing worklog entry.
* Note that:(optional) allows you to provide specific instructions to update the remaining time estimate of the issue. Valid values are
*
* "new" - sets the estimate to a specific value
* "leave"- leaves the estimate as is
* "auto"- Default option. Will automatically adjust the value based on the new timeSpent specified on the worklog (required when "new" is selected for adjustEstimate) the new value for the remaining estimate field.
*
* @method updateWorklog
* @memberOf Issue#
* @param {Object} options An object containing options to pass to the Jira API.
* @param {string} options.issueIdOrKey issueIdOrKey
* @param {string} options.id id
* @param {string} options.adjustEstimate adjustEstimate (optional) allows you to provide specific instructions to update the remaining time estimate of the issue. Valid values are
"new" - sets the estimate to a specific value
"leave"- leaves the estimate as is
"auto"- Default option. Will automatically adjust the value based on the new timeSpent specified on the worklog
* @param {string} options.newEstimate newEstimate (required when "new" is selected for adjustEstimate) the new value for the remaining estimate field.
* @param {string} options.token token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with result of api call
* @return {Promise.<any>} result of api call
*/
this.updateWorklog = (...args) => {
let callback = ((typeof args[args.length - 1]) === 'function') ? args.pop() : null;
let options = ((typeof args[0]) === 'object') ? args[0] : {
"issueIdOrKey": args[0],
"id": args[1],
"adjustEstimate": args[2],
"newEstimate": args[3],
"token": args[4]
};
return this.makeRequest('updateWorklog', 'PUT', 'rest/api/2/issue/:issueIdOrKey/worklog/:id', options, callback);
};
this.methods = [];
this.register();
}
}
exports.Issue = Issue;