getCommentsForPullRequest method

Future<GetCommentsForPullRequestOutput> getCommentsForPullRequest({
  1. required String pullRequestId,
  2. String? afterCommitId,
  3. String? beforeCommitId,
  4. int? maxResults,
  5. String? nextToken,
  6. String? repositoryName,
})

Returns comments made on a pull request.

May throw CommitDoesNotExistException. May throw CommitIdRequiredException. May throw EncryptionIntegrityChecksFailedException. May throw EncryptionKeyAccessDeniedException. May throw EncryptionKeyDisabledException. May throw EncryptionKeyNotFoundException. May throw EncryptionKeyUnavailableException. May throw InvalidCommitIdException. May throw InvalidContinuationTokenException. May throw InvalidMaxResultsException. May throw InvalidPullRequestIdException. May throw InvalidRepositoryNameException. May throw PullRequestDoesNotExistException. May throw PullRequestIdRequiredException. May throw RepositoryDoesNotExistException. May throw RepositoryNameRequiredException. May throw RepositoryNotAssociatedWithPullRequestException.

Parameter pullRequestId : The system-generated ID of the pull request. To get this ID, use ListPullRequests.

Parameter afterCommitId : The full commit ID of the commit in the source branch that was the tip of the branch at the time the comment was made. Requirement is conditional: afterCommitId must be specified when repositoryName is included.

Parameter beforeCommitId : The full commit ID of the commit in the destination branch that was the tip of the branch at the time the pull request was created. Requirement is conditional: beforeCommitId must be specified when repositoryName is included.

Parameter maxResults : A non-zero, non-negative integer used to limit the number of returned results. The default is 100 comments. You can return up to 500 comments with a single request.

Parameter nextToken : An enumeration token that, when provided in a request, returns the next batch of the results.

Parameter repositoryName : The name of the repository that contains the pull request. Requirement is conditional: repositoryName must be specified when beforeCommitId and afterCommitId are included.

Implementation

Future<GetCommentsForPullRequestOutput> getCommentsForPullRequest({
  required String pullRequestId,
  String? afterCommitId,
  String? beforeCommitId,
  int? maxResults,
  String? nextToken,
  String? repositoryName,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CodeCommit_20150413.GetCommentsForPullRequest'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'pullRequestId': pullRequestId,
      if (afterCommitId != null) 'afterCommitId': afterCommitId,
      if (beforeCommitId != null) 'beforeCommitId': beforeCommitId,
      if (maxResults != null) 'maxResults': maxResults,
      if (nextToken != null) 'nextToken': nextToken,
      if (repositoryName != null) 'repositoryName': repositoryName,
    },
  );

  return GetCommentsForPullRequestOutput.fromJson(jsonResponse.body);
}