From 3d80414441030f6bff033eec6fd894eaf49b2410 Mon Sep 17 00:00:00 2001 From: pyrite Date: Fri, 19 Sep 2025 13:14:04 +0200 Subject: [PATCH] chore(torn-api): version 4.2.0 --- Cargo.lock | 4 +- torn-api/Cargo.toml | 2 +- torn-api/openapi.json | 663 ++++++++++++++++++++++++++++++++++++++--- torn-api/src/scopes.rs | 14 +- 4 files changed, 626 insertions(+), 57 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 50ab1ba..38839e3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2294,7 +2294,7 @@ dependencies = [ [[package]] name = "torn-api" -version = "4.1.1" +version = "4.2.0" dependencies = [ "bon", "bytes", @@ -2329,7 +2329,7 @@ dependencies = [ [[package]] name = "torn-key-pool" -version = "1.2.0" +version = "2.0.0" dependencies = [ "chrono", "futures", diff --git a/torn-api/Cargo.toml b/torn-api/Cargo.toml index 82f3ab2..9453718 100644 --- a/torn-api/Cargo.toml +++ b/torn-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "torn-api" -version = "4.1.1" +version = "4.2.0" edition = "2021" description = "Auto-generated bindings for the v2 torn api" license = { workspace = true } diff --git a/torn-api/openapi.json b/torn-api/openapi.json index ea223e3..a51a3ec 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.1.1" + "version": "4.2.0" }, "servers": [ { @@ -120,6 +120,45 @@ "x-stability": "Stable" } }, + "/user/bars": { + "get": { + "tags": [ + "User" + ], + "summary": "Get your bars information", + "description": "Requires minimal access key.
", + "operationId": "62b16119fb11b6a4d12864987f2a7223", + "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/UserBarsResponse" + } + } + } + } + }, + "security": [ + { + "api_key": [] + } + ], + "x-stability": "Unstable" + } + }, "/user/basic": { "get": { "tags": [ @@ -288,7 +327,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/user/{id}/bounties": { @@ -465,6 +504,45 @@ "x-stability": "Unstable" } }, + "/user/cooldowns": { + "get": { + "tags": [ + "User" + ], + "summary": "Get your cooldowns information", + "description": "Requires minimal access key.
", + "operationId": "fe1a505c4c4b83c667fa9e7313045d8b", + "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/UserCooldownsResponse" + } + } + } + } + }, + "security": [ + { + "api_key": [] + } + ], + "x-stability": "Unstable" + } + }, "/user/{crimeId}/crimes": { "get": { "tags": [ @@ -549,7 +627,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/user/enlistedcars": { @@ -1492,7 +1570,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/user/jobranks": { @@ -1662,7 +1740,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/user/medals": { @@ -1830,7 +1908,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/user/newevents": { @@ -1914,6 +1992,45 @@ "x-stability": "Unstable" } }, + "/user/notifications": { + "get": { + "tags": [ + "User" + ], + "summary": "Get your notifications", + "description": "Requires minimal access key.
", + "operationId": "6c73f06efc23903e15343c95e426b7ad", + "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/UserNotificationsResponse" + } + } + } + } + }, + "security": [ + { + "api_key": [] + } + ], + "x-stability": "Unstable" + } + }, "/user/organizedcrime": { "get": { "tags": [ @@ -2238,7 +2355,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/user/{id}/properties": { @@ -2295,7 +2412,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/user/property": { @@ -2334,7 +2451,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/user/{id}/property": { @@ -2382,7 +2499,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/user/races": { @@ -2481,6 +2598,45 @@ "api_key": [] } ], + "x-stability": "Stable" + } + }, + "/user/refills": { + "get": { + "tags": [ + "User" + ], + "summary": "Get your refills information", + "description": "Requires minimal access key.
", + "operationId": "f504d71a34f5cb3398bee32d6f67ee0e", + "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/UserRefillsResponse" + } + } + } + } + }, + "security": [ + { + "api_key": [] + } + ], "x-stability": "Unstable" } }, @@ -2544,7 +2700,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/user/revives": { @@ -2697,6 +2853,84 @@ "api_key": [] } ], + "x-stability": "Stable" + } + }, + "/user/travel": { + "get": { + "tags": [ + "User" + ], + "summary": "Get your travel information", + "description": "Requires minimal access key.
", + "operationId": "b129b86b2f3902d6f875da827d0dee17", + "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/UserTravelResponse" + } + } + } + } + }, + "security": [ + { + "api_key": [] + } + ], + "x-stability": "Unstable" + } + }, + "/user/virus": { + "get": { + "tags": [ + "User" + ], + "summary": "Get your virus information", + "description": "Requires minimal access key.
", + "operationId": "5e94a9ab2363bed4a7dfdef02ce135f6", + "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/UserVirusResponse" + } + } + } + } + }, + "security": [ + { + "api_key": [] + } + ], "x-stability": "Unstable" } }, @@ -3043,6 +3277,24 @@ { "$ref": "#/components/schemas/FactionAttacksResponse" }, + { + "$ref": "#/components/schemas/UserBarsResponse" + }, + { + "$ref": "#/components/schemas/UserCooldownsResponse" + }, + { + "$ref": "#/components/schemas/UserNotificationsResponse" + }, + { + "$ref": "#/components/schemas/UserRefillsResponse" + }, + { + "$ref": "#/components/schemas/UserTravelResponse" + }, + { + "$ref": "#/components/schemas/UserVirusResponse" + }, { "$ref": "#/components/schemas/FactionAttacksFullResponse" }, @@ -3709,7 +3961,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/faction/crimes": { @@ -4124,7 +4376,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/faction/rackets": { @@ -4163,7 +4415,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/faction/{raidWarId}/raidreport": { @@ -4211,7 +4463,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/faction/raids": { @@ -4259,7 +4511,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/faction/{id}/raids": { @@ -4307,7 +4559,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/faction/rankedwars": { @@ -4514,7 +4766,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/faction/revives": { @@ -4679,7 +4931,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/faction/stats": { @@ -4718,7 +4970,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/faction/territory": { @@ -4757,7 +5009,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/faction/{id}/territory": { @@ -4805,7 +5057,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/faction/territoryownership": { @@ -4850,7 +5102,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/faction/territorywars": { @@ -4901,7 +5153,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/faction/{id}/territorywars": { @@ -4949,7 +5201,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/faction/{territoryWarId}/territorywarreport": { @@ -4997,7 +5249,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/faction/upgrades": { @@ -5036,7 +5288,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/faction/warfare": { @@ -6037,7 +6289,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/key/info": { @@ -6076,7 +6328,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/key": { @@ -6189,7 +6441,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/market/{id}/bazaar": { @@ -6237,7 +6489,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/market/{id}/itemmarket": { @@ -6297,7 +6549,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/market/{propertyTypeId}/properties": { @@ -6354,7 +6606,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/market/{propertyTypeId}/rentals": { @@ -6411,7 +6663,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/market/lookup": { @@ -7164,7 +7416,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/property/lookup": { @@ -7533,7 +7785,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/torn/factionhof": { @@ -7626,7 +7878,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/torn/honors": { @@ -8253,7 +8505,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/torn/properties": { @@ -8292,7 +8544,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/torn/{crimeId}/subcrimes": { @@ -8399,7 +8651,7 @@ "api_key": [] } ], - "x-stability": "Unstable" + "x-stability": "Stable" } }, "/torn/lookup": { @@ -8747,6 +8999,15 @@ "airliner" ] }, + "UserFlyMethodEnum": { + "type": "string", + "enum": [ + "Private", + "Business", + "Airstrip", + "Standard" + ] + }, "UserStatusStateEnum": { "type": "string", "enum": [ @@ -8904,7 +9165,8 @@ "Canada", "United Kingdom", "UAE", - "Cayman Islands" + "Cayman Islands", + "Torn" ] }, "ReportTypeEnum": { @@ -15191,6 +15453,295 @@ } ] }, + "UserVirus": { + "required": [ + "item", + "until" + ], + "properties": { + "item": { + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ItemId" + }, + "name": { + "type": "string" + } + }, + "type": "object" + }, + "until": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "UserVirusResponse": { + "required": [ + "virus" + ], + "properties": { + "virus": { + "description": "Null if the player is currently not programming a virus.", + "oneOf": [ + { + "$ref": "#/components/schemas/UserVirus" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "UserTravelResponse": { + "required": [ + "travel" + ], + "properties": { + "travel": { + "required": [ + "destination", + "method", + "departed_at", + "arrival_at", + "time_left" + ], + "properties": { + "destination": { + "$ref": "#/components/schemas/CountryEnum" + }, + "method": { + "description": "Null if the player has never flown before.", + "oneOf": [ + { + "$ref": "#/components/schemas/UserFlyMethodEnum" + }, + { + "type": "null" + } + ] + }, + "departed_at": { + "description": "Null if the player has never flown before.", + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "arrival_at": { + "description": "Null if the player has never flown before.", + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "time_left": { + "description": "Time left in seconds.", + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "UserRefillsResponse": { + "required": [ + "refills" + ], + "properties": { + "refills": { + "required": [ + "energy", + "nerve", + "token", + "special_count" + ], + "properties": { + "energy": { + "type": "boolean" + }, + "nerve": { + "type": "boolean" + }, + "token": { + "type": "boolean" + }, + "special_count": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "UserNotificationsResponse": { + "required": [ + "notifications" + ], + "properties": { + "notifications": { + "required": [ + "messages", + "events", + "awards", + "competition" + ], + "properties": { + "messages": { + "type": "integer", + "format": "int32" + }, + "events": { + "type": "integer", + "format": "int32" + }, + "awards": { + "type": "integer", + "format": "int32" + }, + "competition": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "UserCooldownsResponse": { + "required": [ + "cooldowns" + ], + "properties": { + "cooldowns": { + "required": [ + "drug", + "medical", + "booster" + ], + "properties": { + "drug": { + "type": "integer", + "format": "int32" + }, + "medical": { + "type": "integer", + "format": "int32" + }, + "booster": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "UserBar": { + "required": [ + "current", + "maximum", + "increment", + "interval", + "tick_time", + "full_time" + ], + "properties": { + "current": { + "type": "integer", + "format": "int32" + }, + "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" + }, + "UserBars": { + "required": [ + "energy", + "nerve", + "happy", + "life", + "chain" + ], + "properties": { + "energy": { + "$ref": "#/components/schemas/UserBar" + }, + "nerve": { + "$ref": "#/components/schemas/UserBar" + }, + "happy": { + "$ref": "#/components/schemas/UserBar" + }, + "life": { + "$ref": "#/components/schemas/UserBar" + }, + "chain": { + "oneOf": [ + { + "$ref": "#/components/schemas/FactionOngoingChain" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "UserBarsResponse": { + "required": [ + "bars" + ], + "properties": { + "bars": { + "$ref": "#/components/schemas/UserBars" + } + }, + "type": "object" + }, "UserNewEventsResponse": { "required": [ "events" @@ -15717,10 +16268,24 @@ "format": "int32" }, "rank": { - "$ref": "#/components/schemas/UserRankEnum" + "oneOf": [ + { + "$ref": "#/components/schemas/UserRankEnum" + }, + { + "type": "string" + } + ] }, "title": { - "$ref": "#/components/schemas/UserTitleEnum" + "oneOf": [ + { + "$ref": "#/components/schemas/UserTitleEnum" + }, + { + "type": "string" + } + ] }, "donator_status": { "oneOf": [ @@ -18077,16 +18642,18 @@ "UserSelectionName": { "oneOf": [ { - "description": "The following selections will fallback to API v1 and may change at any time: 'ammo','bars','bazaar','cooldowns','criminalrecord','discord','display','education','equipment','gym','inventory','missions','networth','notifications','perks','refills','stocks','travel','weaponexp'.", + "description": "The following selections will fallback to API v1 and may change at any time: 'ammo','bazaar','criminalrecord','discord','display','equipment','gym','inventory','missions','networth','perks','stocks','weaponexp'.", "type": "string", "enum": [ "attacks", "attacksfull", + "bars", "basic", "battlestats", "bounties", "calendar", "competition", + "cooldowns", "crimes", "enlistedcars", "events", @@ -18113,6 +18680,7 @@ "money", "newevents", "newmessages", + "notifications", "organizedcrime", "personalstats", "profile", @@ -18120,16 +18688,16 @@ "property", "races", "racingrecords", + "refills", "reports", "revives", "revivesfull", "skills", "timestamp", + "travel", "workstats", "ammo", - "bars", "bazaar", - "cooldowns", "criminalrecord", "discord", "display", @@ -18139,11 +18707,8 @@ "inventory", "missions", "networth", - "notifications", "perks", - "refills", "stocks", - "travel", "weaponexp" ] }, diff --git a/torn-api/src/scopes.rs b/torn-api/src/scopes.rs index c7ab02e..6eef90b 100644 --- a/torn-api/src/scopes.rs +++ b/torn-api/src/scopes.rs @@ -9,12 +9,14 @@ pub(super) mod test { use crate::{ executor::{ExecutorExt, ReqwestClient}, models::{ - faction_selection_name::FactionSelectionNameVariant, - user_selection_name::UserSelectionNameVariant, AttackCode, PersonalStatsCategoryEnum, - PersonalStatsStatName, UserListEnum, + faction_selection_name::FactionSelectionNameVariant, AttackCode, + PersonalStatsCategoryEnum, PersonalStatsStatName, UserListEnum, }, }; + #[cfg(feature = "strum")] + use crate::models::user_selection_name::UserSelectionNameVariant; + use super::*; static TICKETS: OnceLock>> = OnceLock::new(); @@ -499,14 +501,14 @@ pub(super) mod test { racing_scope.carupgrades(|b| b).await.unwrap(); } - /* #[tokio::test] + #[tokio::test] async fn racing_races() { let client = test_client().await; let racing_scope = RacingScope(&client); racing_scope.races(|b| b).await.unwrap(); - } */ + } #[tokio::test] async fn racing_race_for_race_id() { @@ -1144,6 +1146,8 @@ pub(super) mod test { let client = test_client().await; client.user().profile(|b| b).await.unwrap(); + + client.user().profile_for_id(4.into(), |b| b).await.unwrap(); } #[tokio::test]