Skip to main content

GitHub

Struct GitHub 

Source
pub struct GitHub<R: ProcessRunner = JobRunner> { /* private fields */ }
Expand description

The real GitHub client. Generic over the ProcessRunner so tests can inject a fake process executor; GitHub::new() uses the real job-backed runner.

Implementations§

Source§

impl GitHub<JobRunner>

Source

pub fn new() -> Self

Create a client driving the real job-backed runner.

Source§

impl<R: ProcessRunner> GitHub<R>

Source

pub fn with_runner(runner: R) -> Self

Create a client driving runner — inject a fake in tests.

Source

pub fn default_timeout(self, timeout: Duration) -> Self

Apply a default timeout to every command this client builds.

Trait Implementations§

Source§

impl Default for GitHub<JobRunner>

Source§

fn default() -> Self

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

impl<R: ProcessRunner> GitHubApi for GitHub<R>

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>, returning trimmed stdout (throws on a non-zero exit).
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 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).
Source§

fn repo_view<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<Repo>> + 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 --json …).
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 --json …).
Source§

fn pr_create<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, dir: &'life1 Path, title: &'life2 str, body: &'life3 str, base: Option<String>, ) -> 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 a pull request, returning its URL (gh pr create). base is owned (Option<String>) to keep the trait mockall-friendly.
Source§

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

Raw GitHub REST/GraphQL response body (gh api <endpoint>).

Auto Trait Implementations§

§

impl<R> Freeze for GitHub<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for GitHub<R>
where R: RefUnwindSafe,

§

impl<R> Send for GitHub<R>

§

impl<R> Sync for GitHub<R>

§

impl<R> Unpin for GitHub<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for GitHub<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for GitHub<R>
where R: UnwindSafe,

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> 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, 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.