2022-06-08 22:02:20 +00:00
|
|
|
//! HTTP `/fs/list` Request, Response, FileInfo and DirInfo types
|
|
|
|
|
2022-04-24 20:07:41 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
2022-06-08 22:02:20 +00:00
|
|
|
/// `/fs/list` Request
|
2022-04-24 20:07:41 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
pub struct Request {
|
|
|
|
pub path: String,
|
|
|
|
}
|
|
|
|
|
2022-06-08 22:02:20 +00:00
|
|
|
/// `/fs/list` Response
|
2022-04-24 20:07:41 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
pub struct Response {
|
2022-04-29 19:33:44 +00:00
|
|
|
pub files: Vec<FileInfo>,
|
2022-05-03 08:42:53 +00:00
|
|
|
pub dirs: Vec<DirInfo>,
|
2022-04-24 20:07:41 +00:00
|
|
|
}
|
2022-04-29 19:33:44 +00:00
|
|
|
|
2022-06-08 22:02:20 +00:00
|
|
|
/// Info about a file
|
2022-04-29 19:33:44 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
pub struct FileInfo {
|
2022-06-08 22:02:20 +00:00
|
|
|
/// File name
|
2022-04-29 19:33:44 +00:00
|
|
|
pub name: String,
|
2022-06-08 22:02:20 +00:00
|
|
|
/// File size
|
2022-04-29 19:33:44 +00:00
|
|
|
pub size: String,
|
2022-06-08 22:02:20 +00:00
|
|
|
/// Latest modification of this file
|
2022-05-03 09:26:29 +00:00
|
|
|
pub modified: String,
|
2022-04-29 19:33:44 +00:00
|
|
|
}
|
2022-05-03 08:42:53 +00:00
|
|
|
|
2022-06-08 22:02:20 +00:00
|
|
|
/// Info about a directory
|
2022-05-03 08:42:53 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
pub struct DirInfo {
|
2022-06-08 22:02:20 +00:00
|
|
|
/// Directory name
|
2022-05-03 08:42:53 +00:00
|
|
|
pub name: String,
|
2022-06-08 22:02:20 +00:00
|
|
|
/// Directory size (size of all files in directory)
|
2022-05-03 08:42:53 +00:00
|
|
|
pub size: String,
|
|
|
|
}
|