mirror of
https://github.com/kristoferssolo/transmission-rpc.git
synced 2025-10-21 20:10:37 +00:00
Use serde's rename_all everywhere
This commit is contained in:
parent
cf720e36cd
commit
405bc6dba6
@ -13,31 +13,24 @@ impl<T: RpcResponseArgument> RpcResponse<T> {
|
|||||||
pub trait RpcResponseArgument {}
|
pub trait RpcResponseArgument {}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
|
#[serde(rename_all = "kebab-case")]
|
||||||
pub struct SessionGet {
|
pub struct SessionGet {
|
||||||
#[serde(rename = "blocklist-enabled")]
|
|
||||||
pub blocklist_enabled: bool,
|
pub blocklist_enabled: bool,
|
||||||
#[serde(rename = "download-dir")]
|
|
||||||
pub download_dir: String,
|
pub download_dir: String,
|
||||||
pub encryption: String,
|
pub encryption: String,
|
||||||
#[serde(rename = "rpc-version")]
|
|
||||||
pub rpc_version: i32,
|
pub rpc_version: i32,
|
||||||
#[serde(rename = "rpc-version-minimum")]
|
|
||||||
pub rpc_version_minimum: i32,
|
pub rpc_version_minimum: i32,
|
||||||
pub version: String,
|
pub version: String,
|
||||||
}
|
}
|
||||||
impl RpcResponseArgument for SessionGet {}
|
impl RpcResponseArgument for SessionGet {}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct SessionStats {
|
pub struct SessionStats {
|
||||||
#[serde(rename = "torrentCount")]
|
|
||||||
pub torrent_count: i32,
|
pub torrent_count: i32,
|
||||||
#[serde(rename = "activeTorrentCount")]
|
|
||||||
pub active_torrent_count: i32,
|
pub active_torrent_count: i32,
|
||||||
#[serde(rename = "pausedTorrentCount")]
|
|
||||||
pub paused_torrent_count: i32,
|
pub paused_torrent_count: i32,
|
||||||
#[serde(rename = "downloadSpeed")]
|
|
||||||
pub download_speed: i64,
|
pub download_speed: i64,
|
||||||
#[serde(rename = "uploadSpeed")]
|
|
||||||
pub upload_speed: i64,
|
pub upload_speed: i64,
|
||||||
#[serde(rename = "current-stats")]
|
#[serde(rename = "current-stats")]
|
||||||
pub current_stats: Stats,
|
pub current_stats: Stats,
|
||||||
@ -51,109 +44,78 @@ pub struct SessionClose {}
|
|||||||
impl RpcResponseArgument for SessionClose {}
|
impl RpcResponseArgument for SessionClose {}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
|
#[serde(rename_all = "kebab-case")]
|
||||||
pub struct BlocklistUpdate {
|
pub struct BlocklistUpdate {
|
||||||
#[serde(rename = "blocklist-size")]
|
|
||||||
pub blocklist_size: Option<i32>,
|
pub blocklist_size: Option<i32>,
|
||||||
}
|
}
|
||||||
impl RpcResponseArgument for BlocklistUpdate {}
|
impl RpcResponseArgument for BlocklistUpdate {}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
|
#[serde(rename_all = "kebab-case")]
|
||||||
pub struct FreeSpace {
|
pub struct FreeSpace {
|
||||||
pub path: String,
|
pub path: String,
|
||||||
#[serde(rename = "size-bytes")]
|
|
||||||
pub size_bytes: i64,
|
pub size_bytes: i64,
|
||||||
}
|
}
|
||||||
impl RpcResponseArgument for FreeSpace {}
|
impl RpcResponseArgument for FreeSpace {}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
|
#[serde(rename_all = "kebab-case")]
|
||||||
pub struct PortTest {
|
pub struct PortTest {
|
||||||
#[serde(rename = "port-is-open")]
|
|
||||||
pub port_is_open: bool,
|
pub port_is_open: bool,
|
||||||
}
|
}
|
||||||
impl RpcResponseArgument for PortTest {}
|
impl RpcResponseArgument for PortTest {}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Torrent {
|
pub struct Torrent {
|
||||||
#[serde(rename = "activityDate")]
|
|
||||||
pub activity_date: Option<i64>,
|
pub activity_date: Option<i64>,
|
||||||
#[serde(rename = "addedDate")]
|
|
||||||
pub added_date: Option<i64>,
|
pub added_date: Option<i64>,
|
||||||
#[serde(rename = "doneDate")]
|
|
||||||
pub done_date: Option<i64>,
|
pub done_date: Option<i64>,
|
||||||
#[serde(rename = "downloadDir")]
|
|
||||||
pub download_dir: Option<String>,
|
pub download_dir: Option<String>,
|
||||||
#[serde(rename = "editDate")]
|
|
||||||
pub edit_date: Option<i64>,
|
pub edit_date: Option<i64>,
|
||||||
pub error: Option<i64>,
|
pub error: Option<i64>,
|
||||||
#[serde(rename = "errorString")]
|
|
||||||
pub error_string: Option<String>,
|
pub error_string: Option<String>,
|
||||||
pub eta: Option<i64>,
|
pub eta: Option<i64>,
|
||||||
pub id: Option<i64>,
|
pub id: Option<i64>,
|
||||||
#[serde(rename = "isFinished")]
|
|
||||||
pub is_finished: Option<bool>,
|
pub is_finished: Option<bool>,
|
||||||
#[serde(rename = "isPrivate")]
|
|
||||||
pub is_private: Option<bool>,
|
pub is_private: Option<bool>,
|
||||||
#[serde(rename = "isStalled")]
|
|
||||||
pub is_stalled: Option<bool>,
|
pub is_stalled: Option<bool>,
|
||||||
#[serde(rename = "labels")]
|
|
||||||
pub labels: Option<Vec<String>>,
|
pub labels: Option<Vec<String>>,
|
||||||
#[serde(rename = "leftUntilDone")]
|
|
||||||
pub left_until_done: Option<i64>,
|
pub left_until_done: Option<i64>,
|
||||||
#[serde(rename = "metadataPercentComplete")]
|
|
||||||
pub metadata_percent_complete: Option<f32>,
|
pub metadata_percent_complete: Option<f32>,
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
#[serde(rename = "hashString")]
|
|
||||||
pub hash_string: Option<String>,
|
pub hash_string: Option<String>,
|
||||||
#[serde(rename = "peersConnected")]
|
|
||||||
pub peers_connected: Option<i64>,
|
pub peers_connected: Option<i64>,
|
||||||
#[serde(rename = "peersGettingFromUs")]
|
|
||||||
pub peers_getting_from_us: Option<i64>,
|
pub peers_getting_from_us: Option<i64>,
|
||||||
#[serde(rename = "peersSendingToUs")]
|
|
||||||
pub peers_sending_to_us: Option<i64>,
|
pub peers_sending_to_us: Option<i64>,
|
||||||
#[serde(rename = "percentDone")]
|
|
||||||
pub percent_done: Option<f32>,
|
pub percent_done: Option<f32>,
|
||||||
#[serde(rename = "rateDownload")]
|
|
||||||
pub rate_download: Option<i64>,
|
pub rate_download: Option<i64>,
|
||||||
#[serde(rename = "rateUpload")]
|
|
||||||
pub rate_upload: Option<i64>,
|
pub rate_upload: Option<i64>,
|
||||||
#[serde(rename = "recheckProgress")]
|
|
||||||
pub recheck_progress: Option<f32>,
|
pub recheck_progress: Option<f32>,
|
||||||
#[serde(rename = "secondsSeeding")]
|
|
||||||
pub seconds_seeding: Option<i64>,
|
pub seconds_seeding: Option<i64>,
|
||||||
#[serde(rename = "seedRatioLimit")]
|
|
||||||
pub seed_ratio_limit: Option<f32>,
|
pub seed_ratio_limit: Option<f32>,
|
||||||
#[serde(rename = "sizeWhenDone")]
|
|
||||||
pub size_when_done: Option<i64>,
|
pub size_when_done: Option<i64>,
|
||||||
pub status: Option<i64>,
|
pub status: Option<i64>,
|
||||||
#[serde(rename = "torrentFile")]
|
|
||||||
pub torrent_file: Option<String>,
|
pub torrent_file: Option<String>,
|
||||||
#[serde(rename = "totalSize")]
|
|
||||||
pub total_size: Option<i64>,
|
pub total_size: Option<i64>,
|
||||||
pub trackers: Option<Vec<Trackers>>,
|
pub trackers: Option<Vec<Trackers>>,
|
||||||
#[serde(rename = "uploadRatio")]
|
|
||||||
pub upload_ratio: Option<f32>,
|
pub upload_ratio: Option<f32>,
|
||||||
#[serde(rename = "uploadedEver")]
|
|
||||||
pub uploaded_ever: Option<i64>,
|
pub uploaded_ever: Option<i64>,
|
||||||
pub files: Option<Vec<File>>,
|
pub files: Option<Vec<File>>,
|
||||||
/// for each file in files, whether or not they will be downloaded (0 or 1)
|
/// for each file in files, whether or not they will be downloaded (0 or 1)
|
||||||
pub wanted: Option<Vec<i8>>,
|
pub wanted: Option<Vec<i8>>,
|
||||||
/// for each file in files, their download priority (low:-1,normal:0,high:1)
|
/// for each file in files, their download priority (low:-1,normal:0,high:1)
|
||||||
pub priorities: Option<Vec<i8>>,
|
pub priorities: Option<Vec<i8>>,
|
||||||
#[serde(rename = "fileStats")]
|
|
||||||
pub file_stats: Option<Vec<FileStat>>,
|
pub file_stats: Option<Vec<FileStat>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Stats {
|
pub struct Stats {
|
||||||
#[serde(rename = "filesAdded")]
|
|
||||||
pub files_added: i32,
|
pub files_added: i32,
|
||||||
#[serde(rename = "downloadedBytes")]
|
|
||||||
pub downloaded_bytes: i64,
|
pub downloaded_bytes: i64,
|
||||||
#[serde(rename = "uploadedBytes")]
|
|
||||||
pub uploaded_bytes: i64,
|
pub uploaded_bytes: i64,
|
||||||
#[serde(rename = "secondsActive")]
|
|
||||||
pub seconds_active: i64,
|
pub seconds_active: i64,
|
||||||
#[serde(rename = "sessionCount")]
|
|
||||||
pub session_count: Option<i32>,
|
pub session_count: Option<i32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,16 +132,16 @@ pub struct Trackers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct File {
|
pub struct File {
|
||||||
pub length: i64,
|
pub length: i64,
|
||||||
#[serde(rename = "bytesCompleted")]
|
|
||||||
pub bytes_completed: i64,
|
pub bytes_completed: i64,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct FileStat {
|
pub struct FileStat {
|
||||||
#[serde(rename = "bytesCompleted")]
|
|
||||||
pub bytes_completed: i64,
|
pub bytes_completed: i64,
|
||||||
pub wanted: bool,
|
pub wanted: bool,
|
||||||
/// low: -1, normal: 0, high: 1
|
/// low: -1, normal: 0, high: 1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user