1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
use crate::api_core::common::{FileSelection, FileServiceSelection};
use crate::api_core::endpoints::Endpoint;
use serde::Serialize;
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;
#[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,
}
pub struct AddFile;
impl Endpoint for AddFile {
type Request = AddFileRequest;
type Response = AddFileResponse;
fn path() -> String {
String::from("add_files/add_file")
}
}
#[derive(Clone, Debug, Serialize)]
pub struct DeleteFilesRequest {
#[serde(flatten)]
pub file_selection: FileSelection,
#[serde(flatten)]
pub service_selection: FileServiceSelection,
pub reason: Option<String>,
}
pub struct DeleteFiles;
impl Endpoint for DeleteFiles {
type Request = DeleteFilesRequest;
type Response = ();
fn path() -> String {
String::from("add_files/delete_files")
}
}
#[derive(Clone, Debug, Serialize)]
pub struct UndeleteFilesRequest {
#[serde(flatten)]
pub file_selection: FileSelection,
#[serde(flatten)]
pub service_selection: FileServiceSelection,
}
pub struct UndeleteFiles;
impl Endpoint for UndeleteFiles {
type Request = UndeleteFilesRequest;
type Response = ();
fn path() -> String {
String::from("add_files/undelete_files")
}
}
#[derive(Clone, Debug, Serialize)]
pub struct ArchiveFilesRequest {
#[serde(flatten)]
pub file_selection: FileSelection,
#[serde(flatten)]
pub service_selection: FileServiceSelection,
}
pub struct ArchiveFiles;
impl Endpoint for ArchiveFiles {
type Request = ArchiveFilesRequest;
type Response = ();
fn path() -> String {
String::from("add_files/archive_files")
}
}
#[derive(Clone, Debug, Serialize)]
pub struct UnarchiveFilesRequest {
#[serde(flatten)]
pub file_selection: FileSelection,
#[serde(flatten)]
pub service_selection: FileServiceSelection,
}
pub struct UnarchiveFiles;
impl Endpoint for UnarchiveFiles {
type Request = UnarchiveFilesRequest;
type Response = ();
fn path() -> String {
String::from("add_files/unarchive_files")
}
}