Commit Graph

939 Commits

Author SHA1 Message Date
bitfl0wer 6e136fba83 Make ChorusError Clone 2023-09-01 01:17:23 +02:00
bitfl0wer 42f2f7bfbe Add Default to LoginSchema 2023-09-01 00:50:19 +02:00
bitfl0wer 9b0567ac9e Remove borrow 2023-09-01 00:50:07 +02:00
bitfl0wer fe8baeb699 Make UrlBundle `Hash` 2023-08-30 19:13:46 +02:00
kozabrada123 0dfd622661 Fix failing build w/o client and move ratelimits (#426)
* Fix failing build without client feature

* Feature lock Updateable and Composite
2023-08-30 15:26:19 +02:00
kozabrada123 141dc32819 Error observer (also merge perpetual/gateway-dev) (#425)
* Add Webrtc Identify & Ready

* Test error observer

* Minor updates

* More derives

* Even more derives

* Small types update

* e
2023-08-29 16:38:26 +00:00
kozabrada123 3d8d6b6f3b Make GatewayHandle Clone 2023-08-29 14:24:32 +02:00
bitfl0wer 00faab4801 Change gateway to Arc::new(gateway) 2023-08-29 00:05:36 +02:00
bitfl0wer 17fe4f004f Make ChorusUser `Clone` 2023-08-29 00:05:16 +02:00
bitfl0wer 4bbb22eb31 Replace `belongs_to: Rc<RefCell<Instance>>` with `Arc<RwLock<Instance>>` to make `ChorusUser` `Send` 2023-08-28 18:12:17 +02:00
bitfl0wer a8bea5d881 Clippy rules, docs logo 2023-08-28 12:27:38 +02:00
bitfl0wer 02212f95e3 Add Debug derives to all structs 2023-08-28 12:27:21 +02:00
bitfl0wer 2f9936cfd2 Add rustdoc comments 2023-08-26 19:41:00 +02:00
bitfl0wer ea66edc68d Fix guild ban test failing 2023-08-26 17:45:27 +02:00
bitfl0wer aee50036a0 Add delete_role + test 2023-08-26 16:54:24 +02:00
bitfl0wer 116f1312e7 Disambiguate function name 2023-08-26 16:22:18 +02:00
bitfl0wer f120bcd386 Update GuildBan object 2023-08-26 16:21:47 +02:00
bitfl0wer 1709e85a4b Add delete_guild_ban 2023-08-25 17:28:02 +02:00
bitfl0wer 07ebaf6119 Add Get Guild Ban/s, add audit_log_reason to create_ban 2023-08-25 17:26:01 +02:00
bitfl0wer cd70a5b388 Add modify guild member profile route 2023-08-25 17:11:00 +02:00
bitfl0wer cce5b507bc Add modify_current_member route 2023-08-25 16:54:41 +02:00
bitfl0wer 7b55590fd0 Add modify_member route 2023-08-25 16:47:28 +02:00
bitfl0wer 516a1467fa Add some more routes 2023-08-25 01:35:57 +02:00
bitfl0wer 0d93ad8578 Remove unneeded function 2023-08-25 01:35:49 +02:00
bitfl0wer 2b69aba2ca Merge branch 'main' into guild-routes 2023-08-25 01:11:28 +02:00
bitfl0wer d73c1963fc Start refactoring ChorusRequest to ChorusRequest::new() 2023-08-25 00:02:26 +02:00
bitfl0wer e9318ea4dc start adding auditlogreason to routes that take it 2023-08-24 22:30:13 +02:00
bitfl0wer 87d325e38f Create ChorusRequest-builder function 2023-08-24 22:29:26 +02:00
bitfl0wer eb163d278a Change UserMeta to ChorusUser 2023-08-24 21:46:02 +02:00
bitfl0wer facb91fc20 Merge branch 'main' into guild-routes 2023-08-24 21:41:22 +02:00
bitfl0wer 64ba6a657a Change `UserMeta` to `ChorusUser` 2023-08-24 21:09:23 +02:00
bitfl0wer fb7e33c0ec Change `UserMeta` to `ChorusUser` 2023-08-24 21:06:28 +02:00
bitfl0wer 5ed2f0f2c3 add get guild preview route 2023-08-24 21:05:39 +02:00
bitfl0wer 9db9d2a512 Add get user guilds endpoint 2023-08-23 00:08:43 +02:00
bitfl0wer 0c62bf9836 Fix clippy lint 2023-08-22 22:40:36 +02:00
bitfl0wer 9e3bf947c1 Add acknowledge_pinned endpoint 2023-08-22 22:34:37 +02:00
bitfl0wer a23363e0a3 add delete and bulk_delete endpoints 2023-08-22 22:32:48 +02:00
bitfl0wer a8f37ea201 Add Modify Message endpoint 2023-08-22 22:27:09 +02:00
bitfl0wer f85cde71b4 Add Hide from guild feed endpoint 2023-08-22 22:16:07 +02:00
bitfl0wer 852d784bd5 Add crosspost endpoint 2023-08-22 22:10:12 +02:00
bitfl0wer 54c5cc6cc2 Add message acknowledge endpoint 2023-08-22 22:06:19 +02:00
bitfl0wer d751c92778 Create Greet Message 2023-08-22 21:55:24 +02:00
bitfl0wer fd3a3ee836 Add message: get 2023-08-22 21:27:31 +02:00
bitfl0wer 7b5426519d Closes #269, #268, #270 2023-08-22 20:09:44 +02:00
bitfl0wer 36a0730d0b Correctify search_message
Fixes Search Messages #258
2023-08-22 19:23:27 +02:00
bitfl0wer 6e40568b23 Move search_messages to Channel impl 2023-08-22 17:56:13 +02:00
bitfl0wer d913b2d97f Implement Default for MessageSearchQuery 2023-08-22 17:55:53 +02:00
bitfl0wer 9ac5925bf9 Make channel_type in ChannelCreateSchema of type enum "ChannelType" 2023-08-22 17:55:29 +02:00
bitfl0wer 500ab0e3d0 Add some missing derives 2023-08-22 14:01:17 +02:00
bitfl0wer 1984f8c5da Add MessageSearchEndpoint Enum and MessageSearchQuery schema struct 2023-08-22 14:01:03 +02:00
bitfl0wer a13f766758 Add search() and search_messages() 2023-08-22 14:00:39 +02:00
bitfl0wer cfbcb29a95 Modify Guild Channel Positions
Fixes #229
2023-08-22 01:11:22 +02:00
bitfl0wer 5f532eff01 Fix deserialize error 2023-08-20 23:24:30 +02:00
bitfl0wer 7eee08459b Add Guild::modify(); 2023-08-20 23:13:34 +02:00
bitfl0wer 24891b3fd5 Complete GuildModifySchema 2023-08-20 22:52:06 +02:00
bitfl0wer 09a83f1a1f Add GuildModifySchema 2023-08-20 22:46:58 +02:00
bitfl0wer dd04b760a4 Add Types 2023-08-20 22:46:44 +02:00
bitfl0wer cb216c462d Add create_ban
Closes "Create Guild Ban #299"
2023-08-20 18:49:10 +02:00
bitfl0wer b53afe855d Create GuildBanCreateSchema, clean up GuildCreateSchema 2023-08-20 18:48:07 +02:00
bitfl0wer 6cb28dda92 Start implementing some UpdateMessages 2023-08-19 01:13:07 +02:00
bitfl0wer 0b840372e2 Handle id().is_none() cases 2023-08-18 23:40:01 +02:00
bitfl0wer d64004b308 Make id(&self) return Option<Snowflake> 2023-08-18 23:34:00 +02:00
bitfl0wer 82d2151f1b Fix typo 2023-08-18 21:29:34 +02:00
bitfl0wer e1615a4cd3 Remove prints 2023-08-18 20:20:58 +02:00
bitfl0wer 5f0a04c345 Add Arc<RwLock<T>> 2023-08-18 20:20:53 +02:00
bitfl0wer cafa84d41e Add Todo to every event which needs UpdateMessage 2023-08-18 20:20:25 +02:00
kozabrada123 ad58b550fb Minor gateway updates (#188)
* Fix TYPING_START not existing

* Fix spacebar READY deserialization error
2023-08-18 14:27:39 +02:00
kozabrada123 905b7af618 Add content type specification 2023-08-18 11:41:06 +02:00
bitfl0wer c2c1ad93b6 Change type of Channel::last_pin_timestamp 2023-08-17 22:45:42 +02:00
bitfl0wer 0396e318d3 Change bearer_auth to header("Authorization" 2023-08-17 22:26:07 +02:00
bitfl0wer 4424e3f07a Remove comment 2023-08-17 18:26:34 +02:00
bitfl0wer d69a459025 Remove prints 2023-08-17 18:26:14 +02:00
bitfl0wer 711580f270 Call watch_whole either way 2023-08-17 18:26:06 +02:00
bitfl0wer 4210bd6d73 Remove debug prints 2023-08-16 22:04:43 +02:00
bitfl0wer a1df997c9f I think i found out why shit no work 2023-08-16 22:04:36 +02:00
bitfl0wer 29b9050e6d Make store pub(crate), other adjustments 2023-08-16 22:04:07 +02:00
bitfl0wer 887ba4a1b1 Make trait Debug 2023-08-16 21:26:27 +02:00
bitfl0wer fbf72b74d0 Remove tokio watch channels 2023-08-16 21:26:19 +02:00
bitfl0wer 116c829f28 Rename update to modify 2023-08-16 14:05:51 +02:00
bitfl0wer 9ce75482d1 Make Role Clone 2023-08-16 14:05:44 +02:00
bitfl0wer 2af8388947 Add GuildRoleCreate and -Update 2023-08-16 14:05:37 +02:00
bitfl0wer 5f0f19e8ce Rename functions, add observe_and_into_inner 2023-08-16 01:11:26 +02:00
bitfl0wer a9381fec1e Revert "Give `GatewayHandle` and `Gateway` common trait to call `watch_whole()` or observe() from a `Gateway`"
This reverts commit d36b1de170.
2023-08-16 00:21:18 +02:00
bitfl0wer d36b1de170 Give `GatewayHandle` and `Gateway` common trait to call `watch_whole()` or observe() from a `Gateway` 2023-08-16 00:18:32 +02:00
bitfl0wer 2b21933cb3 Add back set_json. No idea when it disappeared? 2023-08-15 22:19:47 +02:00
bitfl0wer b1594cf1e1 Merge branch 'feature/update-message-all-events' into enhancement/improved-auto-updating-structs 2023-08-15 20:53:56 +02:00
bitfl0wer ff77e5a61d Add `Composite` derive to all entities which require it 2023-08-15 20:19:52 +02:00
bitfl0wer bdeaa476e2 Add `Composite<T>` bound to automatically call `watch_whole()` on caller object. 2023-08-15 20:19:16 +02:00
bitfl0wer 32fd918a43 Remove `Send` bound 2023-08-15 20:18:11 +02:00
bitfl0wer 7de3204f59 Make trait pub 2023-08-15 17:54:36 +02:00
bitfl0wer 20baada605 Add Composite to some types 2023-08-15 17:38:53 +02:00
bitfl0wer 509ab578d6 Implement trait methods 2023-08-15 16:58:20 +02:00
bitfl0wer 37d976cd0d Try out new macro 2023-08-15 16:58:06 +02:00
bitfl0wer d66807ed20 Add observe_and_get method 2023-08-15 16:57:54 +02:00
bitfl0wer b2a1122f4a todo 2023-08-15 12:14:03 +02:00
bitfl0wer f49fefb400 derive Updateable for Guild 2023-08-14 17:18:53 +02:00
bitfl0wer 2329cc2243 Add Composite trait 2023-08-14 17:18:44 +02:00
bitfl0wer 6dd9f84573 Remove unused import 2023-08-14 00:04:58 +02:00
bitfl0wer 02be1e786d Remove stupid comment from me 2023-08-14 00:04:53 +02:00
bitfl0wer 45d68b4da4 Rename get to get_user 2023-08-14 00:02:30 +02:00
bitfl0wer 614c7bb2b2 Change UserMeta::get() to take self instead of Self 2023-08-14 00:02:03 +02:00
bitfl0wer 0f00d5d283 Change UpdateMessage<T> to write into RwLock 2023-08-13 16:46:57 +02:00
bitfl0wer 33357db291 Change observe() again, pass Arc<RwLock<T>> into message.update(), Add comment explaining closure 2023-08-13 16:46:21 +02:00
bitfl0wer f9c3f55d95 Remove channel_id argument from modify. WHY WAS IT THERE TO BEGIN WITH LOL 2023-08-13 15:54:25 +02:00
bitfl0wer 73cc139e78 Moddify observe to still store T internally 2023-08-13 15:52:16 +02:00
fowb 63a4141bde Add fixme comment 2023-08-12 22:40:07 +02:00
fowb a0c9f6fb14 Change observe() to take Arc<RwLock<T>> 2023-08-12 19:47:11 +02:00
fowb ff47965e99 Change Mutex<T> to RwLock<T> 2023-08-12 19:31:31 +02:00
kozabrada123 e0d7df417c Fix trailing /s (#180) 2023-08-12 16:48:33 +02:00
kozabrada123 1801d22273 Minor snowflake updates (#179)
* Make snowflake fully public

* Simple into for snowflake
2023-08-07 20:34:58 +02:00
bitfl0wer 07818b2cd6 Fix unwrap panic on trying to access rate limits 2023-08-07 14:56:10 +02:00
kozabrada123 1cc29540d0 Minor improvements to message events (#177) 2023-08-07 14:15:23 +02:00
bitfl0wer dad419c1de update mutex to rwlock 2023-08-04 20:08:49 +02:00
bitfl0wer a2561fd2e0 Change Arc<Mutex<T>> components to Arc<RwLock<T>> 2023-08-04 17:57:03 +02:00
bitfl0wer 55a2335664 Add note about Gateway: store 2023-08-04 16:54:56 +02:00
bitfl0wer c8abec7686 Add note about GatewayHandle: `store` 2023-08-04 16:54:03 +02:00
bitfl0wer 8f57150a79 Make message mut 2023-08-04 16:46:22 +02:00
bitfl0wer 7b05d391b0 Add clone bound to T 2023-08-04 16:46:15 +02:00
bitfl0wer cfb84f3da0 Fix channel.rs 2023-08-04 16:41:57 +02:00
bitfl0wer b9b5e5e463 Add update_object 2023-08-04 16:41:51 +02:00
kozabrada123 47246cabad Re-add derives to structs where possible 2023-08-04 15:33:46 +02:00
bitfl0wer fb792f8356 Integrate component behaviour everywhere 2023-08-04 11:19:23 +02:00
bitfl0wer 94eac6eba9 Make components be Arc<Mutex<T>> 2023-08-02 23:08:53 +02:00
bitfl0wer a36d691fea Add PartialEq, Eq, Hash to Enums 2023-08-02 20:23:50 +02:00
bitfl0wer 9f69f57635 Start component-izing entities, remove PartialEq wherever needed (because PartialEq isn't implemented for Mutex) 2023-08-02 20:18:16 +02:00
kozabrada123 c0bc2ee9e2 Fix missing references to the best of my ability 2023-07-31 10:28:18 +02:00
kozabrada123 261ae6eb4a Goof 2023-07-31 10:07:56 +02:00
kozabrada123 60393a5686 Docs 2023-07-31 10:01:25 +02:00
kozabrada123 7f65f9ca81 Merge branch 'main' into fix/doc-improvements 2023-07-31 09:13:33 +02:00
Flori 2249ae65d7 Remove newline 2023-07-30 20:35:02 +02:00
Vivien 92bc958cf1 update of reaction struct 2023-07-30 20:27:13 +02:00
Vivien 50538eb15d change signed to unsigned integer 2023-07-30 20:23:12 +02:00
kozabrada123 1ce9bf08cd Guilds + Channels 2023-07-30 09:04:31 +02:00
kozabrada123 ba25cab1e9 Fix broken links 2023-07-30 08:31:12 +02:00
kozabrada123 b72ebf36ed Documemtaiom 2023-07-30 08:26:26 +02:00
kozabrada123 d50e969a07 Document a small bit of attachment 2023-07-29 18:12:57 +02:00
kozabrada123 590afc8c9d Permissions with code blocks 2023-07-29 18:12:57 +02:00
kozabrada123 7637051733 Update src/types/utils/rights.rs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-29 16:07:06 +00:00
kozabrada123 0f300cfb20 Update src/types/utils/snowflake.rs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-29 16:06:49 +00:00
kozabrada123 e64233e6d8 Update src/types/utils/rights.rs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-29 16:06:35 +00:00
kozabrada123 84ada8b94a Update src/types/utils/rights.rs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-29 16:05:27 +00:00
kozabrada123 b172e5910d Update src/types/utils/rights.rs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-29 16:04:49 +00:00
kozabrada123 552032a61e Capitalise docs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-29 16:04:08 +00:00
kozabrada123 e6dc44754c Forgot this since had the lint on my local copy 2023-07-29 11:45:25 +02:00
kozabrada123 b632958b0f Document some flags 2023-07-29 11:26:10 +02:00
kozabrada123 ede965411e Minor doc changes 2023-07-29 11:26:00 +02:00
kozabrada123 1e81a2682f Document rights 2023-07-29 11:00:28 +02:00
kozabrada123 83d4ffc4e8 Moar docs 2023-07-29 10:23:04 +02:00
kozabrada123 8eb2e2008c Remove the todos from the last commit 2023-07-28 18:57:35 +02:00
kozabrada123 d0547cb1f0 Better docs 2023-07-28 18:45:40 +02:00
kozabrada123 dcfb59fca1 Merge branch 'main' into fix/doc-improvements 2023-07-28 18:21:20 +02:00
Flori 07f283a205 Improve auto updating structs usage (#168)
* Add `GatewayHandle` to `UserMeta`

* Make user::shell async due to gateway add
2023-07-24 19:13:53 +02:00
SpecificProtagonist 9ebe72a7dc derive Updateable (#167) 2023-07-22 11:20:31 +02:00
Flori ccf44a5375 Auto updating structs (#163)
* Gateway fields don't need to be pub

* Add store to Gateway

* Add UpdateMessage trait

* Proof of concept: impl UpdateMessage for Channel

* Start working on auto updating structs

* Send entity updates over watch channel

* Add id to UpdateMessage

* Create trait Updateable

* Add documentation

* add gateway test

* Complete test

* Impl UpdateMessage::update() for ChannelUpdate

* Impl UpdateMessage::update() for ChannelUpdate
Co-authored by: SpecificProtagonist <specificprotagonist@posteo.org>

* make channel::modify no longer mutate Channel

* change modify call

* remove unused imports

* Allow dead code with TODO to remove it

* fix channel::modify test

* Update src/gateway.rs

Co-authored-by: SpecificProtagonist <vincentjunge@posteo.net>

---------

Co-authored-by: SpecificProtagonist <vincentjunge@posteo.net>
2023-07-21 15:35:31 +02:00
kozabrada123 44d9655e8e Merge stuff 2023-07-21 14:10:50 +02:00
SpecificProtagonist 776efce4dc Fix gateway heartbeat blocking (#162)
fix gateway heartbeat blocking
2023-07-21 13:59:40 +02:00
Flori 85fb24cd8c Fix: message file attachment duplication (#159)
* make send() take ownership of MessageSendSchema

* Remove message file attachment duplication

* Remove superfluous docstrings
2023-07-17 23:26:25 +02:00
Flori 1fdbe6cc00 Join/Leave Guilds, (Group) DMs and minor improvements (#157)
## Summary:

**Added:**
- Schemas `PrivateChannelCreateSchema` `ChannelInviteCreateSchema`, `AddChannelRecipientSchema` recursively (including schemas which were needed to create these schemas)
- Methods `create_private_channel`, `leave_guild`, `accept_invite`, `create_user_invite`, `create_guild_invite`, `add_channel_recipient`, `remove_channel_recipient`
- Integration tests for the functionality covered by implementing #45
- Documentation in some places where I noticed it would be useful to have some
- `create_user` method in `/src/tests`: Cuts down on test boilerplate needed to create an addition test user

**Changed:**
- `.gitignore`
  - Added `.DS_store` files to gitignore (some weird macos files), removed Cargo.lock, as Cargo.lock should be included for libraries
- Added a lot of default trait derives like Clone, Copy, PartialEq, Eq, Ord, PartialOrd to structs and enums where I saw them missing
- Added missing `teardown()` calls to the integration tests
- Renamed integration test files in `/src/tests` dir to all be plural: `channel.rs` -> `channels.rs`
- Made more fields on `User` type `Option<>`
- All instances in `/src/tests` where a second test user was created using a RegistrationSchema and the register_user method were replaced with the new `create_user` method
- README.md: Marked roadmap fields covered by #45 as implemented
- Changed visibility of `/src/tests/common/mod.rs` methods from `pub` to `pub(crate)`. In hindsight, this was probably not required, haha

**Removed:**
- Unneeded import in`src/types/config/types/guild_configuration.rs`


## Commit log:

* Add .DS_store, remove Cargo.lock

* Create PrivateChannelCreateSchema

* pub use users

* add channels.rs

* create channels.rs

* Add Deserialize/Serialize derives

* Implement create_private_channel

* Add create_dm() test

* Make optional fields on `User` `Option<>`

* Check boxes for implemented features

* Create users/guilds.rs

* Remove unneeded import

* Add UserMeta::leave_guild()

* Create api/invites/mod.rs

* Add debug print to send_request

* Rename tests files

* Create invites.rs

* create invite.rs

* Add documentation

* Implement accept_invite

* Sort fields on Channel alphabetically

* Add invite mod

* Add forgotten teardown() at test end

* change visiblities, add create_user()

* Implement `create_user_invite()`

* start working on invite tests

* Add allow flags

* Fix bad url

* Create CreateChannelInviteSchema and friends

* remove non-implemented test code

* add body to requests

* Add Clone to UserMeta

* More comprehensive error message when running into a deserialization error

* Add arguments documentation to accept_invite

* Add Eq derive to GuildFeaturesList

* Add Eq derive to Emoji

* Add Eq derive to GuildBan

* Add create_accept_invite() test

* Add Default derive to ChannelCreateSchema

* Change create_guild_invite to return GuildInvite

* Dates as chrono::Date(Utc); sort alphabetically

* Add default derives wherever possible

* Implement add_- and remove_channel_recipient

* Create AddChannelRecipientSchema

* replace otheruser regs with bundle.creeate_user()

* Add (disabled) test remove_add_person_from_to_dm()
2023-07-17 19:36:28 +02:00
Flori 6f3bd04963 Enable saving and loading LimitsConfiguration (#152)
Impl Serialize, Deserialize for LimitsConfiguration and children
2023-07-14 17:38:54 +02:00
SpecificProtagonist db0b1131ed Deduplicate gateway dispatch event handling (#148)
deduplicate gateway dispatch event handling
2023-07-11 20:11:13 +02:00
kozabrada123 a0d2fc8213 Add some docs 2023-07-11 19:54:04 +02:00
kozabrada123 3b35f03993 Merge branch 'main' into fix/doc-improvements 2023-07-11 19:24:37 +02:00
Zert3x 0d6d705e46 Async Observer Trait (#147) 2023-07-11 19:20:27 +02:00
kozabrada123 18ac7b5708 Rustdoc warnings + misc changes 2023-07-10 18:06:45 +02:00
kozabrada123 322894e4e9 UrlBundle slightly better docs 2023-07-10 17:22:31 +02:00
kozabrada123 192f12d892 /* -> /// 2023-07-10 16:59:00 +02:00
Flori 69b7c2445c Ratelimiter overhaul (#144)
* Rename limits and limit to have better names

* Remove empty lines

* Remove handle_request (moved to requestlimiter)

* Start working on new ratelimiter

* Make limits Option, add "limited?" to constructor

* Add missing logic to send_request

* Rename Limits

* Create Ratelimits and Limit Struct

* Define Limit

* Import Ratelimits

* Define get_rate_limits

* Remove unused import

* + check_rate_limits & limits_config_to_ratelimits

* Remove Absolute Limits
These limits are not meant to be tracked anyways.

* add ratelimits is_exhausted

* Add error handling and send request checking

* change limits to option ratelimits

* Add strum

* Change Ratelimits to Hashmap

* Remove ratelimits in favor of hashmap

* Change code from struct to hashmap

* start working on update rate limits

* Remove wrong import

* Rename ChorusLibError to ChorusError

* Documented the chorus errors

* Made error documentation docstring

* Make ReceivedErrorCodeError have error string

* Remove unneeded import

* Match changes in errors.rs

* Improve update_rate_limits and can_send_request

* add ratelimits.to_hash_map()

* use instances' client instead of new client

* add LimitsConfiguration to instance

* improve update_limits, change a method name

* Fix un-updated errors

* Get LimitConfiguration in a sane way

* Move common.rs into ratelimiter::ChorusRequest

* Delete common.rs

* Make instance.rs use overhauled errors

* Refactor to use new Rate limiting implementation

* Refactor to use new Rate limiting implementation

* Refactor to use new Rate limiting implementation

* Refactor to use new Rate limiting implementation

* Refactor to use new Rate limiting implementation

* Refactor to use new Rate limiting implementation

* update ratelimiter implementation across all files

* Fix remaining errors post-refactor

* Changed Enum case to be correct

* Use result

* Re-add missing body to request

* Remove unneeded late initalization

* Change visibility from pub to pub(crate)
I feel like these core methods don't need to be exposed as public API.

* Remove unnecessary import

* Fix clippy warnings

* Add docstring

* Change Error names across all files

* Update Cargo.toml

Strum is not needed

* Update ratelimits.rs

* Update ratelimits.rs

* Bug/discord instance info unavailable (#146)

* Change text to be more ambigous

* Use default Configuration instead of erroring out

* Emit warning log if instance config cant be gotten

* Remove import

* Update src/instance.rs

Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>

* Add missing closing bracket

* Put limits and limits_configuration as one struct

* Derive Hash

* remove import

* rename limits and limits_configuration

* Save clone call

* Change LimitsConfiguration to RateLimits
`LimitsConfiguration` is in no way related to whether the instance has API rate limits enabled or not. Therefore, it has been replaced with what it should have been all along.

* Add ensure_limit_in_map(), add `window` to `Limit`

* Remove unneeded var

* Remove import

* Clean up unneeded things
Dead code warnings have been supressed, but flagged as FIXME so they don't get forgotten. Anyone using tools like TODO Tree in VSCode can still see that they are there, however, they will not be shown as warnings anymore

* Remove nested submodule `limit`

* Add doc comments

* Add more doc comments

* Add some log messages to some methods

---------

Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-09 18:38:02 +02:00
kozabrada123 3f6d0e2d9d Use log instead of prints 2023-07-01 19:29:50 +02:00
Vincent Junge 94a051631f require password to log in 2023-06-25 22:34:05 +02:00
Vincent Junge 8b0f41fad3 remove client side validation 2023-06-25 11:36:37 +02:00
Flori Weber c25795ab4d Make ReactionMeta::get() return Vec<PublicUser> 2023-06-23 12:54:08 +02:00
Flori Weber 6c9df9508e Fix stupid multi line comments 2023-06-23 12:18:22 +02:00
Flori 8fdbd7d84f Merge pull request #130 from polyphony-chat/refactor/change-channel-modify
Refactor/change channel modify
2023-06-22 20:05:15 +02:00
Flori Weber c00cc215fe Remove wrongful match statement 2023-06-22 19:54:39 +02:00
Flori 6c0faa29f3 Update src/api/channels/channels.rs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-06-22 19:42:07 +02:00
Flori Weber 7fb37ff204 Make Channel::modify() take &mut self 2023-06-22 18:56:16 +02:00
Vincent Junge d52acd9093 always use Snowflakes in args 2023-06-22 18:55:19 +02:00
Vincent Junge f98180cd03 ChorusResult type alias 2023-06-21 21:39:22 +02:00
Vincent Junge 709ef11f2c get channel messages 2023-06-21 14:46:45 +02:00
Flori Weber 62f6bfa363 Change send_request() calls to pass &mut Instance 2023-06-20 22:42:42 +02:00
Flori Weber 6650bcf1df Use Instance.client instead of creating a new one. 2023-06-20 22:42:08 +02:00
Flori Weber 6542a7a362 Add reqwest::Client to chorus::Instance. 2023-06-20 22:41:31 +02:00
Flori Weber 6eb3cf65d1 Change to single-line docstring 2023-06-20 22:36:39 +02:00
Flori Weber 20f39a409d Multiline docstring to single line docstring 2023-06-20 22:30:42 +02:00
Flori Weber 0f085491a0 Merge branch 'main' into refactor/reuse-reqwest-client 2023-06-20 22:21:08 +02:00
Flori Weber c08ec54f92 Change docstring from multi- to singleline 2023-06-20 22:20:06 +02:00
Flori a9dbde4122 Merge pull request #122 from SpecificProtagonist/winter
More consistent use of snowflakes
2023-06-20 22:16:54 +02:00
Vincent Junge 55b0f268e2 more consistent use of snowflakes 2023-06-20 22:03:29 +02:00
Flori 2c6becb361 Merge pull request #121 from polyphony-chat/fix/cannot-connect-to-discord
Remove unnecessary things
2023-06-20 21:54:53 +02:00
Flori 03df0ae9cf Merge pull request #114 from SpecificProtagonist/snowflake
Simplify Snowflake
2023-06-20 18:57:25 +02:00
Flori 225b6e4798 Merge pull request #117 from SpecificProtagonist/gateway-event
Simplify GatewayEvent
2023-06-20 18:57:13 +02:00
kozabrada123 cd98de286f Change Option<ChorusLibError> to Result<(), ChorusLibError> 2023-06-20 18:26:30 +02:00
Vincent Junge 1df01512d7 simplify GatewayEvent 2023-06-20 16:12:13 +02:00
Vincent Junge 9c7031abde UrlBundle remove getters 2023-06-20 12:29:52 +02:00
Vincent Junge f9619dde8d simplyfy Snowflake 2023-06-20 12:21:22 +02:00
Flori Weber a5afada13f Remove unnecessary things 2023-06-20 00:35:46 +02:00
Flori Weber ec3a531f48 apply clippy suggestions 2023-06-19 19:01:18 +02:00
Flori Weber 5dbb627322 change post to delete 2023-06-19 18:12:09 +02:00
Flori Weber 51e7cc003a Add Eq, PartialEq derives 2023-06-19 18:12:01 +02:00
Vincent Junge c06778fc71 Fix clippy::await_holding_refcell_ref false positives 2023-06-19 16:46:58 +02:00
Flori Weber cac12decad Fix build failing 2023-06-19 16:11:53 +02:00
Vincent Junge f0241e0756 Make MessageSendSchema fields public 2023-06-19 14:21:27 +02:00
Vincent Junge 208eeac536 Fix various Clippy lints 2023-06-19 12:35:07 +02:00
Flori Weber 1cb672faa6 Add remove_relationship 2023-06-18 23:10:29 +02:00
Flori Weber f658f3fe61 Remove unneccessary imports 2023-06-18 23:04:25 +02:00
Flori Weber 8c68e8bd77 Add modify_user_relationship 2023-06-18 23:02:49 +02:00
Flori Weber fa524b1791 Fix errors not displayed, add InvalidArgumentsErr 2023-06-18 23:01:38 +02:00
Flori Weber 3aa162cfc7 Move FriendRequestSchema to schemas 2023-06-18 19:05:09 +02:00
Flori Weber 3102ea8057 Create relationship schemes 2023-06-18 19:04:55 +02:00
Flori Weber 9b52ceab4b Change returns, add documentation 2023-06-18 15:39:52 +02:00
Flori Weber 94ae449f7d Start implementing get_relationship 2023-06-18 14:00:12 +02:00
Flori Weber 2e6e9ad59d Add FriendRequestSendSchema 2023-06-15 19:01:01 +02:00
Flori Weber c2d46196c8 Implement send_friend_request 2023-06-15 19:00:47 +02:00
Flori Weber 28881276e0 Add get_mutual_relationships 2023-06-14 22:54:14 +02:00
Flori Weber 7e4b4269b6 Change belongs_to to be borrowed non-mutably 2023-06-14 22:53:56 +02:00
Flori Weber e14a21f814 Format relationships.rs 2023-06-14 22:14:56 +02:00
Flori Weber 7202722eb1 Add relationships.rs 2023-06-14 22:14:48 +02:00
Flori Weber 57fc5ba860 Update link reference 2023-06-13 15:23:39 +02:00
Flori Weber cefc522e2f Update relationship.rs types 2023-06-13 15:23:06 +02:00
Flori Weber 2e84385007 Create relationships.rs 2023-06-13 14:04:58 +02:00
Flori Weber 616d8a1bf0 Create relationships.rs 2023-06-13 14:04:39 +02:00
bitfl0wer 7a3524a1ab run cargo fix 2023-06-12 18:59:06 +02:00
bitfl0wer 9bbe9fc470 run cargo fix 2023-06-12 18:58:53 +02:00
bitfl0wer c97fa7bc48 Remove unneccessary variable 2023-06-12 18:55:27 +02:00
bitfl0wer 44224cb478 Refactor limited requester
The requester does not need to be instantiated anymore, which makes things easier to read imo.
2023-06-12 18:51:54 +02:00
Flori Weber 057e8e552f Refactor users.rs to use api::common 2023-06-11 21:40:03 +02:00
Flori Weber 6db823cb48 Refactor roles.rs to use api::common 2023-06-11 20:04:40 +02:00
Flori Weber 893d1be98a Refactor member.rs to use api::common 2023-06-11 19:30:15 +02:00
Flori Weber d10f268ae5 Refactor guilds.rs to use api:common 2023-06-11 19:26:34 +02:00
Flori Weber c8e4268638 Use handle_request_as_option instead 2023-06-11 19:22:28 +02:00
Flori Weber e0a6b37a94 Introduce handle_request_as_option 2023-06-11 19:22:10 +02:00
Flori Weber 8d6fab0858 Refactor reactions to use api::options 2023-06-11 19:13:38 +02:00
Flori Weber 876cbd319d Refactor permissions.rs to use api::common 2023-06-11 17:56:29 +02:00
Flori Weber 96b82377d8 Remove import 2023-06-11 17:51:26 +02:00
Flori Weber 06e27e816c Refactor Message::send() 2023-06-11 17:49:42 +02:00
Flori Weber 5a0bf4b570 Make some fields Option enum 2023-06-11 17:49:30 +02:00
Flori Weber 99aa44daa8 Refactor to use api common, return Message instead 2023-06-11 17:40:44 +02:00
Flori Weber 0d8505121d Refactor channels.rs to use api::common 2023-06-11 17:36:04 +02:00
Flori Weber 120469453b Add argument to specify which LimitType to use 2023-06-11 17:35:47 +02:00
Flori Weber 4305f035f0 Move common request code into common.rs 2023-06-11 17:21:09 +02:00
Flori Weber 9b6a3c2fa6 Merge branch 'main' into feature/permissions-and-roles 2023-06-11 15:34:43 +02:00
Flori Weber 1dbc05d48c create common.rs 2023-06-11 15:34:05 +02:00
kozabrada123 3237e7b7b7 Reformat and cargo fix 2023-06-11 14:32:37 +02:00
Flori Weber a5a596fb4b Cargo fix 2023-06-11 13:55:00 +02:00
Flori Weber 63f09e51d8 Cargo fix 2023-06-11 13:54:54 +02:00
Flori Weber c745861592 Reformat entire project, optimize imports 2023-06-11 13:52:53 +02:00
Flori Weber f641dbb14f Reformat entire project, optimize imports 2023-06-11 13:52:31 +02:00
kozabrada123 b61bc573b7 Merge branch 'main' into perpetual/gateway-dev 2023-06-11 09:10:03 +02:00
bitfl0wer 9940394f20 Implement delete_permission 2023-06-10 22:16:53 +02:00
bitfl0wer b20fc61aea impl Channel::edit_permissions() 2023-06-10 22:09:53 +02:00