Skip to main content

GhClient

Trait GhClient 

Source
pub trait GhClient {
    // Required methods
    fn list_open_prs(&self, dir: &Path) -> Result<Vec<PrSummary>>;
    fn view_pr(&self, dir: &Path, target: &str) -> Result<PrView>;
    fn default_branch(&self, dir: &Path) -> Result<Option<String>>;
    fn find_pr_for_branch(
        &self,
        dir: &Path,
        branch: &str,
    ) -> Result<Option<OpenPr>>;
    fn create_pr(&self, dir: &Path, args: &[String]) -> Result<String>;
    fn edit_pr(&self, dir: &Path, args: &[String]) -> Result<String>;

    // Provided methods
    fn list_open_issues(&self, _dir: &Path) -> Result<Vec<IssueSummary>> { ... }
    fn view_issue(&self, _dir: &Path, _target: &str) -> Result<IssueView> { ... }
    fn open_pr_numbers(&self, dir: &Path) -> Result<Vec<u64>> { ... }
}
Expand description

Performs GitHub pull-request operations via gh.

Required Methods§

Source

fn list_open_prs(&self, dir: &Path) -> Result<Vec<PrSummary>>

Lists open PRs for the repository at dir.

Source

fn view_pr(&self, dir: &Path, target: &str) -> Result<PrView>

Views the PR identified by target (a number, URL, or head branch).

Source

fn default_branch(&self, dir: &Path) -> Result<Option<String>>

The repository’s default branch (gh repo view --json defaultBranchRef), or None on any failure (kept non-fatal so trunk detection can fall back to local git state offline).

Source

fn find_pr_for_branch(&self, dir: &Path, branch: &str) -> Result<Option<OpenPr>>

The open PR whose head is branch, if any.

Source

fn create_pr(&self, dir: &Path, args: &[String]) -> Result<String>

Runs gh pr create with the prebuilt args, returning stdout (the URL line is parsed by the caller). Args are typically built by sendit::build_create_args.

Source

fn edit_pr(&self, dir: &Path, args: &[String]) -> Result<String>

Runs gh pr edit with the prebuilt args, returning stdout. Args are typically built by sendit::build_edit_args.

Provided Methods§

Source

fn list_open_issues(&self, _dir: &Path) -> Result<Vec<IssueSummary>>

Lists open issues for the repository at dir.

Defaulted so third-party GhClient implementations stay source-compatible; clients that support the issue workflow override it.

Source

fn view_issue(&self, _dir: &Path, _target: &str) -> Result<IssueView>

Views the issue identified by target (a number or URL).

Defaulted for the same reason as GhClient::list_open_issues.

Source

fn open_pr_numbers(&self, dir: &Path) -> Result<Vec<u64>>

Lists open PR numbers (for completion; best-effort).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§