addComment method

Future<Comment> addComment({
  1. required String issueIdOrKey,
  2. String? expand,
  3. required Comment body,
})

Adds a comment to an issue.

This operation can be accessed anonymously.

Permissions required:

  • Browse projects and Add comments project permission for the project that the issue containing the comment is in.
  • If issue-level security is configured, issue-level security permission to view the issue.

Implementation

Future<Comment> addComment(
    {required String issueIdOrKey,
    String? expand,
    required Comment body}) async {
  return Comment.fromJson(await _client.send(
    'post',
    'rest/api/3/issue/{issueIdOrKey}/comment',
    pathParameters: {
      'issueIdOrKey': issueIdOrKey,
    },
    queryParameters: {
      if (expand != null) 'expand': expand,
    },
    body: body.toJson(),
  ));
}