From 27069656be40081303b7e3888b37b5c23231c5df Mon Sep 17 00:00:00 2001 From: Julius Michaelis Date: Thu, 9 Jul 2020 17:33:12 +0900 Subject: add ipfs files chcid --- ipfs-api/src/client/internal.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'ipfs-api/src/client/internal.rs') diff --git a/ipfs-api/src/client/internal.rs b/ipfs-api/src/client/internal.rs index ef4e9f2..6c646cc 100644 --- a/ipfs-api/src/client/internal.rs +++ b/ipfs-api/src/client/internal.rs @@ -1257,6 +1257,30 @@ impl IpfsClient { .await } + /// Change the cid version or hash function of the root node of a given path. + /// + /// ```no_run + /// use ipfs_api::IpfsClient; + /// use std::fs::File; + /// + /// let client = IpfsClient::default(); + /// let res = client.files_chcid("/test/", 1, Some("sha3-512")); + /// ``` + /// + /// Not specifying a byte `count` writes the entire input. + /// + #[inline] + pub async fn files_chcid( + &self, + path: &str, + cid_version: i32, + hash: Option<&str>, + ) -> Result + { + self.request_empty(request::FilesChcid { path, cid_version, hash }, None) + .await + } + /// List blocks that are both in the filestore and standard block storage. /// /// ```no_run -- cgit v1.2.3