19 lines
806 B
Rust
19 lines
806 B
Rust
use crate::commands::shared::{
|
|
create_authenticated_conn, find_folder, find_lab_in_cache, load_cache_with_token_refresh, parse_remote_path,
|
|
};
|
|
|
|
pub async fn metadata(remote_path: &str, password: Option<&str>) -> Result<(), Box<dyn std::error::Error>> {
|
|
let (remote, labname, folder_path) = parse_remote_path(remote_path)?;
|
|
let cache = load_cache_with_token_refresh(&remote).await?;
|
|
let conn = create_authenticated_conn(&remote, &cache)?;
|
|
let lab = find_lab_in_cache(&cache, &labname)?;
|
|
let folder = find_folder(&conn, lab.id, &folder_path, password).await?;
|
|
|
|
let resp = conn
|
|
.get(&format!("v3/folders/{}/metadata/", folder.id))
|
|
.await?;
|
|
let json: serde_json::Value = resp.json().await?;
|
|
println!("{}", serde_json::to_string_pretty(&json)?);
|
|
Ok(())
|
|
}
|