diff --git a/src/limit.rs b/src/limit.rs index b9820f8..1986f7a 100644 --- a/src/limit.rs +++ b/src/limit.rs @@ -5,50 +5,10 @@ use crate::{ errors::ChorusLibError, }; -// Note: There seem to be some overlapping request limiters. We need to make sure that sending a -// request checks for all the request limiters that apply, and blocks if any of the limiters are 0 - -#[allow(dead_code)] -#[derive(Debug)] -pub struct TypedRequest { - request: RequestBuilder, - limit_type: LimitType, -} - #[derive(Debug)] pub struct LimitedRequester; impl LimitedRequester { - /** - # send_request - Checks, if a request can be sent without hitting API rate limits and sends it, if true. - Will automatically update the rate limits of the LimitedRequester the request has been - sent with. - - ## Arguments - - `request`: A [`RequestBuilder`](reqwest::RequestBuilder) that contains a request ready to be - sent. Unfinished or invalid requests will result in the method panicing. - - `limit_type`: Because this library does not yet implement a way to check for which rate limit - will be used when the request gets send, you will have to specify this manually using a - [`LimitType`](crate::api::limits::LimitType) enum. - - ## Returns - - `Response`: The [`Response`](`reqwest::Response`) gotten from sending the request to the - server. This will be returned if the Request was built and send successfully. Is wrapped in - an [`Option`](`core::option::Option`) - - `None`: [`None`](`core::option::Option`) will be returned if the rate limit has been hit, and - the request could therefore not have been sent. - - ## Errors - - This method will error, if: - - The request does not return a success status code (200-299) - - The supplied [`RequestBuilder`](reqwest::RequestBuilder) contains invalid or incomplete - information - - There has been an error with processing (unwrapping) the [`Response`](`reqwest::Response`) - - The call to [`update_limits`](`crate::limits::update_limits`) yielded errors. Read the - methods' Errors section for more information. - */ pub async fn send_request( request: RequestBuilder, limit_type: LimitType,