summaryrefslogtreecommitdiffstats
path: root/ipfs-api/src/response/dag.rs
diff options
context:
space:
mode:
authorFerris Tseng <ferristseng@fastmail.fm>2017-10-10 23:27:33 -0400
committerFerris Tseng <ferristseng@fastmail.fm>2017-10-10 23:27:33 -0400
commit710e86da290ec7f8944f85f89fbc02400bab25a5 (patch)
tree119700370a28b1d0d93154bd4d8b9d2c9b4514be /ipfs-api/src/response/dag.rs
parentabc51e51407678a59087b76e91ce9019a858c04a (diff)
add get dag
Diffstat (limited to 'ipfs-api/src/response/dag.rs')
-rw-r--r--ipfs-api/src/response/dag.rs31
1 files changed, 29 insertions, 2 deletions
diff --git a/ipfs-api/src/response/dag.rs b/ipfs-api/src/response/dag.rs
index 01509ca..2e3c3a3 100644
--- a/ipfs-api/src/response/dag.rs
+++ b/ipfs-api/src/response/dag.rs
@@ -1,8 +1,35 @@
-pub type DagGetResponse = String;
+use response::serde;
+use std::collections::HashMap;
-#[derive(Deserialize)]
+#[derive(Debug, Deserialize)]
+#[serde(rename_all = "PascalCase")]
+pub struct DagIpfsHeader {
+ pub name: String,
+ pub size: u64,
+
+ #[serde(deserialize_with = "serde::deserialize_hashmap")]
+ pub cid: HashMap<String, String>
+}
+
+
+#[derive(Debug, Deserialize)]
+pub struct DagGetResponse {
+ pub data: Option<String>,
+
+ #[serde(deserialize_with = "serde::deserialize_vec")]
+ pub links: Vec<DagIpfsHeader>
+}
+
+
+#[derive(Debug, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct DagPutResponse {
pub cid: String,
}
+
+
+#[cfg(test)]
+mod tests {
+ deserialize_test!(v0_dag_get_0, DagGetResponse);
+}