aboutsummaryrefslogtreecommitdiffstats
path: root/src/client.rs
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2020-01-03 23:50:19 +0100
committerHarald Eilertsen <haraldei@anduin.net>2020-01-03 23:50:19 +0100
commitfa6296ce5f0b0309c86acf8dabe536f53cce0387 (patch)
tree537fccd76864f0440c492d654bad9efd784b8756 /src/client.rs
parent970df3ea4169eb2fe935a0f50012503079b8636d (diff)
downloadrust-zotapi-fa6296ce5f0b0309c86acf8dabe536f53cce0387.tar.gz
rust-zotapi-fa6296ce5f0b0309c86acf8dabe536f53cce0387.tar.bz2
rust-zotapi-fa6296ce5f0b0309c86acf8dabe536f53cce0387.zip
Move client constructor fn to submodule.
Diffstat (limited to 'src/client.rs')
-rw-r--r--src/client.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/client.rs b/src/client.rs
index fcafed3..d37133f 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -33,16 +33,16 @@ pub struct Client {
pw: String,
}
-impl Client {
- pub fn new(base_url: &str, user: &str, pw: &str) -> Client {
- Client {
- inner: reqwest::Client::new(),
- base_url: Url::parse(base_url).unwrap().join("api/z/1.0/").unwrap(),
- user: String::from(user),
- pw: String::from(pw),
- }
+pub fn client(url: &str, user: &str, pw: &str) -> Client {
+ Client {
+ inner: reqwest::Client::new(),
+ base_url: Url::parse(url).unwrap().join("api/z/1.0/").unwrap(),
+ user: String::from(user),
+ pw: String::from(pw),
}
+}
+impl Client {
fn url<T>(&self, path: &str, args: &T) -> String
where
T: Serialize + std::fmt::Debug,