From 0396a65904a16fbb9820155c2564bb664f516d67 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 15 Jun 2019 13:02:21 +0200 Subject: Implement /dag/put route --- ipfs-api/src/client.rs | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/ipfs-api/src/client.rs b/ipfs-api/src/client.rs index 6c1e3bf..10afc6e 100644 --- a/ipfs-api/src/client.rs +++ b/ipfs-api/src/client.rs @@ -942,22 +942,19 @@ impl IpfsClient { self.request(&request::DagGet { path }, None) } - // TODO /dag routes are experimental, and there isn't a whole lot of - // documentation available for how this route works. - // - // /// Add a DAG node to Ipfs. - // /// - // #[inline] - // pub fn dag_put(&self, data: R) -> AsyncResponse - // where - // R: 'static + Read + Send, - // { - // let mut form = multipart::Form::default(); - // - // form.add_reader("arg", data); - // - // self.request(&request::DagPut, Some(form)) - // } + /// Add a DAG node to Ipfs. + /// + #[inline] + pub fn dag_put(&self, data: R) -> AsyncResponse + where + R: 'static + Read + Send, + { + let mut form = multipart::Form::default(); + + form.add_reader("arg", data); + + self.request(&request::DagPut, Some(form)) + } // TODO /dag/resolve -- cgit v1.2.3