summaryrefslogtreecommitdiff
path: root/crates/nixpkgs-tracker-http/src/lib.rs
blob: 873ebb847e45b6d5439ee852fb494c94c48f7c69 (plain)
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
mod github;
mod model;
mod teawie;

pub use github::Ext as GitHubClientExt;
pub use model::*;
pub use teawie::Ext as TeawieClientExt;

pub type Client = reqwest::Client;
pub type Error = reqwest::Error;

/// Fun trait for functions we use with [Client]
pub trait Ext {
	fn default() -> Self;
}

impl Ext for Client {
	/// Create the default [`Client`]
	fn default() -> Self {
		reqwest::Client::builder()
			.user_agent(format!(
				"nixpkgs-tracker-bot/{}",
				option_env!("CARGO_PKG_VERSION").unwrap_or_else(|| "development")
			))
			.build()
			.unwrap()
	}
}