chore(codegen): updated spec and improved builder ergonomics
This commit is contained in:
parent
84d7c7586b
commit
e5e5d327a2
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1228,7 +1228,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "torn-api-codegen"
|
name = "torn-api-codegen"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "torn-api-codegen"
|
name = "torn-api-codegen"
|
||||||
authors = ["Pyrit [2111649]"]
|
authors = ["Pyrit [2111649]"]
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
description = "Contains the v2 torn API model descriptions and codegen for the bindings"
|
description = "Contains the v2 torn API model descriptions and codegen for the bindings"
|
||||||
license-file = { workspace = true }
|
license-file = { workspace = true }
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -15,26 +15,51 @@ pub enum EnumRepr {
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum EnumVariantTupleValue {
|
pub enum EnumVariantTupleValue {
|
||||||
Ref(String),
|
Ref { ty_name: String },
|
||||||
|
ArrayOfRefs { ty_name: String },
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EnumVariantTupleValue {
|
impl EnumVariantTupleValue {
|
||||||
pub fn from_schema(schema: &OpenApiType) -> Option<Self> {
|
pub fn from_schema(schema: &OpenApiType) -> Option<Self> {
|
||||||
if let OpenApiType {
|
match schema {
|
||||||
|
OpenApiType {
|
||||||
ref_path: Some(path),
|
ref_path: Some(path),
|
||||||
..
|
..
|
||||||
} = schema
|
} => Some(Self::Ref {
|
||||||
{
|
ty_name: path.strip_prefix("#/components/schemas/")?.to_owned(),
|
||||||
Some(Self::Ref((*path).to_owned()))
|
}),
|
||||||
} else {
|
OpenApiType {
|
||||||
None
|
r#type: Some("array"),
|
||||||
|
items: Some(items),
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
let OpenApiType {
|
||||||
|
ref_path: Some(path),
|
||||||
|
..
|
||||||
|
} = items.as_ref()
|
||||||
|
else {
|
||||||
|
return None;
|
||||||
|
};
|
||||||
|
Some(Self::ArrayOfRefs {
|
||||||
|
ty_name: path.strip_prefix("#/components/schemas/")?.to_owned(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name(&self) -> Option<&str> {
|
pub fn type_name(&self) -> &str {
|
||||||
let Self::Ref(path) = self;
|
match self {
|
||||||
|
Self::Ref { ty_name } => ty_name,
|
||||||
|
Self::ArrayOfRefs { ty_name } => ty_name,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
path.strip_prefix("#/components/schemas/")
|
pub fn name(&self) -> String {
|
||||||
|
match self {
|
||||||
|
Self::Ref { ty_name } => ty_name.clone(),
|
||||||
|
Self::ArrayOfRefs { ty_name } => format!("{ty_name}s"),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +128,7 @@ impl EnumVariant {
|
||||||
let mut val_tys = Vec::with_capacity(values.len());
|
let mut val_tys = Vec::with_capacity(values.len());
|
||||||
|
|
||||||
for value in values {
|
for value in values {
|
||||||
let ty_name = value.name()?;
|
let ty_name = value.type_name();
|
||||||
let ty_name = format_ident!("{ty_name}");
|
let ty_name = format_ident!("{ty_name}");
|
||||||
|
|
||||||
val_tys.push(quote! {
|
val_tys.push(quote! {
|
||||||
|
@ -216,7 +241,7 @@ impl Enum {
|
||||||
|
|
||||||
for schema in schemas {
|
for schema in schemas {
|
||||||
let value = EnumVariantTupleValue::from_schema(schema)?;
|
let value = EnumVariantTupleValue::from_schema(schema)?;
|
||||||
let name = value.name()?.to_owned();
|
let name = value.name();
|
||||||
|
|
||||||
result.variants.push(EnumVariant {
|
result.variants.push(EnumVariant {
|
||||||
name,
|
name,
|
||||||
|
@ -253,11 +278,15 @@ impl Enum {
|
||||||
|
|
||||||
let mut derives = vec![];
|
let mut derives = vec![];
|
||||||
|
|
||||||
if self.copy {
|
if self.repr.is_some() {
|
||||||
derives.extend_from_slice(&["Copy", "Hash"]);
|
derives.push(quote! { serde_repr::Deserialize_repr });
|
||||||
|
} else {
|
||||||
|
derives.push(quote! { serde::Deserialize });
|
||||||
}
|
}
|
||||||
|
|
||||||
let derives = derives.into_iter().map(|d| format_ident!("{d}"));
|
if self.copy {
|
||||||
|
derives.push(quote! { Copy, Hash });
|
||||||
|
}
|
||||||
|
|
||||||
let serde_attr = self.untagged.then(|| {
|
let serde_attr = self.untagged.then(|| {
|
||||||
quote! {
|
quote! {
|
||||||
|
@ -279,7 +308,7 @@ impl Enum {
|
||||||
|
|
||||||
Some(quote! {
|
Some(quote! {
|
||||||
#desc
|
#desc
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Deserialize, #(#derives),*)]
|
#[derive(Debug, Clone, PartialEq, #(#derives),*)]
|
||||||
#serde_attr
|
#serde_attr
|
||||||
pub enum #name {
|
pub enum #name {
|
||||||
#(#variants),*
|
#(#variants),*
|
||||||
|
|
|
@ -280,7 +280,7 @@ impl Object {
|
||||||
|
|
||||||
for (prop_name, prop) in props {
|
for (prop_name, prop) in props {
|
||||||
// HACK: This will cause a duplicate key otherwise
|
// HACK: This will cause a duplicate key otherwise
|
||||||
if *prop_name == "itemDetails" {
|
if ["itemDetails", "sci-fi", "non-attackers", "co-leader_id"].contains(prop_name) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,6 +217,12 @@ impl Parameter {
|
||||||
Self(inner)
|
Self(inner)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<i32> for #name {
|
||||||
|
fn from(inner: i32) -> Self {
|
||||||
|
Self(inner)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -317,6 +323,14 @@ The default value [Self::{}](self::{}#variant.{})"#,
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T> From<T> for #name where T: IntoIterator<Item = #inner_ty> {
|
||||||
|
fn from(value: T) -> #name {
|
||||||
|
let items = value.into_iter().collect();
|
||||||
|
|
||||||
|
Self(items)
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Some(code)
|
Some(code)
|
||||||
|
|
|
@ -154,7 +154,7 @@ impl Path {
|
||||||
PathParameter::Component(param) => (false, param),
|
PathParameter::Component(param) => (false, param),
|
||||||
};
|
};
|
||||||
|
|
||||||
let ty = match ¶m.r#type {
|
let (ty, builder_param) = match ¶m.r#type {
|
||||||
ParameterType::I32 { .. } | ParameterType::Enum { .. } => {
|
ParameterType::I32 { .. } | ParameterType::Enum { .. } => {
|
||||||
let ty_name = format_ident!("{}", param.name);
|
let ty_name = format_ident!("{}", param.name);
|
||||||
|
|
||||||
|
@ -162,31 +162,43 @@ impl Path {
|
||||||
ns.push_element(param.codegen()?);
|
ns.push_element(param.codegen()?);
|
||||||
let path = ns.get_ident();
|
let path = ns.get_ident();
|
||||||
|
|
||||||
|
(
|
||||||
quote! {
|
quote! {
|
||||||
crate::request::models::#path::#ty_name
|
crate::request::models::#path::#ty_name
|
||||||
}
|
},
|
||||||
|
Some(quote! { #[builder(into)] }),
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
|
(
|
||||||
quote! {
|
quote! {
|
||||||
crate::parameters::#ty_name
|
crate::parameters::#ty_name
|
||||||
|
},
|
||||||
|
Some(quote! { #[builder(into)]}),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
ParameterType::String => (quote! { String }, None),
|
||||||
ParameterType::String => quote! { String },
|
ParameterType::Boolean => (quote! { bool }, None),
|
||||||
ParameterType::Boolean => quote! { bool },
|
|
||||||
ParameterType::Schema { type_name } => {
|
ParameterType::Schema { type_name } => {
|
||||||
let ty_name = format_ident!("{}", type_name);
|
let ty_name = format_ident!("{}", type_name);
|
||||||
|
|
||||||
|
(
|
||||||
quote! {
|
quote! {
|
||||||
crate::models::#ty_name
|
crate::models::#ty_name
|
||||||
}
|
},
|
||||||
|
None,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
ParameterType::Array { .. } => {
|
ParameterType::Array { .. } => {
|
||||||
ns.push_element(param.codegen()?);
|
ns.push_element(param.codegen()?);
|
||||||
let ty_name = param.r#type.codegen_type_name(¶m.name);
|
let ty_name = param.r#type.codegen_type_name(¶m.name);
|
||||||
let path = ns.get_ident();
|
let path = ns.get_ident();
|
||||||
|
(
|
||||||
quote! {
|
quote! {
|
||||||
crate::request::models::#path::#ty_name
|
crate::request::models::#path::#ty_name
|
||||||
}
|
},
|
||||||
|
Some(quote! { #[builder(into)] }),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -199,6 +211,7 @@ impl Path {
|
||||||
let path_name = format_ident!("{}", param.value);
|
let path_name = format_ident!("{}", param.value);
|
||||||
start_fields.push(quote! {
|
start_fields.push(quote! {
|
||||||
#[builder(start_fn)]
|
#[builder(start_fn)]
|
||||||
|
#builder_param
|
||||||
pub #name: #ty
|
pub #name: #ty
|
||||||
});
|
});
|
||||||
fmt_val.push(quote! {
|
fmt_val.push(quote! {
|
||||||
|
@ -218,6 +231,7 @@ impl Path {
|
||||||
};
|
};
|
||||||
|
|
||||||
fields.push(quote! {
|
fields.push(quote! {
|
||||||
|
#builder_param
|
||||||
pub #name: #ty
|
pub #name: #ty
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -260,7 +274,7 @@ impl Path {
|
||||||
#ns
|
#ns
|
||||||
|
|
||||||
#[derive(Debug, Clone, bon::Builder)]
|
#[derive(Debug, Clone, bon::Builder)]
|
||||||
#[builder(state_mod(vis = "pub(crate)"))]
|
#[builder(state_mod(vis = "pub(crate)"), on(String, into))]
|
||||||
pub struct #name {
|
pub struct #name {
|
||||||
#(#start_fields),*
|
#(#start_fields),*
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,13 @@ pub(super) mod test {
|
||||||
|
|
||||||
use tokio::sync::mpsc;
|
use tokio::sync::mpsc;
|
||||||
|
|
||||||
use crate::executor::ReqwestClient;
|
use crate::{
|
||||||
|
executor::{ExecutorExt, ReqwestClient},
|
||||||
|
models::{
|
||||||
|
AttackCode, FactionSelectionName, PersonalStatsCategoryEnum, PersonalStatsStatName,
|
||||||
|
UserListEnum,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
@ -54,6 +60,21 @@ pub(super) mod test {
|
||||||
rx.recv().await.unwrap()
|
rx.recv().await.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn faction() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
let r = client
|
||||||
|
.faction()
|
||||||
|
.for_selections(|b| {
|
||||||
|
b.selections([FactionSelectionName::Basic, FactionSelectionName::Balance])
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
r.faction_basic_response().unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn faction_applications() {
|
async fn faction_applications() {
|
||||||
let client = test_client().await;
|
let client = test_client().await;
|
||||||
|
@ -193,7 +214,7 @@ pub(super) mod test {
|
||||||
let faction_scope = FactionScope(&client);
|
let faction_scope = FactionScope(&client);
|
||||||
|
|
||||||
faction_scope
|
faction_scope
|
||||||
.crime_for_id(468347.into(), |b| b)
|
.crime_for_crime_id(468347.into(), |b| b)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
@ -277,7 +298,7 @@ pub(super) mod test {
|
||||||
let faction_scope = FactionScope(&client);
|
let faction_scope = FactionScope(&client);
|
||||||
|
|
||||||
faction_scope
|
faction_scope
|
||||||
.rankedwarreport_for_id(24424.into(), |b| b)
|
.rankedwarreport_for_ranked_war_id(24424.into(), |b| b)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
@ -337,7 +358,7 @@ pub(super) mod test {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn lookup() {
|
async fn faction_lookup() {
|
||||||
let client = test_client().await;
|
let client = test_client().await;
|
||||||
|
|
||||||
let faction_scope = FactionScope(&client);
|
let faction_scope = FactionScope(&client);
|
||||||
|
@ -520,7 +541,7 @@ pub(super) mod test {
|
||||||
let racing_scope = TornScope(&client);
|
let racing_scope = TornScope(&client);
|
||||||
|
|
||||||
racing_scope
|
racing_scope
|
||||||
.attacklog(|b| b.log("ec987a60a22155cbfb7c1625cbb2092f".to_owned()))
|
.attacklog(|b| b.log(AttackCode("ec987a60a22155cbfb7c1625cbb2092f".to_owned())))
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
@ -661,7 +682,7 @@ pub(super) mod test {
|
||||||
let torn_scope = TornScope(&client);
|
let torn_scope = TornScope(&client);
|
||||||
|
|
||||||
torn_scope
|
torn_scope
|
||||||
.subcrimes_for_crime_id("3".into(), |b| b)
|
.subcrimes_for_crime_id(3.into(), |b| b)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
@ -669,7 +690,6 @@ pub(super) mod test {
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn torn_lookup() {
|
async fn torn_lookup() {
|
||||||
let client = test_client().await;
|
let client = test_client().await;
|
||||||
|
|
||||||
let torn_scope = TornScope(&client);
|
let torn_scope = TornScope(&client);
|
||||||
|
|
||||||
torn_scope.lookup(|b| b).await.unwrap();
|
torn_scope.lookup(|b| b).await.unwrap();
|
||||||
|
@ -683,4 +703,255 @@ pub(super) mod test {
|
||||||
|
|
||||||
torn_scope.timestamp(|b| b).await.unwrap();
|
torn_scope.timestamp(|b| b).await.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_attacks() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().attacks(|b| b).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_attacksfull() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().attacksfull(|b| b).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_bounties() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().bounties(|b| b).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_bounties_for_id() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client
|
||||||
|
.user()
|
||||||
|
.bounties_for_id(986228.into(), |b| b)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_calendar() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().calendar(|b| b).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_crimes_for_crime_id() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client
|
||||||
|
.user()
|
||||||
|
.crimes_for_crime_id(10.into(), |b| b)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_enlisted_cars() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().enlistedcars(|b| b).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_factionbalance() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().factionbalance(|b| b).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_forumfeed() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().forumfeed(|b| b).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_forumfriends() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().forumfriends(|b| b).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_forumposts() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().forumposts(|b| b).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_forumposts_for_id() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client
|
||||||
|
.user()
|
||||||
|
.forumposts_for_id(1.into(), |b| b)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_forumsubscribedthreads() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().forumsubscribedthreads(|b| b).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_forumthreads() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().forumthreads(|b| b).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_forumthreads_for_id() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client
|
||||||
|
.user()
|
||||||
|
.forumthreads_for_id(1.into(), |b| b)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_hof() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().hof(|b| b).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_hof_for_id() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().hof_for_id(1.into(), |b| b).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_itemmarket() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().itemmarket(|b| b).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_jobranks() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().jobranks(|b| b).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_list() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client
|
||||||
|
.user()
|
||||||
|
.list(|b| b.cat(UserListEnum::Friends))
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_organizedcrime() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().organizedcrime(|b| b).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_personalstats() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client
|
||||||
|
.user()
|
||||||
|
.personalstats(|b| {
|
||||||
|
b.stat([PersonalStatsStatName::Piercinghits])
|
||||||
|
.timestamp(1737661955)
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
client
|
||||||
|
.user()
|
||||||
|
.personalstats(|b| b.cat(PersonalStatsCategoryEnum::All))
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
client
|
||||||
|
.user()
|
||||||
|
.personalstats(|b| b.cat(PersonalStatsCategoryEnum::Popular))
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
client
|
||||||
|
.user()
|
||||||
|
.personalstats(|b| b.cat(PersonalStatsCategoryEnum::Drugs))
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
client
|
||||||
|
.user()
|
||||||
|
.personalstats(|b| b.stat([PersonalStatsStatName::Piercinghits]))
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_personalstats_for_id() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client
|
||||||
|
.user()
|
||||||
|
.personalstats_for_id(1.into(), |b| b.cat(PersonalStatsCategoryEnum::All))
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_races() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().races(|b| b).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_revives() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().revives(|b| b).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_revivesfull() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().revives_full(|b| b).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_lookup() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().lookup(|b| b).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn user_timestamp() {
|
||||||
|
let client = test_client().await;
|
||||||
|
|
||||||
|
client.user().attacks(|b| b).await.unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue