You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
3.0 KiB
Rust
129 lines
3.0 KiB
Rust
use crate::types::identifier::FileIdentifier;
|
|
use chrono::NaiveDateTime;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[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 GetFileThumbnailOfSizeRequest {
|
|
pub id: FileIdentifier,
|
|
pub min_size: (u32, u32),
|
|
pub max_size: (u32, u32),
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
pub struct GetFileTagsRequest {
|
|
pub id: FileIdentifier,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
pub struct GetFilesTagsRequest {
|
|
pub cds: Vec<String>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
pub struct FindFilesRequest {
|
|
pub filters: Vec<FilterExpression>,
|
|
pub sort_expression: Vec<SortKey>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
pub enum FilterExpression {
|
|
OrExpression(Vec<TagQuery>),
|
|
Query(TagQuery),
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
pub struct TagQuery {
|
|
pub negate: bool,
|
|
pub tag: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
pub enum SortKey {
|
|
Namespace(SortNamespace),
|
|
FileName(SortDirection),
|
|
FileSize(SortDirection),
|
|
FileImportedTime(SortDirection),
|
|
FileCreatedTime(SortDirection),
|
|
FileChangeTime(SortDirection),
|
|
FileType(SortDirection),
|
|
NumTags(SortDirection),
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
pub struct SortNamespace {
|
|
pub name: String,
|
|
pub direction: SortDirection,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, Ord, PartialOrd, PartialEq)]
|
|
pub enum SortDirection {
|
|
Ascending,
|
|
Descending,
|
|
}
|
|
|
|
impl Eq for SortDirection {}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
pub struct FileBasicDataResponse {
|
|
pub id: i64,
|
|
pub status: FileStatus,
|
|
pub cd: String,
|
|
pub mime_type: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
pub enum FileStatus {
|
|
Imported,
|
|
Archived,
|
|
Deleted,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
pub struct FileMetadataResponse {
|
|
pub file_id: i64,
|
|
pub name: Option<String>,
|
|
pub comment: Option<String>,
|
|
pub creation_time: NaiveDateTime,
|
|
pub change_time: NaiveDateTime,
|
|
pub import_time: NaiveDateTime,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
pub struct FileOSMetadata {
|
|
pub path: String,
|
|
pub name: String,
|
|
pub mime_type: Option<String>,
|
|
pub creation_time: NaiveDateTime,
|
|
pub change_time: NaiveDateTime,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ThumbnailMetadataResponse {
|
|
pub file_hash: String,
|
|
pub height: u32,
|
|
pub width: u32,
|
|
pub mime_type: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
pub struct UpdateFileNameRequest {
|
|
pub file_id: FileIdentifier,
|
|
pub name: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
pub struct AddFileRequestHeader {
|
|
pub metadata: FileOSMetadata,
|
|
pub tags: Vec<String>,
|
|
}
|