Commit Graph

23 Commits

Author SHA1 Message Date
bitfl0wer de3ccd7504
Add rustdoc comments 2023-08-26 19:41:00 +02:00
kozabrada123 a4f59fcdf4 Minor doc changes 2023-07-29 11:26:00 +02:00
kozabrada123 787da3092c Moar docs 2023-07-29 10:23:04 +02:00
kozabrada123 832cb92abc UrlBundle slightly better docs 2023-07-10 17:22:31 +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 f614e93892
UrlBundle remove getters 2023-06-20 12:29:52 +02:00
Vincent Junge 37de1d7b06
Fix various Clippy lints 2023-06-19 12:35:07 +02:00
Flori Weber f4e0d520b1
Reformat entire project, optimize imports 2023-06-11 13:52:31 +02:00
Zertex d00f21cd3f Un-lock mod errors 2023-05-26 10:23:11 -04:00
Zertex 38503aea57 Lock client specific code behind feature 2023-05-26 10:16:08 -04:00
bitfl0wer 5dc1441ac6
Integrate polyphony-types into chorus 2023-05-25 21:11:08 +02:00
bitfl0wer d8c8cd079b
remove println 2023-05-09 17:19:04 +02:00
bitfl0wer 15ee53b5f4
Made modules public, removed 110 warnings 2023-05-09 14:04:46 +02:00
bitfl0wer 7cb77bae0f
Improve readability 2023-04-25 17:41:14 +02:00
bitfl0wer f96bcb87f6
Move custom errros to central file 2023-04-21 16:18:20 +02:00
bitfl0wer d4bf540203
Add PartialEq and Eq derives 2023-04-16 22:16:39 +02:00
bitfl0wer 84258ec8da
Fix incorrect url formatting, add more tests 2023-04-15 13:27:34 +02:00
bitfl0wer d60711a5d1
Fixed goofy ahh way to remove a slash from the end of the url 2023-04-15 13:03:51 +02:00
bitfl0wer dee5fd4631
add: impl display for limit, check_limits 2023-04-10 17:20:02 +02:00
bitfl0wer 2829f2e2e0
Remove http 2023-04-10 14:18:33 +02:00
bitfl0wer f6930d3a38
Indicate that code block is of type Rust 2023-04-05 22:19:15 +02:00
bitfl0wer af13830d99
Add url parser and tests 2023-04-05 21:54:27 +02:00
bitfl0wer 5e000afdc6
main -> lib 2023-04-04 17:37:11 +02:00