Skip to content

Commit

Permalink
User routes update (#537)
Browse files Browse the repository at this point in the history
* feat: Add UserProfile and other types

* api: re-do a large part of the users api

* feat: add modify user profile

* feat: delete and disable user endpoints

* feat: modify email and verify email endpoints

* feat!: add discriminator parameter to get_user_by_username

* feat!: add get_user_profile query string schema

* chore: add integration expire behavior

* feat: add get_pomelo_suggestions and get_pomelo_eligibility

* feat: add create_pomelo_migration

* fix: rustdoc lints

* feat: recent_mentions endpoints

Adds GET /users/@me/mentions and DELETE /users/@me/mentions/{message.id}

* feat: add get_user_harvest & create_user_harvest

Also adds /types/entities/harvest.rs, types for Harvest

* feat: user notes endpoints

Adds: get_user_notes, get_user_note, set_user_note

* feat: add #545 and #546

Adds the RECENT_MENTION_DELETE and USER_NOTE_UPDATE gateway events.

The events can be accessed at:
message.recent_mention_delete
&
user.note_update

* feat: add authorize_connection

Also adds: src/types/entities/connection.rs, Connection and PublicConnection,
src/api/users/connections.rs

* feat: add rest* of Connections api

* The only thing not added yet is create_domain_connection, because it uses errors in a funky way

adds:
- create_connection_callback
- create_contact_sync_connection
- get_connections
- refresh_connection
- modify_connection
- delete_connection
- get_connection_access_token
- get_connection_subreddits

+ related schema for all those routes, and some supporting types

* feat: add connected_accounts to UserProfile

* feat: add affinities

* feat: add get_premium_usage endpoint

note: not fully tested; I do not have an account with premium

* cliipy my arch nemesis strikes again

* aa

* feat: add create_domain_connection

* feat: add get_burst_credits

* grumble grumble

* clippy

* fix READY deserialization error on spacebar

* fix a deserialization error on Spacebar

See spacebarchat/server#1188

A deserialization error was happening with get_user_profile, where pronouns should have been serialized as an empty string, but were instead serialized as null.

* skip serializing None query parameters

* add test for get_user_profile

* apparently Sb does not implement users/@me/notes

* add some tests, minor connection updates

- Document that create_domain_connection is unimplemented on Spacebar

- Add Discord connection type

- Change ConnectionType::array() into ConnectionType::vector() - returning a fixed size array is dubious, since it'll likely be expanded. Returning a vector is easier keep up to variable length

- Add ConnectionType::discord_vector() and ConnectionType::spacebar_vector() to return a vector ConnectionTypes available on the respective server backends

- add tests test_modify_user_profile, test_disable_user, test_get_user_note, test_set_user_note, test_get_user_affinities, test_get_guild_affinities, test_get_connections

Note: connections are hard to test, since they require secrets / an external service's account

* minor pre merge changes

- add some extra doc comments

- and into_public() for connection

- remove a todo that is no longer valid
  • Loading branch information
kozabrada123 authored and bitfl0wer committed Oct 10, 2024
1 parent 239f994 commit 0eea35a
Show file tree
Hide file tree
Showing 19 changed files with 2,846 additions and 51 deletions.
2 changes: 1 addition & 1 deletion src/api/auth/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl Instance {
>>>>>>> 03f1e7d (Refactor / fix login and register (#495))
user.settings = login_result.settings;

let object = User::get(&mut user, None).await?;
let object = User::get_current(&mut user).await?;
*user.object.write().unwrap() = object;

let mut identify = GatewayIdentifyPayload::common();
Expand Down
2 changes: 1 addition & 1 deletion src/api/auth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl Instance {
ChorusUser::shell(Arc::new(RwLock::new(self.clone())), token).await;
>>>>>>> 03f1e7d (Refactor / fix login and register (#495))

let object = User::get(&mut user, None).await?;
let object = User::get_current(&mut user).await?;
let settings = User::get_settings(&mut user).await?;

*user.object.write().unwrap() = object;
Expand Down
Loading

0 comments on commit 0eea35a

Please sign in to comment.