diff options
author | Ferris Tseng <ferristseng@fastmail.fm> | 2018-01-23 20:24:44 -0500 |
---|---|---|
committer | Ferris Tseng <ferristseng@fastmail.fm> | 2018-01-23 20:24:44 -0500 |
commit | 1661d3e4a90ea2797b3b0485c9396b0b79473e0c (patch) | |
tree | 2fe85a30d67cfb38b2d8fa2da99838e7053206a7 /ipfs-api/src | |
parent | a6c716e771ac041323fefcc1d04dc98490c38eff (diff) |
add /bitswap/reprovide
Diffstat (limited to 'ipfs-api/src')
-rw-r--r-- | ipfs-api/src/client.rs | 23 | ||||
-rw-r--r-- | ipfs-api/src/request/bitswap.rs | 8 | ||||
-rw-r--r-- | ipfs-api/src/response/bitswap.rs | 2 |
3 files changed, 32 insertions, 1 deletions
diff --git a/ipfs-api/src/client.rs b/ipfs-api/src/client.rs index 564415f..7a4fbed 100644 --- a/ipfs-api/src/client.rs +++ b/ipfs-api/src/client.rs @@ -362,7 +362,28 @@ impl IpfsClient { self.request(&request::BitswapLedger { peer }, None) } - // TODO /bitswap/reprovide + /// Triggers a reprovide. + /// + /// # Examples + /// + /// ```no_run + /// # extern crate ipfs_api; + /// # extern crate tokio_core; + /// # + /// use ipfs_api::IpfsClient; + /// use tokio_core::reactor::Core; + /// + /// # fn main() { + /// let mut core = Core::new().unwrap(); + /// let client = IpfsClient::default(&core.handle()); + /// let req = client.bitswap_reprovide(); + /// # } + /// ``` + /// + #[inline] + pub fn bitswap_reprovide(&self) -> AsyncResponse<response::BitswapReprovideResponse> { + self.request_empty(&request::BitswapReprovide, None) + } /// Returns some stats about the bitswap agent. /// diff --git a/ipfs-api/src/request/bitswap.rs b/ipfs-api/src/request/bitswap.rs index 1f795bb..326778e 100644 --- a/ipfs-api/src/request/bitswap.rs +++ b/ipfs-api/src/request/bitswap.rs @@ -17,6 +17,14 @@ impl<'a> ApiRequest for BitswapLedger<'a> { const PATH: &'static str = "/bitswap/ledger"; } +pub struct BitswapReprovide; + +impl_skip_serialize!(BitswapReprovide); + +impl ApiRequest for BitswapReprovide { + const PATH: &'static str = "/bitswap/reprovide"; +} + pub struct BitswapStat; impl_skip_serialize!(BitswapStat); diff --git a/ipfs-api/src/response/bitswap.rs b/ipfs-api/src/response/bitswap.rs index 69b9705..c1039de 100644 --- a/ipfs-api/src/response/bitswap.rs +++ b/ipfs-api/src/response/bitswap.rs @@ -18,6 +18,8 @@ pub struct BitswapLedgerResponse { pub exchanged: u64, } +pub type BitswapReprovideResponse = (); + #[derive(Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct BitswapStatResponse { |