pub struct GithubClient { /* private fields */ }Expand description
Sync GitHub Releases API client.
Constructed with an explicit base URL (for test injection via mockito)
and an optional bearer token. Does not read environment variables
in the constructor — use from_env() for that.
Implementations§
Source§impl GithubClient
impl GithubClient
Sourcepub fn new(base_url: &str, user_agent: &str, token: Option<String>) -> Self
pub fn new(base_url: &str, user_agent: &str, token: Option<String>) -> Self
Create a client with an explicit token (or None for unauthenticated).
Tests use this constructor directly to avoid touching process-global env state.
Sourcepub fn from_env(base_url: &str, user_agent: &str) -> Self
pub fn from_env(base_url: &str, user_agent: &str) -> Self
Create a client reading auth from the environment.
Precedence: GITHUB_TOKEN wins when both are set, matching gh CLI’s
default non-enterprise behavior.
Sourcepub fn latest_release_tag(&self, org: &str, repo: &str) -> Result<String, Error>
pub fn latest_release_tag(&self, org: &str, repo: &str) -> Result<String, Error>
Fetch the latest (most recently published, non-draft) release tag.
Uses the list endpoint (/repos/{org}/{repo}/releases) rather than
/releases/latest so that pre-release tags are visible.
Sourcepub fn release_asset_body(
&self,
org: &str,
repo: &str,
tag: &str,
) -> Result<(u64, Box<dyn Read + Send>), Error>
pub fn release_asset_body( &self, org: &str, repo: &str, tag: &str, ) -> Result<(u64, Box<dyn Read + Send>), Error>
Stream the first .tar.gz asset for a given release tag.
Returns (content_length, reader). The reader is the raw HTTP body;
the caller wraps it in a progress bar and hands it to tarball::extract_safe.
Auto Trait Implementations§
impl Freeze for GithubClient
impl !RefUnwindSafe for GithubClient
impl Send for GithubClient
impl Sync for GithubClient
impl Unpin for GithubClient
impl UnsafeUnpin 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> 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