diff --git a/src/routes/mod.rs b/src/routes/mod.rs index 3ad8b1bf..3640104e 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -6,5 +6,5 @@ mod user; pub fn mount(rocket: Rocket) -> Rocket { rocket .mount("/api/account", routes![ account::create, account::verify_email, account::resend_email, account::login ]) - .mount("/api/users", routes![ user::me, user::lookup ]) + .mount("/api/users", routes![ user::me, user::dms, user::lookup ]) } diff --git a/src/routes/user.rs b/src/routes/user.rs index a265b0b7..8f74db42 100644 --- a/src/routes/user.rs +++ b/src/routes/user.rs @@ -6,6 +6,7 @@ use serde::{ Serialize, Deserialize }; use mongodb::options::FindOptions; use bson::{ bson, doc }; +/// retrieve your user information #[get("/@me")] pub fn me(user: User) -> JsonValue { let User ( id, username, doc ) = user; @@ -20,11 +21,19 @@ pub fn me(user: User) -> JsonValue { }) } +/// retrieve another user's information +#[get("/")] +pub fn user(user: User, id: String) -> JsonValue { + json!([]) +} + #[derive(Serialize, Deserialize)] pub struct Query { username: String, } +/// lookup a user on Revolt +/// currently only supports exact username searches #[post("/lookup", data = "")] pub fn lookup(_user: User, query: Json) -> JsonValue { let col = database::get_db().collection("users"); @@ -47,3 +56,39 @@ pub fn lookup(_user: User, query: Json) -> JsonValue { json!(results) } + +/// retrieve all of your DMs +#[get("/@me/dms")] +pub fn dms(user: User) -> JsonValue { + json!([]) +} + +/// open a DM with a user +#[get("//dm")] +pub fn dm(user: User, id: String) -> JsonValue { + json!([]) +} + +/// retrieve all of your friends +#[get("/@me/friend")] +pub fn get_friends(user: User) -> JsonValue { + json!([]) +} + +/// retrieve friend status with user +#[get("//friend")] +pub fn get_friend(user: User, id: String) -> JsonValue { + json!([]) +} + +/// create or accept a friend request +#[put("//friend")] +pub fn add_friend(user: User, id: String) -> JsonValue { + json!([]) +} + +/// remove a friend or deny a request +#[delete("//friend")] +pub fn remove_friend(user: User, id: String) -> JsonValue { + json!([]) +}