chore(torn-api): update schema

This commit is contained in:
pyrite 2025-05-28 19:51:32 +02:00
parent 1c9b4123c3
commit a90bcb00c4
Signed by: pyrite
GPG key ID: 7F1BA9170CD35D15
4 changed files with 178 additions and 69 deletions

2
Cargo.lock generated
View file

@ -2294,7 +2294,7 @@ dependencies = [
[[package]]
name = "torn-api"
version = "1.6.5"
version = "1.6.6"
dependencies = [
"bon",
"bytes",

View file

@ -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 }

View file

@ -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. <br>",
"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"
}
]
}
}

View file

@ -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;