Skip to main content

MockGitHubApi

Struct MockGitHubApi 

Source
pub struct MockGitHubApi { /* private fields */ }
Expand description

The GitHub operations this crate exposes — the interface consumers code against and mock in tests.

Implementations§

Source§

impl MockGitHubApi

Source

pub fn checkpoint(&mut self)

Validate that all current expectations for all methods have been satisfied, and discard them.

Source

pub fn new() -> Self

Create a new mock object with no expectations.

This method will not be generated if the real struct already has a new method. However, it will be generated if the struct implements a trait with a new method. The trait’s new method can still be called like <MockX as TraitY>::new

Source§

impl MockGitHubApi

Source

pub fn expect_run(&mut self) -> &mut Expectation

Create an Expectation for mocking the run method

Source

pub fn expect_run_raw(&mut self) -> &mut Expectation

Create an Expectation for mocking the run_raw method

Source

pub fn expect_version(&mut self) -> &mut Expectation

Create an Expectation for mocking the version method

Source

pub fn expect_capabilities(&mut self) -> &mut Expectation

Create an Expectation for mocking the capabilities method

Source

pub fn expect_auth_status(&mut self) -> &mut Expectation

Create an Expectation for mocking the auth_status method

Source

pub fn expect_auth_status_for(&mut self) -> &mut Expectation

Create an Expectation for mocking the auth_status_for method

Source

pub fn expect_repo_view(&mut self) -> &mut Expectation

Create an Expectation for mocking the repo_view method

Source

pub fn expect_pr_list(&mut self) -> &mut Expectation

Create an Expectation for mocking the pr_list method

Source

pub fn expect_pr_list_with(&mut self) -> &mut Expectation

Create an Expectation for mocking the pr_list_with method

Source

pub fn expect_pr_list_for_source_branch(&mut self) -> &mut Expectation

Create an Expectation for mocking the pr_list_for_source_branch method

Source

pub fn expect_pr_list_for_branch(&mut self) -> &mut Expectation

Create an Expectation for mocking the pr_list_for_branch method

Source

pub fn expect_pr_view(&mut self) -> &mut Expectation

Create an Expectation for mocking the pr_view method

Source

pub fn expect_issue_list(&mut self) -> &mut Expectation

Create an Expectation for mocking the issue_list method

Source

pub fn expect_issue_list_with(&mut self) -> &mut Expectation

Create an Expectation for mocking the issue_list_with method

Source

pub fn expect_pr_create(&mut self) -> &mut Expectation

Create an Expectation for mocking the pr_create method

Source

pub fn expect_api(&mut self) -> &mut Expectation

Create an Expectation for mocking the api method

Source

pub fn expect_pr_merge(&mut self) -> &mut Expectation

Create an Expectation for mocking the pr_merge method

Source

pub fn expect_pr_mark_ready(&mut self) -> &mut Expectation

Create an Expectation for mocking the pr_mark_ready method

Source

pub fn expect_pr_close(&mut self) -> &mut Expectation

Create an Expectation for mocking the pr_close method

Source

pub fn expect_pr_add_labels(&mut self) -> &mut Expectation

Create an Expectation for mocking the pr_add_labels method

Source

pub fn expect_pr_remove_labels(&mut self) -> &mut Expectation

Create an Expectation for mocking the pr_remove_labels method

Source

pub fn expect_pr_checkout(&mut self) -> &mut Expectation

Create an Expectation for mocking the pr_checkout method

Source

pub fn expect_pr_checks(&mut self) -> &mut Expectation

Create an Expectation for mocking the pr_checks method

Source

pub fn expect_pr_review(&mut self) -> &mut Expectation

Create an Expectation for mocking the pr_review method

Source

pub fn expect_pr_comment(&mut self) -> &mut Expectation

Create an Expectation for mocking the pr_comment method

Source

pub fn expect_pr_edit(&mut self) -> &mut Expectation

Create an Expectation for mocking the pr_edit method

Source

pub fn expect_pr_feedback(&mut self) -> &mut Expectation

Create an Expectation for mocking the pr_feedback method

Source

pub fn expect_pr_diff(&mut self) -> &mut Expectation

Create an Expectation for mocking the pr_diff method

Source

pub fn expect_workflow_list(&mut self) -> &mut Expectation

Create an Expectation for mocking the workflow_list method

Source

pub fn expect_workflow_list_with(&mut self) -> &mut Expectation

Create an Expectation for mocking the workflow_list_with method

Source

pub fn expect_workflow_view(&mut self) -> &mut Expectation

Create an Expectation for mocking the workflow_view method

Source

pub fn expect_run_list(&mut self) -> &mut Expectation

Create an Expectation for mocking the run_list method

Source

pub fn expect_run_view(&mut self) -> &mut Expectation

Create an Expectation for mocking the run_view method

Source

pub fn expect_run_watch(&mut self) -> &mut Expectation

Create an Expectation for mocking the run_watch method

Source

pub fn expect_workflow_dispatch(&mut self) -> &mut Expectation

Create an Expectation for mocking the workflow_dispatch method

Source

pub fn expect_run_rerun(&mut self) -> &mut Expectation

Create an Expectation for mocking the run_rerun method

Source

pub fn expect_run_cancel(&mut self) -> &mut Expectation

Create an Expectation for mocking the run_cancel method

Source

pub fn expect_issue_create(&mut self) -> &mut Expectation

Create an Expectation for mocking the issue_create method

Source

pub fn expect_issue_create_with(&mut self) -> &mut Expectation

Create an Expectation for mocking the issue_create_with method

Source

pub fn expect_issue_add_labels(&mut self) -> &mut Expectation

Create an Expectation for mocking the issue_add_labels method

Source

pub fn expect_issue_remove_labels(&mut self) -> &mut Expectation

Create an Expectation for mocking the issue_remove_labels method

Source

pub fn expect_issue_view(&mut self) -> &mut Expectation

Create an Expectation for mocking the issue_view method

Source

pub fn expect_issue_close(&mut self) -> &mut Expectation

Create an Expectation for mocking the issue_close method

Source

pub fn expect_issue_reopen(&mut self) -> &mut Expectation

Create an Expectation for mocking the issue_reopen method

Source

pub fn expect_issue_comment(&mut self) -> &mut Expectation

Create an Expectation for mocking the issue_comment method

Source

pub fn expect_release_list(&mut self) -> &mut Expectation

Create an Expectation for mocking the release_list method

Source

pub fn expect_release_view(&mut self) -> &mut Expectation

Create an Expectation for mocking the release_view method

Source

pub fn expect_release_create(&mut self) -> &mut Expectation

Create an Expectation for mocking the release_create method

Source

pub fn expect_release_delete(&mut self) -> &mut Expectation

Create an Expectation for mocking the release_delete method

Trait Implementations§

Source§

impl Debug for MockGitHubApi

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for MockGitHubApi

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl GitHubApi for MockGitHubApi

The GitHub operations this crate exposes — the interface consumers code against and mock in tests.

Source§

fn run<'life0, 'life1, 'async_trait>( &'life0 self, args: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Run gh <args> in the process’s current directory, returning trimmed stdout (throws on a non-zero exit). A raw escape hatch — you supply the whole argv, so pass -R owner/repo to target a specific repo. This method on the client is the process-cwd escape hatch; the at(dir) bound view’s run is instead bound to dir (it forwards to GitHub::run_in, so gh.at(dir).run(…) runs in the bound repo’s cwd, like api). Use gh.at(dir).run(…) (or GitHub::run_in) for the bound repo (T-035).

Source§

fn run_raw<'life0, 'life1, 'async_trait>( &'life0 self, args: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<ProcessResult<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Like GitHubApi::run but never errors on a non-zero exit — returns the captured ProcessResult.

Source§

fn version<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Installed GitHub CLI version (gh --version).

Source§

fn capabilities<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<GitHubCapabilities>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The installed binary’s parsed version, as GitHubCapabilities (gh --version). A value type — probe once and keep it; an unrecognisable version banner is an ErrorReason::Parse. Gate an operation on a minimum gh with GitHubCapabilities::ensure_supported.

Source§

fn auth_status<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Whether the user is authenticated (gh auth status exits zero). Reflects the exit code as a bool — any non-zero exit reads as false, never an error; only a spawn failure or timeout errors. Unscoped: it inspects every configured host, so a broken session for one host can make it report false even when the host you care about is fine — reach for auth_status_for to scope it.

Source§

fn auth_status_for<'life0, 'life1, 'async_trait>( &'life0 self, host: &'life1 GitHubHost, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Whether the user is authenticated for host (gh auth status --hostname <host> exits zero) — the host-scoped twin of auth_status. Scoping to the repository’s host (build a GitHubHost from its remote, e.g. GitHubHost::from_remote_url) means a broken or absent session for another host can’t turn this into a false negative for the host you target. Like auth_status, it folds only the exit code into the bool (any non-zero exit → false); a spawn failure or timeout still errors. Defaulted to ErrorReason::Unsupported so external implementers of the trait keep compiling when the crate bumps (only the GitHub concrete impl and the regenerated MockGitHubApi override it).

Source§

fn repo_view<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<RepoView>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The repository for dir (gh repo view --json …).

Source§

fn pr_list<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<Vec<PullRequest>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Pull requests for dir (gh pr list --limit 100 --json …). Returns up to 100 open PRs; use run for more.

Source§

fn pr_list_with<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, spec: PrList, ) -> Pin<Box<dyn Future<Output = Result<Vec<PullRequest>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Pull requests selected by spec (--state / --limit). A zero limit is rejected before spawning. Defaulted to ErrorReason::Unsupported so external trait implementers keep compiling when the crate bumps.

Source§

fn pr_list_for_source_branch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, head: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<PullRequest>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Pull requests whose source branch is head, in any state — open, closed, or merged (gh pr list --head <head> --state all --limit 100 --json …). Empty when none match; returns up to 100. A flag-like or empty head is rejected before spawning so an untrusted branch cannot alter the command.

Defaulted to ErrorReason::Unsupported so external trait implementers keep compiling when the crate bumps.

Source§

fn pr_list_for_branch<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, dir: &'life1 Path, head: &'life2 str, base: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<PullRequest>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Pull requests that merge head into base, in any state — open, closed, or merged (gh pr list --head <head> --base <base> --state all --limit 100 --json …). Each carries its title, URL, and state. Empty when none match; returns up to 100 (use run for more).

Source§

fn pr_view<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, number: u64, ) -> Pin<Box<dyn Future<Output = Result<PullRequest>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

A single pull request by number (gh pr view <n> --json …).

Source§

fn issue_list<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<Vec<Issue>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Issues for dir (gh issue list --limit 100 --json …). Returns up to 100 open issues; use run for more.

Source§

fn issue_list_with<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, spec: IssueList, ) -> Pin<Box<dyn Future<Output = Result<Vec<Issue>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Issues selected by spec (--state / --limit). A zero limit is rejected before spawning. Defaulted to ErrorReason::Unsupported so external trait implementers keep compiling when the crate bumps.

Source§

fn pr_create<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, spec: PrCreate, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Open a pull request, returning its URL (gh pr create) — see PrCreate for the title/body and the optional head (source branch; None = current branch) / base (target; None = repo default).

Source§

fn api<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, endpoint: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Raw GitHub REST/GraphQL response body (gh api <endpoint>), run in dir so a relative endpoint’s {owner}/{repo} placeholder resolves against the bound repository — not whatever repo the process’s current directory happens to be in.

Source§

fn pr_merge<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, number: u64, merge: PrMerge, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Merge a pull request (gh pr merge <n> --merge|--squash|--rebase [--auto] [--delete-branch]) — see PrMerge.

Source§

fn pr_mark_ready<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, number: u64, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Mark a draft pull request as ready for review (gh pr ready <n>).

Source§

fn pr_close<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, number: u64, spec: PrClose, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Close a pull request without merging (gh pr close <n> [--delete-branch]); see PrClose.

Source§

fn pr_add_labels<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, number: u64, labels: &'life2 [String], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Add labels to an existing pull request (gh pr edit <n> --add-label <name>).

Source§

fn pr_remove_labels<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, number: u64, labels: &'life2 [String], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Remove labels from an existing pull request (gh pr edit <n> --remove-label <name>).

Source§

fn pr_checkout<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, number: u64, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check out a pull request’s branch into the working copy at dir (gh pr checkout <n>) — the head branch is fetched and switched to, so a subsequent build/test/edit runs against the PR locally. Mutates the working copy. Defaulted to ErrorReason::Unsupported so external implementers of the trait keep compiling when the crate bumps (only the GitHub concrete impl and the regenerated MockGitHubApi override it).

Source§

fn pr_checks<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, number: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<CheckRun>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The PR’s checks (gh pr checks <n> --json …). gh signals the overall outcome through its exit code — 0 all passed, 8 still pending, 1 some failed — and emits the same JSON either way, so all three return the parsed list; branch on each entry’s bucket. A PR with no checks at all yields an empty list (gh’s “no checks reported” exit). Any other exit (no such PR, auth required, …) errors.

Source§

fn pr_review<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, number: u64, action: ReviewAction, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Submit a review (gh pr review <n> --approve|--request-changes|--comment [--body <body>]) — see ReviewAction (request-changes/comment carry a required body by construction).

Source§

fn pr_comment<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, number: u64, body: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Add a conversation comment, returning its URL (gh pr comment <n> --body <body>).

Source§

fn pr_edit<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, number: u64, edit: PrEdit, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Edit a pull request’s title and/or body (gh pr edit <n> [--title <title>] [--body <body>]). At least one of title or body must be Some — the facade rejects both-None before reaching the wrapper, so the default implementation is unreachable in normal use. Defaulted to ErrorReason::Unsupported so external implementers of the trait keep compiling when the crate bumps.

Source§

fn pr_feedback<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, number: u64, ) -> Pin<Box<dyn Future<Output = Result<PrFeedback>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The PR’s submitted reviews and conversation comments (gh pr view <n> --json reviews,comments).

Source§

fn pr_diff<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, number: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<FileDiff>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The PR’s diff, one FileDiff per changed file (gh pr diff <n> --color never), through the same unified-diff parser vcs-git/vcs-jj use — gh pr diff emits the same git-format diff git diff does.

Source§

fn workflow_list<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<Vec<Workflow>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Active workflow definitions (gh workflow list --limit 50 --json …). Disabled workflows are hidden; use workflow_list_with with WorkflowList::all to include them. Defaulted to ErrorReason::Unsupported so external trait implementers keep compiling.

Source§

fn workflow_list_with<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, spec: WorkflowList, ) -> Pin<Box<dyn Future<Output = Result<Vec<Workflow>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Workflow definitions selected by spec (--all / --limit). A zero limit is rejected before spawning. Defaulted to ErrorReason::Unsupported so external trait implementers keep compiling.

Source§

fn workflow_view<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, selector: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Workflow>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Resolve one workflow by numeric id, display name (case-insensitive), or workflow filename/path. Current gh workflow view has no --json mode, so this resolves against the complete disabled-inclusive JSON inventory from gh workflow list rather than scraping human-readable output. Defaulted to ErrorReason::Unsupported so external trait implementers keep compiling.

Source§

fn run_list<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, limit: u64, branch: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<Vec<WorkflowRun>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Recent workflow runs, newest first (gh run list --limit <n> [--branch <b>] --json …). branch is an owned Option<String> to keep the trait mockall-friendly.

Source§

fn run_view<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, id: u64, ) -> Pin<Box<dyn Future<Output = Result<WorkflowRun>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

A single workflow run by id (gh run view <id> --json …); the id is WorkflowRun::database_id.

Source§

fn run_watch<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, id: u64, ) -> Pin<Box<dyn Future<Output = Result<WorkflowRun>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Block until the run finishes, then return its final state (gh run watch <id>, then a run view). Inspect conclusion for the outcome — exit codes can’t distinguish a failed run from a cancelled one.

Blocks for the whole run. A client default_timeout kills the watch when it elapses (ErrorReason::Timeout) — drive this from a client with no (or a generous) timeout.

Source§

fn workflow_dispatch<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, spec: WorkflowDispatch, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fire a workflow_dispatch event for a workflow, driven by a WorkflowDispatch spec (the workflow selector plus an optional target ref and inputs) — the whole span kept on one line so rustdoc doesn’t read the angle-bracket placeholders as HTML: gh workflow run <workflow> [--ref <ref>] [--raw-field key=value …]. The workflow file must declare an on: workflow_dispatch trigger.

Returns Result<()>, not a run URL: the underlying GitHub API replies 204 No Content with no run identifier (the dispatch is asynchronous — the run may not exist yet), so any URL gh prints is best-effort. To find the run this started, poll run_list for the workflow/branch. Exit codes follow gh’s convention (gh help exit-codes): 0 dispatched, 1 on failure — e.g. an unknown workflow (HTTP 404: workflow … not found), a workflow lacking a workflow_dispatch trigger, or an unknown input — surfaced as ErrorReason::Exit; 4 if gh is not authenticated.

Defaulted to ErrorReason::Unsupported so external implementers of the trait keep compiling when the crate bumps (only the GitHub concrete impl and the regenerated MockGitHubApi override it).

Source§

fn run_rerun<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, id: u64, scope: RerunScope, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Rerun a completed workflow run (gh run rerun <id> [--failed]); pass a RerunScope to rerun every job (All) or only the failed jobs and their dependencies (FailedOnly). The id is WorkflowRun::database_id; being a u64, the bare positional can never look like a flag — nothing to guard.

gh queues the rerun and returns; the new run is a separate WorkflowRun — poll run_list or run_watch for it. Exit codes follow gh’s convention (gh help exit-codes): 0 queued, 1 on failure — e.g. no such run (failed to get run: HTTP 404), or --failed on a run with no failed jobs — as ErrorReason::Exit; 4 if unauthenticated.

Defaulted to ErrorReason::Unsupported so external implementers keep compiling when the crate bumps.

Source§

fn run_cancel<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, id: u64, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Cancel an in-progress workflow run (gh run cancel <id>). The id is WorkflowRun::database_id; being a u64, the bare positional can never look like a flag — nothing to guard.

Cancellation is a request — gh returns once GitHub accepts it, before jobs actually wind down; read the run’s terminal state with run_view/run_watch (a cancelled run’s conclusion is "cancelled"). Exit codes follow gh’s convention (gh help exit-codes): 0 accepted, 1 on failure — e.g. no such run (Could not find any workflow run with ID …), or a run that is already completed (Cannot cancel a workflow run that is completed) — as ErrorReason::Exit; 4 if unauthenticated.

Defaulted to ErrorReason::Unsupported so external implementers keep compiling when the crate bumps.

Source§

fn issue_create<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, dir: &'life1 Path, title: &'life2 str, body: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Open an issue, returning its URL (gh issue create --title <title> --body <body>).

Source§

fn issue_create_with<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, spec: IssueCreate, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Open an issue from an extensible spec, including labels. The default keeps old external trait implementations source-compatible and supports the label-free case through issue_create.

Source§

fn issue_add_labels<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, number: u64, labels: &'life2 [String], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Add labels to an existing issue (gh issue edit <n> --add-label <name>).

Source§

fn issue_remove_labels<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, number: u64, labels: &'life2 [String], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Remove labels from an existing issue (gh issue edit <n> --remove-label <name>).

Source§

fn issue_view<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, number: u64, ) -> Pin<Box<dyn Future<Output = Result<Issue>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

A single issue by number, with body/url filled (gh issue view <n> --json …).

Source§

fn issue_close<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, number: u64, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Close an issue (gh issue close <n>). number is a u64, so the bare positional can never look like a flag — nothing to guard. Defaulted to ErrorReason::Unsupported so external implementers of the trait keep compiling when the crate bumps (only the GitHub concrete impl and the regenerated MockGitHubApi override it).

Source§

fn issue_reopen<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, number: u64, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Reopen a closed issue (gh issue reopen <n>). number is a u64, so the bare positional can never look like a flag — nothing to guard. Defaulted to ErrorReason::Unsupported so external implementers of the trait keep compiling when the crate bumps (only the GitHub concrete impl and the regenerated MockGitHubApi override it).

Source§

fn issue_comment<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, number: u64, body: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Add a comment to an issue, returning its URL (gh issue comment <n> --body <body>). The body rides in a flag-VALUE slot, so a leading - is safe and no argv guard is needed (same as pr_comment). Defaulted to ErrorReason::Unsupported so external implementers of the trait keep compiling when the crate bumps (only the GitHub concrete impl and the regenerated MockGitHubApi override it).

Source§

fn release_list<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<Vec<Release>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Releases, newest first (gh release list --limit 100 --json …); body/url are not fetched here — use release_view. Returns up to 100 releases; use run for more.

Source§

fn release_view<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, tag: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Release>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

A single release by tag, with body/url filled (gh release view <tag> --json …). gh reports is_latest only from release_list; here it defaults to false.

Source§

fn release_create<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, spec: ReleaseCreate, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a release, returning its URL (gh release create <tag> [--title <title>] [--notes <notes>] [--draft] [--prerelease]) — see ReleaseCreate. gh creates the git tag from the default branch’s latest state if it doesn’t yet exist. Asset uploads are out of scope (attach files with run). Defaulted to ErrorReason::Unsupported so external implementers of the trait keep compiling when the crate bumps (only the GitHub concrete impl and the regenerated MockGitHubApi override it).

Source§

fn release_delete<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, tag: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Delete a release by tag (gh release delete <tag> --yes). --yes skips gh’s confirmation prompt so a headless caller never hangs. Deletes the release only, not the underlying git tag (use gh release delete --cleanup-tag via run for that). Defaulted to ErrorReason::Unsupported so external implementers keep compiling when the crate bumps.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Any for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Source§

fn type_name(&self) -> &'static str

Source§

impl<T> AnySync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more