pub struct GitHubClient { /* private fields */ }Expand description
GitHub API client using todoku’s HttpClient.
Implementations§
Source§impl GitHubClient
impl GitHubClient
Sourcepub fn new(token: Option<&str>) -> Result<Self, TodokuError>
pub fn new(token: Option<&str>) -> Result<Self, TodokuError>
Create a new GitHub client with optional token.
§Errors
Returns TodokuError if the underlying HTTP client fails to build.
Sourcepub fn from_client(client: HttpClient) -> Self
pub fn from_client(client: HttpClient) -> Self
Create from an existing HttpClient (for custom configuration).
Sourcepub fn from_env() -> Result<Self, TodokuError>
pub fn from_env() -> Result<Self, TodokuError>
Create from the GITHUB_TOKEN environment variable.
§Errors
Returns TodokuError if the underlying HTTP client fails to build.
Trait Implementations§
Source§impl GitHubApi for GitHubClient
impl GitHubApi for GitHubClient
Source§fn get_repo_head<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
owner: &'life1 str,
repo: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<String, TodokuError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_repo_head<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
owner: &'life1 str,
repo: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<String, TodokuError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Get the HEAD commit SHA for a repo’s default branch.
Source§fn get_latest_tag<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
owner: &'life1 str,
repo: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, TodokuError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_latest_tag<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
owner: &'life1 str,
repo: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, TodokuError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Get the latest tag for a repo (returns None if no tags).
Source§fn get_primary_language<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
owner: &'life1 str,
repo: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, TodokuError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_primary_language<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
owner: &'life1 str,
repo: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, TodokuError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Detect the primary language of a repo.
Source§fn list_repos<'life0, 'life1, 'async_trait>(
&'life0 self,
owner: &'life1 str,
owner_type: OwnerType,
) -> Pin<Box<dyn Future<Output = Result<Vec<GitHubRepo>, TodokuError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_repos<'life0, 'life1, 'async_trait>(
&'life0 self,
owner: &'life1 str,
owner_type: OwnerType,
) -> Pin<Box<dyn Future<Output = Result<Vec<GitHubRepo>, TodokuError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List repos for an org or user.
Source§fn get_file_info<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
owner: &'life1 str,
repo: &'life2 str,
path: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<FileInfo, TodokuError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn get_file_info<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
owner: &'life1 str,
repo: &'life2 str,
path: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<FileInfo, TodokuError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Get file metadata (SHA, size, download URL).
Auto Trait Implementations§
impl !RefUnwindSafe for GitHubClient
impl !UnwindSafe for GitHubClient
impl Freeze for GitHubClient
impl Send for GitHubClient
impl Sync for GitHubClient
impl Unpin for GitHubClient
impl UnsafeUnpin 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
Mutably borrows from an owned value. Read more