pub struct CodecovClient { /* private fields */ }Expand description
Codecov API client (Bearer token + base URL).
Implementations§
Source§impl CodecovClient
impl CodecovClient
Sourcepub fn new(token: impl Into<String>, api_base: impl Into<String>) -> Self
pub fn new(token: impl Into<String>, api_base: impl Into<String>) -> Self
Builds a client with an explicit token and API base URL.
§Panics
Panics only if the default reqwest::Client cannot be constructed
(should not happen in normal environments).
Sourcepub fn from_env() -> Result<Self, ClientError>
pub fn from_env() -> Result<Self, ClientError>
Builds a client from CODECOV_TOKEN and optional CODECOV_API_URL.
Loads an optional .env file first (does not override existing process env).
§Errors
Returns ClientError::MissingToken when the token env var is unset or empty.
Sourcepub fn totals_url(
api_base: &str,
owner: &str,
repo: &str,
branch: Option<&str>,
sha: Option<&str>,
) -> String
pub fn totals_url( api_base: &str, owner: &str, repo: &str, branch: Option<&str>, sha: Option<&str>, ) -> String
Builds the totals URL for a GitHub repo.
Sourcepub fn file_report_url(
api_base: &str,
owner: &str,
repo: &str,
path: &str,
branch: Option<&str>,
sha: Option<&str>,
) -> String
pub fn file_report_url( api_base: &str, owner: &str, repo: &str, path: &str, branch: Option<&str>, sha: Option<&str>, ) -> String
Builds the file report URL for a path inside a GitHub repo.
Sourcepub async fn totals(
&self,
owner: &str,
repo: &str,
branch: Option<&str>,
sha: Option<&str>,
) -> Result<CoverageReport, ClientError>
pub async fn totals( &self, owner: &str, repo: &str, branch: Option<&str>, sha: Option<&str>, ) -> Result<CoverageReport, ClientError>
Fetches commit coverage totals (including per-file breakdown).
§Errors
Returns ClientError::Http, ClientError::Api, or ClientError::Json.
Sourcepub async fn miss_files(
&self,
owner: &str,
repo: &str,
branch: Option<&str>,
sha: Option<&str>,
limit: usize,
) -> Result<MissFilesResult, ClientError>
pub async fn miss_files( &self, owner: &str, repo: &str, branch: Option<&str>, sha: Option<&str>, limit: usize, ) -> Result<MissFilesResult, ClientError>
Sourcepub async fn file_report(
&self,
owner: &str,
repo: &str,
path: &str,
branch: Option<&str>,
sha: Option<&str>,
) -> Result<ReportFile, ClientError>
pub async fn file_report( &self, owner: &str, repo: &str, path: &str, branch: Option<&str>, sha: Option<&str>, ) -> Result<ReportFile, ClientError>
Trait Implementations§
Source§impl Clone for CodecovClient
impl Clone for CodecovClient
Source§fn clone(&self) -> CodecovClient
fn clone(&self) -> CodecovClient
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for CodecovClient
impl !UnwindSafe for CodecovClient
impl Freeze for CodecovClient
impl Send for CodecovClient
impl Sync for CodecovClient
impl Unpin for CodecovClient
impl UnsafeUnpin for CodecovClient
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