feat: handle duplicate enum cases

This commit is contained in:
pyrite 2025-12-01 18:29:13 +01:00
parent 12cfcf7f11
commit 2e60e0a24f
Signed by: pyrite
GPG key ID: 7F1BA9170CD35D15
10 changed files with 1462 additions and 658 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "torn-api"
version = "4.2.0"
version = "4.7.0"
edition = "2021"
description = "Auto-generated bindings for the v2 torn api"
license = { workspace = true }
@ -43,7 +43,7 @@ strum = { version = "0.27.1", features = ["derive"], optional = true }
tokio = { version = "1", features = ["full"] }
[build-dependencies]
torn-api-codegen = { path = "../torn-api-codegen", version = "0.7.4" }
torn-api-codegen = { path = "../torn-api-codegen", version = "0.8" }
syn = { workspace = true, features = ["parsing"] }
proc-macro2 = { workspace = true }
prettyplease = "0.2"

File diff suppressed because it is too large Load diff

View file

@ -10,7 +10,7 @@ pub(super) mod test {
executor::{ExecutorExt, ReqwestClient},
models::{
faction_selection_name::FactionSelectionNameVariant, AttackCode,
PersonalStatsCategoryEnum, PersonalStatsStatName, UserListEnum,
PersonalStatsCategoryEnum, PersonalStatsStatName, UserId, UserListEnum,
},
};
@ -743,7 +743,7 @@ pub(super) mod test {
client
.user()
.bounties_for_id(986228.into(), |b| b)
.bounties_for_id(UserId(986228).into(), |b| b)
.await
.unwrap();
}
@ -807,7 +807,7 @@ pub(super) mod test {
client
.user()
.forumposts_for_id(1.into(), |b| b)
.forumposts_for_id(UserId(1).into(), |b| b)
.await
.unwrap();
}
@ -832,7 +832,7 @@ pub(super) mod test {
client
.user()
.forumthreads_for_id(1.into(), |b| b)
.forumthreads_for_id(UserId(1).into(), |b| b)
.await
.unwrap();
}
@ -848,7 +848,11 @@ pub(super) mod test {
async fn user_hof_for_id() {
let client = test_client().await;
client.user().hof_for_id(1.into(), |b| b).await.unwrap();
client
.user()
.hof_for_id(UserId(1).into(), |b| b)
.await
.unwrap();
}
#[tokio::test]
@ -1094,7 +1098,7 @@ pub(super) mod test {
client
.user()
.personalstats_for_id(1.into(), |b| b.cat(PersonalStatsCategoryEnum::All))
.personalstats_for_id(UserId(1).into(), |b| b.cat(PersonalStatsCategoryEnum::All))
.await
.unwrap();
}
@ -1147,7 +1151,11 @@ pub(super) mod test {
client.user().profile(|b| b).await.unwrap();
client.user().profile_for_id(4.into(), |b| b).await.unwrap();
client
.user()
.profile_for_id(UserId(4).into(), |b| b)
.await
.unwrap();
}
#[tokio::test]