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.
81 lines
1.7 KiB
Rust
81 lines
1.7 KiB
Rust
3 years ago
|
use crate::api_core::common::BasicHashList;
|
||
|
use crate::api_core::Endpoint;
|
||
3 years ago
|
|
||
3 years ago
|
pub static STATUS_IMPORT_SUCCESS: u8 = 1;
|
||
|
pub static STATUS_IMPORT_ALREADY_EXISTS: u8 = 2;
|
||
|
pub static STATUS_IMPORT_PREVIOUSLY_DELETED: u8 = 3;
|
||
|
pub static STATUS_IMPORT_FAILED: u8 = 4;
|
||
|
pub static STATUS_IMPORT_VETOED: u8 = 5;
|
||
|
|
||
3 years ago
|
#[derive(Debug, Clone, Serialize)]
|
||
|
pub struct AddFileRequest {
|
||
|
pub path: String,
|
||
|
}
|
||
|
|
||
|
#[derive(Debug, Clone, Deserialize)]
|
||
|
pub struct AddFileResponse {
|
||
|
pub status: u8,
|
||
|
pub hash: String,
|
||
|
pub note: String,
|
||
|
}
|
||
|
|
||
3 years ago
|
pub struct AddFile;
|
||
|
|
||
|
impl Endpoint for AddFile {
|
||
|
type Request = AddFileRequest;
|
||
|
type Response = AddFileResponse;
|
||
|
|
||
3 years ago
|
fn path() -> String {
|
||
3 years ago
|
String::from("add_files/add_file")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
pub type DeleteFilesRequest = BasicHashList;
|
||
|
|
||
3 years ago
|
pub struct DeleteFiles;
|
||
|
|
||
|
impl Endpoint for DeleteFiles {
|
||
|
type Request = DeleteFilesRequest;
|
||
|
type Response = ();
|
||
|
|
||
3 years ago
|
fn path() -> String {
|
||
3 years ago
|
String::from("add_files/delete_files")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
pub type UndeleteFilesRequest = BasicHashList;
|
||
3 years ago
|
pub struct UndeleteFiles;
|
||
|
|
||
|
impl Endpoint for UndeleteFiles {
|
||
|
type Request = UndeleteFilesRequest;
|
||
|
type Response = ();
|
||
3 years ago
|
|
||
3 years ago
|
fn path() -> String {
|
||
3 years ago
|
String::from("add_files/undelete_files")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
pub type ArchiveFilesRequest = BasicHashList;
|
||
3 years ago
|
pub struct ArchiveFiles;
|
||
|
|
||
|
impl Endpoint for ArchiveFiles {
|
||
|
type Request = ArchiveFilesRequest;
|
||
|
type Response = ();
|
||
3 years ago
|
|
||
3 years ago
|
fn path() -> String {
|
||
3 years ago
|
String::from("add_files/archive_files")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
pub type UnarchiveFilesRequest = BasicHashList;
|
||
3 years ago
|
pub struct UnarchiveFiles;
|
||
|
|
||
|
impl Endpoint for UnarchiveFiles {
|
||
|
type Request = UndeleteFilesRequest;
|
||
|
type Response = ();
|
||
3 years ago
|
|
||
3 years ago
|
fn path() -> String {
|
||
3 years ago
|
String::from("add_files/unarchive_files")
|
||
|
}
|
||
|
}
|