diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2023-04-01 15:42:18 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2023-04-01 15:42:18 +0200 |
commit | cca150aff45557c5149a12638cf9da7cc4e028b5 (patch) | |
tree | 68134c051518d1766273d35108fade5bbbbeb9c4 /src/zotapi.rs | |
parent | 8100cff32bf0c87dc19fba78f3faac8090f863da (diff) | |
download | rust-zotapi-cca150aff45557c5149a12638cf9da7cc4e028b5.tar.gz rust-zotapi-cca150aff45557c5149a12638cf9da7cc4e028b5.tar.bz2 rust-zotapi-cca150aff45557c5149a12638cf9da7cc4e028b5.zip |
Add version API.
Diffstat (limited to 'src/zotapi.rs')
-rw-r--r-- | src/zotapi.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/zotapi.rs b/src/zotapi.rs index 9e13d99..2d50ef3 100644 --- a/src/zotapi.rs +++ b/src/zotapi.rs @@ -40,6 +40,9 @@ pub fn new(url: &str, channel: &str, pw: &str) -> ZotApi { } impl ZotApi { + /** + * Returns the channel object of the logged in channel. + */ pub async fn verify(&self) -> Result<Channel, Box<dyn std::error::Error>> { let raw = self.get("verify").send().await?.text().await?; let mut channel: Channel = serde_json::from_str(&raw)?; @@ -48,6 +51,15 @@ impl ZotApi { Ok(channel) } + /** + * Returns the version of the server. + * + * This API can be invoked without authentication. + */ + pub async fn version(&self) -> Result<String, Box<dyn std::error::Error>> { + Ok(self.get("version").send().await?.text().await?) + } + /// Return a RequestBuilder object that's set up with the correct /// path and headers for performing a zot api request. |