summaryrefslogtreecommitdiff
path: root/crates/nixpkgs-tracker-http/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/nixpkgs-tracker-http/src/lib.rs')
-rw-r--r--crates/nixpkgs-tracker-http/src/lib.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/crates/nixpkgs-tracker-http/src/lib.rs b/crates/nixpkgs-tracker-http/src/lib.rs
new file mode 100644
index 0000000..873ebb8
--- /dev/null
+++ b/crates/nixpkgs-tracker-http/src/lib.rs
@@ -0,0 +1,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()
+ }
+}