Skip to main content

chrome_for_testing/
lib.rs

1//! # Chrome for Testing API Client
2//!
3//! This crate provides programmatic access to "chrome-for-testing" JSON APIs,
4//! which are used to retrieve version details and other relevant information about
5//! `Chrome` and `ChromeDriver` for testing purposes.
6//!
7//! ## Modules Overview
8//!
9//! - [`chromedriver`]: `ChromeDriver` specific utilities, such as log level configuration.
10//!
11//! ## API Endpoints
12//!
13//! The crate leverages the following JSON API endpoints:
14//!
15//! - **Last Known Good Versions**:
16//!   Recent good versions for each release channel (Stable/Beta/Dev/Canary). Perfect if you just
17//!   need the "latest stable" version for example.
18//!
19//! - **Known Good Versions**:
20//!   All known good versions. Longer API response, not pre-grouped per release channel. Good fit
21//!   if you have a hardcoded old version that you want to resolve a download URL for.
22//!
23//! For detailed documentation on these APIs, see the
24//! [official Chrome for Testing documentation](https://github.com/GoogleChromeLabs/chrome-for-testing#json-api-endpoints).
25//!
26//! ## Features
27//!
28//! - **Ease of Use**: Simplifies interaction with Chrome's testing-related APIs.
29//! - **Type-Safe Deserialization**: Automatically maps JSON responses to Rust structs for
30//!   seamless API interaction.
31//! - **Asynchronous Support**: Fully asynchronous.
32//!
33//! ## Example Usage
34//!
35//! ```rust,no_run
36//! #[tokio::main]
37//! async fn main() {
38//!     use chrome_for_testing::KnownGoodVersions;
39//!
40//!     let client = reqwest::Client::new();
41//!     match KnownGoodVersions::fetch(&client).await {
42//!         Ok(data) => println!("Successfully fetched Chrome versions: {data:?}"),
43//!         Err(e) => println!("Error occurred: {e:?}"),
44//!     }
45//! }
46//! ```
47
48/// `ChromeDriver` specific utilities, such as log level configuration.
49pub mod chromedriver;
50
51pub(crate) mod api;
52pub(crate) mod error;
53
54pub use api::Download;
55pub use api::DownloadsByPlatform;
56pub use api::HasVersion;
57pub use api::channel::Channel;
58pub use api::channel::ParseChannelError;
59pub use api::known_good_versions::Downloads as KnownGoodDownloads;
60pub use api::known_good_versions::KnownGoodVersions;
61pub use api::known_good_versions::VersionWithoutChannel;
62pub use api::last_known_good_versions::Downloads as LastKnownGoodDownloads;
63pub use api::last_known_good_versions::LastKnownGoodVersions;
64pub use api::last_known_good_versions::VersionInChannel;
65pub use api::platform::ParsePlatformError;
66pub use api::platform::Platform;
67pub use api::version::ParseVersionError;
68pub use api::version::Version;
69pub use error::Error;