pub struct PullRequestsClient { /* private fields */ }Expand description
Domain client for pull request operations.
Obtained via InstallationClient::pull_requests(). Cheap to clone (Arc-backed).
See docs/specs/interfaces/pull-request-operations.md
Implementations§
Source§impl PullRequestsClient
impl PullRequestsClient
Sourcepub async fn list(
&self,
owner: &str,
repo: &str,
state: Option<&str>,
page: Option<u32>,
) -> Result<PagedResponse<PullRequest>, ApiError>
pub async fn list( &self, owner: &str, repo: &str, state: Option<&str>, page: Option<u32>, ) -> Result<PagedResponse<PullRequest>, ApiError>
List pull requests in a repository.
Returns a paginated response with pull requests and pagination metadata. Use the pagination information to fetch subsequent pages if needed.
§Arguments
owner- Repository ownerrepo- Repository namestate- Filter by state ("open","closed", or"all")page- Page number (1-indexed, omit for first page)
§Examples
// Get first page
let response = client.list("owner", "repo", None, None).await?;
println!("Got {} pull requests", response.items.len());
// Check if more pages exist
if response.has_next() {
if let Some(next_page) = response.next_page_number() {
let next_response = client.list("owner", "repo", None, Some(next_page)).await?;
println!("Got {} more PRs", next_response.items.len());
}
}See docs/spec/interfaces/pull-request-operations.md
Sourcepub async fn get(
&self,
owner: &str,
repo: &str,
pull_number: u64,
) -> Result<PullRequest, ApiError>
pub async fn get( &self, owner: &str, repo: &str, pull_number: u64, ) -> Result<PullRequest, ApiError>
Get a specific pull request by number.
See docs/spec/interfaces/pull-request-operations.md
Sourcepub async fn create(
&self,
owner: &str,
repo: &str,
request: CreatePullRequestRequest,
) -> Result<PullRequest, ApiError>
pub async fn create( &self, owner: &str, repo: &str, request: CreatePullRequestRequest, ) -> Result<PullRequest, ApiError>
Create a new pull request.
See docs/spec/interfaces/pull-request-operations.md
Sourcepub async fn update(
&self,
owner: &str,
repo: &str,
pull_number: u64,
request: UpdatePullRequestRequest,
) -> Result<PullRequest, ApiError>
pub async fn update( &self, owner: &str, repo: &str, pull_number: u64, request: UpdatePullRequestRequest, ) -> Result<PullRequest, ApiError>
Update an existing pull request.
See docs/spec/interfaces/pull-request-operations.md
Sourcepub async fn merge(
&self,
owner: &str,
repo: &str,
pull_number: u64,
request: MergePullRequestRequest,
) -> Result<MergeResult, ApiError>
pub async fn merge( &self, owner: &str, repo: &str, pull_number: u64, request: MergePullRequestRequest, ) -> Result<MergeResult, ApiError>
Merge a pull request.
See docs/spec/interfaces/pull-request-operations.md
Sourcepub async fn set_milestone(
&self,
owner: &str,
repo: &str,
pull_number: u64,
milestone_number: Option<u64>,
) -> Result<PullRequest, ApiError>
pub async fn set_milestone( &self, owner: &str, repo: &str, pull_number: u64, milestone_number: Option<u64>, ) -> Result<PullRequest, ApiError>
Set the milestone on a pull request.
The GitHub Pulls API silently ignores the milestone field, so this method delegates to the Issues API (PATCH /repos/{owner}/{repo}/issues/{number}) which correctly applies the milestone, then re-fetches the PR to return the updated state.
§Partial-failure note
If the Issues API call succeeds but the subsequent get() call fails
(e.g. due to a transient network error), this method returns an error even
though the milestone was actually set on the PR. Callers should treat
an error response as “milestone state unknown” rather than “milestone not
set” and may wish to re-fetch the PR to confirm the current state.
See docs/specs/interfaces/pull-request-operations.md
Sourcepub async fn list_reviews(
&self,
owner: &str,
repo: &str,
pull_number: u64,
) -> Result<Vec<Review>, ApiError>
pub async fn list_reviews( &self, owner: &str, repo: &str, pull_number: u64, ) -> Result<Vec<Review>, ApiError>
List reviews on a pull request.
See docs/spec/interfaces/pull-request-operations.md
Sourcepub async fn get_review(
&self,
owner: &str,
repo: &str,
pull_number: u64,
review_id: u64,
) -> Result<Review, ApiError>
pub async fn get_review( &self, owner: &str, repo: &str, pull_number: u64, review_id: u64, ) -> Result<Review, ApiError>
Get a specific review by ID.
See docs/spec/interfaces/pull-request-operations.md
Sourcepub async fn create_review(
&self,
owner: &str,
repo: &str,
pull_number: u64,
request: CreateReviewRequest,
) -> Result<Review, ApiError>
pub async fn create_review( &self, owner: &str, repo: &str, pull_number: u64, request: CreateReviewRequest, ) -> Result<Review, ApiError>
Create a review on a pull request.
See docs/spec/interfaces/pull-request-operations.md
Sourcepub async fn update_review(
&self,
owner: &str,
repo: &str,
pull_number: u64,
review_id: u64,
request: UpdateReviewRequest,
) -> Result<Review, ApiError>
pub async fn update_review( &self, owner: &str, repo: &str, pull_number: u64, review_id: u64, request: UpdateReviewRequest, ) -> Result<Review, ApiError>
Update a pending review.
See docs/spec/interfaces/pull-request-operations.md
Sourcepub async fn dismiss_review(
&self,
owner: &str,
repo: &str,
pull_number: u64,
review_id: u64,
request: DismissReviewRequest,
) -> Result<Review, ApiError>
pub async fn dismiss_review( &self, owner: &str, repo: &str, pull_number: u64, review_id: u64, request: DismissReviewRequest, ) -> Result<Review, ApiError>
Dismiss a review.
See docs/spec/interfaces/pull-request-operations.md
Sourcepub async fn list_comments(
&self,
owner: &str,
repo: &str,
pull_number: u64,
) -> Result<Vec<Comment>, ApiError>
pub async fn list_comments( &self, owner: &str, repo: &str, pull_number: u64, ) -> Result<Vec<Comment>, ApiError>
List all conversation-thread comments on a pull request (auto-paginated).
Uses the Issues comments endpoint per GitHub API design.
See docs/specs/interfaces/pull-request-operations.md
Sourcepub async fn create_comment(
&self,
owner: &str,
repo: &str,
pull_number: u64,
request: CreatePullRequestCommentRequest,
) -> Result<Comment, ApiError>
pub async fn create_comment( &self, owner: &str, repo: &str, pull_number: u64, request: CreatePullRequestCommentRequest, ) -> Result<Comment, ApiError>
Add a conversation-thread comment to a pull request.
Uses the Issues comments endpoint per GitHub API design.
See docs/specs/interfaces/pull-request-operations.md
Sourcepub async fn update_comment(
&self,
owner: &str,
repo: &str,
comment_id: u64,
request: UpdatePullRequestCommentRequest,
) -> Result<Comment, ApiError>
pub async fn update_comment( &self, owner: &str, repo: &str, comment_id: u64, request: UpdatePullRequestCommentRequest, ) -> Result<Comment, ApiError>
Update an existing pull request conversation-thread comment.
See docs/specs/interfaces/pull-request-operations.md
Sourcepub async fn delete_comment(
&self,
owner: &str,
repo: &str,
comment_id: u64,
) -> Result<(), ApiError>
pub async fn delete_comment( &self, owner: &str, repo: &str, comment_id: u64, ) -> Result<(), ApiError>
Delete a pull request conversation-thread comment.
See docs/specs/interfaces/pull-request-operations.md
Sourcepub async fn add_labels(
&self,
owner: &str,
repo: &str,
pull_number: u64,
labels: Vec<String>,
) -> Result<Vec<Label>, ApiError>
pub async fn add_labels( &self, owner: &str, repo: &str, pull_number: u64, labels: Vec<String>, ) -> Result<Vec<Label>, ApiError>
Add labels to a pull request.
See docs/specs/interfaces/pull-request-operations.md
Sourcepub async fn replace_labels(
&self,
owner: &str,
repo: &str,
pull_number: u64,
labels: Vec<String>,
) -> Result<Vec<Label>, ApiError>
pub async fn replace_labels( &self, owner: &str, repo: &str, pull_number: u64, labels: Vec<String>, ) -> Result<Vec<Label>, ApiError>
Replace all labels on a pull request.
Replaces the entire set of labels. Pass an empty vec to clear all labels.
See docs/specs/interfaces/pull-request-operations.md
Sourcepub async fn remove_label(
&self,
owner: &str,
repo: &str,
pull_number: u64,
name: &str,
) -> Result<Vec<Label>, ApiError>
pub async fn remove_label( &self, owner: &str, repo: &str, pull_number: u64, name: &str, ) -> Result<Vec<Label>, ApiError>
Remove a label from a pull request.
See docs/spec/interfaces/pull-request-operations.md
§Error mapping
GitHub returns HTTP 422 when the label name is unprocessable (e.g. does
not exist on the repository). This method maps that to
ApiError::InvalidRequest, which is the correct semantic mapping and
is consistent with how other label methods in this file behave. Callers
that previously matched on ApiError::HttpError { status: 422, .. }
must be updated to match ApiError::InvalidRequest { .. } instead.
Trait Implementations§
Source§impl Clone for PullRequestsClient
impl Clone for PullRequestsClient
Source§fn clone(&self) -> PullRequestsClient
fn clone(&self) -> PullRequestsClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more