diff --git a/Cargo.lock b/Cargo.lock index 06a011d..c7c0243 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2294,7 +2294,7 @@ dependencies = [ [[package]] name = "torn-api" -version = "1.6.2" +version = "1.6.1" dependencies = [ "bon", "bytes", @@ -2316,7 +2316,7 @@ dependencies = [ [[package]] name = "torn-api-codegen" -version = "0.6.2" +version = "0.6.1" dependencies = [ "heck", "indexmap", diff --git a/torn-api-codegen/Cargo.toml b/torn-api-codegen/Cargo.toml index da49172..8d57044 100644 --- a/torn-api-codegen/Cargo.toml +++ b/torn-api-codegen/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "torn-api-codegen" authors = ["Pyrit [2111649]"] -version = "0.6.2" +version = "0.6.1" edition = "2021" description = "Contains the v2 torn API model descriptions and codegen for the bindings" license-file = { workspace = true } diff --git a/torn-api-codegen/src/model/enum.rs b/torn-api-codegen/src/model/enum.rs index 4920c03..cac4b40 100644 --- a/torn-api-codegen/src/model/enum.rs +++ b/torn-api-codegen/src/model/enum.rs @@ -429,25 +429,6 @@ impl Enum { }); } - // HACK: idk - let shared: Vec<_> = result - .variants - .iter_mut() - .filter(|v| v.name == "Variant") - .collect(); - if shared.len() >= 2 { - for (idx, variant) in shared.into_iter().enumerate() { - let label = idx + 1; - variant.name = format!("Variant{}", label); - if let EnumVariantValue::Tuple(values) = &mut variant.value { - if let [EnumVariantTupleValue::Enum { name, inner, .. }] = values.as_mut_slice() - { - inner.name.push_str(&label.to_string()); - name.push_str(&label.to_string()); - } - } - } - } Some(result) } @@ -463,8 +444,8 @@ impl Enum { pub fn codegen(&self, resolved: &ResolvedSchema) -> Option { let repr = self.repr.map(|r| match r { - EnumRepr::U8 => quote! { #[repr(u8)] }, - EnumRepr::U32 => quote! { #[repr(u32)] }, + EnumRepr::U8 => quote! { #[repr(u8)]}, + EnumRepr::U32 => quote! { #[repr(u32)]}, }); let name = format_ident!("{}", self.name); let desc = self.description.as_ref().map(|d| { diff --git a/torn-api/Cargo.toml b/torn-api/Cargo.toml index c0d31ee..9e10e3d 100644 --- a/torn-api/Cargo.toml +++ b/torn-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "torn-api" -version = "1.6.2" +version = "1.6.1" edition = "2021" description = "Auto-generated bindings for the v2 torn api" license-file = { workspace = true } @@ -39,7 +39,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.6.2" } +torn-api-codegen = { path = "../torn-api-codegen", version = "0.6.0" } syn = { workspace = true, features = ["parsing"] } proc-macro2 = { workspace = true } prettyplease = "0.2" diff --git a/torn-api/openapi.json b/torn-api/openapi.json index e01f22b..bee9fe7 100644 --- a/torn-api/openapi.json +++ b/torn-api/openapi.json @@ -3059,12 +3059,6 @@ { "$ref": "#/components/parameters/ApiFactionSearchFilter" }, - { - "$ref": "#/components/parameters/ApiLimit20" - }, - { - "$ref": "#/components/parameters/ApiOffset" - }, { "$ref": "#/components/parameters/ApiTimestamp" }, @@ -3653,23 +3647,7 @@ "description": "selection id", "required": false, "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/FactionId" - }, - { - "$ref": "#/components/schemas/FactionCrimeId" - }, - { - "$ref": "#/components/schemas/ChainId" - }, - { - "$ref": "#/components/schemas/RankedWarId" - }, - { - "$ref": "#/components/schemas/TerritoryWarId" - } - ] + "type": "string" } }, { @@ -3687,40 +3665,7 @@ "description": "Selection category", "required": false, "schema": { - "oneOf": [ - { - "type": "string", - "enum": [ - "all", - "current" - ] - }, - { - "type": "string", - "enum": [ - "all", - "recruiting", - "planning", - "failure", - "successful", - "expired", - "available", - "completed" - ] - }, - { - "$ref": "#/components/schemas/FactionNewsCategory" - }, - { - "$ref": "#/components/schemas/FactionRankedWarsCategoryEnum" - }, - { - "$ref": "#/components/schemas/ReportTypeEnum" - }, - { - "$ref": "#/components/schemas/FactionTerritoryWarsCategoryEnum" - } - ] + "type": "string" } }, { @@ -3729,7 +3674,7 @@ "description": "Stat category", "required": false, "schema": { - "$ref": "#/components/schemas/FactionStatEnum" + "type": "string" } }, { @@ -4226,17 +4171,7 @@ "description": "selection id", "required": false, "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/ForumThreadId" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/ForumId" - } - } - ] + "type": "string" } }, { @@ -4622,7 +4557,7 @@ "description": "selection id", "required": false, "schema": { - "$ref": "#/components/schemas/ItemId" + "type": "string" } }, { @@ -4634,6 +4569,15 @@ "$ref": "#/components/schemas/WeaponBonusEnum" } }, + { + "name": "cat", + "in": "query", + "description": "Selection category", + "required": false, + "schema": { + "type": "string" + } + }, { "name": "sort", "in": "query", @@ -4768,66 +4712,6 @@ "x-stability": "Stable" } }, - "/racing/races": { - "get": { - "tags": [ - "Racing" - ], - "summary": "Get races", - "description": "Requires public access key.
Returns a list of races, ordered by race start timestamp.", - "operationId": "4be921a67d32b5e82c68835ef56175d0", - "parameters": [ - { - "$ref": "#/components/parameters/ApiLimit100" - }, - { - "$ref": "#/components/parameters/ApiSortDesc" - }, - { - "$ref": "#/components/parameters/ApiTo" - }, - { - "$ref": "#/components/parameters/ApiFrom" - }, - { - "name": "cat", - "in": "query", - "description": "Category of races returned", - "required": false, - "schema": { - "$ref": "#/components/schemas/RacingRaceTypeEnum" - } - }, - { - "$ref": "#/components/parameters/ApiTimestamp" - }, - { - "$ref": "#/components/parameters/ApiComment" - }, - { - "$ref": "#/components/parameters/ApiKeyPublic" - } - ], - "responses": { - "200": { - "description": "Successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RacingRacesResponse" - } - } - } - } - }, - "security": [ - { - "api_key": [] - } - ], - "x-stability": "Stable" - } - }, "/racing/{raceId}/race": { "get": { "tags": [ @@ -20404,8 +20288,7 @@ "ItemMarket": { "required": [ "item", - "listings", - "timestamp" + "listings" ], "properties": { "item": { @@ -20423,11 +20306,6 @@ } ] } - }, - "cache_timestamp": { - "description": "Timestamp when the data was globally cached at.", - "type": "integer", - "format": "int32" } }, "type": "object" diff --git a/torn-api/src/request/mod.rs b/torn-api/src/request/mod.rs index 15ac0a0..a5a7245 100644 --- a/torn-api/src/request/mod.rs +++ b/torn-api/src/request/mod.rs @@ -14,13 +14,7 @@ impl ApiRequest { pub fn url(&self) -> String { let mut url = format!("https://api.torn.com/v2{}?", self.path); - let mut first = true; for (name, value) in &self.parameters { - if first { - first = false; - } else { - url.push('&'); - } url.push_str(&format!("{name}={value}")); }