diff --git a/src/types/mod.rs b/src/types/mod.rs index f601540..5629958 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -10,7 +10,6 @@ pub struct BasicAuth { } pub use self::request::ArgumentFields; -pub use self::request::File; pub use self::request::Id; pub(crate) use self::request::RpcRequest; pub use self::request::TorrentAction; diff --git a/src/types/request.rs b/src/types/request.rs index 6582883..4620d3a 100644 --- a/src/types/request.rs +++ b/src/types/request.rs @@ -146,16 +146,22 @@ pub struct TorrentAddArgs { pub peer_limit: Option, #[serde(skip_serializing_if = "Option::is_none", rename = "bandwidthPriority")] pub bandwidth_priority: Option, + /// list of indices of files to be downloaded + /// to ignore some files, put their indices in files_unwanted, otherwise they will still be downloaded #[serde(skip_serializing_if = "Option::is_none", rename = "files-wanted")] - pub files_wanted: Option>, + pub files_wanted: Option>, + /// list of indices of files not to download #[serde(skip_serializing_if = "Option::is_none", rename = "files-unwanted")] - pub files_unwanted: Option>, + pub files_unwanted: Option>, + /// list of indices of files to be downloaded with high priority #[serde(skip_serializing_if = "Option::is_none", rename = "priority-high")] - pub priority_high: Option>, + pub priority_high: Option>, + /// list of indices of files to be downloaded with low priority #[serde(skip_serializing_if = "Option::is_none", rename = "priority-low")] - pub priority_low: Option>, + pub priority_low: Option>, + /// list of indices of files to be downloaded with normal priority #[serde(skip_serializing_if = "Option::is_none", rename = "priority-normal")] - pub priority_normal: Option>, + pub priority_normal: Option>, } impl Default for TorrentAddArgs { @@ -177,10 +183,6 @@ impl Default for TorrentAddArgs { } } -#[derive(Serialize, Debug, RustcEncodable, Clone)] -pub struct File { - //todo -} #[derive(Clone, IntoEnumIterator)] pub enum TorrentGetField { Id, @@ -213,6 +215,9 @@ pub enum TorrentGetField { Uploadedever, Uploadratio, Webseedssendingtous, + Wanted, + Priorities, + Filestats } impl TorrentGetField { @@ -254,6 +259,9 @@ impl TorrentGetField { TorrentGetField::Uploadedever => "uploadedEver", TorrentGetField::Uploadratio => "uploadRatio", TorrentGetField::Webseedssendingtous => "webseedsSendingToUs", + TorrentGetField::Wanted => "wanted", + TorrentGetField::Priorities => "priorities", + TorrentGetField::Filestats => "fileStats", }.to_string() } } diff --git a/src/types/response.rs b/src/types/response.rs index 6f2193d..0dfc5f2 100644 --- a/src/types/response.rs +++ b/src/types/response.rs @@ -76,6 +76,12 @@ pub struct Torrent { #[serde(rename = "uploadedEver")] pub uploaded_ever: Option, pub files: Option>, + /// for each file in files, whether or not they will be downloaded (0 or 1) + pub wanted: Option>, + /// for each file in files, their download priority (low:-1,normal:0,high:1) + pub priorities: Option>, + #[serde(rename = "fileStats")] + pub file_stats: Option>, } #[derive(Deserialize, Debug, RustcEncodable)] @@ -98,6 +104,15 @@ pub struct File { pub name: String, } +#[derive(Deserialize, Debug, RustcEncodable, Clone)] +pub struct FileStat { + #[serde(rename = "bytesCompleted")] + pub bytes_completed: i64, + pub wanted: bool, + /// low: -1, normal: 0, high: 1 + pub priority: i8, +} + #[derive(Deserialize, Debug, RustcEncodable)] pub struct Nothing {} impl RpcResponseArgument for Nothing {}