listPullRequests method

Future<ListPullRequestsOutput> listPullRequests({
  1. required String repositoryName,
  2. String? authorArn,
  3. int? maxResults,
  4. String? nextToken,
  5. PullRequestStatusEnum? pullRequestStatus,
})

Returns a list of pull requests for a specified repository. The return list can be refined by pull request status or pull request author ARN.

May throw InvalidPullRequestStatusException. May throw InvalidAuthorArnException. May throw AuthorDoesNotExistException. May throw RepositoryNameRequiredException. May throw InvalidRepositoryNameException. May throw RepositoryDoesNotExistException. May throw InvalidMaxResultsException. May throw InvalidContinuationTokenException. May throw EncryptionIntegrityChecksFailedException. May throw EncryptionKeyAccessDeniedException. May throw EncryptionKeyDisabledException. May throw EncryptionKeyNotFoundException. May throw EncryptionKeyUnavailableException.

Parameter repositoryName : The name of the repository for which you want to list pull requests.

Parameter authorArn : Optional. The Amazon Resource Name (ARN) of the user who created the pull request. If used, this filters the results to pull requests created by that user.

Parameter maxResults : A non-zero, non-negative integer used to limit the number of returned results.

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

Parameter pullRequestStatus : Optional. The status of the pull request. If used, this refines the results to the pull requests that match the specified status.

Implementation

Future<ListPullRequestsOutput> listPullRequests({
  required String repositoryName,
  String? authorArn,
  int? maxResults,
  String? nextToken,
  PullRequestStatusEnum? pullRequestStatus,
}) async {
  ArgumentError.checkNotNull(repositoryName, 'repositoryName');
  _s.validateStringLength(
    'repositoryName',
    repositoryName,
    1,
    100,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CodeCommit_20150413.ListPullRequests'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'repositoryName': repositoryName,
      if (authorArn != null) 'authorArn': authorArn,
      if (maxResults != null) 'maxResults': maxResults,
      if (nextToken != null) 'nextToken': nextToken,
      if (pullRequestStatus != null)
        'pullRequestStatus': pullRequestStatus.toValue(),
    },
  );

  return ListPullRequestsOutput.fromJson(jsonResponse.body);
}