aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 0026bf0..d87e6d0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -38,7 +38,15 @@ pub struct Client {
impl Client {
pub fn channel_stream(&self) -> Result<String, Error> {
- let url = self.url(ZOTAPI_CHANNEL_STREAM_PATH);
+ self.fetch_stream(ZOTAPI_CHANNEL_STREAM_PATH)
+ }
+
+ fn url(&self, path: &str) -> String {
+ self.base_url.clone() + path
+ }
+
+ fn fetch_stream(&self, path: &str) -> Result<String, Error> {
+ let url = self.url(path);
let mut res = self.inner.get(&url)
.header(Accept(vec![qitem(mime::APPLICATION_JSON)]))
.basic_auth(self.user.clone(), Some(self.pw.clone()))
@@ -54,10 +62,6 @@ impl Client {
_ => Err(Error::Unknown)
}
}
-
- fn url(&self, path: &str) -> String {
- self.base_url.clone() + path
- }
}
pub fn client(url: &str, user: &str, pw: &str) -> Client