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
impl GitHubClient
Sourcepub fn builder() -> GitHubClientBuilder
pub fn builder() -> GitHubClientBuilder
Create a new client builder
Sourcepub fn with_token(token: impl Into<String>) -> GitHubResult<Self>
pub fn with_token(token: impl Into<String>) -> GitHubResult<Self>
Convenience: create client with personal access token
Sourcepub fn get_issue(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
issue_number: u64,
) -> AsyncTask<Result<Issue, GitHubError>> ⓘ
pub fn get_issue( &self, owner: impl Into<String>, repo: impl Into<String>, issue_number: u64, ) -> AsyncTask<Result<Issue, GitHubError>> ⓘ
Get a single issue
Sourcepub 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>> ⓘ
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
Sourcepub fn add_issue_comment(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
issue_number: u64,
body: impl Into<String>,
) -> AsyncTask<Result<Comment, GitHubError>> ⓘ
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
Sourcepub fn get_issue_comments(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
issue_number: u64,
) -> AsyncStream<Result<Comment, GitHubError>>
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
Sourcepub fn list_issues(
&self,
request: ListIssuesRequest,
) -> AsyncStream<Result<Issue, GitHubError>>
pub fn list_issues( &self, request: ListIssuesRequest, ) -> AsyncStream<Result<Issue, GitHubError>>
List issues with filters
Sourcepub fn update_issue(
&self,
request: UpdateIssueRequest,
) -> AsyncTask<Result<Issue, GitHubError>> ⓘ
pub fn update_issue( &self, request: UpdateIssueRequest, ) -> AsyncTask<Result<Issue, GitHubError>> ⓘ
Update an issue
Sourcepub 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>>
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
Sourcepub fn create_pull_request(
&self,
request: CreatePullRequestRequest,
) -> AsyncTask<Result<PullRequest, GitHubError>> ⓘ
pub fn create_pull_request( &self, request: CreatePullRequestRequest, ) -> AsyncTask<Result<PullRequest, GitHubError>> ⓘ
Create a pull request
Sourcepub fn get_pull_request_status(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
pr_number: u64,
) -> AsyncTask<Result<CombinedStatus, GitHubError>> ⓘ
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
Sourcepub fn get_pull_request_comments(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
pr_number: u64,
) -> AsyncStream<Result<Comment, GitHubError>>
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
Sourcepub fn get_pull_request_files(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
pr_number: u64,
) -> AsyncStream<Result<DiffEntry, GitHubError>>
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
Sourcepub fn get_pull_request_reviews(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
pr_number: u64,
) -> AsyncStream<Result<Review, GitHubError>>
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
Sourcepub fn create_pull_request_review(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
pr_number: u64,
options: CreatePullRequestReviewOptions,
) -> AsyncTask<Result<Review, GitHubError>> ⓘ
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
Sourcepub fn add_pull_request_review_comment(
&self,
request: AddPullRequestReviewCommentRequest,
) -> AsyncTask<Result<ReviewComment, GitHubError>> ⓘ
pub fn add_pull_request_review_comment( &self, request: AddPullRequestReviewCommentRequest, ) -> AsyncTask<Result<ReviewComment, GitHubError>> ⓘ
Add a review comment to a pull request
Sourcepub fn update_pull_request(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
pr_number: u64,
options: UpdatePullRequestOptions,
) -> AsyncTask<Result<PullRequest, GitHubError>> ⓘ
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
Sourcepub fn merge_pull_request(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
pr_number: u64,
options: MergePullRequestOptions,
) -> AsyncTask<Result<Value, GitHubError>> ⓘ
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
Sourcepub 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>> ⓘ
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
Sourcepub fn create_or_update_file(
&self,
request: CreateOrUpdateFileRequest,
) -> AsyncTask<Result<FileUpdate, GitHubError>> ⓘ
pub fn create_or_update_file( &self, request: CreateOrUpdateFileRequest, ) -> AsyncTask<Result<FileUpdate, GitHubError>> ⓘ
Create or update a file
Sourcepub fn list_branches(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
page: Option<u32>,
per_page: Option<u8>,
) -> AsyncTask<Result<Vec<Branch>, GitHubError>> ⓘ
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
Sourcepub 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>> ⓘ
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
Sourcepub fn list_commits(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
options: ListCommitsOptions,
) -> AsyncTask<Result<Vec<RepoCommit>, GitHubError>> ⓘ
pub fn list_commits( &self, owner: impl Into<String>, repo: impl Into<String>, options: ListCommitsOptions, ) -> AsyncTask<Result<Vec<RepoCommit>, GitHubError>> ⓘ
List commits
Sourcepub 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>> ⓘ
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
Sourcepub 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>> ⓘ
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
Sourcepub fn create_repository(
&self,
name: impl Into<String>,
description: Option<String>,
private: Option<bool>,
auto_init: Option<bool>,
) -> AsyncTask<Result<Repository, GitHubError>> ⓘ
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
Sourcepub fn fork_repository(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
organization: Option<String>,
) -> AsyncTask<Result<Repository, GitHubError>> ⓘ
pub fn fork_repository( &self, owner: impl Into<String>, repo: impl Into<String>, organization: Option<String>, ) -> AsyncTask<Result<Repository, GitHubError>> ⓘ
Fork a repository
Sourcepub 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>> ⓘ
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
Sourcepub 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>> ⓘ
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
Sourcepub 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>> ⓘ
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
Sourcepub fn get_code_scanning_alert(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
alert_number: u64,
) -> AsyncTask<Result<Value, GitHubError>> ⓘ
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
Sourcepub 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>> ⓘ
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
Sourcepub fn get_secret_scanning_alert(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
alert_number: u32,
) -> AsyncTask<Result<SecretScanningAlert, GitHubError>> ⓘ
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
Sourcepub async fn upload_release_asset(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
options: UploadAssetOptions,
) -> Result<Asset, GitHubError>
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.
Sourcepub async fn delete_release_asset(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
asset_id: u64,
) -> Result<(), GitHubError>
pub async fn delete_release_asset( &self, owner: impl Into<String>, repo: impl Into<String>, asset_id: u64, ) -> Result<(), GitHubError>
Delete a release asset
Trait Implementations§
Source§impl Clone for GitHubClient
impl Clone for GitHubClient
Source§fn clone(&self) -> GitHubClient
fn clone(&self) -> GitHubClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for GitHubClient
impl !RefUnwindSafe for GitHubClient
impl Send for GitHubClient
impl Sync for GitHubClient
impl Unpin for GitHubClient
impl !UnwindSafe for GitHubClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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