pub struct PullRequestsApi<'a> { /* private fields */ }Implementations§
Source§impl<'a> PullRequestsApi<'a>
impl<'a> PullRequestsApi<'a>
Sourcepub async fn list(
&self,
repo: &RepoRef,
filter: &PullRequestFilter,
) -> Result<Vec<PullRequest>>
pub async fn list( &self, repo: &RepoRef, filter: &PullRequestFilter, ) -> Result<Vec<PullRequest>>
GET /api/v1/repos/{repo_ref}/pullreq
Sourcepub async fn get(&self, repo: &RepoRef, number: u64) -> Result<PullRequest>
pub async fn get(&self, repo: &RepoRef, number: u64) -> Result<PullRequest>
GET /api/v1/repos/{repo_ref}/pullreq/{pullreq_number}
Sourcepub async fn find_for_branch(
&self,
repo: &RepoRef,
branch: &str,
) -> Result<Option<PullRequest>>
pub async fn find_for_branch( &self, repo: &RepoRef, branch: &str, ) -> Result<Option<PullRequest>>
The open pull request whose source branch is branch, if there is one.
This is how gf pr view works with no number: the branch you are
standing on identifies the pull request.
Sourcepub async fn find_any_for_branch(
&self,
repo: &RepoRef,
branch: &str,
) -> Result<Option<PullRequest>>
pub async fn find_any_for_branch( &self, repo: &RepoRef, branch: &str, ) -> Result<Option<PullRequest>>
The most recent pull request from branch in any state — what a branch
names once its pull request has been merged or closed.
Sourcepub async fn create(
&self,
repo: &RepoRef,
input: &CreatePullRequest,
) -> Result<PullRequest>
pub async fn create( &self, repo: &RepoRef, input: &CreatePullRequest, ) -> Result<PullRequest>
POST /api/v1/repos/{repo_ref}/pullreq
Sourcepub async fn update(
&self,
repo: &RepoRef,
number: u64,
input: &UpdatePullRequest,
) -> Result<PullRequest>
pub async fn update( &self, repo: &RepoRef, number: u64, input: &UpdatePullRequest, ) -> Result<PullRequest>
PATCH /api/v1/repos/{repo_ref}/pullreq/{pullreq_number}
Sourcepub async fn merge(
&self,
repo: &RepoRef,
number: u64,
input: &MergePullRequest,
) -> Result<MergeResult>
pub async fn merge( &self, repo: &RepoRef, number: u64, input: &MergePullRequest, ) -> Result<MergeResult>
POST /api/v1/repos/{repo_ref}/pullreq/{pullreq_number}/merge
Sourcepub async fn delete_source_branch(
&self,
repo: &RepoRef,
number: u64,
) -> Result<()>
pub async fn delete_source_branch( &self, repo: &RepoRef, number: u64, ) -> Result<()>
DELETE /api/v1/repos/{repo_ref}/pullreq/{pullreq_number}/branch
Separate from the merge call: GitFox has no delete_branch flag on
merge, so gf pr merge --delete-branch is two requests.
Sourcepub async fn diff_files(
&self,
repo: &RepoRef,
number: u64,
) -> Result<Vec<FileDiff>>
pub async fn diff_files( &self, repo: &RepoRef, number: u64, ) -> Result<Vec<FileDiff>>
GET …/pullreq/{pullreq_number}/diff as structured per-file entries.
The endpoint content-negotiates: JSON here, raw text in
Self::diff_text. Both describe the same change.
Sourcepub async fn diff_text(&self, repo: &RepoRef, number: u64) -> Result<String>
pub async fn diff_text(&self, repo: &RepoRef, number: u64) -> Result<String>
GET …/pullreq/{pullreq_number}/diff as a raw unified diff.
Sourcepub async fn checks(
&self,
repo: &RepoRef,
number: u64,
) -> Result<PullRequestChecks>
pub async fn checks( &self, repo: &RepoRef, number: u64, ) -> Result<PullRequestChecks>
GET …/pullreq/{pullreq_number}/checks
Sourcepub async fn commits(
&self,
repo: &RepoRef,
number: u64,
page: u32,
limit: u32,
) -> Result<Vec<Commit>>
pub async fn commits( &self, repo: &RepoRef, number: u64, page: u32, limit: u32, ) -> Result<Vec<Commit>>
GET …/pullreq/{pullreq_number}/commits, oldest first.
Sourcepub async fn set_state(
&self,
repo: &RepoRef,
number: u64,
state: PullRequestState,
) -> Result<PullRequest>
pub async fn set_state( &self, repo: &RepoRef, number: u64, state: PullRequestState, ) -> Result<PullRequest>
POST /api/v1/repos/{repo_ref}/pullreq/{pullreq_number}/state
Sourcepub async fn set_draft(
&self,
repo: &RepoRef,
number: u64,
draft: bool,
) -> Result<PullRequest>
pub async fn set_draft( &self, repo: &RepoRef, number: u64, draft: bool, ) -> Result<PullRequest>
Mark an open pull request as a draft, or as ready for review.
The same endpoint as Self::set_state: GitFox treats “draft” as a
facet of the open state rather than a state of its own.
Sourcepub async fn activities(
&self,
repo: &RepoRef,
number: u64,
kinds: &[&str],
) -> Result<Vec<PullRequestActivity>>
pub async fn activities( &self, repo: &RepoRef, number: u64, kinds: &[&str], ) -> Result<Vec<PullRequestActivity>>
GET …/pullreq/{pullreq_number}/activities, optionally only some kinds
(comment, change-comment, system).
Sourcepub async fn comment(
&self,
repo: &RepoRef,
number: u64,
text: &str,
) -> Result<PullRequestActivity>
pub async fn comment( &self, repo: &RepoRef, number: u64, text: &str, ) -> Result<PullRequestActivity>
POST …/pullreq/{pullreq_number}/comments
Sourcepub async fn update_comment(
&self,
repo: &RepoRef,
number: u64,
comment_id: i64,
text: &str,
) -> Result<PullRequestActivity>
pub async fn update_comment( &self, repo: &RepoRef, number: u64, comment_id: i64, text: &str, ) -> Result<PullRequestActivity>
PATCH …/comments/{pullreq_comment_id}
Sourcepub async fn delete_comment(
&self,
repo: &RepoRef,
number: u64,
comment_id: i64,
) -> Result<()>
pub async fn delete_comment( &self, repo: &RepoRef, number: u64, comment_id: i64, ) -> Result<()>
DELETE …/comments/{pullreq_comment_id}
Sourcepub async fn review(
&self,
repo: &RepoRef,
number: u64,
commit_sha: &str,
decision: ReviewDecision,
) -> Result<()>
pub async fn review( &self, repo: &RepoRef, number: u64, commit_sha: &str, decision: ReviewDecision, ) -> Result<()>
POST …/pullreq/{pullreq_number}/reviews
A review is a decision about one commit; GitFox has no review body, so anything the reviewer wants to say is a separate comment.
Sourcepub async fn reviewers(
&self,
repo: &RepoRef,
number: u64,
) -> Result<Vec<PullRequestReviewer>>
pub async fn reviewers( &self, repo: &RepoRef, number: u64, ) -> Result<Vec<PullRequestReviewer>>
GET …/pullreq/{pullreq_number}/reviewers
Sourcepub async fn add_reviewer(
&self,
repo: &RepoRef,
number: u64,
reviewer_id: i64,
) -> Result<PullRequestReviewer>
pub async fn add_reviewer( &self, repo: &RepoRef, number: u64, reviewer_id: i64, ) -> Result<PullRequestReviewer>
PUT …/pullreq/{pullreq_number}/reviewers
Sourcepub async fn remove_reviewer(
&self,
repo: &RepoRef,
number: u64,
reviewer_id: i64,
) -> Result<()>
pub async fn remove_reviewer( &self, repo: &RepoRef, number: u64, reviewer_id: i64, ) -> Result<()>
DELETE …/pullreq/{pullreq_number}/reviewers/{pullreq_reviewer_id}
Sourcepub async fn labels(
&self,
repo: &RepoRef,
number: u64,
) -> Result<PullRequestLabels>
pub async fn labels( &self, repo: &RepoRef, number: u64, ) -> Result<PullRequestLabels>
GET …/pullreq/{pullreq_number}/labels — every label that could be
attached, each saying whether it is.