github_stats/
lib.rs

1//! Gets the stats of a [Github] repository.
2//!
3//! # Examples
4//!
5//! ## Get Stats of Repository
6//!
7//! ```no_run
8//! # async fn run() {
9//! use github_stats::Repo;
10//!
11//! let repo = Repo::new("rust-lang", "rust", "<my user agent>").await;
12//!
13//! match repo {
14//!     Ok(repo) => {/* Do some stuff */},
15//!     Err(e) => eprintln!(":("),
16//! }
17//! # }
18//! ```
19//!
20//! ## Search Latest Merged PR and Get Total Merged PR Count
21//!
22//! ```no_run
23//! # async fn run() {
24//! use github_stats::{Query, Search};
25//!
26//! // Gets latest merged PR
27//! let search = Search::issues(
28//!     &Query::new().repo("rust-lang", "rust").is("pr").is("merged"),
29//! )
30//! .per_page(1)
31//! .search("<my user agent>")
32//! .await;
33//!
34//! match search {
35//!     Ok(results) => println!("# of merged PRs: {}", results.total_count()),
36//!     Err(e) => eprintln!(":("),
37//! }
38//! # }
39//! ```
40//!
41//! [Github]: https://github.com/
42
43pub use repository::Repo;
44pub use search::{Query, Search};
45pub use user::User;
46
47mod repository;
48pub mod search;
49mod user;
50
51/// This crate's standard error type.
52pub type Error = Box<dyn std::error::Error>;
53
54/// This crate's standard `Result` type.
55pub type Result<T> = std::result::Result<T, Error>;