summaryrefslogtreecommitdiffstats
path: root/server/src/api/mod.rs
diff options
context:
space:
mode:
authorFelix <me@nutomic.com>2020-01-16 15:39:08 +0100
committerFelix <me@nutomic.com>2020-01-18 14:26:04 +0100
commitf1035dacc2191385fe1e8695ab5a29e529aca380 (patch)
tree174882c74108b3a83584a0b1fd8b7c4f9c55c289 /server/src/api/mod.rs
parent19afdf993e55e42ae5f86882fe04ac108f71a6d6 (diff)
working!
Diffstat (limited to 'server/src/api/mod.rs')
-rw-r--r--server/src/api/mod.rs54
1 files changed, 4 insertions, 50 deletions
diff --git a/server/src/api/mod.rs b/server/src/api/mod.rs
index e3580447..bee7b8fe 100644
--- a/server/src/api/mod.rs
+++ b/server/src/api/mod.rs
@@ -26,73 +26,27 @@ pub mod post;
pub mod site;
pub mod user;
-#[derive(EnumString, ToString, Debug)]
-pub enum UserOperation {
- Login,
- Register,
- CreateCommunity,
- CreatePost,
- ListCommunities,
- ListCategories,
- GetPost,
- GetCommunity,
- CreateComment,
- EditComment,
- SaveComment,
- CreateCommentLike,
- GetPosts,
- CreatePostLike,
- EditPost,
- SavePost,
- EditCommunity,
- FollowCommunity,
- GetFollowedCommunities,
- GetUserDetails,
- GetReplies,
- GetUserMentions,
- EditUserMention,
- GetModlog,
- BanFromCommunity,
- AddModToCommunity,
- CreateSite,
- EditSite,
- GetSite,
- AddAdmin,
- BanUser,
- Search,
- MarkAllAsRead,
- SaveUserSettings,
- TransferCommunity,
- TransferSite,
- DeleteAccount,
- PasswordReset,
- PasswordChange,
-}
-
#[derive(Fail, Debug)]
-#[fail(display = "{{\"op\":\"{}\", \"error\":\"{}\"}}", op, message)]
+#[fail(display = "{{\"error\":\"{}\"}}", message)]
pub struct APIError {
- pub op: String,
pub message: String,
}
impl APIError {
- pub fn err(op: &UserOperation, msg: &str) -> Self {
+ pub fn err(msg: &str) -> Self {
APIError {
- op: op.to_string(),
message: msg.to_string(),
}
}
}
pub struct Oper<T> {
- op: UserOperation,
data: T,
}
impl<T> Oper<T> {
- pub fn new(op: UserOperation, data: T) -> Oper<T> {
- Oper { op, data }
+ pub fn new(data: T) -> Oper<T> {
+ Oper { data }
}
}