GitHubClient

Struct GitHubClient 

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

GitHub API client wrapper that encapsulates Octocrab.

Provides clean API without exposing Octocrab dependency. Cloning is cheap (Arc clone).

Implementations§

Source§

impl GitHubClient

Source

pub fn builder() -> GitHubClientBuilder

Create a new client builder

Source

pub fn with_token(token: impl Into<String>) -> GitHubResult<Self>

Convenience: create client with personal access token

Source

pub fn inner(&self) -> &Arc<Octocrab>

Get inner Octocrab client

Source

pub fn get_issue( &self, owner: impl Into<String>, repo: impl Into<String>, issue_number: u64, ) -> AsyncTask<Result<Issue, GitHubError>>

Get a single issue

Source

pub fn create_issue( &self, owner: impl Into<String>, repo: impl Into<String>, title: impl Into<String>, body: Option<String>, assignees: Option<Vec<String>>, labels: Option<Vec<String>>, ) -> AsyncTask<Result<Issue, GitHubError>>

Create a new issue

Source

pub fn add_issue_comment( &self, owner: impl Into<String>, repo: impl Into<String>, issue_number: u64, body: impl Into<String>, ) -> AsyncTask<Result<Comment, GitHubError>>

Add a comment to an issue

Source

pub fn get_issue_comments( &self, owner: impl Into<String>, repo: impl Into<String>, issue_number: u64, ) -> AsyncStream<Result<Comment, GitHubError>>

Get comments for an issue

Source

pub fn list_issues( &self, request: ListIssuesRequest, ) -> AsyncStream<Result<Issue, GitHubError>>

List issues with filters

Source

pub fn update_issue( &self, request: UpdateIssueRequest, ) -> AsyncTask<Result<Issue, GitHubError>>

Update an issue

Source

pub fn search_issues( &self, query: impl Into<String>, sort: Option<String>, order: Option<String>, page: Option<u32>, per_page: Option<u8>, ) -> AsyncStream<Result<Issue, GitHubError>>

Search issues

Source

pub fn create_pull_request( &self, request: CreatePullRequestRequest, ) -> AsyncTask<Result<PullRequest, GitHubError>>

Create a pull request

Source

pub fn get_pull_request_status( &self, owner: impl Into<String>, repo: impl Into<String>, pr_number: u64, ) -> AsyncTask<Result<CombinedStatus, GitHubError>>

Get pull request status

Source

pub fn get_pull_request_comments( &self, owner: impl Into<String>, repo: impl Into<String>, pr_number: u64, ) -> AsyncStream<Result<Comment, GitHubError>>

Get pull request comments

Source

pub fn get_pull_request_files( &self, owner: impl Into<String>, repo: impl Into<String>, pr_number: u64, ) -> AsyncStream<Result<DiffEntry, GitHubError>>

Get pull request files

Source

pub fn get_pull_request_reviews( &self, owner: impl Into<String>, repo: impl Into<String>, pr_number: u64, ) -> AsyncStream<Result<Review, GitHubError>>

Get pull request reviews

Source

pub fn create_pull_request_review( &self, owner: impl Into<String>, repo: impl Into<String>, pr_number: u64, options: CreatePullRequestReviewOptions, ) -> AsyncTask<Result<Review, GitHubError>>

Create a pull request review

Source

pub fn add_pull_request_review_comment( &self, request: AddPullRequestReviewCommentRequest, ) -> AsyncTask<Result<ReviewComment, GitHubError>>

Add a review comment to a pull request

Source

pub fn update_pull_request( &self, owner: impl Into<String>, repo: impl Into<String>, pr_number: u64, options: UpdatePullRequestOptions, ) -> AsyncTask<Result<PullRequest, GitHubError>>

Update a pull request

Source

pub fn merge_pull_request( &self, owner: impl Into<String>, repo: impl Into<String>, pr_number: u64, options: MergePullRequestOptions, ) -> AsyncTask<Result<Value, GitHubError>>

Merge a pull request

Source

pub fn get_file_contents( &self, owner: impl Into<String>, repo: impl Into<String>, path: impl Into<String>, ref_name: Option<String>, ) -> AsyncTask<Result<Vec<Content>, GitHubError>>

Get file contents

Source

pub fn create_or_update_file( &self, request: CreateOrUpdateFileRequest, ) -> AsyncTask<Result<FileUpdate, GitHubError>>

Create or update a file

Source

pub fn list_branches( &self, owner: impl Into<String>, repo: impl Into<String>, page: Option<u32>, per_page: Option<u8>, ) -> AsyncTask<Result<Vec<Branch>, GitHubError>>

List branches

Source

pub fn create_branch( &self, owner: impl Into<String>, repo: impl Into<String>, branch_name: impl Into<String>, sha: impl Into<String>, ) -> AsyncTask<Result<Ref, GitHubError>>

Create a branch

Source

pub fn list_commits( &self, owner: impl Into<String>, repo: impl Into<String>, options: ListCommitsOptions, ) -> AsyncTask<Result<Vec<RepoCommit>, GitHubError>>

List commits

Source

pub fn get_commit( &self, owner: impl Into<String>, repo: impl Into<String>, commit_sha: impl Into<String>, page: Option<u32>, per_page: Option<u8>, ) -> AsyncTask<Result<RepoCommit, GitHubError>>

Get a commit

Source

pub fn search_code( &self, query: impl Into<String>, sort: Option<String>, order: Option<String>, page: Option<u32>, per_page: Option<u8>, enrich_stars: bool, ) -> AsyncTask<Result<Page<Code>, GitHubError>>

Search code

Source

pub fn create_repository( &self, name: impl Into<String>, description: Option<String>, private: Option<bool>, auto_init: Option<bool>, ) -> AsyncTask<Result<Repository, GitHubError>>

Create a repository

Source

pub fn fork_repository( &self, owner: impl Into<String>, repo: impl Into<String>, organization: Option<String>, ) -> AsyncTask<Result<Repository, GitHubError>>

Fork a repository

Source

pub fn push_files( &self, owner: impl Into<String>, repo: impl Into<String>, branch: impl Into<String>, files: HashMap<String, String>, commit_message: impl Into<String>, ) -> AsyncTask<Result<Commit, GitHubError>>

Push files to a repository

Source

pub fn get_me(&self) -> AsyncTask<Result<Author, GitHubError>>

Get the authenticated user

Source

pub fn search_users( &self, query: impl Into<String>, sort: Option<UserSearchSort>, order: Option<SearchOrder>, page: Option<u32>, per_page: Option<u8>, ) -> AsyncTask<Result<Page<Author>, GitHubError>>

Search users

Source

pub fn list_code_scanning_alerts( &self, owner: impl Into<String>, repo: impl Into<String>, state: Option<String>, ref_name: Option<String>, tool_name: Option<String>, severity: Option<String>, ) -> AsyncTask<Result<Vec<Value>, GitHubError>>

List code scanning alerts

Source

pub fn get_code_scanning_alert( &self, owner: impl Into<String>, repo: impl Into<String>, alert_number: u64, ) -> AsyncTask<Result<Value, GitHubError>>

Get a code scanning alert

Source

pub fn list_secret_scanning_alerts( &self, owner: impl Into<String>, repo: impl Into<String>, state: Option<String>, secret_type: Option<String>, resolution: Option<String>, ) -> AsyncTask<Result<Vec<SecretScanningAlert>, GitHubError>>

List secret scanning alerts

Source

pub fn get_secret_scanning_alert( &self, owner: impl Into<String>, repo: impl Into<String>, alert_number: u32, ) -> AsyncTask<Result<SecretScanningAlert, GitHubError>>

Get a secret scanning alert

Source

pub async fn upload_release_asset( &self, owner: impl Into<String>, repo: impl Into<String>, options: UploadAssetOptions, ) -> Result<Asset, GitHubError>

Upload an asset to a release

Requires the release ID and binary content of the file. Returns the uploaded asset information including download URL.

Source

pub async fn delete_release_asset( &self, owner: impl Into<String>, repo: impl Into<String>, asset_id: u64, ) -> Result<(), GitHubError>

Delete a release asset

Source

pub fn request_copilot_review( &self, owner: impl Into<String>, repo: impl Into<String>, pr_number: u64, ) -> AsyncTask<Result<(), GitHubError>>

Request a Copilot review

Trait Implementations§

Source§

impl Clone for GitHubClient

Source§

fn clone(&self) -> GitHubClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GitHubClient

Source§

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

Formats the value using the given formatter. Read more

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> 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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