HomeDisk/types/src/fs/list.rs

40 lines
941 B
Rust
Raw Normal View History

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-11 08:19:47 +00:00
/// HTTP `/fs/list` Request
2022-04-24 20:07:41 +00:00
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Request {
2022-06-18 10:35:23 +00:00
/// Path to directory
2022-04-24 20:07:41 +00:00
pub path: String,
}
2022-06-11 08:19:47 +00:00
/// HTTP `/fs/list` Response
2022-04-24 20:07:41 +00:00
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Response {
2022-06-18 10:35:23 +00:00
/// Vector with files info
2022-04-29 19:33:44 +00:00
pub files: Vec<FileInfo>,
2022-06-18 10:35:23 +00:00
/// Vector with directories info
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
pub modified: u64,
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,
}