From: Felix Date: Sat, 18 Jan 2020 13:22:25 +0000 (+0100) Subject: rewrite api endpoint urls X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/%24%7B%60data:application/%22https:/hacktivis.me/sneer-club-logo.svg?a=commitdiff_plain;h=cde4a8a977b202fbc0ca10c802fc31fe41c9388b;p=lemmy.git rewrite api endpoint urls --- diff --git a/server/src/routes/api.rs b/server/src/routes/api.rs index 41d92dfd..6ba62766 100644 --- a/server/src/routes/api.rs +++ b/server/src/routes/api.rs @@ -15,45 +15,53 @@ type DbParam = web::Data>>; #[rustfmt::skip] pub fn config(cfg: &mut web::ServiceConfig) { cfg - .route("/api/v1/login", web::post().to(route::)) - .route("/api/v1/register", web::post().to(route::)) - .route("/api/v1/create_community", web::post().to(route::)) - .route("/api/v1/create_post", web::post().to(route::)) - .route("/api/v1/list_communities", web::get().to(route::)) - .route("/api/v1/list_categories", web::get().to(route::)) - .route("/api/v1/get_post", web::get().to(route::)) - .route("/api/v1/get_community", web::get().to(route::)) - .route("/api/v1/create_comment", web::post().to(route::)) - .route("/api/v1/edit_comment", web::post().to(route::)) - .route("/api/v1/save_comment", web::post().to(route::)) - .route("/api/v1/create_comment_like", web::post().to(route::)) - .route("/api/v1/get_posts", web::get().to(route::)) - .route("/api/v1/create_post_like", web::post().to(route::)) - .route("/api/v1/edit_post", web::post().to(route::)) - .route("/api/v1/save_post", web::post().to(route::)) - .route("/api/v1/edit_community", web::post().to(route::)) - .route("/api/v1/follow_community", web::post().to(route::)) - .route("/api/v1/get_followed_communities", web::get().to(route::)) - .route("/api/v1/get_user_details", web::get().to(route::)) - .route("/api/v1/get_replies", web::get().to(route::)) - .route("/api/v1/get_user_mentions", web::get().to(route::)) - .route("/api/v1/edit_user_mention", web::post().to(route::)) - .route("/api/v1/get_modlog", web::get().to(route::)) - .route("/api/v1/ban_from_community", web::post().to(route::)) - .route("/api/v1/add_mod_to_community", web::post().to(route::)) - .route("/api/v1/create_site", web::post().to(route::)) - .route("/api/v1/edit_site", web::post().to(route::)) - .route("/api/v1/get_site", web::get().to(route::)) - .route("/api/v1/add_admin", web::post().to(route::)) - .route("/api/v1/ban_user", web::post().to(route::)) + // Site + .route("/api/v1/site", web::get().to(route::)) + .route("/api/v1/categories", web::get().to(route::)) + .route("/api/v1/modlog", web::get().to(route::)) .route("/api/v1/search", web::post().to(route::)) - .route("/api/v1/mark_all_as_read", web::post().to(route::)) - .route("/api/v1/save_user_settings", web::post().to(route::)) - .route("/api/v1/transfer_community", web::post().to(route::)) - .route("/api/v1/transfer_site", web::post().to(route::)) - .route("/api/v1/delete_account", web::post().to(route::)) - .route("/api/v1/password_reset", web::post().to(route::)) - .route("/api/v1/password_change", web::post().to(route::)); + // Community + .route("/api/v1/community", web::post().to(route::)) + .route("/api/v1/community", web::get().to(route::)) + .route("/api/v1/community", web::put().to(route::)) + .route("/api/v1/community/list", web::get().to(route::)) + .route("/api/v1/community/follow", web::post().to(route::)) + // Post + .route("/api/v1/post", web::post().to(route::)) + .route("/api/v1/post", web::put().to(route::)) + .route("/api/v1/post", web::get().to(route::)) + .route("/api/v1/post/list", web::get().to(route::)) + .route("/api/v1/post/like", web::post().to(route::)) + .route("/api/v1/post/save", web::post().to(route::)) + .route("/api/v1/post/replies", web::get().to(route::)) + // Comment + .route("/api/v1/comment", web::post().to(route::)) + .route("/api/v1/comment", web::put().to(route::)) + .route("/api/v1/comment/like", web::post().to(route::)) + .route("/api/v1/comment/save", web::post().to(route::)) + // User + .route("/api/v1/user", web::get().to(route::)) + .route("/api/v1/user/mentions", web::get().to(route::)) + .route("/api/v1/user/mentions", web::put().to(route::)) + .route("/api/v1/user/followed-communities", web::get().to(route::)) + // Mod actions + .route("/api/v1/community/transfer", web::post().to(route::)) + .route("/api/v1/community/ban-user", web::post().to(route::)) + .route("/api/v1/community/mod", web::post().to(route::)) + // Admin actions + .route("/api/v1/site", web::post().to(route::)) + .route("/api/v1/site", web::put().to(route::)) + .route("/api/v1/site/transfer", web::post().to(route::)) + .route("/api/v1/admin/add", web::post().to(route::)) + .route("/api/v1/user/ban", web::post().to(route::)) + // User account actions + .route("/api/v1/user/login", web::post().to(route::)) + .route("/api/v1/user/register", web::post().to(route::)) + .route("/api/v1/user/delete_account", web::post().to(route::)) + .route("/api/v1/user/password_reset", web::post().to(route::)) + .route("/api/v1/user/password_change", web::post().to(route::)) + .route("/api/v1/user/mark_all_as_read", web::post().to(route::)) + .route("/api/v1/user/save_user_settings", web::post().to(route::)); } fn perform(data: Request, db: DbParam) -> Result