expose request in builder
This commit is contained in:
parent
c6b3051887
commit
e8a8b5976b
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "torn-api"
|
name = "torn-api"
|
||||||
version = "0.6.6"
|
version = "0.6.7"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.75.0"
|
rust-version = "1.75.0"
|
||||||
authors = ["Pyrit [2111649]"]
|
authors = ["Pyrit [2111649]"]
|
||||||
|
|
|
@ -15,7 +15,7 @@ pub fn user_benchmark(c: &mut Criterion) {
|
||||||
client
|
client
|
||||||
.torn_api(key)
|
.torn_api(key)
|
||||||
.user(|b| {
|
.user(|b| {
|
||||||
b.selections(&[
|
b.selections([
|
||||||
user::Selection::Basic,
|
user::Selection::Basic,
|
||||||
user::Selection::Discord,
|
user::Selection::Discord,
|
||||||
user::Selection::Profile,
|
user::Selection::Profile,
|
||||||
|
@ -49,7 +49,7 @@ pub fn faction_benchmark(c: &mut Criterion) {
|
||||||
|
|
||||||
client
|
client
|
||||||
.torn_api(key)
|
.torn_api(key)
|
||||||
.faction(|b| b.selections(&[faction::Selection::Basic]))
|
.faction(|b| b.selections([faction::Selection::Basic]))
|
||||||
.await
|
.await
|
||||||
.unwrap()
|
.unwrap()
|
||||||
});
|
});
|
||||||
|
@ -74,7 +74,7 @@ pub fn attacks_full(c: &mut Criterion) {
|
||||||
|
|
||||||
client
|
client
|
||||||
.torn_api(key)
|
.torn_api(key)
|
||||||
.faction(|b| b.selections(&[faction::Selection::AttacksFull]))
|
.faction(|b| b.selections([faction::Selection::AttacksFull]))
|
||||||
.await
|
.await
|
||||||
.unwrap()
|
.unwrap()
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,9 +39,7 @@ where
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
Ok(None)
|
Ok(None)
|
||||||
} else {
|
} else {
|
||||||
let naive = NaiveDateTime::from_timestamp_opt(i, 0)
|
Ok(DateTime::from_timestamp(i, 0))
|
||||||
.ok_or_else(|| D::Error::invalid_value(Unexpected::Signed(i), &"Epoch timestamp"))?;
|
|
||||||
Ok(Some(DateTime::from_utc(naive, Utc)))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -223,8 +223,8 @@ pub struct ApiRequestBuilder<A>
|
||||||
where
|
where
|
||||||
A: ApiSelection,
|
A: ApiSelection,
|
||||||
{
|
{
|
||||||
request: ApiRequest<A>,
|
pub request: ApiRequest<A>,
|
||||||
id: Option<String>,
|
pub id: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A> Default for ApiRequestBuilder<A>
|
impl<A> Default for ApiRequestBuilder<A>
|
||||||
|
|
Loading…
Reference in a new issue