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

pub use repository::Repo;
pub use search::{Query, Search};
pub use user::User;

mod repository;
pub mod search;
mod user;

/// This crate's standard error type.
pub type Error = Box<dyn std::error::Error>;

/// This crate's standard `Result` type.
pub type Result<T> = std::result::Result<T, Error>;