Skip to content

PullRequest

NOTE: Intended instantiation via Repository get_pull_requests/get_pull_request methods, rather than direct initialisation.

This class represents a PullRequest on a specific repository.

It may be used to perform actions within the context of the PullRequest.

Attributes:

Name Type Description
identifier int

Unique identifier of the PullRequest

number int

User friendly number of the pull request

client Session

Session used to make requests to the RESTAPI, intended to be passed in when instance is created via Repository

base_url str

Base URL we should use for querying the RESTAPI within the context of the PullRequest

title str

Title given to the PullRequest

repo str

Name of the Repository which the instance is associated with

state PullRequestState

State of the pull request

__eq__(other)

Parameters:

Name Type Description Default
other object

Object to compare against

required

Returns:

Type Description
bool

True if instances are equal, False otherwise.

__hash__()

Returns:

Type Description
int

Unique int representation of instance.

__post_init__()

Dataclass magic method, utilised in this instance to calculate useful values from, and populate said values in to, state.

__str__()

Returns:

Type Description
str

Information string representation

get_comments()

Examples:

get_comments()

Returns:

Type Description
List[Comment]

All Comments on the PullRequest, empty if none found or instance otherwise doesn't have access to, or fails to query, the RESTAPI.

post_comment(body)

Parameters:

Name Type Description Default
body str

Body of the comment to post to the PullRequest

required

Returns:

Type Description
Union[Comment, None]

Comment instance if successfully posted, else None