qbittorrent_web_api/README.md

41 lines
1.2 KiB
Markdown
Raw Permalink Normal View History

2022-07-10 17:09:31 +02:00
# qBittorrent web api for Rust
2022-08-05 22:20:21 +02:00
This is an automatic async implementation of the qBittorrent 4.1 web api. The api generation is based on a forked wiki markdown file describing the api which can be found [here](https://github.com/jowax/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)) and the original [here](https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)).
2022-07-11 03:59:36 +02:00
## 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?;
2022-07-11 04:09:27 +02:00
println!("{:#?}", logs);
2022-07-11 03:59:36 +02:00
// current torrent info
let info = api.torrent_management().info().send().await?;
println!("{:#?}", info);
Ok(())
}
```