Compare commits
No commits in common. "12cfcf7f11acbced4a5e107a7e874221099595e9" and "5c138d94d0ee4d8d2a62940b0be254e792f687ae" have entirely different histories.
12cfcf7f11
...
5c138d94d0
6 changed files with 66 additions and 638 deletions
6
Cargo.lock
generated
6
Cargo.lock
generated
|
|
@ -2294,7 +2294,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "torn-api"
|
name = "torn-api"
|
||||||
version = "4.2.0"
|
version = "4.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bon",
|
"bon",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
|
@ -2316,7 +2316,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "torn-api-codegen"
|
name = "torn-api-codegen"
|
||||||
version = "0.7.5"
|
version = "0.7.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
|
|
@ -2329,7 +2329,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "torn-key-pool"
|
name = "torn-key-pool"
|
||||||
version = "2.0.0"
|
version = "1.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"futures",
|
"futures",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "torn-api-codegen"
|
name = "torn-api-codegen"
|
||||||
authors = ["Pyrit [2111649]"]
|
authors = ["Pyrit [2111649]"]
|
||||||
version = "0.7.5"
|
version = "0.7.4"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
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 = { workspace = true }
|
license = { workspace = true }
|
||||||
|
|
|
||||||
|
|
@ -258,14 +258,12 @@ impl Path {
|
||||||
} else {
|
} else {
|
||||||
let ty = if param.required {
|
let ty = if param.required {
|
||||||
convert_field.push(quote! {
|
convert_field.push(quote! {
|
||||||
parameters.push((#query_val, self.#name.to_string()));
|
.chain(std::iter::once(&self.#name).map(|v| (#query_val, v.to_string())))
|
||||||
});
|
});
|
||||||
ty
|
ty
|
||||||
} else {
|
} else {
|
||||||
convert_field.push(quote! {
|
convert_field.push(quote! {
|
||||||
if let Some(value) = &self.#name {
|
.chain(self.#name.as_ref().into_iter().map(|v| (#query_val, v.to_string())))
|
||||||
parameters.push((#query_val, value.to_string()));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
quote! { Option<#ty>}
|
quote! { Option<#ty>}
|
||||||
};
|
};
|
||||||
|
|
@ -297,8 +295,8 @@ impl Path {
|
||||||
let mut path_fmt_str = String::new();
|
let mut path_fmt_str = String::new();
|
||||||
for seg in &self.segments {
|
for seg in &self.segments {
|
||||||
match seg {
|
match seg {
|
||||||
PathSegment::Constant(val) => _ = write!(path_fmt_str, "/{val}"),
|
PathSegment::Constant(val) => _ = write!(path_fmt_str, "/{}", val),
|
||||||
PathSegment::Parameter { name } => _ = write!(path_fmt_str, "/{{{name}}}"),
|
PathSegment::Parameter { name } => _ = write!(path_fmt_str, "/{{{}}}", name),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -326,15 +324,14 @@ impl Path {
|
||||||
type Response = #response_ty;
|
type Response = #response_ty;
|
||||||
fn into_request(self) -> (Self::Discriminant, crate::request::ApiRequest) {
|
fn into_request(self) -> (Self::Discriminant, crate::request::ApiRequest) {
|
||||||
let path = format!(#path_fmt_str, #(#fmt_val),*);
|
let path = format!(#path_fmt_str, #(#fmt_val),*);
|
||||||
let mut parameters = Vec::new();
|
|
||||||
#(#convert_field)*
|
|
||||||
|
|
||||||
#[allow(unused_parens)]
|
#[allow(unused_parens)]
|
||||||
(
|
(
|
||||||
(#(#discriminant_val),*),
|
(#(#discriminant_val),*),
|
||||||
crate::request::ApiRequest {
|
crate::request::ApiRequest {
|
||||||
path,
|
path,
|
||||||
parameters,
|
parameters: std::iter::empty()
|
||||||
|
#(#convert_field)*
|
||||||
|
.collect(),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "torn-api"
|
name = "torn-api"
|
||||||
version = "4.2.0"
|
version = "4.1.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Auto-generated bindings for the v2 torn api"
|
description = "Auto-generated bindings for the v2 torn api"
|
||||||
license = { workspace = true }
|
license = { workspace = true }
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -9,14 +9,12 @@ pub(super) mod test {
|
||||||
use crate::{
|
use crate::{
|
||||||
executor::{ExecutorExt, ReqwestClient},
|
executor::{ExecutorExt, ReqwestClient},
|
||||||
models::{
|
models::{
|
||||||
faction_selection_name::FactionSelectionNameVariant, AttackCode,
|
faction_selection_name::FactionSelectionNameVariant,
|
||||||
PersonalStatsCategoryEnum, PersonalStatsStatName, UserListEnum,
|
user_selection_name::UserSelectionNameVariant, AttackCode, PersonalStatsCategoryEnum,
|
||||||
|
PersonalStatsStatName, UserListEnum,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "strum")]
|
|
||||||
use crate::models::user_selection_name::UserSelectionNameVariant;
|
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
static TICKETS: OnceLock<mpsc::Sender<mpsc::Sender<ReqwestClient>>> = OnceLock::new();
|
static TICKETS: OnceLock<mpsc::Sender<mpsc::Sender<ReqwestClient>>> = OnceLock::new();
|
||||||
|
|
@ -501,14 +499,14 @@ pub(super) mod test {
|
||||||
racing_scope.carupgrades(|b| b).await.unwrap();
|
racing_scope.carupgrades(|b| b).await.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
/* #[tokio::test]
|
||||||
async fn racing_races() {
|
async fn racing_races() {
|
||||||
let client = test_client().await;
|
let client = test_client().await;
|
||||||
|
|
||||||
let racing_scope = RacingScope(&client);
|
let racing_scope = RacingScope(&client);
|
||||||
|
|
||||||
racing_scope.races(|b| b).await.unwrap();
|
racing_scope.races(|b| b).await.unwrap();
|
||||||
}
|
} */
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn racing_race_for_race_id() {
|
async fn racing_race_for_race_id() {
|
||||||
|
|
@ -1146,8 +1144,6 @@ pub(super) mod test {
|
||||||
let client = test_client().await;
|
let client = test_client().await;
|
||||||
|
|
||||||
client.user().profile(|b| b).await.unwrap();
|
client.user().profile(|b| b).await.unwrap();
|
||||||
|
|
||||||
client.user().profile_for_id(4.into(), |b| b).await.unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue