import * as Models from './models'; import * as Parameters from './parameters'; import { Callback } from '../callback'; import { Client } from '../clients'; import { RequestConfig } from '../requestConfig'; export class Issues { constructor(private client: Client) {} /** * Returns all issue events. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg). */ async getEvents(callback: Callback): Promise; /** * Returns all issue events. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg). */ async getEvents(callback?: never): Promise; async getEvents(callback?: Callback): Promise { const config: RequestConfig = { url: '/rest/api/3/events', method: 'GET', }; return this.client.sendRequest(config, callback); } /** * Creates an issue or, where the option to create subtasks is enabled in Jira, a subtask. A transition may be * applied, to move the issue or subtask to a workflow step other than the default start step, and issue properties * set. * * The content of the issue or subtask is defined using `update` and `fields`. The fields that can be set in the issue * or subtask are determined using the [ Get create issue metadata](#api-rest-api-3-issue-createmeta-get). These are * the same fields that appear on the issue's create screen. Note that the `description`, `environment`, and any * `textarea` type custom fields (multi-line text fields) take Atlassian Document Format content. Single line custom * fields (`textfield`) accept a string and don't handle Atlassian Document Format content. * * Creating a subtask differs from creating an issue as follows: * * - `issueType` must be set to a subtask issue type (use [ Get create issue * metadata](#api-rest-api-3-issue-createmeta-get) to find subtask issue types). * - `parent` must contain the ID or key of the parent issue. * * In a next-gen project any issue may be made a child providing that the parent and child are members of the same * project. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** _Browse * projects_ and _Create issues_ [project permissions](https://confluence.atlassian.com/x/yodKLg) for the project in * which the issue or subtask is created. */ async createIssue(parameters: Parameters.CreateIssue, callback: Callback): Promise; /** * Creates an issue or, where the option to create subtasks is enabled in Jira, a subtask. A transition may be * applied, to move the issue or subtask to a workflow step other than the default start step, and issue properties * set. * * The content of the issue or subtask is defined using `update` and `fields`. The fields that can be set in the issue * or subtask are determined using the [ Get create issue metadata](#api-rest-api-3-issue-createmeta-get). These are * the same fields that appear on the issue's create screen. Note that the `description`, `environment`, and any * `textarea` type custom fields (multi-line text fields) take Atlassian Document Format content. Single line custom * fields (`textfield`) accept a string and don't handle Atlassian Document Format content. * * Creating a subtask differs from creating an issue as follows: * * - `issueType` must be set to a subtask issue type (use [ Get create issue * metadata](#api-rest-api-3-issue-createmeta-get) to find subtask issue types). * - `parent` must contain the ID or key of the parent issue. * * In a next-gen project any issue may be made a child providing that the parent and child are members of the same * project. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** _Browse * projects_ and _Create issues_ [project permissions](https://confluence.atlassian.com/x/yodKLg) for the project in * which the issue or subtask is created. */ async createIssue(parameters: Parameters.CreateIssue, callback?: never): Promise; async createIssue( parameters: Parameters.CreateIssue, callback?: Callback, ): Promise { if (parameters.fields?.description && typeof parameters.fields.description === 'string') { parameters.fields.description = { type: 'doc', version: 1, content: [ { type: 'paragraph', content: [ { text: parameters.fields.description, type: 'text', }, ], }, ], }; } const config: RequestConfig = { url: '/rest/api/3/issue', method: 'POST', params: { updateHistory: parameters.updateHistory, }, data: { fields: parameters.fields, historyMetadata: parameters.historyMetadata, properties: parameters.properties, transition: parameters.transition, update: parameters.update, }, }; return this.client.sendRequest(config, callback); } /** * Enables admins to archive up to 100,000 issues in a single request using JQL, returning the URL to check the status * of the submitted request. * * You can use the [get * task](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-tasks/#api-rest-api-3-task-taskid-get) * and [cancel * task](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-tasks/#api-rest-api-3-task-taskid-cancel-post) * APIs to manage the request. * * **Note that:** * * - You can't archive subtasks directly, only through their parent issues * - You can only archive issues from software, service management, and business projects * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Jira * admin or site admin: [global permission](https://confluence.atlassian.com/x/x4dKLg) * * **License required:** Premium or Enterprise * * **Signed-in users only:** This API can't be accessed anonymously. * * **Rate limiting:** Only a single request per user can be active at any given time. */ async archiveIssuesAsync( parameters: Parameters.ArchiveIssuesAsync, callback: Callback, ): Promise; /** * Enables admins to archive up to 100,000 issues in a single request using JQL, returning the URL to check the status * of the submitted request. * * You can use the [get * task](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-tasks/#api-rest-api-3-task-taskid-get) * and [cancel * task](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-tasks/#api-rest-api-3-task-taskid-cancel-post) * APIs to manage the request. * * **Note that:** * * - You can't archive subtasks directly, only through their parent issues * - You can only archive issues from software, service management, and business projects * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Jira * admin or site admin: [global permission](https://confluence.atlassian.com/x/x4dKLg) * * **License required:** Premium or Enterprise * * **Signed-in users only:** This API can't be accessed anonymously. * * **Rate limiting:** Only a single request per user can be active at any given time. */ async archiveIssuesAsync(parameters: Parameters.ArchiveIssuesAsync, callback?: never): Promise; async archiveIssuesAsync( parameters: Parameters.ArchiveIssuesAsync, callback?: Callback, ): Promise { const config: RequestConfig = { url: '/rest/api/3/issue/archive', method: 'POST', data: { jql: parameters.jql, }, }; return this.client.sendRequest(config, callback); } /** * Enables admins to archive up to 1000 issues in a single request using issue ID/key, returning details of the * issue(s) archived in the process and the errors encountered, if any. * * **Note that:** * * - You can't archive subtasks directly, only through their parent issues * - You can only archive issues from software, service management, and business projects * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Jira * admin or site admin: [global permission](https://confluence.atlassian.com/x/x4dKLg) * * **License required:** Premium or Enterprise * * **Signed-in users only:** This API can't be accessed anonymously. */ async archiveIssues( parameters: Parameters.ArchiveIssues, callback: Callback, ): Promise; /** * Enables admins to archive up to 1000 issues in a single request using issue ID/key, returning details of the * issue(s) archived in the process and the errors encountered, if any. * * **Note that:** * * - You can't archive subtasks directly, only through their parent issues * - You can only archive issues from software, service management, and business projects * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Jira * admin or site admin: [global permission](https://confluence.atlassian.com/x/x4dKLg) * * **License required:** Premium or Enterprise * * **Signed-in users only:** This API can't be accessed anonymously. */ async archiveIssues(parameters: Parameters.ArchiveIssues, callback?: never): Promise; async archiveIssues( parameters: Parameters.ArchiveIssues, callback?: Callback, ): Promise { const config: RequestConfig = { url: '/rest/api/3/issue/archive', method: 'PUT', data: { issueIdsOrKeys: parameters.issueIdsOrKeys, }, }; return this.client.sendRequest(config, callback); } /** * Creates upto **50** issues and, where the option to create subtasks is enabled in Jira, subtasks. Transitions may * be applied, to move the issues or subtasks to a workflow step other than the default start step, and issue * properties set. * * The content of each issue or subtask is defined using `update` and `fields`. The fields that can be set in the * issue or subtask are determined using the [ Get create issue metadata](#api-rest-api-3-issue-createmeta-get). These * are the same fields that appear on the issues' create screens. Note that the `description`, `environment`, and any * `textarea` type custom fields (multi-line text fields) take Atlassian Document Format content. Single line custom * fields (`textfield`) accept a string and don't handle Atlassian Document Format content. * * Creating a subtask differs from creating an issue as follows: * * - `issueType` must be set to a subtask issue type (use [ Get create issue * metadata](#api-rest-api-3-issue-createmeta-get) to find subtask issue types). * - `parent` the must contain the ID or key of the parent issue. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** _Browse * projects_ and _Create issues_ [project permissions](https://confluence.atlassian.com/x/yodKLg) for the project in * which each issue or subtask is created. */ async createIssues( parameters: Parameters.CreateIssues | undefined, callback: Callback, ): Promise; /** * Creates upto **50** issues and, where the option to create subtasks is enabled in Jira, subtasks. Transitions may * be applied, to move the issues or subtasks to a workflow step other than the default start step, and issue * properties set. * * The content of each issue or subtask is defined using `update` and `fields`. The fields that can be set in the * issue or subtask are determined using the [ Get create issue metadata](#api-rest-api-3-issue-createmeta-get). These * are the same fields that appear on the issues' create screens. Note that the `description`, `environment`, and any * `textarea` type custom fields (multi-line text fields) take Atlassian Document Format content. Single line custom * fields (`textfield`) accept a string and don't handle Atlassian Document Format content. * * Creating a subtask differs from creating an issue as follows: * * - `issueType` must be set to a subtask issue type (use [ Get create issue * metadata](#api-rest-api-3-issue-createmeta-get) to find subtask issue types). * - `parent` the must contain the ID or key of the parent issue. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** _Browse * projects_ and _Create issues_ [project permissions](https://confluence.atlassian.com/x/yodKLg) for the project in * which each issue or subtask is created. */ async createIssues(parameters?: Parameters.CreateIssues, callback?: never): Promise; async createIssues( parameters?: Parameters.CreateIssues, callback?: Callback, ): Promise { const config: RequestConfig = { url: '/rest/api/3/issue/bulk', method: 'POST', data: { issueUpdates: parameters?.issueUpdates, }, }; return this.client.sendRequest(config, callback); } /** * Returns details of projects, issue types within projects, and, when requested, the create screen fields for each * issue type for the user. Use the information to populate the requests in [ Create * issue](#api-rest-api-3-issue-post) and [Create issues](#api-rest-api-3-issue-bulk-post). * * The request can be restricted to specific projects or issue types using the query parameters. The response will * contain information for the valid projects, issue types, or project and issue type combinations requested. Note * that invalid project, issue type, or project and issue type combinations do not generate errors. * * This operation can be accessed anonymously. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** _Create * issues_ [project permission](https://confluence.atlassian.com/x/yodKLg) in the requested projects. */ async getCreateIssueMeta( parameters: Parameters.GetCreateIssueMeta | undefined, callback: Callback, ): Promise; /** * Returns details of projects, issue types within projects, and, when requested, the create screen fields for each * issue type for the user. Use the information to populate the requests in [ Create * issue](#api-rest-api-3-issue-post) and [Create issues](#api-rest-api-3-issue-bulk-post). * * The request can be restricted to specific projects or issue types using the query parameters. The response will * contain information for the valid projects, issue types, or project and issue type combinations requested. Note * that invalid project, issue type, or project and issue type combinations do not generate errors. * * This operation can be accessed anonymously. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** _Create * issues_ [project permission](https://confluence.atlassian.com/x/yodKLg) in the requested projects. */ async getCreateIssueMeta( parameters?: Parameters.GetCreateIssueMeta, callback?: never, ): Promise; async getCreateIssueMeta( parameters?: Parameters.GetCreateIssueMeta, callback?: Callback, ): Promise { const config: RequestConfig = { url: '/rest/api/3/issue/createmeta', method: 'GET', params: { projectIds: parameters?.projectIds, projectKeys: parameters?.projectKeys, issuetypeIds: parameters?.issuetypeIds, issuetypeNames: parameters?.issuetypeNames, expand: parameters?.expand, }, }; return this.client.sendRequest(config, callback); } /** * Enables admins to unarchive up to 1000 issues in a single request using issue ID/key, returning details of the * issue(s) unarchived in the process and the errors encountered, if any. * * **Note that:** * * - You can't unarchive subtasks directly, only through their parent issues * - You can only unarchive issues from software, service management, and business projects * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Jira * admin or site admin: [global permission](https://confluence.atlassian.com/x/x4dKLg) * * **License required:** Premium or Enterprise * * **Signed-in users only:** This API can't be accessed anonymously. */ async unarchiveIssues( parameters: Parameters.UnarchiveIssues, callback: Callback, ): Promise; /** * Enables admins to unarchive up to 1000 issues in a single request using issue ID/key, returning details of the * issue(s) unarchived in the process and the errors encountered, if any. * * **Note that:** * * - You can't unarchive subtasks directly, only through their parent issues * - You can only unarchive issues from software, service management, and business projects * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Jira * admin or site admin: [global permission](https://confluence.atlassian.com/x/x4dKLg) * * **License required:** Premium or Enterprise * * **Signed-in users only:** This API can't be accessed anonymously. */ async unarchiveIssues( parameters: Parameters.UnarchiveIssues, callback?: never, ): Promise; async unarchiveIssues( parameters: Parameters.UnarchiveIssues, callback?: Callback, ): Promise { const config: RequestConfig = { url: '/rest/api/3/issue/unarchive', method: 'PUT', data: { issueIdsOrKeys: parameters.issueIdsOrKeys, }, }; return this.client.sendRequest(config, callback); } /** * Returns the details for an issue. * * The issue is identified by its ID or key, however, if the identifier doesn't match an issue, a case-insensitive * search and check for moved issues is performed. If a matching issue is found its details are returned, a 302 or * other redirect is **not** returned. The issue key returned in the response is the key of the issue found. * * This operation can be accessed anonymously. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * * - _Browse projects_ [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is * in. * - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission * to view the issue. */ async getIssue(parameters: Parameters.GetIssue, callback: Callback): Promise; /** * Returns the details for an issue. * * The issue is identified by its ID or key, however, if the identifier doesn't match an issue, a case-insensitive * search and check for moved issues is performed. If a matching issue is found its details are returned, a 302 or * other redirect is **not** returned. The issue key returned in the response is the key of the issue found. * * This operation can be accessed anonymously. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * * - _Browse projects_ [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is * in. * - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission * to view the issue. */ async getIssue(parameters: Parameters.GetIssue, callback?: never): Promise; async getIssue(parameters: Parameters.GetIssue, callback?: Callback): Promise { const config: RequestConfig = { url: `/rest/api/3/issue/${parameters.issueIdOrKey}`, method: 'GET', params: { fields: parameters.fields, fieldsByKeys: parameters.fieldsByKeys, expand: parameters.expand, properties: parameters.properties, updateHistory: parameters.updateHistory, }, }; return this.client.sendRequest(config, callback); } /** * Edits an issue. A transition may be applied and issue properties updated as part of the edit. * * The edits to the issue's fields are defined using `update` and `fields`. The fields that can be edited are * determined using [ Get edit issue metadata](#api-rest-api-3-issue-issueIdOrKey-editmeta-get). * * The parent field may be set by key or ID. For standard issue types, the parent may be removed by setting * `update.parent.set.none` to _true_. Note that the `description`, `environment`, and any `textarea` type custom * fields (multi-line text fields) take Atlassian Document Format content. Single line custom fields (`textfield`) * accept a string and don't handle Atlassian Document Format content. * * Connect apps having an app user with _Administer Jira_ [global * permission](https://confluence.atlassian.com/x/x4dKLg), and Forge apps acting on behalf of users with _Administer * Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg), can override the screen security * configuration using `overrideScreenSecurity` and `overrideEditableFlag`. * * This operation can be accessed anonymously. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * * - _Browse projects_ and _Edit issues_ [project permission](https://confluence.atlassian.com/x/yodKLg) for the project * that the issue is in. * - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission * to view the issue. */ async editIssue(parameters: Parameters.EditIssue, callback: Callback): Promise; /** * Edits an issue. A transition may be applied and issue properties updated as part of the edit. * * The edits to the issue's fields are defined using `update` and `fields`. The fields that can be edited are * determined using [ Get edit issue metadata](#api-rest-api-3-issue-issueIdOrKey-editmeta-get). * * The parent field may be set by key or ID. For standard issue types, the parent may be removed by setting * `update.parent.set.none` to _true_. Note that the `description`, `environment`, and any `textarea` type custom * fields (multi-line text fields) take Atlassian Document Format content. Single line custom fields (`textfield`) * accept a string and don't handle Atlassian Document Format content. * * Connect apps having an app user with _Administer Jira_ [global * permission](https://confluence.atlassian.com/x/x4dKLg), and Forge apps acting on behalf of users with _Administer * Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg), can override the screen security * configuration using `overrideScreenSecurity` and `overrideEditableFlag`. * * This operation can be accessed anonymously. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * * - _Browse projects_ and _Edit issues_ [project permission](https://confluence.atlassian.com/x/yodKLg) for the project * that the issue is in. * - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission * to view the issue. */ async editIssue(parameters: Parameters.EditIssue, callback?: never): Promise; async editIssue(parameters: Parameters.EditIssue, callback?: Callback): Promise { if (parameters.fields?.description && typeof parameters.fields.description === 'string') { const { fields: { description }, } = await this.getIssue({ issueIdOrKey: parameters.issueIdOrKey }); parameters.fields.description = { type: 'doc', version: description?.version ?? 1, content: [ { type: 'paragraph', content: [ { text: parameters.fields.description, type: 'text', }, ], }, ], }; } const config: RequestConfig = { url: `/rest/api/3/issue/${parameters.issueIdOrKey}`, method: 'PUT', params: { notifyUsers: parameters.notifyUsers, overrideScreenSecurity: parameters.overrideScreenSecurity, overrideEditableFlag: parameters.overrideEditableFlag, returnIssue: parameters.returnIssue, expand: parameters.expand, }, data: { fields: parameters.fields, historyMetadata: parameters.historyMetadata, properties: parameters.properties, transition: parameters.transition, update: parameters.update, }, }; return this.client.sendRequest(config, callback); } /** * Deletes an issue. * * An issue cannot be deleted if it has one or more subtasks. To delete an issue with subtasks, set `deleteSubtasks`. * This causes the issue's subtasks to be deleted with the issue. * * This operation can be accessed anonymously. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * * - _Browse projects_ and _Delete issues_ [project permission](https://confluence.atlassian.com/x/yodKLg) for the * project containing the issue. * - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission * to view the issue. */ async deleteIssue(parameters: Parameters.DeleteIssue, callback: Callback): Promise; /** * Deletes an issue. * * An issue cannot be deleted if it has one or more subtasks. To delete an issue with subtasks, set `deleteSubtasks`. * This causes the issue's subtasks to be deleted with the issue. * * This operation can be accessed anonymously. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * * - _Browse projects_ and _Delete issues_ [project permission](https://confluence.atlassian.com/x/yodKLg) for the * project containing the issue. * - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission * to view the issue. */ async deleteIssue(parameters: Parameters.DeleteIssue, callback?: never): Promise; async deleteIssue(parameters: Parameters.DeleteIssue, callback?: Callback): Promise { const config: RequestConfig = { url: `/rest/api/3/issue/${parameters.issueIdOrKey}`, method: 'DELETE', params: { deleteSubtasks: parameters.deleteSubtasks, }, }; return this.client.sendRequest(config, callback); } /** * Assigns an issue to a user. Use this operation when the calling user does not have the _Edit Issues_ permission but * has the _Assign issue_ permission for the project that the issue is in. * * If `name` or `accountId` is set to: * * - `"-1"`, the issue is assigned to the default assignee for the project. * - `null`, the issue is set to unassigned. * * This operation can be accessed anonymously. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * * - _Browse Projects_ and _Assign Issues_ [ project permission](https://confluence.atlassian.com/x/yodKLg) for the * project that the issue is in. * - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission * to view the issue. */ async assignIssue(parameters: Parameters.AssignIssue, callback: Callback): Promise; /** * Assigns an issue to a user. Use this operation when the calling user does not have the _Edit Issues_ permission but * has the _Assign issue_ permission for the project that the issue is in. * * If `name` or `accountId` is set to: * * - `"-1"`, the issue is assigned to the default assignee for the project. * - `null`, the issue is set to unassigned. * * This operation can be accessed anonymously. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * * - _Browse Projects_ and _Assign Issues_ [ project permission](https://confluence.atlassian.com/x/yodKLg) for the * project that the issue is in. * - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission * to view the issue. */ async assignIssue(parameters: Parameters.AssignIssue, callback?: never): Promise; async assignIssue(parameters: Parameters.AssignIssue, callback?: Callback): Promise { const config: RequestConfig = { url: `/rest/api/3/issue/${parameters.issueIdOrKey}/assignee`, method: 'PUT', data: { accountId: parameters.accountId, accountType: parameters.accountType, active: parameters.active, applicationRoles: parameters.applicationRoles, avatarUrls: parameters.avatarUrls, displayName: parameters.displayName, emailAddress: parameters.emailAddress, expand: parameters.expand, groups: parameters.groups, key: parameters.key, locale: parameters.locale, name: parameters.name, self: parameters.self, timeZone: parameters.timeZone, }, }; return this.client.sendRequest(config, callback); } /** * Returns a [paginated](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#pagination) list of all * changelogs for an issue sorted by date, starting from the oldest. * * This operation can be accessed anonymously. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * * - _Browse projects_ [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is * in. * - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission * to view the issue. */ async getChangeLogs( parameters: Parameters.GetChangeLogs, callback: Callback, ): Promise; /** * Returns a [paginated](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#pagination) list of all * changelogs for an issue sorted by date, starting from the oldest. * * This operation can be accessed anonymously. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * * - _Browse projects_ [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is * in. * - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission * to view the issue. */ async getChangeLogs(parameters: Parameters.GetChangeLogs, callback?: never): Promise; async getChangeLogs( parameters: Parameters.GetChangeLogs, callback?: Callback, ): Promise { const config: RequestConfig = { url: `/rest/api/3/issue/${parameters.issueIdOrKey}/changelog`, method: 'GET', params: { startAt: parameters.startAt, maxResults: parameters.maxResults, }, }; return this.client.sendRequest(config, callback); } /** * Returns changelogs for an issue specified by a list of changelog IDs. * * This operation can be accessed anonymously. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * * - _Browse projects_ [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is * in. * - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission * to view the issue. */ async getChangeLogsByIds( parameters: Parameters.GetChangeLogsByIds, callback: Callback, ): Promise; /** * Returns changelogs for an issue specified by a list of changelog IDs. * * This operation can be accessed anonymously. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * * - _Browse projects_ [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is * in. * - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission * to view the issue. */ async getChangeLogsByIds( parameters: Parameters.GetChangeLogsByIds, callback?: never, ): Promise; async getChangeLogsByIds( parameters: Parameters.GetChangeLogsByIds, callback?: Callback, ): Promise { const config: RequestConfig = { url: `/rest/api/3/issue/${parameters.issueIdOrKey}/changelog/list`, method: 'POST', data: { changelogIds: parameters.changelogIds, }, }; return this.client.sendRequest(config, callback); } /** * Returns the edit screen fields for an issue that are visible to and editable by the user. Use the information to * populate the requests in [Edit issue](#api-rest-api-3-issue-issueIdOrKey-put). * * This endpoint will check for these conditions: * * 1. Field is available on a field screen - through screen, screen scheme, issue type screen scheme, and issue type * scheme configuration. `overrideScreenSecurity=true` skips this condition. * 2. Field is visible in the [field * configuration](https://support.atlassian.com/jira-cloud-administration/docs/change-a-field-configuration/). * `overrideScreenSecurity=true` skips this condition. * 3. Field is shown on the issue: each field has different conditions here. For example: Attachment field only shows if * attachments are enabled. Assignee only shows if user has permissions to assign the issue. * 4. If a field is custom then it must have valid custom field context, applicable for its project and issue type. All * system fields are assumed to have context in all projects and all issue types. * 5. Issue has a project, issue type, and status defined. * 6. Issue is assigned to a valid workflow, and the current status has assigned a workflow step. * `overrideEditableFlag=true` skips this condition. * 7. The current workflow step is editable. This is true by default, but [can be disabled by * setting](https://support.atlassian.com/jira-cloud-administration/docs/use-workflow-properties/) the * `jira.issue.editable` property to `false`. `overrideEditableFlag=true` skips this condition. * 8. User has [Edit issues * permission](https://support.atlassian.com/jira-cloud-administration/docs/permissions-for-company-managed-projects/). * 9. Workflow permissions allow editing a field. This is true by default but [can be * modified](https://support.atlassian.com/jira-cloud-administration/docs/use-workflow-properties/) using * `jira.permission.*` workflow properties. * * Fields hidden using [Issue layout settings * page](https://support.atlassian.com/jira-software-cloud/docs/configure-field-layout-in-the-issue-view/) remain * editable. * * Connect apps having an app user with _Administer Jira_ [global * permission](https://confluence.atlassian.com/x/x4dKLg), and Forge apps acting on behalf of users with _Administer * Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg), can return additional details using: * * - `overrideScreenSecurity` When this flag is `true`, then this endpoint skips checking if fields are available * through screens, and field configuration (conditions 1. and 2. from the list above). * - `overrideEditableFlag` When this flag is `true`, then this endpoint skips checking if workflow is present and if * the current step is editable (conditions 6. and 7. from the list above). * * This operation can be accessed anonymously. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * * - _Browse projects_ [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is * in. * - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission * to view the issue. * * Note: For any fields to be editable the user must have the _Edit issues_ [project * permission](https://confluence.atlassian.com/x/yodKLg) for the issue. */ async getEditIssueMeta( parameters: Parameters.GetEditIssueMeta, callback: Callback, ): Promise; /** * Returns the edit screen fields for an issue that are visible to and editable by the user. Use the information to * populate the requests in [Edit issue](#api-rest-api-3-issue-issueIdOrKey-put). * * This endpoint will check for these conditions: * * 1. Field is available on a field screen - through screen, screen scheme, issue type screen scheme, and issue type * scheme configuration. `overrideScreenSecurity=true` skips this condition. * 2. Field is visible in the [field * configuration](https://support.atlassian.com/jira-cloud-administration/docs/change-a-field-configuration/). * `overrideScreenSecurity=true` skips this condition. * 3. Field is shown on the issue: each field has different conditions here. For example: Attachment field only shows if * attachments are enabled. Assignee only shows if user has permissions to assign the issue. * 4. If a field is custom then it must have valid custom field context, applicable for its project and issue type. All * system fields are assumed to have context in all projects and all issue types. * 5. Issue has a project, issue type, and status defined. * 6. Issue is assigned to a valid workflow, and the current status has assigned a workflow step. * `overrideEditableFlag=true` skips this condition. * 7. The current workflow step is editable. This is true by default, but [can be disabled by * setting](https://support.atlassian.com/jira-cloud-administration/docs/use-workflow-properties/) the * `jira.issue.editable` property to `false`. `overrideEditableFlag=true` skips this condition. * 8. User has [Edit issues * permission](https://support.atlassian.com/jira-cloud-administration/docs/permissions-for-company-managed-projects/). * 9. Workflow permissions allow editing a field. This is true by default but [can be * modified](https://support.atlassian.com/jira-cloud-administration/docs/use-workflow-properties/) using * `jira.permission.*` workflow properties. * * Fields hidden using [Issue layout settings * page](https://support.atlassian.com/jira-software-cloud/docs/configure-field-layout-in-the-issue-view/) remain * editable. * * Connect apps having an app user with _Administer Jira_ [global * permission](https://confluence.atlassian.com/x/x4dKLg), and Forge apps acting on behalf of users with _Administer * Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg), can return additional details using: * * - `overrideScreenSecurity` When this flag is `true`, then this endpoint skips checking if fields are available * through screens, and field configuration (conditions 1. and 2. from the list above). * - `overrideEditableFlag` When this flag is `true`, then this endpoint skips checking if workflow is present and if * the current step is editable (conditions 6. and 7. from the list above). * * This operation can be accessed anonymously. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * * - _Browse projects_ [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is * in. * - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission * to view the issue. * * Note: For any fields to be editable the user must have the _Edit issues_ [project * permission](https://confluence.atlassian.com/x/yodKLg) for the issue. */ async getEditIssueMeta( parameters: Parameters.GetEditIssueMeta, callback?: never, ): Promise; async getEditIssueMeta( parameters: Parameters.GetEditIssueMeta, callback?: Callback, ): Promise { const config: RequestConfig = { url: `/rest/api/3/issue/${parameters.issueIdOrKey}/editmeta`, method: 'GET', params: { overrideScreenSecurity: parameters.overrideScreenSecurity, overrideEditableFlag: parameters.overrideEditableFlag, }, }; return this.client.sendRequest(config, callback); } /** * Creates an email notification for an issue and adds it to the mail queue. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * * - _Browse Projects_ [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is * in. * - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission * to view the issue. */ async notify(parameters: Parameters.Notify, callback: Callback): Promise; /** * Creates an email notification for an issue and adds it to the mail queue. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * * - _Browse Projects_ [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is * in. * - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission * to view the issue. */ async notify(parameters: Parameters.Notify, callback?: never): Promise; async notify(parameters: Parameters.Notify, callback?: Callback): Promise { const config: RequestConfig = { url: `/rest/api/3/issue/${parameters.issueIdOrKey}/notify`, method: 'POST', data: { htmlBody: parameters.htmlBody, restrict: parameters.restrict, subject: parameters.subject, textBody: parameters.textBody, to: parameters.to, }, }; return this.client.sendRequest(config, callback); } /** * Returns either all transitions or a transition that can be performed by the user on an issue, based on the issue's * status. * * Note, if a request is made for a transition that does not exist or cannot be performed on the issue, given its * status, the response will return any empty transitions list. * * This operation can be accessed anonymously. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required: A list or * transition is returned only when the user has:** * * - _Browse projects_ [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is * in. * - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission * to view the issue. * * However, if the user does not have the _Transition issues_ [ project * permission](https://confluence.atlassian.com/x/yodKLg) the response will not list any transitions. */ async getTransitions( parameters: Parameters.GetTransitions, callback: Callback, ): Promise; /** * Returns either all transitions or a transition that can be performed by the user on an issue, based on the issue's * status. * * Note, if a request is made for a transition that does not exist or cannot be performed on the issue, given its * status, the response will return any empty transitions list. * * This operation can be accessed anonymously. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required: A list or * transition is returned only when the user has:** * * - _Browse projects_ [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is * in. * - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission * to view the issue. * * However, if the user does not have the _Transition issues_ [ project * permission](https://confluence.atlassian.com/x/yodKLg) the response will not list any transitions. */ async getTransitions(parameters: Parameters.GetTransitions, callback?: never): Promise; async getTransitions( parameters: Parameters.GetTransitions, callback?: Callback, ): Promise { const config: RequestConfig = { url: `/rest/api/3/issue/${parameters.issueIdOrKey}/transitions`, method: 'GET', params: { expand: parameters.expand, transitionId: parameters.transitionId, skipRemoteOnlyCondition: parameters.skipRemoteOnlyCondition, includeUnavailableTransitions: parameters.includeUnavailableTransitions, sortByOpsBarAndStatus: parameters.sortByOpsBarAndStatus, }, }; return this.client.sendRequest(config, callback); } /** * Performs an issue transition and, if the transition has a screen, updates the fields from the transition screen. * * SortByCategory To update the fields on the transition screen, specify the fields in the `fields` or `update` * parameters in the request body. Get details about the fields using [ Get * transitions](#api-rest-api-3-issue-issueIdOrKey-transitions-get) with the `transitions.fields` expand. * * This operation can be accessed anonymously. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * * - _Browse projects_ and _Transition issues_ [project permission](https://confluence.atlassian.com/x/yodKLg) for the * project that the issue is in. * - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission * to view the issue. */ async doTransition(parameters: Parameters.DoTransition, callback: Callback): Promise; /** * Performs an issue transition and, if the transition has a screen, updates the fields from the transition screen. * * SortByCategory To update the fields on the transition screen, specify the fields in the `fields` or `update` * parameters in the request body. Get details about the fields using [ Get * transitions](#api-rest-api-3-issue-issueIdOrKey-transitions-get) with the `transitions.fields` expand. * * This operation can be accessed anonymously. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * * - _Browse projects_ and _Transition issues_ [project permission](https://confluence.atlassian.com/x/yodKLg) for the * project that the issue is in. * - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission * to view the issue. */ async doTransition(parameters: Parameters.DoTransition, callback?: never): Promise; async doTransition(parameters: Parameters.DoTransition, callback?: Callback): Promise { if (parameters.fields?.description && typeof parameters.fields.description === 'string') { parameters.fields.description = { type: 'doc', version: 1, content: [ { type: 'paragraph', content: [ { text: parameters.fields.description, type: 'text', }, ], }, ], }; } const config: RequestConfig = { url: `/rest/api/3/issue/${parameters.issueIdOrKey}/transitions`, method: 'POST', data: { fields: parameters.fields, historyMetadata: parameters.historyMetadata, properties: parameters.properties, transition: parameters.transition, update: parameters.update, }, }; return this.client.sendRequest(config, callback); } /** * Enables admins to retrieve details of all archived issues. Upon a successful request, the admin who submitted it * will receive an email with a link to download a CSV file with the issue details. * * Note that this API only exports the values of system fields and archival-specific fields (`ArchivedBy` and * `ArchivedDate`). Custom fields aren't supported. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Jira * admin or site admin: [global permission](https://confluence.atlassian.com/x/x4dKLg) * * **License required:** Premium or Enterprise * * **Signed-in users only:** This API can't be accessed anonymously. * * **Rate limiting:** Only a single request can be active at any given time. */ async exportArchivedIssues( parameters: Parameters.ExportArchivedIssues | undefined, callback: Callback, ): Promise; /** * Enables admins to retrieve details of all archived issues. Upon a successful request, the admin who submitted it * will receive an email with a link to download a CSV file with the issue details. * * Note that this API only exports the values of system fields and archival-specific fields (`ArchivedBy` and * `ArchivedDate`). Custom fields aren't supported. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Jira * admin or site admin: [global permission](https://confluence.atlassian.com/x/x4dKLg) * * **License required:** Premium or Enterprise * * **Signed-in users only:** This API can't be accessed anonymously. * * **Rate limiting:** Only a single request can be active at any given time. */ async exportArchivedIssues( parameters?: Parameters.ExportArchivedIssues, callback?: never, ): Promise; async exportArchivedIssues( parameters?: Parameters.ExportArchivedIssues, callback?: Callback, ): Promise { const config: RequestConfig = { url: '/rest/api/3/issues/archive/export', method: 'PUT', data: { archivedBy: parameters?.archivedBy, archivedDateRange: parameters?.archivedDateRange, issueTypes: parameters?.issueTypes, projects: parameters?.projects, reporters: parameters?.reporters, }, }; return this.client.sendRequest(config, callback); } }