Skip to main content

GhClient

Struct GhClient 

Source
pub struct GhClient<R: CommandRunner> { /* private fields */ }
Expand description

Client for GitHub operations via the gh CLI.

Implementations§

Source§

impl<R: CommandRunner> GhClient<R>

Source

pub async fn get_issues_by_label(&self, label: &str) -> Result<Vec<Issue>>

Fetch open issues with the given label, ordered oldest first.

Source

pub async fn get_issue(&self, issue_number: u32) -> Result<Issue>

Fetch a single issue by number.

Source

pub async fn get_current_user(&self) -> Result<String>

Fetch the authenticated GitHub user’s login.

Source

pub async fn comment_on_issue( &self, issue_number: u32, body: &str, ) -> Result<()>

Post a comment on an issue.

Source

pub async fn close_issue( &self, issue_number: u32, comment: Option<&str>, ) -> Result<()>

Close an issue with an optional comment.

Source§

impl<R: CommandRunner> GhClient<R>

Source

pub async fn add_label(&self, issue_number: u32, label: &str) -> Result<()>

Add a label to an issue.

Source

pub async fn remove_label(&self, issue_number: u32, label: &str) -> Result<()>

Remove a label from an issue.

Source

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.

Source

pub async fn ensure_labels_exist(&self) -> Result<()>

Ensure all oven labels exist in the repository.

Source§

impl<R: CommandRunner> GhClient<R>

Source

pub async fn create_draft_pr( &self, title: &str, branch: &str, body: &str, ) -> Result<u32>

Create a draft pull request and return its number.

Source

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.

Source

pub async fn comment_on_pr(&self, pr_number: u32, body: &str) -> Result<()>

Post a comment on a pull request (in the default repo).

Source

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.

Source

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

Source

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.

Source

pub async fn mark_pr_ready(&self, pr_number: u32) -> Result<()>

Mark a PR as ready for review (in the default repo).

Source

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.

Source

pub async fn get_pr_state(&self, pr_number: u32) -> Result<PrState>

Check the merge state of a pull request (in the default repo).

Source

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.

Source

pub async fn merge_pr( &self, pr_number: u32, strategy: &MergeStrategy, ) -> Result<()>

Merge a pull request (in the default repo).

Source

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.

Source§

impl<R: CommandRunner> GhClient<R>

Source

pub fn new(runner: R, repo_dir: &Path) -> Self

Auto Trait Implementations§

§

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

§

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

§

impl<R> Send for GhClient<R>

§

impl<R> Sync for GhClient<R>

§

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

§

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

§

impl<R> UnwindSafe for GhClient<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> 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