add bucket identifiers, add check_limits stub

This commit is contained in:
bitfl0wer 2023-04-07 23:22:44 +02:00
parent 79cdc6e315
commit 3e84976256
No known key found for this signature in database
GPG Key ID: 84BBB60DF895ABF2
1 changed files with 18 additions and 5 deletions

View File

@ -1,16 +1,17 @@
use reqwest::{Client, Request};
use std::collections::VecDeque;
struct Limit {
pub struct Limit {
limit: i64,
remaining: i64,
reset: i64,
bucket: String,
}
pub struct LimitedRequester {
http: Client,
limit: Limit,
requests: VecDeque<Request>, // wow, amazing
requests: VecDeque<Request>,
}
impl LimitedRequester {
@ -21,12 +22,24 @@ impl LimitedRequester {
pub fn new() -> Self {
LimitedRequester {
limit: Limit {
limit: 1,
remaining: 1,
reset: 0,
limit: -1,
remaining: -1,
reset: -1,
bucket: String::new(),
},
http: Client::new(),
requests: VecDeque::new(),
}
}
pub fn check_limits(url: String) -> Limit {
let client = Client::new();
let url_parsed = crate::URLBundle::parse_url(url);
Limit {
limit: -1,
remaining: -1,
reset: -1,
bucket: String::new(),
} // TODO: Implement
}
}