removeWatcher method

Future<void> removeWatcher({
  1. required String issueIdOrKey,
  2. String? username,
  3. String? accountId,
})

Deletes a user as a watcher of an issue.

This operation requires the Allow users to watch issues option to be ON. This option is set in General configuration for Jira. See Configuring Jira application options for details.

Permissions required:

  • Browse projects project permission for the project that the issue is in.
  • If issue-level security is configured, issue-level security permission to view the issue.
  • To remove users other than themselves from the watchlist, Manage watcher list project permission for the project that the issue is in.

Implementation

Future<void> removeWatcher(
    {required String issueIdOrKey,
    String? username,
    String? accountId}) async {
  await _client.send(
    'delete',
    'rest/api/3/issue/{issueIdOrKey}/watchers',
    pathParameters: {
      'issueIdOrKey': issueIdOrKey,
    },
    queryParameters: {
      if (username != null) 'username': username,
      if (accountId != null) 'accountId': accountId,
    },
  );
}