Commit Graph

150 Commits

Author SHA1 Message Date
bitfl0wer 2bfdf4e3e9
Add PartialEq, Eq, Hash to Enums 2023-08-02 20:23:50 +02:00
bitfl0wer 5d66ad83f2
Start component-izing entities, remove PartialEq wherever needed (because PartialEq isn't implemented for Mutex) 2023-08-02 20:18:16 +02:00
kozabrada123 4e4e279333 Docs 2023-07-31 10:01:25 +02:00
kozabrada123 abb3c7e0e6 Merge branch 'main' into fix/doc-improvements 2023-07-31 09:13:33 +02:00
Flori 18faea5aad
Remove newline 2023-07-30 20:35:02 +02:00
Vivien 6ec26feffb update of reaction struct 2023-07-30 20:27:13 +02:00
Vivien 909f1c0285 change signed to unsigned integer 2023-07-30 20:23:12 +02:00
kozabrada123 b99bcef1f6 Guilds + Channels 2023-07-30 09:04:31 +02:00
kozabrada123 51679e773c Fix broken links 2023-07-30 08:31:12 +02:00
kozabrada123 499faefa51 Documemtaiom 2023-07-30 08:26:26 +02:00
kozabrada123 b897e44cca Document a small bit of attachment 2023-07-29 18:12:57 +02:00
kozabrada123 49801bef10
Update src/types/utils/rights.rs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-29 16:07:06 +00:00
kozabrada123 8954fd2ae5
Update src/types/utils/snowflake.rs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-29 16:06:49 +00:00
kozabrada123 5ed24eea62
Update src/types/utils/rights.rs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-29 16:06:35 +00:00
kozabrada123 d4048d8845
Update src/types/utils/rights.rs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-29 16:05:27 +00:00
kozabrada123 5d49e72461
Update src/types/utils/rights.rs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-29 16:04:49 +00:00
kozabrada123 b4b9f87520
Capitalise docs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-29 16:04:08 +00:00
kozabrada123 abcdd5e128 Forgot this since had the lint on my local copy 2023-07-29 11:45:25 +02:00
kozabrada123 9c4136644b Document some flags 2023-07-29 11:26:10 +02:00
kozabrada123 a4f59fcdf4 Minor doc changes 2023-07-29 11:26:00 +02:00
kozabrada123 3058025e9d Document rights 2023-07-29 11:00:28 +02:00
kozabrada123 577c8a2d71 Merge branch 'main' into fix/doc-improvements 2023-07-28 18:21:20 +02:00
SpecificProtagonist 24450571de
derive Updateable (#167) 2023-07-22 11:20:31 +02:00
Flori 38f0659ec9
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 260dd320a8 Merge stuff 2023-07-21 14:10:50 +02:00
SpecificProtagonist f97d26bc6c
Fix gateway heartbeat blocking (#162)
fix gateway heartbeat blocking
2023-07-21 13:59:40 +02:00
Flori 7df6cb183f
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
kozabrada123 133021a805 Rustdoc warnings + misc changes 2023-07-10 18:06:45 +02:00
kozabrada123 282bc06cff /* -> /// 2023-07-10 16:59:00 +02:00
Flori 8c9ccdd997
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
Vincent Junge 2e9d4caee5
require password to log in 2023-06-25 22:34:05 +02:00
Vincent Junge 9ccc08b5e2
remove client side validation 2023-06-25 11:36:37 +02:00
Vincent Junge f2709492de
always use Snowflakes in args 2023-06-22 18:55:19 +02:00
Vincent Junge 8d7e49f3c2
get channel messages 2023-06-21 14:46:45 +02:00
Vincent Junge 9429bd7772
more consistent use of snowflakes 2023-06-20 22:03:29 +02:00
Flori 304cb6076a
Merge pull request #114 from SpecificProtagonist/snowflake
Simplify Snowflake
2023-06-20 18:57:25 +02:00
Vincent Junge 04c3ee56e9
simplify GatewayEvent 2023-06-20 16:12:13 +02:00
Vincent Junge 29fcdfe641
simplyfy Snowflake 2023-06-20 12:21:22 +02:00
Flori Weber 06b4f5fb65
Add Eq, PartialEq derives 2023-06-19 18:12:01 +02:00
Flori Weber b8e8a1c23a
Fix build failing 2023-06-19 16:11:53 +02:00
Vincent Junge cadf14ba6a
Make MessageSendSchema fields public 2023-06-19 14:21:27 +02:00
Vincent Junge 37de1d7b06
Fix various Clippy lints 2023-06-19 12:35:07 +02:00
Flori Weber 4829845512
Move FriendRequestSchema to schemas 2023-06-18 19:05:09 +02:00
Flori Weber 191dc34933
Create relationship schemes 2023-06-18 19:04:55 +02:00
Flori Weber cd303b0fef
Add FriendRequestSendSchema 2023-06-15 19:01:01 +02:00
Flori Weber b56b5f5f12
Format relationships.rs 2023-06-14 22:14:56 +02:00
Flori Weber 2a8a8d75d3
Add relationships.rs 2023-06-14 22:14:48 +02:00
Flori Weber 870d5606a0
Update link reference 2023-06-13 15:23:39 +02:00
Flori Weber dfec24b8b8
Update relationship.rs types 2023-06-13 15:23:06 +02:00
Flori Weber 583031e64f
Make some fields Option enum 2023-06-11 17:49:30 +02:00