expose request in builder

This commit is contained in:
TotallyNot 2024-04-02 21:06:41 +02:00
parent c6b3051887
commit e8a8b5976b
4 changed files with 7 additions and 9 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "torn-api"
version = "0.6.6"
version = "0.6.7"
edition = "2021"
rust-version = "1.75.0"
authors = ["Pyrit [2111649]"]

View file

@ -15,7 +15,7 @@ pub fn user_benchmark(c: &mut Criterion) {
client
.torn_api(key)
.user(|b| {
b.selections(&[
b.selections([
user::Selection::Basic,
user::Selection::Discord,
user::Selection::Profile,
@ -49,7 +49,7 @@ pub fn faction_benchmark(c: &mut Criterion) {
client
.torn_api(key)
.faction(|b| b.selections(&[faction::Selection::Basic]))
.faction(|b| b.selections([faction::Selection::Basic]))
.await
.unwrap()
});
@ -74,7 +74,7 @@ pub fn attacks_full(c: &mut Criterion) {
client
.torn_api(key)
.faction(|b| b.selections(&[faction::Selection::AttacksFull]))
.faction(|b| b.selections([faction::Selection::AttacksFull]))
.await
.unwrap()
});

View file

@ -39,9 +39,7 @@ where
if i == 0 {
Ok(None)
} else {
let naive = NaiveDateTime::from_timestamp_opt(i, 0)
.ok_or_else(|| D::Error::invalid_value(Unexpected::Signed(i), &"Epoch timestamp"))?;
Ok(Some(DateTime::from_utc(naive, Utc)))
Ok(DateTime::from_timestamp(i, 0))
}
}

View file

@ -223,8 +223,8 @@ pub struct ApiRequestBuilder<A>
where
A: ApiSelection,
{
request: ApiRequest<A>,
id: Option<String>,
pub request: ApiRequest<A>,
pub id: Option<String>,
}
impl<A> Default for ApiRequestBuilder<A>