qbit 0.3.0

A wrapper for qBittorrent Web API
Documentation

Crates.io version Github repo docs.rs Rust

Qbittorrent WebUI Api

Asynchronous Rust wrapper for Qbittorrent Web API, supporting all documented endpoints.

Supported Qbittorrent versions

Supported Qbittorrent versions: >=5.2.0, >=5.1.2 (with feature flag qBittorrent-5_1) This is the lowest tested versions.

Usage

Add it using cargo:

cargo add qbit

Add it manually in your Cargo.toml:

[dependencies]
qbit = "0.3"

Feature flags

Leaving feature flags unset will default to Qbittorrent 5.2

For backwards compatibility, and future-proofing, two feature flags are available: qBittorrent-5_3 and qBittorrent-5_1.

Enabling qBittorrent-5_1 will expect the server to be running Qbittorrent 5.1, while qBittorrent-5_3 will expect the server to be running a prerelease version of 5.3.

qBittorrent-5_3 should be expected to be experimental and may be unstable as it is in active development.

Basic usage to get all torrents:

use qbit::API;
use qbit::Credentials;

let credentials = Credentials::Login("username".to_string(), "password".to_string());
let mut client = Api::new_login("http://127.0.0.1/", credentials).await.unwrap();

let torrents = client.torrents(None).await.unwrap();

Testing

Quick example of how to set up the codebase for testing.

Basic codebase tests

Basic testing of the codebase. This should not hit external services.

cargo test

Full API tests

Testing of API calls against a running qBittorrent server. It requires a running qBittorrent server with the web UI enabled. It uses environment variables to configure the server URL and credentials. Environment can be set in the shell or in a .env file see .env.example.

WEBUI_URL="http://localhost" \
WEBUI_PORT="6969" \
WEBUI_USERNAME="admin" \
WEBUI_PASSWORD="adminadmin" \
WEBUI_APIKEY="<APIKEY>" \
TEMP_DIR=".temp" \
SERVER_TEMP_DIR=".temp" \
cargo test -- --include-ignored

Implemented

WebUI 5.0 documentation

Authentication

  • Login
  • Logout

Application

  • Get application version
  • Get API version
  • Get build info
  • Shutdown application
  • Get application preferences
  • Set application preferences
  • Get default save path
  • Get cookies
  • Set cookies

Log

  • Get log
  • Get peer log

Sync

  • Get main data
  • Get torrent peers data // Incomplete documentation for API

Transfer info

  • Get global transfer info
  • Get alternative speed limits state
  • Toggle alternative speed limits
  • Get global download limit
  • Set global download limit
  • Get global upload limit
  • Set global upload limit
  • Ban peers

Torrent management

  • Get torrent list
  • Get torrent generic properties
  • Get torrent trackers
  • Get torrent web seeds
  • Get torrent contents
  • Get torrent pieces' states
  • Get torrent pieces' hashes
  • Stop torrents
  • Start torrents
  • Delete torrents
  • Recheck torrents
  • Reannounce torrents
  • Add new torrent
  • Add trackers to torrent
  • Edit trackers
  • Remove trackers
  • Add peers
  • Increase torrent priority
  • Decrease torrent priority
  • Maximal torrent priority
  • Minimal torrent priority
  • Set file priority
  • Get torrent download limit
  • Set torrent download limit
  • Set torrent share limit
  • Get torrent upload limit
  • Set torrent upload limit
  • Set torrent location
  • Set torrent name
  • Set torrent category
  • Get all categories
  • Add new category
  • Edit category
  • Remove categories
  • Add torrent tags
  • Remove torrent tags
  • Get all tags
  • Create tags
  • Delete tags
  • Set automatic torrent management
  • Toggle sequential download
  • Set first/last piece priority
  • Set force start
  • Set super seeding
  • Rename file // Unsure if this is for the file or the torrent
  • Rename folder // Unsure if this is for the file or the torrent

RSS (experimental)

  • Add folder
  • Add feed
  • Remove item
  • Move item
  • Get all items
  • Mark as read
  • Refresh item
  • Set auto-downloading rule
  • Rename auto-downloading rule
  • Remove auto-downloading rule
  • Get all auto-downloading rules
  • Get all articles matching a rule

Search

  • Start search
  • Stop search
  • Get search status
  • Get search results
  • Delete search
  • Get search plugins
  • Install search plugin
  • Uninstall search plugin
  • Enable search plugin
  • Update search plugins