diff --git a/src/lib.rs b/src/lib.rs index 96c0c14..b9b4e4e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,6 +19,7 @@ mod ipns; mod object; mod version; +#[derive(Clone, PartialEq, Hash, Debug)] pub struct IpfsApi { server: String, port: u16 diff --git a/src/object.rs b/src/object.rs index 9c952a0..618454e 100644 --- a/src/object.rs +++ b/src/object.rs @@ -13,8 +13,12 @@ error_chain! { #[derive(Deserialize, Debug, PartialEq, Hash)] #[serde(rename_all="PascalCase")] pub struct ObjectStats { - hash: String, - cumulative_size: u64 + pub hash: String, + pub num_links: u64, + pub block_size: u64, + pub links_size: u64, + pub data_size: u64, + pub cumulative_size: u64 } impl IpfsApi { @@ -39,9 +43,13 @@ mod tests { let stats = api.object_stats("QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u").unwrap(); let desired = ObjectStats { hash: "QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u".to_string(), + num_links: 0, + block_size: 20, + links_size: 2, + data_size: 18, cumulative_size: 20, }; assert_eq!(stats, desired); } -} \ No newline at end of file +} diff --git a/src/pin.rs b/src/pin.rs index 1490758..694d149 100644 --- a/src/pin.rs +++ b/src/pin.rs @@ -15,27 +15,27 @@ error_chain! { #[derive(Deserialize, Debug, PartialEq, Hash)] #[serde(rename_all="PascalCase")] pub struct PinAddResponse { - pins: Vec, - progress: Option + pub pins: Vec, + pub progress: Option } #[derive(Deserialize, Debug, PartialEq, Hash)] #[serde(rename_all="PascalCase")] pub struct PinRmResponse { - pins: Vec + pub pins: Vec } #[derive(Deserialize, Debug, PartialEq, Hash)] pub struct PinType { #[serde(rename = "Type")] - objtype: String, + pub objtype: String, } #[derive(Deserialize, Debug, PartialEq)] #[serde(rename_all="PascalCase")] pub struct PinList { // keys: Vec - keys: HashMap + pub keys: HashMap } impl IpfsApi { @@ -82,7 +82,6 @@ impl IpfsApi { #[cfg(test)] mod tests { - use std::collections::HashMap; use IpfsApi; use super::*; @@ -132,4 +131,4 @@ mod tests { }; assert_eq!(resp.unwrap(), desired); } -} \ No newline at end of file +} diff --git a/src/pubsub.rs b/src/pubsub.rs index f10bfe2..ee8dd53 100644 --- a/src/pubsub.rs +++ b/src/pubsub.rs @@ -22,9 +22,9 @@ struct JsonPubSubMessage { #[derive(Debug)] pub struct PubSubMessage { - data: Option>, - from: Option>, - seqno: Option> + pub data: Option>, + pub from: Option>, + pub seqno: Option> } impl PubSubMessage { diff --git a/src/version.rs b/src/version.rs index c8deee8..079c1cb 100644 --- a/src/version.rs +++ b/src/version.rs @@ -13,11 +13,11 @@ error_chain! { #[derive(Deserialize, Debug)] #[serde(rename_all="PascalCase")] pub struct IpfsVersion { - version: String, - commit: String, - repo: String, - system: String, - golang: String + pub version: String, + pub commit: String, + pub repo: String, + pub system: String, + pub golang: String } impl IpfsApi {