From 716e34de0419ec0a2533fe6b5b20cab3d11405b2 Mon Sep 17 00:00:00 2001 From: Julius Michaelis Date: Mon, 13 Jul 2020 15:21:17 +0900 Subject: ipfs files: add *_with_options for currently unusable parameters --- ipfs-api/src/client/internal.rs | 72 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 67 insertions(+), 5 deletions(-) diff --git a/ipfs-api/src/client/internal.rs b/ipfs-api/src/client/internal.rs index d652458..0817ada 100644 --- a/ipfs-api/src/client/internal.rs +++ b/ipfs-api/src/client/internal.rs @@ -1124,10 +1124,27 @@ impl IpfsClient { path: &str, dest: &str, ) -> Result { - self.request_empty(request::FilesCp { path, dest, .. default() }, None) + self.files_cp_with_options(request::FilesCp { path, dest, .. default() }) .await } + /// Copy files into MFS. + /// + /// ```no_run + /// use ipfs_api::IpfsClient; + /// + /// let client = IpfsClient::default(); + /// let res = client.files_cp("/path/to/file", "/dest"); + /// ``` + /// + #[inline] + pub async fn files_cp_with_options( + &self, + options: request::FilesCp<'_>, + ) -> Result { + self.request_empty(options, None).await + } + /// Flush a path's data to disk. /// /// ```no_run @@ -1236,8 +1253,7 @@ impl IpfsClient { &self, options: request::FilesMkdir<'_> ) -> Result { - self.request_empty(options, None) - .await + self.request_empty(options, None).await } /// Copy files into MFS. @@ -1255,7 +1271,31 @@ impl IpfsClient { path: &str, dest: &str, ) -> Result { - self.request_empty(request::FilesMv { path, dest, .. default() }, None) + self.files_mv_with_options(request::FilesMv { path, dest, .. default() }) + .await + } + + /// Copy files into MFS. + /// + /// ```no_run + /// use ipfs_api::IpfsClient; + /// + /// let client = IpfsClient::default(); + /// let res = client.files_mv_with_options( + /// ipfs_api::request::FilesMv { + /// path: "/test/tmp.json", + /// dest: "/test/file.json", + /// flush: Some(false), + /// } + /// ); + /// ``` + /// + #[inline] + pub async fn files_mv_with_options( + &self, + options: request::FilesMv<'_>, + ) -> Result { + self.request_empty(options, None) .await } @@ -1358,7 +1398,29 @@ impl IpfsClient { /// #[inline] pub async fn files_stat(&self, path: &str) -> Result { - self.request(request::FilesStat { path, .. default() }, None).await + self.files_stat_with_options(request::FilesStat { path, .. default() }).await + } + + /// Display a file's status in MFS. + /// + /// ```no_run + /// use ipfs_api::IpfsClient; + /// + /// let client = IpfsClient::default(); + /// let res = client.files_stat_with_options( + /// ipfs_api::request::FilesStat { + /// path: "/test/dir/", + /// with_local: Some(true), + /// } + /// ); + /// ``` + /// + #[inline] + pub async fn files_stat_with_options( + &self, + options: request::FilesStat<'_> + ) -> Result { + self.request(options, None).await } /// Write to a mutable file in the filesystem. -- cgit v1.2.3