qbit_rs/model/
sync.rs

1use std::{collections::HashMap, net::SocketAddr};
2
3use serde_value::Value;
4
5use crate::model::{Category, Torrent};
6
7#[derive(Debug, Clone, serde::Deserialize, PartialEq)]
8pub struct SyncData {
9    /// Response ID
10    pub rid: i64,
11    /// Whether the response contains all the data or partial data
12    pub full_update: Option<bool>,
13    /// Property: torrent hash, value: same as [torrent list](#get-torrent-list)
14    pub torrents: Option<HashMap<String, Torrent>>,
15    /// List of hashes of torrents removed since last request
16    pub torrents_removed: Option<Vec<String>>,
17    /// Info for categories added since last request
18    pub categories: Option<HashMap<String, Category>>,
19    /// List of categories removed since last request
20    pub categories_removed: Option<Vec<String>>,
21    /// List of tags added since last request
22    pub tags: Option<Vec<String>>,
23    /// List of tags removed since last request
24    pub tags_removed: Option<Vec<String>>,
25    /// Map of trackers added since last request, and the torrents that have
26    /// them. Property: tracker URL, value: torrent hash
27    pub trackers: Option<HashMap<String, Vec<String>>>,
28    /// List of tracker URLs removed since last request
29    pub trackers_removed: Option<Vec<String>>,
30    /// Global transfer info
31    pub server_state: Option<HashMap<String, Value>>,
32}
33
34#[derive(Debug, Clone, serde::Deserialize, PartialEq)]
35pub struct PeerSyncData {
36    pub full_update: Option<bool>,
37    pub peers: Option<HashMap<SocketAddr, Peer>>,
38    pub peers_removed: Option<Vec<SocketAddr>>,
39    pub rid: i64,
40    pub show_flags: bool,
41}
42#[derive(Debug, Clone, serde::Deserialize, PartialEq)]
43pub struct Peer {
44    pub client: Option<String>,
45    pub connection: Option<String>,
46    pub country: Option<String>,
47    pub country_code: Option<String>,
48    pub dl_speed: Option<u64>,
49    pub downloaded: Option<u64>,
50    pub files: Option<String>,
51    pub flags: Option<String>,
52    pub flags_desc: Option<String>,
53    pub ip: Option<String>,
54    pub port: Option<u16>,
55    pub progress: Option<f64>,
56    pub relevance: Option<u64>,
57    pub up_speed: Option<u64>,
58    pub uploaded: Option<u64>,
59}