pub struct GitHubClient { /* private fields */ }Expand description
Low-level GitHub API client with connection pooling.
Configures HTTP requests and authentication, and retrieves quota information.
Requests are not automatically delayed or retried when quotas are exhausted.
For most use cases, prefer using GitHubService instead.
Implementations§
Source§impl GitHubClient
impl GitHubClient
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Creates a new GitHub API client with connection pooling and optional token authentication.
Reads GITHUB_TOKEN from the environment. An unset, empty or whitespace-only
variable produces an anonymous client; the builder itself still rejects empty tokens.
The token is stored securely using SecretString and is automatically
zeroized when the client is dropped.
Sourcepub fn builder() -> GitHubClientBuilder
pub fn builder() -> GitHubClientBuilder
Creates a builder with no token; environment variables are not read.
pub fn has_token(&self) -> bool
Sourcepub fn client(&self) -> &Client
pub fn client(&self) -> &Client
Raw HTTP transport. Library authentication headers are added only by API methods.
Sourcepub async fn check_rate_limit(&self) -> Result<RateLimit>
pub async fn check_rate_limit(&self) -> Result<RateLimit>
Returns the REST core quota. Use check_rate_limits for GraphQL and search quotas.
Sourcepub async fn check_rate_limits(&self) -> Result<RateLimits>
pub async fn check_rate_limits(&self) -> Result<RateLimits>
Retrieves separate quotas for every resource returned by GitHub.