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 PullRequestIdRequiredException. May throw PullRequestDoesNotExistException. May throw InvalidPullRequestIdException. May throw RepositoryNameRequiredException. May throw RepositoryDoesNotExistException. May throw InvalidRepositoryNameException. May throw CommitIdRequiredException. May throw InvalidCommitIdException. May throw CommitDoesNotExistException. May throw InvalidMaxResultsException. May throw InvalidContinuationTokenException. May throw RepositoryNotAssociatedWithPullRequestException. May throw EncryptionIntegrityChecksFailedException. May throw EncryptionKeyAccessDeniedException. May throw EncryptionKeyDisabledException. May throw EncryptionKeyNotFoundException. May throw EncryptionKeyUnavailableException.

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.

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.

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.

Implementation

Future<GetCommentsForPullRequestOutput> getCommentsForPullRequest({
  required String pullRequestId,
  String? afterCommitId,
  String? beforeCommitId,
  int? maxResults,
  String? nextToken,
  String? repositoryName,
}) async {
  ArgumentError.checkNotNull(pullRequestId, 'pullRequestId');
  _s.validateStringLength(
    'repositoryName',
    repositoryName,
    1,
    100,
  );
  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);
}