diff --git a/Cargo.lock b/Cargo.lock index 680f87c..14d3409 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2257,7 +2257,7 @@ dependencies = [ [[package]] name = "torn-api" -version = "4.7.0" +version = "5.0.2" dependencies = [ "bon", "bytes", @@ -2279,7 +2279,7 @@ dependencies = [ [[package]] name = "torn-api-codegen" -version = "0.8.0" +version = "0.8.1" dependencies = [ "heck", "indexmap", @@ -2292,7 +2292,7 @@ dependencies = [ [[package]] name = "torn-key-pool" -version = "2.0.0" +version = "2.1.0" dependencies = [ "chrono", "futures", diff --git a/torn-api-codegen/Cargo.toml b/torn-api-codegen/Cargo.toml index 8393bb6..32edfcb 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.8.0" +version = "0.8.1" edition = "2021" description = "Contains the v2 torn API model descriptions and codegen for the bindings" license = { workspace = true } diff --git a/torn-api-codegen/src/model/object.rs b/torn-api-codegen/src/model/object.rs index 420c47d..4ae1896 100644 --- a/torn-api-codegen/src/model/object.rs +++ b/torn-api-codegen/src/model/object.rs @@ -473,7 +473,11 @@ impl Object { } else { r#type }; - let obj = Self::from_schema_object(name, r#type, schemas, warnings.child("variant")); + let obj = if let Some(types) = &r#type.all_of { + Self::from_all_of(name, types, schemas, warnings.child("variant")) + } else { + Self::from_schema_object(name, r#type, schemas, warnings.child("variant")) + }; result.description = result.description.or(obj.description); result.properties.extend(obj.properties); diff --git a/torn-api/Cargo.toml b/torn-api/Cargo.toml index a1268f3..a08986f 100644 --- a/torn-api/Cargo.toml +++ b/torn-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "torn-api" -version = "4.7.0" +version = "5.0.2" 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.8" } +torn-api-codegen = { path = "../torn-api-codegen", version = "0.8.1" } 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 5e58a18..ec0a2c7 100644 --- a/torn-api/openapi.json +++ b/torn-api/openapi.json @@ -3,7 +3,7 @@ "info": { "title": "Torn API", "description": "\n * The development of Torn's API v2 is still ongoing.\n * If selections remain unaltered, they will default to the API v1 version.\n * Unlike API v1, API v2 accepts both selections and IDs as path and query parameters.\n * If any discrepancies or errors are found, please submit a [bug report](https://www.torn.com/forums.php#/p=forums&f=19&b=0&a=0) on the Torn Forums.\n * In case you're using bots to check for changes on openapi.json file, make sure to specificy a custom user-agent header - CloudFlare sometimes prevents requests from default user-agents.", - "version": "4.6.0" + "version": "5.0.2" }, "servers": [ { @@ -422,7 +422,7 @@ "tags": [ "User" ], - "summary": "Get your competition's event start time", + "summary": "Get your calendar events start time", "description": "Requires minimal access key.
Only available to yourself.", "operationId": "4cc4cc6fa3764f9732db9589e91d7739", "parameters": [ @@ -795,6 +795,45 @@ "x-stability": "Stable" } }, + "/user/equipment": { + "get": { + "tags": [ + "User" + ], + "summary": "Get your equipment & clothing", + "description": "Requires minimal access key.", + "operationId": "273c3a96077332793a1b6ffe21c10218", + "parameters": [ + { + "$ref": "#/components/parameters/ApiTimestamp" + }, + { + "$ref": "#/components/parameters/ApiComment" + }, + { + "$ref": "#/components/parameters/ApiKeyMinimal" + } + ], + "responses": { + "200": { + "description": "Successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserEquipmentResponse" + } + } + } + } + }, + "security": [ + { + "api_key": [] + } + ], + "x-stability": "Unstable" + } + }, "/user/events": { "get": { "tags": [ @@ -933,46 +972,6 @@ "x-stability": "Stable" } }, - "/user/factionbalance": { - "get": { - "tags": [ - "User" - ], - "summary": "Deprecated. Use user/money instead", - "description": "Will be removed on 1st of December 2025. Requires limited access key.
", - "operationId": "b7ebbeea51dc2ef56c3ed5fd9d94e680", - "parameters": [ - { - "$ref": "#/components/parameters/ApiTimestamp" - }, - { - "$ref": "#/components/parameters/ApiComment" - }, - { - "$ref": "#/components/parameters/ApiKeyLimited" - } - ], - "responses": { - "200": { - "description": "Successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserFactionBalanceResponse" - } - } - } - } - }, - "deprecated": true, - "security": [ - { - "api_key": [] - } - ], - "x-stability": "Deprecated" - } - }, "/user/forumfeed": { "get": { "tags": [ @@ -3427,6 +3426,12 @@ { "$ref": "#/components/schemas/UserForumFriendsResponse" }, + { + "$ref": "#/components/schemas/UserPropertyResponse" + }, + { + "$ref": "#/components/schemas/ReportsResponse" + }, { "$ref": "#/components/schemas/UserHofResponse" }, @@ -3490,6 +3495,9 @@ { "$ref": "#/components/schemas/UserListResponse" }, + { + "$ref": "#/components/schemas/UserEquipmentResponse" + }, { "$ref": "#/components/schemas/UserMissionsResponse" }, @@ -8358,6 +8366,54 @@ "x-stability": "Stable" } }, + "/torn/{id}/itemdetails": { + "get": { + "tags": [ + "Torn" + ], + "summary": "Get information about a specific item", + "description": "Requires public key.", + "operationId": "bb6524988f52a1e75729c05a825b91c8", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Item uid", + "required": true, + "schema": { + "$ref": "#/components/schemas/ItemUid" + } + }, + { + "$ref": "#/components/parameters/ApiTimestamp" + }, + { + "$ref": "#/components/parameters/ApiComment" + }, + { + "$ref": "#/components/parameters/ApiKeyPublic" + } + ], + "responses": { + "200": { + "description": "Successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TornItemDetailsResponse" + } + } + } + } + }, + "security": [ + { + "api_key": [] + } + ], + "x-stability": "Unstable" + } + }, "/torn/itemmods": { "get": { "tags": [ @@ -9060,6 +9116,9 @@ { "$ref": "#/components/schemas/TornCrimeId" }, + { + "$ref": "#/components/schemas/ItemUid" + }, { "type": "array", "items": { @@ -9185,9 +9244,15 @@ { "$ref": "#/components/schemas/TornMeritsResponse" }, + { + "$ref": "#/components/schemas/TornOrganizedCrimeResponse" + }, { "$ref": "#/components/schemas/TornHonorsResponse" }, + { + "$ref": "#/components/schemas/TornItemDetailsResponse" + }, { "$ref": "#/components/schemas/TornMedalsResponse" }, @@ -13753,7 +13818,6 @@ "Newsletter Sending", "Announcement Changes", "Description Changes", - "Organised Crimes", "Utility Item Loaning", "Consumable Item Usage" ] @@ -15813,6 +15877,69 @@ } ] }, + "UserEquipment": { + "allOf": [ + { + "$ref": "#/components/schemas/TornItemDetails" + }, + { + "required": [ + "slot" + ], + "properties": { + "slot": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + ] + }, + "UserClothing": { + "required": [ + "id", + "name", + "uid", + "type" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ItemId" + }, + "name": { + "type": "string" + }, + "uid": { + "$ref": "#/components/schemas/ItemUid" + }, + "type": { + "$ref": "#/components/schemas/TornItemTypeEnum" + } + }, + "type": "object" + }, + "UserEquipmentResponse": { + "required": [ + "equipment", + "clothing" + ], + "properties": { + "equipment": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserEquipment" + } + }, + "clothing": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserClothing" + } + } + }, + "type": "object" + }, "UserDiscordResponse": { "required": [ "discord" @@ -16321,11 +16448,7 @@ "UserBar": { "required": [ "current", - "maximum", - "increment", - "interval", - "tick_time", - "full_time" + "maximum" ], "properties": { "current": { @@ -16335,22 +16458,6 @@ "maximum": { "type": "integer", "format": "int32" - }, - "increment": { - "type": "integer", - "format": "int32" - }, - "interval": { - "type": "integer", - "format": "int32" - }, - "tick_time": { - "type": "integer", - "format": "int32" - }, - "full_time": { - "type": "integer", - "format": "int32" } }, "type": "object" @@ -16648,6 +16755,33 @@ }, "type": "object" }, + "UserCompetitionElimination": { + "required": [ + "name", + "score", + "total" + ], + "properties": { + "name": { + "type": "string", + "enum": [ + "Elimination" + ] + }, + "score": { + "type": "integer", + "format": "int32" + }, + "team": { + "type": "string" + }, + "attacks": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, "UserCompetitionRps": { "required": [ "name", @@ -16699,6 +16833,9 @@ }, { "$ref": "#/components/schemas/UserCompetitionRps" + }, + { + "$ref": "#/components/schemas/UserCompetitionElimination" } ] } @@ -19374,7 +19511,7 @@ "UserSelectionName": { "oneOf": [ { - "description": "The following selections will fallback to API v1 and may change at any time: 'bazaar','criminalrecord','display','equipment','gym','inventory','networth','perks','stocks'.", + "description": "The following selections will fallback to API v1 and may change at any time: 'bazaar','criminalrecord','display','gym','inventory','networth','perks','stocks'.", "type": "string", "enum": [ "ammo", @@ -19390,6 +19527,7 @@ "crimes", "discord", "enlistedcars", + "equipment", "events", "faction", "factionbalance", @@ -19436,7 +19574,6 @@ "criminalrecord", "display", "education", - "equipment", "gym", "inventory", "networth", @@ -23926,11 +24063,6 @@ } ] }, - "travel_type": { - "description": "This field is replaced by the 'plane_image_type' field and will be removed on October 1st 2025.", - "type": "string", - "deprecated": true - }, "plane_image_type": { "$ref": "#/components/schemas/UserPlaneImageTypeEnum", "description": "This field is populated only if the state is 'Traveling'." @@ -27871,6 +28003,54 @@ }, "type": "object" }, + "TornItemDetails": { + "allOf": [ + { + "$ref": "#/components/schemas/ItemMarketListingItemDetails" + }, + { + "required": [ + "id", + "name", + "type", + "sub_type" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ItemId" + }, + "name": { + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/TornItemTypeEnum" + }, + "sub_type": { + "oneOf": [ + { + "$ref": "#/components/schemas/TornItemWeaponTypeEnum" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + } + ] + }, + "TornItemDetailsResponse": { + "required": [ + "itemdetails" + ], + "properties": { + "itemdetails": { + "$ref": "#/components/schemas/TornItemDetails" + } + }, + "type": "object" + }, "TornMerit": { "required": [ "id", diff --git a/torn-api/src/scopes.rs b/torn-api/src/scopes.rs index eae4515..9a83089 100644 --- a/torn-api/src/scopes.rs +++ b/torn-api/src/scopes.rs @@ -777,7 +777,7 @@ pub(super) mod test { async fn user_factionbalance() { let client = test_client().await; - client.user().factionbalance(|b| b).await.unwrap(); + client.user().money(|b| b).await.unwrap(); } #[tokio::test] diff --git a/torn-key-pool/Cargo.toml b/torn-key-pool/Cargo.toml index 524542c..5854903 100644 --- a/torn-key-pool/Cargo.toml +++ b/torn-key-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "torn-key-pool" -version = "2.0.0" +version = "2.1.0" edition = "2021" authors = ["Pyrit [2111649]"] license = { workspace = true } @@ -14,7 +14,7 @@ postgres = ["dep:sqlx", "dep:chrono", "dep:indoc"] tokio-runtime = ["dep:tokio", "dep:rand", "dep:tokio-stream"] [dependencies] -torn-api = { path = "../torn-api", default-features = false, version = "4.1.1" } +torn-api = { path = "../torn-api", default-features = false, version = "5.0.2" } thiserror = "2" sqlx = { version = "0.8", features = [