Add request and response types

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/4/head
trivernis 3 years ago
parent 57fbd666a8
commit ace0d78aea

@ -9,6 +9,7 @@ license = "gpl-3"
[dependencies] [dependencies]
tracing = "0.1.29" tracing = "0.1.29"
thiserror = "1.0.30" thiserror = "1.0.30"
chrono = "0.4.19"
rmp-ipc = {version = "0.7.2", optional=true} rmp-ipc = {version = "0.7.2", optional=true}
tauri = {version = "1.0.0-beta.8", optional=true} tauri = {version = "1.0.0-beta.8", optional=true}

@ -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…
Cancel
Save