pub struct GhClient<R: CommandRunner> { /* private fields */ }Expand description
Client for GitHub operations via the gh CLI.
Implementations§
Source§impl<R: CommandRunner> GhClient<R>
impl<R: CommandRunner> GhClient<R>
Sourcepub async fn get_issues_by_label(&self, label: &str) -> Result<Vec<Issue>>
pub async fn get_issues_by_label(&self, label: &str) -> Result<Vec<Issue>>
Fetch open issues with the given label, ordered oldest first.
Sourcepub async fn get_issue(&self, issue_number: u32) -> Result<Issue>
pub async fn get_issue(&self, issue_number: u32) -> Result<Issue>
Fetch a single issue by number.
Sourcepub async fn get_current_user(&self) -> Result<String>
pub async fn get_current_user(&self) -> Result<String>
Fetch the authenticated GitHub user’s login.
Source§impl<R: CommandRunner> GhClient<R>
impl<R: CommandRunner> GhClient<R>
Sourcepub async fn add_label(&self, issue_number: u32, label: &str) -> Result<()>
pub async fn add_label(&self, issue_number: u32, label: &str) -> Result<()>
Add a label to an issue.
Sourcepub async fn remove_label(&self, issue_number: u32, label: &str) -> Result<()>
pub async fn remove_label(&self, issue_number: u32, label: &str) -> Result<()>
Remove a label from an issue.
Sourcepub async fn swap_labels(
&self,
issue_number: u32,
remove: &str,
add: &str,
) -> Result<()>
pub async fn swap_labels( &self, issue_number: u32, remove: &str, add: &str, ) -> Result<()>
Remove one label and add another in a single gh CLI call.
Sourcepub async fn ensure_labels_exist(&self) -> Result<()>
pub async fn ensure_labels_exist(&self) -> Result<()>
Ensure all oven labels exist in the repository.
Source§impl<R: CommandRunner> GhClient<R>
impl<R: CommandRunner> GhClient<R>
Sourcepub async fn create_draft_pr(
&self,
title: &str,
branch: &str,
body: &str,
) -> Result<u32>
pub async fn create_draft_pr( &self, title: &str, branch: &str, body: &str, ) -> Result<u32>
Create a draft pull request and return its number.
Sourcepub async fn create_draft_pr_in(
&self,
title: &str,
branch: &str,
body: &str,
repo_dir: &Path,
) -> Result<u32>
pub async fn create_draft_pr_in( &self, title: &str, branch: &str, body: &str, repo_dir: &Path, ) -> Result<u32>
Create a draft pull request in a specific repo directory and return its number.
Used in multi-repo mode where the PR belongs in the target repo, not the god repo.
Sourcepub async fn comment_on_pr(&self, pr_number: u32, body: &str) -> Result<()>
pub async fn comment_on_pr(&self, pr_number: u32, body: &str) -> Result<()>
Post a comment on a pull request (in the default repo).
Sourcepub async fn comment_on_pr_in(
&self,
pr_number: u32,
body: &str,
repo_dir: &Path,
) -> Result<()>
pub async fn comment_on_pr_in( &self, pr_number: u32, body: &str, repo_dir: &Path, ) -> Result<()>
Post a comment on a pull request in a specific repo directory.
Sourcepub async fn edit_pr(
&self,
pr_number: u32,
title: &str,
body: &str,
) -> Result<()>
pub async fn edit_pr( &self, pr_number: u32, title: &str, body: &str, ) -> Result<()>
Update the title and body of a pull request (in the default repo).
Sourcepub async fn edit_pr_in(
&self,
pr_number: u32,
title: &str,
body: &str,
repo_dir: &Path,
) -> Result<()>
pub async fn edit_pr_in( &self, pr_number: u32, title: &str, body: &str, repo_dir: &Path, ) -> Result<()>
Update the title and body of a pull request in a specific repo directory.
Sourcepub async fn mark_pr_ready(&self, pr_number: u32) -> Result<()>
pub async fn mark_pr_ready(&self, pr_number: u32) -> Result<()>
Mark a PR as ready for review (in the default repo).
Sourcepub async fn mark_pr_ready_in(
&self,
pr_number: u32,
repo_dir: &Path,
) -> Result<()>
pub async fn mark_pr_ready_in( &self, pr_number: u32, repo_dir: &Path, ) -> Result<()>
Mark a PR as ready for review in a specific repo directory.
Sourcepub async fn get_pr_state(&self, pr_number: u32) -> Result<PrState>
pub async fn get_pr_state(&self, pr_number: u32) -> Result<PrState>
Check the merge state of a pull request (in the default repo).
Sourcepub async fn get_pr_state_in(
&self,
pr_number: u32,
repo_dir: &Path,
) -> Result<PrState>
pub async fn get_pr_state_in( &self, pr_number: u32, repo_dir: &Path, ) -> Result<PrState>
Check the merge state of a pull request in a specific repo directory.
Sourcepub async fn merge_pr(
&self,
pr_number: u32,
strategy: &MergeStrategy,
) -> Result<()>
pub async fn merge_pr( &self, pr_number: u32, strategy: &MergeStrategy, ) -> Result<()>
Merge a pull request (in the default repo).
Sourcepub async fn merge_pr_in(
&self,
pr_number: u32,
strategy: &MergeStrategy,
repo_dir: &Path,
) -> Result<()>
pub async fn merge_pr_in( &self, pr_number: u32, strategy: &MergeStrategy, repo_dir: &Path, ) -> Result<()>
Merge a pull request in a specific repo directory.