Skip to content

list_pull_requests

list_pull_requests(
    repository_name: RepositoryName,
    *,
    config_overrides: Optional[CodeCommitClientConfig] = None,
    author_arn: Optional[Arn] = None,
    pull_request_status: Optional[PullRequestStatusEnum] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
) -> ListPullRequestsOutput

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.

Parameters:

  • repository_name (RepositoryName) –

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

  • author_arn (Optional[Arn], default: None ) –

    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.

  • pull_request_status (Optional[PullRequestStatusEnum], default: None ) –

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

  • next_token (Optional[NextToken], default: None ) –

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

  • max_results (Optional[MaxResults], default: None ) –

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

Raises:

Source code in docs_src/capo_codecommit/_services/code_commit.py
def list_pull_requests(
    self,
    repository_name: "capo_codecommit.types.repository_name.RepositoryName",
    *,
    config_overrides: Optional[CodeCommitClientConfig] = None,
    author_arn: Optional["capo_codecommit.types.arn.Arn"] = None,
    pull_request_status: Optional[
        "capo_codecommit.types.pull_request_status_enum.PullRequestStatusEnum"
    ] = None,
    next_token: Optional["capo_codecommit.types.next_token.NextToken"] = None,
    max_results: Optional["capo_codecommit.types.max_results.MaxResults"] = None,
) -> "capo_codecommit.types.list_pull_requests_output.ListPullRequestsOutput":
    """<p>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.</p>

    Args:
        repository_name: <p>The name of the repository for which you want to list pull requests.</p>
        author_arn: <p>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.</p>
        pull_request_status: <p>Optional. The status of the pull request. If used, this refines the results to the pull requests that match the specified status.</p>
        next_token: <p>An enumeration token that, when provided in a request, returns the next batch of the results.</p>
        max_results: <p>A non-zero, non-negative integer used to limit the number of returned results.</p>

    Raises:
        capo_codecommit.errors.author_does_not_exist_exception.AuthorDoesNotExistException: <p>The specified Amazon Resource Name (ARN) does not exist in the Amazon Web Services account.</p>
        capo_codecommit.errors.encryption_integrity_checks_failed_exception.EncryptionIntegrityChecksFailedException: <p>An encryption integrity check failed.</p>
        capo_codecommit.errors.encryption_key_access_denied_exception.EncryptionKeyAccessDeniedException: <p>An encryption key could not be accessed.</p>
        capo_codecommit.errors.encryption_key_disabled_exception.EncryptionKeyDisabledException: <p>The encryption key is disabled.</p>
        capo_codecommit.errors.encryption_key_not_found_exception.EncryptionKeyNotFoundException: <p>No encryption key was found.</p>
        capo_codecommit.errors.encryption_key_unavailable_exception.EncryptionKeyUnavailableException: <p>The encryption key is not available.</p>
        capo_codecommit.errors.invalid_author_arn_exception.InvalidAuthorArnException: <p>The Amazon Resource Name (ARN) is not valid. Make sure that you have provided the full ARN for the author of the pull request, and then try again.</p>
        capo_codecommit.errors.invalid_continuation_token_exception.InvalidContinuationTokenException: <p>The specified continuation token is not valid.</p>
        capo_codecommit.errors.invalid_max_results_exception.InvalidMaxResultsException: <p>The specified number of maximum results is not valid.</p>
        capo_codecommit.errors.invalid_pull_request_status_exception.InvalidPullRequestStatusException: <p>The pull request status is not valid. The only valid values are <code>OPEN</code> and <code>CLOSED</code>.</p>
        capo_codecommit.errors.invalid_repository_name_exception.InvalidRepositoryNameException: <p>A specified repository name is not valid.</p> <note> <p>This exception occurs only when a specified repository name is not valid. Other exceptions occur when a required repository parameter is missing, or when a specified repository does not exist.</p> </note>
        capo_codecommit.errors.repository_does_not_exist_exception.RepositoryDoesNotExistException: <p>The specified repository does not exist.</p>
        capo_codecommit.errors.repository_name_required_exception.RepositoryNameRequiredException: <p>A repository name is required, but was not specified.</p>
        capo_codecommit.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_codecommit.types.list_pull_requests_input.ListPullRequestsInput]",
    ) -> OperationResponse[
        "capo_codecommit.types.list_pull_requests_output.ListPullRequestsOutput"
    ]:
        import capo_codecommit._operations.code_commit_20150413.list_pull_requests

        output, http_response = (
            capo_codecommit._operations.code_commit_20150413.list_pull_requests.list_pull_requests(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListPullRequests")
    )
    input_: capo_codecommit.types.list_pull_requests_input.ListPullRequestsInput = {
        "repository_name": repository_name
    }
    if author_arn is not None:
        input_["author_arn"] = author_arn
    if pull_request_status is not None:
        input_["pull_request_status"] = pull_request_status
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output