diff --git a/Cargo.lock b/Cargo.lock index 58df819..99356c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2294,7 +2294,7 @@ dependencies = [ [[package]] name = "torn-api" -version = "1.6.5" +version = "1.6.6" dependencies = [ "bon", "bytes", diff --git a/torn-api/Cargo.toml b/torn-api/Cargo.toml index 2b4f0a2..262da7f 100644 --- a/torn-api/Cargo.toml +++ b/torn-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "torn-api" -version = "1.6.5" +version = "1.6.6" edition = "2021" description = "Auto-generated bindings for the v2 torn api" license-file = { workspace = true } diff --git a/torn-api/openapi.json b/torn-api/openapi.json index 2cbd3cb..88bce60 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": "1.8.0" + "version": "1.8.3" }, "servers": [ { @@ -5910,55 +5910,10 @@ "operationId": "37f1828422f3080da21f9eb4aa576686", "parameters": [ { - "$ref": "#/components/parameters/ApiOffset" - }, - { - "$ref": "#/components/parameters/ApiLimit250Default20" - }, - { - "$ref": "#/components/parameters/ApiTimestamp" - }, - { - "$ref": "#/components/parameters/ApiComment" - }, - { - "$ref": "#/components/parameters/ApiKeyPublic" - } - ], - "responses": { - "200": { - "description": "Successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TornTerritoriesResponse" - } - } - } - } - }, - "security": [ - { - "api_key": [] - } - ], - "x-stability": "Unstable" - } - }, - "/torn/{territoryIds}/territory": { - "get": { - "tags": [ - "Torn" - ], - "summary": "Get territory details", - "description": "Requires public access key.
", - "operationId": "4e528387ddb78befed57cb4c84151399", - "parameters": [ - { - "name": "territoryIds", - "in": "path", - "description": "Territory id or a list of territory ids (comma separated)", - "required": true, + "name": "ids", + "in": "query", + "description": "Specific territory id or a list of territory ids (comma separated)", + "required": false, "style": "form", "explode": false, "schema": { @@ -5968,6 +5923,12 @@ } } }, + { + "$ref": "#/components/parameters/ApiOffset" + }, + { + "$ref": "#/components/parameters/ApiLimit250Default20" + }, { "$ref": "#/components/parameters/ApiTimestamp" }, @@ -11078,7 +11039,6 @@ ] }, "Parameters": { - "type": "string", "oneOf": [ { "type": "string", @@ -13928,7 +13888,8 @@ "awards", "merits_bought", "refills", - "donator_days" + "donator_days", + "ranked_war_wins" ], "properties": { "activity": { @@ -13990,6 +13951,10 @@ "donator_days": { "type": "integer", "format": "int32" + }, + "ranked_war_wins": { + "type": "integer", + "format": "int32" } }, "type": "object" @@ -14966,20 +14931,13 @@ "properties": { "crimes": { "required": [ + "total", "version" ], "properties": { - "offenses": { - "type": "object", - "required": [ - "total" - ], - "properties": { - "total": { - "type": "integer", - "format": "int32" - } - } + "total": { + "type": "integer", + "format": "int32" }, "version": { "type": "string" @@ -20407,7 +20365,7 @@ "required": [ "item", "listings", - "timestamp" + "cache_timestamp" ], "properties": { "item": { @@ -21897,6 +21855,22 @@ "type": "null" } ] + }, + "attacker_item": { + "description": "This field only exists if the attacker is stealthed and they used a temporary item.", + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ItemId" + }, + "name": { + "type": "string" + } + }, + "type": "object" } }, "type": "object" @@ -22554,7 +22528,6 @@ "type": "array", "items": { "schema": "Parameters", - "type": "string", "oneOf": [ { "type": "string", @@ -22870,4 +22843,4 @@ "description": "Part of Torn section" } ] -} +} \ No newline at end of file diff --git a/torn-api/src/scopes.rs b/torn-api/src/scopes.rs index a3da78d..534e98b 100644 --- a/torn-api/src/scopes.rs +++ b/torn-api/src/scopes.rs @@ -11,7 +11,7 @@ pub(super) mod test { models::{ faction_selection_name::FactionSelectionNameVariant, user_selection_name::UserSelectionNameVariant, AttackCode, PersonalStatsCategoryEnum, - PersonalStatsStatName, UserListEnum, UserPersonalStatsPopular, + PersonalStatsStatName, UserListEnum, }, }; @@ -919,6 +919,7 @@ pub(super) mod test { .unwrap(); } + #[cfg(feature = "strum")] #[tokio::test] async fn user_personalstats_popular() { let client = test_client().await; @@ -938,6 +939,141 @@ pub(super) mod test { .is_user_personal_stats_popular()); } + #[cfg(feature = "strum")] + #[tokio::test] + async fn user_personalstats_all() { + let client = test_client().await; + + let resp = client + .user() + .for_selections(|b| { + b.selections([UserSelectionNameVariant::Personalstats]) + .cat(PersonalStatsCategoryEnum::All) + }) + .await + .unwrap(); + + assert!(resp + .user_personal_stats_response() + .unwrap() + .is_user_personal_stats_full()); + } + + #[cfg(feature = "strum")] + #[tokio::test] + async fn user_personalstats_cat_attacking() { + let client = test_client().await; + + let resp = client + .user() + .for_selections(|b| { + b.selections([UserSelectionNameVariant::Personalstats]) + .cat(PersonalStatsCategoryEnum::Attacking) + }) + .await + .unwrap(); + + assert!(resp + .user_personal_stats_response() + .unwrap() + .try_as_user_personal_stats_category() + .unwrap() + .personalstats + .is_personal_stats_attacking_public()); + } + + #[cfg(feature = "strum")] + #[tokio::test] + async fn user_personalstats_cat_jobs() { + let client = test_client().await; + + let resp = client + .user() + .for_selections(|b| { + b.selections([UserSelectionNameVariant::Personalstats]) + .cat(PersonalStatsCategoryEnum::Jobs) + }) + .await + .unwrap(); + + assert!(resp + .user_personal_stats_response() + .unwrap() + .try_as_user_personal_stats_category() + .unwrap() + .personalstats + .is_personal_stats_jobs_public()); + } + + #[cfg(feature = "strum")] + #[tokio::test] + async fn user_personalstats_cat_trading() { + let client = test_client().await; + + let resp = client + .user() + .for_selections(|b| { + b.selections([UserSelectionNameVariant::Personalstats]) + .cat(PersonalStatsCategoryEnum::Trading) + }) + .await + .unwrap(); + + assert!(resp + .user_personal_stats_response() + .unwrap() + .try_as_user_personal_stats_category() + .unwrap() + .personalstats + .is_personal_stats_trading()); + } + + #[cfg(feature = "strum")] + #[tokio::test] + async fn user_personalstats_cat_jail() { + let client = test_client().await; + + let resp = client + .user() + .for_selections(|b| { + b.selections([UserSelectionNameVariant::Personalstats]) + .cat(PersonalStatsCategoryEnum::Jail) + }) + .await + .unwrap(); + + assert!(resp + .user_personal_stats_response() + .unwrap() + .try_as_user_personal_stats_category() + .unwrap() + .personalstats + .is_personal_stats_jail()); + } + + #[cfg(feature = "strum")] + #[tokio::test] + async fn user_personalstats_cat_hospital() { + let client = test_client().await; + + let resp = client + .user() + .for_selections(|b| { + b.selections([UserSelectionNameVariant::Personalstats]) + .cat(PersonalStatsCategoryEnum::Hospital) + }) + .await + .unwrap(); + + assert!(resp + .user_personal_stats_response() + .unwrap() + .try_as_user_personal_stats_category() + .unwrap() + .personalstats + .is_personal_stats_hospital()); + } + #[tokio::test] async fn user_personalstats_for_id() { let client = test_client().await;