Add request and response types
Signed-off-by: trivernis <trivernis@protonmail.com>pull/4/head
parent
57fbd666a8
commit
ace0d78aea
@ -0,0 +1,55 @@
|
||||
use chrono::NaiveDateTime;
|
||||
use crate::types::identifier::FileIdentifier;
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct AddFileRequest {
|
||||
pub path: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct ReadFileRequest {
|
||||
pub id: FileIdentifier,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct GetFileThumbnailsRequest {
|
||||
pub id: FileIdentifier,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct GetFileTagsRequest {
|
||||
pub id: FileIdentifier,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct FindFilesByTagsRequest {
|
||||
pub tags: Vec<TagQuery>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct TagQuery {
|
||||
pub negate: bool,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct FileMetadataResponse {
|
||||
pub id: i64,
|
||||
pub name: Option<String>,
|
||||
pub comment: Option<String>,
|
||||
pub hash: String,
|
||||
pub file_type: u32,
|
||||
pub mime_type: Option<String>,
|
||||
pub creation_time: NaiveDateTime,
|
||||
pub change_time: NaiveDateTime,
|
||||
pub import_time: NaiveDateTime,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct ThumbnailMetadataResponse {
|
||||
pub id: i64,
|
||||
pub hash: Strin,
|
||||
pub height: i32,
|
||||
pub width: i32,
|
||||
pub mime_type: Option<String>,
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub enum FileIdentifier {
|
||||
ID(i64),
|
||||
Hash(String),
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct InfoResponse {
|
||||
pub name: String,
|
||||
pub version: String,
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
pub mod files;
|
||||
pub mod identifier;
|
||||
pub mod misc;
|
||||
pub mod tags;
|
@ -0,0 +1,6 @@
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct TagResponse {
|
||||
pub id: i64,
|
||||
pub namespace: Option<String>,
|
||||
pub name: String,
|
||||
}
|
Loading…
Reference in New Issue