diff options
author | Ferris Tseng <ferristseng@fastmail.fm> | 2017-10-12 18:10:25 -0400 |
---|---|---|
committer | Ferris Tseng <ferristseng@fastmail.fm> | 2017-10-12 18:10:25 -0400 |
commit | 31ac8fcce3e34c0a5fa7c96f952523d3c643585f (patch) | |
tree | 1dfa43e8e94b22730cae24a7fdc8430fdb6417cb /ipfs-api/src/response | |
parent | 15c3808b3f5e27655025acbb0dc001f156ff74e1 (diff) |
add call for pubsub/sub
Diffstat (limited to 'ipfs-api/src/response')
-rw-r--r-- | ipfs-api/src/response/pubsub.rs | 30 | ||||
-rw-r--r-- | ipfs-api/src/response/tests/v0_pubsub_sub_1.json | 1 |
2 files changed, 13 insertions, 18 deletions
diff --git a/ipfs-api/src/response/pubsub.rs b/ipfs-api/src/response/pubsub.rs index f60d3de..b1948a2 100644 --- a/ipfs-api/src/response/pubsub.rs +++ b/ipfs-api/src/response/pubsub.rs @@ -1,7 +1,7 @@ use response::serde; -#[derive(Deserialize)] +#[derive(Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct PubsubLsResponse { #[serde(deserialize_with = "serde::deserialize_vec")] @@ -9,7 +9,7 @@ pub struct PubsubLsResponse { } -#[derive(Deserialize)] +#[derive(Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct PubsubPeersResponse { #[serde(deserialize_with = "serde::deserialize_vec")] @@ -20,24 +20,17 @@ pub struct PubsubPeersResponse { pub type PubsubPubResponse = (); -#[derive(Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct PubsubMessage { - pub from: String, - pub data: String, - pub seqno: String, - pub topic_ids: Vec<String>, - - #[serde(rename = "XXX_unrecognized")] - #[serde(deserialize_with = "serde::deserialize_vec")] - pub unrecognized: Vec<u8>, -} +#[derive(Debug, Deserialize)] +pub struct PubsubSubResponse { + pub from: Option<String>, + pub data: Option<String>, + pub seqno: Option<String>, + #[serde(rename = "topicIDs")] + pub topic_ids: Option<Vec<String>>, -#[derive(Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct PubsubSubResponse { - pub message: Option<PubsubMessage>, + #[serde(rename = "XXX_unrecognized")] + pub unrecognized: Option<Vec<u8>>, } @@ -47,4 +40,5 @@ mod tests { deserialize_test!(v0_pubsub_ls_1, PubsubLsResponse); deserialize_test!(v0_pubsub_peers_0, PubsubPeersResponse); deserialize_test!(v0_pubsub_sub_0, PubsubSubResponse); + deserialize_test!(v0_pubsub_sub_1, PubsubSubResponse); } diff --git a/ipfs-api/src/response/tests/v0_pubsub_sub_1.json b/ipfs-api/src/response/tests/v0_pubsub_sub_1.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/ipfs-api/src/response/tests/v0_pubsub_sub_1.json @@ -0,0 +1 @@ +{} |