From b56e59feaed67a34e24be6cc802108d933ea57a9 Mon Sep 17 00:00:00 2001 From: Joel Wachsler Date: Mon, 11 Jul 2022 01:59:36 +0000 Subject: [PATCH] Add readme --- README.md | 41 ++++++++++++++++++++++++++++++- qbittorrent-web-api-gen/README.md | 1 + 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 qbittorrent-web-api-gen/README.md diff --git a/README.md b/README.md index 22d08a1..787b190 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,42 @@ # qBittorrent web api for Rust -This is a qBittorrent api implementation automatically generated from the markdown file taken from here - https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1). +This is an automatic async implementation of the qBittorrent 4.1 web api. The api generation is based on the wiki markdown file which can be seen [here](https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)). + +## Example + +```rust +use anyhow::Result; +use qbittorrent_web_api::Api; + +#[tokio::main] +async fn main() -> Result<()> { + let api = Api::login("http://localhost:8080", "admin", "adminadmin").await?; + + // add a torrent + api.torrent_management() + .add("http://www.legittorrents.info/download.php?id=5cc013e801095be61d768e609e3039da58616fd0&f=Oddepoxy%20-%20Oddepoxy%20(2013)%20[OGG%20320%20CBR].torrent") + .send() + .await?; + + // critical logs + let logs = api.log() + .main() + .critical(true) + .warning(false) + .normal(false) + .info(false) + .send() + .await?; + + println!("{:#?}", &logs); + + // current torrent info + let info = api.torrent_management().info().send().await?; + + println!("{:#?}", info); + + Ok(()) +} + +``` + diff --git a/qbittorrent-web-api-gen/README.md b/qbittorrent-web-api-gen/README.md new file mode 100644 index 0000000..40751d0 --- /dev/null +++ b/qbittorrent-web-api-gen/README.md @@ -0,0 +1 @@ +This is the implementation for the crate `qbittorrent-web-api` - use that crate instead. \ No newline at end of file