jorgehermo9 commented on code in PR #6066: URL: https://github.com/apache/opendal/pull/6066#discussion_r2061442076
########## core/src/services/b2/core.rs: ########## @@ -407,12 +423,45 @@ impl B2Core { self.send(req).await } + pub async fn get_file_info(&self, path: &str, delimiter: Option<&str>) -> Result<File> { + let resp = self + .list_file_names_raw(Some(path), delimiter, None, None, Operation::Stat) + .await?; + + let status = resp.status(); + match status { + StatusCode::OK => { + let bs = resp.into_body(); + let mut resp: ListFileNamesResponse = + serde_json::from_reader(bs.reader()).map_err(new_json_deserialize_error)?; Review Comment: While doing this refactor I realized that, In my opinion, we should do response deserialization in all `core.rs` modules. For example, `list_file_names` should return a `ListFileNamesResponse` instead of `Buffer` and then deserialize it in the backend. I think all methods in core.rs (not only this services, but others) should do something similar to what I'm doing here, since I don't really think it is the backend responsibility. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@opendal.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org