From e2c4f742425773c35f02c59939416f8acbcef010 Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:23:18 +0200 Subject: [PATCH 01/26] chore(key-pool): release version --- Cargo.lock | 2 +- torn-key-pool/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ceaf3b3..19e2230 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2304,7 +2304,7 @@ dependencies = [ [[package]] name = "torn-key-pool" -version = "1.1.1" +version = "1.1.2" dependencies = [ "chrono", "futures", diff --git a/torn-key-pool/Cargo.toml b/torn-key-pool/Cargo.toml index 28aad1a..86881da 100644 --- a/torn-key-pool/Cargo.toml +++ b/torn-key-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "torn-key-pool" -version = "1.1.1" +version = "1.1.2" edition = "2021" authors = ["Pyrit [2111649]"] license-file = { workspace = true } From 1deef2150dbc823e8a598fd579eb2be20a9f4600 Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:23:19 +0200 Subject: [PATCH 02/26] fix(codegen): fixed codegen for array path parameters --- torn-api-codegen/openapi.json | 12593 +++++++++++----------- torn-api-codegen/src/model/enum.rs | 20 - torn-api-codegen/src/model/mod.rs | 61 +- torn-api-codegen/src/model/newtype.rs | 21 - torn-api-codegen/src/model/object.rs | 4 +- torn-api-codegen/src/model/parameter.rs | 9 +- torn-api-codegen/src/model/path.rs | 15 +- torn-api/src/scopes.rs | 4 +- 8 files changed, 6393 insertions(+), 6334 deletions(-) diff --git a/torn-api-codegen/openapi.json b/torn-api-codegen/openapi.json index a6b7e07..c5ddb7a 100644 --- a/torn-api-codegen/openapi.json +++ b/torn-api-codegen/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.6.0" + "version": "1.6.1" }, "servers": [ { @@ -19,6 +19,7 @@ ], "summary": "Get your detailed attacks", "description": "Requires limited access key.
", + "operationId": "3acc98a3016974b786cb01e04e1ced04", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100" @@ -69,6 +70,7 @@ ], "summary": "Get your simplified attacks", "description": "Requires limited access key.
Returns up to 1,000 rows.
", + "operationId": "e995691fd9845c8b4a91f065ac9c8420", "parameters": [ { "$ref": "#/components/parameters/ApiLimit1000" @@ -119,6 +121,7 @@ ], "summary": "Get bounties placed on you", "description": "Requires public access key.
", + "operationId": "c85fd102a25aaec3aa98611d0da6c219", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -157,6 +160,7 @@ ], "summary": "Get bounties placed on a specific user", "description": "Requires public access key.
", + "operationId": "eb5eca5c6b978ee23ef74035c14ff4cc", "parameters": [ { "name": "id", @@ -204,6 +208,7 @@ ], "summary": "Get your competition's event start time", "description": "Requires minimal access key.
Only available to yourself.", + "operationId": "4cc4cc6fa3764f9732db9589e91d7739", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -242,6 +247,7 @@ ], "summary": "Get your crime statistics", "description": "Requires minimal access key.
Return the details and statistics about for a specific crime.", + "operationId": "37f1e394f9d6e3f6fd436fae3e9b9ac4", "parameters": [ { "name": "crimeId", @@ -289,6 +295,7 @@ ], "summary": "Get your education information", "description": "The response contains a list of complete eduactions and of a current education (if any).", + "operationId": "fddc6adc5139d8a1e0a151d80816dba7", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -327,6 +334,7 @@ ], "summary": "Get user enlisted cars", "description": "Requires minimal access key.
Returns a list of all user enlisted cars.", + "operationId": "dc3deee7629610931240be337c47a8ee", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -365,6 +373,7 @@ ], "summary": "Get your current faction balance", "description": "Requires limited access key.
", + "operationId": "b7ebbeea51dc2ef56c3ed5fd9d94e680", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -403,6 +412,7 @@ ], "summary": "Get updates on your threads and posts", "description": "Requires minimal access key.
This selection returns data visible in 'Feed' section on forum page. Feed is sorted by timestamp descending. Only a maximum of 100 rows are returned.", + "operationId": "17f99b99fac9601887dd1d001b95bb08", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -441,6 +451,7 @@ ], "summary": "Get updates on your friends' activity", "description": "Requires minimal access key.
This selection returns data visible in 'Friends' section on forum page. Feed is sorted by timestamp descending. Only a maximum of 100 rows are returned.", + "operationId": "2ceb7f08dc5f06a01d1fbe50425414c1", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -479,6 +490,7 @@ ], "summary": "Get your posts", "description": "Requires public access key.
Returns 20 posts per page.", + "operationId": "cc3a21ed98c1a80ffeeda4e33c75b9a0", "parameters": [ { "$ref": "#/components/parameters/ApiStripTagsTrue" @@ -532,6 +544,7 @@ ], "summary": "Get posts for a specific player", "description": "Requires public access key.
Returns 20 posts per page for a specific player.", + "operationId": "423ceffcad89f9ee7abfb85bed32b692", "parameters": [ { "$ref": "#/components/parameters/ApiStripTagsTrue" @@ -594,6 +607,7 @@ ], "summary": "Get updates on threads you subscribed to", "description": "Requires minimal access key.
This selection returns data visible in 'Subscribed Threads' section on forum page. Threads are sorted in the same way as on site.", + "operationId": "92c7e86065c3d18b000e825aa6688eed", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -632,6 +646,7 @@ ], "summary": "Get your threads", "description": "Requires public access key.
Returns 100 threads per page. The field 'new_posts' is also available, indicating the amount of unread posts with a Minimum API key (or higher).", + "operationId": "807adc6a64d86e07d629a15dde8c6105", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100Default20" @@ -682,6 +697,7 @@ ], "summary": "Get threads for a specific player", "description": "Requires public access key.
Returns 100 threads per page for a specific player. When requesting data for the key owner, a field 'new_posts' is also available, indicating the amount of unread posts. Minimum API key is required for that.", + "operationId": "481c6645dae298b54f0630ef7de81dba", "parameters": [ { "name": "id", @@ -741,6 +757,7 @@ ], "summary": "Get your hall of fame rankings", "description": "Requires public access key.
When requesting selection with Limited, Full or Custom key, battle_stats selection will be populated.", + "operationId": "959a3a302d736b416ec1edd4def8fe91", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -779,6 +796,7 @@ ], "summary": "Get hall of fame rankings for a specific player", "description": "Requires public access key.
The battle_stats selection will be populated only when requesting selection with Limited, Full or Custom key and for yourself.", + "operationId": "f86d41c9434e42d22f9ff46ecc4e5b88", "parameters": [ { "name": "id", @@ -826,6 +844,7 @@ ], "summary": "Get your item market listings for a specific item", "description": "Requires limited access key.
", + "operationId": "8fcbe4dcf8a3a28e31e2eaab877feea1", "parameters": [ { "$ref": "#/components/parameters/ApiOffset" @@ -867,6 +886,7 @@ ], "summary": "Get your starter job positions", "description": "Requires minimal access key.
", + "operationId": "facf1ddeef80a440229941f49aec6ccc", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -905,6 +925,7 @@ ], "summary": "Get your friends, enemies or targets list", "description": "Requires limited access key.
", + "operationId": "e93ba44fcc7ad2eb3063dec7469ee2f6", "parameters": [ { "name": "cat", @@ -961,6 +982,7 @@ ], "summary": "Get your current ongoing organized crime", "description": "Requires minimal access key.
", + "operationId": "3c6f8acbfcb398592e3f3b65ab91a40f", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -999,6 +1021,7 @@ ], "summary": "Get your personal stats", "description": "Requires public access key.
\n * UserPersonalStatsFull is returned only when this selection is requested with Limited, Full or Custom key access key.\n * UserPersonalStatsFullPublic is returned when the requested category is 'all'.\n * UserPersonalStatsPopular is returned when the requested category is 'popular'. Please try to use UserPersonalStatsPopular over UserPersonalStatsFullPublic wherever possible in order to reduce the server load.\n * Otherwise, UserPersonalStatsCategory is returned for the matched category.\n * It's possible to request specific stats via 'stat' parameter. In this case the response will vary depending on the stats requested. Private stats are still available only to the key owner (with Limited or higher key).\n * Additionally, historical stats can also be fetched via 'stat' query parameter, but 'timestamp' parameter must be provided as well. It's only possible to pass up to 10 historical stats at once (the rest is trimmed). When requesting historical stats the response will be of type UserPersonalStatsHistoric.", + "operationId": "388e8008ae1c2645819af76d71ef92a5", "parameters": [ { "name": "cat", @@ -1033,9 +1056,6 @@ "format": "int32" } }, - { - "$ref": "#/components/parameters/ApiTimestamp" - }, { "$ref": "#/components/parameters/ApiComment" }, @@ -1070,6 +1090,7 @@ ], "summary": "Get a player's personal stats", "description": "Requires public access key.
\n * UserPersonalStatsFull is returned only when this selection is requested for the key owner with Limited, Full or Custom key.\n * UserPersonalStatsFullPublic is returned when the requested category is 'all'.\n * UserPersonalStatsPopular is returned when the requested category is 'popular'. Please try to use UserPersonalStatsPopular over UserPersonalStatsFullPublic wherever possible in order to reduce the server load.\n * Otherwise, UserPersonalStatsCategory is returned for the matched category.\n * It's possible to request specific stats via 'stat' parameter. In this case the response will vary depending on the stats requested. Private stats are still available only to the key owner (with Limited or higher key).\n * Additionally, historical stats can also be fetched via 'stat' query parameter, but 'timestamp' parameter must be provided as well. It's only possible to pass up to 10 historical stats at once (the rest is trimmed). When requesting historical stats the response will be of type UserPersonalStatsHistoric.", + "operationId": "6ac851069df2c33e53cc69eecae44f1e", "parameters": [ { "name": "id", @@ -1113,9 +1134,6 @@ "format": "int32" } }, - { - "$ref": "#/components/parameters/ApiTimestamp" - }, { "$ref": "#/components/parameters/ApiComment" }, @@ -1150,6 +1168,7 @@ ], "summary": "Get user races", "description": "Requires minimal access key.
Returns a list of user races, ordered by race start timestamp.", + "operationId": "ba6e495bf0c6b2e87db337c1a09f4852", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100Default20" @@ -1214,6 +1233,7 @@ ], "summary": "Get your detailed revives", "description": "Requires limited access key.
", + "operationId": "3c847eb1325040798f37a7492108e094", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100Default20" @@ -1267,6 +1287,7 @@ ], "summary": "Get your simplified revives", "description": "Requires limited access key.
", + "operationId": "8820cd889afde899353037ca5a0f9a07", "parameters": [ { "$ref": "#/components/parameters/ApiLimit1000Default20" @@ -1320,6 +1341,7 @@ ], "summary": "Get all available user selections", "description": "Requires public access key.
", + "operationId": "c0a6c91697cd1683c39b3c0649a18ec8", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -1358,6 +1380,7 @@ ], "summary": "Get current server time", "description": "Requires public access key.
", + "operationId": "a72308321da0c4a2c31c60218acc7a85", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -1396,6 +1419,7 @@ ], "summary": "Get any User selection", "description": "Key access level depends on the required selections.
Choose one or more selections (comma separated).", + "operationId": "ce480599312126b8a5d77ced3ab8caa8", "parameters": [ { "name": "selections", @@ -1566,6 +1590,7 @@ ], "summary": "Get your faction's applications", "description": "Requires minimal access key with faction API access permissions.
", + "operationId": "9f7dccb023d81a8da7f5f6a359658a64", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -1604,6 +1629,7 @@ ], "summary": "Get your faction's detailed attacks", "description": "Requires limited access key with faction API access permissions.
", + "operationId": "cb5b38ba64c389e706526df8bc8af9b6", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100" @@ -1654,6 +1680,7 @@ ], "summary": "Get your faction's simplified attacks", "description": "Requires limited access key with faction API access permissions.
", + "operationId": "8551280aaaf9819aa94be5c469a523de", "parameters": [ { "$ref": "#/components/parameters/ApiLimit1000" @@ -1704,6 +1731,7 @@ ], "summary": "Get your faction's & member's balance details", "description": "Requires limited access key with faction API access permissions.
", + "operationId": "3ca2c0319f960b728ffece8e322cf40f", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -1742,6 +1770,7 @@ ], "summary": "Get your faction's basic details", "description": "Requires public access key.
The 'is_enlisted' value will be populated if you have API faction permissions (with custom, limited or full access keys), otherwise it will be set as null.", + "operationId": "fb363bf0e1d54296bd4d5dd554ad9825", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -1780,6 +1809,7 @@ ], "summary": "Get a faction's basic details", "description": "Requires public access key.
The 'is_enlisted' value will be populated if you're requesting data for your faction and have faction permissions (with custom, limited or full access keys), otherwise it will be set as null.", + "operationId": "a09da2d5f951a49d974dbec3149b3a24", "parameters": [ { "name": "id", @@ -1827,6 +1857,7 @@ ], "summary": "Get your faction's current chain", "description": "Requires public access key.
", + "operationId": "aee5679a81c6a7bcd3862c0aafd6b558", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -1865,6 +1896,7 @@ ], "summary": "Get a faction's current chain", "description": "Requires public access key.
", + "operationId": "ec8f82e15a321adbb20e615024d9dff6", "parameters": [ { "name": "id", @@ -1912,6 +1944,7 @@ ], "summary": "Get a list of your faction's completed chains", "description": "Requires public access key.
", + "operationId": "dfc0adb55af4aeeeebc2d82309c71eea", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100" @@ -1962,6 +1995,7 @@ ], "summary": "Get a list of a faction's completed chains", "description": "Requires public access key.
", + "operationId": "dd88ca1ffafed80457916da5298a3422", "parameters": [ { "name": "id", @@ -2021,6 +2055,7 @@ ], "summary": "Get your faction's latest chain report", "description": "Requires public access key.
This includes currently ongoing chains.", + "operationId": "614a2f2bdd7fb6df778b7657c75d1113", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -2059,6 +2094,7 @@ ], "summary": "Get a chain report", "description": "Requires public access key.
Chain reports for ongoing chains are available only for your own faction.", + "operationId": "21a251c2ec9f6c93b89fb715196bb8be", "parameters": [ { "name": "chainId", @@ -2106,6 +2142,7 @@ ], "summary": "Get your faction's challenge contributors", "description": "Requires limiteed access key with faction API access permissions.
", + "operationId": "40eb7627818eb777fdc713ed78209c6b", "parameters": [ { "name": "stat", @@ -2166,6 +2203,7 @@ ], "summary": "Get your faction's organized crimes", "description": "Requires minimal access key with faction API access permissions.
It's possible to get older entries either by timestamp range (from, to) or with offset.", + "operationId": "72e5db8a773908fedff4bb002f3f4406", "parameters": [ { "name": "cat", @@ -2235,6 +2273,7 @@ ], "summary": "Get a specific organized crime", "description": "Requires minimal access key with faction API access permissions.
", + "operationId": "b4867db9b02fa7dcd31b2073f2a936ce", "parameters": [ { "name": "crimeId", @@ -2282,6 +2321,7 @@ ], "summary": "Get your faction's hall of fame rankings.", "description": "Requires public access key.
", + "operationId": "e104b0b606664d06d9638111702301f3", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -2320,6 +2360,7 @@ ], "summary": "Get a faction's hall of fame rankings.", "description": "Requires public access key.
", + "operationId": "a775ca7831f4cad88c308be28f50e597", "parameters": [ { "name": "id", @@ -2367,6 +2408,7 @@ ], "summary": "Get a list of your faction's members", "description": "Requires public access key.
The 'revive_setting' value will be populated (not Unknown) if you have faction permissions (with custom, limited or full access keys), otherwise it will be set as 'Unknown'.", + "operationId": "03d304564e4f84e3f258e5b8059bcc22", "parameters": [ { "$ref": "#/components/parameters/ApiStripTagsTrue" @@ -2408,6 +2450,7 @@ ], "summary": "Get a list of a faction's members", "description": "Requires public access key.
The 'revive_setting' value will be populated (not Unknown) if you're requesting data for your own faction and have faction permissions (with custom, limited or full access keys), otherwise it will be set as 'Unknown'.", + "operationId": "99a899c0094645475fd6254b423fea43", "parameters": [ { "name": "id", @@ -2458,6 +2501,7 @@ ], "summary": "Get your faction's news details", "description": "Requires minimal access key with faction API access permissions.
It is possible to pass up to 10 categories at the time (comma separated). Categories 'attack', 'depositFunds' and 'giveFunds' are only available with 'Custom', 'Limited' or 'Full' access keys.", + "operationId": "1da64889366de71140f2c15ad14b67b1", "parameters": [ { "$ref": "#/components/parameters/ApiStripTagsFalse" @@ -2520,6 +2564,7 @@ ], "summary": "Get your faction's positions details", "description": "Requires minimal access key with faction API access permissions.
", + "operationId": "77dae3b930e2e2f9f7608567db0b94f4", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -2558,6 +2603,7 @@ ], "summary": "Get a list of current rackets", "description": "Requires public access key.
", + "operationId": "f750d219e54329ae300c4db384dd5dcd", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -2596,6 +2642,7 @@ ], "summary": "Get ranked wars list", "description": "Requires public access key.
When category 'all' is chosen, you can use 'from', 'to' & 'sort' query parameters.
When category 'ongoing' is chosen, all currently active ranked wars are returned.
When no category is chosen, this selection will return ranked war history of your own faction (if any).", + "operationId": "4f5d624a86e2d389a7a738b6b3ce8c9e", "parameters": [ { "name": "cat", @@ -2651,6 +2698,7 @@ ], "summary": "Get a faction's ranked wars history", "description": "Requires public access key.
", + "operationId": "5b6646714e5ae1cc397bdec877f55691", "parameters": [ { "name": "id", @@ -2698,6 +2746,7 @@ ], "summary": "Get ranked war details", "description": "Requires public access key.
", + "operationId": "db49842d88e193777dc695e54769113e", "parameters": [ { "name": "rankedWarId", @@ -2745,6 +2794,7 @@ ], "summary": "Get your faction's detailed revives", "description": "Requires limited access key with faction API access permissions.
", + "operationId": "486fcda26ed1aa6aba8ec7091080723b", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100" @@ -2798,6 +2848,7 @@ ], "summary": "Get your faction's simplified revives", "description": "Requires limited access key with faction API access permissions.
", + "operationId": "f17a4064779e8de5200238816c233c02", "parameters": [ { "$ref": "#/components/parameters/ApiLimit1000" @@ -2851,6 +2902,7 @@ ], "summary": "Get your faction's challenges stats", "description": "Requires minimal access key with faction API access permissions.
", + "operationId": "806d9dc7e5fcf9e1ee9c3cdf7f035392", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -2889,6 +2941,7 @@ ], "summary": "Get a list of your faction's territories", "description": "Requires public access key.
", + "operationId": "fa6b3fbb14e5f3a71279b058bd751754", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -2927,6 +2980,7 @@ ], "summary": "Get a list of a faction's territories", "description": "Requires public access key.
", + "operationId": "4dce518364dad91fb3503e0382adfadf", "parameters": [ { "name": "id", @@ -2974,6 +3028,7 @@ ], "summary": "Get a list of your faction's territories", "description": "Requires public access key.
", + "operationId": "bf56fb8aba4d6810e9b96402e25b931d", "parameters": [ { "$ref": "#/components/parameters/ApiOffset" @@ -3018,6 +3073,7 @@ ], "summary": "Get territory wars list", "description": "Requires public access key.
When category 'finished' is chosen, you can use 'from', 'to' & 'sort' query parameters.
When category 'ongoing' is chosen, all currently active territory wars are returned.
When no category is chosen, this selection will return territory war history of your own faction (if any).", + "operationId": "0258963246159d1e3e54547c32aac7c8", "parameters": [ { "name": "cat", @@ -3076,6 +3132,7 @@ ], "summary": "Get a faction's territory wars history", "description": "Requires public access key.
", + "operationId": "76ce672d50a66fc0a832f9088e5436af", "parameters": [ { "name": "id", @@ -3123,6 +3180,7 @@ ], "summary": "Get territory war details", "description": "Requires public access key.
", + "operationId": "4e8aeafde7b5fc9918d166cda150fa91", "parameters": [ { "name": "territoryWarId", @@ -3170,6 +3228,7 @@ ], "summary": "Get your faction's upgrades", "description": "Requires minimal access key with faction API access permissions.
", + "operationId": "959f415abf48cb753414cec179b1b039", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -3208,6 +3267,7 @@ ], "summary": "Get your faction's wars & pacts details", "description": "Requires public access key.
", + "operationId": "b31cce9916e77431c08822844a0dbf2b", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -3246,6 +3306,7 @@ ], "summary": "Get a faction's wars & pacts details", "description": "Requires public access key.
", + "operationId": "c370823454d5ea28fc0df9a5b6a24c54", "parameters": [ { "name": "id", @@ -3292,6 +3353,7 @@ "Faction" ], "description": "Requires public access key.
", + "operationId": "065bcbaa654fc44ce7b8ea574b84f7b9", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -3330,6 +3392,7 @@ ], "summary": "Get current server time", "description": "Requires public access key.
", + "operationId": "627df4d7d8b91c62dacb66ff373aab5c", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -3368,6 +3431,7 @@ ], "summary": "Get any Faction selection", "description": "Key access level depends on the required selections.
Choose one or more selections (comma separated).", + "operationId": "dd89e28b1f1ed88853b09ecc982e4e66", "parameters": [ { "name": "selections", @@ -3556,6 +3620,7 @@ ], "summary": "Get publicly available forum categories", "description": "Requires public access key.
", + "operationId": "79b21191b87da275f3b87a7a1a233d04", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -3594,6 +3659,7 @@ ], "summary": "Get specific forum thread posts", "description": "Requires public access key.
Returns 20 posts per page for a specific thread.", + "operationId": "9c5eeb1aebb102b7c62fab11974c359a", "parameters": [ { "$ref": "#/components/parameters/ApiOffsetNoDefault" @@ -3647,6 +3713,7 @@ ], "summary": "Get specific thread details", "description": "Requires public access key.
Contains details of a thread including topic content and poll (if any).", + "operationId": "a4618a3901c01413c14b75e984495a9b", "parameters": [ { "name": "threadId", @@ -3694,6 +3761,7 @@ ], "summary": "Get threads across all forum categories", "description": "Requires public access key.
", + "operationId": "d2d64a69cedfdce19a50eff117e2c166", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100" @@ -3744,6 +3812,7 @@ ], "summary": "Get threads for specific public forum category or categories", "description": "Requires public access key.
", + "operationId": "715cb3a4df0a9bf8094a53dc3259b633", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100" @@ -3762,10 +3831,13 @@ "in": "path", "description": "Category id or a list of category ids (comma separated)", "required": true, - "style": "simple", + "style": "form", "explode": false, "schema": { - "type": "string" + "type": "array", + "items": { + "$ref": "#/components/schemas/ForumId" + } } }, { @@ -3805,6 +3877,7 @@ ], "summary": "Get all available forum selections", "description": "Requires public access key.
", + "operationId": "f0805d0b7ad26c62ddd2fa8d0d332ba4", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -3843,6 +3916,7 @@ ], "summary": "Get current server time", "description": "Requires public access key.
", + "operationId": "ec72c2a8cd96c88e4d228221bf6bf42f", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -3881,6 +3955,7 @@ ], "summary": "Get any Forum selection", "description": "Requires public access key.
Choose one or more selections (comma separated).", + "operationId": "21915cf0228ce3677261cdce27fb39e2", "parameters": [ { "name": "selections", @@ -3988,6 +4063,7 @@ ], "summary": "Get current key log history", "description": "Available for any key.
\n * This selection contains up to last 250 request logs.", + "operationId": "0d6dae59c9b3419c18d2a4ca0da757e6", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100" @@ -4032,6 +4108,7 @@ ], "summary": "Get current key info", "description": "Available for any key.
", + "operationId": "e6d387f16971004628eeca2d6473f825", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -4069,6 +4146,7 @@ "Key" ], "summary": "Get any Key selection", + "operationId": "c6ccbb0a05ebf3b307c82a4c89275e52", "parameters": [ { "name": "selections", @@ -4134,6 +4212,7 @@ ], "summary": "Get item market listings", "description": "Requires public access key.
", + "operationId": "f535a33bf405e7bd60918e536f827e5c", "parameters": [ { "name": "id", @@ -4193,6 +4272,7 @@ ], "summary": "Get all available market selections", "description": "Requires public access key.
", + "operationId": "22a00095ad734485b6dacdc12c1f62ff", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -4231,6 +4311,7 @@ ], "summary": "Get current server time", "description": "Requires public access key.
", + "operationId": "ad0c908328835d9672d157fe84eac884", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -4269,6 +4350,7 @@ ], "summary": "Get any Market selection", "description": "Requires public access key.
Choose one or more selections (comma separated).", + "operationId": "8e78be3fa3d353f59f8654fcc1c2199c", "parameters": [ { "name": "selections", @@ -4374,6 +4456,7 @@ ], "summary": "Get cars and their racing stats", "description": "Requires public access key.
Returns the stat details about racing cars.", + "operationId": "ab5b44b00bf70d7a8587a3c2c9deeb17", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -4412,6 +4495,7 @@ ], "summary": "Get all possible car upgrades", "description": "Requires public access key.
Returns the details about all possible car upgrades.", + "operationId": "c9e76cf48aa3c4bac4c8b33f1c0c9a17", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -4450,6 +4534,7 @@ ], "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" @@ -4514,6 +4599,7 @@ ], "summary": "Get specific race details", "description": "Requires public access key.
Returns the details of a race.", + "operationId": "76925256951bb63fd28534c8c479b27b", "parameters": [ { "name": "raceId", @@ -4561,6 +4647,7 @@ ], "summary": "Get track records", "description": "Requires public access key.
Returns a list of 10 best lap records for the chosen track and car class. Results are cached globally 1 hour.", + "operationId": "5fbc62db3b9380b155d7e33100620da7", "parameters": [ { "name": "trackId", @@ -4617,6 +4704,7 @@ ], "summary": "Get race tracks and descriptions", "description": "Requires public access key.
Returns the details about racing tracks.", + "operationId": "6e4507cc442d6f099d0170b78a35bf8d", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -4655,6 +4743,7 @@ ], "summary": "Get all available racing selections", "description": "Requires public access key.
", + "operationId": "8bd16be9aa517fedf717c9a79ff47e2c", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -4693,6 +4782,7 @@ ], "summary": "Get current server time", "description": "Requires public access key.
", + "operationId": "eb1ae216aa2949a8db0702df474d174c", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -4731,6 +4821,7 @@ ], "summary": "Get any Racing selection", "description": "Requires public access key.
Choose one or more selections (comma separated).", + "operationId": "39b8ce36e3fffc9e2aa1d0aed9ebccda", "parameters": [ { "name": "selections", @@ -4841,6 +4932,7 @@ ], "summary": "Get attack log details", "description": "Requires public key.
", + "operationId": "61c2d0bc6980cf8d730fe48eb81f417b", "parameters": [ { "name": "log", @@ -4897,6 +4989,7 @@ ], "summary": "Get bounties", "description": "Requires public key.
", + "operationId": "279e811630fa497fb2cae268c70992e2", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100" @@ -4941,6 +5034,7 @@ ], "summary": "Get calendar information", "description": "Requires public access key.
Get the details about competitions & events in the running year.", + "operationId": "e95c96ef528248341647a5704630320e", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -4979,6 +5073,7 @@ ], "summary": "Get crimes information", "description": "Requires public access key.
Return the details about released crimes.", + "operationId": "b73ff4e5a9dd28905060da24ca76efde", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -5017,6 +5112,7 @@ ], "summary": "Get education information", "description": "Requires public access key.
", + "operationId": "992f8b71435ca78ba96f1e5298c25152", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -5055,6 +5151,7 @@ ], "summary": "Get faction hall of fame positions for a specific category", "description": "Requires public access key.
", + "operationId": "2a67e4b84813ee97a398be48e544abf5", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100" @@ -5108,6 +5205,7 @@ ], "summary": "Get full faction tree", "description": "Requires public access key.
", + "operationId": "f45431b364546bb20b0ca909e9ac686e", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -5146,6 +5244,7 @@ ], "summary": "Get player hall of fame positions for a specific category", "description": "Requires public key.", + "operationId": "911d56b49218cef2102be3de73f82f01", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100" @@ -5199,6 +5298,7 @@ ], "summary": "Get information about ammo", "description": "Requires public key.", + "operationId": "2e799e84fcfa9b722f856e859df909f8", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -5237,6 +5337,7 @@ ], "summary": "Get information about weapon upgrades", "description": "Requires public key.", + "operationId": "80ad6ebd50b6c075427c04d2f54d7af5", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -5275,6 +5376,7 @@ ], "summary": "Get information about items", "description": "Requires public key.
Default category is 'All'.
Details are not populated when requesting the category 'All'.", + "operationId": "0f4c4c07e1dfacbda689b2a0d62ccda4", "parameters": [ { "name": "cat", @@ -5325,16 +5427,20 @@ ], "summary": "Get information about items", "description": "Requires public key.
Details are always populated when available.", + "operationId": "a4fedadcac3aada40131288e4e3d6c2d", "parameters": [ { "name": "ids", "in": "path", "description": "Item id or a list of item ids (comma separated)", "required": true, - "style": "simple", + "style": "form", "explode": false, "schema": { - "type": "string" + "type": "array", + "items": { + "$ref": "#/components/schemas/ItemId" + } } }, { @@ -5377,6 +5483,7 @@ ], "summary": "Get available log categories", "description": "Requires public key.
", + "operationId": "2f68d7e04d218e26005be3eeca6de583", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -5415,6 +5522,7 @@ ], "summary": "Get all available log ids", "description": "Requires public key.
", + "operationId": "d4cb87bc2502a517c49525b910a6dd82", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -5453,6 +5561,7 @@ ], "summary": "Get available log ids for a specific log category", "description": "Requires public key.
", + "operationId": "7be904fbcb98a7bb724f0c5b02a37a25", "parameters": [ { "name": "logCategoryId", @@ -5500,6 +5609,7 @@ ], "summary": "Get Subcrimes information", "description": "Requires public access key.
Return the details about possible actions for a specific crime.", + "operationId": "ad45b0f57a1109977f605581fc294bda", "parameters": [ { "name": "crimeId", @@ -5547,6 +5657,7 @@ ], "summary": "Get territory details", "description": "Requires public access key.
", + "operationId": "37f1828422f3080da21f9eb4aa576686", "parameters": [ { "$ref": "#/components/parameters/ApiOffset" @@ -5591,16 +5702,20 @@ ], "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, - "style": "simple", + "style": "form", "explode": false, "schema": { - "$ref": "#/components/schemas/FactionTerritoryEnum" + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryEnum" + } } }, { @@ -5640,6 +5755,7 @@ ], "summary": "Get all available torn selections", "description": "Requires public key.
", + "operationId": "2baae03f953cd57fd5303dd1d04efae0", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -5678,6 +5794,7 @@ ], "summary": "Get current server time", "description": "Requires public key.
", + "operationId": "6f8cffcdae9fe97110b8d46c3991f109", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -5716,6 +5833,7 @@ ], "summary": "Get any Torn selection", "description": "Requires public access key.
Choose one or more selections (comma separated).", + "operationId": "1846c4cf1e6878553e36571dc9cac29f", "parameters": [ { "name": "selections", @@ -11332,1979 +11450,38 @@ }, "type": "object" }, - "FactionTerritoryWarFinishedFaction": { + "UserCurrentEducation": { "required": [ "id", - "name", - "score", - "is_aggressor" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionId" - }, - "name": { - "type": "string" - }, - "score": { - "type": "integer", - "format": "int32" - }, - "is_aggressor": { - "type": "boolean" - } - }, - "type": "object" - }, - "FactionTerritoryWarFinished": { - "required": [ - "id", - "territory", - "start", - "end", - "target", - "result", - "factions" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/TerritoryWarId" - }, - "territory": { - "$ref": "#/components/schemas/FactionTerritoryEnum" - }, - "start": { - "type": "integer", - "format": "int64" - }, - "end": { - "type": "integer", - "format": "int64" - }, - "target": { - "type": "integer", - "format": "int32" - }, - "result": { - "$ref": "#/components/schemas/FactionTerritoryWarResultEnum" - }, - "factions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryWarFinishedFaction" - } - } - }, - "type": "object" - }, - "FactionTerritoryWarOngoingFaction": { - "required": [ - "id", - "name", - "score", - "is_aggressor", - "chain", - "playerIds" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionId" - }, - "name": { - "type": "string" - }, - "score": { - "type": "integer", - "format": "int32" - }, - "is_aggressor": { - "type": "boolean" - }, - "chain": { - "type": "integer", - "format": "int32" - }, - "playerIds": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserId" - } - } - }, - "type": "object" - }, - "FactionTerritoryWarOngoing": { - "required": [ - "id", - "territory", - "start", - "end", - "target", - "factions" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/TerritoryWarId" - }, - "territory": { - "$ref": "#/components/schemas/FactionTerritoryEnum" - }, - "start": { - "type": "integer", - "format": "int32" - }, - "end": { - "type": "integer", - "format": "int32" - }, - "target": { - "type": "integer", - "format": "int32" - }, - "factions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryWarOngoingFaction" - } - } - }, - "type": "object" - }, - "FactionTerritoryWarsResponse": { - "required": [ - "territorywars" - ], - "properties": { - "territorywars": { - "description": "If the chosen category is 'ongoing' the response will be of 'FactionTerritoryWarOngoing' type, otherwise, the type will be 'FactionTerritoryWarFinished'.", - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryWarOngoing" - } - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryWarFinished" - } - } - ] - } - }, - "type": "object" - }, - "FactionTerritoryWarsHistoryResponse": { - "required": [ - "territorywars" - ], - "properties": { - "territorywars": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryWarFinished" - } - } - }, - "type": "object" - }, - "FactionTerritoryWarReportMembers": { - "required": [ - "id", - "username", - "level", - "score", - "joins", - "clears" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "username": { - "type": "string" - }, - "level": { - "type": "integer", - "format": "int32" - }, - "score": { - "type": "integer", - "format": "int32" - }, - "joins": { - "type": "integer", - "format": "int32" - }, - "clears": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionTerritoryWarReportFaction": { - "required": [ - "id", - "name", - "score", - "joins", - "clears", - "is_aggressor", - "members" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionId" - }, - "name": { - "type": "string" - }, - "score": { - "type": "integer", - "format": "int32" - }, - "joins": { - "type": "integer", - "format": "int32" - }, - "clears": { - "type": "integer", - "format": "int32" - }, - "is_aggressor": { - "type": "boolean" - }, - "members": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryWarReportMembers" - } - } - }, - "type": "object" - }, - "FactionTerritoryWarReport": { - "required": [ - "id", - "territory", - "started_at", - "ended_at", - "winner", - "result", - "factions" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/TerritoryWarId" - }, - "territory": { - "$ref": "#/components/schemas/FactionTerritoryEnum" - }, - "started_at": { - "type": "integer", - "format": "int32" - }, - "ended_at": { - "type": "integer", - "format": "int32" - }, - "winner": { - "$ref": "#/components/schemas/FactionId" - }, - "result": { - "type": "string" - }, - "factions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryWarReportFaction" - } - } - }, - "type": "object" - }, - "FactionTerritoryWarReportResponse": { - "required": [ - "territorywarreport" - ], - "properties": { - "territorywarreport": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryWarReport" - } - } - }, - "type": "object" - }, - "FactionTerritoryOwnership": { - "required": [ - "id", - "owned_by", - "acquired_at" - ], - "properties": { - "id": { - "type": "string" - }, - "owned_by": { - "oneOf": [ - { - "$ref": "#/components/schemas/FactionId" - }, - { - "type": "null" - } - ] - }, - "acquired_at": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "FactionTerritoriesOwnershipResponse": { - "required": [ - "territoryownership" - ], - "properties": { - "territoryownership": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryOwnership" - } - } - }, - "type": "object" - }, - "TornRacketReward": { - "required": [ - "type", - "quantity", - "id" - ], - "properties": { - "type": { - "$ref": "#/components/schemas/TornRacketType" - }, - "quantity": { - "type": "integer", - "format": "int32" - }, - "id": { - "oneOf": [ - { - "$ref": "#/components/schemas/ItemId" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "TornRacket": { - "required": [ - "name", - "level", - "description", - "reward", - "created_at", - "changed_at" - ], - "properties": { - "name": { - "type": "string" - }, - "level": { - "type": "integer", - "format": "int32" - }, - "description": { - "type": "string" - }, - "reward": { - "$ref": "#/components/schemas/TornRacketReward" - }, - "created_at": { - "type": "integer", - "format": "int32" - }, - "changed_at": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionRacketsReponse": { - "required": [ - "rackets" - ], - "properties": { - "rackets": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornRacket" - } - } - }, - "type": "object" - }, - "FactionTerritory": { - "required": [ - "id", - "acquired_at", - "sector", - "size", - "density", - "slots", - "respect", - "coordinates", - "racket" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionTerritoryEnum" - }, - "acquired_at": { - "type": "integer", - "format": "int32" - }, - "sector": { - "type": "integer", - "format": "int32" - }, - "size": { - "type": "integer", - "format": "int32" - }, - "density": { - "type": "integer", - "format": "int32" - }, - "slots": { - "type": "integer", - "format": "int32" - }, - "respect": { - "type": "integer", - "format": "int32" - }, - "coordinates": { - "$ref": "#/components/schemas/TornTerritoryCoordinates" - }, - "racket": { - "oneOf": [ - { - "$ref": "#/components/schemas/TornRacket" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "FactionTerritoriesReponse": { - "required": [ - "territory" - ], - "properties": { - "territory": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritory" - } - } - }, - "type": "object" - }, - "FactionPosition": { - "required": [ - "name", - "is_default", - "abilities" - ], - "properties": { - "name": { - "type": "string" - }, - "is_default": { - "type": "boolean" - }, - "abilities": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionPositionAbilityEnum" - } - } - }, - "type": "object" - }, - "FactionPositionsResponse": { - "required": [ - "positions" - ], - "properties": { - "positions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionPosition" - } - } - }, - "type": "object" - }, - "FactionUpgradeDetails": { - "required": [ - "id", - "name", - "ability", - "level", - "cost", - "unlockedAt" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionBranchId" - }, - "name": { - "type": "string" - }, - "ability": { - "type": "string" - }, - "level": { - "type": "integer", - "format": "int32" - }, - "cost": { - "type": "integer", - "format": "int32" - }, - "unlocked_at": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionBranchDetails": { - "required": [ - "name", - "order", - "multiplier", - "upgrades" - ], - "properties": { - "name": { - "type": "string" - }, - "order": { - "type": "integer", - "format": "int32" - }, - "multiplier": { - "description": "Respect cost multiplier.", - "type": "integer", - "format": "int32" - }, - "upgrades": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionUpgradeDetails" - } - } - }, - "type": "object" - }, - "FactionUpgrades": { - "required": [ - "core", - "peace", - "war" - ], - "properties": { - "core": { - "properties": { - "upgrades": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionUpgradeDetails" - } - } - }, - "type": "object" - }, - "peace": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionBranchDetails" - } - }, - "war": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionBranchDetails" - } - } - }, - "type": "object" - }, - "FactionUpgradesResponse": { - "required": [ - "upgrades", - "state" - ], - "properties": { - "upgrades": { - "$ref": "#/components/schemas/FactionUpgrades" - }, - "state": { - "$ref": "#/components/schemas/FactionBranchStateEnum" - } - }, - "type": "object" - }, - "FactionStat": { - "required": [ - "name", - "value" - ], - "properties": { - "name": { - "$ref": "#/components/schemas/FactionStatEnum" - }, - "value": { - "type": "integer", - "format": "int64" - } - }, - "type": "object" - }, - "FactionStatsResponse": { - "required": [ - "stats" - ], - "properties": { - "stats": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionStat" - } - } - }, - "type": "object" - }, - "FactionContributor": { - "required": [ - "id", - "username", - "value", - "in_faction" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "username": { - "type": "string" - }, - "value": { - "type": "integer", - "format": "int64" - }, - "in_faction": { - "type": "boolean" - } - }, - "type": "object" - }, - "FactionContributorsResponse": { - "required": [ - "contributors" - ], - "properties": { - "contributors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionContributor" - } - } - }, - "type": "object" - }, - "FactionHofStats": { - "required": [ - "rank", - "respect", - "chain" - ], - "properties": { - "rank": { - "$ref": "#/components/schemas/HofValueString" - }, - "respect": { - "$ref": "#/components/schemas/HofValue" - }, - "chain": { - "$ref": "#/components/schemas/HofValue" - } - }, - "type": "object" - }, - "FactionHofResponse": { - "required": [ - "hof" - ], - "properties": { - "hof": { - "$ref": "#/components/schemas/FactionHofStats" - } - }, - "type": "object" - }, - "FactionMember": { - "description": "Details about a faction member.", - "required": [ - "id", - "name", - "position", - "level", - "days_in_faction", - "is_revivable", - "is_on_wall", - "is_in_oc", - "has_early_discharge", - "last_action", - "status", - "revive_setting" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "name": { - "type": "string" - }, - "position": { - "type": "string" - }, - "level": { - "type": "integer", - "format": "int32" - }, - "days_in_faction": { - "type": "integer", - "format": "int32" - }, - "is_revivable": { - "type": "boolean" - }, - "is_on_wall": { - "description": "Shows if the member is currently defending territory wall.", - "type": "boolean" - }, - "is_in_oc": { - "description": "Shows if the member is currently participating in an organized crime. Show false for members of other factions.", - "type": "boolean" - }, - "has_early_discharge": { - "description": "Shows if the member is eligible for an early discharge from the hospital.", - "type": "boolean" - }, - "last_action": { - "$ref": "#/components/schemas/UserLastAction" - }, - "status": { - "$ref": "#/components/schemas/UserStatus" - }, - "revive_setting": { - "$ref": "#/components/schemas/ReviveSetting" - } - }, - "type": "object" - }, - "UserLastAction": { - "description": "Details about a user's last action.", - "required": [ - "status", - "timestamp", - "relative" - ], - "properties": { - "status": { - "type": "string" - }, - "timestamp": { - "type": "integer", - "format": "int32" - }, - "relative": { - "type": "string" - } - }, - "type": "object" - }, - "UserStatus": { - "description": "Details about a user's status.", - "required": [ - "description", - "details", - "state", "until" ], "properties": { - "description": { - "type": "string" - }, - "details": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "state": { - "type": "string" + "id": { + "$ref": "#/components/schemas/EducationId" }, "until": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] + "type": "integer", + "format": "int32" } }, "type": "object" }, - "FactionMembersResponse": { + "UserEducation": { "required": [ - "members" + "complete", + "current" ], "properties": { - "members": { + "complete": { "type": "array", "items": { - "$ref": "#/components/schemas/FactionMember" + "$ref": "#/components/schemas/EducationId" } - } - }, - "type": "object" - }, - "FactionRank": { - "required": [ - "level", - "name", - "division", - "position", - "wins" - ], - "properties": { - "level": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - }, - "division": { - "type": "integer", - "format": "int32" - }, - "position": { - "type": "integer", - "format": "int32" - }, - "wins": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionBasic": { - "required": [ - "id", - "name", - "tag", - "tag_image", - "leader_id", - "co_leader_id", - "respect", - "days_old", - "capacity", - "members", - "is_enlisted", - "rank", - "best_chain" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionId" - }, - "name": { - "type": "string" - }, - "tag": { - "type": "string" - }, - "tag_image": { - "type": "string" - }, - "leader_id": { - "$ref": "#/components/schemas/UserId" - }, - "co-leader_id": { - "$ref": "#/components/schemas/UserId" - }, - "co_leader_id": { - "$ref": "#/components/schemas/UserId" - }, - "respect": { - "type": "integer", - "format": "int32" - }, - "days_old": { - "type": "integer", - "format": "int32" - }, - "capacity": { - "type": "integer", - "format": "int32" - }, - "members": { - "type": "integer", - "format": "int32" - }, - "is_enlisted": { - "description": "Indicates if the faction is enlisted for ranked wars. Available only with faction AA permissions for your own faction.", - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ] - }, - "rank": { - "$ref": "#/components/schemas/FactionRank" - }, - "best_chain": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionBasicResponse": { - "required": [ - "basic" - ], - "properties": { - "basic": { - "$ref": "#/components/schemas/FactionBasic" - } - }, - "type": "object" - }, - "FactionPact": { - "required": [ - "faction_id", - "faction_name", - "until" - ], - "properties": { - "faction_id": { - "$ref": "#/components/schemas/FactionId" - }, - "faction_name": { - "type": "string" - }, - "until": { - "description": "The duration until when is the non-aggression pact valid.", - "type": "string" - } - }, - "type": "object" - }, - "FactionRankedWarParticipant": { - "required": [ - "id", - "name", - "score", - "chain" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionId" - }, - "name": { - "type": "string" - }, - "score": { - "type": "integer", - "format": "int32" - }, - "chain": { - "description": "Faction's current chain.", - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionRankedWar": { - "required": [ - "war_id", - "start", - "end", - "target", - "winner", - "factions" - ], - "properties": { - "war_id": { - "type": "integer", - "format": "int32" - }, - "start": { - "type": "integer", - "format": "int32" - }, - "end": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "target": { - "description": "The score target of the war.", - "type": "integer", - "format": "int32" - }, - "winner": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "factions": { - "description": "The factions involved in the ranked war.", - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionRankedWarParticipant" - } - } - }, - "type": "object" - }, - "FactionRaidWarParticipant": { - "required": [ - "id", - "name", - "score", - "chain", - "is_aggressor" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionId" - }, - "name": { - "type": "string" - }, - "score": { - "type": "integer", - "format": "int32" - }, - "chain": { - "description": "Faction's current chain.", - "type": "integer", - "format": "int32" - }, - "is_aggressor": { - "type": "boolean" - } - }, - "type": "object" - }, - "FactionRaidWar": { - "required": [ - "war_id", - "start", - "end", - "factions" - ], - "properties": { - "war_id": { - "type": "integer", - "format": "int32" - }, - "start": { - "type": "integer", - "format": "int32" - }, - "end": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "factions": { - "description": "The factions involved in the raid war.", - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionRaidWarParticipant" - } - } - }, - "type": "object" - }, - "FactionTerritoryWarParticipant": { - "required": [ - "id", - "name", - "score", - "chain", - "is_aggressor", - "playerIds" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionId" - }, - "name": { - "type": "string" - }, - "score": { - "type": "integer", - "format": "int32" - }, - "chain": { - "description": "Faction's current chain.", - "type": "integer", - "format": "int32" - }, - "is_aggressor": { - "type": "boolean" - }, - "playerIds": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserId" - } - } - }, - "type": "object" - }, - "FactionTerritoryWar": { - "required": [ - "war_id", - "territory", - "start", - "end", - "target", - "factions" - ], - "properties": { - "war_id": { - "type": "integer", - "format": "int32" - }, - "territory": { - "type": "string" - }, - "start": { - "type": "integer", - "format": "int32" - }, - "end": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "target": { - "description": "The score target of the war.", - "type": "integer", - "format": "int32" - }, - "winner": { - "oneOf": [ - { - "$ref": "#/components/schemas/FactionId" - }, - { - "type": "null" - } - ] - }, - "factions": { - "description": "The factions involved in the territory war.", - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryWarParticipant" - } - } - }, - "type": "object" - }, - "FactionWars": { - "required": [ - "ranked", - "raids", - "territory" - ], - "properties": { - "ranked": { - "oneOf": [ - { - "$ref": "#/components/schemas/FactionRankedWar" - }, - { - "type": "null" - } - ] - }, - "raids": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionRaidWar" - } - }, - "territory": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryWar" - } - } - }, - "type": "object" - }, - "FactionWarsResponse": { - "required": [ - "pacts", - "wars" - ], - "properties": { - "pacts": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionPact" - } - }, - "wars": { - "$ref": "#/components/schemas/FactionWars" - } - }, - "type": "object" - }, - "FactionNews": { - "required": [ - "id", - "text", - "timestamp" - ], - "properties": { - "id": { - "type": "string" - }, - "text": { - "type": "string" - }, - "timestamp": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionNewsResponse": { - "required": [ - "news", - "_metadata" - ], - "properties": { - "news": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionNews" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "FactionAttacksResponse": { - "required": [ - "attacks", - "_metadata" - ], - "properties": { - "attacks": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Attack" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "FactionAttacksFullResponse": { - "required": [ - "attacks", - "_metadata" - ], - "properties": { - "attacks": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AttackSimplified" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "FactionApplication": { - "required": [ - "id", - "user", - "message", - "valid_until", - "status" - ], - "properties": { - "id": { - "description": "application id", - "type": "integer", - "format": "int32" - }, - "user": { - "required": [ - "id", - "name", - "level", - "stats" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "name": { - "type": "string" - }, - "level": { - "type": "integer", - "format": "int32" - }, - "stats": { - "required": [ - "strength", - "speed", - "dexterity", - "defense" - ], - "properties": { - "strength": { - "type": "integer", - "format": "int64" - }, - "speed": { - "type": "integer", - "format": "int64" - }, - "dexterity": { - "type": "integer", - "format": "int64" - }, - "defense": { - "type": "integer", - "format": "int64" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "message": { - "type": "string" - }, - "valid_until": { - "type": "integer", - "format": "int32" - }, - "status": { - "$ref": "#/components/schemas/FactionApplicationStatusEnum" - } - }, - "type": "object" - }, - "FactionApplicationsResponse": { - "required": [ - "applications" - ], - "properties": { - "applications": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionApplication" - } - } - }, - "type": "object" - }, - "FactionOngoingChain": { - "required": [ - "id", - "current", - "max", - "timeout", - "modifier", - "cooldown", - "start", - "end" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ChainId" }, "current": { - "type": "integer", - "format": "int32" - }, - "max": { - "type": "integer", - "format": "int32" - }, - "timeout": { - "description": "Seconds until chain breaks.", - "type": "integer", - "format": "int32" - }, - "modifier": { - "type": "number", - "format": "float" - }, - "cooldown": { - "description": "Timestamp until when chain is on cooldown.", - "type": "integer", - "format": "int32" - }, - "start": { - "type": "integer", - "format": "int32" - }, - "end": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionOngoingChainResponse": { - "required": [ - "chain" - ], - "properties": { - "chain": { - "$ref": "#/components/schemas/FactionOngoingChain" - } - }, - "type": "object" - }, - "FactionChain": { - "required": [ - "id", - "chain", - "respect", - "start", - "end" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ChainId" - }, - "chain": { - "type": "integer", - "format": "int32" - }, - "respect": { - "type": "number", - "format": "float" - }, - "start": { - "type": "integer", - "format": "int32" - }, - "end": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionChainsResponse": { - "required": [ - "chains", - "_metadata" - ], - "properties": { - "chains": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionChain" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "FactionChainReportResponse": { - "required": [ - "chainreport" - ], - "properties": { - "chainreport": { - "$ref": "#/components/schemas/FactionChainReport" - } - }, - "type": "object" - }, - "FactionChainReport": { - "required": [ - "id", - "faction_id", - "start", - "end", - "details", - "bonuses", - "attackers", - "non_attackers" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ChainId" - }, - "faction_id": { - "$ref": "#/components/schemas/FactionId" - }, - "start": { - "type": "integer", - "format": "int32" - }, - "end": { - "type": "integer", - "format": "int32" - }, - "details": { - "$ref": "#/components/schemas/FactionChainReportDetails" - }, - "bonuses": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionChainReportBonus" - } - }, - "attackers": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionChainReportAttacker" - } - }, - "non-attackers": { - "description": "This is replaced with 'non_attackers' field and will be removed on 1st June 2025.", - "type": "array", - "items": { - "$ref": "#/components/schemas/UserId" - }, - "deprecated": true - }, - "non_attackers": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserId" - } - } - }, - "type": "object" - }, - "FactionChainReportDetails": { - "required": [ - "chain", - "respect", - "members", - "targets", - "war", - "best", - "leave", - "mug", - "hospitalize", - "assists", - "retaliations", - "overseas", - "draws", - "escapes", - "losses" - ], - "properties": { - "chain": { - "type": "integer", - "format": "int32" - }, - "respect": { - "type": "number", - "format": "float" - }, - "members": { - "type": "integer", - "format": "int32" - }, - "targets": { - "type": "integer", - "format": "int32" - }, - "war": { - "type": "integer", - "format": "int32" - }, - "best": { - "type": "number", - "format": "float" - }, - "leave": { - "type": "integer", - "format": "int32" - }, - "mug": { - "type": "integer", - "format": "int32" - }, - "hospitalize": { - "type": "integer", - "format": "int32" - }, - "assists": { - "type": "integer", - "format": "int32" - }, - "retaliations": { - "type": "integer", - "format": "int32" - }, - "overseas": { - "type": "integer", - "format": "int32" - }, - "draws": { - "type": "integer", - "format": "int32" - }, - "escapes": { - "type": "integer", - "format": "int32" - }, - "losses": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionChainReportBonus": { - "required": [ - "attacker_id", - "defender_id", - "chain", - "respect" - ], - "properties": { - "attacker_id": { - "$ref": "#/components/schemas/UserId" - }, - "defender_id": { - "$ref": "#/components/schemas/UserId" - }, - "chain": { - "type": "integer", - "format": "int32" - }, - "respect": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionChainReportAttacker": { - "required": [ - "id", - "respect", - "attacks" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "respect": { - "$ref": "#/components/schemas/FactionChainReportAttackerRespect" - }, - "attacks": { - "$ref": "#/components/schemas/FactionChainReportAttackerAttacks" - } - }, - "type": "object" - }, - "FactionChainReportAttackerRespect": { - "required": [ - "total", - "average", - "best" - ], - "properties": { - "total": { - "type": "number", - "format": "float" - }, - "average": { - "type": "number", - "format": "float" - }, - "best": { - "type": "number", - "format": "float" - } - }, - "type": "object" - }, - "FactionChainReportAttackerAttacks": { - "required": [ - "total", - "leave", - "mug", - "hospitalize", - "assists", - "retaliations", - "overseas", - "draws", - "escpaces", - "losses", - "war", - "bonuses" - ], - "properties": { - "total": { - "type": "integer", - "format": "int32" - }, - "leave": { - "type": "integer", - "format": "int32" - }, - "mug": { - "type": "integer", - "format": "int32" - }, - "hospitalize": { - "type": "integer", - "format": "int32" - }, - "assists": { - "type": "integer", - "format": "int32" - }, - "retaliations": { - "type": "integer", - "format": "int32" - }, - "overseas": { - "type": "integer", - "format": "int32" - }, - "draws": { - "type": "integer", - "format": "int32" - }, - "escapes": { - "type": "integer", - "format": "int32" - }, - "losses": { - "type": "integer", - "format": "int32" - }, - "war": { - "type": "integer", - "format": "int32" - }, - "bonuses": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionCrimeUser": { - "required": [ - "id", - "outcome", - "joined_at", - "progress" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "outcome": { - "description": "This field will be null for old crimes.", "oneOf": [ { - "$ref": "#/components/schemas/FactionCrimeUserOutcome" - }, - { - "type": "null" - } - ] - }, - "joined_at": { - "description": "The timestamp at which the user joined the slot.", - "type": "integer", - "format": "int32" - }, - "progress": { - "description": "Current planning progress on the slot.", - "type": "number", - "format": "float" - } - }, - "type": "object" - }, - "FactionCrimeRewardItem": { - "required": [ - "id", - "quantity" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ItemId" - }, - "quantity": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionCrimeRewardPayout": { - "required": [ - "type", - "percentage", - "paid_by", - "paid_at" - ], - "properties": { - "type": { - "$ref": "#/components/schemas/FactionOrganizedCrimePayoutType" - }, - "percentage": { - "description": "Total percentage split between all participants.", - "type": "integer", - "format": "int32" - }, - "paid_by": { - "$ref": "#/components/schemas/UserId" - }, - "paid_at": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionCrimeReward": { - "required": [ - "money", - "items", - "respect", - "payout", - "scope" - ], - "properties": { - "money": { - "type": "integer", - "format": "int32" - }, - "items": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionCrimeRewardItem" - } - }, - "respect": { - "type": "integer", - "format": "int32" - }, - "scope": { - "type": "integer", - "format": "int32" - }, - "payout": { - "description": "Details about the crime payouts. This field is null if the crime has not been paid via the automatic payouts system.", - "oneOf": [ - { - "$ref": "#/components/schemas/FactionCrimeRewardPayout" + "$ref": "#/components/schemas/UserCurrentEducation" }, { "type": "null" @@ -13314,572 +11491,213 @@ }, "type": "object" }, - "FactionCrimeSlot": { + "UserEducationResponse": { "required": [ - "position", - "item_requirement", - "user", - "checkpoint_pass_rate" + "education" ], "properties": { - "position": { - "type": "string" - }, - "item_requirement": { - "description": "Details of item required for the slot, if applicable.", - "oneOf": [ - { - "required": [ - "id", - "is_reusable", - "is_available" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ItemId" - }, - "is_reusable": { - "description": "Shows if the item is reusable or consumed during the crime.", - "type": "boolean" - }, - "is_available": { - "description": "Shows if user has the required item.", - "type": "boolean" - } - }, - "type": "object" - }, - { - "type": "null" - } - ] - }, - "user": { - "description": "Details about the user joined the slot, if any.", - "oneOf": [ - { - "$ref": "#/components/schemas/FactionCrimeUser" - }, - { - "type": "null" - } - ] - }, - "checkpoint_pass_rate": { - "description": "Returns CPR for the player who joined the slot. If the slot is empty (availalbe), it shows your CPR for that slot. This value is 0 for expired crimes.", - "type": "integer", - "format": "int32" + "education": { + "$ref": "#/components/schemas/UserEducation" } }, "type": "object" }, - "FactionCrime": { + "UserCrimeDetailsBootlegging": { "required": [ - "id", - "name", - "previous_crime_id", - "difficulty", - "status", - "created_at", - "planning_at", - "ready_at", - "expired_at", - "executed_at", - "slots", - "rewards" + "online_store", + "dvd_sales", + "dvd_copies" ], "properties": { - "id": { - "$ref": "#/components/schemas/FactionCrimeId" - }, - "previous_crime_id": { - "oneOf": [ - { - "$ref": "#/components/schemas/FactionCrimeId" - }, - { - "type": "null" - } - ] - }, - "name": { - "type": "string" - }, - "difficulty": { - "type": "integer", - "format": "int32" - }, - "status": { - "$ref": "#/components/schemas/FactionCrimeStatusEnum" - }, - "created_at": { - "description": "The timestamp at which the crime was created.", - "type": "integer", - "format": "int32" - }, - "planning_at": { - "description": "The timestamp at which the planning phase for the crime has begun.", - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "ready_at": { - "description": "The timestamp at which the crime will be ready.", - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "expired_at": { - "description": "The timestamp at which the crime will expire.", - "type": "integer", - "format": "int32" - }, - "executed_at": { - "description": "The timestamp at which the crime was executed.
Note: this value is null for all crimes executed before January 15th, 2025.", - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "slots": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionCrimeSlot" - } - }, - "rewards": { - "description": "Details about the crime rewards. Available only for crimes with 'Successful' status.", - "oneOf": [ - { - "$ref": "#/components/schemas/FactionCrimeReward" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "FactionCrimesResponse": { - "required": [ - "crimes", - "_metadata" - ], - "properties": { - "crimes": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionCrime" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "FactionCrimeResponse": { - "required": [ - "crime" - ], - "properties": { - "crime": { - "$ref": "#/components/schemas/FactionCrime" - } - }, - "type": "object" - }, - "FactionBalance": { - "required": [ - "faction", - "members" - ], - "properties": { - "faction": { + "online_store": { + "description": "Online store statistics.", "required": [ - "money", - "points", - "scope" + "earnings", + "visits", + "customers", + "sales" ], "properties": { - "money": { + "earnings": { "type": "integer", - "format": "int64" + "format": "int32" }, - "points": { + "visits": { "type": "integer", - "format": "int64" + "format": "int32" }, - "scope": { + "customers": { + "type": "integer", + "format": "int32" + }, + "sales": { "type": "integer", "format": "int32" } }, "type": "object" }, - "members": { - "type": "array", - "items": { - "required": [ - "id", - "username", - "money", - "points" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "username": { - "type": "string" - }, - "money": { - "type": "integer", - "format": "int64" - }, - "points": { - "type": "integer", - "format": "int64" - } - }, - "type": "object" - } - } - }, - "type": "object" - }, - "FactionBalanceResponse": { - "required": [ - "balance" - ], - "properties": { - "balance": { - "$ref": "#/components/schemas/FactionBalance" - } - }, - "type": "object" - }, - "FactionSelectionName": { - "description": "The following selections will fallback to API v1 and may change at any time: 'armor', 'boosters', 'caches', 'cesium', 'crimeexp', 'drugs', 'medical', 'positions', 'reports', 'temporary', 'weapons'.\n * The following selections are not available in API v2: 'armorynews', 'attacknews', 'crimenews', 'currency', 'donations', 'fundsnews', 'mainnews', 'membershipnews', 'territorynews'.", - "type": "string", - "enum": [ - "applications", - "attacks", - "attacksfull", - "balance", - "basic", - "chain", - "chainreport", - "chains", - "contributors", - "crime", - "crimes", - "hof", - "lookup", - "members", - "news", - "rackets", - "rankedwars", - "rankedwarreport", - "revives", - "revivesfull", - "stats", - "territory", - "territoryownership", - "territorywarreport", - "territorywars", - "timestamp", - "upgrades", - "wars", - "armor", - "boosters", - "caches", - "cesium", - "crimeexp", - "drugs", - "medical", - "positions", - "reports", - "temporary", - "weapons", - "armorynews", - "attacknews", - "crimenews", - "currency", - "donations", - "fundsnews", - "mainnews", - "membershipnews", - "territorynews" - ] - }, - "FactionLookupResponse": { - "required": [ - "selections" - ], - "properties": { - "selections": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionSelectionName" - } - } - }, - "type": "object" - }, - "FactionRankedWarDetails": { - "required": [ - "id", - "start", - "end", - "target", - "winner", - "factions" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/RankedWarId" - }, - "start": { - "description": "Timestamp the war started at.", - "type": "integer", - "format": "int32" - }, - "end": { - "description": "Timestamp the war ended at.", - "type": "integer", - "format": "int32" - }, - "target": { - "type": "integer", - "format": "int32" - }, - "winner": { - "oneOf": [ - { - "$ref": "#/components/schemas/FactionId" - }, - { - "type": "null" - } - ] - }, - "factions": { - "type": "array", - "items": { - "required": [ - "id", - "name", - "score", - "chain" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionId" - }, - "name": { - "type": "string" - }, - "score": { - "type": "integer", - "format": "int32" - }, - "chain": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - } - } - }, - "type": "object" - }, - "FactionRankedWarResponse": { - "required": [ - "rankedwars", - "_metadata" - ], - "properties": { - "rankedwars": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionRankedWarDetails" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "FactionRankedWarReportResponse": { - "required": [ - "rankedwarreport" - ], - "properties": { - "rankedwarreport": { + "dvd_sales": { + "description": "DVD sales statistics.", "required": [ - "id", - "start", - "end", - "winner", - "forfeit", - "factions" + "action", + "comedy", + "drama", + "fantasy", + "horror", + "romance", + "thriller", + "sci_fi", + "total", + "earnings" ], "properties": { - "id": { - "$ref": "#/components/schemas/RankedWarId" - }, - "start": { - "description": "Timestamp the war started at.", + "action": { "type": "integer", "format": "int32" }, - "end": { - "description": "Timestamp the war ended at.", + "comedy": { "type": "integer", "format": "int32" }, - "winner": { - "$ref": "#/components/schemas/FactionId" + "drama": { + "type": "integer", + "format": "int32" }, - "forfeit": { - "type": "boolean" + "fantasy": { + "type": "integer", + "format": "int32" }, - "factions": { + "horror": { + "type": "integer", + "format": "int32" + }, + "romance": { + "type": "integer", + "format": "int32" + }, + "thriller": { + "type": "integer", + "format": "int32" + }, + "sci-fi": { + "description": "This is replaced with 'sci_fi' field and will be removed on 1st June 2025.", + "type": "integer", + "format": "int32", + "deprecated": true + }, + "sci_fi": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + }, + "earnings": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "dvds_copied": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "UserCrimeDetailsGraffiti": { + "required": [ + "cans_used", + "most_graffiti_in_one_area", + "most_graffiti_simultaneously", + "graffiti_removed", + "cost_to_city" + ], + "properties": { + "cans_used": { + "type": "integer", + "format": "int32" + }, + "most_graffiti_in_one_area": { + "type": "integer", + "format": "int32" + }, + "most_graffiti_simultaneously": { + "type": "integer", + "format": "int32" + }, + "graffiti_removed": { + "type": "integer", + "format": "int32" + }, + "cost_to_city": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "UserCrimeDetailsShoplifting": { + "required": [ + "average_notoriety" + ], + "properties": { + "average_notoriety": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "UserCrimeDetailsCardSkimming": { + "required": [ + "card_details", + "skimmers" + ], + "properties": { + "card_details": { + "required": [ + "recoverable", + "recovered", + "sold", + "lost", + "areas" + ], + "properties": { + "recoverable": { + "type": "integer", + "format": "int32" + }, + "recovered": { + "type": "integer", + "format": "int32" + }, + "sold": { + "type": "integer", + "format": "int32" + }, + "lost": { + "type": "integer", + "format": "int32" + }, + "areas": { "type": "array", "items": { "required": [ "id", - "name", - "score", - "attacks", - "rank", - "rewards", - "members" + "amount" ], "properties": { "id": { - "$ref": "#/components/schemas/FactionId" - }, - "name": { - "type": "string" - }, - "score": { "type": "integer", "format": "int32" }, - "attacks": { + "amount": { "type": "integer", "format": "int32" - }, - "rank": { - "required": [ - "before", - "after" - ], - "properties": { - "before": { - "type": "string" - }, - "after": { - "type": "string" - } - }, - "type": "object" - }, - "rewards": { - "required": [ - "respect", - "points", - "items" - ], - "properties": { - "respect": { - "type": "integer", - "format": "int32" - }, - "points": { - "type": "integer", - "format": "int32" - }, - "items": { - "type": "array", - "items": { - "required": [ - "id", - "name", - "quantity" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ItemId" - }, - "name": { - "type": "string" - }, - "quantity": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - } - } - }, - "type": "object" - }, - "members": { - "type": "array", - "items": { - "required": [ - "id", - "name", - "level", - "attacks", - "score" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "name": { - "type": "string" - }, - "level": { - "type": "integer", - "format": "int32" - }, - "attacks": { - "type": "integer", - "format": "int32" - }, - "score": { - "type": "number", - "format": "float" - } - }, - "type": "object" - } } }, "type": "object" @@ -13887,423 +11705,529 @@ } }, "type": "object" - } - }, - "type": "object" - }, - "ForumCategoriesResponse": { - "required": [ - "categories" - ], - "properties": { - "categories": { - "type": "array", - "items": { - "required": [ - "id", - "title", - "acronym", - "threads" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ForumId" - }, - "title": { - "type": "string" - }, - "acronym": { - "type": "string" - }, - "threads": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - } - } - }, - "type": "object" - }, - "ForumThreadAuthor": { - "required": [ - "id", - "username", - "karma" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" }, - "username": { - "type": "string" - }, - "karma": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "ForumPollVote": { - "required": [ - "answer", - "votes" - ], - "properties": { - "answer": { - "type": "string" - }, - "votes": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "ForumPoll": { - "required": [ - "question", - "answers_count", - "answers" - ], - "properties": { - "question": { - "type": "string" - }, - "answers_count": { - "type": "integer", - "format": "int32" - }, - "answers": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ForumPollVote" - } - } - }, - "type": "object" - }, - "ForumThreadBase": { - "required": [ - "id", - "title", - "forum_id", - "posts", - "rating", - "views", - "author", - "last_poster", - "first_post_time", - "last_post_time", - "has_poll", - "is_locked", - "is_sticky" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ForumThreadId" - }, - "title": { - "type": "string" - }, - "forum_id": { - "$ref": "#/components/schemas/ForumId" - }, - "posts": { - "type": "integer", - "format": "int32" - }, - "rating": { - "type": "integer", - "format": "int32" - }, - "views": { - "description": "Total number of times players have opened this thread.", - "type": "integer", - "format": "int32" - }, - "author": { - "$ref": "#/components/schemas/ForumThreadAuthor" - }, - "last_poster": { - "oneOf": [ - { - "$ref": "#/components/schemas/ForumThreadAuthor" - }, - { - "type": "null" - } - ] - }, - "first_post_time": { - "type": "integer", - "format": "int32" - }, - "last_post_time": { - "oneOf": [ - { + "skimmers": { + "required": [ + "active", + "most_lucrative", + "oldest_recovered", + "lost" + ], + "properties": { + "active": { "type": "integer", "format": "int32" }, - { - "type": "null" + "most_lucrative": { + "type": "integer", + "format": "int32" + }, + "oldest_recovered": { + "type": "integer", + "format": "int32" + }, + "lost": { + "type": "integer", + "format": "int32" } - ] - }, - "has_poll": { - "type": "boolean" - }, - "is_locked": { - "type": "boolean" - }, - "is_sticky": { - "type": "boolean" + }, + "type": "object" } }, "type": "object" }, - "ForumThreadExtended": { - "allOf": [ - { + "UserCrimeDetailsHustling": { + "required": [ + "total_audience_gathered", + "biggest_money_won", + "shill_money_collected", + "pickpocket_money_collected" + ], + "properties": { + "total_audience_gathered": { + "type": "integer", + "format": "int32" + }, + "biggest_money_won": { + "type": "integer", + "format": "int32" + }, + "shill_money_collected": { + "type": "integer", + "format": "int32" + }, + "pickpocket_money_collected": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "UserCrimeDetailsCracking": { + "required": [ + "brute_force_cycles", + "encryption_layers_broken", + "highest_mips", + "chars_guessed", + "chars_guessed_total" + ], + "properties": { + "brute_force_cycles": { + "type": "integer", + "format": "int32" + }, + "encryption_layers_broken": { + "type": "integer", + "format": "int32" + }, + "highest_mips": { + "type": "integer", + "format": "int32" + }, + "chars_guessed": { + "type": "integer", + "format": "int32" + }, + "chars_guessed_total": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "UserCrimeDetailsScamming": { + "required": [ + "most_responses", + "zones", + "concerns", + "payouts", + "emails" + ], + "properties": { + "most_responses": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "zones": { "required": [ - "content", - "content_raw", - "poll" + "red", + "neutral", + "concern", + "sensitivity", + "temptation", + "hesitation", + "low_reward", + "medium_reward", + "high_reward" ], "properties": { - "content": { - "type": "string" + "red": { + "type": "integer", + "format": "int32", + "default": 0 }, - "content_raw": { - "type": "string" + "neutral": { + "type": "integer", + "format": "int32", + "default": 0 }, - "poll": { - "description": "'poll' is null when 'has_poll' is false.", - "oneOf": [ - { - "$ref": "#/components/schemas/ForumPoll" - }, - { - "type": "null" - } - ] + "concern": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "sensitivity": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "temptation": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "hesitation": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "low_reward": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "medium_reward": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "high_reward": { + "type": "integer", + "format": "int32", + "default": 0 } }, "type": "object" }, - { - "$ref": "#/components/schemas/ForumThreadBase" - } - ] - }, - "ForumPost": { - "required": [ - "id", - "thread_id", - "author", - "is_legacy", - "is_topic", - "is_edited", - "is_pinned", - "created_time", - "edited_by", - "has_quote", - "quoted_post_id", - "content", - "likes", - "dislikes" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ForumPostId" - }, - "thread_id": { - "$ref": "#/components/schemas/ForumThreadId" - }, - "author": { - "$ref": "#/components/schemas/ForumThreadAuthor" - }, - "is_legacy": { - "description": "Indicates whether post was made using the old formatting engine which doesn't use HTML.", - "type": "boolean" - }, - "is_topic": { - "type": "boolean" - }, - "is_edited": { - "type": "boolean" - }, - "is_pinned": { - "type": "boolean" - }, - "created_time": { - "type": "integer", - "format": "int32" - }, - "edited_by": { - "description": "'edited_by' is null when 'is_edited' is false.", - "oneOf": [ - { - "$ref": "#/components/schemas/UserId" - }, - { - "type": "null" - } - ] - }, - "has_quote": { - "type": "boolean" - }, - "quoted_post_id": { - "description": "'quoted_post_id' is null when 'has_quote' is false.", - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "content": { - "description": "depending on the input 'cat' parameter, this will either return raw value (with HTML) or plain text. Legacy posts are returned as is, they can't be stripped of tags.", - "type": "string" - }, - "likes": { - "type": "integer", - "format": "int32" - }, - "dislikes": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "ForumThreadUserExtended": { - "allOf": [ - { + "concerns": { "required": [ - "new_posts" + "attempts", + "resolved" ], "properties": { - "new_posts": { - "description": "Available only when requesting data for yourself (no id or your id) with at least 'Minimal' access type key.", - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] + "attempts": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "resolved": { + "type": "integer", + "format": "int32", + "default": 0 } }, "type": "object" }, - { - "$ref": "#/components/schemas/ForumThreadBase" + "payouts": { + "required": [ + "low", + "medium", + "high" + ], + "properties": { + "low": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "medium": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "high": { + "type": "integer", + "format": "int32", + "default": 0 + } + }, + "type": "object" + }, + "emails": { + "required": [ + "scraper", + "phisher" + ], + "properties": { + "scraper": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "phisher": { + "type": "integer", + "format": "int32", + "default": 0 + } + }, + "type": "object" } - ] + }, + "type": "object" }, - "ForumSubscribedThreadPostsCount": { + "UserSubcrime": { "required": [ - "new", - "total" + "id", + "total", + "success", + "fail" ], "properties": { - "new": { + "id": { "type": "integer", "format": "int32" }, "total": { "type": "integer", "format": "int32" - } - }, - "type": "object" - }, - "ForumSubscribedThread": { - "required": [ - "id", - "forum_id", - "author", - "title", - "posts" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ForumThreadId" }, - "forum_id": { - "$ref": "#/components/schemas/ForumId" - }, - "author": { - "$ref": "#/components/schemas/ForumThreadAuthor" - }, - "title": { - "type": "string" - }, - "posts": { - "$ref": "#/components/schemas/ForumSubscribedThreadPostsCount" - } - }, - "type": "object" - }, - "ForumFeed": { - "required": [ - "thread_id", - "post_id", - "user", - "title", - "text", - "timestamp", - "is_seen", - "type" - ], - "properties": { - "thread_id": { - "$ref": "#/components/schemas/ForumThreadId" - }, - "post_id": { - "$ref": "#/components/schemas/ForumPostId" - }, - "user": { - "$ref": "#/components/schemas/ForumThreadAuthor" - }, - "title": { - "type": "string" - }, - "text": { - "type": "string" - }, - "timestamp": { + "success": { "type": "integer", "format": "int32" }, - "is_seen": { - "type": "boolean" - }, - "type": { - "$ref": "#/components/schemas/ForumFeedTypeEnum" + "fail": { + "type": "integer", + "format": "int32" } }, "type": "object" }, - "ForumThreadsResponse": { + "UserCrimeRewardAmmo": { "required": [ - "threads", + "standard", + "special" + ], + "properties": { + "standard": { + "type": "integer", + "format": "int32" + }, + "special": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "UserCrimeRewardItem": { + "required": [ + "id", + "amount" + ], + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "amount": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "UserCrimeRewards": { + "required": [ + "money", + "ammo", + "items" + ], + "properties": { + "money": { + "type": "integer", + "format": "int64" + }, + "ammo": { + "$ref": "#/components/schemas/UserCrimeRewardAmmo" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserCrimeRewardItem" + } + } + }, + "type": "object" + }, + "UserCrimeAttempts": { + "required": [ + "total", + "success", + "fail", + "critical_fail", + "subcrimes" + ], + "properties": { + "total": { + "type": "integer", + "format": "int32" + }, + "success": { + "type": "integer", + "format": "int32" + }, + "fail": { + "type": "integer", + "format": "int32" + }, + "critical_fail": { + "type": "integer", + "format": "int32" + }, + "subcrimes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserSubcrime" + } + } + }, + "type": "object" + }, + "UserCrimeUniquesRewardMoney": { + "required": [ + "min", + "max" + ], + "properties": { + "min": { + "type": "integer", + "format": "int32" + }, + "max": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "UserCrimeUniquesRewardAmmo": { + "required": [ + "amount", + "type" + ], + "properties": { + "amount": { + "type": "integer", + "format": "int32" + }, + "type": { + "$ref": "#/components/schemas/UserCrimeUniquesRewardAmmoEnum" + } + }, + "type": "object" + }, + "UserCrimeUniquesReward": { + "required": [ + "items", + "money", + "ammo" + ], + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserCrimeRewardItem" + } + }, + "money": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserCrimeUniquesRewardMoney" + }, + { + "type": "null" + } + ] + }, + "ammo": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserCrimeUniquesRewardAmmo" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "UserCrimeUniques": { + "required": [ + "id", + "rewards" + ], + "properties": { + "id": { + "description": "Unique result id.", + "type": "integer", + "format": "int64" + }, + "rewards": { + "$ref": "#/components/schemas/UserCrimeUniquesReward" + } + }, + "type": "object" + }, + "UserCrimesResponse": { + "required": [ + "crimes" + ], + "properties": { + "crimes": { + "$ref": "#/components/schemas/UserCrime" + } + }, + "type": "object" + }, + "UserCrime": { + "required": [ + "nerve_spent", + "skill", + "progression_bonus", + "rewards", + "attempts", + "uniques", + "miscellaneous" + ], + "properties": { + "nerve_spent": { + "type": "integer", + "format": "int32" + }, + "skill": { + "type": "integer", + "format": "int32" + }, + "progression_bonus": { + "type": "integer", + "format": "int32" + }, + "rewards": { + "$ref": "#/components/schemas/UserCrimeRewards" + }, + "attempts": { + "$ref": "#/components/schemas/UserCrimeAttempts" + }, + "uniques": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserCrimeUniques" + } + }, + "miscellaneous": { + "description": " Miscellaneous stats for specific crime. Results differ based on the cat id.", + "oneOf": [ + { + "$ref": "#/components/schemas/UserCrimeDetailsBootlegging" + }, + { + "$ref": "#/components/schemas/UserCrimeDetailsGraffiti" + }, + { + "$ref": "#/components/schemas/UserCrimeDetailsShoplifting" + }, + { + "$ref": "#/components/schemas/UserCrimeDetailsCardSkimming" + }, + { + "$ref": "#/components/schemas/UserCrimeDetailsHustling" + }, + { + "$ref": "#/components/schemas/UserCrimeDetailsCracking" + }, + { + "$ref": "#/components/schemas/UserCrimeDetailsScamming" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "UserRacesResponse": { + "required": [ + "races", "_metadata" ], "properties": { - "threads": { + "races": { "type": "array", "items": { - "$ref": "#/components/schemas/ForumThreadBase" + "$ref": "#/components/schemas/RacingRaceDetailsResponse" } }, "_metadata": { @@ -14312,24 +12236,87 @@ }, "type": "object" }, - "ForumThreadResponse": { + "UserRaceCarDetails": { + "allOf": [ + { + "$ref": "#/components/schemas/RaceCar" + }, + { + "required": [ + "id", + "name", + "worth", + "points_spent", + "races_entered", + "races_won", + "is_removed", + "parts" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/RaceCarId" + }, + "name": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "worth": { + "type": "integer", + "format": "int64" + }, + "points_spent": { + "type": "integer", + "format": "int32" + }, + "races_entered": { + "type": "integer", + "format": "int32" + }, + "races_won": { + "type": "integer", + "format": "int32" + }, + "is_removed": { + "type": "boolean" + }, + "parts": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RaceCarUpgradeId" + } + } + }, + "type": "object" + } + ] + }, + "UserEnlistedCarsResponse": { "required": [ - "thread" + "enlistedcars" ], "properties": { - "thread": { - "$ref": "#/components/schemas/ForumThreadExtended" + "enlistedcars": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserRaceCarDetails" + } } }, "type": "object" }, - "ForumPostsResponse": { + "UserForumPostsResponse": { "required": [ - "posts", + "forumPosts", "_metadata" ], "properties": { - "posts": { + "forumPosts": { "type": "array", "items": { "$ref": "#/components/schemas/ForumPost" @@ -14341,309 +12328,302 @@ }, "type": "object" }, - "ForumSelectionName": { - "type": "string", - "enum": [ - "categories", - "lookup", - "posts", - "thread", - "threads", - "timestamp" - ] - }, - "ForumLookupResponse": { + "UserForumThreadsResponse": { "required": [ - "selections" + "forumThreads", + "_metadata" ], "properties": { - "selections": { + "forumThreads": { "type": "array", "items": { - "$ref": "#/components/schemas/ForumSelectionName" + "$ref": "#/components/schemas/ForumThreadUserExtended" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "UserForumSubscribedThreadsResponse": { + "required": [ + "forumSbuscribedThreads" + ], + "properties": { + "forumSubscribedThreads": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ForumSubscribedThread" } } }, "type": "object" }, - "KeyLogResponse": { + "UserForumFeedResponse": { "required": [ - "log" + "forumFeed" ], "properties": { - "log": { + "forumFeed": { "type": "array", "items": { - "required": [ - "timestamp", - "type", - "selections", - "id", - "ip" - ], - "properties": { - "timestamp": { - "type": "integer", - "format": "int32" - }, - "type": { - "type": "string" - }, - "selections": { - "type": "string" - }, - "id": { - "oneOf": [ - { - "type": "integer", - "format": "int64" - }, - { - "type": "null" - } - ] - }, - "comment": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "ip": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/components/schemas/ForumFeed" } } }, "type": "object" }, - "KeyInfoResponse": { + "UserForumFriendsResponse": { "required": [ - "info" + "forumFriends" ], "properties": { - "info": { - "required": [ - "selections", - "access" - ], - "properties": { - "selections": { - "required": [ - "company", - "faction", - "market", - "property", - "torn", - "user", - "racing", - "forum", - "key" - ], - "properties": { - "company": { - "type": "array", - "items": { - "type": "string" - } - }, - "faction": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionSelectionName" - } - }, - "market": { - "type": "array", - "items": { - "$ref": "#/components/schemas/MarketSelectionName" - } - }, - "property": { - "type": "array", - "items": { - "type": "string" - } - }, - "torn": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornSelectionName" - } - }, - "user": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserSelectionName" - } - }, - "racing": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RacingSelectionName" - } - }, - "forum": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ForumSelectionName" - } - }, - "key": { - "type": "array", - "items": { - "$ref": "#/components/schemas/KeySelectionName" - } - } - }, - "type": "object" - }, - "access": { - "required": [ - "level", - "type", - "faction", - "company" - ], - "properties": { - "level": { - "type": "integer", - "format": "int32" - }, - "type": { - "$ref": "#/components/schemas/ApiKeyAccessTypeEnum" - }, - "faction": { - "type": "boolean" - }, - "faction_id": { - "oneOf": [ - { - "$ref": "#/components/schemas/FactionId" - }, - { - "type": "null" - } - ] - }, - "company": { - "type": "boolean" - }, - "company_id": { - "oneOf": [ - { - "$ref": "#/components/schemas/CompanyId" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - } - }, - "type": "object" + "forumFriends": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ForumFeed" + } } }, "type": "object" }, - "KeySelectionName": { - "type": "string", - "enum": [ - "info", - "log" - ] - }, - "ItemMarketListingItemBonus": { + "HofValue": { "required": [ - "id", - "title", - "description", - "value" + "value", + "rank" ], "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, "value": { + "type": "integer", + "format": "int64" + }, + "rank": { "type": "integer", "format": "int32" } }, "type": "object" }, - "ItemMarketListingItemStats": { + "HofValueFloat": { "required": [ - "damage", - "accuracy", - "armor", - "quality" + "value", + "rank" ], "properties": { - "damage": { - "oneOf": [ - { - "type": "number", - "format": "float" - }, - { - "type": "null" - } - ] - }, - "accuracy": { - "oneOf": [ - { - "type": "number", - "format": "float" - }, - { - "type": "null" - } - ] - }, - "armor": { - "oneOf": [ - { - "type": "number", - "format": "float" - }, - { - "type": "null" - } - ] - }, - "quality": { - "type": "number", + "value": { + "type": "integer", "format": "float" + }, + "rank": { + "type": "integer", + "format": "int32" } }, "type": "object" }, - "ItemMarketItem": { + "HofValueString": { + "required": [ + "value", + "rank" + ], + "properties": { + "value": { + "type": "string" + }, + "rank": { + "oneOf": [ + { + "type": "number", + "format": "int32" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "UserHofStats": { + "required": [ + "attacks", + "busts", + "defends", + "networth", + "offences", + "revives", + "level", + "rank", + "awards", + "racing_skill", + "racing_points", + "racing_wins", + "travel_time", + "working_stats", + "battle_stats" + ], + "properties": { + "attacks": { + "$ref": "#/components/schemas/HofValue" + }, + "busts": { + "$ref": "#/components/schemas/HofValue" + }, + "defends": { + "$ref": "#/components/schemas/HofValue" + }, + "networth": { + "$ref": "#/components/schemas/HofValue" + }, + "offences": { + "$ref": "#/components/schemas/HofValue" + }, + "revives": { + "$ref": "#/components/schemas/HofValue" + }, + "level": { + "$ref": "#/components/schemas/HofValue" + }, + "rank": { + "$ref": "#/components/schemas/HofValue" + }, + "awards": { + "$ref": "#/components/schemas/HofValue" + }, + "racing_skill": { + "$ref": "#/components/schemas/HofValueFloat" + }, + "racing_points": { + "$ref": "#/components/schemas/HofValue" + }, + "racing_wins": { + "$ref": "#/components/schemas/HofValue" + }, + "travel_time": { + "$ref": "#/components/schemas/HofValue" + }, + "working_stats": { + "$ref": "#/components/schemas/HofValue" + }, + "battle_stats": { + "oneOf": [ + { + "$ref": "#/components/schemas/HofValue", + "description": "This field is null when requesting data for other players." + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "UserHofResponse": { + "required": [ + "hof" + ], + "properties": { + "hof": { + "$ref": "#/components/schemas/UserHofStats" + } + }, + "type": "object" + }, + "UserCalendar": { + "required": [ + "start_time" + ], + "properties": { + "start_time": { + "description": "Event start time displayed in TCT.", + "type": "string" + } + }, + "type": "object" + }, + "UserCalendarResponse": { + "required": [ + "calendar" + ], + "properties": { + "calendar": { + "$ref": "#/components/schemas/UserCalendar" + } + }, + "type": "object" + }, + "UserBountiesResponse": { + "required": [ + "bounties" + ], + "properties": { + "bounties": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Bounty" + } + } + }, + "type": "object" + }, + "UserJobRanks": { + "required": [ + "army", + "grocer", + "casino", + "medical", + "law", + "education" + ], + "properties": { + "army": { + "$ref": "#/components/schemas/JobPositionArmyEnum" + }, + "grocer": { + "$ref": "#/components/schemas/JobPositionGrocerEnum" + }, + "casino": { + "$ref": "#/components/schemas/JobPositionCasinoEnum" + }, + "medical": { + "$ref": "#/components/schemas/JobPositionMedicalEnum" + }, + "law": { + "$ref": "#/components/schemas/JobPositionLawEnum" + }, + "education": { + "$ref": "#/components/schemas/JobPositionEducationEnum" + } + }, + "type": "object" + }, + "UserJobRanksResponse": { + "required": [ + "jobranks" + ], + "properties": { + "jobranks": { + "$ref": "#/components/schemas/UserJobRanks" + } + }, + "type": "object" + }, + "UserItemMarkeListingItemDetails": { "required": [ "id", "name", "type", - "average_price" + "rarity", + "uid", + "stats", + "bonuses" ], "properties": { "id": { - "$ref": "#/components/schemas/ItemId" + "type": "integer", + "format": "int64" }, "name": { "type": "string" @@ -14651,50 +12631,6 @@ "type": { "type": "string" }, - "average_price": { - "type": "integer", - "format": "int64" - } - }, - "type": "object" - }, - "ItemMarketListingStackable": { - "required": [ - "price", - "amount" - ], - "properties": { - "price": { - "type": "integer", - "format": "int64" - }, - "amount": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "ItemMarketListingItemDetails": { - "required": [ - "uid", - "stats", - "bonuses", - "rarity" - ], - "properties": { - "uid": { - "$ref": "#/components/schemas/ItemUid" - }, - "stats": { - "$ref": "#/components/schemas/ItemMarketListingItemStats" - }, - "bonuses": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ItemMarketListingItemBonus" - } - }, "rarity": { "oneOf": [ { @@ -14709,313 +12645,87 @@ "type": "null" } ] + }, + "uid": { + "oneOf": [ + { + "$ref": "#/components/schemas/ItemUid" + }, + { + "type": "null" + } + ] + }, + "stats": { + "oneOf": [ + { + "$ref": "#/components/schemas/ItemMarketListingItemStats" + }, + { + "type": "null" + } + ] + }, + "bonuses": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ItemMarketListingItemBonus" + } } }, "type": "object" }, - "ItemMarketListingNonstackable": { + "UserItemMarketListing": { "required": [ + "id", "price", + "average_price", "amount", - "item_details" + "is_anonymous", + "available", + "item" ], "properties": { + "id": { + "type": "integer", + "format": "int64" + }, "price": { "type": "integer", "format": "int64" }, + "average_price": { + "type": "integer", + "format": "int64" + }, "amount": { "type": "integer", "format": "int32" }, - "item_details": { - "$ref": "#/components/schemas/ItemMarketListingItemDetails" - } - }, - "type": "object" - }, - "ItemMarket": { - "required": [ - "item", - "listings" - ], - "properties": { - "item": { - "$ref": "#/components/schemas/ItemMarketItem" + "is_anonymous": { + "type": "boolean" }, - "listings": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/ItemMarketListingNonstackable" - }, - { - "$ref": "#/components/schemas/ItemMarketListingStackable" - } - ] - } + "available": { + "description": "Amount remaining in the inventory.", + "type": "integer", + "format": "int32" + }, + "item": { + "$ref": "#/components/schemas/UserItemMarkeListingItemDetails" } }, "type": "object" }, - "MarketItemMarketResponse": { + "UserItemMarketResponse": { "required": [ "itemmarket", "_metadata" ], "properties": { "itemmarket": { - "$ref": "#/components/schemas/ItemMarket" - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "MarketSelectionName": { - "description": "The following selections will fallback to API v1 and may change at any time: 'pointsmarket'.", - "type": "string", - "enum": [ - "itemmarket", - "lookup", - "timestamp", - "pointsmarket", - "bazaar" - ] - }, - "MarketLookupResponse": { - "required": [ - "selections" - ], - "properties": { - "selections": { "type": "array", "items": { - "$ref": "#/components/schemas/MarketSelectionName" - } - } - }, - "type": "object" - }, - "RacingCarsResponse": { - "required": [ - "cars" - ], - "properties": { - "cars": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RaceCar" - } - } - }, - "type": "object" - }, - "RaceCar": { - "required": [ - "car_item_id", - "car_item_name", - "top_speed", - "acceleration", - "braking", - "dirt", - "handling", - "safety", - "tarmac", - "class" - ], - "properties": { - "car_item_id": { - "$ref": "#/components/schemas/ItemId" - }, - "car_item_name": { - "type": "string" - }, - "top_speed": { - "type": "integer", - "format": "int32" - }, - "acceleration": { - "type": "integer", - "format": "int32" - }, - "braking": { - "type": "integer", - "format": "int32" - }, - "dirt": { - "type": "integer", - "format": "int32" - }, - "handling": { - "type": "integer", - "format": "int32" - }, - "safety": { - "type": "integer", - "format": "int32" - }, - "tarmac": { - "type": "integer", - "format": "int32" - }, - "class": { - "$ref": "#/components/schemas/RaceClassEnum" - } - }, - "type": "object" - }, - "RacingTracksResponse": { - "required": [ - "tracks" - ], - "properties": { - "tracks": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RaceTrack" - } - } - }, - "type": "object" - }, - "RaceTrack": { - "required": [ - "id", - "title", - "description" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/RaceTrackId" - }, - "title": { - "type": "string" - }, - "description": { - "type": "string" - } - }, - "type": "object" - }, - "RacingCarUpgradesResponse": { - "required": [ - "carupgrades" - ], - "properties": { - "carupgrades": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RaceCarUpgrade" - } - } - }, - "type": "object" - }, - "RaceCarUpgrade": { - "required": [ - "id", - "class_required", - "name", - "description", - "category", - "subcategory", - "effects", - "cost" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/RaceCarUpgradeId" - }, - "class_required": { - "$ref": "#/components/schemas/RaceClassEnum" - }, - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "category": { - "$ref": "#/components/schemas/RaceCarUpgradeCategory" - }, - "subcategory": { - "$ref": "#/components/schemas/RaceCarUpgradeSubCategory" - }, - "effects": { - "required": [ - "top_speed", - "acceleration", - "braking", - "handling", - "safety", - "dirt", - "tarmac" - ], - "properties": { - "top_speed": { - "type": "integer", - "format": "int32" - }, - "acceleration": { - "type": "integer", - "format": "int32" - }, - "braking": { - "type": "integer", - "format": "int32" - }, - "handling": { - "type": "integer", - "format": "int32" - }, - "safety": { - "type": "integer", - "format": "int32" - }, - "dirt": { - "type": "integer", - "format": "int32" - }, - "tarmac": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "cost": { - "required": [ - "points", - "cash" - ], - "properties": { - "points": { - "type": "integer", - "format": "int32" - }, - "cash": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "RacingRacesResponse": { - "required": [ - "races", - "_metadata" - ], - "properties": { - "races": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Race" + "$ref": "#/components/schemas/UserItemMarketListing" } }, "_metadata": { @@ -15024,818 +12734,108 @@ }, "type": "object" }, - "Race": { + "UserFactionBalance": { "required": [ - "id", - "title", - "track_id", - "creator_id", - "status", - "laps", - "participants", - "schedule", - "requirements" + "money", + "points" ], "properties": { - "id": { - "$ref": "#/components/schemas/RaceId" - }, - "title": { - "type": "string" - }, - "track_id": { - "$ref": "#/components/schemas/RaceTrackId" - }, - "creator_id": { - "$ref": "#/components/schemas/UserId" - }, - "status": { - "$ref": "#/components/schemas/RaceStatusEnum" - }, - "laps": { + "money": { "type": "integer", - "format": "int32" + "format": "int64" }, - "participants": { - "required": [ - "minimum", - "maximum", - "current" - ], - "properties": { - "minimum": { - "type": "integer", - "format": "int32" - }, - "maximum": { - "type": "integer", - "format": "int32" - }, - "current": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "schedule": { - "required": [ - "join_from", - "join_until", - "start", - "end" - ], - "properties": { - "join_from": { - "type": "integer", - "format": "int32" - }, - "join_until": { - "type": "integer", - "format": "int32" - }, - "start": { - "type": "integer", - "format": "int32" - }, - "end": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "requirements": { - "required": [ - "car_class", - "driver_class", - "car_item_id", - "requires_stock_car", - "requires_password", - "join_fee" - ], - "properties": { - "car_class": { - "oneOf": [ - { - "$ref": "#/components/schemas/RaceClassEnum" - }, - { - "type": "null" - } - ] - }, - "driver_class": { - "oneOf": [ - { - "$ref": "#/components/schemas/RaceClassEnum" - }, - { - "type": "null" - } - ] - }, - "car_item_id": { - "oneOf": [ - { - "$ref": "#/components/schemas/ItemId" - }, - { - "type": "null" - } - ] - }, - "requires_stock_car": { - "type": "boolean" - }, - "requires_password": { - "type": "boolean" - }, - "join_fee": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "RacingTrackRecordsResponse": { - "required": [ - "records" - ], - "properties": { - "records": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RaceRecord" - } - } - }, - "type": "object" - }, - "RaceRecord": { - "required": [ - "driver_id", - "driver_name", - "car_item_id", - "lap_time", - "car_item_name" - ], - "properties": { - "driver_id": { - "$ref": "#/components/schemas/UserId" - }, - "driver_name": { - "type": "string" - }, - "car_item_id": { - "$ref": "#/components/schemas/ItemId" - }, - "lap_time": { - "type": "number", - "format": "float" - }, - "car_item_name": { - "type": "string" - } - }, - "type": "object" - }, - "RacerDetails": { - "required": [ - "driver_id", - "position", - "car_id", - "car_item_id", - "car_item_name", - "car_class", - "has_crashed", - "best_lap_time", - "race_time", - "time_ended" - ], - "properties": { - "driver_id": { - "$ref": "#/components/schemas/UserId" - }, - "position": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "car_id": { - "$ref": "#/components/schemas/RaceCarId" - }, - "car_item_id": { - "$ref": "#/components/schemas/ItemId" - }, - "car_item_name": { - "type": "string" - }, - "car_class": { - "$ref": "#/components/schemas/RaceClassEnum" - }, - "has_crashed": { - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ] - }, - "best_lap_time": { - "oneOf": [ - { - "type": "number", - "format": "float" - }, - { - "type": "null" - } - ] - }, - "race_time": { - "oneOf": [ - { - "type": "number", - "format": "float" - }, - { - "type": "null" - } - ] - }, - "time_ended": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "RacingRaceDetailsResponse": { - "properties": { - "race": { - "allOf": [ - { - "required": [ - "results" - ], - "properties": { - "results": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RacerDetails" - } - } - }, - "type": "object" - }, - { - "$ref": "#/components/schemas/Race" - } - ] - } - }, - "type": "object" - }, - "RacingSelectionName": { - "type": "string", - "enum": [ - "cars", - "carupgrades", - "lookup", - "race", - "races", - "records", - "timestamp", - "tracks" - ] - }, - "RacingLookupResponse": { - "required": [ - "selections" - ], - "properties": { - "selections": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RacingSelectionName" - } - } - }, - "type": "object" - }, - "TornEducationRewards": { - "required": [ - "working_stats", - "effect", - "honor" - ], - "properties": { - "working_stats": { - "required": [ - "manual_labor", - "intelligence", - "endurance" - ], - "properties": { - "manual_labor": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "intelligence": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "endurance": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "effect": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "honor": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "TornEducationPrerequisites": { - "required": [ - "cost", - "courses" - ], - "properties": { - "cost": { + "points": { "type": "integer", - "format": "int32" - }, - "courses": { - "type": "array", - "items": { - "type": "integer", - "format": "int32" - } + "format": "int64" } }, "type": "object" }, - "TornEducationCourses": { + "UserFactionBalanceResponse": { "required": [ - "id", - "code", - "name", - "description", - "duration", - "rewards", - "prerequisites" + "factionBalance" ], "properties": { - "id": { - "$ref": "#/components/schemas/EducationId" - }, - "code": { - "type": "string" - }, - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "duration": { - "type": "integer", - "format": "int32" - }, - "rewards": { - "$ref": "#/components/schemas/TornEducationRewards" - }, - "prerequisites": { - "$ref": "#/components/schemas/TornEducationPrerequisites" + "factionBalance": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserFactionBalance" + }, + { + "type": "null" + } + ] } }, "type": "object" }, - "TornEducation": { + "UserOrganizedCrimeResponse": { + "required": [ + "organizedCrime" + ], + "properties": { + "organizedCrime": { + "oneOf": [ + { + "$ref": "#/components/schemas/FactionCrime" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "UserList": { "required": [ "id", "name", - "courses" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - }, - "courses": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornEducationCourses" - } - } - }, - "type": "object" - }, - "TornEducationResponse": { - "required": [ - "education" - ], - "properties": { - "education": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornEducation" - } - } - }, - "type": "object" - }, - "TornTerritoryCoordinates": { - "required": [ - "x", - "y" - ], - "properties": { - "x": { - "type": "number", - "format": "float" - }, - "y": { - "type": "number", - "format": "float" - } - }, - "type": "object" - }, - "TornTerritory": { - "required": [ - "id", - "sector", - "size", - "density", - "slots", - "respect", - "coordinates", - "neighbors" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionTerritoryEnum" - }, - "sector": { - "type": "integer", - "format": "int32" - }, - "size": { - "type": "integer", - "format": "int32" - }, - "density": { - "type": "integer", - "format": "int32" - }, - "slots": { - "type": "integer", - "format": "int32" - }, - "respect": { - "type": "integer", - "format": "int32" - }, - "coordinates": { - "$ref": "#/components/schemas/TornTerritoryCoordinates" - }, - "neighbors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryEnum" - } - } - }, - "type": "object" - }, - "TornTerritoriesResponse": { - "required": [ - "territory", - "_metadata" - ], - "properties": { - "territory": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornTerritory" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "TornTerritoriesNoLinksReponse": { - "required": [ - "territory" - ], - "properties": { - "territory": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornTerritory" - } - } - }, - "type": "object" - }, - "TornSubcrimesResponse": { - "required": [ - "subcrimes" - ], - "properties": { - "subcrimes": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornSubcrime" - } - } - }, - "type": "object" - }, - "TornSubcrime": { - "required": [ - "id", - "name", - "nerve_cost" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - }, - "nerve_cost": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "TornCrimesResponse": { - "required": [ - "crimes" - ], - "properties": { - "crimes": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornCrime" - } - } - }, - "type": "object" - }, - "TornCrime": { - "required": [ - "id", - "name", - "category_id", - "enhancer_id", - "enhancer_name", - "unique_outcomes_count", - "unique_outcomes_ids" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/TornCrimeId" - }, - "name": { - "type": "string" - }, - "category_id": { - "type": "integer", - "format": "int32" - }, - "category_name": { - "type": "string" - }, - "enhancer_id": { - "type": "integer", - "format": "int32" - }, - "enhancer_name": { - "type": "string" - }, - "unique_outcomes_count": { - "type": "integer", - "format": "int32" - }, - "unique_outcomes_ids": { - "type": "array", - "items": { - "type": "integer", - "format": "int32" - } - }, - "notes": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "type": "object" - }, - "TornCalendarActivity": { - "required": [ - "title", - "description", - "start", - "end" - ], - "properties": { - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "start": { - "type": "integer", - "format": "int32" - }, - "end": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "TornCalendarResponse": { - "required": [ - "calendar" - ], - "properties": { - "calendar": { - "required": [ - "competitions", - "events" - ], - "properties": { - "competitions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornCalendarActivity" - } - }, - "events": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornCalendarActivity" - } - } - }, - "type": "object" - } - }, - "type": "object" - }, - "TornHof": { - "required": [ - "id", - "username", - "faction_id", "level", + "faction_id", "last_action", - "rank_name", - "rank_number", - "position", - "signed_up", - "age_in_days", - "value", - "rank" + "status" ], "properties": { "id": { "$ref": "#/components/schemas/UserId" }, - "username": { + "name": { "type": "string" }, - "faction_id": { - "$ref": "#/components/schemas/FactionId" - }, "level": { "type": "integer", "format": "int32" }, + "faction_id": { + "oneOf": [ + { + "$ref": "#/components/schemas/FactionId" + }, + { + "type": "null" + } + ] + }, "last_action": { - "type": "integer", - "format": "int32" + "$ref": "#/components/schemas/UserLastAction" }, - "rank_name": { - "type": "string" - }, - "rank_number": { - "type": "integer", - "format": "int32" - }, - "position": { - "type": "integer", - "format": "int32" - }, - "signed_up": { - "type": "integer", - "format": "int32" - }, - "age_in_days": { - "type": "integer", - "format": "int32" - }, - "value": { - "description": "Value representing the chosen category. Traveltime is shown in seconds. If the chosen category is 'rank', the value is of type string. If the chosen category is 'racingskill', the value is of type float. Otherwise it is an integer." - }, - "rank": { - "type": "string" + "status": { + "$ref": "#/components/schemas/UserStatus" } }, "type": "object" }, - "TornHofResponse": { + "UserListResponse": { "required": [ - "hof", + "list", "_metadata" ], "properties": { - "hof": { + "list": { "type": "array", "items": { - "$ref": "#/components/schemas/TornHof" + "$ref": "#/components/schemas/UserList" } }, "_metadata": { @@ -15844,963 +12844,73 @@ }, "type": "object" }, - "FactionHofValues": { - "required": [ - "chain", - "chain_duration", - "respect" - ], - "properties": { - "chain": { - "description": "Maximum chain achieved by the faction. Null if chosen category is 'rank' or 'respect'.", - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "chain_duration": { - "description": "The duration of the chain. Null if chosen category is 'rank' or 'respect'.", - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "respect": { - "description": "Null if chosen category is 'chain'.", - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "TornFactionHof": { - "required": [ - "id", - "name", - "members", - "position", - "rank", - "values" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionId" - }, - "name": { - "type": "string" - }, - "members": { - "type": "integer", - "format": "int32" - }, - "position": { - "type": "integer", - "format": "int32" - }, - "rank": { - "description": "The full rank title & division of the faction.", - "type": "string" - }, - "values": { - "$ref": "#/components/schemas/FactionHofValues" - } - }, - "type": "object" - }, - "TornFactionHofResponse": { - "required": [ - "factionhof", - "_metadata" - ], - "properties": { - "factionhof": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornFactionHof" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "TornLog": { - "required": [ - "id", - "title" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/LogId" - }, - "title": { - "type": "string" - } - }, - "type": "object" - }, - "TornLogCategory": { - "required": [ - "id", - "title" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/LogCategoryId" - }, - "title": { - "type": "string" - } - }, - "type": "object" - }, - "TornLogTypesResponse": { - "required": [ - "logtypes" - ], - "properties": { - "logtypes": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornLog" - } - } - }, - "type": "object" - }, - "TornLogCategoriesResponse": { - "required": [ - "logcategories" - ], - "properties": { - "logcategories": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornLogCategory" - } - } - }, - "type": "object" - }, - "Bounty": { - "required": [ - "target_id", - "target_name", - "target_level", - "lister_id", - "lister_name", - "reward", - "reason", - "quantity", - "is_anonymous", - "valid_until" - ], - "properties": { - "target_id": { - "$ref": "#/components/schemas/UserId" - }, - "target_name": { - "type": "string" - }, - "target_level": { - "type": "integer", - "format": "int32" - }, - "lister_id": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserId" - }, - { - "type": "null" - } - ] - }, - "lister_name": { - "description": "If the bounty is anonymous this field is null.", - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "reward": { - "type": "integer", - "format": "int64" - }, - "reason": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "quantity": { - "type": "integer", - "format": "int32" - }, - "is_anonymous": { - "type": "boolean" - }, - "valid_until": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "AttackLogSummary": { - "required": [ - "id", - "name", - "hits", - "misses", - "damage" - ], - "properties": { - "id": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserId" - }, - { - "type": "null" - } - ] - }, - "name": { - "oneOf": [ - { - "description": "Name of the participant, could be null in stealthed attacks.", - "type": "string" - }, - { - "type": "null" - } - ] - }, - "hits": { - "type": "integer", - "format": "int32" - }, - "misses": { - "type": "integer", - "format": "int32" - }, - "damage": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "AttackLog": { - "required": [ - "text", - "timestamp", - "action", - "icon", - "attacker", - "defender" - ], - "properties": { - "text": { - "type": "string" - }, - "timestamp": { - "type": "integer", - "format": "int32" - }, - "action": { - "$ref": "#/components/schemas/AttackActionEnum" - }, - "icon": { - "type": "string" - }, - "attacker": { - "oneOf": [ - { - "description": "This value could be null in stealthed attacks.", - "required": [ - "id", - "name", - "item" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "name": { - "type": "string" - }, - "item": { - "oneOf": [ - { - "description": "This object could be null if there was no item being used in this turn or during this effect.", - "properties": { - "id": { - "$ref": "#/components/schemas/ItemId" - }, - "name": { - "type": "string" - } - }, - "type": "object" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - { - "type": "null" - } - ] - }, - "defender": { - "oneOf": [ - { - "description": "This value could be null in stealthed attacks.", - "required": [ - "id", - "name" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "name": { - "type": "string" - } - }, - "type": "object" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "AttackLogResponse": { - "required": [ - "attacklog", - "_metadata" - ], - "properties": { - "attacklog": { - "required": [ - "log", - "summary" - ], - "properties": { - "log": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AttackLog" - } - }, - "summary": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AttackLogSummary" - } - } - }, - "type": "object" - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "TornBountiesResponse": { - "required": [ - "bounties", - "_metadata" - ], - "properties": { - "bounties": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Bounty" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "TornItemAmmo": { - "required": [ - "id", - "name", - "price", - "types" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/AmmoId" - }, - "name": { - "type": "string" - }, - "price": { - "type": "integer", - "format": "int64" - }, - "types": { - "description": "Types of ammo", - "type": "array", - "items": { - "$ref": "#/components/schemas/TornItemAmmoTypeEnum" - } - } - }, - "type": "object" - }, - "TornItemAmmoResponse": { - "required": [ - "itemammo" - ], - "properties": { - "itemammo": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornItemAmmo" - } - } - }, - "type": "object" - }, - "TornItemMods": { - "required": [ - "id", - "name", - "description", - "dual_fit", - "weapons" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ItemModId" - }, - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "dual_fit": { - "description": "Whether the upgrade fits on dual weapons.", - "type": "boolean" - }, - "weapons": { - "description": "The weapon types this upgrade can be attached to.", - "type": "array", - "items": { - "$ref": "#/components/schemas/TornItemWeaponTypeEnum" - } - } - }, - "type": "object" - }, - "TornItemModsResponse": { - "required": [ - "itemmods" - ], - "properties": { - "itemmods": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornItemMods" - } - } - }, - "type": "object" - }, - "TornItemBaseStats": { - "required": [ - "damage", - "accuracy", - "armor" - ], - "properties": { - "damage": { - "type": "integer", - "format": "int32" - }, - "accuracy": { - "type": "integer", - "format": "int32" - }, - "armor": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "TornItemWeaponDetails": { - "required": [ - "stealth_level", - "base_stats", - "category", - "ammo", - "mods" - ], - "properties": { - "stealth_level": { - "type": "number", - "format": "float" - }, - "base_stats": { - "$ref": "#/components/schemas/TornItemBaseStats" - }, - "category": { - "$ref": "#/components/schemas/TornItemWeaponCategoryEnum" - }, - "ammo": { - "oneOf": [ - { - "required": [ - "id", - "name", - "magazine_rounds", - "rate_of_fire" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/AmmoId" - }, - "name": { - "type": "string" - }, - "magazine_rounds": { - "type": "integer", - "format": "int32" - }, - "rate_of_fire": { - "required": [ - "minimum", - "maximum" - ], - "properties": { - "minimum": { - "type": "integer", - "format": "int32" - }, - "maximum": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - } - }, - "type": "object" - }, - { - "type": "null" - } - ] - }, - "mods": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ItemModId" - } - } - }, - "type": "object" - }, - "TornItemArmorCoverage": { - "required": [ - "name", - "value" - ], - "properties": { - "name": { - "$ref": "#/components/schemas/TornItemArmorCoveragePartEnum" - }, - "value": { - "type": "number", - "format": "float" - } - }, - "type": "object" - }, - "TornItemArmorDetails": { - "required": [ - "coverage", - "base_stats" - ], - "properties": { - "coverage": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornItemArmorCoverage" - } - }, - "base_stats": { - "$ref": "#/components/schemas/TornItemBaseStats" - } - }, - "type": "object" - }, - "TornItem": { - "required": [ - "id", - "name", - "description", - "effect", - "requirement", - "image", - "type", - "sub_type", - "is_masked", - "is_tradable", - "is_found_in_city", - "value", - "circulation", - "details" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ItemId" - }, - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "effect": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "requirement": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "image": { - "type": "string" - }, - "type": { - "$ref": "#/components/schemas/TornItemTypeEnum" - }, - "sub_type": { - "oneOf": [ - { - "$ref": "#/components/schemas/TornItemWeaponTypeEnum" - }, - { - "type": "null" - } - ] - }, - "is_masked": { - "type": "boolean" - }, - "is_tradable": { - "type": "boolean" - }, - "is_found_in_city": { - "type": "boolean" - }, - "value": { - "required": [ - "vendor", - "buy_price", - "sell_price", - "market_price" - ], - "properties": { - "vendor": { - "oneOf": [ - { - "required": [ - "country", - "name" - ], - "properties": { - "country": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "type": "object" - }, - { - "type": "null" - } - ] - }, - "buy_price": { - "oneOf": [ - { - "type": "integer", - "format": "int64" - }, - { - "type": "null" - } - ] - }, - "sell_price": { - "oneOf": [ - { - "type": "integer", - "format": "int64" - }, - { - "type": "null" - } - ] - }, - "market_price": { - "type": "integer", - "format": "int64" - } - }, - "type": "object" - }, - "circulation": { - "type": "integer", - "format": "int64" - }, - "details": { - "description": "If the item 'type' is 'Armor' then TornItemArmorDetails is returned.
If the item 'type' is 'Weapon' then TornItemWeaponDetails is returned.
Otherwise, null is returned.", - "oneOf": [ - { - "$ref": "#/components/schemas/TornItemWeaponDetails" - }, - { - "$ref": "#/components/schemas/TornItemArmorDetails" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "TornItemsResponse": { - "required": [ - "items" - ], - "properties": { - "items": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornItem" - } - } - }, - "type": "object" - }, - "TornFactionTreeBranch": { - "required": [ - "id", - "name", - "upgrades" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionBranchId" - }, - "name": { - "type": "string" - }, - "upgrades": { - "type": "array", - "items": { - "required": [ - "name", - "level", - "ability", - "challenge", - "cost" - ], - "properties": { - "name": { - "type": "string" - }, - "level": { - "type": "integer", - "format": "int32" - }, - "ability": { - "type": "string" - }, - "cost": { - "type": "integer", - "format": "int32" - }, - "challenge": { - "oneOf": [ - { - "required": [ - "description", - "amount_required", - "stat" - ], - "properties": { - "description": { - "type": "string" - }, - "amount_required": { - "type": "integer", - "format": "int64" - }, - "stat": { - "$ref": "#/components/schemas/FactionStatEnum" - } - }, - "type": "object" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - } - } - }, - "type": "object" - }, - "TornFactionTree": { - "required": [ - "name", - "branches" - ], - "properties": { - "name": { - "type": "string" - }, - "branches": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornFactionTreeBranch" - } - } - }, - "type": "object" - }, - "TornFactionTreeResponse": { - "required": [ - "factionTree" - ], - "properties": { - "factionTree": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornFactionTree" - } - } - }, - "type": "object" - }, - "TornSelectionName": { - "description": "The following selections will fallback to API v1 and may change at any time: 'bank','cards','cityshops','companies','competition','dirtybombs','gyms','honors','itemdetails','itemstats','medals','organisedcrimes','pawnshop','pokertables','properties','raidreport','raids','rockpaperscissors','searchforcash','shoplifting','stats','stocks'.\n * The following selections are not available in API v2: 'chainreport', 'rackets', 'rankedwarreport', 'rankedwars', 'territorynames', 'territorywarreport', 'territorywars'.", + "UserSelectionName": { + "description": "The following selections will fallback to API v1 and may change at any time: 'ammo','bars','basic','battlestats','bazaar','cooldowns','criminalrecord','discord','display','education','equipment','events','gym','honors','icons','inventory','jobpoints','log','medals','merits','messages','missions','money','networth','newevents','newmessages','notifications','perks','profile','properties','refills','reports','skills','stocks','travel','weaponexp','workstats'.", "type": "string", "enum": [ - "attacklog", + "attacks", + "attacksfull", "bounties", "calendar", "crimes", - "education", - "factionhof", - "factiontree", + "enlistedcars", + "factionbalance", + "forumfeed", + "forumfriends", + "forumposts", + "forumsubscribedthreads", + "forumthreads", "hof", - "itemammo", - "itemmods", - "items", - "logcategories", - "logtypes", + "itemmarket", + "jobranks", + "list", "lookup", - "subcrimes", - "territory", + "organizedcrime", + "personalstats", + "races", + "revives", + "revivesfull", "timestamp", - "bank", - "cards", - "cityshops", - "companies", - "competition", - "dirtybombs", - "gyms", + "ammo", + "bars", + "basic", + "battlestats", + "bazaar", + "cooldowns", + "criminalrecord", + "discord", + "display", + "education", + "equipment", + "events", + "gym", "honors", - "itemdetails", - "itemstats", + "icons", + "inventory", + "jobpoints", + "log", "medals", - "organisedcrimes", - "pawnshop", - "pokertables", + "merits", + "messages", + "missions", + "money", + "networth", + "newevents", + "newmessages", + "notifications", + "perks", + "profile", "properties", - "raidreport", - "raids", - "rockpaperscissors", - "searchforcash", - "shoplifting", - "stats", + "refills", + "reports", + "skills", "stocks", - "chainreport", - "rackets", - "rankedwarreport", - "rankedwars", - "territorynames", - "territorywarreport", - "territorywars" + "travel", + "weaponexp", + "workstats" ] }, - "TornLookupResponse": { + "UserLookupResponse": { "required": [ "selections" ], @@ -16808,7 +12918,7 @@ "selections": { "type": "array", "items": { - "$ref": "#/components/schemas/TornSelectionName" + "$ref": "#/components/schemas/UserSelectionName" } } }, @@ -19853,38 +15963,339 @@ "scammingskill" ] }, - "UserCurrentEducation": { + "FactionTerritoryWarFinishedFaction": { "required": [ "id", - "until" + "name", + "score", + "is_aggressor" ], "properties": { "id": { - "$ref": "#/components/schemas/EducationId" + "$ref": "#/components/schemas/FactionId" }, - "until": { + "name": { + "type": "string" + }, + "score": { + "type": "integer", + "format": "int32" + }, + "is_aggressor": { + "type": "boolean" + } + }, + "type": "object" + }, + "FactionTerritoryWarFinished": { + "required": [ + "id", + "territory", + "start", + "end", + "target", + "result", + "factions" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/TerritoryWarId" + }, + "territory": { + "$ref": "#/components/schemas/FactionTerritoryEnum" + }, + "start": { + "type": "integer", + "format": "int64" + }, + "end": { + "type": "integer", + "format": "int64" + }, + "target": { + "type": "integer", + "format": "int32" + }, + "result": { + "$ref": "#/components/schemas/FactionTerritoryWarResultEnum" + }, + "factions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryWarFinishedFaction" + } + } + }, + "type": "object" + }, + "FactionTerritoryWarOngoingFaction": { + "required": [ + "id", + "name", + "score", + "is_aggressor", + "chain", + "playerIds" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionId" + }, + "name": { + "type": "string" + }, + "score": { + "type": "integer", + "format": "int32" + }, + "is_aggressor": { + "type": "boolean" + }, + "chain": { + "type": "integer", + "format": "int32" + }, + "playerIds": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserId" + } + } + }, + "type": "object" + }, + "FactionTerritoryWarOngoing": { + "required": [ + "id", + "territory", + "start", + "end", + "target", + "factions" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/TerritoryWarId" + }, + "territory": { + "$ref": "#/components/schemas/FactionTerritoryEnum" + }, + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "type": "integer", + "format": "int32" + }, + "target": { + "type": "integer", + "format": "int32" + }, + "factions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryWarOngoingFaction" + } + } + }, + "type": "object" + }, + "FactionTerritoryWarsResponse": { + "required": [ + "territorywars" + ], + "properties": { + "territorywars": { + "description": "If the chosen category is 'ongoing' the response will be of 'FactionTerritoryWarOngoing' type, otherwise, the type will be 'FactionTerritoryWarFinished'.", + "oneOf": [ + { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryWarOngoing" + } + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryWarFinished" + } + } + ] + } + }, + "type": "object" + }, + "FactionTerritoryWarsHistoryResponse": { + "required": [ + "territorywars" + ], + "properties": { + "territorywars": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryWarFinished" + } + } + }, + "type": "object" + }, + "FactionTerritoryWarReportMembers": { + "required": [ + "id", + "username", + "level", + "score", + "joins", + "clears" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "username": { + "type": "string" + }, + "level": { + "type": "integer", + "format": "int32" + }, + "score": { + "type": "integer", + "format": "int32" + }, + "joins": { + "type": "integer", + "format": "int32" + }, + "clears": { "type": "integer", "format": "int32" } }, "type": "object" }, - "UserEducation": { + "FactionTerritoryWarReportFaction": { "required": [ - "complete", - "current" + "id", + "name", + "score", + "joins", + "clears", + "is_aggressor", + "members" ], "properties": { - "complete": { + "id": { + "$ref": "#/components/schemas/FactionId" + }, + "name": { + "type": "string" + }, + "score": { + "type": "integer", + "format": "int32" + }, + "joins": { + "type": "integer", + "format": "int32" + }, + "clears": { + "type": "integer", + "format": "int32" + }, + "is_aggressor": { + "type": "boolean" + }, + "members": { "type": "array", "items": { - "$ref": "#/components/schemas/EducationId" + "$ref": "#/components/schemas/FactionTerritoryWarReportMembers" } + } + }, + "type": "object" + }, + "FactionTerritoryWarReport": { + "required": [ + "id", + "territory", + "started_at", + "ended_at", + "winner", + "result", + "factions" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/TerritoryWarId" }, - "current": { + "territory": { + "$ref": "#/components/schemas/FactionTerritoryEnum" + }, + "started_at": { + "type": "integer", + "format": "int32" + }, + "ended_at": { + "type": "integer", + "format": "int32" + }, + "winner": { + "$ref": "#/components/schemas/FactionId", + "description": "Winning faction id." + }, + "result": { + "type": "string" + }, + "factions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryWarReportFaction" + } + } + }, + "type": "object" + }, + "FactionTerritoryWarReportResponse": { + "required": [ + "territorywarreport" + ], + "properties": { + "territorywarreport": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryWarReport" + } + } + }, + "type": "object" + }, + "FactionTerritoryOwnership": { + "required": [ + "id", + "owned_by", + "acquired_at" + ], + "properties": { + "id": { + "type": "string" + }, + "owned_by": { "oneOf": [ { - "$ref": "#/components/schemas/UserCurrentEducation" + "$ref": "#/components/schemas/FactionId" + }, + { + "type": "null" + } + ] + }, + "acquired_at": { + "oneOf": [ + { + "type": "integer", + "format": "int32" }, { "type": "null" @@ -19894,724 +16305,522 @@ }, "type": "object" }, - "UserEducationResponse": { + "FactionTerritoriesOwnershipResponse": { "required": [ - "education" + "territoryownership" ], "properties": { - "education": { - "$ref": "#/components/schemas/UserEducation" + "territoryownership": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryOwnership" + } } }, "type": "object" }, - "UserCrimeDetailsBootlegging": { + "TornRacketReward": { "required": [ - "online_store", - "dvd_sales", - "dvd_copies" + "type", + "quantity", + "id" ], "properties": { - "online_store": { - "description": "Online store statistics.", - "required": [ - "earnings", - "visits", - "customers", - "sales" - ], - "properties": { - "earnings": { - "type": "integer", - "format": "int32" + "type": { + "$ref": "#/components/schemas/TornRacketType" + }, + "quantity": { + "type": "integer", + "format": "int32" + }, + "id": { + "oneOf": [ + { + "$ref": "#/components/schemas/ItemId" }, - "visits": { - "type": "integer", - "format": "int32" - }, - "customers": { - "type": "integer", - "format": "int32" - }, - "sales": { - "type": "integer", - "format": "int32" + { + "type": "null" } - }, - "type": "object" + ] + } + }, + "type": "object" + }, + "TornRacket": { + "required": [ + "name", + "level", + "description", + "reward", + "created_at", + "changed_at" + ], + "properties": { + "name": { + "type": "string" }, - "dvd_sales": { - "description": "DVD sales statistics.", - "required": [ - "action", - "comedy", - "drama", - "fantasy", - "horror", - "romance", - "thriller", - "sci_fi", - "total", - "earnings" - ], - "properties": { - "action": { - "type": "integer", - "format": "int32" + "level": { + "type": "integer", + "format": "int32" + }, + "description": { + "type": "string" + }, + "reward": { + "$ref": "#/components/schemas/TornRacketReward" + }, + "created_at": { + "type": "integer", + "format": "int32" + }, + "changed_at": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionRacketsReponse": { + "required": [ + "rackets" + ], + "properties": { + "rackets": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornRacket" + } + } + }, + "type": "object" + }, + "FactionTerritory": { + "required": [ + "id", + "acquired_at", + "sector", + "size", + "density", + "slots", + "respect", + "coordinates", + "racket" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionTerritoryEnum" + }, + "acquired_at": { + "type": "integer", + "format": "int32" + }, + "sector": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "density": { + "type": "integer", + "format": "int32" + }, + "slots": { + "type": "integer", + "format": "int32" + }, + "respect": { + "type": "integer", + "format": "int32" + }, + "coordinates": { + "$ref": "#/components/schemas/TornTerritoryCoordinates" + }, + "racket": { + "oneOf": [ + { + "$ref": "#/components/schemas/TornRacket" }, - "comedy": { - "type": "integer", - "format": "int32" - }, - "drama": { - "type": "integer", - "format": "int32" - }, - "fantasy": { - "type": "integer", - "format": "int32" - }, - "horror": { - "type": "integer", - "format": "int32" - }, - "romance": { - "type": "integer", - "format": "int32" - }, - "thriller": { - "type": "integer", - "format": "int32" - }, - "sci-fi": { - "description": "This is replaced with 'sci_fi' field and will be removed on 1st June 2025.", - "type": "integer", - "format": "int32", - "deprecated": true - }, - "sci_fi": { - "type": "integer", - "format": "int32" - }, - "total": { - "type": "integer", - "format": "int32" - }, - "earnings": { - "type": "integer", - "format": "int32" + { + "type": "null" } - }, - "type": "object" + ] + } + }, + "type": "object" + }, + "FactionTerritoriesReponse": { + "required": [ + "territory" + ], + "properties": { + "territory": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritory" + } + } + }, + "type": "object" + }, + "FactionPosition": { + "required": [ + "name", + "is_default", + "abilities" + ], + "properties": { + "name": { + "type": "string" }, - "dvds_copied": { + "is_default": { + "type": "boolean" + }, + "abilities": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionPositionAbilityEnum" + } + } + }, + "type": "object" + }, + "FactionPositionsResponse": { + "required": [ + "positions" + ], + "properties": { + "positions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionPosition" + } + } + }, + "type": "object" + }, + "FactionUpgradeDetails": { + "required": [ + "id", + "name", + "ability", + "level", + "cost", + "unlockedAt" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionBranchId" + }, + "name": { + "type": "string" + }, + "ability": { + "type": "string" + }, + "level": { + "type": "integer", + "format": "int32" + }, + "cost": { + "type": "integer", + "format": "int32" + }, + "unlocked_at": { "type": "integer", "format": "int32" } }, "type": "object" }, - "UserCrimeDetailsGraffiti": { + "FactionBranchDetails": { "required": [ - "cans_used", - "most_graffiti_in_one_area", - "most_graffiti_simultaneously", - "graffiti_removed", - "cost_to_city" + "name", + "order", + "multiplier", + "upgrades" ], "properties": { - "cans_used": { + "name": { + "type": "string" + }, + "order": { "type": "integer", "format": "int32" }, - "most_graffiti_in_one_area": { + "multiplier": { + "description": "Respect cost multiplier.", "type": "integer", "format": "int32" }, - "most_graffiti_simultaneously": { - "type": "integer", - "format": "int32" - }, - "graffiti_removed": { - "type": "integer", - "format": "int32" - }, - "cost_to_city": { - "type": "integer", - "format": "int32" + "upgrades": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionUpgradeDetails" + } } }, "type": "object" }, - "UserCrimeDetailsShoplifting": { + "FactionUpgrades": { "required": [ - "average_notoriety" + "core", + "peace", + "war" ], "properties": { - "average_notoriety": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "UserCrimeDetailsCardSkimming": { - "required": [ - "card_details", - "skimmers" - ], - "properties": { - "card_details": { - "required": [ - "recoverable", - "recovered", - "sold", - "lost", - "areas" - ], + "core": { "properties": { - "recoverable": { - "type": "integer", - "format": "int32" - }, - "recovered": { - "type": "integer", - "format": "int32" - }, - "sold": { - "type": "integer", - "format": "int32" - }, - "lost": { - "type": "integer", - "format": "int32" - }, - "areas": { + "upgrades": { "type": "array", "items": { - "required": [ - "id", - "amount" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "amount": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" + "$ref": "#/components/schemas/FactionUpgradeDetails" } } }, "type": "object" }, - "skimmers": { - "required": [ - "active", - "most_lucrative", - "oldest_recovered", - "lost" - ], - "properties": { - "active": { - "type": "integer", - "format": "int32" - }, - "most_lucrative": { - "type": "integer", - "format": "int32" - }, - "oldest_recovered": { - "type": "integer", - "format": "int32" - }, - "lost": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" + "peace": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionBranchDetails" + } + }, + "war": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionBranchDetails" + } } }, "type": "object" }, - "UserCrimeDetailsHustling": { + "FactionUpgradesResponse": { "required": [ - "total_audience_gathered", - "biggest_money_won", - "shill_money_collected", - "pickpocket_money_collected" + "upgrades", + "state" ], "properties": { - "total_audience_gathered": { - "type": "integer", - "format": "int32" + "upgrades": { + "$ref": "#/components/schemas/FactionUpgrades" }, - "biggest_money_won": { - "type": "integer", - "format": "int32" - }, - "shill_money_collected": { - "type": "integer", - "format": "int32" - }, - "pickpocket_money_collected": { - "type": "integer", - "format": "int32" + "state": { + "$ref": "#/components/schemas/FactionBranchStateEnum" } }, "type": "object" }, - "UserCrimeDetailsCracking": { + "FactionStat": { "required": [ - "brute_force_cycles", - "encryption_layers_broken", - "highest_mips", - "chars_guessed", - "chars_guessed_total" + "name", + "value" ], "properties": { - "brute_force_cycles": { - "type": "integer", - "format": "int32" + "name": { + "$ref": "#/components/schemas/FactionStatEnum" }, - "encryption_layers_broken": { + "value": { "type": "integer", - "format": "int32" - }, - "highest_mips": { - "type": "integer", - "format": "int32" - }, - "chars_guessed": { - "type": "integer", - "format": "int32" - }, - "chars_guessed_total": { - "type": "integer", - "format": "int32" + "format": "int64" } }, "type": "object" }, - "UserCrimeDetailsScamming": { + "FactionStatsResponse": { "required": [ - "most_responses", - "zones", - "concerns", - "payouts", - "emails" + "stats" ], "properties": { - "most_responses": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "zones": { - "required": [ - "red", - "neutral", - "concern", - "sensitivity", - "temptation", - "hesitation", - "low_reward", - "medium_reward", - "high_reward" - ], - "properties": { - "red": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "neutral": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "concern": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "sensitivity": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "temptation": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "hesitation": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "low_reward": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "medium_reward": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "high_reward": { - "type": "integer", - "format": "int32", - "default": 0 - } - }, - "type": "object" - }, - "concerns": { - "required": [ - "attempts", - "resolved" - ], - "properties": { - "attempts": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "resolved": { - "type": "integer", - "format": "int32", - "default": 0 - } - }, - "type": "object" - }, - "payouts": { - "required": [ - "low", - "medium", - "high" - ], - "properties": { - "low": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "medium": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "high": { - "type": "integer", - "format": "int32", - "default": 0 - } - }, - "type": "object" - }, - "emails": { - "required": [ - "scraper", - "phisher" - ], - "properties": { - "scraper": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "phisher": { - "type": "integer", - "format": "int32", - "default": 0 - } - }, - "type": "object" + "stats": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionStat" + } } }, "type": "object" }, - "UserSubcrime": { + "FactionContributor": { "required": [ "id", - "total", - "success", - "fail" + "username", + "value", + "in_faction" ], "properties": { "id": { - "type": "integer", - "format": "int32" + "$ref": "#/components/schemas/UserId" }, - "total": { - "type": "integer", - "format": "int32" + "username": { + "type": "string" }, - "success": { - "type": "integer", - "format": "int32" - }, - "fail": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "UserCrimeRewardAmmo": { - "required": [ - "standard", - "special" - ], - "properties": { - "standard": { - "type": "integer", - "format": "int32" - }, - "special": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "UserCrimeRewardItem": { - "required": [ - "id", - "amount" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "amount": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "UserCrimeRewards": { - "required": [ - "money", - "ammo", - "items" - ], - "properties": { - "money": { + "value": { "type": "integer", "format": "int64" }, - "ammo": { - "$ref": "#/components/schemas/UserCrimeRewardAmmo" - }, - "items": { + "in_faction": { + "type": "boolean" + } + }, + "type": "object" + }, + "FactionContributorsResponse": { + "required": [ + "contributors" + ], + "properties": { + "contributors": { "type": "array", "items": { - "$ref": "#/components/schemas/UserCrimeRewardItem" + "$ref": "#/components/schemas/FactionContributor" } } }, "type": "object" }, - "UserCrimeAttempts": { + "FactionHofStats": { "required": [ - "total", - "success", - "fail", - "critical_fail", - "subcrimes" + "rank", + "respect", + "chain" ], "properties": { - "total": { - "type": "integer", - "format": "int32" + "rank": { + "$ref": "#/components/schemas/HofValueString" }, - "success": { - "type": "integer", - "format": "int32" + "respect": { + "$ref": "#/components/schemas/HofValue" }, - "fail": { - "type": "integer", - "format": "int32" - }, - "critical_fail": { - "type": "integer", - "format": "int32" - }, - "subcrimes": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserSubcrime" - } + "chain": { + "$ref": "#/components/schemas/HofValue" } }, "type": "object" }, - "UserCrimeUniquesRewardMoney": { + "FactionHofResponse": { "required": [ - "min", - "max" + "hof" ], "properties": { - "min": { - "type": "integer", - "format": "int32" - }, - "max": { - "type": "integer", - "format": "int32" + "hof": { + "$ref": "#/components/schemas/FactionHofStats" } }, "type": "object" }, - "UserCrimeUniquesRewardAmmo": { - "required": [ - "amount", - "type" - ], - "properties": { - "amount": { - "type": "integer", - "format": "int32" - }, - "type": { - "$ref": "#/components/schemas/UserCrimeUniquesRewardAmmoEnum" - } - }, - "type": "object" - }, - "UserCrimeUniquesReward": { - "required": [ - "items", - "money", - "ammo" - ], - "properties": { - "items": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserCrimeRewardItem" - } - }, - "money": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserCrimeUniquesRewardMoney" - }, - { - "type": "null" - } - ] - }, - "ammo": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserCrimeUniquesRewardAmmo" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "UserCrimeUniques": { + "FactionMember": { + "description": "Details about a faction member.", "required": [ "id", - "rewards" + "name", + "position", + "level", + "days_in_faction", + "is_revivable", + "is_on_wall", + "is_in_oc", + "has_early_discharge", + "last_action", + "status", + "revive_setting" ], "properties": { "id": { - "description": "Unique result id.", - "type": "integer", - "format": "int64" + "$ref": "#/components/schemas/UserId" }, - "rewards": { - "$ref": "#/components/schemas/UserCrimeUniquesReward" + "name": { + "type": "string" + }, + "position": { + "type": "string" + }, + "level": { + "type": "integer", + "format": "int32" + }, + "days_in_faction": { + "type": "integer", + "format": "int32" + }, + "is_revivable": { + "type": "boolean" + }, + "is_on_wall": { + "description": "Shows if the member is currently defending territory wall.", + "type": "boolean" + }, + "is_in_oc": { + "description": "Shows if the member is currently participating in an organized crime. Show false for members of other factions.", + "type": "boolean" + }, + "has_early_discharge": { + "description": "Shows if the member is eligible for an early discharge from the hospital.", + "type": "boolean" + }, + "last_action": { + "$ref": "#/components/schemas/UserLastAction" + }, + "status": { + "$ref": "#/components/schemas/UserStatus" + }, + "revive_setting": { + "$ref": "#/components/schemas/ReviveSetting" } }, "type": "object" }, - "UserCrimesResponse": { + "UserLastAction": { + "description": "Details about a user's last action.", "required": [ - "crimes" + "status", + "timestamp", + "relative" ], "properties": { - "crimes": { - "$ref": "#/components/schemas/UserCrime" + "status": { + "type": "string" + }, + "timestamp": { + "type": "integer", + "format": "int32" + }, + "relative": { + "type": "string" } }, "type": "object" }, - "UserCrime": { + "UserStatus": { + "description": "Details about a user's status.", "required": [ - "nerve_spent", - "skill", - "progression_bonus", - "rewards", - "attempts", - "uniques", - "miscellaneous" + "description", + "details", + "state", + "until" ], "properties": { - "nerve_spent": { - "type": "integer", - "format": "int32" + "description": { + "type": "string" }, - "skill": { - "type": "integer", - "format": "int32" - }, - "progression_bonus": { - "type": "integer", - "format": "int32" - }, - "rewards": { - "$ref": "#/components/schemas/UserCrimeRewards" - }, - "attempts": { - "$ref": "#/components/schemas/UserCrimeAttempts" - }, - "uniques": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserCrimeUniques" - } - }, - "miscellaneous": { - "description": " Miscellaneous stats for specific crime. Results differ based on the cat id.", + "details": { "oneOf": [ { - "$ref": "#/components/schemas/UserCrimeDetailsBootlegging" + "type": "string" }, { - "$ref": "#/components/schemas/UserCrimeDetailsGraffiti" - }, + "type": "null" + } + ] + }, + "state": { + "type": "string" + }, + "until": { + "oneOf": [ { - "$ref": "#/components/schemas/UserCrimeDetailsShoplifting" - }, - { - "$ref": "#/components/schemas/UserCrimeDetailsCardSkimming" - }, - { - "$ref": "#/components/schemas/UserCrimeDetailsHustling" - }, - { - "$ref": "#/components/schemas/UserCrimeDetailsCracking" - }, - { - "$ref": "#/components/schemas/UserCrimeDetailsScamming" + "type": "integer", + "format": "int32" }, { "type": "null" @@ -20621,16 +16830,481 @@ }, "type": "object" }, - "UserRacesResponse": { + "FactionMembersResponse": { "required": [ - "races", + "members" + ], + "properties": { + "members": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionMember" + } + } + }, + "type": "object" + }, + "FactionRank": { + "required": [ + "level", + "name", + "division", + "position", + "wins" + ], + "properties": { + "level": { + "description": "/**", + "type": "integer", + "format": "int32" + }, + "name": { + "type": "string" + }, + "division": { + "type": "integer", + "format": "int32" + }, + "position": { + "type": "integer", + "format": "int32" + }, + "wins": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionBasic": { + "required": [ + "id", + "name", + "tag", + "tag_image", + "leader_id", + "co_leader_id", + "respect", + "days_old", + "capacity", + "members", + "is_enlisted", + "rank", + "best_chain" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionId" + }, + "name": { + "type": "string" + }, + "tag": { + "type": "string" + }, + "tag_image": { + "type": "string" + }, + "leader_id": { + "$ref": "#/components/schemas/UserId" + }, + "co-leader_id": { + "$ref": "#/components/schemas/UserId", + "description": "This is replaced with 'co_leader_id' field and will be removed on 1st June 2025." + }, + "co_leader_id": { + "$ref": "#/components/schemas/UserId" + }, + "respect": { + "type": "integer", + "format": "int32" + }, + "days_old": { + "type": "integer", + "format": "int32" + }, + "capacity": { + "type": "integer", + "format": "int32" + }, + "members": { + "type": "integer", + "format": "int32" + }, + "is_enlisted": { + "description": "Indicates if the faction is enlisted for ranked wars. Available only with faction AA permissions for your own faction.", + "oneOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ] + }, + "rank": { + "$ref": "#/components/schemas/FactionRank" + }, + "best_chain": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionBasicResponse": { + "required": [ + "basic" + ], + "properties": { + "basic": { + "$ref": "#/components/schemas/FactionBasic" + } + }, + "type": "object" + }, + "FactionPact": { + "required": [ + "faction_id", + "faction_name", + "until" + ], + "properties": { + "faction_id": { + "$ref": "#/components/schemas/FactionId" + }, + "faction_name": { + "type": "string" + }, + "until": { + "description": "The duration until when is the non-aggression pact valid.", + "type": "string" + } + }, + "type": "object" + }, + "FactionRankedWarParticipant": { + "required": [ + "id", + "name", + "score", + "chain" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionId" + }, + "name": { + "type": "string" + }, + "score": { + "type": "integer", + "format": "int32" + }, + "chain": { + "description": "Faction's current chain.", + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionRankedWar": { + "required": [ + "war_id", + "start", + "end", + "target", + "winner", + "factions" + ], + "properties": { + "war_id": { + "type": "integer", + "format": "int32" + }, + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "target": { + "description": "The score target of the war.", + "type": "integer", + "format": "int32" + }, + "winner": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "factions": { + "description": "The factions involved in the ranked war.", + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionRankedWarParticipant" + } + } + }, + "type": "object" + }, + "FactionRaidWarParticipant": { + "required": [ + "id", + "name", + "score", + "chain", + "is_aggressor" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionId" + }, + "name": { + "type": "string" + }, + "score": { + "type": "integer", + "format": "int32" + }, + "chain": { + "description": "Faction's current chain.", + "type": "integer", + "format": "int32" + }, + "is_aggressor": { + "type": "boolean" + } + }, + "type": "object" + }, + "FactionRaidWar": { + "required": [ + "war_id", + "start", + "end", + "factions" + ], + "properties": { + "war_id": { + "type": "integer", + "format": "int32" + }, + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "factions": { + "description": "The factions involved in the raid war.", + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionRaidWarParticipant" + } + } + }, + "type": "object" + }, + "FactionTerritoryWarParticipant": { + "required": [ + "id", + "name", + "score", + "chain", + "is_aggressor", + "playerIds" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionId" + }, + "name": { + "type": "string" + }, + "score": { + "type": "integer", + "format": "int32" + }, + "chain": { + "description": "Faction's current chain.", + "type": "integer", + "format": "int32" + }, + "is_aggressor": { + "type": "boolean" + }, + "playerIds": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserId" + } + } + }, + "type": "object" + }, + "FactionTerritoryWar": { + "required": [ + "war_id", + "territory", + "start", + "end", + "target", + "factions" + ], + "properties": { + "war_id": { + "type": "integer", + "format": "int32" + }, + "territory": { + "type": "string" + }, + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "target": { + "description": "The score target of the war.", + "type": "integer", + "format": "int32" + }, + "winner": { + "oneOf": [ + { + "$ref": "#/components/schemas/FactionId" + }, + { + "type": "null" + } + ] + }, + "factions": { + "description": "The factions involved in the territory war.", + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryWarParticipant" + } + } + }, + "type": "object" + }, + "FactionWars": { + "required": [ + "ranked", + "raids", + "territory" + ], + "properties": { + "ranked": { + "oneOf": [ + { + "$ref": "#/components/schemas/FactionRankedWar" + }, + { + "type": "null" + } + ] + }, + "raids": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionRaidWar" + } + }, + "territory": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryWar" + } + } + }, + "type": "object" + }, + "FactionWarsResponse": { + "required": [ + "pacts", + "wars" + ], + "properties": { + "pacts": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionPact" + } + }, + "wars": { + "$ref": "#/components/schemas/FactionWars" + } + }, + "type": "object" + }, + "FactionNews": { + "required": [ + "id", + "text", + "timestamp" + ], + "properties": { + "id": { + "type": "string" + }, + "text": { + "type": "string" + }, + "timestamp": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionNewsResponse": { + "required": [ + "news", "_metadata" ], "properties": { - "races": { + "news": { "type": "array", "items": { - "$ref": "#/components/schemas/RacingRaceDetailsResponse" + "$ref": "#/components/schemas/FactionNews" } }, "_metadata": { @@ -20639,87 +17313,1657 @@ }, "type": "object" }, - "UserRaceCarDetails": { - "allOf": [ - { + "FactionAttacksResponse": { + "required": [ + "attacks", + "_metadata" + ], + "properties": { + "attacks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Attack" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "FactionAttacksFullResponse": { + "required": [ + "attacks", + "_metadata" + ], + "properties": { + "attacks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AttackSimplified" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "FactionApplication": { + "required": [ + "id", + "user", + "message", + "valid_until", + "status" + ], + "properties": { + "id": { + "description": "application id", + "type": "integer", + "format": "int32" + }, + "user": { "required": [ "id", "name", - "worth", - "points_spent", - "races_entered", - "races_won", - "is_removed", - "parts" + "level", + "stats" ], "properties": { "id": { - "$ref": "#/components/schemas/RaceCarId" + "$ref": "#/components/schemas/UserId" }, "name": { - "oneOf": [ - { - "type": "string" + "type": "string" + }, + "level": { + "type": "integer", + "format": "int32" + }, + "stats": { + "required": [ + "strength", + "speed", + "dexterity", + "defense" + ], + "properties": { + "strength": { + "type": "integer", + "format": "int64" }, - { - "type": "null" + "speed": { + "type": "integer", + "format": "int64" + }, + "dexterity": { + "type": "integer", + "format": "int64" + }, + "defense": { + "type": "integer", + "format": "int64" } - ] - }, - "worth": { - "type": "integer", - "format": "int64" - }, - "points_spent": { - "type": "integer", - "format": "int32" - }, - "races_entered": { - "type": "integer", - "format": "int32" - }, - "races_won": { - "type": "integer", - "format": "int32" - }, - "is_removed": { - "type": "boolean" - }, - "parts": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RaceCarUpgradeId" - } + }, + "type": "object" } }, "type": "object" }, - { - "$ref": "#/components/schemas/RaceCar" + "message": { + "type": "string" + }, + "valid_until": { + "type": "integer", + "format": "int32" + }, + "status": { + "$ref": "#/components/schemas/FactionApplicationStatusEnum" } - ] + }, + "type": "object" }, - "UserEnlistedCarsResponse": { + "FactionApplicationsResponse": { "required": [ - "enlistedcars" + "applications" ], "properties": { - "enlistedcars": { + "applications": { "type": "array", "items": { - "$ref": "#/components/schemas/UserRaceCarDetails" + "$ref": "#/components/schemas/FactionApplication" } } }, "type": "object" }, - "UserForumPostsResponse": { + "FactionOngoingChain": { "required": [ - "forumPosts", + "id", + "current", + "max", + "timeout", + "modifier", + "cooldown", + "start", + "end" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ChainId" + }, + "current": { + "type": "integer", + "format": "int32" + }, + "max": { + "type": "integer", + "format": "int32" + }, + "timeout": { + "description": "Seconds until chain breaks.", + "type": "integer", + "format": "int32" + }, + "modifier": { + "type": "number", + "format": "float" + }, + "cooldown": { + "description": "Timestamp until when chain is on cooldown.", + "type": "integer", + "format": "int32" + }, + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionOngoingChainResponse": { + "required": [ + "chain" + ], + "properties": { + "chain": { + "$ref": "#/components/schemas/FactionOngoingChain" + } + }, + "type": "object" + }, + "FactionChain": { + "required": [ + "id", + "chain", + "respect", + "start", + "end" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ChainId" + }, + "chain": { + "type": "integer", + "format": "int32" + }, + "respect": { + "type": "number", + "format": "float" + }, + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionChainsResponse": { + "required": [ + "chains", "_metadata" ], "properties": { - "forumPosts": { + "chains": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionChain" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "FactionChainReportResponse": { + "required": [ + "chainreport" + ], + "properties": { + "chainreport": { + "$ref": "#/components/schemas/FactionChainReport" + } + }, + "type": "object" + }, + "FactionChainReport": { + "required": [ + "id", + "faction_id", + "start", + "end", + "details", + "bonuses", + "attackers", + "non_attackers" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ChainId" + }, + "faction_id": { + "$ref": "#/components/schemas/FactionId" + }, + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "type": "integer", + "format": "int32" + }, + "details": { + "$ref": "#/components/schemas/FactionChainReportDetails" + }, + "bonuses": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionChainReportBonus" + } + }, + "attackers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionChainReportAttacker" + } + }, + "non-attackers": { + "description": "This is replaced with 'non_attackers' field and will be removed on 1st June 2025.", + "type": "array", + "items": { + "$ref": "#/components/schemas/UserId" + }, + "deprecated": true + }, + "non_attackers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserId" + } + } + }, + "type": "object" + }, + "FactionChainReportDetails": { + "required": [ + "chain", + "respect", + "members", + "targets", + "war", + "best", + "leave", + "mug", + "hospitalize", + "assists", + "retaliations", + "overseas", + "draws", + "escapes", + "losses" + ], + "properties": { + "chain": { + "type": "integer", + "format": "int32" + }, + "respect": { + "type": "number", + "format": "float" + }, + "members": { + "type": "integer", + "format": "int32" + }, + "targets": { + "type": "integer", + "format": "int32" + }, + "war": { + "type": "integer", + "format": "int32" + }, + "best": { + "type": "number", + "format": "float" + }, + "leave": { + "type": "integer", + "format": "int32" + }, + "mug": { + "type": "integer", + "format": "int32" + }, + "hospitalize": { + "type": "integer", + "format": "int32" + }, + "assists": { + "type": "integer", + "format": "int32" + }, + "retaliations": { + "type": "integer", + "format": "int32" + }, + "overseas": { + "type": "integer", + "format": "int32" + }, + "draws": { + "type": "integer", + "format": "int32" + }, + "escapes": { + "type": "integer", + "format": "int32" + }, + "losses": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionChainReportBonus": { + "required": [ + "attacker_id", + "defender_id", + "chain", + "respect" + ], + "properties": { + "attacker_id": { + "$ref": "#/components/schemas/UserId" + }, + "defender_id": { + "$ref": "#/components/schemas/UserId" + }, + "chain": { + "type": "integer", + "format": "int32" + }, + "respect": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionChainReportAttacker": { + "required": [ + "id", + "respect", + "attacks" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "respect": { + "$ref": "#/components/schemas/FactionChainReportAttackerRespect" + }, + "attacks": { + "$ref": "#/components/schemas/FactionChainReportAttackerAttacks" + } + }, + "type": "object" + }, + "FactionChainReportAttackerRespect": { + "required": [ + "total", + "average", + "best" + ], + "properties": { + "total": { + "type": "number", + "format": "float" + }, + "average": { + "type": "number", + "format": "float" + }, + "best": { + "type": "number", + "format": "float" + } + }, + "type": "object" + }, + "FactionChainReportAttackerAttacks": { + "required": [ + "total", + "leave", + "mug", + "hospitalize", + "assists", + "retaliations", + "overseas", + "draws", + "escpaces", + "losses", + "war", + "bonuses" + ], + "properties": { + "total": { + "type": "integer", + "format": "int32" + }, + "leave": { + "type": "integer", + "format": "int32" + }, + "mug": { + "type": "integer", + "format": "int32" + }, + "hospitalize": { + "type": "integer", + "format": "int32" + }, + "assists": { + "type": "integer", + "format": "int32" + }, + "retaliations": { + "type": "integer", + "format": "int32" + }, + "overseas": { + "type": "integer", + "format": "int32" + }, + "draws": { + "type": "integer", + "format": "int32" + }, + "escapes": { + "type": "integer", + "format": "int32" + }, + "losses": { + "type": "integer", + "format": "int32" + }, + "war": { + "type": "integer", + "format": "int32" + }, + "bonuses": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionCrimeUser": { + "required": [ + "id", + "outcome", + "joined_at", + "progress" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "outcome": { + "description": "This field will be null for old crimes.", + "oneOf": [ + { + "$ref": "#/components/schemas/FactionCrimeUserOutcome" + }, + { + "type": "null" + } + ] + }, + "joined_at": { + "description": "The timestamp at which the user joined the slot.", + "type": "integer", + "format": "int32" + }, + "progress": { + "description": "Current planning progress on the slot.", + "type": "number", + "format": "float" + } + }, + "type": "object" + }, + "FactionCrimeRewardItem": { + "required": [ + "id", + "quantity" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ItemId" + }, + "quantity": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionCrimeRewardPayout": { + "required": [ + "type", + "percentage", + "paid_by", + "paid_at" + ], + "properties": { + "type": { + "$ref": "#/components/schemas/FactionOrganizedCrimePayoutType" + }, + "percentage": { + "description": "Total percentage split between all participants.", + "type": "integer", + "format": "int32" + }, + "paid_by": { + "$ref": "#/components/schemas/UserId" + }, + "paid_at": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionCrimeReward": { + "required": [ + "money", + "items", + "respect", + "payout", + "scope" + ], + "properties": { + "money": { + "type": "integer", + "format": "int32" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionCrimeRewardItem" + } + }, + "respect": { + "type": "integer", + "format": "int32" + }, + "scope": { + "type": "integer", + "format": "int32" + }, + "payout": { + "description": "Details about the crime payouts. This field is null if the crime has not been paid via the automatic payouts system.", + "oneOf": [ + { + "$ref": "#/components/schemas/FactionCrimeRewardPayout" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "FactionCrimeSlot": { + "required": [ + "position", + "item_requirement", + "user", + "checkpoint_pass_rate" + ], + "properties": { + "position": { + "type": "string" + }, + "item_requirement": { + "description": "Details of item required for the slot, if applicable.", + "oneOf": [ + { + "required": [ + "id", + "is_reusable", + "is_available" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ItemId" + }, + "is_reusable": { + "description": "Shows if the item is reusable or consumed during the crime.", + "type": "boolean" + }, + "is_available": { + "description": "Shows if user has the required item.", + "type": "boolean" + } + }, + "type": "object" + }, + { + "type": "null" + } + ] + }, + "user": { + "description": "Details about the user joined the slot, if any.", + "oneOf": [ + { + "$ref": "#/components/schemas/FactionCrimeUser" + }, + { + "type": "null" + } + ] + }, + "checkpoint_pass_rate": { + "description": "Returns CPR for the player who joined the slot. If the slot is empty (availalbe), it shows your CPR for that slot. This value is 0 for expired crimes.", + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionCrime": { + "required": [ + "id", + "name", + "previous_crime_id", + "difficulty", + "status", + "created_at", + "planning_at", + "ready_at", + "expired_at", + "executed_at", + "slots", + "rewards" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionCrimeId" + }, + "previous_crime_id": { + "oneOf": [ + { + "$ref": "#/components/schemas/FactionCrimeId" + }, + { + "type": "null" + } + ] + }, + "name": { + "type": "string" + }, + "difficulty": { + "type": "integer", + "format": "int32" + }, + "status": { + "$ref": "#/components/schemas/FactionCrimeStatusEnum" + }, + "created_at": { + "description": "The timestamp at which the crime was created.", + "type": "integer", + "format": "int32" + }, + "planning_at": { + "description": "The timestamp at which the planning phase for the crime has begun.", + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "ready_at": { + "description": "The timestamp at which the crime will be ready.", + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "expired_at": { + "description": "The timestamp at which the crime will expire.", + "type": "integer", + "format": "int32" + }, + "executed_at": { + "description": "The timestamp at which the crime was executed.
Note: this value is null for all crimes executed before January 15th, 2025.", + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "slots": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionCrimeSlot" + } + }, + "rewards": { + "description": "Details about the crime rewards. Available only for crimes with 'Successful' status.", + "oneOf": [ + { + "$ref": "#/components/schemas/FactionCrimeReward" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "FactionCrimesResponse": { + "required": [ + "crimes", + "_metadata" + ], + "properties": { + "crimes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionCrime" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "FactionCrimeResponse": { + "required": [ + "crime" + ], + "properties": { + "crime": { + "$ref": "#/components/schemas/FactionCrime" + } + }, + "type": "object" + }, + "FactionBalance": { + "required": [ + "faction", + "members" + ], + "properties": { + "faction": { + "required": [ + "money", + "points", + "scope" + ], + "properties": { + "money": { + "type": "integer", + "format": "int64" + }, + "points": { + "type": "integer", + "format": "int64" + }, + "scope": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "members": { + "type": "array", + "items": { + "required": [ + "id", + "username", + "money", + "points" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "username": { + "type": "string" + }, + "money": { + "type": "integer", + "format": "int64" + }, + "points": { + "type": "integer", + "format": "int64" + } + }, + "type": "object" + } + } + }, + "type": "object" + }, + "FactionBalanceResponse": { + "required": [ + "balance" + ], + "properties": { + "balance": { + "$ref": "#/components/schemas/FactionBalance" + } + }, + "type": "object" + }, + "FactionSelectionName": { + "description": "The following selections will fallback to API v1 and may change at any time: 'armor', 'boosters', 'caches', 'cesium', 'crimeexp', 'drugs', 'medical', 'positions', 'reports', 'temporary', 'weapons'.\n * The following selections are not available in API v2: 'armorynews', 'attacknews', 'crimenews', 'currency', 'donations', 'fundsnews', 'mainnews', 'membershipnews', 'territorynews'.", + "type": "string", + "enum": [ + "applications", + "attacks", + "attacksfull", + "balance", + "basic", + "chain", + "chainreport", + "chains", + "contributors", + "crime", + "crimes", + "hof", + "lookup", + "members", + "news", + "rackets", + "rankedwars", + "rankedwarreport", + "revives", + "revivesfull", + "stats", + "territory", + "territoryownership", + "territorywarreport", + "territorywars", + "timestamp", + "upgrades", + "wars", + "armor", + "boosters", + "caches", + "cesium", + "crimeexp", + "drugs", + "medical", + "positions", + "reports", + "temporary", + "weapons", + "armorynews", + "attacknews", + "crimenews", + "currency", + "donations", + "fundsnews", + "mainnews", + "membershipnews", + "territorynews" + ] + }, + "FactionLookupResponse": { + "required": [ + "selections" + ], + "properties": { + "selections": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionSelectionName" + } + } + }, + "type": "object" + }, + "FactionRankedWarDetails": { + "required": [ + "id", + "start", + "end", + "target", + "winner", + "factions" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/RankedWarId" + }, + "start": { + "description": "Timestamp the war started at.", + "type": "integer", + "format": "int32" + }, + "end": { + "description": "Timestamp the war ended at.", + "type": "integer", + "format": "int32" + }, + "target": { + "type": "integer", + "format": "int32" + }, + "winner": { + "oneOf": [ + { + "$ref": "#/components/schemas/FactionId" + }, + { + "type": "null" + } + ] + }, + "factions": { + "type": "array", + "items": { + "required": [ + "id", + "name", + "score", + "chain" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionId" + }, + "name": { + "type": "string" + }, + "score": { + "type": "integer", + "format": "int32" + }, + "chain": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + } + }, + "type": "object" + }, + "FactionRankedWarResponse": { + "required": [ + "rankedwars", + "_metadata" + ], + "properties": { + "rankedwars": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionRankedWarDetails" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "FactionRankedWarReportResponse": { + "required": [ + "rankedwarreport" + ], + "properties": { + "rankedwarreport": { + "required": [ + "id", + "start", + "end", + "winner", + "forfeit", + "factions" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/RankedWarId" + }, + "start": { + "description": "Timestamp the war started at.", + "type": "integer", + "format": "int32" + }, + "end": { + "description": "Timestamp the war ended at.", + "type": "integer", + "format": "int32" + }, + "winner": { + "$ref": "#/components/schemas/FactionId" + }, + "forfeit": { + "type": "boolean" + }, + "factions": { + "type": "array", + "items": { + "required": [ + "id", + "name", + "score", + "attacks", + "rank", + "rewards", + "members" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionId" + }, + "name": { + "type": "string" + }, + "score": { + "type": "integer", + "format": "int32" + }, + "attacks": { + "type": "integer", + "format": "int32" + }, + "rank": { + "required": [ + "before", + "after" + ], + "properties": { + "before": { + "type": "string" + }, + "after": { + "type": "string" + } + }, + "type": "object" + }, + "rewards": { + "required": [ + "respect", + "points", + "items" + ], + "properties": { + "respect": { + "type": "integer", + "format": "int32" + }, + "points": { + "type": "integer", + "format": "int32" + }, + "items": { + "type": "array", + "items": { + "required": [ + "id", + "name", + "quantity" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ItemId" + }, + "name": { + "type": "string" + }, + "quantity": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + } + }, + "type": "object" + }, + "members": { + "type": "array", + "items": { + "required": [ + "id", + "name", + "level", + "attacks", + "score" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "name": { + "type": "string" + }, + "level": { + "type": "integer", + "format": "int32" + }, + "attacks": { + "type": "integer", + "format": "int32" + }, + "score": { + "type": "number", + "format": "float" + } + }, + "type": "object" + } + } + }, + "type": "object" + } + } + }, + "type": "object" + } + }, + "type": "object" + }, + "ForumCategoriesResponse": { + "required": [ + "categories" + ], + "properties": { + "categories": { + "type": "array", + "items": { + "required": [ + "id", + "title", + "acronym", + "threads" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ForumId" + }, + "title": { + "type": "string" + }, + "acronym": { + "type": "string" + }, + "threads": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + } + }, + "type": "object" + }, + "ForumThreadAuthor": { + "required": [ + "id", + "username", + "karma" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "username": { + "type": "string" + }, + "karma": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "ForumPollVote": { + "required": [ + "answer", + "votes" + ], + "properties": { + "answer": { + "type": "string" + }, + "votes": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "ForumPoll": { + "required": [ + "question", + "answers_count", + "answers" + ], + "properties": { + "question": { + "type": "string" + }, + "answers_count": { + "type": "integer", + "format": "int32" + }, + "answers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ForumPollVote" + } + } + }, + "type": "object" + }, + "ForumThreadBase": { + "required": [ + "id", + "title", + "forum_id", + "posts", + "rating", + "views", + "author", + "last_poster", + "first_post_time", + "last_post_time", + "has_poll", + "is_locked", + "is_sticky" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ForumThreadId" + }, + "title": { + "type": "string" + }, + "forum_id": { + "$ref": "#/components/schemas/ForumId" + }, + "posts": { + "type": "integer", + "format": "int32" + }, + "rating": { + "type": "integer", + "format": "int32" + }, + "views": { + "description": "Total number of times players have opened this thread.", + "type": "integer", + "format": "int32" + }, + "author": { + "$ref": "#/components/schemas/ForumThreadAuthor" + }, + "last_poster": { + "oneOf": [ + { + "$ref": "#/components/schemas/ForumThreadAuthor" + }, + { + "type": "null" + } + ] + }, + "first_post_time": { + "type": "integer", + "format": "int32" + }, + "last_post_time": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "has_poll": { + "type": "boolean" + }, + "is_locked": { + "type": "boolean" + }, + "is_sticky": { + "type": "boolean" + } + }, + "type": "object" + }, + "ForumThreadExtended": { + "allOf": [ + { + "$ref": "#/components/schemas/ForumThreadBase" + }, + { + "required": [ + "content", + "content_raw", + "poll" + ], + "properties": { + "content": { + "type": "string" + }, + "content_raw": { + "type": "string" + }, + "poll": { + "description": "'poll' is null when 'has_poll' is false.", + "oneOf": [ + { + "$ref": "#/components/schemas/ForumPoll" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + } + ] + }, + "ForumPost": { + "required": [ + "id", + "thread_id", + "author", + "is_legacy", + "is_topic", + "is_edited", + "is_pinned", + "created_time", + "edited_by", + "has_quote", + "quoted_post_id", + "content", + "likes", + "dislikes" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ForumPostId" + }, + "thread_id": { + "$ref": "#/components/schemas/ForumThreadId" + }, + "author": { + "$ref": "#/components/schemas/ForumThreadAuthor" + }, + "is_legacy": { + "description": "Indicates whether post was made using the old formatting engine which doesn't use HTML.", + "type": "boolean" + }, + "is_topic": { + "type": "boolean" + }, + "is_edited": { + "type": "boolean" + }, + "is_pinned": { + "type": "boolean" + }, + "created_time": { + "type": "integer", + "format": "int32" + }, + "edited_by": { + "description": "'edited_by' is null when 'is_edited' is false.", + "oneOf": [ + { + "$ref": "#/components/schemas/UserId" + }, + { + "type": "null" + } + ] + }, + "has_quote": { + "type": "boolean" + }, + "quoted_post_id": { + "description": "'quoted_post_id' is null when 'has_quote' is false.", + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "content": { + "description": "depending on the input 'cat' parameter, this will either return raw value (with HTML) or plain text. Legacy posts are returned as is, they can't be stripped of tags.", + "type": "string" + }, + "likes": { + "type": "integer", + "format": "int32" + }, + "dislikes": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "ForumThreadUserExtended": { + "allOf": [ + { + "$ref": "#/components/schemas/ForumThreadBase" + }, + { + "required": [ + "new_posts" + ], + "properties": { + "new_posts": { + "description": "Available only when requesting data for yourself (no id or your id) with at least 'Minimal' access type key.", + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + } + ] + }, + "ForumSubscribedThreadPostsCount": { + "required": [ + "new", + "total" + ], + "properties": { + "new": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "ForumSubscribedThread": { + "required": [ + "id", + "forum_id", + "author", + "title", + "posts" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ForumThreadId" + }, + "forum_id": { + "$ref": "#/components/schemas/ForumId" + }, + "author": { + "$ref": "#/components/schemas/ForumThreadAuthor" + }, + "title": { + "type": "string" + }, + "posts": { + "$ref": "#/components/schemas/ForumSubscribedThreadPostsCount" + } + }, + "type": "object" + }, + "ForumFeed": { + "required": [ + "thread_id", + "post_id", + "user", + "title", + "text", + "timestamp", + "is_seen", + "type" + ], + "properties": { + "thread_id": { + "$ref": "#/components/schemas/ForumThreadId" + }, + "post_id": { + "$ref": "#/components/schemas/ForumPostId" + }, + "user": { + "$ref": "#/components/schemas/ForumThreadAuthor" + }, + "title": { + "type": "string" + }, + "text": { + "type": "string" + }, + "timestamp": { + "type": "integer", + "format": "int32" + }, + "is_seen": { + "type": "boolean" + }, + "type": { + "$ref": "#/components/schemas/ForumFeedTypeEnum" + } + }, + "type": "object" + }, + "ForumThreadsResponse": { + "required": [ + "threads", + "_metadata" + ], + "properties": { + "threads": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ForumThreadBase" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "ForumThreadResponse": { + "required": [ + "thread" + ], + "properties": { + "thread": { + "$ref": "#/components/schemas/ForumThreadExtended" + } + }, + "type": "object" + }, + "ForumPostsResponse": { + "required": [ + "posts", + "_metadata" + ], + "properties": { + "posts": { "type": "array", "items": { "$ref": "#/components/schemas/ForumPost" @@ -20731,284 +18975,309 @@ }, "type": "object" }, - "UserForumThreadsResponse": { - "required": [ - "forumThreads", - "_metadata" - ], - "properties": { - "forumThreads": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ForumThreadUserExtended" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" + "ForumSelectionName": { + "type": "string", + "enum": [ + "categories", + "lookup", + "posts", + "thread", + "threads", + "timestamp" + ] }, - "UserForumSubscribedThreadsResponse": { + "ForumLookupResponse": { "required": [ - "forumSbuscribedThreads" + "selections" ], "properties": { - "forumSubscribedThreads": { + "selections": { "type": "array", "items": { - "$ref": "#/components/schemas/ForumSubscribedThread" + "$ref": "#/components/schemas/ForumSelectionName" } } }, "type": "object" }, - "UserForumFeedResponse": { + "KeyLogResponse": { "required": [ - "forumFeed" + "log" ], "properties": { - "forumFeed": { + "log": { "type": "array", "items": { - "$ref": "#/components/schemas/ForumFeed" + "required": [ + "timestamp", + "type", + "selections", + "id", + "ip" + ], + "properties": { + "timestamp": { + "type": "integer", + "format": "int32" + }, + "type": { + "type": "string" + }, + "selections": { + "type": "string" + }, + "id": { + "oneOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "null" + } + ] + }, + "comment": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "ip": { + "type": "string" + } + }, + "type": "object" } } }, "type": "object" }, - "UserForumFriendsResponse": { + "KeyInfoResponse": { "required": [ - "forumFriends" + "info" ], "properties": { - "forumFriends": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ForumFeed" - } + "info": { + "required": [ + "selections", + "access" + ], + "properties": { + "selections": { + "required": [ + "company", + "faction", + "market", + "property", + "torn", + "user", + "racing", + "forum", + "key" + ], + "properties": { + "company": { + "type": "array", + "items": { + "type": "string" + } + }, + "faction": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionSelectionName" + } + }, + "market": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MarketSelectionName" + } + }, + "property": { + "type": "array", + "items": { + "type": "string" + } + }, + "torn": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornSelectionName" + } + }, + "user": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserSelectionName" + } + }, + "racing": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RacingSelectionName" + } + }, + "forum": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ForumSelectionName" + } + }, + "key": { + "type": "array", + "items": { + "$ref": "#/components/schemas/KeySelectionName" + } + } + }, + "type": "object" + }, + "access": { + "required": [ + "level", + "type", + "faction", + "company" + ], + "properties": { + "level": { + "type": "integer", + "format": "int32" + }, + "type": { + "$ref": "#/components/schemas/ApiKeyAccessTypeEnum" + }, + "faction": { + "type": "boolean" + }, + "faction_id": { + "oneOf": [ + { + "$ref": "#/components/schemas/FactionId" + }, + { + "type": "null" + } + ] + }, + "company": { + "type": "boolean" + }, + "company_id": { + "oneOf": [ + { + "$ref": "#/components/schemas/CompanyId" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + } + }, + "type": "object" } }, "type": "object" }, - "HofValue": { + "KeySelectionName": { + "type": "string", + "enum": [ + "info", + "log" + ] + }, + "ItemMarketListingItemBonus": { "required": [ - "value", - "rank" + "id", + "title", + "description", + "value" ], "properties": { - "value": { + "id": { "type": "integer", - "format": "int64" + "format": "int32" }, - "rank": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "value": { "type": "integer", "format": "int32" } }, "type": "object" }, - "HofValueString": { + "ItemMarketListingItemStats": { "required": [ - "value", - "rank" + "damage", + "accuracy", + "armor", + "quality" ], "properties": { - "value": { - "type": "string" - }, - "rank": { + "damage": { "oneOf": [ { "type": "number", - "format": "int32" + "format": "float" }, { "type": "null" } ] - } - }, - "type": "object" - }, - "UserHofStats": { - "required": [ - "attacks", - "busts", - "defends", - "networth", - "offences", - "revives", - "level", - "rank", - "awards", - "racing_skill", - "racing_points", - "racing_wins", - "travel_time", - "working_stats", - "battle_stats" - ], - "properties": { - "attacks": { - "$ref": "#/components/schemas/HofValue" }, - "busts": { - "$ref": "#/components/schemas/HofValue" - }, - "defends": { - "$ref": "#/components/schemas/HofValue" - }, - "networth": { - "$ref": "#/components/schemas/HofValue" - }, - "offences": { - "$ref": "#/components/schemas/HofValue" - }, - "revives": { - "$ref": "#/components/schemas/HofValue" - }, - "level": { - "$ref": "#/components/schemas/HofValue" - }, - "rank": { - "$ref": "#/components/schemas/HofValue" - }, - "awards": { - "$ref": "#/components/schemas/HofValue" - }, - "racing_skill": { - "$ref": "#/components/schemas/HofValue" - }, - "racing_points": { - "$ref": "#/components/schemas/HofValue" - }, - "racing_wins": { - "$ref": "#/components/schemas/HofValue" - }, - "travel_time": { - "$ref": "#/components/schemas/HofValue" - }, - "working_stats": { - "$ref": "#/components/schemas/HofValue" - }, - "battle_stats": { + "accuracy": { "oneOf": [ { - "$ref": "#/components/schemas/HofValue" + "type": "number", + "format": "float" }, { "type": "null" } ] - } - }, - "type": "object" - }, - "UserHofResponse": { - "required": [ - "hof" - ], - "properties": { - "hof": { - "$ref": "#/components/schemas/UserHofStats" - } - }, - "type": "object" - }, - "UserCalendar": { - "required": [ - "start_time" - ], - "properties": { - "start_time": { - "description": "Event start time displayed in TCT.", - "type": "string" - } - }, - "type": "object" - }, - "UserCalendarResponse": { - "required": [ - "calendar" - ], - "properties": { - "calendar": { - "$ref": "#/components/schemas/UserCalendar" - } - }, - "type": "object" - }, - "UserBountiesResponse": { - "required": [ - "bounties" - ], - "properties": { - "bounties": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Bounty" - } - } - }, - "type": "object" - }, - "UserJobRanks": { - "required": [ - "army", - "grocer", - "casino", - "medical", - "law", - "education" - ], - "properties": { - "army": { - "$ref": "#/components/schemas/JobPositionArmyEnum" }, - "grocer": { - "$ref": "#/components/schemas/JobPositionGrocerEnum" + "armor": { + "oneOf": [ + { + "type": "number", + "format": "float" + }, + { + "type": "null" + } + ] }, - "casino": { - "$ref": "#/components/schemas/JobPositionCasinoEnum" - }, - "medical": { - "$ref": "#/components/schemas/JobPositionMedicalEnum" - }, - "law": { - "$ref": "#/components/schemas/JobPositionLawEnum" - }, - "education": { - "$ref": "#/components/schemas/JobPositionEducationEnum" + "quality": { + "type": "number", + "format": "float" } }, "type": "object" }, - "UserJobRanksResponse": { - "required": [ - "jobranks" - ], - "properties": { - "jobranks": { - "$ref": "#/components/schemas/UserJobRanks" - } - }, - "type": "object" - }, - "UserItemMarkeListingItemDetails": { + "ItemMarketItem": { "required": [ "id", "name", "type", - "rarity", - "uid", - "stats", - "bonuses" + "average_price" ], "properties": { "id": { - "type": "integer", - "format": "int64" + "$ref": "#/components/schemas/ItemId" }, "name": { "type": "string" @@ -21016,6 +19285,50 @@ "type": { "type": "string" }, + "average_price": { + "type": "integer", + "format": "int64" + } + }, + "type": "object" + }, + "ItemMarketListingStackable": { + "required": [ + "price", + "amount" + ], + "properties": { + "price": { + "type": "integer", + "format": "int64" + }, + "amount": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "ItemMarketListingItemDetails": { + "required": [ + "uid", + "stats", + "bonuses", + "rarity" + ], + "properties": { + "uid": { + "$ref": "#/components/schemas/ItemUid" + }, + "stats": { + "$ref": "#/components/schemas/ItemMarketListingItemStats" + }, + "bonuses": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ItemMarketListingItemBonus" + } + }, "rarity": { "oneOf": [ { @@ -21030,88 +19343,64 @@ "type": "null" } ] - }, - "uid": { - "oneOf": [ - { - "$ref": "#/components/schemas/ItemUid" - }, - { - "type": "null" - } - ] - }, - "stats": { - "oneOf": [ - { - "$ref": "#/components/schemas/ItemMarketListingItemStats" - }, - { - "type": "null" - } - ] - }, - "bonuses": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ItemMarketListingItemBonus" - } } }, "type": "object" }, - "UserItemMarketListing": { + "ItemMarketListingNonstackable": { "required": [ - "id", "price", - "average_price", "amount", - "is_anonymous", - "available", - "item" + "item_details" ], "properties": { - "id": { - "type": "integer", - "format": "int64" - }, "price": { "type": "integer", "format": "int64" }, - "average_price": { - "type": "integer", - "format": "int64" - }, "amount": { "type": "integer", "format": "int32" }, - "is_anonymous": { - "type": "boolean" - }, - "available": { - "description": "Amount remaining in the inventory.", - "type": "integer", - "format": "int32" - }, - "item": { - "$ref": "#/components/schemas/UserItemMarkeListingItemDetails" + "item_details": { + "$ref": "#/components/schemas/ItemMarketListingItemDetails" } }, "type": "object" }, - "UserItemMarketResponse": { + "ItemMarket": { + "required": [ + "item", + "listings" + ], + "properties": { + "item": { + "$ref": "#/components/schemas/ItemMarketItem" + }, + "listings": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/ItemMarketListingNonstackable" + }, + { + "$ref": "#/components/schemas/ItemMarketListingStackable" + } + ] + } + } + }, + "type": "object" + }, + "MarketItemMarketResponse": { "required": [ "itemmarket", "_metadata" ], "properties": { "itemmarket": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserItemMarketListing" - } + "$ref": "#/components/schemas/ItemMarket" }, "_metadata": { "$ref": "#/components/schemas/RequestMetadataWithLinks" @@ -21119,183 +19408,18 @@ }, "type": "object" }, - "UserFactionBalance": { - "required": [ - "money", - "points" - ], - "properties": { - "money": { - "type": "integer", - "format": "int64" - }, - "points": { - "type": "integer", - "format": "int64" - } - }, - "type": "object" - }, - "UserFactionBalanceResponse": { - "required": [ - "factionBalance" - ], - "properties": { - "factionBalance": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserFactionBalance" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "UserOrganizedCrimeResponse": { - "required": [ - "organizedCrime" - ], - "properties": { - "organizedCrime": { - "oneOf": [ - { - "$ref": "#/components/schemas/FactionCrime" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "UserList": { - "required": [ - "id", - "name", - "level", - "faction_id", - "last_action", - "status" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "name": { - "type": "string" - }, - "level": { - "type": "integer", - "format": "int32" - }, - "faction_id": { - "oneOf": [ - { - "$ref": "#/components/schemas/FactionId" - }, - { - "type": "null" - } - ] - }, - "last_action": { - "$ref": "#/components/schemas/UserLastAction" - }, - "status": { - "$ref": "#/components/schemas/UserStatus" - } - }, - "type": "object" - }, - "UserListResponse": { - "required": [ - "list", - "_metadata" - ], - "properties": { - "list": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserList" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "UserSelectionName": { - "description": "The following selections will fallback to API v1 and may change at any time: 'ammo','bars','basic','battlestats','bazaar','cooldowns','criminalrecord','discord','display','education','equipment','events','gym','honors','icons','inventory','jobpoints','log','medals','merits','messages','missions','money','networth','newevents','newmessages','notifications','perks','profile','properties','refills','reports','skills','stocks','travel','weaponexp','workstats'.", + "MarketSelectionName": { + "description": "The following selections will fallback to API v1 and may change at any time: 'pointsmarket'.", "type": "string", "enum": [ - "attacks", - "attacksfull", - "bounties", - "calendar", - "crimes", - "enlistedcars", - "factionbalance", - "forumfeed", - "forumfriends", - "forumposts", - "forumsubscribedthreads", - "forumthreads", - "hof", "itemmarket", - "jobranks", - "list", "lookup", - "organizedcrime", - "personalstats", - "races", - "revives", - "revivesfull", "timestamp", - "ammo", - "bars", - "basic", - "battlestats", - "bazaar", - "cooldowns", - "criminalrecord", - "discord", - "display", - "education", - "equipment", - "events", - "gym", - "honors", - "icons", - "inventory", - "jobpoints", - "log", - "medals", - "merits", - "messages", - "missions", - "money", - "networth", - "newevents", - "newmessages", - "notifications", - "perks", - "profile", - "properties", - "refills", - "reports", - "skills", - "stocks", - "travel", - "weaponexp", - "workstats" + "pointsmarket", + "bazaar" ] }, - "UserLookupResponse": { + "MarketLookupResponse": { "required": [ "selections" ], @@ -21303,7 +19427,2024 @@ "selections": { "type": "array", "items": { - "$ref": "#/components/schemas/UserSelectionName" + "$ref": "#/components/schemas/MarketSelectionName" + } + } + }, + "type": "object" + }, + "RacingCarsResponse": { + "required": [ + "cars" + ], + "properties": { + "cars": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RaceCar" + } + } + }, + "type": "object" + }, + "RaceCar": { + "required": [ + "car_item_id", + "car_item_name", + "top_speed", + "acceleration", + "braking", + "dirt", + "handling", + "safety", + "tarmac", + "class" + ], + "properties": { + "car_item_id": { + "$ref": "#/components/schemas/ItemId" + }, + "car_item_name": { + "type": "string" + }, + "top_speed": { + "type": "integer", + "format": "int32" + }, + "acceleration": { + "type": "integer", + "format": "int32" + }, + "braking": { + "type": "integer", + "format": "int32" + }, + "dirt": { + "type": "integer", + "format": "int32" + }, + "handling": { + "type": "integer", + "format": "int32" + }, + "safety": { + "type": "integer", + "format": "int32" + }, + "tarmac": { + "type": "integer", + "format": "int32" + }, + "class": { + "$ref": "#/components/schemas/RaceClassEnum" + } + }, + "type": "object" + }, + "RacingTracksResponse": { + "required": [ + "tracks" + ], + "properties": { + "tracks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RaceTrack" + } + } + }, + "type": "object" + }, + "RaceTrack": { + "required": [ + "id", + "title", + "description" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/RaceTrackId" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "type": "object" + }, + "RacingCarUpgradesResponse": { + "required": [ + "carupgrades" + ], + "properties": { + "carupgrades": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RaceCarUpgrade" + } + } + }, + "type": "object" + }, + "RaceCarUpgrade": { + "required": [ + "id", + "class_required", + "name", + "description", + "category", + "subcategory", + "effects", + "cost" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/RaceCarUpgradeId" + }, + "class_required": { + "$ref": "#/components/schemas/RaceClassEnum" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "category": { + "$ref": "#/components/schemas/RaceCarUpgradeCategory" + }, + "subcategory": { + "$ref": "#/components/schemas/RaceCarUpgradeSubCategory" + }, + "effects": { + "required": [ + "top_speed", + "acceleration", + "braking", + "handling", + "safety", + "dirt", + "tarmac" + ], + "properties": { + "top_speed": { + "type": "integer", + "format": "int32" + }, + "acceleration": { + "type": "integer", + "format": "int32" + }, + "braking": { + "type": "integer", + "format": "int32" + }, + "handling": { + "type": "integer", + "format": "int32" + }, + "safety": { + "type": "integer", + "format": "int32" + }, + "dirt": { + "type": "integer", + "format": "int32" + }, + "tarmac": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "cost": { + "required": [ + "points", + "cash" + ], + "properties": { + "points": { + "type": "integer", + "format": "int32" + }, + "cash": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "RacingRacesResponse": { + "required": [ + "races", + "_metadata" + ], + "properties": { + "races": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Race" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "Race": { + "required": [ + "id", + "title", + "track_id", + "creator_id", + "status", + "laps", + "participants", + "schedule", + "requirements" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/RaceId" + }, + "title": { + "type": "string" + }, + "track_id": { + "$ref": "#/components/schemas/RaceTrackId" + }, + "creator_id": { + "$ref": "#/components/schemas/UserId" + }, + "status": { + "$ref": "#/components/schemas/RaceStatusEnum" + }, + "laps": { + "type": "integer", + "format": "int32" + }, + "participants": { + "required": [ + "minimum", + "maximum", + "current" + ], + "properties": { + "minimum": { + "type": "integer", + "format": "int32" + }, + "maximum": { + "type": "integer", + "format": "int32" + }, + "current": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "schedule": { + "required": [ + "join_from", + "join_until", + "start", + "end" + ], + "properties": { + "join_from": { + "type": "integer", + "format": "int32" + }, + "join_until": { + "type": "integer", + "format": "int32" + }, + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "requirements": { + "required": [ + "car_class", + "driver_class", + "car_item_id", + "requires_stock_car", + "requires_password", + "join_fee" + ], + "properties": { + "car_class": { + "oneOf": [ + { + "$ref": "#/components/schemas/RaceClassEnum" + }, + { + "type": "null" + } + ] + }, + "driver_class": { + "oneOf": [ + { + "$ref": "#/components/schemas/RaceClassEnum" + }, + { + "type": "null" + } + ] + }, + "car_item_id": { + "oneOf": [ + { + "$ref": "#/components/schemas/ItemId" + }, + { + "type": "null" + } + ] + }, + "requires_stock_car": { + "type": "boolean" + }, + "requires_password": { + "type": "boolean" + }, + "join_fee": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "RacingTrackRecordsResponse": { + "required": [ + "records" + ], + "properties": { + "records": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RaceRecord" + } + } + }, + "type": "object" + }, + "RaceRecord": { + "required": [ + "driver_id", + "driver_name", + "car_item_id", + "lap_time", + "car_item_name" + ], + "properties": { + "driver_id": { + "$ref": "#/components/schemas/UserId" + }, + "driver_name": { + "type": "string" + }, + "car_item_id": { + "$ref": "#/components/schemas/ItemId" + }, + "lap_time": { + "type": "number", + "format": "float" + }, + "car_item_name": { + "type": "string" + } + }, + "type": "object" + }, + "RacerDetails": { + "required": [ + "driver_id", + "position", + "car_id", + "car_item_id", + "car_item_name", + "car_class", + "has_crashed", + "best_lap_time", + "race_time", + "time_ended" + ], + "properties": { + "driver_id": { + "$ref": "#/components/schemas/UserId" + }, + "position": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "car_id": { + "$ref": "#/components/schemas/RaceCarId" + }, + "car_item_id": { + "$ref": "#/components/schemas/ItemId" + }, + "car_item_name": { + "type": "string" + }, + "car_class": { + "$ref": "#/components/schemas/RaceClassEnum" + }, + "has_crashed": { + "oneOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ] + }, + "best_lap_time": { + "oneOf": [ + { + "type": "number", + "format": "float" + }, + { + "type": "null" + } + ] + }, + "race_time": { + "oneOf": [ + { + "type": "number", + "format": "float" + }, + { + "type": "null" + } + ] + }, + "time_ended": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "RacingRaceDetailsResponse": { + "properties": { + "race": { + "allOf": [ + { + "$ref": "#/components/schemas/Race" + }, + { + "required": [ + "results" + ], + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RacerDetails" + } + } + }, + "type": "object" + } + ] + } + }, + "type": "object" + }, + "RacingSelectionName": { + "type": "string", + "enum": [ + "cars", + "carupgrades", + "lookup", + "race", + "races", + "records", + "timestamp", + "tracks" + ] + }, + "RacingLookupResponse": { + "required": [ + "selections" + ], + "properties": { + "selections": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RacingSelectionName" + } + } + }, + "type": "object" + }, + "TornEducationRewards": { + "required": [ + "working_stats", + "effect", + "honor" + ], + "properties": { + "working_stats": { + "required": [ + "manual_labor", + "intelligence", + "endurance" + ], + "properties": { + "manual_labor": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "intelligence": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "endurance": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "effect": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "honor": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "TornEducationPrerequisites": { + "required": [ + "cost", + "courses" + ], + "properties": { + "cost": { + "type": "integer", + "format": "int32" + }, + "courses": { + "type": "array", + "items": { + "type": "integer", + "format": "int32" + } + } + }, + "type": "object" + }, + "TornEducationCourses": { + "required": [ + "id", + "code", + "name", + "description", + "duration", + "rewards", + "prerequisites" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/EducationId" + }, + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "duration": { + "type": "integer", + "format": "int32" + }, + "rewards": { + "$ref": "#/components/schemas/TornEducationRewards" + }, + "prerequisites": { + "$ref": "#/components/schemas/TornEducationPrerequisites" + } + }, + "type": "object" + }, + "TornEducation": { + "required": [ + "id", + "name", + "courses" + ], + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "name": { + "type": "string" + }, + "courses": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornEducationCourses" + } + } + }, + "type": "object" + }, + "TornEducationResponse": { + "required": [ + "education" + ], + "properties": { + "education": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornEducation" + } + } + }, + "type": "object" + }, + "TornTerritoryCoordinates": { + "required": [ + "x", + "y" + ], + "properties": { + "x": { + "type": "number", + "format": "float" + }, + "y": { + "type": "number", + "format": "float" + } + }, + "type": "object" + }, + "TornTerritory": { + "required": [ + "id", + "sector", + "size", + "density", + "slots", + "respect", + "coordinates", + "neighbors" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionTerritoryEnum" + }, + "sector": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "density": { + "type": "integer", + "format": "int32" + }, + "slots": { + "type": "integer", + "format": "int32" + }, + "respect": { + "type": "integer", + "format": "int32" + }, + "coordinates": { + "$ref": "#/components/schemas/TornTerritoryCoordinates" + }, + "neighbors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryEnum" + } + } + }, + "type": "object" + }, + "TornTerritoriesResponse": { + "required": [ + "territory", + "_metadata" + ], + "properties": { + "territory": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornTerritory" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "TornTerritoriesNoLinksReponse": { + "required": [ + "territory" + ], + "properties": { + "territory": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornTerritory" + } + } + }, + "type": "object" + }, + "TornSubcrimesResponse": { + "required": [ + "subcrimes" + ], + "properties": { + "subcrimes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornSubcrime" + } + } + }, + "type": "object" + }, + "TornSubcrime": { + "required": [ + "id", + "name", + "nerve_cost" + ], + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "name": { + "type": "string" + }, + "nerve_cost": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "TornCrime": { + "required": [ + "id", + "name", + "category_id", + "enhancer_id", + "enhancer_name", + "unique_outcomes_count", + "unique_outcomes_ids" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/TornCrimeId" + }, + "name": { + "type": "string" + }, + "category_id": { + "type": "integer", + "format": "int32" + }, + "category_name": { + "type": "string" + }, + "enhancer_id": { + "type": "integer", + "format": "int32" + }, + "enhancer_name": { + "type": "string" + }, + "unique_outcomes_count": { + "type": "integer", + "format": "int32" + }, + "unique_outcomes_ids": { + "type": "array", + "items": { + "type": "integer", + "format": "int32" + } + }, + "notes": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "type": "object" + }, + "TornCrimesResponse": { + "required": [ + "crimes" + ], + "properties": { + "crimes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornCrime" + } + } + }, + "type": "object" + }, + "TornCalendarActivity": { + "required": [ + "title", + "description", + "start", + "end" + ], + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "TornCalendarResponse": { + "required": [ + "calendar" + ], + "properties": { + "calendar": { + "required": [ + "competitions", + "events" + ], + "properties": { + "competitions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornCalendarActivity" + } + }, + "events": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornCalendarActivity" + } + } + }, + "type": "object" + } + }, + "type": "object" + }, + "TornHof": { + "required": [ + "id", + "username", + "faction_id", + "level", + "last_action", + "rank_name", + "rank_number", + "position", + "signed_up", + "age_in_days", + "value", + "rank" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "username": { + "type": "string" + }, + "faction_id": { + "$ref": "#/components/schemas/FactionId" + }, + "level": { + "type": "integer", + "format": "int32" + }, + "last_action": { + "type": "integer", + "format": "int32" + }, + "rank_name": { + "type": "string" + }, + "rank_number": { + "type": "integer", + "format": "int32" + }, + "position": { + "type": "integer", + "format": "int32" + }, + "signed_up": { + "type": "integer", + "format": "int32" + }, + "age_in_days": { + "type": "integer", + "format": "int32" + }, + "value": { + "description": "Value representing the chosen category. Traveltime is shown in seconds. If the chosen category is 'rank', the value is of type string. If the chosen category is 'racingskill', the value is of type float. Otherwise it is an integer." + }, + "rank": { + "type": "string" + } + }, + "type": "object" + }, + "TornHofResponse": { + "required": [ + "hof", + "_metadata" + ], + "properties": { + "hof": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornHof" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "FactionHofValues": { + "required": [ + "chain", + "chain_duration", + "respect" + ], + "properties": { + "chain": { + "description": "Maximum chain achieved by the faction. Null if chosen category is 'rank' or 'respect'.", + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "chain_duration": { + "description": "The duration of the chain. Null if chosen category is 'rank' or 'respect'.", + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "respect": { + "description": "Null if chosen category is 'chain'.", + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "TornFactionHof": { + "required": [ + "id", + "name", + "members", + "position", + "rank", + "values" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionId" + }, + "name": { + "type": "string" + }, + "members": { + "type": "integer", + "format": "int32" + }, + "position": { + "type": "integer", + "format": "int32" + }, + "rank": { + "description": "The full rank title & division of the faction.", + "type": "string" + }, + "values": { + "$ref": "#/components/schemas/FactionHofValues" + } + }, + "type": "object" + }, + "TornFactionHofResponse": { + "required": [ + "factionhof", + "_metadata" + ], + "properties": { + "factionhof": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornFactionHof" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "TornLog": { + "required": [ + "id", + "title" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/LogId" + }, + "title": { + "type": "string" + } + }, + "type": "object" + }, + "TornLogCategory": { + "required": [ + "id", + "title" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/LogCategoryId" + }, + "title": { + "type": "string" + } + }, + "type": "object" + }, + "TornLogTypesResponse": { + "required": [ + "logtypes" + ], + "properties": { + "logtypes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornLog" + } + } + }, + "type": "object" + }, + "TornLogCategoriesResponse": { + "required": [ + "logcategories" + ], + "properties": { + "logcategories": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornLogCategory" + } + } + }, + "type": "object" + }, + "Bounty": { + "required": [ + "target_id", + "target_name", + "target_level", + "lister_id", + "lister_name", + "reward", + "reason", + "quantity", + "is_anonymous", + "valid_until" + ], + "properties": { + "target_id": { + "$ref": "#/components/schemas/UserId" + }, + "target_name": { + "type": "string" + }, + "target_level": { + "type": "integer", + "format": "int32" + }, + "lister_id": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserId", + "description": "If the bounty is anonymous this field is null." + }, + { + "type": "null" + } + ] + }, + "lister_name": { + "description": "If the bounty is anonymous this field is null.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "reward": { + "type": "integer", + "format": "int64" + }, + "reason": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "quantity": { + "type": "integer", + "format": "int32" + }, + "is_anonymous": { + "type": "boolean" + }, + "valid_until": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "AttackLogSummary": { + "required": [ + "id", + "name", + "hits", + "misses", + "damage" + ], + "properties": { + "id": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserId", + "description": "Id of the participant, could be null in stealthed attacks." + }, + { + "type": "null" + } + ] + }, + "name": { + "oneOf": [ + { + "description": "Name of the participant, could be null in stealthed attacks.", + "type": "string" + }, + { + "type": "null" + } + ] + }, + "hits": { + "type": "integer", + "format": "int32" + }, + "misses": { + "type": "integer", + "format": "int32" + }, + "damage": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "AttackLog": { + "required": [ + "text", + "timestamp", + "action", + "icon", + "attacker", + "defender" + ], + "properties": { + "text": { + "type": "string" + }, + "timestamp": { + "type": "integer", + "format": "int32" + }, + "action": { + "$ref": "#/components/schemas/AttackActionEnum" + }, + "icon": { + "type": "string" + }, + "attacker": { + "oneOf": [ + { + "description": "This value could be null in stealthed attacks.", + "required": [ + "id", + "name", + "item" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "name": { + "type": "string" + }, + "item": { + "oneOf": [ + { + "description": "This object could be null if there was no item being used in this turn or during this effect.", + "properties": { + "id": { + "$ref": "#/components/schemas/ItemId" + }, + "name": { + "type": "string" + } + }, + "type": "object" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + { + "type": "null" + } + ] + }, + "defender": { + "oneOf": [ + { + "description": "This value could be null in stealthed attacks.", + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "name": { + "type": "string" + } + }, + "type": "object" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "AttackLogResponse": { + "required": [ + "attacklog", + "_metadata" + ], + "properties": { + "attacklog": { + "required": [ + "log", + "summary" + ], + "properties": { + "log": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AttackLog" + } + }, + "summary": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AttackLogSummary" + } + } + }, + "type": "object" + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "TornBountiesResponse": { + "required": [ + "bounties", + "_metadata" + ], + "properties": { + "bounties": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Bounty" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "TornItemAmmo": { + "required": [ + "id", + "name", + "price", + "types" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/AmmoId" + }, + "name": { + "type": "string" + }, + "price": { + "type": "integer", + "format": "int64" + }, + "types": { + "description": "Types of ammo", + "type": "array", + "items": { + "$ref": "#/components/schemas/TornItemAmmoTypeEnum" + } + } + }, + "type": "object" + }, + "TornItemAmmoResponse": { + "required": [ + "itemammo" + ], + "properties": { + "itemammo": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornItemAmmo" + } + } + }, + "type": "object" + }, + "TornItemMods": { + "required": [ + "id", + "name", + "description", + "dual_fit", + "weapons" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ItemModId" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "dual_fit": { + "description": "Whether the upgrade fits on dual weapons.", + "type": "boolean" + }, + "weapons": { + "description": "The weapon types this upgrade can be attached to.", + "type": "array", + "items": { + "$ref": "#/components/schemas/TornItemWeaponTypeEnum" + } + } + }, + "type": "object" + }, + "TornItemModsResponse": { + "required": [ + "itemmods" + ], + "properties": { + "itemmods": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornItemMods" + } + } + }, + "type": "object" + }, + "TornItemBaseStats": { + "required": [ + "damage", + "accuracy", + "armor" + ], + "properties": { + "damage": { + "type": "integer", + "format": "int32" + }, + "accuracy": { + "type": "integer", + "format": "int32" + }, + "armor": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "TornItemWeaponDetails": { + "required": [ + "stealth_level", + "base_stats", + "category", + "ammo", + "mods" + ], + "properties": { + "stealth_level": { + "type": "number", + "format": "float" + }, + "base_stats": { + "$ref": "#/components/schemas/TornItemBaseStats" + }, + "category": { + "$ref": "#/components/schemas/TornItemWeaponCategoryEnum" + }, + "ammo": { + "oneOf": [ + { + "required": [ + "id", + "name", + "magazine_rounds", + "rate_of_fire" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/AmmoId" + }, + "name": { + "type": "string" + }, + "magazine_rounds": { + "type": "integer", + "format": "int32" + }, + "rate_of_fire": { + "required": [ + "minimum", + "maximum" + ], + "properties": { + "minimum": { + "type": "integer", + "format": "int32" + }, + "maximum": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + }, + "type": "object" + }, + { + "type": "null" + } + ] + }, + "mods": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ItemModId" + } + } + }, + "type": "object" + }, + "TornItemArmorCoverage": { + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "$ref": "#/components/schemas/TornItemArmorCoveragePartEnum" + }, + "value": { + "type": "number", + "format": "float" + } + }, + "type": "object" + }, + "TornItemArmorDetails": { + "required": [ + "coverage", + "base_stats" + ], + "properties": { + "coverage": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornItemArmorCoverage" + } + }, + "base_stats": { + "$ref": "#/components/schemas/TornItemBaseStats" + } + }, + "type": "object" + }, + "TornItem": { + "required": [ + "id", + "name", + "description", + "effect", + "requirement", + "image", + "type", + "sub_type", + "is_masked", + "is_tradable", + "is_found_in_city", + "value", + "circulation", + "details" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ItemId" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "effect": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "requirement": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "image": { + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/TornItemTypeEnum" + }, + "sub_type": { + "oneOf": [ + { + "$ref": "#/components/schemas/TornItemWeaponTypeEnum" + }, + { + "type": "null" + } + ] + }, + "is_masked": { + "type": "boolean" + }, + "is_tradable": { + "type": "boolean" + }, + "is_found_in_city": { + "type": "boolean" + }, + "value": { + "required": [ + "vendor", + "buy_price", + "sell_price", + "market_price" + ], + "properties": { + "vendor": { + "oneOf": [ + { + "required": [ + "country", + "name" + ], + "properties": { + "country": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "type": "object" + }, + { + "type": "null" + } + ] + }, + "buy_price": { + "oneOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "null" + } + ] + }, + "sell_price": { + "oneOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "null" + } + ] + }, + "market_price": { + "type": "integer", + "format": "int64" + } + }, + "type": "object" + }, + "circulation": { + "type": "integer", + "format": "int64" + }, + "details": { + "description": "If the item 'type' is 'Armor' then TornItemArmorDetails is returned.
If the item 'type' is 'Weapon' then TornItemWeaponDetails is returned.
Otherwise, null is returned.", + "oneOf": [ + { + "$ref": "#/components/schemas/TornItemWeaponDetails" + }, + { + "$ref": "#/components/schemas/TornItemArmorDetails" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "TornItemsResponse": { + "required": [ + "items" + ], + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornItem" + } + } + }, + "type": "object" + }, + "TornFactionTreeBranch": { + "required": [ + "id", + "name", + "upgrades" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionBranchId" + }, + "name": { + "type": "string" + }, + "upgrades": { + "type": "array", + "items": { + "required": [ + "name", + "level", + "ability", + "challenge", + "cost" + ], + "properties": { + "name": { + "type": "string" + }, + "level": { + "type": "integer", + "format": "int32" + }, + "ability": { + "type": "string" + }, + "cost": { + "type": "integer", + "format": "int32" + }, + "challenge": { + "oneOf": [ + { + "required": [ + "description", + "amount_required", + "stat" + ], + "properties": { + "description": { + "type": "string" + }, + "amount_required": { + "type": "integer", + "format": "int64" + }, + "stat": { + "$ref": "#/components/schemas/FactionStatEnum" + } + }, + "type": "object" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + } + } + }, + "type": "object" + }, + "TornFactionTree": { + "required": [ + "name", + "branches" + ], + "properties": { + "name": { + "type": "string" + }, + "branches": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornFactionTreeBranch" + } + } + }, + "type": "object" + }, + "TornFactionTreeResponse": { + "required": [ + "factionTree" + ], + "properties": { + "factionTree": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornFactionTree" + } + } + }, + "type": "object" + }, + "TornSelectionName": { + "description": "The following selections will fallback to API v1 and may change at any time: 'bank','cards','cityshops','companies','competition','dirtybombs','gyms','honors','itemdetails','itemstats','medals','organisedcrimes','pawnshop','pokertables','properties','raidreport','raids','rockpaperscissors','searchforcash','shoplifting','stats','stocks'.\n * The following selections are not available in API v2: 'chainreport', 'rackets', 'rankedwarreport', 'rankedwars', 'territorynames', 'territorywarreport', 'territorywars'.", + "type": "string", + "enum": [ + "attacklog", + "bounties", + "calendar", + "crimes", + "education", + "factionhof", + "factiontree", + "hof", + "itemammo", + "itemmods", + "items", + "logcategories", + "logtypes", + "lookup", + "subcrimes", + "territory", + "timestamp", + "bank", + "cards", + "cityshops", + "companies", + "competition", + "dirtybombs", + "gyms", + "honors", + "itemdetails", + "itemstats", + "medals", + "organisedcrimes", + "pawnshop", + "pokertables", + "properties", + "raidreport", + "raids", + "rockpaperscissors", + "searchforcash", + "shoplifting", + "stats", + "stocks", + "chainreport", + "rackets", + "rankedwarreport", + "rankedwars", + "territorynames", + "territorywarreport", + "territorywars" + ] + }, + "TornLookupResponse": { + "required": [ + "selections" + ], + "properties": { + "selections": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornSelectionName" } } }, diff --git a/torn-api-codegen/src/model/enum.rs b/torn-api-codegen/src/model/enum.rs index 382c1f1..23cd52d 100644 --- a/torn-api-codegen/src/model/enum.rs +++ b/torn-api-codegen/src/model/enum.rs @@ -317,23 +317,3 @@ impl Enum { }) } } - -#[cfg(test)] -mod test { - use crate::openapi::schema::OpenApiSchema; - - use super::*; - - #[test] - fn codegen() { - let schema = OpenApiSchema::read().unwrap(); - - let revive_setting = schema.components.schemas.get("ReviveSetting").unwrap(); - - let r#enum = Enum::from_schema("ReviveSetting", revive_setting).unwrap(); - - let code = r#enum.codegen().unwrap(); - - panic!("{code}"); - } -} diff --git a/torn-api-codegen/src/model/mod.rs b/torn-api-codegen/src/model/mod.rs index ed0ae5f..e230952 100644 --- a/torn-api-codegen/src/model/mod.rs +++ b/torn-api-codegen/src/model/mod.rs @@ -1,8 +1,8 @@ -use r#enum::Enum; use indexmap::IndexMap; use newtype::Newtype; use object::Object; use proc_macro2::TokenStream; +use r#enum::Enum; use crate::openapi::r#type::OpenApiType; @@ -101,65 +101,6 @@ mod test { ); } - #[test] - fn resolve_enums() { - let schema = OpenApiSchema::read().unwrap(); - - let forum_feed_type_schema = schema.components.schemas.get("ForumFeedTypeEnum").unwrap(); - - let forum_feed_type = resolve( - forum_feed_type_schema, - "ForumFeedTypeEnum", - &schema.components.schemas, - ); - - assert_eq!(forum_feed_type, Model::Enum(Enum { - name: "ForumFeedType".to_owned(), - description: Some("This represents the type of the activity. Values range from 1 to 8 where:\n * 1 = 'X posted on a thread',\n * 2 = 'X created a thread',\n * 3 = 'X liked your thread',\n * 4 = 'X disliked your thread',\n * 5 = 'X liked your post',\n * 6 = 'X disliked your post',\n * 7 = 'X quoted your post'.".to_owned()), - repr: Some(EnumRepr::U32), - copy: true, - untagged: false, - display: true, - variants: vec![ - EnumVariant { - name: "Variant1".to_owned(), - value: r#enum::EnumVariantValue::Repr(1), - ..Default::default() - }, - EnumVariant { - name: "Variant2".to_owned(), - value: r#enum::EnumVariantValue::Repr(2), - ..Default::default() - }, - EnumVariant { - name: "Variant3".to_owned(), - value: r#enum::EnumVariantValue::Repr(3), - ..Default::default() - }, - EnumVariant { - name: "Variant4".to_owned(), - value: r#enum::EnumVariantValue::Repr(4), - ..Default::default() - }, - EnumVariant { - name: "Variant5".to_owned(), - value: r#enum::EnumVariantValue::Repr(5), - ..Default::default() - }, - EnumVariant { - name: "Variant6".to_owned(), - value: r#enum::EnumVariantValue::Repr(6), - ..Default::default() - }, - EnumVariant { - name: "Variant7".to_owned(), - value: r#enum::EnumVariantValue::Repr(7), - ..Default::default() - }, - ] - })) - } - #[test] fn resolve_all() { let schema = OpenApiSchema::read().unwrap(); diff --git a/torn-api-codegen/src/model/newtype.rs b/torn-api-codegen/src/model/newtype.rs index 372c637..d04dcfe 100644 --- a/torn-api-codegen/src/model/newtype.rs +++ b/torn-api-codegen/src/model/newtype.rs @@ -121,24 +121,3 @@ impl Newtype { Some(body) } } - -#[cfg(test)] -mod test { - use super::*; - use crate::openapi::schema::OpenApiSchema; - - #[test] - fn codegen() { - let schema = OpenApiSchema::read().unwrap(); - - let user_id = schema.components.schemas.get("UserId").unwrap(); - - let mut newtype = Newtype::from_schema("UserId", user_id).unwrap(); - - newtype.description = Some("Description goes here".to_owned()); - - let code = newtype.codegen().unwrap().to_string(); - - panic!("{code}"); - } -} diff --git a/torn-api-codegen/src/model/object.rs b/torn-api-codegen/src/model/object.rs index 60829b9..c29dcbe 100644 --- a/torn-api-codegen/src/model/object.rs +++ b/torn-api-codegen/src/model/object.rs @@ -207,7 +207,9 @@ impl Property { let prim = match (schema.r#type, schema.format) { (Some("integer"), Some("int32")) => PrimitiveType::I32, (Some("integer"), Some("int64")) => PrimitiveType::I64, - (Some("number"), /* Some("float") */ _) => PrimitiveType::Float, + (Some("number"), /* Some("float") */ _) | (_, Some("float")) => { + PrimitiveType::Float + } (Some("string"), None) => PrimitiveType::String, (Some("boolean"), None) => PrimitiveType::Bool, _ => return None, diff --git a/torn-api-codegen/src/model/parameter.rs b/torn-api-codegen/src/model/parameter.rs index dbe87fd..23daff1 100644 --- a/torn-api-codegen/src/model/parameter.rs +++ b/torn-api-codegen/src/model/parameter.rs @@ -2,7 +2,7 @@ use std::fmt::Write; use heck::ToUpperCamelCase; use proc_macro2::TokenStream; -use quote::{ToTokens, format_ident, quote}; +use quote::{format_ident, quote, ToTokens}; use crate::openapi::parameter::{ OpenApiParameter, OpenApiParameterDefault, OpenApiParameterSchema, @@ -303,7 +303,12 @@ The default value [Self::{}](self::{}#variant.{})"#, let mut code = inner.codegen().unwrap_or_default(); let name = format_ident!("{}", outer_name); - let inner_ty = items.codegen_type_name(&inner_name); + let inner_ty = if matches!(items.as_ref(), ParameterType::Schema { type_name: _ }) { + let inner_name = format_ident!("{}", inner_name); + quote! { crate::models::#inner_name } + } else { + items.codegen_type_name(&inner_name).to_token_stream() + }; code.extend(quote! { #[derive(Debug, Clone)] diff --git a/torn-api-codegen/src/model/path.rs b/torn-api-codegen/src/model/path.rs index a1bfb4f..04973de 100644 --- a/torn-api-codegen/src/model/path.rs +++ b/torn-api-codegen/src/model/path.rs @@ -352,7 +352,13 @@ impl Path { crate::models::#ty_name } } - ParameterType::Array { .. } => param.r#type.codegen_type_name(¶m.name), + ParameterType::Array { .. } => { + let ty_name = param.r#type.codegen_type_name(¶m.name); + + quote! { + crate::request::models::#request_mod_name::#ty_name + } + } }; let arg_name = format_ident!("{}", param.value.to_snake_case()); @@ -462,7 +468,12 @@ impl Path { crate::models::#ty_name } } - ParameterType::Array { .. } => param.r#type.codegen_type_name(¶m.name), + ParameterType::Array { .. } => { + let name = param.r#type.codegen_type_name(¶m.name); + quote! { + crate::request::models::#request_mod_name::#name + } + } }; let arg_name = format_ident!("{}", param.value.to_snake_case()); diff --git a/torn-api/src/scopes.rs b/torn-api/src/scopes.rs index 98415c1..9910897 100644 --- a/torn-api/src/scopes.rs +++ b/torn-api/src/scopes.rs @@ -415,7 +415,7 @@ pub(super) mod test { let forum_scope = ForumScope(&client); forum_scope - .threads_for_category_ids("2".to_owned(), |b| b) + .threads_for_category_ids([2.into()].into(), |b| b) .await .unwrap(); } @@ -640,7 +640,7 @@ pub(super) mod test { let torn_scope = TornScope(&client); torn_scope - .items_for_ids("1".to_owned(), |b| b) + .items_for_ids([1.into()].into(), |b| b) .await .unwrap(); } From 9efd2442f01a6fd794c16135eb68f2f70693f33b Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:23:19 +0200 Subject: [PATCH 03/26] chore(codegen): publish version --- Cargo.lock | 2 +- torn-api-codegen/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 19e2230..65a0c28 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2291,7 +2291,7 @@ dependencies = [ [[package]] name = "torn-api-codegen" -version = "0.2.3" +version = "0.2.4" dependencies = [ "heck", "indexmap", diff --git a/torn-api-codegen/Cargo.toml b/torn-api-codegen/Cargo.toml index 48037f1..cec8fba 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.2.3" +version = "0.2.4" edition = "2021" description = "Contains the v2 torn API model descriptions and codegen for the bindings" license-file = { workspace = true } From 9f800026645a050c8d7d157b4d812d9d39eede1a Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:23:19 +0200 Subject: [PATCH 04/26] feat(torn-api): add chrono for datetime support --- Cargo.lock | 2 + torn-api-codegen/openapi.json | 727 +++++++++++++++++++++++- torn-api-codegen/src/model/mod.rs | 5 +- torn-api-codegen/src/model/object.rs | 5 + torn-api-codegen/src/model/parameter.rs | 7 +- torn-api/Cargo.toml | 1 + torn-api/src/scopes.rs | 16 + 7 files changed, 741 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 65a0c28..f8e47bc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -227,6 +227,7 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", + "serde", "wasm-bindgen", "windows-link", ] @@ -2275,6 +2276,7 @@ version = "1.2.0" dependencies = [ "bon", "bytes", + "chrono", "futures", "http", "prettyplease", diff --git a/torn-api-codegen/openapi.json b/torn-api-codegen/openapi.json index c5ddb7a..e70979a 100644 --- a/torn-api-codegen/openapi.json +++ b/torn-api-codegen/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.6.1" + "version": "1.7.0" }, "servers": [ { @@ -1226,6 +1226,69 @@ "x-stability": "Stable" } }, + "/user/reports": { + "get": { + "tags": [ + "User" + ], + "summary": "Get your reports", + "description": "Requires limited access key.
\n * The default limit is set to 25. However, the limit can be set to 100 for the 'stats' category.", + "operationId": "6ba15a813fe1cc014564e9dba892e022", + "parameters": [ + { + "name": "cat", + "in": "query", + "description": "Used to filter reports with a specific type.", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReportTypeEnum" + } + }, + { + "name": "target", + "in": "query", + "description": "Get reports for a specific player by passing their player ID.", + "required": false, + "schema": { + "$ref": "#/components/schemas/UserId" + } + }, + { + "$ref": "#/components/parameters/ApiLimit100Default20" + }, + { + "$ref": "#/components/parameters/ApiOffset" + }, + { + "$ref": "#/components/parameters/ApiTimestamp" + }, + { + "$ref": "#/components/parameters/ApiComment" + }, + { + "$ref": "#/components/parameters/ApiKeyLimited" + } + ], + "responses": { + "200": { + "description": "Successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ReportsResponse" + } + } + } + } + }, + "security": [ + { + "api_key": [] + } + ], + "x-stability": "Unstable" + } + }, "/user/revives": { "get": { "tags": [ @@ -2787,6 +2850,69 @@ "x-stability": "Stable" } }, + "/faction/reports": { + "get": { + "tags": [ + "Faction" + ], + "summary": "Get faction reports", + "description": "Requires limited access key.
\n * The default limit is set to 25. However, the limit can be set to 100 for the 'stats' category.", + "operationId": "e8bd37f10cc5e0e8d6694bb306f3a1e4", + "parameters": [ + { + "name": "cat", + "in": "query", + "description": "Used to filter reports with a specific type.", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReportTypeEnum" + } + }, + { + "name": "target", + "in": "query", + "description": "Get reports for a specific player by passing their player ID.", + "required": false, + "schema": { + "$ref": "#/components/schemas/UserId" + } + }, + { + "$ref": "#/components/parameters/ApiLimit100Default20" + }, + { + "$ref": "#/components/parameters/ApiOffset" + }, + { + "$ref": "#/components/parameters/ApiTimestamp" + }, + { + "$ref": "#/components/parameters/ApiComment" + }, + { + "$ref": "#/components/parameters/ApiKeyLimited" + } + ], + "responses": { + "200": { + "description": "Successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ReportsResponse" + } + } + } + } + }, + "security": [ + { + "api_key": [] + } + ], + "x-stability": "Unstable" + } + }, "/faction/revives": { "get": { "tags": [ @@ -3998,15 +4124,6 @@ { "$ref": "#/components/parameters/ApiOffsetNoDefault" }, - { - "name": "cat", - "in": "query", - "description": "Selection category", - "required": false, - "schema": { - "type": "string" - } - }, { "$ref": "#/components/parameters/ApiTimestamp" }, @@ -5983,6 +6100,37 @@ "E" ] }, + "CountryEnum": { + "type": "string", + "enum": [ + "Mexico", + "Hawaii", + "South Africa", + "Japan", + "China", + "Argentina", + "Switzerland", + "Canada", + "United Kingdom", + "UAE", + "Cayman Islands" + ] + }, + "ReportTypeEnum": { + "type": "string", + "enum": [ + "mostwanted", + "money", + "stats", + "references", + "friendorfoe", + "companyfinancials", + "truelevel", + "stockanalysis", + "anonymousbounties", + "investment" + ] + }, "ApiKeyAccessTypeEnum": { "type": "string", "enum": [ @@ -11450,6 +11598,551 @@ }, "type": "object" }, + "ReportBase": { + "required": [ + "type", + "target_id", + "reporter_id", + "faction_id", + "timestamp" + ], + "properties": { + "type": { + "$ref": "#/components/schemas/ReportTypeEnum" + }, + "target_id": { + "description": "The target ID if applicable.", + "oneOf": [ + { + "$ref": "#/components/schemas/UserId" + }, + { + "type": "null" + } + ] + }, + "reporter_id": { + "$ref": "#/components/schemas/UserId" + }, + "faction_id": { + "description": "Reporter's faction ID if applicable.", + "oneOf": [ + { + "$ref": "#/components/schemas/FactionId" + }, + { + "type": "null" + } + ] + }, + "timestamp": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "ReportWarrantDetails": { + "required": [ + "id", + "name", + "warrant" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "name": { + "type": "string" + }, + "warrant": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "ReportMostWanted": { + "required": [ + "top", + "notable" + ], + "properties": { + "top": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReportWarrantDetails" + } + }, + "notable": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReportWarrantDetails" + } + } + }, + "type": "object" + }, + "ReportMoney": { + "required": [ + "money" + ], + "properties": { + "money": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "ReportInvestment": { + "required": [ + "amount", + "until" + ], + "properties": { + "amount": { + "type": "integer", + "format": "int64" + }, + "until": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "ReportTrueLevel": { + "required": [ + "level" + ], + "properties": { + "level": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "ReportStats": { + "required": [ + "strength", + "speed", + "dexterity", + "defense", + "total" + ], + "properties": { + "strength": { + "oneOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "null" + } + ] + }, + "speed": { + "oneOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "null" + } + ] + }, + "dexterity": { + "oneOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "null" + } + ] + }, + "defense": { + "oneOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "null" + } + ] + }, + "total": { + "oneOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "ReportHistoryFaction": { + "required": [ + "id", + "name", + "joined", + "left" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionId" + }, + "name": { + "type": "string" + }, + "joined": { + "type": "string", + "format": "date" + }, + "left": { + "oneOf": [ + { + "type": "string", + "format": "date" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "ReportHistoryCompany": { + "required": [ + "id", + "name", + "joined", + "left" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/CompanyId" + }, + "name": { + "type": "string" + }, + "joined": { + "type": "string", + "format": "date" + }, + "left": { + "oneOf": [ + { + "type": "string", + "format": "date" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "ReportHistory": { + "required": [ + "factions", + "companies" + ], + "properties": { + "factions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReportHistoryFaction" + } + }, + "companies": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReportHistoryCompany" + } + } + }, + "type": "object" + }, + "ReportFriendOrFoeUser": { + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "name": { + "type": "string" + } + }, + "type": "object" + }, + "ReportFriendOrFoe": { + "required": [ + "friends", + "enemies" + ], + "properties": { + "friends": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReportFriendOrFoeUser" + } + }, + "enemies": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReportFriendOrFoeUser" + } + } + }, + "type": "object" + }, + "ReportCompanyFinancials": { + "required": [ + "balance", + "employees", + "wages" + ], + "properties": { + "balance": { + "type": "integer", + "format": "int64" + }, + "employees": { + "type": "integer", + "format": "int32" + }, + "wages": { + "required": [ + "highest", + "lowest", + "average" + ], + "properties": { + "highest": { + "type": "integer", + "format": "int32" + }, + "lowest": { + "type": "integer", + "format": "int32" + }, + "average": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "ReportStockAnalysis": { + "required": [ + "items" + ], + "properties": { + "items": { + "type": "array", + "items": { + "required": [ + "country", + "item", + "trip_duration", + "hourly_profit" + ], + "properties": { + "country": { + "$ref": "#/components/schemas/CountryEnum" + }, + "item": { + "required": [ + "id", + "name", + "stock", + "price", + "value", + "due" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ItemId" + }, + "name": { + "type": "string" + }, + "price": { + "type": "integer", + "format": "int32" + }, + "value": { + "type": "integer", + "format": "int32" + }, + "due": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "trip_duration": { + "type": "integer", + "format": "int32" + }, + "hourly_profit": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + } + }, + "type": "object" + }, + "ReportAnonymousBounties": { + "required": [ + "bounties" + ], + "properties": { + "bounties": { + "type": "array", + "items": { + "required": [ + "bounty", + "user", + "text" + ], + "properties": { + "text": { + "type": "string" + }, + "bounty": { + "type": "integer", + "format": "int64" + }, + "user": { + "oneOf": [ + { + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "name": { + "type": "string" + } + }, + "type": "object" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + } + } + }, + "type": "object" + }, + "ReportReport": { + "required": [ + "report" + ], + "properties": { + "report": { + "oneOf": [ + { + "$ref": "#/components/schemas/ReportMoney" + }, + { + "$ref": "#/components/schemas/ReportStats" + }, + { + "$ref": "#/components/schemas/ReportMostWanted" + }, + { + "$ref": "#/components/schemas/ReportHistory" + }, + { + "$ref": "#/components/schemas/ReportFriendOrFoe" + }, + { + "$ref": "#/components/schemas/ReportCompanyFinancials" + }, + { + "$ref": "#/components/schemas/ReportTrueLevel" + }, + { + "$ref": "#/components/schemas/ReportStockAnalysis" + }, + { + "$ref": "#/components/schemas/ReportAnonymousBounties" + }, + { + "$ref": "#/components/schemas/ReportInvestment" + } + ] + } + }, + "type": "object" + }, + "Report": { + "allOf": [ + { + "$ref": "#/components/schemas/ReportBase" + }, + { + "$ref": "#/components/schemas/ReportReport" + } + ] + }, + "ReportsResponse": { + "required": [ + "reports", + "_metadata" + ], + "properties": { + "reports": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Report" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, "UserCurrentEducation": { "required": [ "id", @@ -12412,7 +13105,7 @@ ], "properties": { "value": { - "type": "integer", + "type": "number", "format": "float" }, "rank": { @@ -12434,7 +13127,7 @@ "rank": { "oneOf": [ { - "type": "number", + "type": "integer", "format": "int32" }, { @@ -21603,6 +22296,16 @@ "minimum": 1 } }, + "ApiTarget": { + "name": "target", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int32", + "minimum": 1 + } + }, "ApiSort": { "name": "sort", "in": "query", diff --git a/torn-api-codegen/src/model/mod.rs b/torn-api-codegen/src/model/mod.rs index e230952..6b9c313 100644 --- a/torn-api-codegen/src/model/mod.rs +++ b/torn-api-codegen/src/model/mod.rs @@ -61,10 +61,7 @@ impl Model { #[cfg(test)] mod test { use super::*; - use crate::{ - model::r#enum::{EnumRepr, EnumVariant}, - openapi::schema::OpenApiSchema, - }; + use crate::openapi::schema::OpenApiSchema; #[test] fn resolve_newtypes() { diff --git a/torn-api-codegen/src/model/object.rs b/torn-api-codegen/src/model/object.rs index c29dcbe..8b96376 100644 --- a/torn-api-codegen/src/model/object.rs +++ b/torn-api-codegen/src/model/object.rs @@ -15,6 +15,7 @@ pub enum PrimitiveType { I64, String, Float, + DateTime, } #[derive(Debug, Clone, PartialEq, Eq)] @@ -35,6 +36,9 @@ impl PropertyType { Self::Primitive(PrimitiveType::String) => { Some(format_ident!("String").into_token_stream()) } + Self::Primitive(PrimitiveType::DateTime) => { + Some(quote! { chrono::DateTime }) + } Self::Primitive(PrimitiveType::Float) => Some(format_ident!("f64").into_token_stream()), Self::Ref(path) => { let name = path.strip_prefix("#/components/schemas/")?; @@ -211,6 +215,7 @@ impl Property { PrimitiveType::Float } (Some("string"), None) => PrimitiveType::String, + (Some("string"), Some("date")) => PrimitiveType::DateTime, (Some("boolean"), None) => PrimitiveType::Bool, _ => return None, }; diff --git a/torn-api-codegen/src/model/parameter.rs b/torn-api-codegen/src/model/parameter.rs index 23daff1..613b8a9 100644 --- a/torn-api-codegen/src/model/parameter.rs +++ b/torn-api-codegen/src/model/parameter.rs @@ -303,12 +303,7 @@ The default value [Self::{}](self::{}#variant.{})"#, let mut code = inner.codegen().unwrap_or_default(); let name = format_ident!("{}", outer_name); - let inner_ty = if matches!(items.as_ref(), ParameterType::Schema { type_name: _ }) { - let inner_name = format_ident!("{}", inner_name); - quote! { crate::models::#inner_name } - } else { - items.codegen_type_name(&inner_name).to_token_stream() - }; + let inner_ty = items.codegen_type_name(&inner_name); code.extend(quote! { #[derive(Debug, Clone)] diff --git a/torn-api/Cargo.toml b/torn-api/Cargo.toml index b9c49dc..0dfc324 100644 --- a/torn-api/Cargo.toml +++ b/torn-api/Cargo.toml @@ -31,6 +31,7 @@ futures = { version = "0.3", default-features = false, features = [ "std", "async-await", ] } +chrono = { version = "0.4.41", features = ["serde"] } [dev-dependencies] tokio = { version = "1", features = ["full"] } diff --git a/torn-api/src/scopes.rs b/torn-api/src/scopes.rs index 9910897..ea548f0 100644 --- a/torn-api/src/scopes.rs +++ b/torn-api/src/scopes.rs @@ -366,6 +366,15 @@ pub(super) mod test { faction_scope.lookup(|b| b).await.unwrap(); } + #[tokio::test] + async fn faction_reports() { + let client = test_client().await; + + let faction_scope = FactionScope(&client); + + faction_scope.reports(|b| b).await.unwrap(); + } + #[tokio::test] async fn forum_categories() { let client = test_client().await; @@ -954,4 +963,11 @@ pub(super) mod test { client.user().attacks(|b| b).await.unwrap(); } + + #[tokio::test] + async fn user_reports() { + let client = test_client().await; + + client.user().reports(|b| b).await.unwrap(); + } } From f9e3d27e7b804691f040fe839d265b989f6d9f4f Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:23:20 +0200 Subject: [PATCH 05/26] chore(codegen): release version --- Cargo.lock | 2 +- torn-api-codegen/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f8e47bc..bb19aa8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2293,7 +2293,7 @@ dependencies = [ [[package]] name = "torn-api-codegen" -version = "0.2.4" +version = "0.2.5" dependencies = [ "heck", "indexmap", diff --git a/torn-api-codegen/Cargo.toml b/torn-api-codegen/Cargo.toml index cec8fba..a2ad99d 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.2.4" +version = "0.3.0" edition = "2021" description = "Contains the v2 torn API model descriptions and codegen for the bindings" license-file = { workspace = true } From 9e11886c3e899a46257279c1ac6fdd9462fcd59f Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:23:20 +0200 Subject: [PATCH 06/26] chore(torn-api): release version 1.3.0 --- Cargo.lock | 4 ++-- torn-api/Cargo.toml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bb19aa8..aa29b2e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2272,7 +2272,7 @@ dependencies = [ [[package]] name = "torn-api" -version = "1.2.0" +version = "1.3.0" dependencies = [ "bon", "bytes", @@ -2293,7 +2293,7 @@ dependencies = [ [[package]] name = "torn-api-codegen" -version = "0.2.5" +version = "0.3.0" dependencies = [ "heck", "indexmap", diff --git a/torn-api/Cargo.toml b/torn-api/Cargo.toml index 0dfc324..71fdb08 100644 --- a/torn-api/Cargo.toml +++ b/torn-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "torn-api" -version = "1.2.0" +version = "1.3.0" edition = "2021" description = "Auto-generated bindings for the v2 torn api" license-file = { workspace = true } @@ -37,7 +37,7 @@ chrono = { version = "0.4.41", features = ["serde"] } tokio = { version = "1", features = ["full"] } [build-dependencies] -torn-api-codegen = { path = "../torn-api-codegen", version = "0.2.3" } +torn-api-codegen = { path = "../torn-api-codegen", version = "0.3.0" } syn = { workspace = true, features = ["parsing"] } proc-macro2 = { workspace = true } prettyplease = "0.2" From 688d745a3f62319fa575095af49ce1abcae2d672 Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:23:20 +0200 Subject: [PATCH 07/26] chore: moved schema file to torn-api crate --- torn-api-codegen/src/model/mod.rs | 6 +++--- torn-api-codegen/src/model/object.rs | 6 +++--- torn-api-codegen/src/model/parameter.rs | 8 ++++---- torn-api-codegen/src/model/path.rs | 6 +++--- torn-api-codegen/src/openapi/parameter.rs | 6 +++--- torn-api-codegen/src/openapi/path.rs | 15 ++++++++++----- torn-api-codegen/src/openapi/schema.rs | 16 ++++------------ torn-api/Cargo.toml | 1 + torn-api/build.rs | 3 ++- {torn-api-codegen => torn-api}/openapi.json | 0 10 files changed, 33 insertions(+), 34 deletions(-) rename {torn-api-codegen => torn-api}/openapi.json (100%) diff --git a/torn-api-codegen/src/model/mod.rs b/torn-api-codegen/src/model/mod.rs index 6b9c313..b6c823b 100644 --- a/torn-api-codegen/src/model/mod.rs +++ b/torn-api-codegen/src/model/mod.rs @@ -61,11 +61,11 @@ impl Model { #[cfg(test)] mod test { use super::*; - use crate::openapi::schema::OpenApiSchema; + use crate::openapi::schema::test::get_schema; #[test] fn resolve_newtypes() { - let schema = OpenApiSchema::read().unwrap(); + let schema = get_schema(); let user_id_schema = schema.components.schemas.get("UserId").unwrap(); @@ -100,7 +100,7 @@ mod test { #[test] fn resolve_all() { - let schema = OpenApiSchema::read().unwrap(); + let schema = get_schema(); let mut unresolved = vec![]; let total = schema.components.schemas.len(); diff --git a/torn-api-codegen/src/model/object.rs b/torn-api-codegen/src/model/object.rs index 8b96376..ffb6c5a 100644 --- a/torn-api-codegen/src/model/object.rs +++ b/torn-api-codegen/src/model/object.rs @@ -420,11 +420,11 @@ impl ObjectNamespace<'_> { mod test { use super::*; - use crate::openapi::schema::OpenApiSchema; + use crate::openapi::schema::test::get_schema; #[test] fn resolve_object() { - let schema = OpenApiSchema::read().unwrap(); + let schema = get_schema(); let attack = schema.components.schemas.get("FactionUpgrades").unwrap(); @@ -436,7 +436,7 @@ mod test { #[test] fn resolve_objects() { - let schema = OpenApiSchema::read().unwrap(); + let schema = get_schema(); let mut objects = 0; let mut unresolved = vec![]; diff --git a/torn-api-codegen/src/model/parameter.rs b/torn-api-codegen/src/model/parameter.rs index 613b8a9..733163f 100644 --- a/torn-api-codegen/src/model/parameter.rs +++ b/torn-api-codegen/src/model/parameter.rs @@ -342,13 +342,13 @@ The default value [Self::{}](self::{}#variant.{})"#, #[cfg(test)] mod test { - use crate::openapi::{path::OpenApiPathParameter, schema::OpenApiSchema}; + use crate::openapi::{path::OpenApiPathParameter, schema::test::get_schema}; use super::*; #[test] fn resolve_components() { - let schema = OpenApiSchema::read().unwrap(); + let schema = get_schema(); let mut parameters = 0; let mut unresolved = vec![]; @@ -376,7 +376,7 @@ mod test { #[test] fn resolve_inline() { - let schema = OpenApiSchema::read().unwrap(); + let schema = get_schema(); let mut params = 0; let mut unresolved = Vec::new(); @@ -404,7 +404,7 @@ mod test { #[test] fn codegen_inline() { - let schema = OpenApiSchema::read().unwrap(); + let schema = get_schema(); let mut params = 0; let mut unresolved = Vec::new(); diff --git a/torn-api-codegen/src/model/path.rs b/torn-api-codegen/src/model/path.rs index 04973de..7f534ce 100644 --- a/torn-api-codegen/src/model/path.rs +++ b/torn-api-codegen/src/model/path.rs @@ -592,11 +592,11 @@ impl PathNamespace<'_> { mod test { use super::*; - use crate::openapi::schema::OpenApiSchema; + use crate::openapi::schema::test::get_schema; #[test] fn resolve_paths() { - let schema = OpenApiSchema::read().unwrap(); + let schema = get_schema(); let mut paths = 0; let mut unresolved = vec![]; @@ -624,7 +624,7 @@ mod test { #[test] fn codegen_paths() { - let schema = OpenApiSchema::read().unwrap(); + let schema = get_schema(); let mut paths = 0; let mut unresolved = vec![]; diff --git a/torn-api-codegen/src/openapi/parameter.rs b/torn-api-codegen/src/openapi/parameter.rs index 0b341d2..857fd85 100644 --- a/torn-api-codegen/src/openapi/parameter.rs +++ b/torn-api-codegen/src/openapi/parameter.rs @@ -9,14 +9,14 @@ pub enum ParameterLocation { Path, } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] #[serde(untagged)] pub enum OpenApiParameterDefault<'a> { Int(i32), Str(&'a str), } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] pub struct OpenApiParameterSchema<'a> { #[serde(rename = "$ref")] pub ref_path: Option<&'a str>, @@ -29,7 +29,7 @@ pub struct OpenApiParameterSchema<'a> { pub items: Option>>, } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] pub struct OpenApiParameter<'a> { pub name: &'a str, pub description: Option>, diff --git a/torn-api-codegen/src/openapi/path.rs b/torn-api-codegen/src/openapi/path.rs index e0d06f8..5df455a 100644 --- a/torn-api-codegen/src/openapi/path.rs +++ b/torn-api-codegen/src/openapi/path.rs @@ -1,10 +1,10 @@ use std::borrow::Cow; -use serde::{Deserialize, Deserializer}; +use serde::{Deserialize, Deserializer, Serialize}; use super::parameter::OpenApiParameter; -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] #[serde(untagged)] pub enum OpenApiPathParameter<'a> { Link { @@ -14,13 +14,13 @@ pub enum OpenApiPathParameter<'a> { Inline(OpenApiParameter<'a>), } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] pub struct SchemaLink<'a> { #[serde(rename = "$ref")] pub ref_path: &'a str, } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] #[serde(untagged)] pub enum OpenApiResponseBody<'a> { Schema(SchemaLink<'a>), @@ -30,6 +30,9 @@ pub enum OpenApiResponseBody<'a> { }, } +#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)] +pub struct OperationId(pub String); + fn deserialize_response_body<'de, D>(deserializer: D) -> Result, D::Error> where D: Deserializer<'de>, @@ -60,7 +63,8 @@ where Ok(responses.ok.content.json.schema) } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] +#[serde(rename_all = "snake_case")] pub struct OpenApiPathBody<'a> { pub summary: Option>, pub description: Option>, @@ -72,6 +76,7 @@ pub struct OpenApiPathBody<'a> { deserialize_with = "deserialize_response_body" )] pub response_content: OpenApiResponseBody<'a>, + pub operation_id: Option, } #[derive(Debug, Clone, Deserialize)] diff --git a/torn-api-codegen/src/openapi/schema.rs b/torn-api-codegen/src/openapi/schema.rs index 2450f01..c06a76d 100644 --- a/torn-api-codegen/src/openapi/schema.rs +++ b/torn-api-codegen/src/openapi/schema.rs @@ -19,20 +19,12 @@ pub struct OpenApiSchema<'a> { pub components: Components<'a>, } -impl OpenApiSchema<'_> { - pub fn read() -> Result { - let s = include_str!("../../openapi.json"); - - serde_json::from_str(s) - } -} - #[cfg(test)] -mod test { +pub(crate) mod test { use super::*; - #[test] - fn read() { - OpenApiSchema::read().unwrap(); + pub(crate) fn get_schema() -> OpenApiSchema<'static> { + let s = include_str!("../../../torn-api/openapi.json"); + serde_json::from_str(s).unwrap() } } diff --git a/torn-api/Cargo.toml b/torn-api/Cargo.toml index 71fdb08..46b33a4 100644 --- a/torn-api/Cargo.toml +++ b/torn-api/Cargo.toml @@ -41,3 +41,4 @@ torn-api-codegen = { path = "../torn-api-codegen", version = "0.3.0" } syn = { workspace = true, features = ["parsing"] } proc-macro2 = { workspace = true } prettyplease = "0.2" +serde_json = { workspace = true } diff --git a/torn-api/build.rs b/torn-api/build.rs index 136a95e..cb27066 100644 --- a/torn-api/build.rs +++ b/torn-api/build.rs @@ -15,7 +15,8 @@ fn main() { let requests_dest = Path::new(&out_dir).join("requests.rs"); let scopes_dest = Path::new(&out_dir).join("scopes.rs"); - let schema = OpenApiSchema::read().unwrap(); + let s = include_str!("./openapi.json"); + let schema: OpenApiSchema = serde_json::from_str(s).unwrap(); let mut models_code = TokenStream::new(); diff --git a/torn-api-codegen/openapi.json b/torn-api/openapi.json similarity index 100% rename from torn-api-codegen/openapi.json rename to torn-api/openapi.json From ec54b4ca2e36f559b44a7f068f4836204bcb20a2 Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:23:20 +0200 Subject: [PATCH 08/26] chore: release versions --- Cargo.lock | 4 ++-- torn-api-codegen/Cargo.toml | 2 +- torn-api/Cargo.toml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aa29b2e..cb40bb1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2272,7 +2272,7 @@ dependencies = [ [[package]] name = "torn-api" -version = "1.3.0" +version = "1.4.0" dependencies = [ "bon", "bytes", @@ -2293,7 +2293,7 @@ dependencies = [ [[package]] name = "torn-api-codegen" -version = "0.3.0" +version = "0.4.0" dependencies = [ "heck", "indexmap", diff --git a/torn-api-codegen/Cargo.toml b/torn-api-codegen/Cargo.toml index a2ad99d..80357c9 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.3.0" +version = "0.4.0" edition = "2021" description = "Contains the v2 torn API model descriptions and codegen for the bindings" license-file = { workspace = true } diff --git a/torn-api/Cargo.toml b/torn-api/Cargo.toml index 46b33a4..b2d031c 100644 --- a/torn-api/Cargo.toml +++ b/torn-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "torn-api" -version = "1.3.0" +version = "1.4.0" edition = "2021" description = "Auto-generated bindings for the v2 torn api" license-file = { workspace = true } @@ -37,7 +37,7 @@ chrono = { version = "0.4.41", features = ["serde"] } tokio = { version = "1", features = ["full"] } [build-dependencies] -torn-api-codegen = { path = "../torn-api-codegen", version = "0.3.0" } +torn-api-codegen = { path = "../torn-api-codegen", version = "0.4.0" } syn = { workspace = true, features = ["parsing"] } proc-macro2 = { workspace = true } prettyplease = "0.2" From dbb35c4e820b3bc4bb1416d53d4fbe45d9ffe319 Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:23:21 +0200 Subject: [PATCH 09/26] feat(torn-api): added optional strum feature --- Cargo.lock | 27 +++++++++++++++++++++++++-- torn-api-codegen/Cargo.toml | 2 +- torn-api-codegen/src/model/enum.rs | 1 + torn-api/Cargo.toml | 6 ++++-- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cb40bb1..8687be0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2081,6 +2081,28 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "strum" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f64def088c51c9510a8579e3c5d67c65349dcf755e5479ad3d010aa6454e2c32" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c77a8c5abcaf0f9ce05d62342b7d298c346515365c36b673df4ebe3ced01fde8" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + [[package]] name = "subtle" version = "2.6.1" @@ -2272,7 +2294,7 @@ dependencies = [ [[package]] name = "torn-api" -version = "1.4.0" +version = "1.5.0" dependencies = [ "bon", "bytes", @@ -2285,6 +2307,7 @@ dependencies = [ "serde", "serde_json", "serde_repr", + "strum", "syn", "thiserror", "tokio", @@ -2293,7 +2316,7 @@ dependencies = [ [[package]] name = "torn-api-codegen" -version = "0.4.0" +version = "0.5.0" dependencies = [ "heck", "indexmap", diff --git a/torn-api-codegen/Cargo.toml b/torn-api-codegen/Cargo.toml index 80357c9..b8ee430 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.4.0" +version = "0.5.0" 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 23cd52d..aed832b 100644 --- a/torn-api-codegen/src/model/enum.rs +++ b/torn-api-codegen/src/model/enum.rs @@ -309,6 +309,7 @@ impl Enum { Some(quote! { #desc #[derive(Debug, Clone, PartialEq, #(#derives),*)] + #[cfg_attr(feature = "strum", derive(strum::EnumIs, strum::EnumTryAs))] #serde_attr pub enum #name { #(#variants),* diff --git a/torn-api/Cargo.toml b/torn-api/Cargo.toml index b2d031c..75f9dbb 100644 --- a/torn-api/Cargo.toml +++ b/torn-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "torn-api" -version = "1.4.0" +version = "1.5.0" edition = "2021" description = "Auto-generated bindings for the v2 torn api" license-file = { workspace = true } @@ -13,6 +13,7 @@ scopes = ["builder"] builder = ["requests", "dep:bon"] requests = ["models"] models = ["dep:serde_repr"] +strum = ["dep:strum"] [dependencies] serde = { workspace = true, features = ["derive"] } @@ -32,12 +33,13 @@ futures = { version = "0.3", default-features = false, features = [ "async-await", ] } chrono = { version = "0.4.41", features = ["serde"] } +strum = { version = "0.27.1", features = ["derive"], optional = true } [dev-dependencies] tokio = { version = "1", features = ["full"] } [build-dependencies] -torn-api-codegen = { path = "../torn-api-codegen", version = "0.4.0" } +torn-api-codegen = { path = "../torn-api-codegen", version = "0.5.0" } syn = { workspace = true, features = ["parsing"] } proc-macro2 = { workspace = true } prettyplease = "0.2" From a0dd9574ea936fd3208523463e6688892c8b490c Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:23:21 +0200 Subject: [PATCH 10/26] chore(key-pool): expose inner storage and client --- Cargo.lock | 2 +- torn-key-pool/Cargo.toml | 2 +- torn-key-pool/src/lib.rs | 14 ++++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8687be0..42757e2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2329,7 +2329,7 @@ dependencies = [ [[package]] name = "torn-key-pool" -version = "1.1.2" +version = "1.1.3" dependencies = [ "chrono", "futures", diff --git a/torn-key-pool/Cargo.toml b/torn-key-pool/Cargo.toml index 86881da..2164fd4 100644 --- a/torn-key-pool/Cargo.toml +++ b/torn-key-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "torn-key-pool" -version = "1.1.2" +version = "1.1.3" edition = "2021" authors = ["Pyrit [2111649]"] license-file = { workspace = true } diff --git a/torn-key-pool/src/lib.rs b/torn-key-pool/src/lib.rs index 2e41408..4f7d8cb 100644 --- a/torn-key-pool/src/lib.rs +++ b/torn-key-pool/src/lib.rs @@ -3,7 +3,7 @@ #[cfg(feature = "postgres")] pub mod postgres; -use std::{collections::HashMap, future::Future, sync::Arc, time::Duration}; +use std::{collections::HashMap, future::Future, ops::Deref, sync::Arc, time::Duration}; use futures::{future::BoxFuture, FutureExt, Stream, StreamExt}; use reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION}; @@ -354,7 +354,7 @@ where } } -struct KeyPoolInner +pub struct KeyPoolInner where S: KeyPoolStorage, { @@ -473,6 +473,16 @@ where inner: Arc>, } +impl Deref for KeyPool +where + S: KeyPoolStorage, +{ + type Target = KeyPoolInner; + fn deref(&self) -> &Self::Target { + &self.inner + } +} + enum RequestResult { Response(ApiResponse), Retry, From 07325fad829efb156c0d2603e4f8802f1d653d4d Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:23:21 +0200 Subject: [PATCH 11/26] chore(codegen): implemented `Eq` for `OpenApiSchema` --- torn-api-codegen/src/openapi/path.rs | 2 +- torn-api-codegen/src/openapi/schema.rs | 4 ++-- torn-api/src/executor.rs | 17 ++++++++++++++++- torn-api/src/scopes.rs | 14 ++++++++++++++ 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/torn-api-codegen/src/openapi/path.rs b/torn-api-codegen/src/openapi/path.rs index 5df455a..513870a 100644 --- a/torn-api-codegen/src/openapi/path.rs +++ b/torn-api-codegen/src/openapi/path.rs @@ -79,7 +79,7 @@ pub struct OpenApiPathBody<'a> { pub operation_id: Option, } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] pub struct OpenApiPath<'a> { #[serde(borrow)] pub get: OpenApiPathBody<'a>, diff --git a/torn-api-codegen/src/openapi/schema.rs b/torn-api-codegen/src/openapi/schema.rs index c06a76d..cd2d47b 100644 --- a/torn-api-codegen/src/openapi/schema.rs +++ b/torn-api-codegen/src/openapi/schema.rs @@ -3,7 +3,7 @@ use serde::Deserialize; use super::{parameter::OpenApiParameter, path::OpenApiPath, r#type::OpenApiType}; -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] pub struct Components<'a> { #[serde(borrow)] pub schemas: IndexMap<&'a str, OpenApiType<'a>>, @@ -11,7 +11,7 @@ pub struct Components<'a> { pub parameters: IndexMap<&'a str, OpenApiParameter<'a>>, } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] pub struct OpenApiSchema<'a> { #[serde(borrow)] pub paths: IndexMap<&'a str, OpenApiPath<'a>>, diff --git a/torn-api/src/executor.rs b/torn-api/src/executor.rs index 3ed5d03..61ba949 100644 --- a/torn-api/src/executor.rs +++ b/torn-api/src/executor.rs @@ -4,12 +4,15 @@ use futures::{Stream, StreamExt}; use http::{header::AUTHORIZATION, HeaderMap, HeaderValue}; use serde::Deserialize; -use crate::request::{ApiRequest, ApiResponse, IntoRequest}; #[cfg(feature = "scopes")] use crate::scopes::{ BulkFactionScope, BulkForumScope, BulkMarketScope, BulkRacingScope, BulkTornScope, BulkUserScope, FactionScope, ForumScope, MarketScope, RacingScope, TornScope, UserScope, }; +use crate::{ + request::{ApiRequest, ApiResponse, IntoRequest}, + scopes::{BulkKeyScope, KeyScope}, +}; pub trait Executor: Sized { type Error: From + From + Send; @@ -125,6 +128,8 @@ pub trait ExecutorExt: Executor + Sized { fn racing(self) -> RacingScope; fn forum(self) -> ForumScope; + + fn key(self) -> KeyScope; } #[cfg(feature = "scopes")] @@ -155,6 +160,10 @@ where fn forum(self) -> ForumScope { ForumScope::new(self) } + + fn key(self) -> KeyScope { + KeyScope::new(self) + } } #[cfg(feature = "scopes")] @@ -170,6 +179,8 @@ pub trait BulkExecutorExt: BulkExecutor + Sized { fn racing_bulk(self) -> BulkRacingScope; fn forum_bulk(self) -> BulkForumScope; + + fn key_bulk(self) -> BulkKeyScope; } #[cfg(feature = "scopes")] @@ -200,6 +211,10 @@ where fn forum_bulk(self) -> BulkForumScope { BulkForumScope::new(self) } + + fn key_bulk(self) -> BulkKeyScope { + BulkKeyScope::new(self) + } } pub struct ReqwestClient(reqwest::Client); diff --git a/torn-api/src/scopes.rs b/torn-api/src/scopes.rs index ea548f0..2751181 100644 --- a/torn-api/src/scopes.rs +++ b/torn-api/src/scopes.rs @@ -970,4 +970,18 @@ pub(super) mod test { client.user().reports(|b| b).await.unwrap(); } + + #[tokio::test] + async fn key_info() { + let client = test_client().await; + + client.key().info(|b| b).await.unwrap(); + } + + #[tokio::test] + async fn key_log() { + let client = test_client().await; + + client.key().log(|b| b).await.unwrap(); + } } From 549654f138c9001601ba6fdeb6833481c2ae18d7 Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:23:21 +0200 Subject: [PATCH 12/26] chore(codegen): release version --- Cargo.lock | 2 +- torn-api-codegen/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 42757e2..2f00c1c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2316,7 +2316,7 @@ dependencies = [ [[package]] name = "torn-api-codegen" -version = "0.5.0" +version = "0.5.1" dependencies = [ "heck", "indexmap", diff --git a/torn-api-codegen/Cargo.toml b/torn-api-codegen/Cargo.toml index b8ee430..ae0c4af 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.5.0" +version = "0.5.1" edition = "2021" description = "Contains the v2 torn API model descriptions and codegen for the bindings" license-file = { workspace = true } From 70fb56823015e93154fe392520bc601a4e240727 Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:23:22 +0200 Subject: [PATCH 13/26] feat(codegen): implemented `oneOf` unions for primitive types --- torn-api-codegen/src/model/enum.rs | 251 +++++++++++++++++++--- torn-api-codegen/src/model/mod.rs | 98 ++++++++- torn-api-codegen/src/model/object.rs | 39 ++-- torn-api-codegen/src/model/parameter.rs | 30 ++- torn-api-codegen/src/model/path.rs | 10 +- torn-api-codegen/src/openapi/parameter.rs | 4 + torn-api/build.rs | 57 +---- torn-api/src/scopes.rs | 20 +- 8 files changed, 380 insertions(+), 129 deletions(-) diff --git a/torn-api-codegen/src/model/enum.rs b/torn-api-codegen/src/model/enum.rs index aed832b..2012181 100644 --- a/torn-api-codegen/src/model/enum.rs +++ b/torn-api-codegen/src/model/enum.rs @@ -1,12 +1,15 @@ -use heck::ToUpperCamelCase; +use heck::{ToSnakeCase, ToUpperCamelCase}; use proc_macro2::TokenStream; use quote::{format_ident, quote}; +use syn::Ident; use crate::openapi::{ parameter::OpenApiParameterSchema, r#type::{OpenApiType, OpenApiVariants}, }; +use super::{object::PrimitiveType, ResolvedSchema}; + #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum EnumRepr { U8, @@ -17,10 +20,12 @@ pub enum EnumRepr { pub enum EnumVariantTupleValue { Ref { ty_name: String }, ArrayOfRefs { ty_name: String }, + Primitive(PrimitiveType), + Enum { name: String, inner: Enum }, } impl EnumVariantTupleValue { - pub fn from_schema(schema: &OpenApiType) -> Option { + pub fn from_schema(name: &str, schema: &OpenApiType) -> Option { match schema { OpenApiType { ref_path: Some(path), @@ -44,14 +49,61 @@ impl EnumVariantTupleValue { ty_name: path.strip_prefix("#/components/schemas/")?.to_owned(), }) } + OpenApiType { + r#type: Some("string"), + format: None, + r#enum: None, + .. + } => Some(Self::Primitive(PrimitiveType::String)), + OpenApiType { + r#type: Some("string"), + format: None, + r#enum: Some(_), + .. + } => { + let name = format!("{name}Variant"); + Some(Self::Enum { + inner: Enum::from_schema(&name, schema)?, + name, + }) + } + OpenApiType { + r#type: Some("integer"), + format: Some("int64"), + .. + } => Some(Self::Primitive(PrimitiveType::I64)), + OpenApiType { + r#type: Some("integer"), + format: Some("int32"), + .. + } => Some(Self::Primitive(PrimitiveType::I32)), _ => None, } } - pub fn type_name(&self) -> &str { + pub fn type_name(&self, ns: &mut EnumNamespace) -> TokenStream { match self { - Self::Ref { ty_name } => ty_name, - Self::ArrayOfRefs { ty_name } => ty_name, + Self::Ref { ty_name } => { + let ty = format_ident!("{ty_name}"); + quote! { crate::models::#ty } + } + Self::ArrayOfRefs { ty_name } => { + let ty = format_ident!("{ty_name}"); + quote! { Vec } + } + Self::Primitive(PrimitiveType::I64) => quote! { i64 }, + Self::Primitive(PrimitiveType::I32) => quote! { i32 }, + Self::Primitive(PrimitiveType::Float) => quote! { f32 }, + Self::Primitive(PrimitiveType::String) => quote! { String }, + Self::Primitive(PrimitiveType::DateTime) => quote! { chrono::DateTime }, + Self::Primitive(PrimitiveType::Bool) => quote! { bool }, + Self::Enum { name, .. } => { + let path = ns.get_ident(); + let ty_name = format_ident!("{name}"); + quote! { + #path::#ty_name, + } + } } } @@ -59,6 +111,36 @@ impl EnumVariantTupleValue { match self { Self::Ref { ty_name } => ty_name.clone(), Self::ArrayOfRefs { ty_name } => format!("{ty_name}s"), + Self::Primitive(PrimitiveType::I64) => "I64".to_owned(), + Self::Primitive(PrimitiveType::I32) => "I32".to_owned(), + Self::Primitive(PrimitiveType::Float) => "Float".to_owned(), + Self::Primitive(PrimitiveType::String) => "String".to_owned(), + Self::Primitive(PrimitiveType::DateTime) => "DateTime".to_owned(), + Self::Primitive(PrimitiveType::Bool) => "Bool".to_owned(), + Self::Enum { .. } => "Variant".to_owned(), + } + } + + pub fn is_display(&self, resolved: &ResolvedSchema) -> bool { + match self { + Self::Primitive(_) => true, + Self::Ref { ty_name } | Self::ArrayOfRefs { ty_name } => resolved + .models + .get(ty_name) + .map(|f| f.is_display(resolved)) + .unwrap_or_default(), + Self::Enum { inner, .. } => inner.is_display(resolved), + } + } + + pub fn codegen_display(&self) -> TokenStream { + match self { + Self::ArrayOfRefs { .. } => quote! { + write!(f, "{}", value.iter().map(ToString::to_string).collect::>().join(",")) + }, + _ => quote! { + write!(f, "{}", value) + }, } } } @@ -77,12 +159,32 @@ impl Default for EnumVariantValue { } impl EnumVariantValue { - pub fn codegen_display(&self, name: &str) -> Option { + pub fn is_display(&self, resolved: &ResolvedSchema) -> bool { match self { - Self::Repr(i) => Some(quote! { write!(f, "{}", #i) }), + Self::Repr(_) | Self::String { .. } => true, + Self::Tuple(val) => { + val.len() == 1 + && val + .iter() + .next() + .map(|v| v.is_display(resolved)) + .unwrap_or_default() + } + } + } + + pub fn codegen_display(&self, name: &str) -> Option { + let variant = format_ident!("{name}"); + + match self { + Self::Repr(i) => Some(quote! { Self::#variant => write!(f, "{}", #i) }), Self::String { rename } => { let name = rename.as_deref().unwrap_or(name); - Some(quote! { write!(f, #name) }) + Some(quote! { Self::#variant => write!(f, #name) }) + } + Self::Tuple(values) if values.len() == 1 => { + let rhs = values.first().unwrap().codegen_display(); + Some(quote! { Self::#variant(value) => #rhs }) } _ => None, } @@ -96,8 +198,61 @@ pub struct EnumVariant { pub value: EnumVariantValue, } +pub struct EnumNamespace<'e> { + r#enum: &'e Enum, + ident: Option, + elements: Vec, + top_level_elements: Vec, +} + +impl EnumNamespace<'_> { + pub fn get_ident(&mut self) -> Ident { + self.ident + .get_or_insert_with(|| { + let name = self.r#enum.name.to_snake_case(); + format_ident!("{name}") + }) + .clone() + } + + pub fn push_element(&mut self, el: TokenStream) { + self.elements.push(el); + } + + pub fn push_top_level(&mut self, el: TokenStream) { + self.top_level_elements.push(el); + } + + pub fn codegen(mut self) -> Option { + if self.elements.is_empty() && self.top_level_elements.is_empty() { + None + } else { + let top_level = &self.top_level_elements; + let mut output = quote! { + #(#top_level)* + }; + + if !self.elements.is_empty() { + let ident = self.get_ident(); + let elements = self.elements; + output.extend(quote! { + pub mod #ident { + #(#elements)* + } + }); + } + + Some(output) + } + } +} + impl EnumVariant { - pub fn codegen(&self) -> Option { + pub fn codegen( + &self, + ns: &mut EnumNamespace, + resolved: &ResolvedSchema, + ) -> Option { let doc = self.description.as_ref().map(|d| { quote! { #[doc = #d] @@ -127,15 +282,29 @@ impl EnumVariant { EnumVariantValue::Tuple(values) => { let mut val_tys = Vec::with_capacity(values.len()); - for value in values { - let ty_name = value.type_name(); - let ty_name = format_ident!("{ty_name}"); + if let [value] = values.as_slice() { + let enum_name = format_ident!("{}", ns.r#enum.name); + let ty_name = value.type_name(ns); - val_tys.push(quote! { - crate::models::#ty_name + ns.push_top_level(quote! { + impl From<#ty_name> for #enum_name { + fn from(value: #ty_name) -> Self { + Self::#name(value) + } + } }); } + for value in values { + let ty_name = value.type_name(ns); + + if let EnumVariantTupleValue::Enum { inner, .. } = &value { + ns.push_element(inner.codegen(resolved)?); + } + + val_tys.push(ty_name); + } + Some(quote! { #name(#(#val_tys),*) }) @@ -144,12 +313,7 @@ impl EnumVariant { } pub fn codegen_display(&self) -> Option { - let rhs = self.value.codegen_display(&self.name)?; - let name = format_ident!("{}", self.name); - - Some(quote! { - Self::#name => #rhs - }) + self.value.codegen_display(&self.name) } } @@ -159,7 +323,6 @@ pub struct Enum { pub description: Option, pub repr: Option, pub copy: bool, - pub display: bool, pub untagged: bool, pub variants: Vec, } @@ -176,7 +339,6 @@ impl Enum { match &schema.r#enum { Some(OpenApiVariants::Int(int_variants)) => { result.repr = Some(EnumRepr::U32); - result.display = true; result.variants = int_variants .iter() .copied() @@ -188,7 +350,6 @@ impl Enum { .collect(); } Some(OpenApiVariants::Str(str_variants)) => { - result.display = true; result.variants = str_variants .iter() .copied() @@ -214,7 +375,6 @@ impl Enum { let mut result = Self { name: name.to_owned(), copy: true, - display: true, ..Default::default() }; @@ -240,7 +400,7 @@ impl Enum { }; for schema in schemas { - let value = EnumVariantTupleValue::from_schema(schema)?; + let value = EnumVariantTupleValue::from_schema(name, schema)?; let name = value.name(); result.variants.push(EnumVariant { @@ -253,7 +413,11 @@ impl Enum { Some(result) } - pub fn codegen(&self) -> Option { + pub fn is_display(&self, resolved: &ResolvedSchema) -> bool { + self.variants.iter().all(|v| v.value.is_display(resolved)) + } + + 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)]}, @@ -266,12 +430,21 @@ impl Enum { } }); + let mut ns = EnumNamespace { + r#enum: self, + ident: None, + elements: Default::default(), + top_level_elements: Default::default(), + }; + + let is_display = self.is_display(resolved); + let mut display = Vec::with_capacity(self.variants.len()); let mut variants = Vec::with_capacity(self.variants.len()); for variant in &self.variants { - variants.push(variant.codegen()?); + variants.push(variant.codegen(&mut ns, resolved)?); - if self.display { + if is_display { display.push(variant.codegen_display()?); } } @@ -294,7 +467,7 @@ impl Enum { } }); - let display = self.display.then(|| { + let display = is_display.then(|| { quote! { impl std::fmt::Display for #name { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { @@ -306,6 +479,8 @@ impl Enum { } }); + let module = ns.codegen(); + Some(quote! { #desc #[derive(Debug, Clone, PartialEq, #(#derives),*)] @@ -315,6 +490,24 @@ impl Enum { #(#variants),* } #display + + #module }) } } + +#[cfg(test)] +mod test { + use super::*; + + use crate::openapi::schema::test::get_schema; + + #[test] + fn is_display() { + let schema = get_schema(); + let resolved = ResolvedSchema::from_open_api(&schema); + + let torn_selection_name = resolved.models.get("TornSelectionName").unwrap(); + assert!(torn_selection_name.is_display(&resolved)); + } +} diff --git a/torn-api-codegen/src/model/mod.rs b/torn-api-codegen/src/model/mod.rs index b6c823b..1a8ea80 100644 --- a/torn-api-codegen/src/model/mod.rs +++ b/torn-api-codegen/src/model/mod.rs @@ -1,10 +1,13 @@ use indexmap::IndexMap; use newtype::Newtype; use object::Object; +use parameter::Parameter; +use path::Path; use proc_macro2::TokenStream; use r#enum::Enum; +use scope::Scope; -use crate::openapi::r#type::OpenApiType; +use crate::openapi::{r#type::OpenApiType, schema::OpenApiSchema}; pub mod r#enum; pub mod newtype; @@ -22,6 +25,93 @@ pub enum Model { Unresolved, } +impl Model { + pub fn is_display(&self, resolved: &ResolvedSchema) -> bool { + match self { + Self::Enum(r#enum) => r#enum.is_display(resolved), + Self::Newtype(_) => true, + _ => false, + } + } +} + +#[derive(Debug, Default)] +pub struct ResolvedSchema { + pub models: IndexMap, + pub paths: IndexMap, + pub parameters: Vec, +} + +impl ResolvedSchema { + pub fn from_open_api(schema: &OpenApiSchema) -> Self { + let mut result = Self::default(); + + for (name, r#type) in &schema.components.schemas { + result.models.insert( + name.to_string(), + resolve(r#type, name, &schema.components.schemas), + ); + } + + for (path, body) in &schema.paths { + result.paths.insert( + path.to_string(), + Path::from_schema(path, body, &schema.components.parameters).unwrap(), + ); + } + + for (name, param) in &schema.components.parameters { + result + .parameters + .push(Parameter::from_schema(name, param).unwrap()); + } + + result + } + + pub fn codegen_models(&self) -> TokenStream { + let mut output = TokenStream::default(); + + for model in self.models.values() { + output.extend(model.codegen(self)); + } + + output + } + + pub fn codegen_requests(&self) -> TokenStream { + let mut output = TokenStream::default(); + + for path in self.paths.values() { + output.extend(path.codegen_request(self)); + } + + output + } + + pub fn codegen_parameters(&self) -> TokenStream { + let mut output = TokenStream::default(); + + for param in &self.parameters { + output.extend(param.codegen(self)); + } + + output + } + + pub fn codegen_scopes(&self) -> TokenStream { + let mut output = TokenStream::default(); + + let scopes = Scope::from_paths(self.paths.values().cloned().collect()); + + for scope in scopes { + output.extend(scope.codegen()); + } + + output + } +} + pub fn resolve(r#type: &OpenApiType, name: &str, schemas: &IndexMap<&str, OpenApiType>) -> Model { match r#type { OpenApiType { @@ -48,11 +138,11 @@ pub fn resolve(r#type: &OpenApiType, name: &str, schemas: &IndexMap<&str, OpenAp } impl Model { - pub fn codegen(&self) -> Option { + pub fn codegen(&self, resolved: &ResolvedSchema) -> Option { match self { Self::Newtype(newtype) => newtype.codegen(), - Self::Enum(r#enum) => r#enum.codegen(), - Self::Object(object) => object.codegen(), + Self::Enum(r#enum) => r#enum.codegen(resolved), + Self::Object(object) => object.codegen(resolved), Self::Unresolved => None, } } diff --git a/torn-api-codegen/src/model/object.rs b/torn-api-codegen/src/model/object.rs index ffb6c5a..48b3688 100644 --- a/torn-api-codegen/src/model/object.rs +++ b/torn-api-codegen/src/model/object.rs @@ -6,7 +6,7 @@ use syn::Ident; use crate::openapi::r#type::OpenApiType; -use super::r#enum::Enum; +use super::{r#enum::Enum, ResolvedSchema}; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum PrimitiveType { @@ -28,7 +28,11 @@ pub enum PropertyType { } impl PropertyType { - pub fn codegen(&self, namespace: &mut ObjectNamespace) -> Option { + pub fn codegen( + &self, + namespace: &mut ObjectNamespace, + resolved: &ResolvedSchema, + ) -> Option { match self { Self::Primitive(PrimitiveType::Bool) => Some(format_ident!("bool").into_token_stream()), Self::Primitive(PrimitiveType::I32) => Some(format_ident!("i32").into_token_stream()), @@ -47,7 +51,7 @@ impl PropertyType { Some(quote! { crate::models::#name }) } Self::Enum(r#enum) => { - let code = r#enum.codegen()?; + let code = r#enum.codegen(resolved)?; namespace.push_element(code); let ns = namespace.get_ident(); @@ -58,14 +62,14 @@ impl PropertyType { }) } Self::Array(array) => { - let inner_ty = array.codegen(namespace)?; + let inner_ty = array.codegen(namespace, resolved)?; Some(quote! { Vec<#inner_ty> }) } Self::Nested(nested) => { - let code = nested.codegen()?; + let code = nested.codegen(resolved)?; namespace.push_element(code); let ns = namespace.get_ident(); @@ -233,7 +237,11 @@ impl Property { } } - pub fn codegen(&self, namespace: &mut ObjectNamespace) -> Option { + pub fn codegen( + &self, + namespace: &mut ObjectNamespace, + resolved: &ResolvedSchema, + ) -> Option { let desc = self.description.as_ref().map(|d| quote! { #[doc = #d]}); let name = &self.name; @@ -246,7 +254,7 @@ impl Property { _ => (format_ident!("{name}"), None), }; - let ty_inner = self.r#type.codegen(namespace)?; + let ty_inner = self.r#type.codegen(namespace, resolved)?; let ty = if !self.required || self.nullable { quote! { Option<#ty_inner> } @@ -303,6 +311,7 @@ impl Object { } // TODO: implement custom enum for this (depends on overrides being added) + // Maybe this is an issue with the schema instead? if *prop_name == "value" && name == "TornHof" { continue; } @@ -348,7 +357,7 @@ impl Object { Some(result) } - pub fn codegen(&self) -> Option { + pub fn codegen(&self, resolved: &ResolvedSchema) -> Option { let doc = self.description.as_ref().map(|d| { quote! { #[doc = #d] @@ -363,7 +372,7 @@ impl Object { let mut props = Vec::with_capacity(self.properties.len()); for prop in &self.properties { - props.push(prop.codegen(&mut namespace)?); + props.push(prop.codegen(&mut namespace, resolved)?); } let name = format_ident!("{}", self.name); @@ -422,18 +431,6 @@ mod test { use crate::openapi::schema::test::get_schema; - #[test] - fn resolve_object() { - let schema = get_schema(); - - let attack = schema.components.schemas.get("FactionUpgrades").unwrap(); - - let resolved = - Object::from_schema_object("FactionUpgrades", attack, &schema.components.schemas) - .unwrap(); - let _code = resolved.codegen().unwrap(); - } - #[test] fn resolve_objects() { let schema = get_schema(); diff --git a/torn-api-codegen/src/model/parameter.rs b/torn-api-codegen/src/model/parameter.rs index 733163f..27ba1c9 100644 --- a/torn-api-codegen/src/model/parameter.rs +++ b/torn-api-codegen/src/model/parameter.rs @@ -9,7 +9,7 @@ use crate::openapi::parameter::{ ParameterLocation as SchemaLocation, }; -use super::r#enum::Enum; +use super::{r#enum::Enum, ResolvedSchema}; #[derive(Debug, Clone)] pub struct ParameterOptions

{ @@ -42,9 +42,7 @@ impl ParameterType { match schema { OpenApiParameterSchema { r#type: Some("integer"), - // BUG: missing for some types in the spec - - // format: Some("int32"), + format: Some("int32"), .. } => { let default = match schema.default { @@ -90,6 +88,17 @@ impl ParameterType { r#type: Enum::from_parameter_schema(name, schema)?, }) } + OpenApiParameterSchema { + one_of: Some(schemas), + .. + } => Some(ParameterType::Enum { + options: ParameterOptions { + default: None, + minimum: None, + maximum: None, + }, + r#type: Enum::from_one_of(name, schemas)?, + }), OpenApiParameterSchema { r#type: Some("string"), .. @@ -170,7 +179,7 @@ impl Parameter { }) } - pub fn codegen(&self) -> Option { + pub fn codegen(&self, resolved: &ResolvedSchema) -> Option { match &self.r#type { ParameterType::I32 { options } => { let name = format_ident!("{}", self.name); @@ -274,7 +283,7 @@ The default value [Self::{}](self::{}#variant.{})"#, } let doc = quote! { #[doc = #desc]}; - let inner = r#type.codegen()?; + let inner = r#type.codegen(resolved)?; Some(quote! { #doc @@ -300,7 +309,7 @@ The default value [Self::{}](self::{}#variant.{})"#, ..self.clone() }; - let mut code = inner.codegen().unwrap_or_default(); + let mut code = inner.codegen(resolved).unwrap_or_default(); let name = format_ident!("{}", outer_name); let inner_ty = items.codegen_type_name(&inner_name); @@ -324,9 +333,9 @@ The default value [Self::{}](self::{}#variant.{})"#, } } - impl From for #name where T: IntoIterator { + impl From for #name where T: IntoIterator, T::Item: Into<#inner_ty> { fn from(value: T) -> #name { - let items = value.into_iter().collect(); + let items = value.into_iter().map(Into::into).collect(); Self(items) } @@ -405,6 +414,7 @@ mod test { #[test] fn codegen_inline() { let schema = get_schema(); + let resolved = ResolvedSchema::from_open_api(&schema); let mut params = 0; let mut unresolved = Vec::new(); @@ -425,7 +435,7 @@ mod test { continue; } params += 1; - if param.codegen().is_none() { + if param.codegen(&resolved).is_none() { unresolved.push(format!("`{}.{}`", path, inline.name)); } } diff --git a/torn-api-codegen/src/model/path.rs b/torn-api-codegen/src/model/path.rs index 7f534ce..319360b 100644 --- a/torn-api-codegen/src/model/path.rs +++ b/torn-api-codegen/src/model/path.rs @@ -14,6 +14,7 @@ use crate::openapi::{ use super::{ parameter::{Parameter, ParameterLocation, ParameterType}, union::Union, + ResolvedSchema, }; #[derive(Debug, Clone)] @@ -125,7 +126,7 @@ impl Path { }) } - pub fn codegen_request(&self) -> Option { + pub fn codegen_request(&self, resolved: &ResolvedSchema) -> Option { let name = if self.segments.len() == 1 { let Some(PathSegment::Constant(first)) = self.segments.first() else { return None; @@ -159,7 +160,7 @@ impl Path { let ty_name = format_ident!("{}", param.name); if is_inline { - ns.push_element(param.codegen()?); + ns.push_element(param.codegen(resolved)?); let path = ns.get_ident(); ( @@ -190,7 +191,7 @@ impl Path { ) } ParameterType::Array { .. } => { - ns.push_element(param.codegen()?); + ns.push_element(param.codegen(resolved)?); let ty_name = param.r#type.codegen_type_name(¶m.name); let path = ns.get_ident(); ( @@ -625,6 +626,7 @@ mod test { #[test] fn codegen_paths() { let schema = get_schema(); + let resolved = ResolvedSchema::from_open_api(&schema); let mut paths = 0; let mut unresolved = vec![]; @@ -636,7 +638,7 @@ mod test { continue; }; - if path.codegen_scope_call().is_none() || path.codegen_request().is_none() { + if path.codegen_scope_call().is_none() || path.codegen_request(&resolved).is_none() { unresolved.push(name); } } diff --git a/torn-api-codegen/src/openapi/parameter.rs b/torn-api-codegen/src/openapi/parameter.rs index 857fd85..38a298a 100644 --- a/torn-api-codegen/src/openapi/parameter.rs +++ b/torn-api-codegen/src/openapi/parameter.rs @@ -2,6 +2,8 @@ use std::borrow::Cow; use serde::Deserialize; +use super::r#type::OpenApiType; + #[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize)] #[serde(rename_all = "lowercase")] pub enum ParameterLocation { @@ -17,6 +19,7 @@ pub enum OpenApiParameterDefault<'a> { } #[derive(Debug, Clone, Deserialize, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] pub struct OpenApiParameterSchema<'a> { #[serde(rename = "$ref")] pub ref_path: Option<&'a str>, @@ -27,6 +30,7 @@ pub struct OpenApiParameterSchema<'a> { pub maximum: Option, pub minimum: Option, pub items: Option>>, + pub one_of: Option>>, } #[derive(Debug, Clone, Deserialize, PartialEq, Eq)] diff --git a/torn-api/build.rs b/torn-api/build.rs index cb27066..0d74a6b 100644 --- a/torn-api/build.rs +++ b/torn-api/build.rs @@ -1,12 +1,6 @@ use std::{env, fs, path::Path}; -use proc_macro2::TokenStream; -use torn_api_codegen::{ - model::{parameter::Parameter, path::Path as ApiPath, resolve, scope::Scope}, - openapi::schema::OpenApiSchema, -}; - -const DENY_LIST: &[&str] = &[]; +use torn_api_codegen::{model::ResolvedSchema, openapi::schema::OpenApiSchema}; fn main() { let out_dir = env::var_os("OUT_DIR").unwrap(); @@ -17,60 +11,21 @@ fn main() { let s = include_str!("./openapi.json"); let schema: OpenApiSchema = serde_json::from_str(s).unwrap(); + let resolved = ResolvedSchema::from_open_api(&schema); - let mut models_code = TokenStream::new(); - - for (name, model) in &schema.components.schemas { - if DENY_LIST.contains(name) { - continue; - } - let model = resolve(model, name, &schema.components.schemas); - if let Some(new_code) = model.codegen() { - models_code.extend(new_code); - } - } - - let models_file = syn::parse2(models_code).unwrap(); + let models_file = syn::parse2(resolved.codegen_models()).unwrap(); let models_pretty = prettyplease::unparse(&models_file); fs::write(&model_dest, models_pretty).unwrap(); - let mut params_code = TokenStream::new(); - - for (name, param) in &schema.components.parameters { - if let Some(code) = Parameter::from_schema(name, param).unwrap().codegen() { - params_code.extend(code); - } - } - - let params_file = syn::parse2(params_code).unwrap(); + let params_file = syn::parse2(resolved.codegen_parameters()).unwrap(); let params_pretty = prettyplease::unparse(¶ms_file); fs::write(¶ms_dest, params_pretty).unwrap(); - let mut requests_code = TokenStream::new(); - let mut paths = Vec::new(); - for (name, path) in &schema.paths { - let Some(path) = ApiPath::from_schema(name, path, &schema.components.parameters) else { - continue; - }; - if let Some(code) = path.codegen_request() { - requests_code.extend(code); - } - paths.push(path); - } - - let requests_file = syn::parse2(requests_code).unwrap(); + let requests_file = syn::parse2(resolved.codegen_requests()).unwrap(); let requests_pretty = prettyplease::unparse(&requests_file); fs::write(&requests_dest, requests_pretty).unwrap(); - let mut scope_code = TokenStream::new(); - let scopes = Scope::from_paths(paths); - for scope in scopes { - if let Some(code) = scope.codegen() { - scope_code.extend(code); - } - } - - let scopes_file = syn::parse2(scope_code).unwrap(); + let scopes_file = syn::parse2(resolved.codegen_scopes()).unwrap(); let scopes_pretty = prettyplease::unparse(&scopes_file); fs::write(&scopes_dest, scopes_pretty).unwrap(); } diff --git a/torn-api/src/scopes.rs b/torn-api/src/scopes.rs index 2751181..bc3e868 100644 --- a/torn-api/src/scopes.rs +++ b/torn-api/src/scopes.rs @@ -9,8 +9,8 @@ pub(super) mod test { use crate::{ executor::{ExecutorExt, ReqwestClient}, models::{ - AttackCode, FactionSelectionName, PersonalStatsCategoryEnum, PersonalStatsStatName, - UserListEnum, + faction_selection_name::FactionSelectionNameVariant, AttackCode, FactionSelectionName, + PersonalStatsCategoryEnum, PersonalStatsStatName, UserListEnum, }, }; @@ -67,7 +67,10 @@ pub(super) mod test { let r = client .faction() .for_selections(|b| { - b.selections([FactionSelectionName::Basic, FactionSelectionName::Balance]) + b.selections([ + FactionSelectionNameVariant::Basic, + FactionSelectionNameVariant::Balance, + ]) }) .await .unwrap(); @@ -424,7 +427,7 @@ pub(super) mod test { let forum_scope = ForumScope(&client); forum_scope - .threads_for_category_ids([2.into()].into(), |b| b) + .threads_for_category_ids([2].into(), |b| b) .await .unwrap(); } @@ -495,14 +498,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() { @@ -648,10 +651,7 @@ pub(super) mod test { let torn_scope = TornScope(&client); - torn_scope - .items_for_ids([1.into()].into(), |b| b) - .await - .unwrap(); + torn_scope.items_for_ids([1].into(), |b| b).await.unwrap(); } #[tokio::test] From b245e3e712a0beb676454f071178e7b4ae8f5be4 Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:27:56 +0200 Subject: [PATCH 14/26] chore(key-pool): release version --- Cargo.lock | 2 +- torn-key-pool/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ceaf3b3..19e2230 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2304,7 +2304,7 @@ dependencies = [ [[package]] name = "torn-key-pool" -version = "1.1.1" +version = "1.1.2" dependencies = [ "chrono", "futures", diff --git a/torn-key-pool/Cargo.toml b/torn-key-pool/Cargo.toml index 28aad1a..86881da 100644 --- a/torn-key-pool/Cargo.toml +++ b/torn-key-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "torn-key-pool" -version = "1.1.1" +version = "1.1.2" edition = "2021" authors = ["Pyrit [2111649]"] license-file = { workspace = true } From 47461b61b20624d03edf74fac50ebdc06144e84e Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:27:56 +0200 Subject: [PATCH 15/26] fix(codegen): fixed codegen for array path parameters --- torn-api-codegen/openapi.json | 12593 +++++++++++----------- torn-api-codegen/src/model/enum.rs | 20 - torn-api-codegen/src/model/mod.rs | 61 +- torn-api-codegen/src/model/newtype.rs | 21 - torn-api-codegen/src/model/object.rs | 4 +- torn-api-codegen/src/model/parameter.rs | 9 +- torn-api-codegen/src/model/path.rs | 15 +- torn-api/src/scopes.rs | 4 +- 8 files changed, 6393 insertions(+), 6334 deletions(-) diff --git a/torn-api-codegen/openapi.json b/torn-api-codegen/openapi.json index a6b7e07..c5ddb7a 100644 --- a/torn-api-codegen/openapi.json +++ b/torn-api-codegen/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.6.0" + "version": "1.6.1" }, "servers": [ { @@ -19,6 +19,7 @@ ], "summary": "Get your detailed attacks", "description": "Requires limited access key.
", + "operationId": "3acc98a3016974b786cb01e04e1ced04", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100" @@ -69,6 +70,7 @@ ], "summary": "Get your simplified attacks", "description": "Requires limited access key.
Returns up to 1,000 rows.
", + "operationId": "e995691fd9845c8b4a91f065ac9c8420", "parameters": [ { "$ref": "#/components/parameters/ApiLimit1000" @@ -119,6 +121,7 @@ ], "summary": "Get bounties placed on you", "description": "Requires public access key.
", + "operationId": "c85fd102a25aaec3aa98611d0da6c219", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -157,6 +160,7 @@ ], "summary": "Get bounties placed on a specific user", "description": "Requires public access key.
", + "operationId": "eb5eca5c6b978ee23ef74035c14ff4cc", "parameters": [ { "name": "id", @@ -204,6 +208,7 @@ ], "summary": "Get your competition's event start time", "description": "Requires minimal access key.
Only available to yourself.", + "operationId": "4cc4cc6fa3764f9732db9589e91d7739", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -242,6 +247,7 @@ ], "summary": "Get your crime statistics", "description": "Requires minimal access key.
Return the details and statistics about for a specific crime.", + "operationId": "37f1e394f9d6e3f6fd436fae3e9b9ac4", "parameters": [ { "name": "crimeId", @@ -289,6 +295,7 @@ ], "summary": "Get your education information", "description": "The response contains a list of complete eduactions and of a current education (if any).", + "operationId": "fddc6adc5139d8a1e0a151d80816dba7", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -327,6 +334,7 @@ ], "summary": "Get user enlisted cars", "description": "Requires minimal access key.
Returns a list of all user enlisted cars.", + "operationId": "dc3deee7629610931240be337c47a8ee", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -365,6 +373,7 @@ ], "summary": "Get your current faction balance", "description": "Requires limited access key.
", + "operationId": "b7ebbeea51dc2ef56c3ed5fd9d94e680", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -403,6 +412,7 @@ ], "summary": "Get updates on your threads and posts", "description": "Requires minimal access key.
This selection returns data visible in 'Feed' section on forum page. Feed is sorted by timestamp descending. Only a maximum of 100 rows are returned.", + "operationId": "17f99b99fac9601887dd1d001b95bb08", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -441,6 +451,7 @@ ], "summary": "Get updates on your friends' activity", "description": "Requires minimal access key.
This selection returns data visible in 'Friends' section on forum page. Feed is sorted by timestamp descending. Only a maximum of 100 rows are returned.", + "operationId": "2ceb7f08dc5f06a01d1fbe50425414c1", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -479,6 +490,7 @@ ], "summary": "Get your posts", "description": "Requires public access key.
Returns 20 posts per page.", + "operationId": "cc3a21ed98c1a80ffeeda4e33c75b9a0", "parameters": [ { "$ref": "#/components/parameters/ApiStripTagsTrue" @@ -532,6 +544,7 @@ ], "summary": "Get posts for a specific player", "description": "Requires public access key.
Returns 20 posts per page for a specific player.", + "operationId": "423ceffcad89f9ee7abfb85bed32b692", "parameters": [ { "$ref": "#/components/parameters/ApiStripTagsTrue" @@ -594,6 +607,7 @@ ], "summary": "Get updates on threads you subscribed to", "description": "Requires minimal access key.
This selection returns data visible in 'Subscribed Threads' section on forum page. Threads are sorted in the same way as on site.", + "operationId": "92c7e86065c3d18b000e825aa6688eed", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -632,6 +646,7 @@ ], "summary": "Get your threads", "description": "Requires public access key.
Returns 100 threads per page. The field 'new_posts' is also available, indicating the amount of unread posts with a Minimum API key (or higher).", + "operationId": "807adc6a64d86e07d629a15dde8c6105", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100Default20" @@ -682,6 +697,7 @@ ], "summary": "Get threads for a specific player", "description": "Requires public access key.
Returns 100 threads per page for a specific player. When requesting data for the key owner, a field 'new_posts' is also available, indicating the amount of unread posts. Minimum API key is required for that.", + "operationId": "481c6645dae298b54f0630ef7de81dba", "parameters": [ { "name": "id", @@ -741,6 +757,7 @@ ], "summary": "Get your hall of fame rankings", "description": "Requires public access key.
When requesting selection with Limited, Full or Custom key, battle_stats selection will be populated.", + "operationId": "959a3a302d736b416ec1edd4def8fe91", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -779,6 +796,7 @@ ], "summary": "Get hall of fame rankings for a specific player", "description": "Requires public access key.
The battle_stats selection will be populated only when requesting selection with Limited, Full or Custom key and for yourself.", + "operationId": "f86d41c9434e42d22f9ff46ecc4e5b88", "parameters": [ { "name": "id", @@ -826,6 +844,7 @@ ], "summary": "Get your item market listings for a specific item", "description": "Requires limited access key.
", + "operationId": "8fcbe4dcf8a3a28e31e2eaab877feea1", "parameters": [ { "$ref": "#/components/parameters/ApiOffset" @@ -867,6 +886,7 @@ ], "summary": "Get your starter job positions", "description": "Requires minimal access key.
", + "operationId": "facf1ddeef80a440229941f49aec6ccc", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -905,6 +925,7 @@ ], "summary": "Get your friends, enemies or targets list", "description": "Requires limited access key.
", + "operationId": "e93ba44fcc7ad2eb3063dec7469ee2f6", "parameters": [ { "name": "cat", @@ -961,6 +982,7 @@ ], "summary": "Get your current ongoing organized crime", "description": "Requires minimal access key.
", + "operationId": "3c6f8acbfcb398592e3f3b65ab91a40f", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -999,6 +1021,7 @@ ], "summary": "Get your personal stats", "description": "Requires public access key.
\n * UserPersonalStatsFull is returned only when this selection is requested with Limited, Full or Custom key access key.\n * UserPersonalStatsFullPublic is returned when the requested category is 'all'.\n * UserPersonalStatsPopular is returned when the requested category is 'popular'. Please try to use UserPersonalStatsPopular over UserPersonalStatsFullPublic wherever possible in order to reduce the server load.\n * Otherwise, UserPersonalStatsCategory is returned for the matched category.\n * It's possible to request specific stats via 'stat' parameter. In this case the response will vary depending on the stats requested. Private stats are still available only to the key owner (with Limited or higher key).\n * Additionally, historical stats can also be fetched via 'stat' query parameter, but 'timestamp' parameter must be provided as well. It's only possible to pass up to 10 historical stats at once (the rest is trimmed). When requesting historical stats the response will be of type UserPersonalStatsHistoric.", + "operationId": "388e8008ae1c2645819af76d71ef92a5", "parameters": [ { "name": "cat", @@ -1033,9 +1056,6 @@ "format": "int32" } }, - { - "$ref": "#/components/parameters/ApiTimestamp" - }, { "$ref": "#/components/parameters/ApiComment" }, @@ -1070,6 +1090,7 @@ ], "summary": "Get a player's personal stats", "description": "Requires public access key.
\n * UserPersonalStatsFull is returned only when this selection is requested for the key owner with Limited, Full or Custom key.\n * UserPersonalStatsFullPublic is returned when the requested category is 'all'.\n * UserPersonalStatsPopular is returned when the requested category is 'popular'. Please try to use UserPersonalStatsPopular over UserPersonalStatsFullPublic wherever possible in order to reduce the server load.\n * Otherwise, UserPersonalStatsCategory is returned for the matched category.\n * It's possible to request specific stats via 'stat' parameter. In this case the response will vary depending on the stats requested. Private stats are still available only to the key owner (with Limited or higher key).\n * Additionally, historical stats can also be fetched via 'stat' query parameter, but 'timestamp' parameter must be provided as well. It's only possible to pass up to 10 historical stats at once (the rest is trimmed). When requesting historical stats the response will be of type UserPersonalStatsHistoric.", + "operationId": "6ac851069df2c33e53cc69eecae44f1e", "parameters": [ { "name": "id", @@ -1113,9 +1134,6 @@ "format": "int32" } }, - { - "$ref": "#/components/parameters/ApiTimestamp" - }, { "$ref": "#/components/parameters/ApiComment" }, @@ -1150,6 +1168,7 @@ ], "summary": "Get user races", "description": "Requires minimal access key.
Returns a list of user races, ordered by race start timestamp.", + "operationId": "ba6e495bf0c6b2e87db337c1a09f4852", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100Default20" @@ -1214,6 +1233,7 @@ ], "summary": "Get your detailed revives", "description": "Requires limited access key.
", + "operationId": "3c847eb1325040798f37a7492108e094", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100Default20" @@ -1267,6 +1287,7 @@ ], "summary": "Get your simplified revives", "description": "Requires limited access key.
", + "operationId": "8820cd889afde899353037ca5a0f9a07", "parameters": [ { "$ref": "#/components/parameters/ApiLimit1000Default20" @@ -1320,6 +1341,7 @@ ], "summary": "Get all available user selections", "description": "Requires public access key.
", + "operationId": "c0a6c91697cd1683c39b3c0649a18ec8", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -1358,6 +1380,7 @@ ], "summary": "Get current server time", "description": "Requires public access key.
", + "operationId": "a72308321da0c4a2c31c60218acc7a85", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -1396,6 +1419,7 @@ ], "summary": "Get any User selection", "description": "Key access level depends on the required selections.
Choose one or more selections (comma separated).", + "operationId": "ce480599312126b8a5d77ced3ab8caa8", "parameters": [ { "name": "selections", @@ -1566,6 +1590,7 @@ ], "summary": "Get your faction's applications", "description": "Requires minimal access key with faction API access permissions.
", + "operationId": "9f7dccb023d81a8da7f5f6a359658a64", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -1604,6 +1629,7 @@ ], "summary": "Get your faction's detailed attacks", "description": "Requires limited access key with faction API access permissions.
", + "operationId": "cb5b38ba64c389e706526df8bc8af9b6", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100" @@ -1654,6 +1680,7 @@ ], "summary": "Get your faction's simplified attacks", "description": "Requires limited access key with faction API access permissions.
", + "operationId": "8551280aaaf9819aa94be5c469a523de", "parameters": [ { "$ref": "#/components/parameters/ApiLimit1000" @@ -1704,6 +1731,7 @@ ], "summary": "Get your faction's & member's balance details", "description": "Requires limited access key with faction API access permissions.
", + "operationId": "3ca2c0319f960b728ffece8e322cf40f", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -1742,6 +1770,7 @@ ], "summary": "Get your faction's basic details", "description": "Requires public access key.
The 'is_enlisted' value will be populated if you have API faction permissions (with custom, limited or full access keys), otherwise it will be set as null.", + "operationId": "fb363bf0e1d54296bd4d5dd554ad9825", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -1780,6 +1809,7 @@ ], "summary": "Get a faction's basic details", "description": "Requires public access key.
The 'is_enlisted' value will be populated if you're requesting data for your faction and have faction permissions (with custom, limited or full access keys), otherwise it will be set as null.", + "operationId": "a09da2d5f951a49d974dbec3149b3a24", "parameters": [ { "name": "id", @@ -1827,6 +1857,7 @@ ], "summary": "Get your faction's current chain", "description": "Requires public access key.
", + "operationId": "aee5679a81c6a7bcd3862c0aafd6b558", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -1865,6 +1896,7 @@ ], "summary": "Get a faction's current chain", "description": "Requires public access key.
", + "operationId": "ec8f82e15a321adbb20e615024d9dff6", "parameters": [ { "name": "id", @@ -1912,6 +1944,7 @@ ], "summary": "Get a list of your faction's completed chains", "description": "Requires public access key.
", + "operationId": "dfc0adb55af4aeeeebc2d82309c71eea", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100" @@ -1962,6 +1995,7 @@ ], "summary": "Get a list of a faction's completed chains", "description": "Requires public access key.
", + "operationId": "dd88ca1ffafed80457916da5298a3422", "parameters": [ { "name": "id", @@ -2021,6 +2055,7 @@ ], "summary": "Get your faction's latest chain report", "description": "Requires public access key.
This includes currently ongoing chains.", + "operationId": "614a2f2bdd7fb6df778b7657c75d1113", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -2059,6 +2094,7 @@ ], "summary": "Get a chain report", "description": "Requires public access key.
Chain reports for ongoing chains are available only for your own faction.", + "operationId": "21a251c2ec9f6c93b89fb715196bb8be", "parameters": [ { "name": "chainId", @@ -2106,6 +2142,7 @@ ], "summary": "Get your faction's challenge contributors", "description": "Requires limiteed access key with faction API access permissions.
", + "operationId": "40eb7627818eb777fdc713ed78209c6b", "parameters": [ { "name": "stat", @@ -2166,6 +2203,7 @@ ], "summary": "Get your faction's organized crimes", "description": "Requires minimal access key with faction API access permissions.
It's possible to get older entries either by timestamp range (from, to) or with offset.", + "operationId": "72e5db8a773908fedff4bb002f3f4406", "parameters": [ { "name": "cat", @@ -2235,6 +2273,7 @@ ], "summary": "Get a specific organized crime", "description": "Requires minimal access key with faction API access permissions.
", + "operationId": "b4867db9b02fa7dcd31b2073f2a936ce", "parameters": [ { "name": "crimeId", @@ -2282,6 +2321,7 @@ ], "summary": "Get your faction's hall of fame rankings.", "description": "Requires public access key.
", + "operationId": "e104b0b606664d06d9638111702301f3", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -2320,6 +2360,7 @@ ], "summary": "Get a faction's hall of fame rankings.", "description": "Requires public access key.
", + "operationId": "a775ca7831f4cad88c308be28f50e597", "parameters": [ { "name": "id", @@ -2367,6 +2408,7 @@ ], "summary": "Get a list of your faction's members", "description": "Requires public access key.
The 'revive_setting' value will be populated (not Unknown) if you have faction permissions (with custom, limited or full access keys), otherwise it will be set as 'Unknown'.", + "operationId": "03d304564e4f84e3f258e5b8059bcc22", "parameters": [ { "$ref": "#/components/parameters/ApiStripTagsTrue" @@ -2408,6 +2450,7 @@ ], "summary": "Get a list of a faction's members", "description": "Requires public access key.
The 'revive_setting' value will be populated (not Unknown) if you're requesting data for your own faction and have faction permissions (with custom, limited or full access keys), otherwise it will be set as 'Unknown'.", + "operationId": "99a899c0094645475fd6254b423fea43", "parameters": [ { "name": "id", @@ -2458,6 +2501,7 @@ ], "summary": "Get your faction's news details", "description": "Requires minimal access key with faction API access permissions.
It is possible to pass up to 10 categories at the time (comma separated). Categories 'attack', 'depositFunds' and 'giveFunds' are only available with 'Custom', 'Limited' or 'Full' access keys.", + "operationId": "1da64889366de71140f2c15ad14b67b1", "parameters": [ { "$ref": "#/components/parameters/ApiStripTagsFalse" @@ -2520,6 +2564,7 @@ ], "summary": "Get your faction's positions details", "description": "Requires minimal access key with faction API access permissions.
", + "operationId": "77dae3b930e2e2f9f7608567db0b94f4", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -2558,6 +2603,7 @@ ], "summary": "Get a list of current rackets", "description": "Requires public access key.
", + "operationId": "f750d219e54329ae300c4db384dd5dcd", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -2596,6 +2642,7 @@ ], "summary": "Get ranked wars list", "description": "Requires public access key.
When category 'all' is chosen, you can use 'from', 'to' & 'sort' query parameters.
When category 'ongoing' is chosen, all currently active ranked wars are returned.
When no category is chosen, this selection will return ranked war history of your own faction (if any).", + "operationId": "4f5d624a86e2d389a7a738b6b3ce8c9e", "parameters": [ { "name": "cat", @@ -2651,6 +2698,7 @@ ], "summary": "Get a faction's ranked wars history", "description": "Requires public access key.
", + "operationId": "5b6646714e5ae1cc397bdec877f55691", "parameters": [ { "name": "id", @@ -2698,6 +2746,7 @@ ], "summary": "Get ranked war details", "description": "Requires public access key.
", + "operationId": "db49842d88e193777dc695e54769113e", "parameters": [ { "name": "rankedWarId", @@ -2745,6 +2794,7 @@ ], "summary": "Get your faction's detailed revives", "description": "Requires limited access key with faction API access permissions.
", + "operationId": "486fcda26ed1aa6aba8ec7091080723b", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100" @@ -2798,6 +2848,7 @@ ], "summary": "Get your faction's simplified revives", "description": "Requires limited access key with faction API access permissions.
", + "operationId": "f17a4064779e8de5200238816c233c02", "parameters": [ { "$ref": "#/components/parameters/ApiLimit1000" @@ -2851,6 +2902,7 @@ ], "summary": "Get your faction's challenges stats", "description": "Requires minimal access key with faction API access permissions.
", + "operationId": "806d9dc7e5fcf9e1ee9c3cdf7f035392", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -2889,6 +2941,7 @@ ], "summary": "Get a list of your faction's territories", "description": "Requires public access key.
", + "operationId": "fa6b3fbb14e5f3a71279b058bd751754", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -2927,6 +2980,7 @@ ], "summary": "Get a list of a faction's territories", "description": "Requires public access key.
", + "operationId": "4dce518364dad91fb3503e0382adfadf", "parameters": [ { "name": "id", @@ -2974,6 +3028,7 @@ ], "summary": "Get a list of your faction's territories", "description": "Requires public access key.
", + "operationId": "bf56fb8aba4d6810e9b96402e25b931d", "parameters": [ { "$ref": "#/components/parameters/ApiOffset" @@ -3018,6 +3073,7 @@ ], "summary": "Get territory wars list", "description": "Requires public access key.
When category 'finished' is chosen, you can use 'from', 'to' & 'sort' query parameters.
When category 'ongoing' is chosen, all currently active territory wars are returned.
When no category is chosen, this selection will return territory war history of your own faction (if any).", + "operationId": "0258963246159d1e3e54547c32aac7c8", "parameters": [ { "name": "cat", @@ -3076,6 +3132,7 @@ ], "summary": "Get a faction's territory wars history", "description": "Requires public access key.
", + "operationId": "76ce672d50a66fc0a832f9088e5436af", "parameters": [ { "name": "id", @@ -3123,6 +3180,7 @@ ], "summary": "Get territory war details", "description": "Requires public access key.
", + "operationId": "4e8aeafde7b5fc9918d166cda150fa91", "parameters": [ { "name": "territoryWarId", @@ -3170,6 +3228,7 @@ ], "summary": "Get your faction's upgrades", "description": "Requires minimal access key with faction API access permissions.
", + "operationId": "959f415abf48cb753414cec179b1b039", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -3208,6 +3267,7 @@ ], "summary": "Get your faction's wars & pacts details", "description": "Requires public access key.
", + "operationId": "b31cce9916e77431c08822844a0dbf2b", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -3246,6 +3306,7 @@ ], "summary": "Get a faction's wars & pacts details", "description": "Requires public access key.
", + "operationId": "c370823454d5ea28fc0df9a5b6a24c54", "parameters": [ { "name": "id", @@ -3292,6 +3353,7 @@ "Faction" ], "description": "Requires public access key.
", + "operationId": "065bcbaa654fc44ce7b8ea574b84f7b9", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -3330,6 +3392,7 @@ ], "summary": "Get current server time", "description": "Requires public access key.
", + "operationId": "627df4d7d8b91c62dacb66ff373aab5c", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -3368,6 +3431,7 @@ ], "summary": "Get any Faction selection", "description": "Key access level depends on the required selections.
Choose one or more selections (comma separated).", + "operationId": "dd89e28b1f1ed88853b09ecc982e4e66", "parameters": [ { "name": "selections", @@ -3556,6 +3620,7 @@ ], "summary": "Get publicly available forum categories", "description": "Requires public access key.
", + "operationId": "79b21191b87da275f3b87a7a1a233d04", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -3594,6 +3659,7 @@ ], "summary": "Get specific forum thread posts", "description": "Requires public access key.
Returns 20 posts per page for a specific thread.", + "operationId": "9c5eeb1aebb102b7c62fab11974c359a", "parameters": [ { "$ref": "#/components/parameters/ApiOffsetNoDefault" @@ -3647,6 +3713,7 @@ ], "summary": "Get specific thread details", "description": "Requires public access key.
Contains details of a thread including topic content and poll (if any).", + "operationId": "a4618a3901c01413c14b75e984495a9b", "parameters": [ { "name": "threadId", @@ -3694,6 +3761,7 @@ ], "summary": "Get threads across all forum categories", "description": "Requires public access key.
", + "operationId": "d2d64a69cedfdce19a50eff117e2c166", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100" @@ -3744,6 +3812,7 @@ ], "summary": "Get threads for specific public forum category or categories", "description": "Requires public access key.
", + "operationId": "715cb3a4df0a9bf8094a53dc3259b633", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100" @@ -3762,10 +3831,13 @@ "in": "path", "description": "Category id or a list of category ids (comma separated)", "required": true, - "style": "simple", + "style": "form", "explode": false, "schema": { - "type": "string" + "type": "array", + "items": { + "$ref": "#/components/schemas/ForumId" + } } }, { @@ -3805,6 +3877,7 @@ ], "summary": "Get all available forum selections", "description": "Requires public access key.
", + "operationId": "f0805d0b7ad26c62ddd2fa8d0d332ba4", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -3843,6 +3916,7 @@ ], "summary": "Get current server time", "description": "Requires public access key.
", + "operationId": "ec72c2a8cd96c88e4d228221bf6bf42f", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -3881,6 +3955,7 @@ ], "summary": "Get any Forum selection", "description": "Requires public access key.
Choose one or more selections (comma separated).", + "operationId": "21915cf0228ce3677261cdce27fb39e2", "parameters": [ { "name": "selections", @@ -3988,6 +4063,7 @@ ], "summary": "Get current key log history", "description": "Available for any key.
\n * This selection contains up to last 250 request logs.", + "operationId": "0d6dae59c9b3419c18d2a4ca0da757e6", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100" @@ -4032,6 +4108,7 @@ ], "summary": "Get current key info", "description": "Available for any key.
", + "operationId": "e6d387f16971004628eeca2d6473f825", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -4069,6 +4146,7 @@ "Key" ], "summary": "Get any Key selection", + "operationId": "c6ccbb0a05ebf3b307c82a4c89275e52", "parameters": [ { "name": "selections", @@ -4134,6 +4212,7 @@ ], "summary": "Get item market listings", "description": "Requires public access key.
", + "operationId": "f535a33bf405e7bd60918e536f827e5c", "parameters": [ { "name": "id", @@ -4193,6 +4272,7 @@ ], "summary": "Get all available market selections", "description": "Requires public access key.
", + "operationId": "22a00095ad734485b6dacdc12c1f62ff", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -4231,6 +4311,7 @@ ], "summary": "Get current server time", "description": "Requires public access key.
", + "operationId": "ad0c908328835d9672d157fe84eac884", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -4269,6 +4350,7 @@ ], "summary": "Get any Market selection", "description": "Requires public access key.
Choose one or more selections (comma separated).", + "operationId": "8e78be3fa3d353f59f8654fcc1c2199c", "parameters": [ { "name": "selections", @@ -4374,6 +4456,7 @@ ], "summary": "Get cars and their racing stats", "description": "Requires public access key.
Returns the stat details about racing cars.", + "operationId": "ab5b44b00bf70d7a8587a3c2c9deeb17", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -4412,6 +4495,7 @@ ], "summary": "Get all possible car upgrades", "description": "Requires public access key.
Returns the details about all possible car upgrades.", + "operationId": "c9e76cf48aa3c4bac4c8b33f1c0c9a17", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -4450,6 +4534,7 @@ ], "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" @@ -4514,6 +4599,7 @@ ], "summary": "Get specific race details", "description": "Requires public access key.
Returns the details of a race.", + "operationId": "76925256951bb63fd28534c8c479b27b", "parameters": [ { "name": "raceId", @@ -4561,6 +4647,7 @@ ], "summary": "Get track records", "description": "Requires public access key.
Returns a list of 10 best lap records for the chosen track and car class. Results are cached globally 1 hour.", + "operationId": "5fbc62db3b9380b155d7e33100620da7", "parameters": [ { "name": "trackId", @@ -4617,6 +4704,7 @@ ], "summary": "Get race tracks and descriptions", "description": "Requires public access key.
Returns the details about racing tracks.", + "operationId": "6e4507cc442d6f099d0170b78a35bf8d", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -4655,6 +4743,7 @@ ], "summary": "Get all available racing selections", "description": "Requires public access key.
", + "operationId": "8bd16be9aa517fedf717c9a79ff47e2c", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -4693,6 +4782,7 @@ ], "summary": "Get current server time", "description": "Requires public access key.
", + "operationId": "eb1ae216aa2949a8db0702df474d174c", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -4731,6 +4821,7 @@ ], "summary": "Get any Racing selection", "description": "Requires public access key.
Choose one or more selections (comma separated).", + "operationId": "39b8ce36e3fffc9e2aa1d0aed9ebccda", "parameters": [ { "name": "selections", @@ -4841,6 +4932,7 @@ ], "summary": "Get attack log details", "description": "Requires public key.
", + "operationId": "61c2d0bc6980cf8d730fe48eb81f417b", "parameters": [ { "name": "log", @@ -4897,6 +4989,7 @@ ], "summary": "Get bounties", "description": "Requires public key.
", + "operationId": "279e811630fa497fb2cae268c70992e2", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100" @@ -4941,6 +5034,7 @@ ], "summary": "Get calendar information", "description": "Requires public access key.
Get the details about competitions & events in the running year.", + "operationId": "e95c96ef528248341647a5704630320e", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -4979,6 +5073,7 @@ ], "summary": "Get crimes information", "description": "Requires public access key.
Return the details about released crimes.", + "operationId": "b73ff4e5a9dd28905060da24ca76efde", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -5017,6 +5112,7 @@ ], "summary": "Get education information", "description": "Requires public access key.
", + "operationId": "992f8b71435ca78ba96f1e5298c25152", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -5055,6 +5151,7 @@ ], "summary": "Get faction hall of fame positions for a specific category", "description": "Requires public access key.
", + "operationId": "2a67e4b84813ee97a398be48e544abf5", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100" @@ -5108,6 +5205,7 @@ ], "summary": "Get full faction tree", "description": "Requires public access key.
", + "operationId": "f45431b364546bb20b0ca909e9ac686e", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -5146,6 +5244,7 @@ ], "summary": "Get player hall of fame positions for a specific category", "description": "Requires public key.", + "operationId": "911d56b49218cef2102be3de73f82f01", "parameters": [ { "$ref": "#/components/parameters/ApiLimit100" @@ -5199,6 +5298,7 @@ ], "summary": "Get information about ammo", "description": "Requires public key.", + "operationId": "2e799e84fcfa9b722f856e859df909f8", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -5237,6 +5337,7 @@ ], "summary": "Get information about weapon upgrades", "description": "Requires public key.", + "operationId": "80ad6ebd50b6c075427c04d2f54d7af5", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -5275,6 +5376,7 @@ ], "summary": "Get information about items", "description": "Requires public key.
Default category is 'All'.
Details are not populated when requesting the category 'All'.", + "operationId": "0f4c4c07e1dfacbda689b2a0d62ccda4", "parameters": [ { "name": "cat", @@ -5325,16 +5427,20 @@ ], "summary": "Get information about items", "description": "Requires public key.
Details are always populated when available.", + "operationId": "a4fedadcac3aada40131288e4e3d6c2d", "parameters": [ { "name": "ids", "in": "path", "description": "Item id or a list of item ids (comma separated)", "required": true, - "style": "simple", + "style": "form", "explode": false, "schema": { - "type": "string" + "type": "array", + "items": { + "$ref": "#/components/schemas/ItemId" + } } }, { @@ -5377,6 +5483,7 @@ ], "summary": "Get available log categories", "description": "Requires public key.
", + "operationId": "2f68d7e04d218e26005be3eeca6de583", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -5415,6 +5522,7 @@ ], "summary": "Get all available log ids", "description": "Requires public key.
", + "operationId": "d4cb87bc2502a517c49525b910a6dd82", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -5453,6 +5561,7 @@ ], "summary": "Get available log ids for a specific log category", "description": "Requires public key.
", + "operationId": "7be904fbcb98a7bb724f0c5b02a37a25", "parameters": [ { "name": "logCategoryId", @@ -5500,6 +5609,7 @@ ], "summary": "Get Subcrimes information", "description": "Requires public access key.
Return the details about possible actions for a specific crime.", + "operationId": "ad45b0f57a1109977f605581fc294bda", "parameters": [ { "name": "crimeId", @@ -5547,6 +5657,7 @@ ], "summary": "Get territory details", "description": "Requires public access key.
", + "operationId": "37f1828422f3080da21f9eb4aa576686", "parameters": [ { "$ref": "#/components/parameters/ApiOffset" @@ -5591,16 +5702,20 @@ ], "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, - "style": "simple", + "style": "form", "explode": false, "schema": { - "$ref": "#/components/schemas/FactionTerritoryEnum" + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryEnum" + } } }, { @@ -5640,6 +5755,7 @@ ], "summary": "Get all available torn selections", "description": "Requires public key.
", + "operationId": "2baae03f953cd57fd5303dd1d04efae0", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -5678,6 +5794,7 @@ ], "summary": "Get current server time", "description": "Requires public key.
", + "operationId": "6f8cffcdae9fe97110b8d46c3991f109", "parameters": [ { "$ref": "#/components/parameters/ApiTimestamp" @@ -5716,6 +5833,7 @@ ], "summary": "Get any Torn selection", "description": "Requires public access key.
Choose one or more selections (comma separated).", + "operationId": "1846c4cf1e6878553e36571dc9cac29f", "parameters": [ { "name": "selections", @@ -11332,1979 +11450,38 @@ }, "type": "object" }, - "FactionTerritoryWarFinishedFaction": { + "UserCurrentEducation": { "required": [ "id", - "name", - "score", - "is_aggressor" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionId" - }, - "name": { - "type": "string" - }, - "score": { - "type": "integer", - "format": "int32" - }, - "is_aggressor": { - "type": "boolean" - } - }, - "type": "object" - }, - "FactionTerritoryWarFinished": { - "required": [ - "id", - "territory", - "start", - "end", - "target", - "result", - "factions" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/TerritoryWarId" - }, - "territory": { - "$ref": "#/components/schemas/FactionTerritoryEnum" - }, - "start": { - "type": "integer", - "format": "int64" - }, - "end": { - "type": "integer", - "format": "int64" - }, - "target": { - "type": "integer", - "format": "int32" - }, - "result": { - "$ref": "#/components/schemas/FactionTerritoryWarResultEnum" - }, - "factions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryWarFinishedFaction" - } - } - }, - "type": "object" - }, - "FactionTerritoryWarOngoingFaction": { - "required": [ - "id", - "name", - "score", - "is_aggressor", - "chain", - "playerIds" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionId" - }, - "name": { - "type": "string" - }, - "score": { - "type": "integer", - "format": "int32" - }, - "is_aggressor": { - "type": "boolean" - }, - "chain": { - "type": "integer", - "format": "int32" - }, - "playerIds": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserId" - } - } - }, - "type": "object" - }, - "FactionTerritoryWarOngoing": { - "required": [ - "id", - "territory", - "start", - "end", - "target", - "factions" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/TerritoryWarId" - }, - "territory": { - "$ref": "#/components/schemas/FactionTerritoryEnum" - }, - "start": { - "type": "integer", - "format": "int32" - }, - "end": { - "type": "integer", - "format": "int32" - }, - "target": { - "type": "integer", - "format": "int32" - }, - "factions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryWarOngoingFaction" - } - } - }, - "type": "object" - }, - "FactionTerritoryWarsResponse": { - "required": [ - "territorywars" - ], - "properties": { - "territorywars": { - "description": "If the chosen category is 'ongoing' the response will be of 'FactionTerritoryWarOngoing' type, otherwise, the type will be 'FactionTerritoryWarFinished'.", - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryWarOngoing" - } - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryWarFinished" - } - } - ] - } - }, - "type": "object" - }, - "FactionTerritoryWarsHistoryResponse": { - "required": [ - "territorywars" - ], - "properties": { - "territorywars": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryWarFinished" - } - } - }, - "type": "object" - }, - "FactionTerritoryWarReportMembers": { - "required": [ - "id", - "username", - "level", - "score", - "joins", - "clears" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "username": { - "type": "string" - }, - "level": { - "type": "integer", - "format": "int32" - }, - "score": { - "type": "integer", - "format": "int32" - }, - "joins": { - "type": "integer", - "format": "int32" - }, - "clears": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionTerritoryWarReportFaction": { - "required": [ - "id", - "name", - "score", - "joins", - "clears", - "is_aggressor", - "members" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionId" - }, - "name": { - "type": "string" - }, - "score": { - "type": "integer", - "format": "int32" - }, - "joins": { - "type": "integer", - "format": "int32" - }, - "clears": { - "type": "integer", - "format": "int32" - }, - "is_aggressor": { - "type": "boolean" - }, - "members": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryWarReportMembers" - } - } - }, - "type": "object" - }, - "FactionTerritoryWarReport": { - "required": [ - "id", - "territory", - "started_at", - "ended_at", - "winner", - "result", - "factions" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/TerritoryWarId" - }, - "territory": { - "$ref": "#/components/schemas/FactionTerritoryEnum" - }, - "started_at": { - "type": "integer", - "format": "int32" - }, - "ended_at": { - "type": "integer", - "format": "int32" - }, - "winner": { - "$ref": "#/components/schemas/FactionId" - }, - "result": { - "type": "string" - }, - "factions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryWarReportFaction" - } - } - }, - "type": "object" - }, - "FactionTerritoryWarReportResponse": { - "required": [ - "territorywarreport" - ], - "properties": { - "territorywarreport": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryWarReport" - } - } - }, - "type": "object" - }, - "FactionTerritoryOwnership": { - "required": [ - "id", - "owned_by", - "acquired_at" - ], - "properties": { - "id": { - "type": "string" - }, - "owned_by": { - "oneOf": [ - { - "$ref": "#/components/schemas/FactionId" - }, - { - "type": "null" - } - ] - }, - "acquired_at": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "FactionTerritoriesOwnershipResponse": { - "required": [ - "territoryownership" - ], - "properties": { - "territoryownership": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryOwnership" - } - } - }, - "type": "object" - }, - "TornRacketReward": { - "required": [ - "type", - "quantity", - "id" - ], - "properties": { - "type": { - "$ref": "#/components/schemas/TornRacketType" - }, - "quantity": { - "type": "integer", - "format": "int32" - }, - "id": { - "oneOf": [ - { - "$ref": "#/components/schemas/ItemId" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "TornRacket": { - "required": [ - "name", - "level", - "description", - "reward", - "created_at", - "changed_at" - ], - "properties": { - "name": { - "type": "string" - }, - "level": { - "type": "integer", - "format": "int32" - }, - "description": { - "type": "string" - }, - "reward": { - "$ref": "#/components/schemas/TornRacketReward" - }, - "created_at": { - "type": "integer", - "format": "int32" - }, - "changed_at": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionRacketsReponse": { - "required": [ - "rackets" - ], - "properties": { - "rackets": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornRacket" - } - } - }, - "type": "object" - }, - "FactionTerritory": { - "required": [ - "id", - "acquired_at", - "sector", - "size", - "density", - "slots", - "respect", - "coordinates", - "racket" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionTerritoryEnum" - }, - "acquired_at": { - "type": "integer", - "format": "int32" - }, - "sector": { - "type": "integer", - "format": "int32" - }, - "size": { - "type": "integer", - "format": "int32" - }, - "density": { - "type": "integer", - "format": "int32" - }, - "slots": { - "type": "integer", - "format": "int32" - }, - "respect": { - "type": "integer", - "format": "int32" - }, - "coordinates": { - "$ref": "#/components/schemas/TornTerritoryCoordinates" - }, - "racket": { - "oneOf": [ - { - "$ref": "#/components/schemas/TornRacket" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "FactionTerritoriesReponse": { - "required": [ - "territory" - ], - "properties": { - "territory": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritory" - } - } - }, - "type": "object" - }, - "FactionPosition": { - "required": [ - "name", - "is_default", - "abilities" - ], - "properties": { - "name": { - "type": "string" - }, - "is_default": { - "type": "boolean" - }, - "abilities": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionPositionAbilityEnum" - } - } - }, - "type": "object" - }, - "FactionPositionsResponse": { - "required": [ - "positions" - ], - "properties": { - "positions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionPosition" - } - } - }, - "type": "object" - }, - "FactionUpgradeDetails": { - "required": [ - "id", - "name", - "ability", - "level", - "cost", - "unlockedAt" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionBranchId" - }, - "name": { - "type": "string" - }, - "ability": { - "type": "string" - }, - "level": { - "type": "integer", - "format": "int32" - }, - "cost": { - "type": "integer", - "format": "int32" - }, - "unlocked_at": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionBranchDetails": { - "required": [ - "name", - "order", - "multiplier", - "upgrades" - ], - "properties": { - "name": { - "type": "string" - }, - "order": { - "type": "integer", - "format": "int32" - }, - "multiplier": { - "description": "Respect cost multiplier.", - "type": "integer", - "format": "int32" - }, - "upgrades": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionUpgradeDetails" - } - } - }, - "type": "object" - }, - "FactionUpgrades": { - "required": [ - "core", - "peace", - "war" - ], - "properties": { - "core": { - "properties": { - "upgrades": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionUpgradeDetails" - } - } - }, - "type": "object" - }, - "peace": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionBranchDetails" - } - }, - "war": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionBranchDetails" - } - } - }, - "type": "object" - }, - "FactionUpgradesResponse": { - "required": [ - "upgrades", - "state" - ], - "properties": { - "upgrades": { - "$ref": "#/components/schemas/FactionUpgrades" - }, - "state": { - "$ref": "#/components/schemas/FactionBranchStateEnum" - } - }, - "type": "object" - }, - "FactionStat": { - "required": [ - "name", - "value" - ], - "properties": { - "name": { - "$ref": "#/components/schemas/FactionStatEnum" - }, - "value": { - "type": "integer", - "format": "int64" - } - }, - "type": "object" - }, - "FactionStatsResponse": { - "required": [ - "stats" - ], - "properties": { - "stats": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionStat" - } - } - }, - "type": "object" - }, - "FactionContributor": { - "required": [ - "id", - "username", - "value", - "in_faction" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "username": { - "type": "string" - }, - "value": { - "type": "integer", - "format": "int64" - }, - "in_faction": { - "type": "boolean" - } - }, - "type": "object" - }, - "FactionContributorsResponse": { - "required": [ - "contributors" - ], - "properties": { - "contributors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionContributor" - } - } - }, - "type": "object" - }, - "FactionHofStats": { - "required": [ - "rank", - "respect", - "chain" - ], - "properties": { - "rank": { - "$ref": "#/components/schemas/HofValueString" - }, - "respect": { - "$ref": "#/components/schemas/HofValue" - }, - "chain": { - "$ref": "#/components/schemas/HofValue" - } - }, - "type": "object" - }, - "FactionHofResponse": { - "required": [ - "hof" - ], - "properties": { - "hof": { - "$ref": "#/components/schemas/FactionHofStats" - } - }, - "type": "object" - }, - "FactionMember": { - "description": "Details about a faction member.", - "required": [ - "id", - "name", - "position", - "level", - "days_in_faction", - "is_revivable", - "is_on_wall", - "is_in_oc", - "has_early_discharge", - "last_action", - "status", - "revive_setting" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "name": { - "type": "string" - }, - "position": { - "type": "string" - }, - "level": { - "type": "integer", - "format": "int32" - }, - "days_in_faction": { - "type": "integer", - "format": "int32" - }, - "is_revivable": { - "type": "boolean" - }, - "is_on_wall": { - "description": "Shows if the member is currently defending territory wall.", - "type": "boolean" - }, - "is_in_oc": { - "description": "Shows if the member is currently participating in an organized crime. Show false for members of other factions.", - "type": "boolean" - }, - "has_early_discharge": { - "description": "Shows if the member is eligible for an early discharge from the hospital.", - "type": "boolean" - }, - "last_action": { - "$ref": "#/components/schemas/UserLastAction" - }, - "status": { - "$ref": "#/components/schemas/UserStatus" - }, - "revive_setting": { - "$ref": "#/components/schemas/ReviveSetting" - } - }, - "type": "object" - }, - "UserLastAction": { - "description": "Details about a user's last action.", - "required": [ - "status", - "timestamp", - "relative" - ], - "properties": { - "status": { - "type": "string" - }, - "timestamp": { - "type": "integer", - "format": "int32" - }, - "relative": { - "type": "string" - } - }, - "type": "object" - }, - "UserStatus": { - "description": "Details about a user's status.", - "required": [ - "description", - "details", - "state", "until" ], "properties": { - "description": { - "type": "string" - }, - "details": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "state": { - "type": "string" + "id": { + "$ref": "#/components/schemas/EducationId" }, "until": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] + "type": "integer", + "format": "int32" } }, "type": "object" }, - "FactionMembersResponse": { + "UserEducation": { "required": [ - "members" + "complete", + "current" ], "properties": { - "members": { + "complete": { "type": "array", "items": { - "$ref": "#/components/schemas/FactionMember" + "$ref": "#/components/schemas/EducationId" } - } - }, - "type": "object" - }, - "FactionRank": { - "required": [ - "level", - "name", - "division", - "position", - "wins" - ], - "properties": { - "level": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - }, - "division": { - "type": "integer", - "format": "int32" - }, - "position": { - "type": "integer", - "format": "int32" - }, - "wins": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionBasic": { - "required": [ - "id", - "name", - "tag", - "tag_image", - "leader_id", - "co_leader_id", - "respect", - "days_old", - "capacity", - "members", - "is_enlisted", - "rank", - "best_chain" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionId" - }, - "name": { - "type": "string" - }, - "tag": { - "type": "string" - }, - "tag_image": { - "type": "string" - }, - "leader_id": { - "$ref": "#/components/schemas/UserId" - }, - "co-leader_id": { - "$ref": "#/components/schemas/UserId" - }, - "co_leader_id": { - "$ref": "#/components/schemas/UserId" - }, - "respect": { - "type": "integer", - "format": "int32" - }, - "days_old": { - "type": "integer", - "format": "int32" - }, - "capacity": { - "type": "integer", - "format": "int32" - }, - "members": { - "type": "integer", - "format": "int32" - }, - "is_enlisted": { - "description": "Indicates if the faction is enlisted for ranked wars. Available only with faction AA permissions for your own faction.", - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ] - }, - "rank": { - "$ref": "#/components/schemas/FactionRank" - }, - "best_chain": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionBasicResponse": { - "required": [ - "basic" - ], - "properties": { - "basic": { - "$ref": "#/components/schemas/FactionBasic" - } - }, - "type": "object" - }, - "FactionPact": { - "required": [ - "faction_id", - "faction_name", - "until" - ], - "properties": { - "faction_id": { - "$ref": "#/components/schemas/FactionId" - }, - "faction_name": { - "type": "string" - }, - "until": { - "description": "The duration until when is the non-aggression pact valid.", - "type": "string" - } - }, - "type": "object" - }, - "FactionRankedWarParticipant": { - "required": [ - "id", - "name", - "score", - "chain" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionId" - }, - "name": { - "type": "string" - }, - "score": { - "type": "integer", - "format": "int32" - }, - "chain": { - "description": "Faction's current chain.", - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionRankedWar": { - "required": [ - "war_id", - "start", - "end", - "target", - "winner", - "factions" - ], - "properties": { - "war_id": { - "type": "integer", - "format": "int32" - }, - "start": { - "type": "integer", - "format": "int32" - }, - "end": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "target": { - "description": "The score target of the war.", - "type": "integer", - "format": "int32" - }, - "winner": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "factions": { - "description": "The factions involved in the ranked war.", - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionRankedWarParticipant" - } - } - }, - "type": "object" - }, - "FactionRaidWarParticipant": { - "required": [ - "id", - "name", - "score", - "chain", - "is_aggressor" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionId" - }, - "name": { - "type": "string" - }, - "score": { - "type": "integer", - "format": "int32" - }, - "chain": { - "description": "Faction's current chain.", - "type": "integer", - "format": "int32" - }, - "is_aggressor": { - "type": "boolean" - } - }, - "type": "object" - }, - "FactionRaidWar": { - "required": [ - "war_id", - "start", - "end", - "factions" - ], - "properties": { - "war_id": { - "type": "integer", - "format": "int32" - }, - "start": { - "type": "integer", - "format": "int32" - }, - "end": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "factions": { - "description": "The factions involved in the raid war.", - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionRaidWarParticipant" - } - } - }, - "type": "object" - }, - "FactionTerritoryWarParticipant": { - "required": [ - "id", - "name", - "score", - "chain", - "is_aggressor", - "playerIds" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionId" - }, - "name": { - "type": "string" - }, - "score": { - "type": "integer", - "format": "int32" - }, - "chain": { - "description": "Faction's current chain.", - "type": "integer", - "format": "int32" - }, - "is_aggressor": { - "type": "boolean" - }, - "playerIds": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserId" - } - } - }, - "type": "object" - }, - "FactionTerritoryWar": { - "required": [ - "war_id", - "territory", - "start", - "end", - "target", - "factions" - ], - "properties": { - "war_id": { - "type": "integer", - "format": "int32" - }, - "territory": { - "type": "string" - }, - "start": { - "type": "integer", - "format": "int32" - }, - "end": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "target": { - "description": "The score target of the war.", - "type": "integer", - "format": "int32" - }, - "winner": { - "oneOf": [ - { - "$ref": "#/components/schemas/FactionId" - }, - { - "type": "null" - } - ] - }, - "factions": { - "description": "The factions involved in the territory war.", - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryWarParticipant" - } - } - }, - "type": "object" - }, - "FactionWars": { - "required": [ - "ranked", - "raids", - "territory" - ], - "properties": { - "ranked": { - "oneOf": [ - { - "$ref": "#/components/schemas/FactionRankedWar" - }, - { - "type": "null" - } - ] - }, - "raids": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionRaidWar" - } - }, - "territory": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryWar" - } - } - }, - "type": "object" - }, - "FactionWarsResponse": { - "required": [ - "pacts", - "wars" - ], - "properties": { - "pacts": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionPact" - } - }, - "wars": { - "$ref": "#/components/schemas/FactionWars" - } - }, - "type": "object" - }, - "FactionNews": { - "required": [ - "id", - "text", - "timestamp" - ], - "properties": { - "id": { - "type": "string" - }, - "text": { - "type": "string" - }, - "timestamp": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionNewsResponse": { - "required": [ - "news", - "_metadata" - ], - "properties": { - "news": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionNews" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "FactionAttacksResponse": { - "required": [ - "attacks", - "_metadata" - ], - "properties": { - "attacks": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Attack" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "FactionAttacksFullResponse": { - "required": [ - "attacks", - "_metadata" - ], - "properties": { - "attacks": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AttackSimplified" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "FactionApplication": { - "required": [ - "id", - "user", - "message", - "valid_until", - "status" - ], - "properties": { - "id": { - "description": "application id", - "type": "integer", - "format": "int32" - }, - "user": { - "required": [ - "id", - "name", - "level", - "stats" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "name": { - "type": "string" - }, - "level": { - "type": "integer", - "format": "int32" - }, - "stats": { - "required": [ - "strength", - "speed", - "dexterity", - "defense" - ], - "properties": { - "strength": { - "type": "integer", - "format": "int64" - }, - "speed": { - "type": "integer", - "format": "int64" - }, - "dexterity": { - "type": "integer", - "format": "int64" - }, - "defense": { - "type": "integer", - "format": "int64" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "message": { - "type": "string" - }, - "valid_until": { - "type": "integer", - "format": "int32" - }, - "status": { - "$ref": "#/components/schemas/FactionApplicationStatusEnum" - } - }, - "type": "object" - }, - "FactionApplicationsResponse": { - "required": [ - "applications" - ], - "properties": { - "applications": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionApplication" - } - } - }, - "type": "object" - }, - "FactionOngoingChain": { - "required": [ - "id", - "current", - "max", - "timeout", - "modifier", - "cooldown", - "start", - "end" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ChainId" }, "current": { - "type": "integer", - "format": "int32" - }, - "max": { - "type": "integer", - "format": "int32" - }, - "timeout": { - "description": "Seconds until chain breaks.", - "type": "integer", - "format": "int32" - }, - "modifier": { - "type": "number", - "format": "float" - }, - "cooldown": { - "description": "Timestamp until when chain is on cooldown.", - "type": "integer", - "format": "int32" - }, - "start": { - "type": "integer", - "format": "int32" - }, - "end": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionOngoingChainResponse": { - "required": [ - "chain" - ], - "properties": { - "chain": { - "$ref": "#/components/schemas/FactionOngoingChain" - } - }, - "type": "object" - }, - "FactionChain": { - "required": [ - "id", - "chain", - "respect", - "start", - "end" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ChainId" - }, - "chain": { - "type": "integer", - "format": "int32" - }, - "respect": { - "type": "number", - "format": "float" - }, - "start": { - "type": "integer", - "format": "int32" - }, - "end": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionChainsResponse": { - "required": [ - "chains", - "_metadata" - ], - "properties": { - "chains": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionChain" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "FactionChainReportResponse": { - "required": [ - "chainreport" - ], - "properties": { - "chainreport": { - "$ref": "#/components/schemas/FactionChainReport" - } - }, - "type": "object" - }, - "FactionChainReport": { - "required": [ - "id", - "faction_id", - "start", - "end", - "details", - "bonuses", - "attackers", - "non_attackers" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ChainId" - }, - "faction_id": { - "$ref": "#/components/schemas/FactionId" - }, - "start": { - "type": "integer", - "format": "int32" - }, - "end": { - "type": "integer", - "format": "int32" - }, - "details": { - "$ref": "#/components/schemas/FactionChainReportDetails" - }, - "bonuses": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionChainReportBonus" - } - }, - "attackers": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionChainReportAttacker" - } - }, - "non-attackers": { - "description": "This is replaced with 'non_attackers' field and will be removed on 1st June 2025.", - "type": "array", - "items": { - "$ref": "#/components/schemas/UserId" - }, - "deprecated": true - }, - "non_attackers": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserId" - } - } - }, - "type": "object" - }, - "FactionChainReportDetails": { - "required": [ - "chain", - "respect", - "members", - "targets", - "war", - "best", - "leave", - "mug", - "hospitalize", - "assists", - "retaliations", - "overseas", - "draws", - "escapes", - "losses" - ], - "properties": { - "chain": { - "type": "integer", - "format": "int32" - }, - "respect": { - "type": "number", - "format": "float" - }, - "members": { - "type": "integer", - "format": "int32" - }, - "targets": { - "type": "integer", - "format": "int32" - }, - "war": { - "type": "integer", - "format": "int32" - }, - "best": { - "type": "number", - "format": "float" - }, - "leave": { - "type": "integer", - "format": "int32" - }, - "mug": { - "type": "integer", - "format": "int32" - }, - "hospitalize": { - "type": "integer", - "format": "int32" - }, - "assists": { - "type": "integer", - "format": "int32" - }, - "retaliations": { - "type": "integer", - "format": "int32" - }, - "overseas": { - "type": "integer", - "format": "int32" - }, - "draws": { - "type": "integer", - "format": "int32" - }, - "escapes": { - "type": "integer", - "format": "int32" - }, - "losses": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionChainReportBonus": { - "required": [ - "attacker_id", - "defender_id", - "chain", - "respect" - ], - "properties": { - "attacker_id": { - "$ref": "#/components/schemas/UserId" - }, - "defender_id": { - "$ref": "#/components/schemas/UserId" - }, - "chain": { - "type": "integer", - "format": "int32" - }, - "respect": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionChainReportAttacker": { - "required": [ - "id", - "respect", - "attacks" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "respect": { - "$ref": "#/components/schemas/FactionChainReportAttackerRespect" - }, - "attacks": { - "$ref": "#/components/schemas/FactionChainReportAttackerAttacks" - } - }, - "type": "object" - }, - "FactionChainReportAttackerRespect": { - "required": [ - "total", - "average", - "best" - ], - "properties": { - "total": { - "type": "number", - "format": "float" - }, - "average": { - "type": "number", - "format": "float" - }, - "best": { - "type": "number", - "format": "float" - } - }, - "type": "object" - }, - "FactionChainReportAttackerAttacks": { - "required": [ - "total", - "leave", - "mug", - "hospitalize", - "assists", - "retaliations", - "overseas", - "draws", - "escpaces", - "losses", - "war", - "bonuses" - ], - "properties": { - "total": { - "type": "integer", - "format": "int32" - }, - "leave": { - "type": "integer", - "format": "int32" - }, - "mug": { - "type": "integer", - "format": "int32" - }, - "hospitalize": { - "type": "integer", - "format": "int32" - }, - "assists": { - "type": "integer", - "format": "int32" - }, - "retaliations": { - "type": "integer", - "format": "int32" - }, - "overseas": { - "type": "integer", - "format": "int32" - }, - "draws": { - "type": "integer", - "format": "int32" - }, - "escapes": { - "type": "integer", - "format": "int32" - }, - "losses": { - "type": "integer", - "format": "int32" - }, - "war": { - "type": "integer", - "format": "int32" - }, - "bonuses": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionCrimeUser": { - "required": [ - "id", - "outcome", - "joined_at", - "progress" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "outcome": { - "description": "This field will be null for old crimes.", "oneOf": [ { - "$ref": "#/components/schemas/FactionCrimeUserOutcome" - }, - { - "type": "null" - } - ] - }, - "joined_at": { - "description": "The timestamp at which the user joined the slot.", - "type": "integer", - "format": "int32" - }, - "progress": { - "description": "Current planning progress on the slot.", - "type": "number", - "format": "float" - } - }, - "type": "object" - }, - "FactionCrimeRewardItem": { - "required": [ - "id", - "quantity" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ItemId" - }, - "quantity": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionCrimeRewardPayout": { - "required": [ - "type", - "percentage", - "paid_by", - "paid_at" - ], - "properties": { - "type": { - "$ref": "#/components/schemas/FactionOrganizedCrimePayoutType" - }, - "percentage": { - "description": "Total percentage split between all participants.", - "type": "integer", - "format": "int32" - }, - "paid_by": { - "$ref": "#/components/schemas/UserId" - }, - "paid_at": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "FactionCrimeReward": { - "required": [ - "money", - "items", - "respect", - "payout", - "scope" - ], - "properties": { - "money": { - "type": "integer", - "format": "int32" - }, - "items": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionCrimeRewardItem" - } - }, - "respect": { - "type": "integer", - "format": "int32" - }, - "scope": { - "type": "integer", - "format": "int32" - }, - "payout": { - "description": "Details about the crime payouts. This field is null if the crime has not been paid via the automatic payouts system.", - "oneOf": [ - { - "$ref": "#/components/schemas/FactionCrimeRewardPayout" + "$ref": "#/components/schemas/UserCurrentEducation" }, { "type": "null" @@ -13314,572 +11491,213 @@ }, "type": "object" }, - "FactionCrimeSlot": { + "UserEducationResponse": { "required": [ - "position", - "item_requirement", - "user", - "checkpoint_pass_rate" + "education" ], "properties": { - "position": { - "type": "string" - }, - "item_requirement": { - "description": "Details of item required for the slot, if applicable.", - "oneOf": [ - { - "required": [ - "id", - "is_reusable", - "is_available" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ItemId" - }, - "is_reusable": { - "description": "Shows if the item is reusable or consumed during the crime.", - "type": "boolean" - }, - "is_available": { - "description": "Shows if user has the required item.", - "type": "boolean" - } - }, - "type": "object" - }, - { - "type": "null" - } - ] - }, - "user": { - "description": "Details about the user joined the slot, if any.", - "oneOf": [ - { - "$ref": "#/components/schemas/FactionCrimeUser" - }, - { - "type": "null" - } - ] - }, - "checkpoint_pass_rate": { - "description": "Returns CPR for the player who joined the slot. If the slot is empty (availalbe), it shows your CPR for that slot. This value is 0 for expired crimes.", - "type": "integer", - "format": "int32" + "education": { + "$ref": "#/components/schemas/UserEducation" } }, "type": "object" }, - "FactionCrime": { + "UserCrimeDetailsBootlegging": { "required": [ - "id", - "name", - "previous_crime_id", - "difficulty", - "status", - "created_at", - "planning_at", - "ready_at", - "expired_at", - "executed_at", - "slots", - "rewards" + "online_store", + "dvd_sales", + "dvd_copies" ], "properties": { - "id": { - "$ref": "#/components/schemas/FactionCrimeId" - }, - "previous_crime_id": { - "oneOf": [ - { - "$ref": "#/components/schemas/FactionCrimeId" - }, - { - "type": "null" - } - ] - }, - "name": { - "type": "string" - }, - "difficulty": { - "type": "integer", - "format": "int32" - }, - "status": { - "$ref": "#/components/schemas/FactionCrimeStatusEnum" - }, - "created_at": { - "description": "The timestamp at which the crime was created.", - "type": "integer", - "format": "int32" - }, - "planning_at": { - "description": "The timestamp at which the planning phase for the crime has begun.", - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "ready_at": { - "description": "The timestamp at which the crime will be ready.", - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "expired_at": { - "description": "The timestamp at which the crime will expire.", - "type": "integer", - "format": "int32" - }, - "executed_at": { - "description": "The timestamp at which the crime was executed.
Note: this value is null for all crimes executed before January 15th, 2025.", - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "slots": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionCrimeSlot" - } - }, - "rewards": { - "description": "Details about the crime rewards. Available only for crimes with 'Successful' status.", - "oneOf": [ - { - "$ref": "#/components/schemas/FactionCrimeReward" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "FactionCrimesResponse": { - "required": [ - "crimes", - "_metadata" - ], - "properties": { - "crimes": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionCrime" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "FactionCrimeResponse": { - "required": [ - "crime" - ], - "properties": { - "crime": { - "$ref": "#/components/schemas/FactionCrime" - } - }, - "type": "object" - }, - "FactionBalance": { - "required": [ - "faction", - "members" - ], - "properties": { - "faction": { + "online_store": { + "description": "Online store statistics.", "required": [ - "money", - "points", - "scope" + "earnings", + "visits", + "customers", + "sales" ], "properties": { - "money": { + "earnings": { "type": "integer", - "format": "int64" + "format": "int32" }, - "points": { + "visits": { "type": "integer", - "format": "int64" + "format": "int32" }, - "scope": { + "customers": { + "type": "integer", + "format": "int32" + }, + "sales": { "type": "integer", "format": "int32" } }, "type": "object" }, - "members": { - "type": "array", - "items": { - "required": [ - "id", - "username", - "money", - "points" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "username": { - "type": "string" - }, - "money": { - "type": "integer", - "format": "int64" - }, - "points": { - "type": "integer", - "format": "int64" - } - }, - "type": "object" - } - } - }, - "type": "object" - }, - "FactionBalanceResponse": { - "required": [ - "balance" - ], - "properties": { - "balance": { - "$ref": "#/components/schemas/FactionBalance" - } - }, - "type": "object" - }, - "FactionSelectionName": { - "description": "The following selections will fallback to API v1 and may change at any time: 'armor', 'boosters', 'caches', 'cesium', 'crimeexp', 'drugs', 'medical', 'positions', 'reports', 'temporary', 'weapons'.\n * The following selections are not available in API v2: 'armorynews', 'attacknews', 'crimenews', 'currency', 'donations', 'fundsnews', 'mainnews', 'membershipnews', 'territorynews'.", - "type": "string", - "enum": [ - "applications", - "attacks", - "attacksfull", - "balance", - "basic", - "chain", - "chainreport", - "chains", - "contributors", - "crime", - "crimes", - "hof", - "lookup", - "members", - "news", - "rackets", - "rankedwars", - "rankedwarreport", - "revives", - "revivesfull", - "stats", - "territory", - "territoryownership", - "territorywarreport", - "territorywars", - "timestamp", - "upgrades", - "wars", - "armor", - "boosters", - "caches", - "cesium", - "crimeexp", - "drugs", - "medical", - "positions", - "reports", - "temporary", - "weapons", - "armorynews", - "attacknews", - "crimenews", - "currency", - "donations", - "fundsnews", - "mainnews", - "membershipnews", - "territorynews" - ] - }, - "FactionLookupResponse": { - "required": [ - "selections" - ], - "properties": { - "selections": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionSelectionName" - } - } - }, - "type": "object" - }, - "FactionRankedWarDetails": { - "required": [ - "id", - "start", - "end", - "target", - "winner", - "factions" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/RankedWarId" - }, - "start": { - "description": "Timestamp the war started at.", - "type": "integer", - "format": "int32" - }, - "end": { - "description": "Timestamp the war ended at.", - "type": "integer", - "format": "int32" - }, - "target": { - "type": "integer", - "format": "int32" - }, - "winner": { - "oneOf": [ - { - "$ref": "#/components/schemas/FactionId" - }, - { - "type": "null" - } - ] - }, - "factions": { - "type": "array", - "items": { - "required": [ - "id", - "name", - "score", - "chain" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionId" - }, - "name": { - "type": "string" - }, - "score": { - "type": "integer", - "format": "int32" - }, - "chain": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - } - } - }, - "type": "object" - }, - "FactionRankedWarResponse": { - "required": [ - "rankedwars", - "_metadata" - ], - "properties": { - "rankedwars": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionRankedWarDetails" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "FactionRankedWarReportResponse": { - "required": [ - "rankedwarreport" - ], - "properties": { - "rankedwarreport": { + "dvd_sales": { + "description": "DVD sales statistics.", "required": [ - "id", - "start", - "end", - "winner", - "forfeit", - "factions" + "action", + "comedy", + "drama", + "fantasy", + "horror", + "romance", + "thriller", + "sci_fi", + "total", + "earnings" ], "properties": { - "id": { - "$ref": "#/components/schemas/RankedWarId" - }, - "start": { - "description": "Timestamp the war started at.", + "action": { "type": "integer", "format": "int32" }, - "end": { - "description": "Timestamp the war ended at.", + "comedy": { "type": "integer", "format": "int32" }, - "winner": { - "$ref": "#/components/schemas/FactionId" + "drama": { + "type": "integer", + "format": "int32" }, - "forfeit": { - "type": "boolean" + "fantasy": { + "type": "integer", + "format": "int32" }, - "factions": { + "horror": { + "type": "integer", + "format": "int32" + }, + "romance": { + "type": "integer", + "format": "int32" + }, + "thriller": { + "type": "integer", + "format": "int32" + }, + "sci-fi": { + "description": "This is replaced with 'sci_fi' field and will be removed on 1st June 2025.", + "type": "integer", + "format": "int32", + "deprecated": true + }, + "sci_fi": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + }, + "earnings": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "dvds_copied": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "UserCrimeDetailsGraffiti": { + "required": [ + "cans_used", + "most_graffiti_in_one_area", + "most_graffiti_simultaneously", + "graffiti_removed", + "cost_to_city" + ], + "properties": { + "cans_used": { + "type": "integer", + "format": "int32" + }, + "most_graffiti_in_one_area": { + "type": "integer", + "format": "int32" + }, + "most_graffiti_simultaneously": { + "type": "integer", + "format": "int32" + }, + "graffiti_removed": { + "type": "integer", + "format": "int32" + }, + "cost_to_city": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "UserCrimeDetailsShoplifting": { + "required": [ + "average_notoriety" + ], + "properties": { + "average_notoriety": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "UserCrimeDetailsCardSkimming": { + "required": [ + "card_details", + "skimmers" + ], + "properties": { + "card_details": { + "required": [ + "recoverable", + "recovered", + "sold", + "lost", + "areas" + ], + "properties": { + "recoverable": { + "type": "integer", + "format": "int32" + }, + "recovered": { + "type": "integer", + "format": "int32" + }, + "sold": { + "type": "integer", + "format": "int32" + }, + "lost": { + "type": "integer", + "format": "int32" + }, + "areas": { "type": "array", "items": { "required": [ "id", - "name", - "score", - "attacks", - "rank", - "rewards", - "members" + "amount" ], "properties": { "id": { - "$ref": "#/components/schemas/FactionId" - }, - "name": { - "type": "string" - }, - "score": { "type": "integer", "format": "int32" }, - "attacks": { + "amount": { "type": "integer", "format": "int32" - }, - "rank": { - "required": [ - "before", - "after" - ], - "properties": { - "before": { - "type": "string" - }, - "after": { - "type": "string" - } - }, - "type": "object" - }, - "rewards": { - "required": [ - "respect", - "points", - "items" - ], - "properties": { - "respect": { - "type": "integer", - "format": "int32" - }, - "points": { - "type": "integer", - "format": "int32" - }, - "items": { - "type": "array", - "items": { - "required": [ - "id", - "name", - "quantity" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ItemId" - }, - "name": { - "type": "string" - }, - "quantity": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - } - } - }, - "type": "object" - }, - "members": { - "type": "array", - "items": { - "required": [ - "id", - "name", - "level", - "attacks", - "score" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "name": { - "type": "string" - }, - "level": { - "type": "integer", - "format": "int32" - }, - "attacks": { - "type": "integer", - "format": "int32" - }, - "score": { - "type": "number", - "format": "float" - } - }, - "type": "object" - } } }, "type": "object" @@ -13887,423 +11705,529 @@ } }, "type": "object" - } - }, - "type": "object" - }, - "ForumCategoriesResponse": { - "required": [ - "categories" - ], - "properties": { - "categories": { - "type": "array", - "items": { - "required": [ - "id", - "title", - "acronym", - "threads" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ForumId" - }, - "title": { - "type": "string" - }, - "acronym": { - "type": "string" - }, - "threads": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - } - } - }, - "type": "object" - }, - "ForumThreadAuthor": { - "required": [ - "id", - "username", - "karma" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" }, - "username": { - "type": "string" - }, - "karma": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "ForumPollVote": { - "required": [ - "answer", - "votes" - ], - "properties": { - "answer": { - "type": "string" - }, - "votes": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "ForumPoll": { - "required": [ - "question", - "answers_count", - "answers" - ], - "properties": { - "question": { - "type": "string" - }, - "answers_count": { - "type": "integer", - "format": "int32" - }, - "answers": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ForumPollVote" - } - } - }, - "type": "object" - }, - "ForumThreadBase": { - "required": [ - "id", - "title", - "forum_id", - "posts", - "rating", - "views", - "author", - "last_poster", - "first_post_time", - "last_post_time", - "has_poll", - "is_locked", - "is_sticky" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ForumThreadId" - }, - "title": { - "type": "string" - }, - "forum_id": { - "$ref": "#/components/schemas/ForumId" - }, - "posts": { - "type": "integer", - "format": "int32" - }, - "rating": { - "type": "integer", - "format": "int32" - }, - "views": { - "description": "Total number of times players have opened this thread.", - "type": "integer", - "format": "int32" - }, - "author": { - "$ref": "#/components/schemas/ForumThreadAuthor" - }, - "last_poster": { - "oneOf": [ - { - "$ref": "#/components/schemas/ForumThreadAuthor" - }, - { - "type": "null" - } - ] - }, - "first_post_time": { - "type": "integer", - "format": "int32" - }, - "last_post_time": { - "oneOf": [ - { + "skimmers": { + "required": [ + "active", + "most_lucrative", + "oldest_recovered", + "lost" + ], + "properties": { + "active": { "type": "integer", "format": "int32" }, - { - "type": "null" + "most_lucrative": { + "type": "integer", + "format": "int32" + }, + "oldest_recovered": { + "type": "integer", + "format": "int32" + }, + "lost": { + "type": "integer", + "format": "int32" } - ] - }, - "has_poll": { - "type": "boolean" - }, - "is_locked": { - "type": "boolean" - }, - "is_sticky": { - "type": "boolean" + }, + "type": "object" } }, "type": "object" }, - "ForumThreadExtended": { - "allOf": [ - { + "UserCrimeDetailsHustling": { + "required": [ + "total_audience_gathered", + "biggest_money_won", + "shill_money_collected", + "pickpocket_money_collected" + ], + "properties": { + "total_audience_gathered": { + "type": "integer", + "format": "int32" + }, + "biggest_money_won": { + "type": "integer", + "format": "int32" + }, + "shill_money_collected": { + "type": "integer", + "format": "int32" + }, + "pickpocket_money_collected": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "UserCrimeDetailsCracking": { + "required": [ + "brute_force_cycles", + "encryption_layers_broken", + "highest_mips", + "chars_guessed", + "chars_guessed_total" + ], + "properties": { + "brute_force_cycles": { + "type": "integer", + "format": "int32" + }, + "encryption_layers_broken": { + "type": "integer", + "format": "int32" + }, + "highest_mips": { + "type": "integer", + "format": "int32" + }, + "chars_guessed": { + "type": "integer", + "format": "int32" + }, + "chars_guessed_total": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "UserCrimeDetailsScamming": { + "required": [ + "most_responses", + "zones", + "concerns", + "payouts", + "emails" + ], + "properties": { + "most_responses": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "zones": { "required": [ - "content", - "content_raw", - "poll" + "red", + "neutral", + "concern", + "sensitivity", + "temptation", + "hesitation", + "low_reward", + "medium_reward", + "high_reward" ], "properties": { - "content": { - "type": "string" + "red": { + "type": "integer", + "format": "int32", + "default": 0 }, - "content_raw": { - "type": "string" + "neutral": { + "type": "integer", + "format": "int32", + "default": 0 }, - "poll": { - "description": "'poll' is null when 'has_poll' is false.", - "oneOf": [ - { - "$ref": "#/components/schemas/ForumPoll" - }, - { - "type": "null" - } - ] + "concern": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "sensitivity": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "temptation": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "hesitation": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "low_reward": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "medium_reward": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "high_reward": { + "type": "integer", + "format": "int32", + "default": 0 } }, "type": "object" }, - { - "$ref": "#/components/schemas/ForumThreadBase" - } - ] - }, - "ForumPost": { - "required": [ - "id", - "thread_id", - "author", - "is_legacy", - "is_topic", - "is_edited", - "is_pinned", - "created_time", - "edited_by", - "has_quote", - "quoted_post_id", - "content", - "likes", - "dislikes" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ForumPostId" - }, - "thread_id": { - "$ref": "#/components/schemas/ForumThreadId" - }, - "author": { - "$ref": "#/components/schemas/ForumThreadAuthor" - }, - "is_legacy": { - "description": "Indicates whether post was made using the old formatting engine which doesn't use HTML.", - "type": "boolean" - }, - "is_topic": { - "type": "boolean" - }, - "is_edited": { - "type": "boolean" - }, - "is_pinned": { - "type": "boolean" - }, - "created_time": { - "type": "integer", - "format": "int32" - }, - "edited_by": { - "description": "'edited_by' is null when 'is_edited' is false.", - "oneOf": [ - { - "$ref": "#/components/schemas/UserId" - }, - { - "type": "null" - } - ] - }, - "has_quote": { - "type": "boolean" - }, - "quoted_post_id": { - "description": "'quoted_post_id' is null when 'has_quote' is false.", - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "content": { - "description": "depending on the input 'cat' parameter, this will either return raw value (with HTML) or plain text. Legacy posts are returned as is, they can't be stripped of tags.", - "type": "string" - }, - "likes": { - "type": "integer", - "format": "int32" - }, - "dislikes": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "ForumThreadUserExtended": { - "allOf": [ - { + "concerns": { "required": [ - "new_posts" + "attempts", + "resolved" ], "properties": { - "new_posts": { - "description": "Available only when requesting data for yourself (no id or your id) with at least 'Minimal' access type key.", - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] + "attempts": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "resolved": { + "type": "integer", + "format": "int32", + "default": 0 } }, "type": "object" }, - { - "$ref": "#/components/schemas/ForumThreadBase" + "payouts": { + "required": [ + "low", + "medium", + "high" + ], + "properties": { + "low": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "medium": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "high": { + "type": "integer", + "format": "int32", + "default": 0 + } + }, + "type": "object" + }, + "emails": { + "required": [ + "scraper", + "phisher" + ], + "properties": { + "scraper": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "phisher": { + "type": "integer", + "format": "int32", + "default": 0 + } + }, + "type": "object" } - ] + }, + "type": "object" }, - "ForumSubscribedThreadPostsCount": { + "UserSubcrime": { "required": [ - "new", - "total" + "id", + "total", + "success", + "fail" ], "properties": { - "new": { + "id": { "type": "integer", "format": "int32" }, "total": { "type": "integer", "format": "int32" - } - }, - "type": "object" - }, - "ForumSubscribedThread": { - "required": [ - "id", - "forum_id", - "author", - "title", - "posts" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ForumThreadId" }, - "forum_id": { - "$ref": "#/components/schemas/ForumId" - }, - "author": { - "$ref": "#/components/schemas/ForumThreadAuthor" - }, - "title": { - "type": "string" - }, - "posts": { - "$ref": "#/components/schemas/ForumSubscribedThreadPostsCount" - } - }, - "type": "object" - }, - "ForumFeed": { - "required": [ - "thread_id", - "post_id", - "user", - "title", - "text", - "timestamp", - "is_seen", - "type" - ], - "properties": { - "thread_id": { - "$ref": "#/components/schemas/ForumThreadId" - }, - "post_id": { - "$ref": "#/components/schemas/ForumPostId" - }, - "user": { - "$ref": "#/components/schemas/ForumThreadAuthor" - }, - "title": { - "type": "string" - }, - "text": { - "type": "string" - }, - "timestamp": { + "success": { "type": "integer", "format": "int32" }, - "is_seen": { - "type": "boolean" - }, - "type": { - "$ref": "#/components/schemas/ForumFeedTypeEnum" + "fail": { + "type": "integer", + "format": "int32" } }, "type": "object" }, - "ForumThreadsResponse": { + "UserCrimeRewardAmmo": { "required": [ - "threads", + "standard", + "special" + ], + "properties": { + "standard": { + "type": "integer", + "format": "int32" + }, + "special": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "UserCrimeRewardItem": { + "required": [ + "id", + "amount" + ], + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "amount": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "UserCrimeRewards": { + "required": [ + "money", + "ammo", + "items" + ], + "properties": { + "money": { + "type": "integer", + "format": "int64" + }, + "ammo": { + "$ref": "#/components/schemas/UserCrimeRewardAmmo" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserCrimeRewardItem" + } + } + }, + "type": "object" + }, + "UserCrimeAttempts": { + "required": [ + "total", + "success", + "fail", + "critical_fail", + "subcrimes" + ], + "properties": { + "total": { + "type": "integer", + "format": "int32" + }, + "success": { + "type": "integer", + "format": "int32" + }, + "fail": { + "type": "integer", + "format": "int32" + }, + "critical_fail": { + "type": "integer", + "format": "int32" + }, + "subcrimes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserSubcrime" + } + } + }, + "type": "object" + }, + "UserCrimeUniquesRewardMoney": { + "required": [ + "min", + "max" + ], + "properties": { + "min": { + "type": "integer", + "format": "int32" + }, + "max": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "UserCrimeUniquesRewardAmmo": { + "required": [ + "amount", + "type" + ], + "properties": { + "amount": { + "type": "integer", + "format": "int32" + }, + "type": { + "$ref": "#/components/schemas/UserCrimeUniquesRewardAmmoEnum" + } + }, + "type": "object" + }, + "UserCrimeUniquesReward": { + "required": [ + "items", + "money", + "ammo" + ], + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserCrimeRewardItem" + } + }, + "money": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserCrimeUniquesRewardMoney" + }, + { + "type": "null" + } + ] + }, + "ammo": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserCrimeUniquesRewardAmmo" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "UserCrimeUniques": { + "required": [ + "id", + "rewards" + ], + "properties": { + "id": { + "description": "Unique result id.", + "type": "integer", + "format": "int64" + }, + "rewards": { + "$ref": "#/components/schemas/UserCrimeUniquesReward" + } + }, + "type": "object" + }, + "UserCrimesResponse": { + "required": [ + "crimes" + ], + "properties": { + "crimes": { + "$ref": "#/components/schemas/UserCrime" + } + }, + "type": "object" + }, + "UserCrime": { + "required": [ + "nerve_spent", + "skill", + "progression_bonus", + "rewards", + "attempts", + "uniques", + "miscellaneous" + ], + "properties": { + "nerve_spent": { + "type": "integer", + "format": "int32" + }, + "skill": { + "type": "integer", + "format": "int32" + }, + "progression_bonus": { + "type": "integer", + "format": "int32" + }, + "rewards": { + "$ref": "#/components/schemas/UserCrimeRewards" + }, + "attempts": { + "$ref": "#/components/schemas/UserCrimeAttempts" + }, + "uniques": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserCrimeUniques" + } + }, + "miscellaneous": { + "description": " Miscellaneous stats for specific crime. Results differ based on the cat id.", + "oneOf": [ + { + "$ref": "#/components/schemas/UserCrimeDetailsBootlegging" + }, + { + "$ref": "#/components/schemas/UserCrimeDetailsGraffiti" + }, + { + "$ref": "#/components/schemas/UserCrimeDetailsShoplifting" + }, + { + "$ref": "#/components/schemas/UserCrimeDetailsCardSkimming" + }, + { + "$ref": "#/components/schemas/UserCrimeDetailsHustling" + }, + { + "$ref": "#/components/schemas/UserCrimeDetailsCracking" + }, + { + "$ref": "#/components/schemas/UserCrimeDetailsScamming" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "UserRacesResponse": { + "required": [ + "races", "_metadata" ], "properties": { - "threads": { + "races": { "type": "array", "items": { - "$ref": "#/components/schemas/ForumThreadBase" + "$ref": "#/components/schemas/RacingRaceDetailsResponse" } }, "_metadata": { @@ -14312,24 +12236,87 @@ }, "type": "object" }, - "ForumThreadResponse": { + "UserRaceCarDetails": { + "allOf": [ + { + "$ref": "#/components/schemas/RaceCar" + }, + { + "required": [ + "id", + "name", + "worth", + "points_spent", + "races_entered", + "races_won", + "is_removed", + "parts" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/RaceCarId" + }, + "name": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "worth": { + "type": "integer", + "format": "int64" + }, + "points_spent": { + "type": "integer", + "format": "int32" + }, + "races_entered": { + "type": "integer", + "format": "int32" + }, + "races_won": { + "type": "integer", + "format": "int32" + }, + "is_removed": { + "type": "boolean" + }, + "parts": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RaceCarUpgradeId" + } + } + }, + "type": "object" + } + ] + }, + "UserEnlistedCarsResponse": { "required": [ - "thread" + "enlistedcars" ], "properties": { - "thread": { - "$ref": "#/components/schemas/ForumThreadExtended" + "enlistedcars": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserRaceCarDetails" + } } }, "type": "object" }, - "ForumPostsResponse": { + "UserForumPostsResponse": { "required": [ - "posts", + "forumPosts", "_metadata" ], "properties": { - "posts": { + "forumPosts": { "type": "array", "items": { "$ref": "#/components/schemas/ForumPost" @@ -14341,309 +12328,302 @@ }, "type": "object" }, - "ForumSelectionName": { - "type": "string", - "enum": [ - "categories", - "lookup", - "posts", - "thread", - "threads", - "timestamp" - ] - }, - "ForumLookupResponse": { + "UserForumThreadsResponse": { "required": [ - "selections" + "forumThreads", + "_metadata" ], "properties": { - "selections": { + "forumThreads": { "type": "array", "items": { - "$ref": "#/components/schemas/ForumSelectionName" + "$ref": "#/components/schemas/ForumThreadUserExtended" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "UserForumSubscribedThreadsResponse": { + "required": [ + "forumSbuscribedThreads" + ], + "properties": { + "forumSubscribedThreads": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ForumSubscribedThread" } } }, "type": "object" }, - "KeyLogResponse": { + "UserForumFeedResponse": { "required": [ - "log" + "forumFeed" ], "properties": { - "log": { + "forumFeed": { "type": "array", "items": { - "required": [ - "timestamp", - "type", - "selections", - "id", - "ip" - ], - "properties": { - "timestamp": { - "type": "integer", - "format": "int32" - }, - "type": { - "type": "string" - }, - "selections": { - "type": "string" - }, - "id": { - "oneOf": [ - { - "type": "integer", - "format": "int64" - }, - { - "type": "null" - } - ] - }, - "comment": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "ip": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/components/schemas/ForumFeed" } } }, "type": "object" }, - "KeyInfoResponse": { + "UserForumFriendsResponse": { "required": [ - "info" + "forumFriends" ], "properties": { - "info": { - "required": [ - "selections", - "access" - ], - "properties": { - "selections": { - "required": [ - "company", - "faction", - "market", - "property", - "torn", - "user", - "racing", - "forum", - "key" - ], - "properties": { - "company": { - "type": "array", - "items": { - "type": "string" - } - }, - "faction": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionSelectionName" - } - }, - "market": { - "type": "array", - "items": { - "$ref": "#/components/schemas/MarketSelectionName" - } - }, - "property": { - "type": "array", - "items": { - "type": "string" - } - }, - "torn": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornSelectionName" - } - }, - "user": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserSelectionName" - } - }, - "racing": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RacingSelectionName" - } - }, - "forum": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ForumSelectionName" - } - }, - "key": { - "type": "array", - "items": { - "$ref": "#/components/schemas/KeySelectionName" - } - } - }, - "type": "object" - }, - "access": { - "required": [ - "level", - "type", - "faction", - "company" - ], - "properties": { - "level": { - "type": "integer", - "format": "int32" - }, - "type": { - "$ref": "#/components/schemas/ApiKeyAccessTypeEnum" - }, - "faction": { - "type": "boolean" - }, - "faction_id": { - "oneOf": [ - { - "$ref": "#/components/schemas/FactionId" - }, - { - "type": "null" - } - ] - }, - "company": { - "type": "boolean" - }, - "company_id": { - "oneOf": [ - { - "$ref": "#/components/schemas/CompanyId" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - } - }, - "type": "object" + "forumFriends": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ForumFeed" + } } }, "type": "object" }, - "KeySelectionName": { - "type": "string", - "enum": [ - "info", - "log" - ] - }, - "ItemMarketListingItemBonus": { + "HofValue": { "required": [ - "id", - "title", - "description", - "value" + "value", + "rank" ], "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, "value": { + "type": "integer", + "format": "int64" + }, + "rank": { "type": "integer", "format": "int32" } }, "type": "object" }, - "ItemMarketListingItemStats": { + "HofValueFloat": { "required": [ - "damage", - "accuracy", - "armor", - "quality" + "value", + "rank" ], "properties": { - "damage": { - "oneOf": [ - { - "type": "number", - "format": "float" - }, - { - "type": "null" - } - ] - }, - "accuracy": { - "oneOf": [ - { - "type": "number", - "format": "float" - }, - { - "type": "null" - } - ] - }, - "armor": { - "oneOf": [ - { - "type": "number", - "format": "float" - }, - { - "type": "null" - } - ] - }, - "quality": { - "type": "number", + "value": { + "type": "integer", "format": "float" + }, + "rank": { + "type": "integer", + "format": "int32" } }, "type": "object" }, - "ItemMarketItem": { + "HofValueString": { + "required": [ + "value", + "rank" + ], + "properties": { + "value": { + "type": "string" + }, + "rank": { + "oneOf": [ + { + "type": "number", + "format": "int32" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "UserHofStats": { + "required": [ + "attacks", + "busts", + "defends", + "networth", + "offences", + "revives", + "level", + "rank", + "awards", + "racing_skill", + "racing_points", + "racing_wins", + "travel_time", + "working_stats", + "battle_stats" + ], + "properties": { + "attacks": { + "$ref": "#/components/schemas/HofValue" + }, + "busts": { + "$ref": "#/components/schemas/HofValue" + }, + "defends": { + "$ref": "#/components/schemas/HofValue" + }, + "networth": { + "$ref": "#/components/schemas/HofValue" + }, + "offences": { + "$ref": "#/components/schemas/HofValue" + }, + "revives": { + "$ref": "#/components/schemas/HofValue" + }, + "level": { + "$ref": "#/components/schemas/HofValue" + }, + "rank": { + "$ref": "#/components/schemas/HofValue" + }, + "awards": { + "$ref": "#/components/schemas/HofValue" + }, + "racing_skill": { + "$ref": "#/components/schemas/HofValueFloat" + }, + "racing_points": { + "$ref": "#/components/schemas/HofValue" + }, + "racing_wins": { + "$ref": "#/components/schemas/HofValue" + }, + "travel_time": { + "$ref": "#/components/schemas/HofValue" + }, + "working_stats": { + "$ref": "#/components/schemas/HofValue" + }, + "battle_stats": { + "oneOf": [ + { + "$ref": "#/components/schemas/HofValue", + "description": "This field is null when requesting data for other players." + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "UserHofResponse": { + "required": [ + "hof" + ], + "properties": { + "hof": { + "$ref": "#/components/schemas/UserHofStats" + } + }, + "type": "object" + }, + "UserCalendar": { + "required": [ + "start_time" + ], + "properties": { + "start_time": { + "description": "Event start time displayed in TCT.", + "type": "string" + } + }, + "type": "object" + }, + "UserCalendarResponse": { + "required": [ + "calendar" + ], + "properties": { + "calendar": { + "$ref": "#/components/schemas/UserCalendar" + } + }, + "type": "object" + }, + "UserBountiesResponse": { + "required": [ + "bounties" + ], + "properties": { + "bounties": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Bounty" + } + } + }, + "type": "object" + }, + "UserJobRanks": { + "required": [ + "army", + "grocer", + "casino", + "medical", + "law", + "education" + ], + "properties": { + "army": { + "$ref": "#/components/schemas/JobPositionArmyEnum" + }, + "grocer": { + "$ref": "#/components/schemas/JobPositionGrocerEnum" + }, + "casino": { + "$ref": "#/components/schemas/JobPositionCasinoEnum" + }, + "medical": { + "$ref": "#/components/schemas/JobPositionMedicalEnum" + }, + "law": { + "$ref": "#/components/schemas/JobPositionLawEnum" + }, + "education": { + "$ref": "#/components/schemas/JobPositionEducationEnum" + } + }, + "type": "object" + }, + "UserJobRanksResponse": { + "required": [ + "jobranks" + ], + "properties": { + "jobranks": { + "$ref": "#/components/schemas/UserJobRanks" + } + }, + "type": "object" + }, + "UserItemMarkeListingItemDetails": { "required": [ "id", "name", "type", - "average_price" + "rarity", + "uid", + "stats", + "bonuses" ], "properties": { "id": { - "$ref": "#/components/schemas/ItemId" + "type": "integer", + "format": "int64" }, "name": { "type": "string" @@ -14651,50 +12631,6 @@ "type": { "type": "string" }, - "average_price": { - "type": "integer", - "format": "int64" - } - }, - "type": "object" - }, - "ItemMarketListingStackable": { - "required": [ - "price", - "amount" - ], - "properties": { - "price": { - "type": "integer", - "format": "int64" - }, - "amount": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "ItemMarketListingItemDetails": { - "required": [ - "uid", - "stats", - "bonuses", - "rarity" - ], - "properties": { - "uid": { - "$ref": "#/components/schemas/ItemUid" - }, - "stats": { - "$ref": "#/components/schemas/ItemMarketListingItemStats" - }, - "bonuses": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ItemMarketListingItemBonus" - } - }, "rarity": { "oneOf": [ { @@ -14709,313 +12645,87 @@ "type": "null" } ] + }, + "uid": { + "oneOf": [ + { + "$ref": "#/components/schemas/ItemUid" + }, + { + "type": "null" + } + ] + }, + "stats": { + "oneOf": [ + { + "$ref": "#/components/schemas/ItemMarketListingItemStats" + }, + { + "type": "null" + } + ] + }, + "bonuses": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ItemMarketListingItemBonus" + } } }, "type": "object" }, - "ItemMarketListingNonstackable": { + "UserItemMarketListing": { "required": [ + "id", "price", + "average_price", "amount", - "item_details" + "is_anonymous", + "available", + "item" ], "properties": { + "id": { + "type": "integer", + "format": "int64" + }, "price": { "type": "integer", "format": "int64" }, + "average_price": { + "type": "integer", + "format": "int64" + }, "amount": { "type": "integer", "format": "int32" }, - "item_details": { - "$ref": "#/components/schemas/ItemMarketListingItemDetails" - } - }, - "type": "object" - }, - "ItemMarket": { - "required": [ - "item", - "listings" - ], - "properties": { - "item": { - "$ref": "#/components/schemas/ItemMarketItem" + "is_anonymous": { + "type": "boolean" }, - "listings": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/ItemMarketListingNonstackable" - }, - { - "$ref": "#/components/schemas/ItemMarketListingStackable" - } - ] - } + "available": { + "description": "Amount remaining in the inventory.", + "type": "integer", + "format": "int32" + }, + "item": { + "$ref": "#/components/schemas/UserItemMarkeListingItemDetails" } }, "type": "object" }, - "MarketItemMarketResponse": { + "UserItemMarketResponse": { "required": [ "itemmarket", "_metadata" ], "properties": { "itemmarket": { - "$ref": "#/components/schemas/ItemMarket" - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "MarketSelectionName": { - "description": "The following selections will fallback to API v1 and may change at any time: 'pointsmarket'.", - "type": "string", - "enum": [ - "itemmarket", - "lookup", - "timestamp", - "pointsmarket", - "bazaar" - ] - }, - "MarketLookupResponse": { - "required": [ - "selections" - ], - "properties": { - "selections": { "type": "array", "items": { - "$ref": "#/components/schemas/MarketSelectionName" - } - } - }, - "type": "object" - }, - "RacingCarsResponse": { - "required": [ - "cars" - ], - "properties": { - "cars": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RaceCar" - } - } - }, - "type": "object" - }, - "RaceCar": { - "required": [ - "car_item_id", - "car_item_name", - "top_speed", - "acceleration", - "braking", - "dirt", - "handling", - "safety", - "tarmac", - "class" - ], - "properties": { - "car_item_id": { - "$ref": "#/components/schemas/ItemId" - }, - "car_item_name": { - "type": "string" - }, - "top_speed": { - "type": "integer", - "format": "int32" - }, - "acceleration": { - "type": "integer", - "format": "int32" - }, - "braking": { - "type": "integer", - "format": "int32" - }, - "dirt": { - "type": "integer", - "format": "int32" - }, - "handling": { - "type": "integer", - "format": "int32" - }, - "safety": { - "type": "integer", - "format": "int32" - }, - "tarmac": { - "type": "integer", - "format": "int32" - }, - "class": { - "$ref": "#/components/schemas/RaceClassEnum" - } - }, - "type": "object" - }, - "RacingTracksResponse": { - "required": [ - "tracks" - ], - "properties": { - "tracks": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RaceTrack" - } - } - }, - "type": "object" - }, - "RaceTrack": { - "required": [ - "id", - "title", - "description" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/RaceTrackId" - }, - "title": { - "type": "string" - }, - "description": { - "type": "string" - } - }, - "type": "object" - }, - "RacingCarUpgradesResponse": { - "required": [ - "carupgrades" - ], - "properties": { - "carupgrades": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RaceCarUpgrade" - } - } - }, - "type": "object" - }, - "RaceCarUpgrade": { - "required": [ - "id", - "class_required", - "name", - "description", - "category", - "subcategory", - "effects", - "cost" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/RaceCarUpgradeId" - }, - "class_required": { - "$ref": "#/components/schemas/RaceClassEnum" - }, - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "category": { - "$ref": "#/components/schemas/RaceCarUpgradeCategory" - }, - "subcategory": { - "$ref": "#/components/schemas/RaceCarUpgradeSubCategory" - }, - "effects": { - "required": [ - "top_speed", - "acceleration", - "braking", - "handling", - "safety", - "dirt", - "tarmac" - ], - "properties": { - "top_speed": { - "type": "integer", - "format": "int32" - }, - "acceleration": { - "type": "integer", - "format": "int32" - }, - "braking": { - "type": "integer", - "format": "int32" - }, - "handling": { - "type": "integer", - "format": "int32" - }, - "safety": { - "type": "integer", - "format": "int32" - }, - "dirt": { - "type": "integer", - "format": "int32" - }, - "tarmac": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "cost": { - "required": [ - "points", - "cash" - ], - "properties": { - "points": { - "type": "integer", - "format": "int32" - }, - "cash": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "RacingRacesResponse": { - "required": [ - "races", - "_metadata" - ], - "properties": { - "races": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Race" + "$ref": "#/components/schemas/UserItemMarketListing" } }, "_metadata": { @@ -15024,818 +12734,108 @@ }, "type": "object" }, - "Race": { + "UserFactionBalance": { "required": [ - "id", - "title", - "track_id", - "creator_id", - "status", - "laps", - "participants", - "schedule", - "requirements" + "money", + "points" ], "properties": { - "id": { - "$ref": "#/components/schemas/RaceId" - }, - "title": { - "type": "string" - }, - "track_id": { - "$ref": "#/components/schemas/RaceTrackId" - }, - "creator_id": { - "$ref": "#/components/schemas/UserId" - }, - "status": { - "$ref": "#/components/schemas/RaceStatusEnum" - }, - "laps": { + "money": { "type": "integer", - "format": "int32" + "format": "int64" }, - "participants": { - "required": [ - "minimum", - "maximum", - "current" - ], - "properties": { - "minimum": { - "type": "integer", - "format": "int32" - }, - "maximum": { - "type": "integer", - "format": "int32" - }, - "current": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "schedule": { - "required": [ - "join_from", - "join_until", - "start", - "end" - ], - "properties": { - "join_from": { - "type": "integer", - "format": "int32" - }, - "join_until": { - "type": "integer", - "format": "int32" - }, - "start": { - "type": "integer", - "format": "int32" - }, - "end": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "requirements": { - "required": [ - "car_class", - "driver_class", - "car_item_id", - "requires_stock_car", - "requires_password", - "join_fee" - ], - "properties": { - "car_class": { - "oneOf": [ - { - "$ref": "#/components/schemas/RaceClassEnum" - }, - { - "type": "null" - } - ] - }, - "driver_class": { - "oneOf": [ - { - "$ref": "#/components/schemas/RaceClassEnum" - }, - { - "type": "null" - } - ] - }, - "car_item_id": { - "oneOf": [ - { - "$ref": "#/components/schemas/ItemId" - }, - { - "type": "null" - } - ] - }, - "requires_stock_car": { - "type": "boolean" - }, - "requires_password": { - "type": "boolean" - }, - "join_fee": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "RacingTrackRecordsResponse": { - "required": [ - "records" - ], - "properties": { - "records": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RaceRecord" - } - } - }, - "type": "object" - }, - "RaceRecord": { - "required": [ - "driver_id", - "driver_name", - "car_item_id", - "lap_time", - "car_item_name" - ], - "properties": { - "driver_id": { - "$ref": "#/components/schemas/UserId" - }, - "driver_name": { - "type": "string" - }, - "car_item_id": { - "$ref": "#/components/schemas/ItemId" - }, - "lap_time": { - "type": "number", - "format": "float" - }, - "car_item_name": { - "type": "string" - } - }, - "type": "object" - }, - "RacerDetails": { - "required": [ - "driver_id", - "position", - "car_id", - "car_item_id", - "car_item_name", - "car_class", - "has_crashed", - "best_lap_time", - "race_time", - "time_ended" - ], - "properties": { - "driver_id": { - "$ref": "#/components/schemas/UserId" - }, - "position": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "car_id": { - "$ref": "#/components/schemas/RaceCarId" - }, - "car_item_id": { - "$ref": "#/components/schemas/ItemId" - }, - "car_item_name": { - "type": "string" - }, - "car_class": { - "$ref": "#/components/schemas/RaceClassEnum" - }, - "has_crashed": { - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ] - }, - "best_lap_time": { - "oneOf": [ - { - "type": "number", - "format": "float" - }, - { - "type": "null" - } - ] - }, - "race_time": { - "oneOf": [ - { - "type": "number", - "format": "float" - }, - { - "type": "null" - } - ] - }, - "time_ended": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "RacingRaceDetailsResponse": { - "properties": { - "race": { - "allOf": [ - { - "required": [ - "results" - ], - "properties": { - "results": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RacerDetails" - } - } - }, - "type": "object" - }, - { - "$ref": "#/components/schemas/Race" - } - ] - } - }, - "type": "object" - }, - "RacingSelectionName": { - "type": "string", - "enum": [ - "cars", - "carupgrades", - "lookup", - "race", - "races", - "records", - "timestamp", - "tracks" - ] - }, - "RacingLookupResponse": { - "required": [ - "selections" - ], - "properties": { - "selections": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RacingSelectionName" - } - } - }, - "type": "object" - }, - "TornEducationRewards": { - "required": [ - "working_stats", - "effect", - "honor" - ], - "properties": { - "working_stats": { - "required": [ - "manual_labor", - "intelligence", - "endurance" - ], - "properties": { - "manual_labor": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "intelligence": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "endurance": { - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "effect": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "honor": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "TornEducationPrerequisites": { - "required": [ - "cost", - "courses" - ], - "properties": { - "cost": { + "points": { "type": "integer", - "format": "int32" - }, - "courses": { - "type": "array", - "items": { - "type": "integer", - "format": "int32" - } + "format": "int64" } }, "type": "object" }, - "TornEducationCourses": { + "UserFactionBalanceResponse": { "required": [ - "id", - "code", - "name", - "description", - "duration", - "rewards", - "prerequisites" + "factionBalance" ], "properties": { - "id": { - "$ref": "#/components/schemas/EducationId" - }, - "code": { - "type": "string" - }, - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "duration": { - "type": "integer", - "format": "int32" - }, - "rewards": { - "$ref": "#/components/schemas/TornEducationRewards" - }, - "prerequisites": { - "$ref": "#/components/schemas/TornEducationPrerequisites" + "factionBalance": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserFactionBalance" + }, + { + "type": "null" + } + ] } }, "type": "object" }, - "TornEducation": { + "UserOrganizedCrimeResponse": { + "required": [ + "organizedCrime" + ], + "properties": { + "organizedCrime": { + "oneOf": [ + { + "$ref": "#/components/schemas/FactionCrime" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "UserList": { "required": [ "id", "name", - "courses" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - }, - "courses": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornEducationCourses" - } - } - }, - "type": "object" - }, - "TornEducationResponse": { - "required": [ - "education" - ], - "properties": { - "education": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornEducation" - } - } - }, - "type": "object" - }, - "TornTerritoryCoordinates": { - "required": [ - "x", - "y" - ], - "properties": { - "x": { - "type": "number", - "format": "float" - }, - "y": { - "type": "number", - "format": "float" - } - }, - "type": "object" - }, - "TornTerritory": { - "required": [ - "id", - "sector", - "size", - "density", - "slots", - "respect", - "coordinates", - "neighbors" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionTerritoryEnum" - }, - "sector": { - "type": "integer", - "format": "int32" - }, - "size": { - "type": "integer", - "format": "int32" - }, - "density": { - "type": "integer", - "format": "int32" - }, - "slots": { - "type": "integer", - "format": "int32" - }, - "respect": { - "type": "integer", - "format": "int32" - }, - "coordinates": { - "$ref": "#/components/schemas/TornTerritoryCoordinates" - }, - "neighbors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FactionTerritoryEnum" - } - } - }, - "type": "object" - }, - "TornTerritoriesResponse": { - "required": [ - "territory", - "_metadata" - ], - "properties": { - "territory": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornTerritory" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "TornTerritoriesNoLinksReponse": { - "required": [ - "territory" - ], - "properties": { - "territory": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornTerritory" - } - } - }, - "type": "object" - }, - "TornSubcrimesResponse": { - "required": [ - "subcrimes" - ], - "properties": { - "subcrimes": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornSubcrime" - } - } - }, - "type": "object" - }, - "TornSubcrime": { - "required": [ - "id", - "name", - "nerve_cost" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - }, - "nerve_cost": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "TornCrimesResponse": { - "required": [ - "crimes" - ], - "properties": { - "crimes": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornCrime" - } - } - }, - "type": "object" - }, - "TornCrime": { - "required": [ - "id", - "name", - "category_id", - "enhancer_id", - "enhancer_name", - "unique_outcomes_count", - "unique_outcomes_ids" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/TornCrimeId" - }, - "name": { - "type": "string" - }, - "category_id": { - "type": "integer", - "format": "int32" - }, - "category_name": { - "type": "string" - }, - "enhancer_id": { - "type": "integer", - "format": "int32" - }, - "enhancer_name": { - "type": "string" - }, - "unique_outcomes_count": { - "type": "integer", - "format": "int32" - }, - "unique_outcomes_ids": { - "type": "array", - "items": { - "type": "integer", - "format": "int32" - } - }, - "notes": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "type": "object" - }, - "TornCalendarActivity": { - "required": [ - "title", - "description", - "start", - "end" - ], - "properties": { - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "start": { - "type": "integer", - "format": "int32" - }, - "end": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "TornCalendarResponse": { - "required": [ - "calendar" - ], - "properties": { - "calendar": { - "required": [ - "competitions", - "events" - ], - "properties": { - "competitions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornCalendarActivity" - } - }, - "events": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornCalendarActivity" - } - } - }, - "type": "object" - } - }, - "type": "object" - }, - "TornHof": { - "required": [ - "id", - "username", - "faction_id", "level", + "faction_id", "last_action", - "rank_name", - "rank_number", - "position", - "signed_up", - "age_in_days", - "value", - "rank" + "status" ], "properties": { "id": { "$ref": "#/components/schemas/UserId" }, - "username": { + "name": { "type": "string" }, - "faction_id": { - "$ref": "#/components/schemas/FactionId" - }, "level": { "type": "integer", "format": "int32" }, + "faction_id": { + "oneOf": [ + { + "$ref": "#/components/schemas/FactionId" + }, + { + "type": "null" + } + ] + }, "last_action": { - "type": "integer", - "format": "int32" + "$ref": "#/components/schemas/UserLastAction" }, - "rank_name": { - "type": "string" - }, - "rank_number": { - "type": "integer", - "format": "int32" - }, - "position": { - "type": "integer", - "format": "int32" - }, - "signed_up": { - "type": "integer", - "format": "int32" - }, - "age_in_days": { - "type": "integer", - "format": "int32" - }, - "value": { - "description": "Value representing the chosen category. Traveltime is shown in seconds. If the chosen category is 'rank', the value is of type string. If the chosen category is 'racingskill', the value is of type float. Otherwise it is an integer." - }, - "rank": { - "type": "string" + "status": { + "$ref": "#/components/schemas/UserStatus" } }, "type": "object" }, - "TornHofResponse": { + "UserListResponse": { "required": [ - "hof", + "list", "_metadata" ], "properties": { - "hof": { + "list": { "type": "array", "items": { - "$ref": "#/components/schemas/TornHof" + "$ref": "#/components/schemas/UserList" } }, "_metadata": { @@ -15844,963 +12844,73 @@ }, "type": "object" }, - "FactionHofValues": { - "required": [ - "chain", - "chain_duration", - "respect" - ], - "properties": { - "chain": { - "description": "Maximum chain achieved by the faction. Null if chosen category is 'rank' or 'respect'.", - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "chain_duration": { - "description": "The duration of the chain. Null if chosen category is 'rank' or 'respect'.", - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - }, - "respect": { - "description": "Null if chosen category is 'chain'.", - "oneOf": [ - { - "type": "integer", - "format": "int32" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "TornFactionHof": { - "required": [ - "id", - "name", - "members", - "position", - "rank", - "values" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionId" - }, - "name": { - "type": "string" - }, - "members": { - "type": "integer", - "format": "int32" - }, - "position": { - "type": "integer", - "format": "int32" - }, - "rank": { - "description": "The full rank title & division of the faction.", - "type": "string" - }, - "values": { - "$ref": "#/components/schemas/FactionHofValues" - } - }, - "type": "object" - }, - "TornFactionHofResponse": { - "required": [ - "factionhof", - "_metadata" - ], - "properties": { - "factionhof": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornFactionHof" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "TornLog": { - "required": [ - "id", - "title" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/LogId" - }, - "title": { - "type": "string" - } - }, - "type": "object" - }, - "TornLogCategory": { - "required": [ - "id", - "title" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/LogCategoryId" - }, - "title": { - "type": "string" - } - }, - "type": "object" - }, - "TornLogTypesResponse": { - "required": [ - "logtypes" - ], - "properties": { - "logtypes": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornLog" - } - } - }, - "type": "object" - }, - "TornLogCategoriesResponse": { - "required": [ - "logcategories" - ], - "properties": { - "logcategories": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornLogCategory" - } - } - }, - "type": "object" - }, - "Bounty": { - "required": [ - "target_id", - "target_name", - "target_level", - "lister_id", - "lister_name", - "reward", - "reason", - "quantity", - "is_anonymous", - "valid_until" - ], - "properties": { - "target_id": { - "$ref": "#/components/schemas/UserId" - }, - "target_name": { - "type": "string" - }, - "target_level": { - "type": "integer", - "format": "int32" - }, - "lister_id": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserId" - }, - { - "type": "null" - } - ] - }, - "lister_name": { - "description": "If the bounty is anonymous this field is null.", - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "reward": { - "type": "integer", - "format": "int64" - }, - "reason": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "quantity": { - "type": "integer", - "format": "int32" - }, - "is_anonymous": { - "type": "boolean" - }, - "valid_until": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "AttackLogSummary": { - "required": [ - "id", - "name", - "hits", - "misses", - "damage" - ], - "properties": { - "id": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserId" - }, - { - "type": "null" - } - ] - }, - "name": { - "oneOf": [ - { - "description": "Name of the participant, could be null in stealthed attacks.", - "type": "string" - }, - { - "type": "null" - } - ] - }, - "hits": { - "type": "integer", - "format": "int32" - }, - "misses": { - "type": "integer", - "format": "int32" - }, - "damage": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "AttackLog": { - "required": [ - "text", - "timestamp", - "action", - "icon", - "attacker", - "defender" - ], - "properties": { - "text": { - "type": "string" - }, - "timestamp": { - "type": "integer", - "format": "int32" - }, - "action": { - "$ref": "#/components/schemas/AttackActionEnum" - }, - "icon": { - "type": "string" - }, - "attacker": { - "oneOf": [ - { - "description": "This value could be null in stealthed attacks.", - "required": [ - "id", - "name", - "item" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "name": { - "type": "string" - }, - "item": { - "oneOf": [ - { - "description": "This object could be null if there was no item being used in this turn or during this effect.", - "properties": { - "id": { - "$ref": "#/components/schemas/ItemId" - }, - "name": { - "type": "string" - } - }, - "type": "object" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - { - "type": "null" - } - ] - }, - "defender": { - "oneOf": [ - { - "description": "This value could be null in stealthed attacks.", - "required": [ - "id", - "name" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "name": { - "type": "string" - } - }, - "type": "object" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "AttackLogResponse": { - "required": [ - "attacklog", - "_metadata" - ], - "properties": { - "attacklog": { - "required": [ - "log", - "summary" - ], - "properties": { - "log": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AttackLog" - } - }, - "summary": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AttackLogSummary" - } - } - }, - "type": "object" - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "TornBountiesResponse": { - "required": [ - "bounties", - "_metadata" - ], - "properties": { - "bounties": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Bounty" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "TornItemAmmo": { - "required": [ - "id", - "name", - "price", - "types" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/AmmoId" - }, - "name": { - "type": "string" - }, - "price": { - "type": "integer", - "format": "int64" - }, - "types": { - "description": "Types of ammo", - "type": "array", - "items": { - "$ref": "#/components/schemas/TornItemAmmoTypeEnum" - } - } - }, - "type": "object" - }, - "TornItemAmmoResponse": { - "required": [ - "itemammo" - ], - "properties": { - "itemammo": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornItemAmmo" - } - } - }, - "type": "object" - }, - "TornItemMods": { - "required": [ - "id", - "name", - "description", - "dual_fit", - "weapons" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ItemModId" - }, - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "dual_fit": { - "description": "Whether the upgrade fits on dual weapons.", - "type": "boolean" - }, - "weapons": { - "description": "The weapon types this upgrade can be attached to.", - "type": "array", - "items": { - "$ref": "#/components/schemas/TornItemWeaponTypeEnum" - } - } - }, - "type": "object" - }, - "TornItemModsResponse": { - "required": [ - "itemmods" - ], - "properties": { - "itemmods": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornItemMods" - } - } - }, - "type": "object" - }, - "TornItemBaseStats": { - "required": [ - "damage", - "accuracy", - "armor" - ], - "properties": { - "damage": { - "type": "integer", - "format": "int32" - }, - "accuracy": { - "type": "integer", - "format": "int32" - }, - "armor": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "TornItemWeaponDetails": { - "required": [ - "stealth_level", - "base_stats", - "category", - "ammo", - "mods" - ], - "properties": { - "stealth_level": { - "type": "number", - "format": "float" - }, - "base_stats": { - "$ref": "#/components/schemas/TornItemBaseStats" - }, - "category": { - "$ref": "#/components/schemas/TornItemWeaponCategoryEnum" - }, - "ammo": { - "oneOf": [ - { - "required": [ - "id", - "name", - "magazine_rounds", - "rate_of_fire" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/AmmoId" - }, - "name": { - "type": "string" - }, - "magazine_rounds": { - "type": "integer", - "format": "int32" - }, - "rate_of_fire": { - "required": [ - "minimum", - "maximum" - ], - "properties": { - "minimum": { - "type": "integer", - "format": "int32" - }, - "maximum": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - } - }, - "type": "object" - }, - { - "type": "null" - } - ] - }, - "mods": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ItemModId" - } - } - }, - "type": "object" - }, - "TornItemArmorCoverage": { - "required": [ - "name", - "value" - ], - "properties": { - "name": { - "$ref": "#/components/schemas/TornItemArmorCoveragePartEnum" - }, - "value": { - "type": "number", - "format": "float" - } - }, - "type": "object" - }, - "TornItemArmorDetails": { - "required": [ - "coverage", - "base_stats" - ], - "properties": { - "coverage": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornItemArmorCoverage" - } - }, - "base_stats": { - "$ref": "#/components/schemas/TornItemBaseStats" - } - }, - "type": "object" - }, - "TornItem": { - "required": [ - "id", - "name", - "description", - "effect", - "requirement", - "image", - "type", - "sub_type", - "is_masked", - "is_tradable", - "is_found_in_city", - "value", - "circulation", - "details" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/ItemId" - }, - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "effect": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "requirement": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "image": { - "type": "string" - }, - "type": { - "$ref": "#/components/schemas/TornItemTypeEnum" - }, - "sub_type": { - "oneOf": [ - { - "$ref": "#/components/schemas/TornItemWeaponTypeEnum" - }, - { - "type": "null" - } - ] - }, - "is_masked": { - "type": "boolean" - }, - "is_tradable": { - "type": "boolean" - }, - "is_found_in_city": { - "type": "boolean" - }, - "value": { - "required": [ - "vendor", - "buy_price", - "sell_price", - "market_price" - ], - "properties": { - "vendor": { - "oneOf": [ - { - "required": [ - "country", - "name" - ], - "properties": { - "country": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "type": "object" - }, - { - "type": "null" - } - ] - }, - "buy_price": { - "oneOf": [ - { - "type": "integer", - "format": "int64" - }, - { - "type": "null" - } - ] - }, - "sell_price": { - "oneOf": [ - { - "type": "integer", - "format": "int64" - }, - { - "type": "null" - } - ] - }, - "market_price": { - "type": "integer", - "format": "int64" - } - }, - "type": "object" - }, - "circulation": { - "type": "integer", - "format": "int64" - }, - "details": { - "description": "If the item 'type' is 'Armor' then TornItemArmorDetails is returned.
If the item 'type' is 'Weapon' then TornItemWeaponDetails is returned.
Otherwise, null is returned.", - "oneOf": [ - { - "$ref": "#/components/schemas/TornItemWeaponDetails" - }, - { - "$ref": "#/components/schemas/TornItemArmorDetails" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "TornItemsResponse": { - "required": [ - "items" - ], - "properties": { - "items": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornItem" - } - } - }, - "type": "object" - }, - "TornFactionTreeBranch": { - "required": [ - "id", - "name", - "upgrades" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/FactionBranchId" - }, - "name": { - "type": "string" - }, - "upgrades": { - "type": "array", - "items": { - "required": [ - "name", - "level", - "ability", - "challenge", - "cost" - ], - "properties": { - "name": { - "type": "string" - }, - "level": { - "type": "integer", - "format": "int32" - }, - "ability": { - "type": "string" - }, - "cost": { - "type": "integer", - "format": "int32" - }, - "challenge": { - "oneOf": [ - { - "required": [ - "description", - "amount_required", - "stat" - ], - "properties": { - "description": { - "type": "string" - }, - "amount_required": { - "type": "integer", - "format": "int64" - }, - "stat": { - "$ref": "#/components/schemas/FactionStatEnum" - } - }, - "type": "object" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - } - } - }, - "type": "object" - }, - "TornFactionTree": { - "required": [ - "name", - "branches" - ], - "properties": { - "name": { - "type": "string" - }, - "branches": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornFactionTreeBranch" - } - } - }, - "type": "object" - }, - "TornFactionTreeResponse": { - "required": [ - "factionTree" - ], - "properties": { - "factionTree": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TornFactionTree" - } - } - }, - "type": "object" - }, - "TornSelectionName": { - "description": "The following selections will fallback to API v1 and may change at any time: 'bank','cards','cityshops','companies','competition','dirtybombs','gyms','honors','itemdetails','itemstats','medals','organisedcrimes','pawnshop','pokertables','properties','raidreport','raids','rockpaperscissors','searchforcash','shoplifting','stats','stocks'.\n * The following selections are not available in API v2: 'chainreport', 'rackets', 'rankedwarreport', 'rankedwars', 'territorynames', 'territorywarreport', 'territorywars'.", + "UserSelectionName": { + "description": "The following selections will fallback to API v1 and may change at any time: 'ammo','bars','basic','battlestats','bazaar','cooldowns','criminalrecord','discord','display','education','equipment','events','gym','honors','icons','inventory','jobpoints','log','medals','merits','messages','missions','money','networth','newevents','newmessages','notifications','perks','profile','properties','refills','reports','skills','stocks','travel','weaponexp','workstats'.", "type": "string", "enum": [ - "attacklog", + "attacks", + "attacksfull", "bounties", "calendar", "crimes", - "education", - "factionhof", - "factiontree", + "enlistedcars", + "factionbalance", + "forumfeed", + "forumfriends", + "forumposts", + "forumsubscribedthreads", + "forumthreads", "hof", - "itemammo", - "itemmods", - "items", - "logcategories", - "logtypes", + "itemmarket", + "jobranks", + "list", "lookup", - "subcrimes", - "territory", + "organizedcrime", + "personalstats", + "races", + "revives", + "revivesfull", "timestamp", - "bank", - "cards", - "cityshops", - "companies", - "competition", - "dirtybombs", - "gyms", + "ammo", + "bars", + "basic", + "battlestats", + "bazaar", + "cooldowns", + "criminalrecord", + "discord", + "display", + "education", + "equipment", + "events", + "gym", "honors", - "itemdetails", - "itemstats", + "icons", + "inventory", + "jobpoints", + "log", "medals", - "organisedcrimes", - "pawnshop", - "pokertables", + "merits", + "messages", + "missions", + "money", + "networth", + "newevents", + "newmessages", + "notifications", + "perks", + "profile", "properties", - "raidreport", - "raids", - "rockpaperscissors", - "searchforcash", - "shoplifting", - "stats", + "refills", + "reports", + "skills", "stocks", - "chainreport", - "rackets", - "rankedwarreport", - "rankedwars", - "territorynames", - "territorywarreport", - "territorywars" + "travel", + "weaponexp", + "workstats" ] }, - "TornLookupResponse": { + "UserLookupResponse": { "required": [ "selections" ], @@ -16808,7 +12918,7 @@ "selections": { "type": "array", "items": { - "$ref": "#/components/schemas/TornSelectionName" + "$ref": "#/components/schemas/UserSelectionName" } } }, @@ -19853,38 +15963,339 @@ "scammingskill" ] }, - "UserCurrentEducation": { + "FactionTerritoryWarFinishedFaction": { "required": [ "id", - "until" + "name", + "score", + "is_aggressor" ], "properties": { "id": { - "$ref": "#/components/schemas/EducationId" + "$ref": "#/components/schemas/FactionId" }, - "until": { + "name": { + "type": "string" + }, + "score": { + "type": "integer", + "format": "int32" + }, + "is_aggressor": { + "type": "boolean" + } + }, + "type": "object" + }, + "FactionTerritoryWarFinished": { + "required": [ + "id", + "territory", + "start", + "end", + "target", + "result", + "factions" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/TerritoryWarId" + }, + "territory": { + "$ref": "#/components/schemas/FactionTerritoryEnum" + }, + "start": { + "type": "integer", + "format": "int64" + }, + "end": { + "type": "integer", + "format": "int64" + }, + "target": { + "type": "integer", + "format": "int32" + }, + "result": { + "$ref": "#/components/schemas/FactionTerritoryWarResultEnum" + }, + "factions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryWarFinishedFaction" + } + } + }, + "type": "object" + }, + "FactionTerritoryWarOngoingFaction": { + "required": [ + "id", + "name", + "score", + "is_aggressor", + "chain", + "playerIds" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionId" + }, + "name": { + "type": "string" + }, + "score": { + "type": "integer", + "format": "int32" + }, + "is_aggressor": { + "type": "boolean" + }, + "chain": { + "type": "integer", + "format": "int32" + }, + "playerIds": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserId" + } + } + }, + "type": "object" + }, + "FactionTerritoryWarOngoing": { + "required": [ + "id", + "territory", + "start", + "end", + "target", + "factions" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/TerritoryWarId" + }, + "territory": { + "$ref": "#/components/schemas/FactionTerritoryEnum" + }, + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "type": "integer", + "format": "int32" + }, + "target": { + "type": "integer", + "format": "int32" + }, + "factions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryWarOngoingFaction" + } + } + }, + "type": "object" + }, + "FactionTerritoryWarsResponse": { + "required": [ + "territorywars" + ], + "properties": { + "territorywars": { + "description": "If the chosen category is 'ongoing' the response will be of 'FactionTerritoryWarOngoing' type, otherwise, the type will be 'FactionTerritoryWarFinished'.", + "oneOf": [ + { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryWarOngoing" + } + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryWarFinished" + } + } + ] + } + }, + "type": "object" + }, + "FactionTerritoryWarsHistoryResponse": { + "required": [ + "territorywars" + ], + "properties": { + "territorywars": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryWarFinished" + } + } + }, + "type": "object" + }, + "FactionTerritoryWarReportMembers": { + "required": [ + "id", + "username", + "level", + "score", + "joins", + "clears" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "username": { + "type": "string" + }, + "level": { + "type": "integer", + "format": "int32" + }, + "score": { + "type": "integer", + "format": "int32" + }, + "joins": { + "type": "integer", + "format": "int32" + }, + "clears": { "type": "integer", "format": "int32" } }, "type": "object" }, - "UserEducation": { + "FactionTerritoryWarReportFaction": { "required": [ - "complete", - "current" + "id", + "name", + "score", + "joins", + "clears", + "is_aggressor", + "members" ], "properties": { - "complete": { + "id": { + "$ref": "#/components/schemas/FactionId" + }, + "name": { + "type": "string" + }, + "score": { + "type": "integer", + "format": "int32" + }, + "joins": { + "type": "integer", + "format": "int32" + }, + "clears": { + "type": "integer", + "format": "int32" + }, + "is_aggressor": { + "type": "boolean" + }, + "members": { "type": "array", "items": { - "$ref": "#/components/schemas/EducationId" + "$ref": "#/components/schemas/FactionTerritoryWarReportMembers" } + } + }, + "type": "object" + }, + "FactionTerritoryWarReport": { + "required": [ + "id", + "territory", + "started_at", + "ended_at", + "winner", + "result", + "factions" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/TerritoryWarId" }, - "current": { + "territory": { + "$ref": "#/components/schemas/FactionTerritoryEnum" + }, + "started_at": { + "type": "integer", + "format": "int32" + }, + "ended_at": { + "type": "integer", + "format": "int32" + }, + "winner": { + "$ref": "#/components/schemas/FactionId", + "description": "Winning faction id." + }, + "result": { + "type": "string" + }, + "factions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryWarReportFaction" + } + } + }, + "type": "object" + }, + "FactionTerritoryWarReportResponse": { + "required": [ + "territorywarreport" + ], + "properties": { + "territorywarreport": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryWarReport" + } + } + }, + "type": "object" + }, + "FactionTerritoryOwnership": { + "required": [ + "id", + "owned_by", + "acquired_at" + ], + "properties": { + "id": { + "type": "string" + }, + "owned_by": { "oneOf": [ { - "$ref": "#/components/schemas/UserCurrentEducation" + "$ref": "#/components/schemas/FactionId" + }, + { + "type": "null" + } + ] + }, + "acquired_at": { + "oneOf": [ + { + "type": "integer", + "format": "int32" }, { "type": "null" @@ -19894,724 +16305,522 @@ }, "type": "object" }, - "UserEducationResponse": { + "FactionTerritoriesOwnershipResponse": { "required": [ - "education" + "territoryownership" ], "properties": { - "education": { - "$ref": "#/components/schemas/UserEducation" + "territoryownership": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryOwnership" + } } }, "type": "object" }, - "UserCrimeDetailsBootlegging": { + "TornRacketReward": { "required": [ - "online_store", - "dvd_sales", - "dvd_copies" + "type", + "quantity", + "id" ], "properties": { - "online_store": { - "description": "Online store statistics.", - "required": [ - "earnings", - "visits", - "customers", - "sales" - ], - "properties": { - "earnings": { - "type": "integer", - "format": "int32" + "type": { + "$ref": "#/components/schemas/TornRacketType" + }, + "quantity": { + "type": "integer", + "format": "int32" + }, + "id": { + "oneOf": [ + { + "$ref": "#/components/schemas/ItemId" }, - "visits": { - "type": "integer", - "format": "int32" - }, - "customers": { - "type": "integer", - "format": "int32" - }, - "sales": { - "type": "integer", - "format": "int32" + { + "type": "null" } - }, - "type": "object" + ] + } + }, + "type": "object" + }, + "TornRacket": { + "required": [ + "name", + "level", + "description", + "reward", + "created_at", + "changed_at" + ], + "properties": { + "name": { + "type": "string" }, - "dvd_sales": { - "description": "DVD sales statistics.", - "required": [ - "action", - "comedy", - "drama", - "fantasy", - "horror", - "romance", - "thriller", - "sci_fi", - "total", - "earnings" - ], - "properties": { - "action": { - "type": "integer", - "format": "int32" + "level": { + "type": "integer", + "format": "int32" + }, + "description": { + "type": "string" + }, + "reward": { + "$ref": "#/components/schemas/TornRacketReward" + }, + "created_at": { + "type": "integer", + "format": "int32" + }, + "changed_at": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionRacketsReponse": { + "required": [ + "rackets" + ], + "properties": { + "rackets": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornRacket" + } + } + }, + "type": "object" + }, + "FactionTerritory": { + "required": [ + "id", + "acquired_at", + "sector", + "size", + "density", + "slots", + "respect", + "coordinates", + "racket" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionTerritoryEnum" + }, + "acquired_at": { + "type": "integer", + "format": "int32" + }, + "sector": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "density": { + "type": "integer", + "format": "int32" + }, + "slots": { + "type": "integer", + "format": "int32" + }, + "respect": { + "type": "integer", + "format": "int32" + }, + "coordinates": { + "$ref": "#/components/schemas/TornTerritoryCoordinates" + }, + "racket": { + "oneOf": [ + { + "$ref": "#/components/schemas/TornRacket" }, - "comedy": { - "type": "integer", - "format": "int32" - }, - "drama": { - "type": "integer", - "format": "int32" - }, - "fantasy": { - "type": "integer", - "format": "int32" - }, - "horror": { - "type": "integer", - "format": "int32" - }, - "romance": { - "type": "integer", - "format": "int32" - }, - "thriller": { - "type": "integer", - "format": "int32" - }, - "sci-fi": { - "description": "This is replaced with 'sci_fi' field and will be removed on 1st June 2025.", - "type": "integer", - "format": "int32", - "deprecated": true - }, - "sci_fi": { - "type": "integer", - "format": "int32" - }, - "total": { - "type": "integer", - "format": "int32" - }, - "earnings": { - "type": "integer", - "format": "int32" + { + "type": "null" } - }, - "type": "object" + ] + } + }, + "type": "object" + }, + "FactionTerritoriesReponse": { + "required": [ + "territory" + ], + "properties": { + "territory": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritory" + } + } + }, + "type": "object" + }, + "FactionPosition": { + "required": [ + "name", + "is_default", + "abilities" + ], + "properties": { + "name": { + "type": "string" }, - "dvds_copied": { + "is_default": { + "type": "boolean" + }, + "abilities": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionPositionAbilityEnum" + } + } + }, + "type": "object" + }, + "FactionPositionsResponse": { + "required": [ + "positions" + ], + "properties": { + "positions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionPosition" + } + } + }, + "type": "object" + }, + "FactionUpgradeDetails": { + "required": [ + "id", + "name", + "ability", + "level", + "cost", + "unlockedAt" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionBranchId" + }, + "name": { + "type": "string" + }, + "ability": { + "type": "string" + }, + "level": { + "type": "integer", + "format": "int32" + }, + "cost": { + "type": "integer", + "format": "int32" + }, + "unlocked_at": { "type": "integer", "format": "int32" } }, "type": "object" }, - "UserCrimeDetailsGraffiti": { + "FactionBranchDetails": { "required": [ - "cans_used", - "most_graffiti_in_one_area", - "most_graffiti_simultaneously", - "graffiti_removed", - "cost_to_city" + "name", + "order", + "multiplier", + "upgrades" ], "properties": { - "cans_used": { + "name": { + "type": "string" + }, + "order": { "type": "integer", "format": "int32" }, - "most_graffiti_in_one_area": { + "multiplier": { + "description": "Respect cost multiplier.", "type": "integer", "format": "int32" }, - "most_graffiti_simultaneously": { - "type": "integer", - "format": "int32" - }, - "graffiti_removed": { - "type": "integer", - "format": "int32" - }, - "cost_to_city": { - "type": "integer", - "format": "int32" + "upgrades": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionUpgradeDetails" + } } }, "type": "object" }, - "UserCrimeDetailsShoplifting": { + "FactionUpgrades": { "required": [ - "average_notoriety" + "core", + "peace", + "war" ], "properties": { - "average_notoriety": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "UserCrimeDetailsCardSkimming": { - "required": [ - "card_details", - "skimmers" - ], - "properties": { - "card_details": { - "required": [ - "recoverable", - "recovered", - "sold", - "lost", - "areas" - ], + "core": { "properties": { - "recoverable": { - "type": "integer", - "format": "int32" - }, - "recovered": { - "type": "integer", - "format": "int32" - }, - "sold": { - "type": "integer", - "format": "int32" - }, - "lost": { - "type": "integer", - "format": "int32" - }, - "areas": { + "upgrades": { "type": "array", "items": { - "required": [ - "id", - "amount" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "amount": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" + "$ref": "#/components/schemas/FactionUpgradeDetails" } } }, "type": "object" }, - "skimmers": { - "required": [ - "active", - "most_lucrative", - "oldest_recovered", - "lost" - ], - "properties": { - "active": { - "type": "integer", - "format": "int32" - }, - "most_lucrative": { - "type": "integer", - "format": "int32" - }, - "oldest_recovered": { - "type": "integer", - "format": "int32" - }, - "lost": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" + "peace": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionBranchDetails" + } + }, + "war": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionBranchDetails" + } } }, "type": "object" }, - "UserCrimeDetailsHustling": { + "FactionUpgradesResponse": { "required": [ - "total_audience_gathered", - "biggest_money_won", - "shill_money_collected", - "pickpocket_money_collected" + "upgrades", + "state" ], "properties": { - "total_audience_gathered": { - "type": "integer", - "format": "int32" + "upgrades": { + "$ref": "#/components/schemas/FactionUpgrades" }, - "biggest_money_won": { - "type": "integer", - "format": "int32" - }, - "shill_money_collected": { - "type": "integer", - "format": "int32" - }, - "pickpocket_money_collected": { - "type": "integer", - "format": "int32" + "state": { + "$ref": "#/components/schemas/FactionBranchStateEnum" } }, "type": "object" }, - "UserCrimeDetailsCracking": { + "FactionStat": { "required": [ - "brute_force_cycles", - "encryption_layers_broken", - "highest_mips", - "chars_guessed", - "chars_guessed_total" + "name", + "value" ], "properties": { - "brute_force_cycles": { - "type": "integer", - "format": "int32" + "name": { + "$ref": "#/components/schemas/FactionStatEnum" }, - "encryption_layers_broken": { + "value": { "type": "integer", - "format": "int32" - }, - "highest_mips": { - "type": "integer", - "format": "int32" - }, - "chars_guessed": { - "type": "integer", - "format": "int32" - }, - "chars_guessed_total": { - "type": "integer", - "format": "int32" + "format": "int64" } }, "type": "object" }, - "UserCrimeDetailsScamming": { + "FactionStatsResponse": { "required": [ - "most_responses", - "zones", - "concerns", - "payouts", - "emails" + "stats" ], "properties": { - "most_responses": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "zones": { - "required": [ - "red", - "neutral", - "concern", - "sensitivity", - "temptation", - "hesitation", - "low_reward", - "medium_reward", - "high_reward" - ], - "properties": { - "red": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "neutral": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "concern": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "sensitivity": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "temptation": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "hesitation": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "low_reward": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "medium_reward": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "high_reward": { - "type": "integer", - "format": "int32", - "default": 0 - } - }, - "type": "object" - }, - "concerns": { - "required": [ - "attempts", - "resolved" - ], - "properties": { - "attempts": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "resolved": { - "type": "integer", - "format": "int32", - "default": 0 - } - }, - "type": "object" - }, - "payouts": { - "required": [ - "low", - "medium", - "high" - ], - "properties": { - "low": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "medium": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "high": { - "type": "integer", - "format": "int32", - "default": 0 - } - }, - "type": "object" - }, - "emails": { - "required": [ - "scraper", - "phisher" - ], - "properties": { - "scraper": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "phisher": { - "type": "integer", - "format": "int32", - "default": 0 - } - }, - "type": "object" + "stats": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionStat" + } } }, "type": "object" }, - "UserSubcrime": { + "FactionContributor": { "required": [ "id", - "total", - "success", - "fail" + "username", + "value", + "in_faction" ], "properties": { "id": { - "type": "integer", - "format": "int32" + "$ref": "#/components/schemas/UserId" }, - "total": { - "type": "integer", - "format": "int32" + "username": { + "type": "string" }, - "success": { - "type": "integer", - "format": "int32" - }, - "fail": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "UserCrimeRewardAmmo": { - "required": [ - "standard", - "special" - ], - "properties": { - "standard": { - "type": "integer", - "format": "int32" - }, - "special": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "UserCrimeRewardItem": { - "required": [ - "id", - "amount" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "amount": { - "type": "integer", - "format": "int32" - } - }, - "type": "object" - }, - "UserCrimeRewards": { - "required": [ - "money", - "ammo", - "items" - ], - "properties": { - "money": { + "value": { "type": "integer", "format": "int64" }, - "ammo": { - "$ref": "#/components/schemas/UserCrimeRewardAmmo" - }, - "items": { + "in_faction": { + "type": "boolean" + } + }, + "type": "object" + }, + "FactionContributorsResponse": { + "required": [ + "contributors" + ], + "properties": { + "contributors": { "type": "array", "items": { - "$ref": "#/components/schemas/UserCrimeRewardItem" + "$ref": "#/components/schemas/FactionContributor" } } }, "type": "object" }, - "UserCrimeAttempts": { + "FactionHofStats": { "required": [ - "total", - "success", - "fail", - "critical_fail", - "subcrimes" + "rank", + "respect", + "chain" ], "properties": { - "total": { - "type": "integer", - "format": "int32" + "rank": { + "$ref": "#/components/schemas/HofValueString" }, - "success": { - "type": "integer", - "format": "int32" + "respect": { + "$ref": "#/components/schemas/HofValue" }, - "fail": { - "type": "integer", - "format": "int32" - }, - "critical_fail": { - "type": "integer", - "format": "int32" - }, - "subcrimes": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserSubcrime" - } + "chain": { + "$ref": "#/components/schemas/HofValue" } }, "type": "object" }, - "UserCrimeUniquesRewardMoney": { + "FactionHofResponse": { "required": [ - "min", - "max" + "hof" ], "properties": { - "min": { - "type": "integer", - "format": "int32" - }, - "max": { - "type": "integer", - "format": "int32" + "hof": { + "$ref": "#/components/schemas/FactionHofStats" } }, "type": "object" }, - "UserCrimeUniquesRewardAmmo": { - "required": [ - "amount", - "type" - ], - "properties": { - "amount": { - "type": "integer", - "format": "int32" - }, - "type": { - "$ref": "#/components/schemas/UserCrimeUniquesRewardAmmoEnum" - } - }, - "type": "object" - }, - "UserCrimeUniquesReward": { - "required": [ - "items", - "money", - "ammo" - ], - "properties": { - "items": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserCrimeRewardItem" - } - }, - "money": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserCrimeUniquesRewardMoney" - }, - { - "type": "null" - } - ] - }, - "ammo": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserCrimeUniquesRewardAmmo" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "UserCrimeUniques": { + "FactionMember": { + "description": "Details about a faction member.", "required": [ "id", - "rewards" + "name", + "position", + "level", + "days_in_faction", + "is_revivable", + "is_on_wall", + "is_in_oc", + "has_early_discharge", + "last_action", + "status", + "revive_setting" ], "properties": { "id": { - "description": "Unique result id.", - "type": "integer", - "format": "int64" + "$ref": "#/components/schemas/UserId" }, - "rewards": { - "$ref": "#/components/schemas/UserCrimeUniquesReward" + "name": { + "type": "string" + }, + "position": { + "type": "string" + }, + "level": { + "type": "integer", + "format": "int32" + }, + "days_in_faction": { + "type": "integer", + "format": "int32" + }, + "is_revivable": { + "type": "boolean" + }, + "is_on_wall": { + "description": "Shows if the member is currently defending territory wall.", + "type": "boolean" + }, + "is_in_oc": { + "description": "Shows if the member is currently participating in an organized crime. Show false for members of other factions.", + "type": "boolean" + }, + "has_early_discharge": { + "description": "Shows if the member is eligible for an early discharge from the hospital.", + "type": "boolean" + }, + "last_action": { + "$ref": "#/components/schemas/UserLastAction" + }, + "status": { + "$ref": "#/components/schemas/UserStatus" + }, + "revive_setting": { + "$ref": "#/components/schemas/ReviveSetting" } }, "type": "object" }, - "UserCrimesResponse": { + "UserLastAction": { + "description": "Details about a user's last action.", "required": [ - "crimes" + "status", + "timestamp", + "relative" ], "properties": { - "crimes": { - "$ref": "#/components/schemas/UserCrime" + "status": { + "type": "string" + }, + "timestamp": { + "type": "integer", + "format": "int32" + }, + "relative": { + "type": "string" } }, "type": "object" }, - "UserCrime": { + "UserStatus": { + "description": "Details about a user's status.", "required": [ - "nerve_spent", - "skill", - "progression_bonus", - "rewards", - "attempts", - "uniques", - "miscellaneous" + "description", + "details", + "state", + "until" ], "properties": { - "nerve_spent": { - "type": "integer", - "format": "int32" + "description": { + "type": "string" }, - "skill": { - "type": "integer", - "format": "int32" - }, - "progression_bonus": { - "type": "integer", - "format": "int32" - }, - "rewards": { - "$ref": "#/components/schemas/UserCrimeRewards" - }, - "attempts": { - "$ref": "#/components/schemas/UserCrimeAttempts" - }, - "uniques": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserCrimeUniques" - } - }, - "miscellaneous": { - "description": " Miscellaneous stats for specific crime. Results differ based on the cat id.", + "details": { "oneOf": [ { - "$ref": "#/components/schemas/UserCrimeDetailsBootlegging" + "type": "string" }, { - "$ref": "#/components/schemas/UserCrimeDetailsGraffiti" - }, + "type": "null" + } + ] + }, + "state": { + "type": "string" + }, + "until": { + "oneOf": [ { - "$ref": "#/components/schemas/UserCrimeDetailsShoplifting" - }, - { - "$ref": "#/components/schemas/UserCrimeDetailsCardSkimming" - }, - { - "$ref": "#/components/schemas/UserCrimeDetailsHustling" - }, - { - "$ref": "#/components/schemas/UserCrimeDetailsCracking" - }, - { - "$ref": "#/components/schemas/UserCrimeDetailsScamming" + "type": "integer", + "format": "int32" }, { "type": "null" @@ -20621,16 +16830,481 @@ }, "type": "object" }, - "UserRacesResponse": { + "FactionMembersResponse": { "required": [ - "races", + "members" + ], + "properties": { + "members": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionMember" + } + } + }, + "type": "object" + }, + "FactionRank": { + "required": [ + "level", + "name", + "division", + "position", + "wins" + ], + "properties": { + "level": { + "description": "/**", + "type": "integer", + "format": "int32" + }, + "name": { + "type": "string" + }, + "division": { + "type": "integer", + "format": "int32" + }, + "position": { + "type": "integer", + "format": "int32" + }, + "wins": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionBasic": { + "required": [ + "id", + "name", + "tag", + "tag_image", + "leader_id", + "co_leader_id", + "respect", + "days_old", + "capacity", + "members", + "is_enlisted", + "rank", + "best_chain" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionId" + }, + "name": { + "type": "string" + }, + "tag": { + "type": "string" + }, + "tag_image": { + "type": "string" + }, + "leader_id": { + "$ref": "#/components/schemas/UserId" + }, + "co-leader_id": { + "$ref": "#/components/schemas/UserId", + "description": "This is replaced with 'co_leader_id' field and will be removed on 1st June 2025." + }, + "co_leader_id": { + "$ref": "#/components/schemas/UserId" + }, + "respect": { + "type": "integer", + "format": "int32" + }, + "days_old": { + "type": "integer", + "format": "int32" + }, + "capacity": { + "type": "integer", + "format": "int32" + }, + "members": { + "type": "integer", + "format": "int32" + }, + "is_enlisted": { + "description": "Indicates if the faction is enlisted for ranked wars. Available only with faction AA permissions for your own faction.", + "oneOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ] + }, + "rank": { + "$ref": "#/components/schemas/FactionRank" + }, + "best_chain": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionBasicResponse": { + "required": [ + "basic" + ], + "properties": { + "basic": { + "$ref": "#/components/schemas/FactionBasic" + } + }, + "type": "object" + }, + "FactionPact": { + "required": [ + "faction_id", + "faction_name", + "until" + ], + "properties": { + "faction_id": { + "$ref": "#/components/schemas/FactionId" + }, + "faction_name": { + "type": "string" + }, + "until": { + "description": "The duration until when is the non-aggression pact valid.", + "type": "string" + } + }, + "type": "object" + }, + "FactionRankedWarParticipant": { + "required": [ + "id", + "name", + "score", + "chain" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionId" + }, + "name": { + "type": "string" + }, + "score": { + "type": "integer", + "format": "int32" + }, + "chain": { + "description": "Faction's current chain.", + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionRankedWar": { + "required": [ + "war_id", + "start", + "end", + "target", + "winner", + "factions" + ], + "properties": { + "war_id": { + "type": "integer", + "format": "int32" + }, + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "target": { + "description": "The score target of the war.", + "type": "integer", + "format": "int32" + }, + "winner": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "factions": { + "description": "The factions involved in the ranked war.", + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionRankedWarParticipant" + } + } + }, + "type": "object" + }, + "FactionRaidWarParticipant": { + "required": [ + "id", + "name", + "score", + "chain", + "is_aggressor" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionId" + }, + "name": { + "type": "string" + }, + "score": { + "type": "integer", + "format": "int32" + }, + "chain": { + "description": "Faction's current chain.", + "type": "integer", + "format": "int32" + }, + "is_aggressor": { + "type": "boolean" + } + }, + "type": "object" + }, + "FactionRaidWar": { + "required": [ + "war_id", + "start", + "end", + "factions" + ], + "properties": { + "war_id": { + "type": "integer", + "format": "int32" + }, + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "factions": { + "description": "The factions involved in the raid war.", + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionRaidWarParticipant" + } + } + }, + "type": "object" + }, + "FactionTerritoryWarParticipant": { + "required": [ + "id", + "name", + "score", + "chain", + "is_aggressor", + "playerIds" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionId" + }, + "name": { + "type": "string" + }, + "score": { + "type": "integer", + "format": "int32" + }, + "chain": { + "description": "Faction's current chain.", + "type": "integer", + "format": "int32" + }, + "is_aggressor": { + "type": "boolean" + }, + "playerIds": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserId" + } + } + }, + "type": "object" + }, + "FactionTerritoryWar": { + "required": [ + "war_id", + "territory", + "start", + "end", + "target", + "factions" + ], + "properties": { + "war_id": { + "type": "integer", + "format": "int32" + }, + "territory": { + "type": "string" + }, + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "target": { + "description": "The score target of the war.", + "type": "integer", + "format": "int32" + }, + "winner": { + "oneOf": [ + { + "$ref": "#/components/schemas/FactionId" + }, + { + "type": "null" + } + ] + }, + "factions": { + "description": "The factions involved in the territory war.", + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryWarParticipant" + } + } + }, + "type": "object" + }, + "FactionWars": { + "required": [ + "ranked", + "raids", + "territory" + ], + "properties": { + "ranked": { + "oneOf": [ + { + "$ref": "#/components/schemas/FactionRankedWar" + }, + { + "type": "null" + } + ] + }, + "raids": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionRaidWar" + } + }, + "territory": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryWar" + } + } + }, + "type": "object" + }, + "FactionWarsResponse": { + "required": [ + "pacts", + "wars" + ], + "properties": { + "pacts": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionPact" + } + }, + "wars": { + "$ref": "#/components/schemas/FactionWars" + } + }, + "type": "object" + }, + "FactionNews": { + "required": [ + "id", + "text", + "timestamp" + ], + "properties": { + "id": { + "type": "string" + }, + "text": { + "type": "string" + }, + "timestamp": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionNewsResponse": { + "required": [ + "news", "_metadata" ], "properties": { - "races": { + "news": { "type": "array", "items": { - "$ref": "#/components/schemas/RacingRaceDetailsResponse" + "$ref": "#/components/schemas/FactionNews" } }, "_metadata": { @@ -20639,87 +17313,1657 @@ }, "type": "object" }, - "UserRaceCarDetails": { - "allOf": [ - { + "FactionAttacksResponse": { + "required": [ + "attacks", + "_metadata" + ], + "properties": { + "attacks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Attack" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "FactionAttacksFullResponse": { + "required": [ + "attacks", + "_metadata" + ], + "properties": { + "attacks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AttackSimplified" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "FactionApplication": { + "required": [ + "id", + "user", + "message", + "valid_until", + "status" + ], + "properties": { + "id": { + "description": "application id", + "type": "integer", + "format": "int32" + }, + "user": { "required": [ "id", "name", - "worth", - "points_spent", - "races_entered", - "races_won", - "is_removed", - "parts" + "level", + "stats" ], "properties": { "id": { - "$ref": "#/components/schemas/RaceCarId" + "$ref": "#/components/schemas/UserId" }, "name": { - "oneOf": [ - { - "type": "string" + "type": "string" + }, + "level": { + "type": "integer", + "format": "int32" + }, + "stats": { + "required": [ + "strength", + "speed", + "dexterity", + "defense" + ], + "properties": { + "strength": { + "type": "integer", + "format": "int64" }, - { - "type": "null" + "speed": { + "type": "integer", + "format": "int64" + }, + "dexterity": { + "type": "integer", + "format": "int64" + }, + "defense": { + "type": "integer", + "format": "int64" } - ] - }, - "worth": { - "type": "integer", - "format": "int64" - }, - "points_spent": { - "type": "integer", - "format": "int32" - }, - "races_entered": { - "type": "integer", - "format": "int32" - }, - "races_won": { - "type": "integer", - "format": "int32" - }, - "is_removed": { - "type": "boolean" - }, - "parts": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RaceCarUpgradeId" - } + }, + "type": "object" } }, "type": "object" }, - { - "$ref": "#/components/schemas/RaceCar" + "message": { + "type": "string" + }, + "valid_until": { + "type": "integer", + "format": "int32" + }, + "status": { + "$ref": "#/components/schemas/FactionApplicationStatusEnum" } - ] + }, + "type": "object" }, - "UserEnlistedCarsResponse": { + "FactionApplicationsResponse": { "required": [ - "enlistedcars" + "applications" ], "properties": { - "enlistedcars": { + "applications": { "type": "array", "items": { - "$ref": "#/components/schemas/UserRaceCarDetails" + "$ref": "#/components/schemas/FactionApplication" } } }, "type": "object" }, - "UserForumPostsResponse": { + "FactionOngoingChain": { "required": [ - "forumPosts", + "id", + "current", + "max", + "timeout", + "modifier", + "cooldown", + "start", + "end" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ChainId" + }, + "current": { + "type": "integer", + "format": "int32" + }, + "max": { + "type": "integer", + "format": "int32" + }, + "timeout": { + "description": "Seconds until chain breaks.", + "type": "integer", + "format": "int32" + }, + "modifier": { + "type": "number", + "format": "float" + }, + "cooldown": { + "description": "Timestamp until when chain is on cooldown.", + "type": "integer", + "format": "int32" + }, + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionOngoingChainResponse": { + "required": [ + "chain" + ], + "properties": { + "chain": { + "$ref": "#/components/schemas/FactionOngoingChain" + } + }, + "type": "object" + }, + "FactionChain": { + "required": [ + "id", + "chain", + "respect", + "start", + "end" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ChainId" + }, + "chain": { + "type": "integer", + "format": "int32" + }, + "respect": { + "type": "number", + "format": "float" + }, + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionChainsResponse": { + "required": [ + "chains", "_metadata" ], "properties": { - "forumPosts": { + "chains": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionChain" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "FactionChainReportResponse": { + "required": [ + "chainreport" + ], + "properties": { + "chainreport": { + "$ref": "#/components/schemas/FactionChainReport" + } + }, + "type": "object" + }, + "FactionChainReport": { + "required": [ + "id", + "faction_id", + "start", + "end", + "details", + "bonuses", + "attackers", + "non_attackers" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ChainId" + }, + "faction_id": { + "$ref": "#/components/schemas/FactionId" + }, + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "type": "integer", + "format": "int32" + }, + "details": { + "$ref": "#/components/schemas/FactionChainReportDetails" + }, + "bonuses": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionChainReportBonus" + } + }, + "attackers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionChainReportAttacker" + } + }, + "non-attackers": { + "description": "This is replaced with 'non_attackers' field and will be removed on 1st June 2025.", + "type": "array", + "items": { + "$ref": "#/components/schemas/UserId" + }, + "deprecated": true + }, + "non_attackers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserId" + } + } + }, + "type": "object" + }, + "FactionChainReportDetails": { + "required": [ + "chain", + "respect", + "members", + "targets", + "war", + "best", + "leave", + "mug", + "hospitalize", + "assists", + "retaliations", + "overseas", + "draws", + "escapes", + "losses" + ], + "properties": { + "chain": { + "type": "integer", + "format": "int32" + }, + "respect": { + "type": "number", + "format": "float" + }, + "members": { + "type": "integer", + "format": "int32" + }, + "targets": { + "type": "integer", + "format": "int32" + }, + "war": { + "type": "integer", + "format": "int32" + }, + "best": { + "type": "number", + "format": "float" + }, + "leave": { + "type": "integer", + "format": "int32" + }, + "mug": { + "type": "integer", + "format": "int32" + }, + "hospitalize": { + "type": "integer", + "format": "int32" + }, + "assists": { + "type": "integer", + "format": "int32" + }, + "retaliations": { + "type": "integer", + "format": "int32" + }, + "overseas": { + "type": "integer", + "format": "int32" + }, + "draws": { + "type": "integer", + "format": "int32" + }, + "escapes": { + "type": "integer", + "format": "int32" + }, + "losses": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionChainReportBonus": { + "required": [ + "attacker_id", + "defender_id", + "chain", + "respect" + ], + "properties": { + "attacker_id": { + "$ref": "#/components/schemas/UserId" + }, + "defender_id": { + "$ref": "#/components/schemas/UserId" + }, + "chain": { + "type": "integer", + "format": "int32" + }, + "respect": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionChainReportAttacker": { + "required": [ + "id", + "respect", + "attacks" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "respect": { + "$ref": "#/components/schemas/FactionChainReportAttackerRespect" + }, + "attacks": { + "$ref": "#/components/schemas/FactionChainReportAttackerAttacks" + } + }, + "type": "object" + }, + "FactionChainReportAttackerRespect": { + "required": [ + "total", + "average", + "best" + ], + "properties": { + "total": { + "type": "number", + "format": "float" + }, + "average": { + "type": "number", + "format": "float" + }, + "best": { + "type": "number", + "format": "float" + } + }, + "type": "object" + }, + "FactionChainReportAttackerAttacks": { + "required": [ + "total", + "leave", + "mug", + "hospitalize", + "assists", + "retaliations", + "overseas", + "draws", + "escpaces", + "losses", + "war", + "bonuses" + ], + "properties": { + "total": { + "type": "integer", + "format": "int32" + }, + "leave": { + "type": "integer", + "format": "int32" + }, + "mug": { + "type": "integer", + "format": "int32" + }, + "hospitalize": { + "type": "integer", + "format": "int32" + }, + "assists": { + "type": "integer", + "format": "int32" + }, + "retaliations": { + "type": "integer", + "format": "int32" + }, + "overseas": { + "type": "integer", + "format": "int32" + }, + "draws": { + "type": "integer", + "format": "int32" + }, + "escapes": { + "type": "integer", + "format": "int32" + }, + "losses": { + "type": "integer", + "format": "int32" + }, + "war": { + "type": "integer", + "format": "int32" + }, + "bonuses": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionCrimeUser": { + "required": [ + "id", + "outcome", + "joined_at", + "progress" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "outcome": { + "description": "This field will be null for old crimes.", + "oneOf": [ + { + "$ref": "#/components/schemas/FactionCrimeUserOutcome" + }, + { + "type": "null" + } + ] + }, + "joined_at": { + "description": "The timestamp at which the user joined the slot.", + "type": "integer", + "format": "int32" + }, + "progress": { + "description": "Current planning progress on the slot.", + "type": "number", + "format": "float" + } + }, + "type": "object" + }, + "FactionCrimeRewardItem": { + "required": [ + "id", + "quantity" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ItemId" + }, + "quantity": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionCrimeRewardPayout": { + "required": [ + "type", + "percentage", + "paid_by", + "paid_at" + ], + "properties": { + "type": { + "$ref": "#/components/schemas/FactionOrganizedCrimePayoutType" + }, + "percentage": { + "description": "Total percentage split between all participants.", + "type": "integer", + "format": "int32" + }, + "paid_by": { + "$ref": "#/components/schemas/UserId" + }, + "paid_at": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionCrimeReward": { + "required": [ + "money", + "items", + "respect", + "payout", + "scope" + ], + "properties": { + "money": { + "type": "integer", + "format": "int32" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionCrimeRewardItem" + } + }, + "respect": { + "type": "integer", + "format": "int32" + }, + "scope": { + "type": "integer", + "format": "int32" + }, + "payout": { + "description": "Details about the crime payouts. This field is null if the crime has not been paid via the automatic payouts system.", + "oneOf": [ + { + "$ref": "#/components/schemas/FactionCrimeRewardPayout" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "FactionCrimeSlot": { + "required": [ + "position", + "item_requirement", + "user", + "checkpoint_pass_rate" + ], + "properties": { + "position": { + "type": "string" + }, + "item_requirement": { + "description": "Details of item required for the slot, if applicable.", + "oneOf": [ + { + "required": [ + "id", + "is_reusable", + "is_available" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ItemId" + }, + "is_reusable": { + "description": "Shows if the item is reusable or consumed during the crime.", + "type": "boolean" + }, + "is_available": { + "description": "Shows if user has the required item.", + "type": "boolean" + } + }, + "type": "object" + }, + { + "type": "null" + } + ] + }, + "user": { + "description": "Details about the user joined the slot, if any.", + "oneOf": [ + { + "$ref": "#/components/schemas/FactionCrimeUser" + }, + { + "type": "null" + } + ] + }, + "checkpoint_pass_rate": { + "description": "Returns CPR for the player who joined the slot. If the slot is empty (availalbe), it shows your CPR for that slot. This value is 0 for expired crimes.", + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "FactionCrime": { + "required": [ + "id", + "name", + "previous_crime_id", + "difficulty", + "status", + "created_at", + "planning_at", + "ready_at", + "expired_at", + "executed_at", + "slots", + "rewards" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionCrimeId" + }, + "previous_crime_id": { + "oneOf": [ + { + "$ref": "#/components/schemas/FactionCrimeId" + }, + { + "type": "null" + } + ] + }, + "name": { + "type": "string" + }, + "difficulty": { + "type": "integer", + "format": "int32" + }, + "status": { + "$ref": "#/components/schemas/FactionCrimeStatusEnum" + }, + "created_at": { + "description": "The timestamp at which the crime was created.", + "type": "integer", + "format": "int32" + }, + "planning_at": { + "description": "The timestamp at which the planning phase for the crime has begun.", + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "ready_at": { + "description": "The timestamp at which the crime will be ready.", + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "expired_at": { + "description": "The timestamp at which the crime will expire.", + "type": "integer", + "format": "int32" + }, + "executed_at": { + "description": "The timestamp at which the crime was executed.
Note: this value is null for all crimes executed before January 15th, 2025.", + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "slots": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionCrimeSlot" + } + }, + "rewards": { + "description": "Details about the crime rewards. Available only for crimes with 'Successful' status.", + "oneOf": [ + { + "$ref": "#/components/schemas/FactionCrimeReward" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "FactionCrimesResponse": { + "required": [ + "crimes", + "_metadata" + ], + "properties": { + "crimes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionCrime" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "FactionCrimeResponse": { + "required": [ + "crime" + ], + "properties": { + "crime": { + "$ref": "#/components/schemas/FactionCrime" + } + }, + "type": "object" + }, + "FactionBalance": { + "required": [ + "faction", + "members" + ], + "properties": { + "faction": { + "required": [ + "money", + "points", + "scope" + ], + "properties": { + "money": { + "type": "integer", + "format": "int64" + }, + "points": { + "type": "integer", + "format": "int64" + }, + "scope": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "members": { + "type": "array", + "items": { + "required": [ + "id", + "username", + "money", + "points" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "username": { + "type": "string" + }, + "money": { + "type": "integer", + "format": "int64" + }, + "points": { + "type": "integer", + "format": "int64" + } + }, + "type": "object" + } + } + }, + "type": "object" + }, + "FactionBalanceResponse": { + "required": [ + "balance" + ], + "properties": { + "balance": { + "$ref": "#/components/schemas/FactionBalance" + } + }, + "type": "object" + }, + "FactionSelectionName": { + "description": "The following selections will fallback to API v1 and may change at any time: 'armor', 'boosters', 'caches', 'cesium', 'crimeexp', 'drugs', 'medical', 'positions', 'reports', 'temporary', 'weapons'.\n * The following selections are not available in API v2: 'armorynews', 'attacknews', 'crimenews', 'currency', 'donations', 'fundsnews', 'mainnews', 'membershipnews', 'territorynews'.", + "type": "string", + "enum": [ + "applications", + "attacks", + "attacksfull", + "balance", + "basic", + "chain", + "chainreport", + "chains", + "contributors", + "crime", + "crimes", + "hof", + "lookup", + "members", + "news", + "rackets", + "rankedwars", + "rankedwarreport", + "revives", + "revivesfull", + "stats", + "territory", + "territoryownership", + "territorywarreport", + "territorywars", + "timestamp", + "upgrades", + "wars", + "armor", + "boosters", + "caches", + "cesium", + "crimeexp", + "drugs", + "medical", + "positions", + "reports", + "temporary", + "weapons", + "armorynews", + "attacknews", + "crimenews", + "currency", + "donations", + "fundsnews", + "mainnews", + "membershipnews", + "territorynews" + ] + }, + "FactionLookupResponse": { + "required": [ + "selections" + ], + "properties": { + "selections": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionSelectionName" + } + } + }, + "type": "object" + }, + "FactionRankedWarDetails": { + "required": [ + "id", + "start", + "end", + "target", + "winner", + "factions" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/RankedWarId" + }, + "start": { + "description": "Timestamp the war started at.", + "type": "integer", + "format": "int32" + }, + "end": { + "description": "Timestamp the war ended at.", + "type": "integer", + "format": "int32" + }, + "target": { + "type": "integer", + "format": "int32" + }, + "winner": { + "oneOf": [ + { + "$ref": "#/components/schemas/FactionId" + }, + { + "type": "null" + } + ] + }, + "factions": { + "type": "array", + "items": { + "required": [ + "id", + "name", + "score", + "chain" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionId" + }, + "name": { + "type": "string" + }, + "score": { + "type": "integer", + "format": "int32" + }, + "chain": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + } + }, + "type": "object" + }, + "FactionRankedWarResponse": { + "required": [ + "rankedwars", + "_metadata" + ], + "properties": { + "rankedwars": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionRankedWarDetails" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "FactionRankedWarReportResponse": { + "required": [ + "rankedwarreport" + ], + "properties": { + "rankedwarreport": { + "required": [ + "id", + "start", + "end", + "winner", + "forfeit", + "factions" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/RankedWarId" + }, + "start": { + "description": "Timestamp the war started at.", + "type": "integer", + "format": "int32" + }, + "end": { + "description": "Timestamp the war ended at.", + "type": "integer", + "format": "int32" + }, + "winner": { + "$ref": "#/components/schemas/FactionId" + }, + "forfeit": { + "type": "boolean" + }, + "factions": { + "type": "array", + "items": { + "required": [ + "id", + "name", + "score", + "attacks", + "rank", + "rewards", + "members" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionId" + }, + "name": { + "type": "string" + }, + "score": { + "type": "integer", + "format": "int32" + }, + "attacks": { + "type": "integer", + "format": "int32" + }, + "rank": { + "required": [ + "before", + "after" + ], + "properties": { + "before": { + "type": "string" + }, + "after": { + "type": "string" + } + }, + "type": "object" + }, + "rewards": { + "required": [ + "respect", + "points", + "items" + ], + "properties": { + "respect": { + "type": "integer", + "format": "int32" + }, + "points": { + "type": "integer", + "format": "int32" + }, + "items": { + "type": "array", + "items": { + "required": [ + "id", + "name", + "quantity" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ItemId" + }, + "name": { + "type": "string" + }, + "quantity": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + } + }, + "type": "object" + }, + "members": { + "type": "array", + "items": { + "required": [ + "id", + "name", + "level", + "attacks", + "score" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "name": { + "type": "string" + }, + "level": { + "type": "integer", + "format": "int32" + }, + "attacks": { + "type": "integer", + "format": "int32" + }, + "score": { + "type": "number", + "format": "float" + } + }, + "type": "object" + } + } + }, + "type": "object" + } + } + }, + "type": "object" + } + }, + "type": "object" + }, + "ForumCategoriesResponse": { + "required": [ + "categories" + ], + "properties": { + "categories": { + "type": "array", + "items": { + "required": [ + "id", + "title", + "acronym", + "threads" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ForumId" + }, + "title": { + "type": "string" + }, + "acronym": { + "type": "string" + }, + "threads": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + } + }, + "type": "object" + }, + "ForumThreadAuthor": { + "required": [ + "id", + "username", + "karma" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "username": { + "type": "string" + }, + "karma": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "ForumPollVote": { + "required": [ + "answer", + "votes" + ], + "properties": { + "answer": { + "type": "string" + }, + "votes": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "ForumPoll": { + "required": [ + "question", + "answers_count", + "answers" + ], + "properties": { + "question": { + "type": "string" + }, + "answers_count": { + "type": "integer", + "format": "int32" + }, + "answers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ForumPollVote" + } + } + }, + "type": "object" + }, + "ForumThreadBase": { + "required": [ + "id", + "title", + "forum_id", + "posts", + "rating", + "views", + "author", + "last_poster", + "first_post_time", + "last_post_time", + "has_poll", + "is_locked", + "is_sticky" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ForumThreadId" + }, + "title": { + "type": "string" + }, + "forum_id": { + "$ref": "#/components/schemas/ForumId" + }, + "posts": { + "type": "integer", + "format": "int32" + }, + "rating": { + "type": "integer", + "format": "int32" + }, + "views": { + "description": "Total number of times players have opened this thread.", + "type": "integer", + "format": "int32" + }, + "author": { + "$ref": "#/components/schemas/ForumThreadAuthor" + }, + "last_poster": { + "oneOf": [ + { + "$ref": "#/components/schemas/ForumThreadAuthor" + }, + { + "type": "null" + } + ] + }, + "first_post_time": { + "type": "integer", + "format": "int32" + }, + "last_post_time": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "has_poll": { + "type": "boolean" + }, + "is_locked": { + "type": "boolean" + }, + "is_sticky": { + "type": "boolean" + } + }, + "type": "object" + }, + "ForumThreadExtended": { + "allOf": [ + { + "$ref": "#/components/schemas/ForumThreadBase" + }, + { + "required": [ + "content", + "content_raw", + "poll" + ], + "properties": { + "content": { + "type": "string" + }, + "content_raw": { + "type": "string" + }, + "poll": { + "description": "'poll' is null when 'has_poll' is false.", + "oneOf": [ + { + "$ref": "#/components/schemas/ForumPoll" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + } + ] + }, + "ForumPost": { + "required": [ + "id", + "thread_id", + "author", + "is_legacy", + "is_topic", + "is_edited", + "is_pinned", + "created_time", + "edited_by", + "has_quote", + "quoted_post_id", + "content", + "likes", + "dislikes" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ForumPostId" + }, + "thread_id": { + "$ref": "#/components/schemas/ForumThreadId" + }, + "author": { + "$ref": "#/components/schemas/ForumThreadAuthor" + }, + "is_legacy": { + "description": "Indicates whether post was made using the old formatting engine which doesn't use HTML.", + "type": "boolean" + }, + "is_topic": { + "type": "boolean" + }, + "is_edited": { + "type": "boolean" + }, + "is_pinned": { + "type": "boolean" + }, + "created_time": { + "type": "integer", + "format": "int32" + }, + "edited_by": { + "description": "'edited_by' is null when 'is_edited' is false.", + "oneOf": [ + { + "$ref": "#/components/schemas/UserId" + }, + { + "type": "null" + } + ] + }, + "has_quote": { + "type": "boolean" + }, + "quoted_post_id": { + "description": "'quoted_post_id' is null when 'has_quote' is false.", + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "content": { + "description": "depending on the input 'cat' parameter, this will either return raw value (with HTML) or plain text. Legacy posts are returned as is, they can't be stripped of tags.", + "type": "string" + }, + "likes": { + "type": "integer", + "format": "int32" + }, + "dislikes": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "ForumThreadUserExtended": { + "allOf": [ + { + "$ref": "#/components/schemas/ForumThreadBase" + }, + { + "required": [ + "new_posts" + ], + "properties": { + "new_posts": { + "description": "Available only when requesting data for yourself (no id or your id) with at least 'Minimal' access type key.", + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + } + ] + }, + "ForumSubscribedThreadPostsCount": { + "required": [ + "new", + "total" + ], + "properties": { + "new": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "ForumSubscribedThread": { + "required": [ + "id", + "forum_id", + "author", + "title", + "posts" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ForumThreadId" + }, + "forum_id": { + "$ref": "#/components/schemas/ForumId" + }, + "author": { + "$ref": "#/components/schemas/ForumThreadAuthor" + }, + "title": { + "type": "string" + }, + "posts": { + "$ref": "#/components/schemas/ForumSubscribedThreadPostsCount" + } + }, + "type": "object" + }, + "ForumFeed": { + "required": [ + "thread_id", + "post_id", + "user", + "title", + "text", + "timestamp", + "is_seen", + "type" + ], + "properties": { + "thread_id": { + "$ref": "#/components/schemas/ForumThreadId" + }, + "post_id": { + "$ref": "#/components/schemas/ForumPostId" + }, + "user": { + "$ref": "#/components/schemas/ForumThreadAuthor" + }, + "title": { + "type": "string" + }, + "text": { + "type": "string" + }, + "timestamp": { + "type": "integer", + "format": "int32" + }, + "is_seen": { + "type": "boolean" + }, + "type": { + "$ref": "#/components/schemas/ForumFeedTypeEnum" + } + }, + "type": "object" + }, + "ForumThreadsResponse": { + "required": [ + "threads", + "_metadata" + ], + "properties": { + "threads": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ForumThreadBase" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "ForumThreadResponse": { + "required": [ + "thread" + ], + "properties": { + "thread": { + "$ref": "#/components/schemas/ForumThreadExtended" + } + }, + "type": "object" + }, + "ForumPostsResponse": { + "required": [ + "posts", + "_metadata" + ], + "properties": { + "posts": { "type": "array", "items": { "$ref": "#/components/schemas/ForumPost" @@ -20731,284 +18975,309 @@ }, "type": "object" }, - "UserForumThreadsResponse": { - "required": [ - "forumThreads", - "_metadata" - ], - "properties": { - "forumThreads": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ForumThreadUserExtended" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" + "ForumSelectionName": { + "type": "string", + "enum": [ + "categories", + "lookup", + "posts", + "thread", + "threads", + "timestamp" + ] }, - "UserForumSubscribedThreadsResponse": { + "ForumLookupResponse": { "required": [ - "forumSbuscribedThreads" + "selections" ], "properties": { - "forumSubscribedThreads": { + "selections": { "type": "array", "items": { - "$ref": "#/components/schemas/ForumSubscribedThread" + "$ref": "#/components/schemas/ForumSelectionName" } } }, "type": "object" }, - "UserForumFeedResponse": { + "KeyLogResponse": { "required": [ - "forumFeed" + "log" ], "properties": { - "forumFeed": { + "log": { "type": "array", "items": { - "$ref": "#/components/schemas/ForumFeed" + "required": [ + "timestamp", + "type", + "selections", + "id", + "ip" + ], + "properties": { + "timestamp": { + "type": "integer", + "format": "int32" + }, + "type": { + "type": "string" + }, + "selections": { + "type": "string" + }, + "id": { + "oneOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "null" + } + ] + }, + "comment": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "ip": { + "type": "string" + } + }, + "type": "object" } } }, "type": "object" }, - "UserForumFriendsResponse": { + "KeyInfoResponse": { "required": [ - "forumFriends" + "info" ], "properties": { - "forumFriends": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ForumFeed" - } + "info": { + "required": [ + "selections", + "access" + ], + "properties": { + "selections": { + "required": [ + "company", + "faction", + "market", + "property", + "torn", + "user", + "racing", + "forum", + "key" + ], + "properties": { + "company": { + "type": "array", + "items": { + "type": "string" + } + }, + "faction": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionSelectionName" + } + }, + "market": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MarketSelectionName" + } + }, + "property": { + "type": "array", + "items": { + "type": "string" + } + }, + "torn": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornSelectionName" + } + }, + "user": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserSelectionName" + } + }, + "racing": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RacingSelectionName" + } + }, + "forum": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ForumSelectionName" + } + }, + "key": { + "type": "array", + "items": { + "$ref": "#/components/schemas/KeySelectionName" + } + } + }, + "type": "object" + }, + "access": { + "required": [ + "level", + "type", + "faction", + "company" + ], + "properties": { + "level": { + "type": "integer", + "format": "int32" + }, + "type": { + "$ref": "#/components/schemas/ApiKeyAccessTypeEnum" + }, + "faction": { + "type": "boolean" + }, + "faction_id": { + "oneOf": [ + { + "$ref": "#/components/schemas/FactionId" + }, + { + "type": "null" + } + ] + }, + "company": { + "type": "boolean" + }, + "company_id": { + "oneOf": [ + { + "$ref": "#/components/schemas/CompanyId" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + } + }, + "type": "object" } }, "type": "object" }, - "HofValue": { + "KeySelectionName": { + "type": "string", + "enum": [ + "info", + "log" + ] + }, + "ItemMarketListingItemBonus": { "required": [ - "value", - "rank" + "id", + "title", + "description", + "value" ], "properties": { - "value": { + "id": { "type": "integer", - "format": "int64" + "format": "int32" }, - "rank": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "value": { "type": "integer", "format": "int32" } }, "type": "object" }, - "HofValueString": { + "ItemMarketListingItemStats": { "required": [ - "value", - "rank" + "damage", + "accuracy", + "armor", + "quality" ], "properties": { - "value": { - "type": "string" - }, - "rank": { + "damage": { "oneOf": [ { "type": "number", - "format": "int32" + "format": "float" }, { "type": "null" } ] - } - }, - "type": "object" - }, - "UserHofStats": { - "required": [ - "attacks", - "busts", - "defends", - "networth", - "offences", - "revives", - "level", - "rank", - "awards", - "racing_skill", - "racing_points", - "racing_wins", - "travel_time", - "working_stats", - "battle_stats" - ], - "properties": { - "attacks": { - "$ref": "#/components/schemas/HofValue" }, - "busts": { - "$ref": "#/components/schemas/HofValue" - }, - "defends": { - "$ref": "#/components/schemas/HofValue" - }, - "networth": { - "$ref": "#/components/schemas/HofValue" - }, - "offences": { - "$ref": "#/components/schemas/HofValue" - }, - "revives": { - "$ref": "#/components/schemas/HofValue" - }, - "level": { - "$ref": "#/components/schemas/HofValue" - }, - "rank": { - "$ref": "#/components/schemas/HofValue" - }, - "awards": { - "$ref": "#/components/schemas/HofValue" - }, - "racing_skill": { - "$ref": "#/components/schemas/HofValue" - }, - "racing_points": { - "$ref": "#/components/schemas/HofValue" - }, - "racing_wins": { - "$ref": "#/components/schemas/HofValue" - }, - "travel_time": { - "$ref": "#/components/schemas/HofValue" - }, - "working_stats": { - "$ref": "#/components/schemas/HofValue" - }, - "battle_stats": { + "accuracy": { "oneOf": [ { - "$ref": "#/components/schemas/HofValue" + "type": "number", + "format": "float" }, { "type": "null" } ] - } - }, - "type": "object" - }, - "UserHofResponse": { - "required": [ - "hof" - ], - "properties": { - "hof": { - "$ref": "#/components/schemas/UserHofStats" - } - }, - "type": "object" - }, - "UserCalendar": { - "required": [ - "start_time" - ], - "properties": { - "start_time": { - "description": "Event start time displayed in TCT.", - "type": "string" - } - }, - "type": "object" - }, - "UserCalendarResponse": { - "required": [ - "calendar" - ], - "properties": { - "calendar": { - "$ref": "#/components/schemas/UserCalendar" - } - }, - "type": "object" - }, - "UserBountiesResponse": { - "required": [ - "bounties" - ], - "properties": { - "bounties": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Bounty" - } - } - }, - "type": "object" - }, - "UserJobRanks": { - "required": [ - "army", - "grocer", - "casino", - "medical", - "law", - "education" - ], - "properties": { - "army": { - "$ref": "#/components/schemas/JobPositionArmyEnum" }, - "grocer": { - "$ref": "#/components/schemas/JobPositionGrocerEnum" + "armor": { + "oneOf": [ + { + "type": "number", + "format": "float" + }, + { + "type": "null" + } + ] }, - "casino": { - "$ref": "#/components/schemas/JobPositionCasinoEnum" - }, - "medical": { - "$ref": "#/components/schemas/JobPositionMedicalEnum" - }, - "law": { - "$ref": "#/components/schemas/JobPositionLawEnum" - }, - "education": { - "$ref": "#/components/schemas/JobPositionEducationEnum" + "quality": { + "type": "number", + "format": "float" } }, "type": "object" }, - "UserJobRanksResponse": { - "required": [ - "jobranks" - ], - "properties": { - "jobranks": { - "$ref": "#/components/schemas/UserJobRanks" - } - }, - "type": "object" - }, - "UserItemMarkeListingItemDetails": { + "ItemMarketItem": { "required": [ "id", "name", "type", - "rarity", - "uid", - "stats", - "bonuses" + "average_price" ], "properties": { "id": { - "type": "integer", - "format": "int64" + "$ref": "#/components/schemas/ItemId" }, "name": { "type": "string" @@ -21016,6 +19285,50 @@ "type": { "type": "string" }, + "average_price": { + "type": "integer", + "format": "int64" + } + }, + "type": "object" + }, + "ItemMarketListingStackable": { + "required": [ + "price", + "amount" + ], + "properties": { + "price": { + "type": "integer", + "format": "int64" + }, + "amount": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "ItemMarketListingItemDetails": { + "required": [ + "uid", + "stats", + "bonuses", + "rarity" + ], + "properties": { + "uid": { + "$ref": "#/components/schemas/ItemUid" + }, + "stats": { + "$ref": "#/components/schemas/ItemMarketListingItemStats" + }, + "bonuses": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ItemMarketListingItemBonus" + } + }, "rarity": { "oneOf": [ { @@ -21030,88 +19343,64 @@ "type": "null" } ] - }, - "uid": { - "oneOf": [ - { - "$ref": "#/components/schemas/ItemUid" - }, - { - "type": "null" - } - ] - }, - "stats": { - "oneOf": [ - { - "$ref": "#/components/schemas/ItemMarketListingItemStats" - }, - { - "type": "null" - } - ] - }, - "bonuses": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ItemMarketListingItemBonus" - } } }, "type": "object" }, - "UserItemMarketListing": { + "ItemMarketListingNonstackable": { "required": [ - "id", "price", - "average_price", "amount", - "is_anonymous", - "available", - "item" + "item_details" ], "properties": { - "id": { - "type": "integer", - "format": "int64" - }, "price": { "type": "integer", "format": "int64" }, - "average_price": { - "type": "integer", - "format": "int64" - }, "amount": { "type": "integer", "format": "int32" }, - "is_anonymous": { - "type": "boolean" - }, - "available": { - "description": "Amount remaining in the inventory.", - "type": "integer", - "format": "int32" - }, - "item": { - "$ref": "#/components/schemas/UserItemMarkeListingItemDetails" + "item_details": { + "$ref": "#/components/schemas/ItemMarketListingItemDetails" } }, "type": "object" }, - "UserItemMarketResponse": { + "ItemMarket": { + "required": [ + "item", + "listings" + ], + "properties": { + "item": { + "$ref": "#/components/schemas/ItemMarketItem" + }, + "listings": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/ItemMarketListingNonstackable" + }, + { + "$ref": "#/components/schemas/ItemMarketListingStackable" + } + ] + } + } + }, + "type": "object" + }, + "MarketItemMarketResponse": { "required": [ "itemmarket", "_metadata" ], "properties": { "itemmarket": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserItemMarketListing" - } + "$ref": "#/components/schemas/ItemMarket" }, "_metadata": { "$ref": "#/components/schemas/RequestMetadataWithLinks" @@ -21119,183 +19408,18 @@ }, "type": "object" }, - "UserFactionBalance": { - "required": [ - "money", - "points" - ], - "properties": { - "money": { - "type": "integer", - "format": "int64" - }, - "points": { - "type": "integer", - "format": "int64" - } - }, - "type": "object" - }, - "UserFactionBalanceResponse": { - "required": [ - "factionBalance" - ], - "properties": { - "factionBalance": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserFactionBalance" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "UserOrganizedCrimeResponse": { - "required": [ - "organizedCrime" - ], - "properties": { - "organizedCrime": { - "oneOf": [ - { - "$ref": "#/components/schemas/FactionCrime" - }, - { - "type": "null" - } - ] - } - }, - "type": "object" - }, - "UserList": { - "required": [ - "id", - "name", - "level", - "faction_id", - "last_action", - "status" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/UserId" - }, - "name": { - "type": "string" - }, - "level": { - "type": "integer", - "format": "int32" - }, - "faction_id": { - "oneOf": [ - { - "$ref": "#/components/schemas/FactionId" - }, - { - "type": "null" - } - ] - }, - "last_action": { - "$ref": "#/components/schemas/UserLastAction" - }, - "status": { - "$ref": "#/components/schemas/UserStatus" - } - }, - "type": "object" - }, - "UserListResponse": { - "required": [ - "list", - "_metadata" - ], - "properties": { - "list": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserList" - } - }, - "_metadata": { - "$ref": "#/components/schemas/RequestMetadataWithLinks" - } - }, - "type": "object" - }, - "UserSelectionName": { - "description": "The following selections will fallback to API v1 and may change at any time: 'ammo','bars','basic','battlestats','bazaar','cooldowns','criminalrecord','discord','display','education','equipment','events','gym','honors','icons','inventory','jobpoints','log','medals','merits','messages','missions','money','networth','newevents','newmessages','notifications','perks','profile','properties','refills','reports','skills','stocks','travel','weaponexp','workstats'.", + "MarketSelectionName": { + "description": "The following selections will fallback to API v1 and may change at any time: 'pointsmarket'.", "type": "string", "enum": [ - "attacks", - "attacksfull", - "bounties", - "calendar", - "crimes", - "enlistedcars", - "factionbalance", - "forumfeed", - "forumfriends", - "forumposts", - "forumsubscribedthreads", - "forumthreads", - "hof", "itemmarket", - "jobranks", - "list", "lookup", - "organizedcrime", - "personalstats", - "races", - "revives", - "revivesfull", "timestamp", - "ammo", - "bars", - "basic", - "battlestats", - "bazaar", - "cooldowns", - "criminalrecord", - "discord", - "display", - "education", - "equipment", - "events", - "gym", - "honors", - "icons", - "inventory", - "jobpoints", - "log", - "medals", - "merits", - "messages", - "missions", - "money", - "networth", - "newevents", - "newmessages", - "notifications", - "perks", - "profile", - "properties", - "refills", - "reports", - "skills", - "stocks", - "travel", - "weaponexp", - "workstats" + "pointsmarket", + "bazaar" ] }, - "UserLookupResponse": { + "MarketLookupResponse": { "required": [ "selections" ], @@ -21303,7 +19427,2024 @@ "selections": { "type": "array", "items": { - "$ref": "#/components/schemas/UserSelectionName" + "$ref": "#/components/schemas/MarketSelectionName" + } + } + }, + "type": "object" + }, + "RacingCarsResponse": { + "required": [ + "cars" + ], + "properties": { + "cars": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RaceCar" + } + } + }, + "type": "object" + }, + "RaceCar": { + "required": [ + "car_item_id", + "car_item_name", + "top_speed", + "acceleration", + "braking", + "dirt", + "handling", + "safety", + "tarmac", + "class" + ], + "properties": { + "car_item_id": { + "$ref": "#/components/schemas/ItemId" + }, + "car_item_name": { + "type": "string" + }, + "top_speed": { + "type": "integer", + "format": "int32" + }, + "acceleration": { + "type": "integer", + "format": "int32" + }, + "braking": { + "type": "integer", + "format": "int32" + }, + "dirt": { + "type": "integer", + "format": "int32" + }, + "handling": { + "type": "integer", + "format": "int32" + }, + "safety": { + "type": "integer", + "format": "int32" + }, + "tarmac": { + "type": "integer", + "format": "int32" + }, + "class": { + "$ref": "#/components/schemas/RaceClassEnum" + } + }, + "type": "object" + }, + "RacingTracksResponse": { + "required": [ + "tracks" + ], + "properties": { + "tracks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RaceTrack" + } + } + }, + "type": "object" + }, + "RaceTrack": { + "required": [ + "id", + "title", + "description" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/RaceTrackId" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "type": "object" + }, + "RacingCarUpgradesResponse": { + "required": [ + "carupgrades" + ], + "properties": { + "carupgrades": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RaceCarUpgrade" + } + } + }, + "type": "object" + }, + "RaceCarUpgrade": { + "required": [ + "id", + "class_required", + "name", + "description", + "category", + "subcategory", + "effects", + "cost" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/RaceCarUpgradeId" + }, + "class_required": { + "$ref": "#/components/schemas/RaceClassEnum" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "category": { + "$ref": "#/components/schemas/RaceCarUpgradeCategory" + }, + "subcategory": { + "$ref": "#/components/schemas/RaceCarUpgradeSubCategory" + }, + "effects": { + "required": [ + "top_speed", + "acceleration", + "braking", + "handling", + "safety", + "dirt", + "tarmac" + ], + "properties": { + "top_speed": { + "type": "integer", + "format": "int32" + }, + "acceleration": { + "type": "integer", + "format": "int32" + }, + "braking": { + "type": "integer", + "format": "int32" + }, + "handling": { + "type": "integer", + "format": "int32" + }, + "safety": { + "type": "integer", + "format": "int32" + }, + "dirt": { + "type": "integer", + "format": "int32" + }, + "tarmac": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "cost": { + "required": [ + "points", + "cash" + ], + "properties": { + "points": { + "type": "integer", + "format": "int32" + }, + "cash": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "RacingRacesResponse": { + "required": [ + "races", + "_metadata" + ], + "properties": { + "races": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Race" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "Race": { + "required": [ + "id", + "title", + "track_id", + "creator_id", + "status", + "laps", + "participants", + "schedule", + "requirements" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/RaceId" + }, + "title": { + "type": "string" + }, + "track_id": { + "$ref": "#/components/schemas/RaceTrackId" + }, + "creator_id": { + "$ref": "#/components/schemas/UserId" + }, + "status": { + "$ref": "#/components/schemas/RaceStatusEnum" + }, + "laps": { + "type": "integer", + "format": "int32" + }, + "participants": { + "required": [ + "minimum", + "maximum", + "current" + ], + "properties": { + "minimum": { + "type": "integer", + "format": "int32" + }, + "maximum": { + "type": "integer", + "format": "int32" + }, + "current": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "schedule": { + "required": [ + "join_from", + "join_until", + "start", + "end" + ], + "properties": { + "join_from": { + "type": "integer", + "format": "int32" + }, + "join_until": { + "type": "integer", + "format": "int32" + }, + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "requirements": { + "required": [ + "car_class", + "driver_class", + "car_item_id", + "requires_stock_car", + "requires_password", + "join_fee" + ], + "properties": { + "car_class": { + "oneOf": [ + { + "$ref": "#/components/schemas/RaceClassEnum" + }, + { + "type": "null" + } + ] + }, + "driver_class": { + "oneOf": [ + { + "$ref": "#/components/schemas/RaceClassEnum" + }, + { + "type": "null" + } + ] + }, + "car_item_id": { + "oneOf": [ + { + "$ref": "#/components/schemas/ItemId" + }, + { + "type": "null" + } + ] + }, + "requires_stock_car": { + "type": "boolean" + }, + "requires_password": { + "type": "boolean" + }, + "join_fee": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "RacingTrackRecordsResponse": { + "required": [ + "records" + ], + "properties": { + "records": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RaceRecord" + } + } + }, + "type": "object" + }, + "RaceRecord": { + "required": [ + "driver_id", + "driver_name", + "car_item_id", + "lap_time", + "car_item_name" + ], + "properties": { + "driver_id": { + "$ref": "#/components/schemas/UserId" + }, + "driver_name": { + "type": "string" + }, + "car_item_id": { + "$ref": "#/components/schemas/ItemId" + }, + "lap_time": { + "type": "number", + "format": "float" + }, + "car_item_name": { + "type": "string" + } + }, + "type": "object" + }, + "RacerDetails": { + "required": [ + "driver_id", + "position", + "car_id", + "car_item_id", + "car_item_name", + "car_class", + "has_crashed", + "best_lap_time", + "race_time", + "time_ended" + ], + "properties": { + "driver_id": { + "$ref": "#/components/schemas/UserId" + }, + "position": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "car_id": { + "$ref": "#/components/schemas/RaceCarId" + }, + "car_item_id": { + "$ref": "#/components/schemas/ItemId" + }, + "car_item_name": { + "type": "string" + }, + "car_class": { + "$ref": "#/components/schemas/RaceClassEnum" + }, + "has_crashed": { + "oneOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ] + }, + "best_lap_time": { + "oneOf": [ + { + "type": "number", + "format": "float" + }, + { + "type": "null" + } + ] + }, + "race_time": { + "oneOf": [ + { + "type": "number", + "format": "float" + }, + { + "type": "null" + } + ] + }, + "time_ended": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "RacingRaceDetailsResponse": { + "properties": { + "race": { + "allOf": [ + { + "$ref": "#/components/schemas/Race" + }, + { + "required": [ + "results" + ], + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RacerDetails" + } + } + }, + "type": "object" + } + ] + } + }, + "type": "object" + }, + "RacingSelectionName": { + "type": "string", + "enum": [ + "cars", + "carupgrades", + "lookup", + "race", + "races", + "records", + "timestamp", + "tracks" + ] + }, + "RacingLookupResponse": { + "required": [ + "selections" + ], + "properties": { + "selections": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RacingSelectionName" + } + } + }, + "type": "object" + }, + "TornEducationRewards": { + "required": [ + "working_stats", + "effect", + "honor" + ], + "properties": { + "working_stats": { + "required": [ + "manual_labor", + "intelligence", + "endurance" + ], + "properties": { + "manual_labor": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "intelligence": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "endurance": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "effect": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "honor": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "TornEducationPrerequisites": { + "required": [ + "cost", + "courses" + ], + "properties": { + "cost": { + "type": "integer", + "format": "int32" + }, + "courses": { + "type": "array", + "items": { + "type": "integer", + "format": "int32" + } + } + }, + "type": "object" + }, + "TornEducationCourses": { + "required": [ + "id", + "code", + "name", + "description", + "duration", + "rewards", + "prerequisites" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/EducationId" + }, + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "duration": { + "type": "integer", + "format": "int32" + }, + "rewards": { + "$ref": "#/components/schemas/TornEducationRewards" + }, + "prerequisites": { + "$ref": "#/components/schemas/TornEducationPrerequisites" + } + }, + "type": "object" + }, + "TornEducation": { + "required": [ + "id", + "name", + "courses" + ], + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "name": { + "type": "string" + }, + "courses": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornEducationCourses" + } + } + }, + "type": "object" + }, + "TornEducationResponse": { + "required": [ + "education" + ], + "properties": { + "education": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornEducation" + } + } + }, + "type": "object" + }, + "TornTerritoryCoordinates": { + "required": [ + "x", + "y" + ], + "properties": { + "x": { + "type": "number", + "format": "float" + }, + "y": { + "type": "number", + "format": "float" + } + }, + "type": "object" + }, + "TornTerritory": { + "required": [ + "id", + "sector", + "size", + "density", + "slots", + "respect", + "coordinates", + "neighbors" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionTerritoryEnum" + }, + "sector": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "density": { + "type": "integer", + "format": "int32" + }, + "slots": { + "type": "integer", + "format": "int32" + }, + "respect": { + "type": "integer", + "format": "int32" + }, + "coordinates": { + "$ref": "#/components/schemas/TornTerritoryCoordinates" + }, + "neighbors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FactionTerritoryEnum" + } + } + }, + "type": "object" + }, + "TornTerritoriesResponse": { + "required": [ + "territory", + "_metadata" + ], + "properties": { + "territory": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornTerritory" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "TornTerritoriesNoLinksReponse": { + "required": [ + "territory" + ], + "properties": { + "territory": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornTerritory" + } + } + }, + "type": "object" + }, + "TornSubcrimesResponse": { + "required": [ + "subcrimes" + ], + "properties": { + "subcrimes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornSubcrime" + } + } + }, + "type": "object" + }, + "TornSubcrime": { + "required": [ + "id", + "name", + "nerve_cost" + ], + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "name": { + "type": "string" + }, + "nerve_cost": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "TornCrime": { + "required": [ + "id", + "name", + "category_id", + "enhancer_id", + "enhancer_name", + "unique_outcomes_count", + "unique_outcomes_ids" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/TornCrimeId" + }, + "name": { + "type": "string" + }, + "category_id": { + "type": "integer", + "format": "int32" + }, + "category_name": { + "type": "string" + }, + "enhancer_id": { + "type": "integer", + "format": "int32" + }, + "enhancer_name": { + "type": "string" + }, + "unique_outcomes_count": { + "type": "integer", + "format": "int32" + }, + "unique_outcomes_ids": { + "type": "array", + "items": { + "type": "integer", + "format": "int32" + } + }, + "notes": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "type": "object" + }, + "TornCrimesResponse": { + "required": [ + "crimes" + ], + "properties": { + "crimes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornCrime" + } + } + }, + "type": "object" + }, + "TornCalendarActivity": { + "required": [ + "title", + "description", + "start", + "end" + ], + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "TornCalendarResponse": { + "required": [ + "calendar" + ], + "properties": { + "calendar": { + "required": [ + "competitions", + "events" + ], + "properties": { + "competitions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornCalendarActivity" + } + }, + "events": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornCalendarActivity" + } + } + }, + "type": "object" + } + }, + "type": "object" + }, + "TornHof": { + "required": [ + "id", + "username", + "faction_id", + "level", + "last_action", + "rank_name", + "rank_number", + "position", + "signed_up", + "age_in_days", + "value", + "rank" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "username": { + "type": "string" + }, + "faction_id": { + "$ref": "#/components/schemas/FactionId" + }, + "level": { + "type": "integer", + "format": "int32" + }, + "last_action": { + "type": "integer", + "format": "int32" + }, + "rank_name": { + "type": "string" + }, + "rank_number": { + "type": "integer", + "format": "int32" + }, + "position": { + "type": "integer", + "format": "int32" + }, + "signed_up": { + "type": "integer", + "format": "int32" + }, + "age_in_days": { + "type": "integer", + "format": "int32" + }, + "value": { + "description": "Value representing the chosen category. Traveltime is shown in seconds. If the chosen category is 'rank', the value is of type string. If the chosen category is 'racingskill', the value is of type float. Otherwise it is an integer." + }, + "rank": { + "type": "string" + } + }, + "type": "object" + }, + "TornHofResponse": { + "required": [ + "hof", + "_metadata" + ], + "properties": { + "hof": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornHof" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "FactionHofValues": { + "required": [ + "chain", + "chain_duration", + "respect" + ], + "properties": { + "chain": { + "description": "Maximum chain achieved by the faction. Null if chosen category is 'rank' or 'respect'.", + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "chain_duration": { + "description": "The duration of the chain. Null if chosen category is 'rank' or 'respect'.", + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + }, + "respect": { + "description": "Null if chosen category is 'chain'.", + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "TornFactionHof": { + "required": [ + "id", + "name", + "members", + "position", + "rank", + "values" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionId" + }, + "name": { + "type": "string" + }, + "members": { + "type": "integer", + "format": "int32" + }, + "position": { + "type": "integer", + "format": "int32" + }, + "rank": { + "description": "The full rank title & division of the faction.", + "type": "string" + }, + "values": { + "$ref": "#/components/schemas/FactionHofValues" + } + }, + "type": "object" + }, + "TornFactionHofResponse": { + "required": [ + "factionhof", + "_metadata" + ], + "properties": { + "factionhof": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornFactionHof" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "TornLog": { + "required": [ + "id", + "title" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/LogId" + }, + "title": { + "type": "string" + } + }, + "type": "object" + }, + "TornLogCategory": { + "required": [ + "id", + "title" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/LogCategoryId" + }, + "title": { + "type": "string" + } + }, + "type": "object" + }, + "TornLogTypesResponse": { + "required": [ + "logtypes" + ], + "properties": { + "logtypes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornLog" + } + } + }, + "type": "object" + }, + "TornLogCategoriesResponse": { + "required": [ + "logcategories" + ], + "properties": { + "logcategories": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornLogCategory" + } + } + }, + "type": "object" + }, + "Bounty": { + "required": [ + "target_id", + "target_name", + "target_level", + "lister_id", + "lister_name", + "reward", + "reason", + "quantity", + "is_anonymous", + "valid_until" + ], + "properties": { + "target_id": { + "$ref": "#/components/schemas/UserId" + }, + "target_name": { + "type": "string" + }, + "target_level": { + "type": "integer", + "format": "int32" + }, + "lister_id": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserId", + "description": "If the bounty is anonymous this field is null." + }, + { + "type": "null" + } + ] + }, + "lister_name": { + "description": "If the bounty is anonymous this field is null.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "reward": { + "type": "integer", + "format": "int64" + }, + "reason": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "quantity": { + "type": "integer", + "format": "int32" + }, + "is_anonymous": { + "type": "boolean" + }, + "valid_until": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "AttackLogSummary": { + "required": [ + "id", + "name", + "hits", + "misses", + "damage" + ], + "properties": { + "id": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserId", + "description": "Id of the participant, could be null in stealthed attacks." + }, + { + "type": "null" + } + ] + }, + "name": { + "oneOf": [ + { + "description": "Name of the participant, could be null in stealthed attacks.", + "type": "string" + }, + { + "type": "null" + } + ] + }, + "hits": { + "type": "integer", + "format": "int32" + }, + "misses": { + "type": "integer", + "format": "int32" + }, + "damage": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "AttackLog": { + "required": [ + "text", + "timestamp", + "action", + "icon", + "attacker", + "defender" + ], + "properties": { + "text": { + "type": "string" + }, + "timestamp": { + "type": "integer", + "format": "int32" + }, + "action": { + "$ref": "#/components/schemas/AttackActionEnum" + }, + "icon": { + "type": "string" + }, + "attacker": { + "oneOf": [ + { + "description": "This value could be null in stealthed attacks.", + "required": [ + "id", + "name", + "item" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "name": { + "type": "string" + }, + "item": { + "oneOf": [ + { + "description": "This object could be null if there was no item being used in this turn or during this effect.", + "properties": { + "id": { + "$ref": "#/components/schemas/ItemId" + }, + "name": { + "type": "string" + } + }, + "type": "object" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + { + "type": "null" + } + ] + }, + "defender": { + "oneOf": [ + { + "description": "This value could be null in stealthed attacks.", + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "name": { + "type": "string" + } + }, + "type": "object" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "AttackLogResponse": { + "required": [ + "attacklog", + "_metadata" + ], + "properties": { + "attacklog": { + "required": [ + "log", + "summary" + ], + "properties": { + "log": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AttackLog" + } + }, + "summary": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AttackLogSummary" + } + } + }, + "type": "object" + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "TornBountiesResponse": { + "required": [ + "bounties", + "_metadata" + ], + "properties": { + "bounties": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Bounty" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, + "TornItemAmmo": { + "required": [ + "id", + "name", + "price", + "types" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/AmmoId" + }, + "name": { + "type": "string" + }, + "price": { + "type": "integer", + "format": "int64" + }, + "types": { + "description": "Types of ammo", + "type": "array", + "items": { + "$ref": "#/components/schemas/TornItemAmmoTypeEnum" + } + } + }, + "type": "object" + }, + "TornItemAmmoResponse": { + "required": [ + "itemammo" + ], + "properties": { + "itemammo": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornItemAmmo" + } + } + }, + "type": "object" + }, + "TornItemMods": { + "required": [ + "id", + "name", + "description", + "dual_fit", + "weapons" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ItemModId" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "dual_fit": { + "description": "Whether the upgrade fits on dual weapons.", + "type": "boolean" + }, + "weapons": { + "description": "The weapon types this upgrade can be attached to.", + "type": "array", + "items": { + "$ref": "#/components/schemas/TornItemWeaponTypeEnum" + } + } + }, + "type": "object" + }, + "TornItemModsResponse": { + "required": [ + "itemmods" + ], + "properties": { + "itemmods": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornItemMods" + } + } + }, + "type": "object" + }, + "TornItemBaseStats": { + "required": [ + "damage", + "accuracy", + "armor" + ], + "properties": { + "damage": { + "type": "integer", + "format": "int32" + }, + "accuracy": { + "type": "integer", + "format": "int32" + }, + "armor": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "TornItemWeaponDetails": { + "required": [ + "stealth_level", + "base_stats", + "category", + "ammo", + "mods" + ], + "properties": { + "stealth_level": { + "type": "number", + "format": "float" + }, + "base_stats": { + "$ref": "#/components/schemas/TornItemBaseStats" + }, + "category": { + "$ref": "#/components/schemas/TornItemWeaponCategoryEnum" + }, + "ammo": { + "oneOf": [ + { + "required": [ + "id", + "name", + "magazine_rounds", + "rate_of_fire" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/AmmoId" + }, + "name": { + "type": "string" + }, + "magazine_rounds": { + "type": "integer", + "format": "int32" + }, + "rate_of_fire": { + "required": [ + "minimum", + "maximum" + ], + "properties": { + "minimum": { + "type": "integer", + "format": "int32" + }, + "maximum": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + }, + "type": "object" + }, + { + "type": "null" + } + ] + }, + "mods": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ItemModId" + } + } + }, + "type": "object" + }, + "TornItemArmorCoverage": { + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "$ref": "#/components/schemas/TornItemArmorCoveragePartEnum" + }, + "value": { + "type": "number", + "format": "float" + } + }, + "type": "object" + }, + "TornItemArmorDetails": { + "required": [ + "coverage", + "base_stats" + ], + "properties": { + "coverage": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornItemArmorCoverage" + } + }, + "base_stats": { + "$ref": "#/components/schemas/TornItemBaseStats" + } + }, + "type": "object" + }, + "TornItem": { + "required": [ + "id", + "name", + "description", + "effect", + "requirement", + "image", + "type", + "sub_type", + "is_masked", + "is_tradable", + "is_found_in_city", + "value", + "circulation", + "details" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ItemId" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "effect": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "requirement": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "image": { + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/TornItemTypeEnum" + }, + "sub_type": { + "oneOf": [ + { + "$ref": "#/components/schemas/TornItemWeaponTypeEnum" + }, + { + "type": "null" + } + ] + }, + "is_masked": { + "type": "boolean" + }, + "is_tradable": { + "type": "boolean" + }, + "is_found_in_city": { + "type": "boolean" + }, + "value": { + "required": [ + "vendor", + "buy_price", + "sell_price", + "market_price" + ], + "properties": { + "vendor": { + "oneOf": [ + { + "required": [ + "country", + "name" + ], + "properties": { + "country": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "type": "object" + }, + { + "type": "null" + } + ] + }, + "buy_price": { + "oneOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "null" + } + ] + }, + "sell_price": { + "oneOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "null" + } + ] + }, + "market_price": { + "type": "integer", + "format": "int64" + } + }, + "type": "object" + }, + "circulation": { + "type": "integer", + "format": "int64" + }, + "details": { + "description": "If the item 'type' is 'Armor' then TornItemArmorDetails is returned.
If the item 'type' is 'Weapon' then TornItemWeaponDetails is returned.
Otherwise, null is returned.", + "oneOf": [ + { + "$ref": "#/components/schemas/TornItemWeaponDetails" + }, + { + "$ref": "#/components/schemas/TornItemArmorDetails" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "TornItemsResponse": { + "required": [ + "items" + ], + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornItem" + } + } + }, + "type": "object" + }, + "TornFactionTreeBranch": { + "required": [ + "id", + "name", + "upgrades" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionBranchId" + }, + "name": { + "type": "string" + }, + "upgrades": { + "type": "array", + "items": { + "required": [ + "name", + "level", + "ability", + "challenge", + "cost" + ], + "properties": { + "name": { + "type": "string" + }, + "level": { + "type": "integer", + "format": "int32" + }, + "ability": { + "type": "string" + }, + "cost": { + "type": "integer", + "format": "int32" + }, + "challenge": { + "oneOf": [ + { + "required": [ + "description", + "amount_required", + "stat" + ], + "properties": { + "description": { + "type": "string" + }, + "amount_required": { + "type": "integer", + "format": "int64" + }, + "stat": { + "$ref": "#/components/schemas/FactionStatEnum" + } + }, + "type": "object" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + } + } + }, + "type": "object" + }, + "TornFactionTree": { + "required": [ + "name", + "branches" + ], + "properties": { + "name": { + "type": "string" + }, + "branches": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornFactionTreeBranch" + } + } + }, + "type": "object" + }, + "TornFactionTreeResponse": { + "required": [ + "factionTree" + ], + "properties": { + "factionTree": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornFactionTree" + } + } + }, + "type": "object" + }, + "TornSelectionName": { + "description": "The following selections will fallback to API v1 and may change at any time: 'bank','cards','cityshops','companies','competition','dirtybombs','gyms','honors','itemdetails','itemstats','medals','organisedcrimes','pawnshop','pokertables','properties','raidreport','raids','rockpaperscissors','searchforcash','shoplifting','stats','stocks'.\n * The following selections are not available in API v2: 'chainreport', 'rackets', 'rankedwarreport', 'rankedwars', 'territorynames', 'territorywarreport', 'territorywars'.", + "type": "string", + "enum": [ + "attacklog", + "bounties", + "calendar", + "crimes", + "education", + "factionhof", + "factiontree", + "hof", + "itemammo", + "itemmods", + "items", + "logcategories", + "logtypes", + "lookup", + "subcrimes", + "territory", + "timestamp", + "bank", + "cards", + "cityshops", + "companies", + "competition", + "dirtybombs", + "gyms", + "honors", + "itemdetails", + "itemstats", + "medals", + "organisedcrimes", + "pawnshop", + "pokertables", + "properties", + "raidreport", + "raids", + "rockpaperscissors", + "searchforcash", + "shoplifting", + "stats", + "stocks", + "chainreport", + "rackets", + "rankedwarreport", + "rankedwars", + "territorynames", + "territorywarreport", + "territorywars" + ] + }, + "TornLookupResponse": { + "required": [ + "selections" + ], + "properties": { + "selections": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TornSelectionName" } } }, diff --git a/torn-api-codegen/src/model/enum.rs b/torn-api-codegen/src/model/enum.rs index 382c1f1..23cd52d 100644 --- a/torn-api-codegen/src/model/enum.rs +++ b/torn-api-codegen/src/model/enum.rs @@ -317,23 +317,3 @@ impl Enum { }) } } - -#[cfg(test)] -mod test { - use crate::openapi::schema::OpenApiSchema; - - use super::*; - - #[test] - fn codegen() { - let schema = OpenApiSchema::read().unwrap(); - - let revive_setting = schema.components.schemas.get("ReviveSetting").unwrap(); - - let r#enum = Enum::from_schema("ReviveSetting", revive_setting).unwrap(); - - let code = r#enum.codegen().unwrap(); - - panic!("{code}"); - } -} diff --git a/torn-api-codegen/src/model/mod.rs b/torn-api-codegen/src/model/mod.rs index ed0ae5f..e230952 100644 --- a/torn-api-codegen/src/model/mod.rs +++ b/torn-api-codegen/src/model/mod.rs @@ -1,8 +1,8 @@ -use r#enum::Enum; use indexmap::IndexMap; use newtype::Newtype; use object::Object; use proc_macro2::TokenStream; +use r#enum::Enum; use crate::openapi::r#type::OpenApiType; @@ -101,65 +101,6 @@ mod test { ); } - #[test] - fn resolve_enums() { - let schema = OpenApiSchema::read().unwrap(); - - let forum_feed_type_schema = schema.components.schemas.get("ForumFeedTypeEnum").unwrap(); - - let forum_feed_type = resolve( - forum_feed_type_schema, - "ForumFeedTypeEnum", - &schema.components.schemas, - ); - - assert_eq!(forum_feed_type, Model::Enum(Enum { - name: "ForumFeedType".to_owned(), - description: Some("This represents the type of the activity. Values range from 1 to 8 where:\n * 1 = 'X posted on a thread',\n * 2 = 'X created a thread',\n * 3 = 'X liked your thread',\n * 4 = 'X disliked your thread',\n * 5 = 'X liked your post',\n * 6 = 'X disliked your post',\n * 7 = 'X quoted your post'.".to_owned()), - repr: Some(EnumRepr::U32), - copy: true, - untagged: false, - display: true, - variants: vec![ - EnumVariant { - name: "Variant1".to_owned(), - value: r#enum::EnumVariantValue::Repr(1), - ..Default::default() - }, - EnumVariant { - name: "Variant2".to_owned(), - value: r#enum::EnumVariantValue::Repr(2), - ..Default::default() - }, - EnumVariant { - name: "Variant3".to_owned(), - value: r#enum::EnumVariantValue::Repr(3), - ..Default::default() - }, - EnumVariant { - name: "Variant4".to_owned(), - value: r#enum::EnumVariantValue::Repr(4), - ..Default::default() - }, - EnumVariant { - name: "Variant5".to_owned(), - value: r#enum::EnumVariantValue::Repr(5), - ..Default::default() - }, - EnumVariant { - name: "Variant6".to_owned(), - value: r#enum::EnumVariantValue::Repr(6), - ..Default::default() - }, - EnumVariant { - name: "Variant7".to_owned(), - value: r#enum::EnumVariantValue::Repr(7), - ..Default::default() - }, - ] - })) - } - #[test] fn resolve_all() { let schema = OpenApiSchema::read().unwrap(); diff --git a/torn-api-codegen/src/model/newtype.rs b/torn-api-codegen/src/model/newtype.rs index 372c637..d04dcfe 100644 --- a/torn-api-codegen/src/model/newtype.rs +++ b/torn-api-codegen/src/model/newtype.rs @@ -121,24 +121,3 @@ impl Newtype { Some(body) } } - -#[cfg(test)] -mod test { - use super::*; - use crate::openapi::schema::OpenApiSchema; - - #[test] - fn codegen() { - let schema = OpenApiSchema::read().unwrap(); - - let user_id = schema.components.schemas.get("UserId").unwrap(); - - let mut newtype = Newtype::from_schema("UserId", user_id).unwrap(); - - newtype.description = Some("Description goes here".to_owned()); - - let code = newtype.codegen().unwrap().to_string(); - - panic!("{code}"); - } -} diff --git a/torn-api-codegen/src/model/object.rs b/torn-api-codegen/src/model/object.rs index 60829b9..c29dcbe 100644 --- a/torn-api-codegen/src/model/object.rs +++ b/torn-api-codegen/src/model/object.rs @@ -207,7 +207,9 @@ impl Property { let prim = match (schema.r#type, schema.format) { (Some("integer"), Some("int32")) => PrimitiveType::I32, (Some("integer"), Some("int64")) => PrimitiveType::I64, - (Some("number"), /* Some("float") */ _) => PrimitiveType::Float, + (Some("number"), /* Some("float") */ _) | (_, Some("float")) => { + PrimitiveType::Float + } (Some("string"), None) => PrimitiveType::String, (Some("boolean"), None) => PrimitiveType::Bool, _ => return None, diff --git a/torn-api-codegen/src/model/parameter.rs b/torn-api-codegen/src/model/parameter.rs index dbe87fd..23daff1 100644 --- a/torn-api-codegen/src/model/parameter.rs +++ b/torn-api-codegen/src/model/parameter.rs @@ -2,7 +2,7 @@ use std::fmt::Write; use heck::ToUpperCamelCase; use proc_macro2::TokenStream; -use quote::{ToTokens, format_ident, quote}; +use quote::{format_ident, quote, ToTokens}; use crate::openapi::parameter::{ OpenApiParameter, OpenApiParameterDefault, OpenApiParameterSchema, @@ -303,7 +303,12 @@ The default value [Self::{}](self::{}#variant.{})"#, let mut code = inner.codegen().unwrap_or_default(); let name = format_ident!("{}", outer_name); - let inner_ty = items.codegen_type_name(&inner_name); + let inner_ty = if matches!(items.as_ref(), ParameterType::Schema { type_name: _ }) { + let inner_name = format_ident!("{}", inner_name); + quote! { crate::models::#inner_name } + } else { + items.codegen_type_name(&inner_name).to_token_stream() + }; code.extend(quote! { #[derive(Debug, Clone)] diff --git a/torn-api-codegen/src/model/path.rs b/torn-api-codegen/src/model/path.rs index a1bfb4f..04973de 100644 --- a/torn-api-codegen/src/model/path.rs +++ b/torn-api-codegen/src/model/path.rs @@ -352,7 +352,13 @@ impl Path { crate::models::#ty_name } } - ParameterType::Array { .. } => param.r#type.codegen_type_name(¶m.name), + ParameterType::Array { .. } => { + let ty_name = param.r#type.codegen_type_name(¶m.name); + + quote! { + crate::request::models::#request_mod_name::#ty_name + } + } }; let arg_name = format_ident!("{}", param.value.to_snake_case()); @@ -462,7 +468,12 @@ impl Path { crate::models::#ty_name } } - ParameterType::Array { .. } => param.r#type.codegen_type_name(¶m.name), + ParameterType::Array { .. } => { + let name = param.r#type.codegen_type_name(¶m.name); + quote! { + crate::request::models::#request_mod_name::#name + } + } }; let arg_name = format_ident!("{}", param.value.to_snake_case()); diff --git a/torn-api/src/scopes.rs b/torn-api/src/scopes.rs index 98415c1..9910897 100644 --- a/torn-api/src/scopes.rs +++ b/torn-api/src/scopes.rs @@ -415,7 +415,7 @@ pub(super) mod test { let forum_scope = ForumScope(&client); forum_scope - .threads_for_category_ids("2".to_owned(), |b| b) + .threads_for_category_ids([2.into()].into(), |b| b) .await .unwrap(); } @@ -640,7 +640,7 @@ pub(super) mod test { let torn_scope = TornScope(&client); torn_scope - .items_for_ids("1".to_owned(), |b| b) + .items_for_ids([1.into()].into(), |b| b) .await .unwrap(); } From 266122ea0e80b53d6b9f99499db1aebd910c4ee1 Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:27:57 +0200 Subject: [PATCH 16/26] chore(codegen): publish version --- Cargo.lock | 2 +- torn-api-codegen/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 19e2230..65a0c28 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2291,7 +2291,7 @@ dependencies = [ [[package]] name = "torn-api-codegen" -version = "0.2.3" +version = "0.2.4" dependencies = [ "heck", "indexmap", diff --git a/torn-api-codegen/Cargo.toml b/torn-api-codegen/Cargo.toml index 48037f1..cec8fba 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.2.3" +version = "0.2.4" edition = "2021" description = "Contains the v2 torn API model descriptions and codegen for the bindings" license-file = { workspace = true } From 7a4f6462f50fca467d085f9ed136cbb2a0382d04 Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:27:57 +0200 Subject: [PATCH 17/26] feat(torn-api): add chrono for datetime support --- Cargo.lock | 2 + torn-api-codegen/openapi.json | 727 +++++++++++++++++++++++- torn-api-codegen/src/model/mod.rs | 5 +- torn-api-codegen/src/model/object.rs | 5 + torn-api-codegen/src/model/parameter.rs | 7 +- torn-api/Cargo.toml | 1 + torn-api/src/scopes.rs | 16 + 7 files changed, 741 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 65a0c28..f8e47bc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -227,6 +227,7 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", + "serde", "wasm-bindgen", "windows-link", ] @@ -2275,6 +2276,7 @@ version = "1.2.0" dependencies = [ "bon", "bytes", + "chrono", "futures", "http", "prettyplease", diff --git a/torn-api-codegen/openapi.json b/torn-api-codegen/openapi.json index c5ddb7a..e70979a 100644 --- a/torn-api-codegen/openapi.json +++ b/torn-api-codegen/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.6.1" + "version": "1.7.0" }, "servers": [ { @@ -1226,6 +1226,69 @@ "x-stability": "Stable" } }, + "/user/reports": { + "get": { + "tags": [ + "User" + ], + "summary": "Get your reports", + "description": "Requires limited access key.
\n * The default limit is set to 25. However, the limit can be set to 100 for the 'stats' category.", + "operationId": "6ba15a813fe1cc014564e9dba892e022", + "parameters": [ + { + "name": "cat", + "in": "query", + "description": "Used to filter reports with a specific type.", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReportTypeEnum" + } + }, + { + "name": "target", + "in": "query", + "description": "Get reports for a specific player by passing their player ID.", + "required": false, + "schema": { + "$ref": "#/components/schemas/UserId" + } + }, + { + "$ref": "#/components/parameters/ApiLimit100Default20" + }, + { + "$ref": "#/components/parameters/ApiOffset" + }, + { + "$ref": "#/components/parameters/ApiTimestamp" + }, + { + "$ref": "#/components/parameters/ApiComment" + }, + { + "$ref": "#/components/parameters/ApiKeyLimited" + } + ], + "responses": { + "200": { + "description": "Successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ReportsResponse" + } + } + } + } + }, + "security": [ + { + "api_key": [] + } + ], + "x-stability": "Unstable" + } + }, "/user/revives": { "get": { "tags": [ @@ -2787,6 +2850,69 @@ "x-stability": "Stable" } }, + "/faction/reports": { + "get": { + "tags": [ + "Faction" + ], + "summary": "Get faction reports", + "description": "Requires limited access key.
\n * The default limit is set to 25. However, the limit can be set to 100 for the 'stats' category.", + "operationId": "e8bd37f10cc5e0e8d6694bb306f3a1e4", + "parameters": [ + { + "name": "cat", + "in": "query", + "description": "Used to filter reports with a specific type.", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReportTypeEnum" + } + }, + { + "name": "target", + "in": "query", + "description": "Get reports for a specific player by passing their player ID.", + "required": false, + "schema": { + "$ref": "#/components/schemas/UserId" + } + }, + { + "$ref": "#/components/parameters/ApiLimit100Default20" + }, + { + "$ref": "#/components/parameters/ApiOffset" + }, + { + "$ref": "#/components/parameters/ApiTimestamp" + }, + { + "$ref": "#/components/parameters/ApiComment" + }, + { + "$ref": "#/components/parameters/ApiKeyLimited" + } + ], + "responses": { + "200": { + "description": "Successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ReportsResponse" + } + } + } + } + }, + "security": [ + { + "api_key": [] + } + ], + "x-stability": "Unstable" + } + }, "/faction/revives": { "get": { "tags": [ @@ -3998,15 +4124,6 @@ { "$ref": "#/components/parameters/ApiOffsetNoDefault" }, - { - "name": "cat", - "in": "query", - "description": "Selection category", - "required": false, - "schema": { - "type": "string" - } - }, { "$ref": "#/components/parameters/ApiTimestamp" }, @@ -5983,6 +6100,37 @@ "E" ] }, + "CountryEnum": { + "type": "string", + "enum": [ + "Mexico", + "Hawaii", + "South Africa", + "Japan", + "China", + "Argentina", + "Switzerland", + "Canada", + "United Kingdom", + "UAE", + "Cayman Islands" + ] + }, + "ReportTypeEnum": { + "type": "string", + "enum": [ + "mostwanted", + "money", + "stats", + "references", + "friendorfoe", + "companyfinancials", + "truelevel", + "stockanalysis", + "anonymousbounties", + "investment" + ] + }, "ApiKeyAccessTypeEnum": { "type": "string", "enum": [ @@ -11450,6 +11598,551 @@ }, "type": "object" }, + "ReportBase": { + "required": [ + "type", + "target_id", + "reporter_id", + "faction_id", + "timestamp" + ], + "properties": { + "type": { + "$ref": "#/components/schemas/ReportTypeEnum" + }, + "target_id": { + "description": "The target ID if applicable.", + "oneOf": [ + { + "$ref": "#/components/schemas/UserId" + }, + { + "type": "null" + } + ] + }, + "reporter_id": { + "$ref": "#/components/schemas/UserId" + }, + "faction_id": { + "description": "Reporter's faction ID if applicable.", + "oneOf": [ + { + "$ref": "#/components/schemas/FactionId" + }, + { + "type": "null" + } + ] + }, + "timestamp": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "ReportWarrantDetails": { + "required": [ + "id", + "name", + "warrant" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "name": { + "type": "string" + }, + "warrant": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "ReportMostWanted": { + "required": [ + "top", + "notable" + ], + "properties": { + "top": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReportWarrantDetails" + } + }, + "notable": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReportWarrantDetails" + } + } + }, + "type": "object" + }, + "ReportMoney": { + "required": [ + "money" + ], + "properties": { + "money": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "ReportInvestment": { + "required": [ + "amount", + "until" + ], + "properties": { + "amount": { + "type": "integer", + "format": "int64" + }, + "until": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "ReportTrueLevel": { + "required": [ + "level" + ], + "properties": { + "level": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + }, + "ReportStats": { + "required": [ + "strength", + "speed", + "dexterity", + "defense", + "total" + ], + "properties": { + "strength": { + "oneOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "null" + } + ] + }, + "speed": { + "oneOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "null" + } + ] + }, + "dexterity": { + "oneOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "null" + } + ] + }, + "defense": { + "oneOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "null" + } + ] + }, + "total": { + "oneOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "ReportHistoryFaction": { + "required": [ + "id", + "name", + "joined", + "left" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/FactionId" + }, + "name": { + "type": "string" + }, + "joined": { + "type": "string", + "format": "date" + }, + "left": { + "oneOf": [ + { + "type": "string", + "format": "date" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "ReportHistoryCompany": { + "required": [ + "id", + "name", + "joined", + "left" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/CompanyId" + }, + "name": { + "type": "string" + }, + "joined": { + "type": "string", + "format": "date" + }, + "left": { + "oneOf": [ + { + "type": "string", + "format": "date" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "ReportHistory": { + "required": [ + "factions", + "companies" + ], + "properties": { + "factions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReportHistoryFaction" + } + }, + "companies": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReportHistoryCompany" + } + } + }, + "type": "object" + }, + "ReportFriendOrFoeUser": { + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "name": { + "type": "string" + } + }, + "type": "object" + }, + "ReportFriendOrFoe": { + "required": [ + "friends", + "enemies" + ], + "properties": { + "friends": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReportFriendOrFoeUser" + } + }, + "enemies": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReportFriendOrFoeUser" + } + } + }, + "type": "object" + }, + "ReportCompanyFinancials": { + "required": [ + "balance", + "employees", + "wages" + ], + "properties": { + "balance": { + "type": "integer", + "format": "int64" + }, + "employees": { + "type": "integer", + "format": "int32" + }, + "wages": { + "required": [ + "highest", + "lowest", + "average" + ], + "properties": { + "highest": { + "type": "integer", + "format": "int32" + }, + "lowest": { + "type": "integer", + "format": "int32" + }, + "average": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "ReportStockAnalysis": { + "required": [ + "items" + ], + "properties": { + "items": { + "type": "array", + "items": { + "required": [ + "country", + "item", + "trip_duration", + "hourly_profit" + ], + "properties": { + "country": { + "$ref": "#/components/schemas/CountryEnum" + }, + "item": { + "required": [ + "id", + "name", + "stock", + "price", + "value", + "due" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ItemId" + }, + "name": { + "type": "string" + }, + "price": { + "type": "integer", + "format": "int32" + }, + "value": { + "type": "integer", + "format": "int32" + }, + "due": { + "oneOf": [ + { + "type": "integer", + "format": "int32" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + "trip_duration": { + "type": "integer", + "format": "int32" + }, + "hourly_profit": { + "type": "integer", + "format": "int32" + } + }, + "type": "object" + } + } + }, + "type": "object" + }, + "ReportAnonymousBounties": { + "required": [ + "bounties" + ], + "properties": { + "bounties": { + "type": "array", + "items": { + "required": [ + "bounty", + "user", + "text" + ], + "properties": { + "text": { + "type": "string" + }, + "bounty": { + "type": "integer", + "format": "int64" + }, + "user": { + "oneOf": [ + { + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/UserId" + }, + "name": { + "type": "string" + } + }, + "type": "object" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + } + } + }, + "type": "object" + }, + "ReportReport": { + "required": [ + "report" + ], + "properties": { + "report": { + "oneOf": [ + { + "$ref": "#/components/schemas/ReportMoney" + }, + { + "$ref": "#/components/schemas/ReportStats" + }, + { + "$ref": "#/components/schemas/ReportMostWanted" + }, + { + "$ref": "#/components/schemas/ReportHistory" + }, + { + "$ref": "#/components/schemas/ReportFriendOrFoe" + }, + { + "$ref": "#/components/schemas/ReportCompanyFinancials" + }, + { + "$ref": "#/components/schemas/ReportTrueLevel" + }, + { + "$ref": "#/components/schemas/ReportStockAnalysis" + }, + { + "$ref": "#/components/schemas/ReportAnonymousBounties" + }, + { + "$ref": "#/components/schemas/ReportInvestment" + } + ] + } + }, + "type": "object" + }, + "Report": { + "allOf": [ + { + "$ref": "#/components/schemas/ReportBase" + }, + { + "$ref": "#/components/schemas/ReportReport" + } + ] + }, + "ReportsResponse": { + "required": [ + "reports", + "_metadata" + ], + "properties": { + "reports": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Report" + } + }, + "_metadata": { + "$ref": "#/components/schemas/RequestMetadataWithLinks" + } + }, + "type": "object" + }, "UserCurrentEducation": { "required": [ "id", @@ -12412,7 +13105,7 @@ ], "properties": { "value": { - "type": "integer", + "type": "number", "format": "float" }, "rank": { @@ -12434,7 +13127,7 @@ "rank": { "oneOf": [ { - "type": "number", + "type": "integer", "format": "int32" }, { @@ -21603,6 +22296,16 @@ "minimum": 1 } }, + "ApiTarget": { + "name": "target", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int32", + "minimum": 1 + } + }, "ApiSort": { "name": "sort", "in": "query", diff --git a/torn-api-codegen/src/model/mod.rs b/torn-api-codegen/src/model/mod.rs index e230952..6b9c313 100644 --- a/torn-api-codegen/src/model/mod.rs +++ b/torn-api-codegen/src/model/mod.rs @@ -61,10 +61,7 @@ impl Model { #[cfg(test)] mod test { use super::*; - use crate::{ - model::r#enum::{EnumRepr, EnumVariant}, - openapi::schema::OpenApiSchema, - }; + use crate::openapi::schema::OpenApiSchema; #[test] fn resolve_newtypes() { diff --git a/torn-api-codegen/src/model/object.rs b/torn-api-codegen/src/model/object.rs index c29dcbe..8b96376 100644 --- a/torn-api-codegen/src/model/object.rs +++ b/torn-api-codegen/src/model/object.rs @@ -15,6 +15,7 @@ pub enum PrimitiveType { I64, String, Float, + DateTime, } #[derive(Debug, Clone, PartialEq, Eq)] @@ -35,6 +36,9 @@ impl PropertyType { Self::Primitive(PrimitiveType::String) => { Some(format_ident!("String").into_token_stream()) } + Self::Primitive(PrimitiveType::DateTime) => { + Some(quote! { chrono::DateTime }) + } Self::Primitive(PrimitiveType::Float) => Some(format_ident!("f64").into_token_stream()), Self::Ref(path) => { let name = path.strip_prefix("#/components/schemas/")?; @@ -211,6 +215,7 @@ impl Property { PrimitiveType::Float } (Some("string"), None) => PrimitiveType::String, + (Some("string"), Some("date")) => PrimitiveType::DateTime, (Some("boolean"), None) => PrimitiveType::Bool, _ => return None, }; diff --git a/torn-api-codegen/src/model/parameter.rs b/torn-api-codegen/src/model/parameter.rs index 23daff1..613b8a9 100644 --- a/torn-api-codegen/src/model/parameter.rs +++ b/torn-api-codegen/src/model/parameter.rs @@ -303,12 +303,7 @@ The default value [Self::{}](self::{}#variant.{})"#, let mut code = inner.codegen().unwrap_or_default(); let name = format_ident!("{}", outer_name); - let inner_ty = if matches!(items.as_ref(), ParameterType::Schema { type_name: _ }) { - let inner_name = format_ident!("{}", inner_name); - quote! { crate::models::#inner_name } - } else { - items.codegen_type_name(&inner_name).to_token_stream() - }; + let inner_ty = items.codegen_type_name(&inner_name); code.extend(quote! { #[derive(Debug, Clone)] diff --git a/torn-api/Cargo.toml b/torn-api/Cargo.toml index b9c49dc..0dfc324 100644 --- a/torn-api/Cargo.toml +++ b/torn-api/Cargo.toml @@ -31,6 +31,7 @@ futures = { version = "0.3", default-features = false, features = [ "std", "async-await", ] } +chrono = { version = "0.4.41", features = ["serde"] } [dev-dependencies] tokio = { version = "1", features = ["full"] } diff --git a/torn-api/src/scopes.rs b/torn-api/src/scopes.rs index 9910897..ea548f0 100644 --- a/torn-api/src/scopes.rs +++ b/torn-api/src/scopes.rs @@ -366,6 +366,15 @@ pub(super) mod test { faction_scope.lookup(|b| b).await.unwrap(); } + #[tokio::test] + async fn faction_reports() { + let client = test_client().await; + + let faction_scope = FactionScope(&client); + + faction_scope.reports(|b| b).await.unwrap(); + } + #[tokio::test] async fn forum_categories() { let client = test_client().await; @@ -954,4 +963,11 @@ pub(super) mod test { client.user().attacks(|b| b).await.unwrap(); } + + #[tokio::test] + async fn user_reports() { + let client = test_client().await; + + client.user().reports(|b| b).await.unwrap(); + } } From eb6e98f41bce8ed3b89e7b24cdd25c941dc0c861 Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:27:57 +0200 Subject: [PATCH 18/26] chore(codegen): release version --- Cargo.lock | 2 +- torn-api-codegen/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f8e47bc..bb19aa8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2293,7 +2293,7 @@ dependencies = [ [[package]] name = "torn-api-codegen" -version = "0.2.4" +version = "0.2.5" dependencies = [ "heck", "indexmap", diff --git a/torn-api-codegen/Cargo.toml b/torn-api-codegen/Cargo.toml index cec8fba..a2ad99d 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.2.4" +version = "0.3.0" edition = "2021" description = "Contains the v2 torn API model descriptions and codegen for the bindings" license-file = { workspace = true } From 11c5d71bf6b3d9007d44ce89f95651a3594dc37b Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:27:57 +0200 Subject: [PATCH 19/26] chore(torn-api): release version 1.3.0 --- Cargo.lock | 4 ++-- torn-api/Cargo.toml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bb19aa8..aa29b2e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2272,7 +2272,7 @@ dependencies = [ [[package]] name = "torn-api" -version = "1.2.0" +version = "1.3.0" dependencies = [ "bon", "bytes", @@ -2293,7 +2293,7 @@ dependencies = [ [[package]] name = "torn-api-codegen" -version = "0.2.5" +version = "0.3.0" dependencies = [ "heck", "indexmap", diff --git a/torn-api/Cargo.toml b/torn-api/Cargo.toml index 0dfc324..71fdb08 100644 --- a/torn-api/Cargo.toml +++ b/torn-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "torn-api" -version = "1.2.0" +version = "1.3.0" edition = "2021" description = "Auto-generated bindings for the v2 torn api" license-file = { workspace = true } @@ -37,7 +37,7 @@ chrono = { version = "0.4.41", features = ["serde"] } tokio = { version = "1", features = ["full"] } [build-dependencies] -torn-api-codegen = { path = "../torn-api-codegen", version = "0.2.3" } +torn-api-codegen = { path = "../torn-api-codegen", version = "0.3.0" } syn = { workspace = true, features = ["parsing"] } proc-macro2 = { workspace = true } prettyplease = "0.2" From 6d57f275a2e46c6231d459cb13ff80f9f8f70bf4 Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:27:58 +0200 Subject: [PATCH 20/26] chore: moved schema file to torn-api crate --- torn-api-codegen/src/model/mod.rs | 6 +++--- torn-api-codegen/src/model/object.rs | 6 +++--- torn-api-codegen/src/model/parameter.rs | 8 ++++---- torn-api-codegen/src/model/path.rs | 6 +++--- torn-api-codegen/src/openapi/parameter.rs | 6 +++--- torn-api-codegen/src/openapi/path.rs | 15 ++++++++++----- torn-api-codegen/src/openapi/schema.rs | 16 ++++------------ torn-api/Cargo.toml | 1 + torn-api/build.rs | 3 ++- {torn-api-codegen => torn-api}/openapi.json | 0 10 files changed, 33 insertions(+), 34 deletions(-) rename {torn-api-codegen => torn-api}/openapi.json (100%) diff --git a/torn-api-codegen/src/model/mod.rs b/torn-api-codegen/src/model/mod.rs index 6b9c313..b6c823b 100644 --- a/torn-api-codegen/src/model/mod.rs +++ b/torn-api-codegen/src/model/mod.rs @@ -61,11 +61,11 @@ impl Model { #[cfg(test)] mod test { use super::*; - use crate::openapi::schema::OpenApiSchema; + use crate::openapi::schema::test::get_schema; #[test] fn resolve_newtypes() { - let schema = OpenApiSchema::read().unwrap(); + let schema = get_schema(); let user_id_schema = schema.components.schemas.get("UserId").unwrap(); @@ -100,7 +100,7 @@ mod test { #[test] fn resolve_all() { - let schema = OpenApiSchema::read().unwrap(); + let schema = get_schema(); let mut unresolved = vec![]; let total = schema.components.schemas.len(); diff --git a/torn-api-codegen/src/model/object.rs b/torn-api-codegen/src/model/object.rs index 8b96376..ffb6c5a 100644 --- a/torn-api-codegen/src/model/object.rs +++ b/torn-api-codegen/src/model/object.rs @@ -420,11 +420,11 @@ impl ObjectNamespace<'_> { mod test { use super::*; - use crate::openapi::schema::OpenApiSchema; + use crate::openapi::schema::test::get_schema; #[test] fn resolve_object() { - let schema = OpenApiSchema::read().unwrap(); + let schema = get_schema(); let attack = schema.components.schemas.get("FactionUpgrades").unwrap(); @@ -436,7 +436,7 @@ mod test { #[test] fn resolve_objects() { - let schema = OpenApiSchema::read().unwrap(); + let schema = get_schema(); let mut objects = 0; let mut unresolved = vec![]; diff --git a/torn-api-codegen/src/model/parameter.rs b/torn-api-codegen/src/model/parameter.rs index 613b8a9..733163f 100644 --- a/torn-api-codegen/src/model/parameter.rs +++ b/torn-api-codegen/src/model/parameter.rs @@ -342,13 +342,13 @@ The default value [Self::{}](self::{}#variant.{})"#, #[cfg(test)] mod test { - use crate::openapi::{path::OpenApiPathParameter, schema::OpenApiSchema}; + use crate::openapi::{path::OpenApiPathParameter, schema::test::get_schema}; use super::*; #[test] fn resolve_components() { - let schema = OpenApiSchema::read().unwrap(); + let schema = get_schema(); let mut parameters = 0; let mut unresolved = vec![]; @@ -376,7 +376,7 @@ mod test { #[test] fn resolve_inline() { - let schema = OpenApiSchema::read().unwrap(); + let schema = get_schema(); let mut params = 0; let mut unresolved = Vec::new(); @@ -404,7 +404,7 @@ mod test { #[test] fn codegen_inline() { - let schema = OpenApiSchema::read().unwrap(); + let schema = get_schema(); let mut params = 0; let mut unresolved = Vec::new(); diff --git a/torn-api-codegen/src/model/path.rs b/torn-api-codegen/src/model/path.rs index 04973de..7f534ce 100644 --- a/torn-api-codegen/src/model/path.rs +++ b/torn-api-codegen/src/model/path.rs @@ -592,11 +592,11 @@ impl PathNamespace<'_> { mod test { use super::*; - use crate::openapi::schema::OpenApiSchema; + use crate::openapi::schema::test::get_schema; #[test] fn resolve_paths() { - let schema = OpenApiSchema::read().unwrap(); + let schema = get_schema(); let mut paths = 0; let mut unresolved = vec![]; @@ -624,7 +624,7 @@ mod test { #[test] fn codegen_paths() { - let schema = OpenApiSchema::read().unwrap(); + let schema = get_schema(); let mut paths = 0; let mut unresolved = vec![]; diff --git a/torn-api-codegen/src/openapi/parameter.rs b/torn-api-codegen/src/openapi/parameter.rs index 0b341d2..857fd85 100644 --- a/torn-api-codegen/src/openapi/parameter.rs +++ b/torn-api-codegen/src/openapi/parameter.rs @@ -9,14 +9,14 @@ pub enum ParameterLocation { Path, } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] #[serde(untagged)] pub enum OpenApiParameterDefault<'a> { Int(i32), Str(&'a str), } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] pub struct OpenApiParameterSchema<'a> { #[serde(rename = "$ref")] pub ref_path: Option<&'a str>, @@ -29,7 +29,7 @@ pub struct OpenApiParameterSchema<'a> { pub items: Option>>, } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] pub struct OpenApiParameter<'a> { pub name: &'a str, pub description: Option>, diff --git a/torn-api-codegen/src/openapi/path.rs b/torn-api-codegen/src/openapi/path.rs index e0d06f8..5df455a 100644 --- a/torn-api-codegen/src/openapi/path.rs +++ b/torn-api-codegen/src/openapi/path.rs @@ -1,10 +1,10 @@ use std::borrow::Cow; -use serde::{Deserialize, Deserializer}; +use serde::{Deserialize, Deserializer, Serialize}; use super::parameter::OpenApiParameter; -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] #[serde(untagged)] pub enum OpenApiPathParameter<'a> { Link { @@ -14,13 +14,13 @@ pub enum OpenApiPathParameter<'a> { Inline(OpenApiParameter<'a>), } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] pub struct SchemaLink<'a> { #[serde(rename = "$ref")] pub ref_path: &'a str, } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] #[serde(untagged)] pub enum OpenApiResponseBody<'a> { Schema(SchemaLink<'a>), @@ -30,6 +30,9 @@ pub enum OpenApiResponseBody<'a> { }, } +#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)] +pub struct OperationId(pub String); + fn deserialize_response_body<'de, D>(deserializer: D) -> Result, D::Error> where D: Deserializer<'de>, @@ -60,7 +63,8 @@ where Ok(responses.ok.content.json.schema) } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] +#[serde(rename_all = "snake_case")] pub struct OpenApiPathBody<'a> { pub summary: Option>, pub description: Option>, @@ -72,6 +76,7 @@ pub struct OpenApiPathBody<'a> { deserialize_with = "deserialize_response_body" )] pub response_content: OpenApiResponseBody<'a>, + pub operation_id: Option, } #[derive(Debug, Clone, Deserialize)] diff --git a/torn-api-codegen/src/openapi/schema.rs b/torn-api-codegen/src/openapi/schema.rs index 2450f01..c06a76d 100644 --- a/torn-api-codegen/src/openapi/schema.rs +++ b/torn-api-codegen/src/openapi/schema.rs @@ -19,20 +19,12 @@ pub struct OpenApiSchema<'a> { pub components: Components<'a>, } -impl OpenApiSchema<'_> { - pub fn read() -> Result { - let s = include_str!("../../openapi.json"); - - serde_json::from_str(s) - } -} - #[cfg(test)] -mod test { +pub(crate) mod test { use super::*; - #[test] - fn read() { - OpenApiSchema::read().unwrap(); + pub(crate) fn get_schema() -> OpenApiSchema<'static> { + let s = include_str!("../../../torn-api/openapi.json"); + serde_json::from_str(s).unwrap() } } diff --git a/torn-api/Cargo.toml b/torn-api/Cargo.toml index 71fdb08..46b33a4 100644 --- a/torn-api/Cargo.toml +++ b/torn-api/Cargo.toml @@ -41,3 +41,4 @@ torn-api-codegen = { path = "../torn-api-codegen", version = "0.3.0" } syn = { workspace = true, features = ["parsing"] } proc-macro2 = { workspace = true } prettyplease = "0.2" +serde_json = { workspace = true } diff --git a/torn-api/build.rs b/torn-api/build.rs index 136a95e..cb27066 100644 --- a/torn-api/build.rs +++ b/torn-api/build.rs @@ -15,7 +15,8 @@ fn main() { let requests_dest = Path::new(&out_dir).join("requests.rs"); let scopes_dest = Path::new(&out_dir).join("scopes.rs"); - let schema = OpenApiSchema::read().unwrap(); + let s = include_str!("./openapi.json"); + let schema: OpenApiSchema = serde_json::from_str(s).unwrap(); let mut models_code = TokenStream::new(); diff --git a/torn-api-codegen/openapi.json b/torn-api/openapi.json similarity index 100% rename from torn-api-codegen/openapi.json rename to torn-api/openapi.json From 56e64470de8ff0dc510bd280ee2b08bd44970bc9 Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:27:58 +0200 Subject: [PATCH 21/26] chore: release versions --- Cargo.lock | 4 ++-- torn-api-codegen/Cargo.toml | 2 +- torn-api/Cargo.toml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aa29b2e..cb40bb1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2272,7 +2272,7 @@ dependencies = [ [[package]] name = "torn-api" -version = "1.3.0" +version = "1.4.0" dependencies = [ "bon", "bytes", @@ -2293,7 +2293,7 @@ dependencies = [ [[package]] name = "torn-api-codegen" -version = "0.3.0" +version = "0.4.0" dependencies = [ "heck", "indexmap", diff --git a/torn-api-codegen/Cargo.toml b/torn-api-codegen/Cargo.toml index a2ad99d..80357c9 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.3.0" +version = "0.4.0" edition = "2021" description = "Contains the v2 torn API model descriptions and codegen for the bindings" license-file = { workspace = true } diff --git a/torn-api/Cargo.toml b/torn-api/Cargo.toml index 46b33a4..b2d031c 100644 --- a/torn-api/Cargo.toml +++ b/torn-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "torn-api" -version = "1.3.0" +version = "1.4.0" edition = "2021" description = "Auto-generated bindings for the v2 torn api" license-file = { workspace = true } @@ -37,7 +37,7 @@ chrono = { version = "0.4.41", features = ["serde"] } tokio = { version = "1", features = ["full"] } [build-dependencies] -torn-api-codegen = { path = "../torn-api-codegen", version = "0.3.0" } +torn-api-codegen = { path = "../torn-api-codegen", version = "0.4.0" } syn = { workspace = true, features = ["parsing"] } proc-macro2 = { workspace = true } prettyplease = "0.2" From 8bfa1b8ac30a18b8f9f4c73730a8c9f19176e3c8 Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:27:58 +0200 Subject: [PATCH 22/26] feat(torn-api): added optional strum feature --- Cargo.lock | 27 +++++++++++++++++++++++++-- torn-api-codegen/Cargo.toml | 2 +- torn-api-codegen/src/model/enum.rs | 1 + torn-api/Cargo.toml | 6 ++++-- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cb40bb1..8687be0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2081,6 +2081,28 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "strum" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f64def088c51c9510a8579e3c5d67c65349dcf755e5479ad3d010aa6454e2c32" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c77a8c5abcaf0f9ce05d62342b7d298c346515365c36b673df4ebe3ced01fde8" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + [[package]] name = "subtle" version = "2.6.1" @@ -2272,7 +2294,7 @@ dependencies = [ [[package]] name = "torn-api" -version = "1.4.0" +version = "1.5.0" dependencies = [ "bon", "bytes", @@ -2285,6 +2307,7 @@ dependencies = [ "serde", "serde_json", "serde_repr", + "strum", "syn", "thiserror", "tokio", @@ -2293,7 +2316,7 @@ dependencies = [ [[package]] name = "torn-api-codegen" -version = "0.4.0" +version = "0.5.0" dependencies = [ "heck", "indexmap", diff --git a/torn-api-codegen/Cargo.toml b/torn-api-codegen/Cargo.toml index 80357c9..b8ee430 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.4.0" +version = "0.5.0" 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 23cd52d..aed832b 100644 --- a/torn-api-codegen/src/model/enum.rs +++ b/torn-api-codegen/src/model/enum.rs @@ -309,6 +309,7 @@ impl Enum { Some(quote! { #desc #[derive(Debug, Clone, PartialEq, #(#derives),*)] + #[cfg_attr(feature = "strum", derive(strum::EnumIs, strum::EnumTryAs))] #serde_attr pub enum #name { #(#variants),* diff --git a/torn-api/Cargo.toml b/torn-api/Cargo.toml index b2d031c..75f9dbb 100644 --- a/torn-api/Cargo.toml +++ b/torn-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "torn-api" -version = "1.4.0" +version = "1.5.0" edition = "2021" description = "Auto-generated bindings for the v2 torn api" license-file = { workspace = true } @@ -13,6 +13,7 @@ scopes = ["builder"] builder = ["requests", "dep:bon"] requests = ["models"] models = ["dep:serde_repr"] +strum = ["dep:strum"] [dependencies] serde = { workspace = true, features = ["derive"] } @@ -32,12 +33,13 @@ futures = { version = "0.3", default-features = false, features = [ "async-await", ] } chrono = { version = "0.4.41", features = ["serde"] } +strum = { version = "0.27.1", features = ["derive"], optional = true } [dev-dependencies] tokio = { version = "1", features = ["full"] } [build-dependencies] -torn-api-codegen = { path = "../torn-api-codegen", version = "0.4.0" } +torn-api-codegen = { path = "../torn-api-codegen", version = "0.5.0" } syn = { workspace = true, features = ["parsing"] } proc-macro2 = { workspace = true } prettyplease = "0.2" From c8bdcc81c486c1c61e48b72cda10a47104a64456 Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:27:58 +0200 Subject: [PATCH 23/26] chore(key-pool): expose inner storage and client --- Cargo.lock | 2 +- torn-key-pool/Cargo.toml | 2 +- torn-key-pool/src/lib.rs | 14 ++++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8687be0..42757e2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2329,7 +2329,7 @@ dependencies = [ [[package]] name = "torn-key-pool" -version = "1.1.2" +version = "1.1.3" dependencies = [ "chrono", "futures", diff --git a/torn-key-pool/Cargo.toml b/torn-key-pool/Cargo.toml index 86881da..2164fd4 100644 --- a/torn-key-pool/Cargo.toml +++ b/torn-key-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "torn-key-pool" -version = "1.1.2" +version = "1.1.3" edition = "2021" authors = ["Pyrit [2111649]"] license-file = { workspace = true } diff --git a/torn-key-pool/src/lib.rs b/torn-key-pool/src/lib.rs index 2e41408..4f7d8cb 100644 --- a/torn-key-pool/src/lib.rs +++ b/torn-key-pool/src/lib.rs @@ -3,7 +3,7 @@ #[cfg(feature = "postgres")] pub mod postgres; -use std::{collections::HashMap, future::Future, sync::Arc, time::Duration}; +use std::{collections::HashMap, future::Future, ops::Deref, sync::Arc, time::Duration}; use futures::{future::BoxFuture, FutureExt, Stream, StreamExt}; use reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION}; @@ -354,7 +354,7 @@ where } } -struct KeyPoolInner +pub struct KeyPoolInner where S: KeyPoolStorage, { @@ -473,6 +473,16 @@ where inner: Arc>, } +impl Deref for KeyPool +where + S: KeyPoolStorage, +{ + type Target = KeyPoolInner; + fn deref(&self) -> &Self::Target { + &self.inner + } +} + enum RequestResult { Response(ApiResponse), Retry, From 6aaa06f5012e8ee3f967a042ffb4475fdbf55bae Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:27:59 +0200 Subject: [PATCH 24/26] chore(codegen): implemented `Eq` for `OpenApiSchema` --- torn-api-codegen/src/openapi/path.rs | 2 +- torn-api-codegen/src/openapi/schema.rs | 4 ++-- torn-api/src/executor.rs | 17 ++++++++++++++++- torn-api/src/scopes.rs | 14 ++++++++++++++ 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/torn-api-codegen/src/openapi/path.rs b/torn-api-codegen/src/openapi/path.rs index 5df455a..513870a 100644 --- a/torn-api-codegen/src/openapi/path.rs +++ b/torn-api-codegen/src/openapi/path.rs @@ -79,7 +79,7 @@ pub struct OpenApiPathBody<'a> { pub operation_id: Option, } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] pub struct OpenApiPath<'a> { #[serde(borrow)] pub get: OpenApiPathBody<'a>, diff --git a/torn-api-codegen/src/openapi/schema.rs b/torn-api-codegen/src/openapi/schema.rs index c06a76d..cd2d47b 100644 --- a/torn-api-codegen/src/openapi/schema.rs +++ b/torn-api-codegen/src/openapi/schema.rs @@ -3,7 +3,7 @@ use serde::Deserialize; use super::{parameter::OpenApiParameter, path::OpenApiPath, r#type::OpenApiType}; -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] pub struct Components<'a> { #[serde(borrow)] pub schemas: IndexMap<&'a str, OpenApiType<'a>>, @@ -11,7 +11,7 @@ pub struct Components<'a> { pub parameters: IndexMap<&'a str, OpenApiParameter<'a>>, } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] pub struct OpenApiSchema<'a> { #[serde(borrow)] pub paths: IndexMap<&'a str, OpenApiPath<'a>>, diff --git a/torn-api/src/executor.rs b/torn-api/src/executor.rs index 3ed5d03..61ba949 100644 --- a/torn-api/src/executor.rs +++ b/torn-api/src/executor.rs @@ -4,12 +4,15 @@ use futures::{Stream, StreamExt}; use http::{header::AUTHORIZATION, HeaderMap, HeaderValue}; use serde::Deserialize; -use crate::request::{ApiRequest, ApiResponse, IntoRequest}; #[cfg(feature = "scopes")] use crate::scopes::{ BulkFactionScope, BulkForumScope, BulkMarketScope, BulkRacingScope, BulkTornScope, BulkUserScope, FactionScope, ForumScope, MarketScope, RacingScope, TornScope, UserScope, }; +use crate::{ + request::{ApiRequest, ApiResponse, IntoRequest}, + scopes::{BulkKeyScope, KeyScope}, +}; pub trait Executor: Sized { type Error: From + From + Send; @@ -125,6 +128,8 @@ pub trait ExecutorExt: Executor + Sized { fn racing(self) -> RacingScope; fn forum(self) -> ForumScope; + + fn key(self) -> KeyScope; } #[cfg(feature = "scopes")] @@ -155,6 +160,10 @@ where fn forum(self) -> ForumScope { ForumScope::new(self) } + + fn key(self) -> KeyScope { + KeyScope::new(self) + } } #[cfg(feature = "scopes")] @@ -170,6 +179,8 @@ pub trait BulkExecutorExt: BulkExecutor + Sized { fn racing_bulk(self) -> BulkRacingScope; fn forum_bulk(self) -> BulkForumScope; + + fn key_bulk(self) -> BulkKeyScope; } #[cfg(feature = "scopes")] @@ -200,6 +211,10 @@ where fn forum_bulk(self) -> BulkForumScope { BulkForumScope::new(self) } + + fn key_bulk(self) -> BulkKeyScope { + BulkKeyScope::new(self) + } } pub struct ReqwestClient(reqwest::Client); diff --git a/torn-api/src/scopes.rs b/torn-api/src/scopes.rs index ea548f0..2751181 100644 --- a/torn-api/src/scopes.rs +++ b/torn-api/src/scopes.rs @@ -970,4 +970,18 @@ pub(super) mod test { client.user().reports(|b| b).await.unwrap(); } + + #[tokio::test] + async fn key_info() { + let client = test_client().await; + + client.key().info(|b| b).await.unwrap(); + } + + #[tokio::test] + async fn key_log() { + let client = test_client().await; + + client.key().log(|b| b).await.unwrap(); + } } From 83dfdb27acffd7fdf658a0c709bd29a0e084dc6c Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:27:59 +0200 Subject: [PATCH 25/26] chore(codegen): release version --- Cargo.lock | 2 +- torn-api-codegen/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 42757e2..2f00c1c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2316,7 +2316,7 @@ dependencies = [ [[package]] name = "torn-api-codegen" -version = "0.5.0" +version = "0.5.1" dependencies = [ "heck", "indexmap", diff --git a/torn-api-codegen/Cargo.toml b/torn-api-codegen/Cargo.toml index b8ee430..ae0c4af 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.5.0" +version = "0.5.1" edition = "2021" description = "Contains the v2 torn API model descriptions and codegen for the bindings" license-file = { workspace = true } From 39731f2f5df92156718739a254568789af165a58 Mon Sep 17 00:00:00 2001 From: pyrite Date: Tue, 27 May 2025 19:27:59 +0200 Subject: [PATCH 26/26] feat(codegen): implemented `oneOf` unions for primitive types --- torn-api-codegen/src/model/enum.rs | 251 +++++++++++++++++++--- torn-api-codegen/src/model/mod.rs | 98 ++++++++- torn-api-codegen/src/model/object.rs | 39 ++-- torn-api-codegen/src/model/parameter.rs | 30 ++- torn-api-codegen/src/model/path.rs | 10 +- torn-api-codegen/src/openapi/parameter.rs | 4 + torn-api/build.rs | 57 +---- torn-api/src/scopes.rs | 20 +- 8 files changed, 380 insertions(+), 129 deletions(-) diff --git a/torn-api-codegen/src/model/enum.rs b/torn-api-codegen/src/model/enum.rs index aed832b..2012181 100644 --- a/torn-api-codegen/src/model/enum.rs +++ b/torn-api-codegen/src/model/enum.rs @@ -1,12 +1,15 @@ -use heck::ToUpperCamelCase; +use heck::{ToSnakeCase, ToUpperCamelCase}; use proc_macro2::TokenStream; use quote::{format_ident, quote}; +use syn::Ident; use crate::openapi::{ parameter::OpenApiParameterSchema, r#type::{OpenApiType, OpenApiVariants}, }; +use super::{object::PrimitiveType, ResolvedSchema}; + #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum EnumRepr { U8, @@ -17,10 +20,12 @@ pub enum EnumRepr { pub enum EnumVariantTupleValue { Ref { ty_name: String }, ArrayOfRefs { ty_name: String }, + Primitive(PrimitiveType), + Enum { name: String, inner: Enum }, } impl EnumVariantTupleValue { - pub fn from_schema(schema: &OpenApiType) -> Option { + pub fn from_schema(name: &str, schema: &OpenApiType) -> Option { match schema { OpenApiType { ref_path: Some(path), @@ -44,14 +49,61 @@ impl EnumVariantTupleValue { ty_name: path.strip_prefix("#/components/schemas/")?.to_owned(), }) } + OpenApiType { + r#type: Some("string"), + format: None, + r#enum: None, + .. + } => Some(Self::Primitive(PrimitiveType::String)), + OpenApiType { + r#type: Some("string"), + format: None, + r#enum: Some(_), + .. + } => { + let name = format!("{name}Variant"); + Some(Self::Enum { + inner: Enum::from_schema(&name, schema)?, + name, + }) + } + OpenApiType { + r#type: Some("integer"), + format: Some("int64"), + .. + } => Some(Self::Primitive(PrimitiveType::I64)), + OpenApiType { + r#type: Some("integer"), + format: Some("int32"), + .. + } => Some(Self::Primitive(PrimitiveType::I32)), _ => None, } } - pub fn type_name(&self) -> &str { + pub fn type_name(&self, ns: &mut EnumNamespace) -> TokenStream { match self { - Self::Ref { ty_name } => ty_name, - Self::ArrayOfRefs { ty_name } => ty_name, + Self::Ref { ty_name } => { + let ty = format_ident!("{ty_name}"); + quote! { crate::models::#ty } + } + Self::ArrayOfRefs { ty_name } => { + let ty = format_ident!("{ty_name}"); + quote! { Vec } + } + Self::Primitive(PrimitiveType::I64) => quote! { i64 }, + Self::Primitive(PrimitiveType::I32) => quote! { i32 }, + Self::Primitive(PrimitiveType::Float) => quote! { f32 }, + Self::Primitive(PrimitiveType::String) => quote! { String }, + Self::Primitive(PrimitiveType::DateTime) => quote! { chrono::DateTime }, + Self::Primitive(PrimitiveType::Bool) => quote! { bool }, + Self::Enum { name, .. } => { + let path = ns.get_ident(); + let ty_name = format_ident!("{name}"); + quote! { + #path::#ty_name, + } + } } } @@ -59,6 +111,36 @@ impl EnumVariantTupleValue { match self { Self::Ref { ty_name } => ty_name.clone(), Self::ArrayOfRefs { ty_name } => format!("{ty_name}s"), + Self::Primitive(PrimitiveType::I64) => "I64".to_owned(), + Self::Primitive(PrimitiveType::I32) => "I32".to_owned(), + Self::Primitive(PrimitiveType::Float) => "Float".to_owned(), + Self::Primitive(PrimitiveType::String) => "String".to_owned(), + Self::Primitive(PrimitiveType::DateTime) => "DateTime".to_owned(), + Self::Primitive(PrimitiveType::Bool) => "Bool".to_owned(), + Self::Enum { .. } => "Variant".to_owned(), + } + } + + pub fn is_display(&self, resolved: &ResolvedSchema) -> bool { + match self { + Self::Primitive(_) => true, + Self::Ref { ty_name } | Self::ArrayOfRefs { ty_name } => resolved + .models + .get(ty_name) + .map(|f| f.is_display(resolved)) + .unwrap_or_default(), + Self::Enum { inner, .. } => inner.is_display(resolved), + } + } + + pub fn codegen_display(&self) -> TokenStream { + match self { + Self::ArrayOfRefs { .. } => quote! { + write!(f, "{}", value.iter().map(ToString::to_string).collect::>().join(",")) + }, + _ => quote! { + write!(f, "{}", value) + }, } } } @@ -77,12 +159,32 @@ impl Default for EnumVariantValue { } impl EnumVariantValue { - pub fn codegen_display(&self, name: &str) -> Option { + pub fn is_display(&self, resolved: &ResolvedSchema) -> bool { match self { - Self::Repr(i) => Some(quote! { write!(f, "{}", #i) }), + Self::Repr(_) | Self::String { .. } => true, + Self::Tuple(val) => { + val.len() == 1 + && val + .iter() + .next() + .map(|v| v.is_display(resolved)) + .unwrap_or_default() + } + } + } + + pub fn codegen_display(&self, name: &str) -> Option { + let variant = format_ident!("{name}"); + + match self { + Self::Repr(i) => Some(quote! { Self::#variant => write!(f, "{}", #i) }), Self::String { rename } => { let name = rename.as_deref().unwrap_or(name); - Some(quote! { write!(f, #name) }) + Some(quote! { Self::#variant => write!(f, #name) }) + } + Self::Tuple(values) if values.len() == 1 => { + let rhs = values.first().unwrap().codegen_display(); + Some(quote! { Self::#variant(value) => #rhs }) } _ => None, } @@ -96,8 +198,61 @@ pub struct EnumVariant { pub value: EnumVariantValue, } +pub struct EnumNamespace<'e> { + r#enum: &'e Enum, + ident: Option, + elements: Vec, + top_level_elements: Vec, +} + +impl EnumNamespace<'_> { + pub fn get_ident(&mut self) -> Ident { + self.ident + .get_or_insert_with(|| { + let name = self.r#enum.name.to_snake_case(); + format_ident!("{name}") + }) + .clone() + } + + pub fn push_element(&mut self, el: TokenStream) { + self.elements.push(el); + } + + pub fn push_top_level(&mut self, el: TokenStream) { + self.top_level_elements.push(el); + } + + pub fn codegen(mut self) -> Option { + if self.elements.is_empty() && self.top_level_elements.is_empty() { + None + } else { + let top_level = &self.top_level_elements; + let mut output = quote! { + #(#top_level)* + }; + + if !self.elements.is_empty() { + let ident = self.get_ident(); + let elements = self.elements; + output.extend(quote! { + pub mod #ident { + #(#elements)* + } + }); + } + + Some(output) + } + } +} + impl EnumVariant { - pub fn codegen(&self) -> Option { + pub fn codegen( + &self, + ns: &mut EnumNamespace, + resolved: &ResolvedSchema, + ) -> Option { let doc = self.description.as_ref().map(|d| { quote! { #[doc = #d] @@ -127,15 +282,29 @@ impl EnumVariant { EnumVariantValue::Tuple(values) => { let mut val_tys = Vec::with_capacity(values.len()); - for value in values { - let ty_name = value.type_name(); - let ty_name = format_ident!("{ty_name}"); + if let [value] = values.as_slice() { + let enum_name = format_ident!("{}", ns.r#enum.name); + let ty_name = value.type_name(ns); - val_tys.push(quote! { - crate::models::#ty_name + ns.push_top_level(quote! { + impl From<#ty_name> for #enum_name { + fn from(value: #ty_name) -> Self { + Self::#name(value) + } + } }); } + for value in values { + let ty_name = value.type_name(ns); + + if let EnumVariantTupleValue::Enum { inner, .. } = &value { + ns.push_element(inner.codegen(resolved)?); + } + + val_tys.push(ty_name); + } + Some(quote! { #name(#(#val_tys),*) }) @@ -144,12 +313,7 @@ impl EnumVariant { } pub fn codegen_display(&self) -> Option { - let rhs = self.value.codegen_display(&self.name)?; - let name = format_ident!("{}", self.name); - - Some(quote! { - Self::#name => #rhs - }) + self.value.codegen_display(&self.name) } } @@ -159,7 +323,6 @@ pub struct Enum { pub description: Option, pub repr: Option, pub copy: bool, - pub display: bool, pub untagged: bool, pub variants: Vec, } @@ -176,7 +339,6 @@ impl Enum { match &schema.r#enum { Some(OpenApiVariants::Int(int_variants)) => { result.repr = Some(EnumRepr::U32); - result.display = true; result.variants = int_variants .iter() .copied() @@ -188,7 +350,6 @@ impl Enum { .collect(); } Some(OpenApiVariants::Str(str_variants)) => { - result.display = true; result.variants = str_variants .iter() .copied() @@ -214,7 +375,6 @@ impl Enum { let mut result = Self { name: name.to_owned(), copy: true, - display: true, ..Default::default() }; @@ -240,7 +400,7 @@ impl Enum { }; for schema in schemas { - let value = EnumVariantTupleValue::from_schema(schema)?; + let value = EnumVariantTupleValue::from_schema(name, schema)?; let name = value.name(); result.variants.push(EnumVariant { @@ -253,7 +413,11 @@ impl Enum { Some(result) } - pub fn codegen(&self) -> Option { + pub fn is_display(&self, resolved: &ResolvedSchema) -> bool { + self.variants.iter().all(|v| v.value.is_display(resolved)) + } + + 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)]}, @@ -266,12 +430,21 @@ impl Enum { } }); + let mut ns = EnumNamespace { + r#enum: self, + ident: None, + elements: Default::default(), + top_level_elements: Default::default(), + }; + + let is_display = self.is_display(resolved); + let mut display = Vec::with_capacity(self.variants.len()); let mut variants = Vec::with_capacity(self.variants.len()); for variant in &self.variants { - variants.push(variant.codegen()?); + variants.push(variant.codegen(&mut ns, resolved)?); - if self.display { + if is_display { display.push(variant.codegen_display()?); } } @@ -294,7 +467,7 @@ impl Enum { } }); - let display = self.display.then(|| { + let display = is_display.then(|| { quote! { impl std::fmt::Display for #name { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { @@ -306,6 +479,8 @@ impl Enum { } }); + let module = ns.codegen(); + Some(quote! { #desc #[derive(Debug, Clone, PartialEq, #(#derives),*)] @@ -315,6 +490,24 @@ impl Enum { #(#variants),* } #display + + #module }) } } + +#[cfg(test)] +mod test { + use super::*; + + use crate::openapi::schema::test::get_schema; + + #[test] + fn is_display() { + let schema = get_schema(); + let resolved = ResolvedSchema::from_open_api(&schema); + + let torn_selection_name = resolved.models.get("TornSelectionName").unwrap(); + assert!(torn_selection_name.is_display(&resolved)); + } +} diff --git a/torn-api-codegen/src/model/mod.rs b/torn-api-codegen/src/model/mod.rs index b6c823b..1a8ea80 100644 --- a/torn-api-codegen/src/model/mod.rs +++ b/torn-api-codegen/src/model/mod.rs @@ -1,10 +1,13 @@ use indexmap::IndexMap; use newtype::Newtype; use object::Object; +use parameter::Parameter; +use path::Path; use proc_macro2::TokenStream; use r#enum::Enum; +use scope::Scope; -use crate::openapi::r#type::OpenApiType; +use crate::openapi::{r#type::OpenApiType, schema::OpenApiSchema}; pub mod r#enum; pub mod newtype; @@ -22,6 +25,93 @@ pub enum Model { Unresolved, } +impl Model { + pub fn is_display(&self, resolved: &ResolvedSchema) -> bool { + match self { + Self::Enum(r#enum) => r#enum.is_display(resolved), + Self::Newtype(_) => true, + _ => false, + } + } +} + +#[derive(Debug, Default)] +pub struct ResolvedSchema { + pub models: IndexMap, + pub paths: IndexMap, + pub parameters: Vec, +} + +impl ResolvedSchema { + pub fn from_open_api(schema: &OpenApiSchema) -> Self { + let mut result = Self::default(); + + for (name, r#type) in &schema.components.schemas { + result.models.insert( + name.to_string(), + resolve(r#type, name, &schema.components.schemas), + ); + } + + for (path, body) in &schema.paths { + result.paths.insert( + path.to_string(), + Path::from_schema(path, body, &schema.components.parameters).unwrap(), + ); + } + + for (name, param) in &schema.components.parameters { + result + .parameters + .push(Parameter::from_schema(name, param).unwrap()); + } + + result + } + + pub fn codegen_models(&self) -> TokenStream { + let mut output = TokenStream::default(); + + for model in self.models.values() { + output.extend(model.codegen(self)); + } + + output + } + + pub fn codegen_requests(&self) -> TokenStream { + let mut output = TokenStream::default(); + + for path in self.paths.values() { + output.extend(path.codegen_request(self)); + } + + output + } + + pub fn codegen_parameters(&self) -> TokenStream { + let mut output = TokenStream::default(); + + for param in &self.parameters { + output.extend(param.codegen(self)); + } + + output + } + + pub fn codegen_scopes(&self) -> TokenStream { + let mut output = TokenStream::default(); + + let scopes = Scope::from_paths(self.paths.values().cloned().collect()); + + for scope in scopes { + output.extend(scope.codegen()); + } + + output + } +} + pub fn resolve(r#type: &OpenApiType, name: &str, schemas: &IndexMap<&str, OpenApiType>) -> Model { match r#type { OpenApiType { @@ -48,11 +138,11 @@ pub fn resolve(r#type: &OpenApiType, name: &str, schemas: &IndexMap<&str, OpenAp } impl Model { - pub fn codegen(&self) -> Option { + pub fn codegen(&self, resolved: &ResolvedSchema) -> Option { match self { Self::Newtype(newtype) => newtype.codegen(), - Self::Enum(r#enum) => r#enum.codegen(), - Self::Object(object) => object.codegen(), + Self::Enum(r#enum) => r#enum.codegen(resolved), + Self::Object(object) => object.codegen(resolved), Self::Unresolved => None, } } diff --git a/torn-api-codegen/src/model/object.rs b/torn-api-codegen/src/model/object.rs index ffb6c5a..48b3688 100644 --- a/torn-api-codegen/src/model/object.rs +++ b/torn-api-codegen/src/model/object.rs @@ -6,7 +6,7 @@ use syn::Ident; use crate::openapi::r#type::OpenApiType; -use super::r#enum::Enum; +use super::{r#enum::Enum, ResolvedSchema}; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum PrimitiveType { @@ -28,7 +28,11 @@ pub enum PropertyType { } impl PropertyType { - pub fn codegen(&self, namespace: &mut ObjectNamespace) -> Option { + pub fn codegen( + &self, + namespace: &mut ObjectNamespace, + resolved: &ResolvedSchema, + ) -> Option { match self { Self::Primitive(PrimitiveType::Bool) => Some(format_ident!("bool").into_token_stream()), Self::Primitive(PrimitiveType::I32) => Some(format_ident!("i32").into_token_stream()), @@ -47,7 +51,7 @@ impl PropertyType { Some(quote! { crate::models::#name }) } Self::Enum(r#enum) => { - let code = r#enum.codegen()?; + let code = r#enum.codegen(resolved)?; namespace.push_element(code); let ns = namespace.get_ident(); @@ -58,14 +62,14 @@ impl PropertyType { }) } Self::Array(array) => { - let inner_ty = array.codegen(namespace)?; + let inner_ty = array.codegen(namespace, resolved)?; Some(quote! { Vec<#inner_ty> }) } Self::Nested(nested) => { - let code = nested.codegen()?; + let code = nested.codegen(resolved)?; namespace.push_element(code); let ns = namespace.get_ident(); @@ -233,7 +237,11 @@ impl Property { } } - pub fn codegen(&self, namespace: &mut ObjectNamespace) -> Option { + pub fn codegen( + &self, + namespace: &mut ObjectNamespace, + resolved: &ResolvedSchema, + ) -> Option { let desc = self.description.as_ref().map(|d| quote! { #[doc = #d]}); let name = &self.name; @@ -246,7 +254,7 @@ impl Property { _ => (format_ident!("{name}"), None), }; - let ty_inner = self.r#type.codegen(namespace)?; + let ty_inner = self.r#type.codegen(namespace, resolved)?; let ty = if !self.required || self.nullable { quote! { Option<#ty_inner> } @@ -303,6 +311,7 @@ impl Object { } // TODO: implement custom enum for this (depends on overrides being added) + // Maybe this is an issue with the schema instead? if *prop_name == "value" && name == "TornHof" { continue; } @@ -348,7 +357,7 @@ impl Object { Some(result) } - pub fn codegen(&self) -> Option { + pub fn codegen(&self, resolved: &ResolvedSchema) -> Option { let doc = self.description.as_ref().map(|d| { quote! { #[doc = #d] @@ -363,7 +372,7 @@ impl Object { let mut props = Vec::with_capacity(self.properties.len()); for prop in &self.properties { - props.push(prop.codegen(&mut namespace)?); + props.push(prop.codegen(&mut namespace, resolved)?); } let name = format_ident!("{}", self.name); @@ -422,18 +431,6 @@ mod test { use crate::openapi::schema::test::get_schema; - #[test] - fn resolve_object() { - let schema = get_schema(); - - let attack = schema.components.schemas.get("FactionUpgrades").unwrap(); - - let resolved = - Object::from_schema_object("FactionUpgrades", attack, &schema.components.schemas) - .unwrap(); - let _code = resolved.codegen().unwrap(); - } - #[test] fn resolve_objects() { let schema = get_schema(); diff --git a/torn-api-codegen/src/model/parameter.rs b/torn-api-codegen/src/model/parameter.rs index 733163f..27ba1c9 100644 --- a/torn-api-codegen/src/model/parameter.rs +++ b/torn-api-codegen/src/model/parameter.rs @@ -9,7 +9,7 @@ use crate::openapi::parameter::{ ParameterLocation as SchemaLocation, }; -use super::r#enum::Enum; +use super::{r#enum::Enum, ResolvedSchema}; #[derive(Debug, Clone)] pub struct ParameterOptions

{ @@ -42,9 +42,7 @@ impl ParameterType { match schema { OpenApiParameterSchema { r#type: Some("integer"), - // BUG: missing for some types in the spec - - // format: Some("int32"), + format: Some("int32"), .. } => { let default = match schema.default { @@ -90,6 +88,17 @@ impl ParameterType { r#type: Enum::from_parameter_schema(name, schema)?, }) } + OpenApiParameterSchema { + one_of: Some(schemas), + .. + } => Some(ParameterType::Enum { + options: ParameterOptions { + default: None, + minimum: None, + maximum: None, + }, + r#type: Enum::from_one_of(name, schemas)?, + }), OpenApiParameterSchema { r#type: Some("string"), .. @@ -170,7 +179,7 @@ impl Parameter { }) } - pub fn codegen(&self) -> Option { + pub fn codegen(&self, resolved: &ResolvedSchema) -> Option { match &self.r#type { ParameterType::I32 { options } => { let name = format_ident!("{}", self.name); @@ -274,7 +283,7 @@ The default value [Self::{}](self::{}#variant.{})"#, } let doc = quote! { #[doc = #desc]}; - let inner = r#type.codegen()?; + let inner = r#type.codegen(resolved)?; Some(quote! { #doc @@ -300,7 +309,7 @@ The default value [Self::{}](self::{}#variant.{})"#, ..self.clone() }; - let mut code = inner.codegen().unwrap_or_default(); + let mut code = inner.codegen(resolved).unwrap_or_default(); let name = format_ident!("{}", outer_name); let inner_ty = items.codegen_type_name(&inner_name); @@ -324,9 +333,9 @@ The default value [Self::{}](self::{}#variant.{})"#, } } - impl From for #name where T: IntoIterator { + impl From for #name where T: IntoIterator, T::Item: Into<#inner_ty> { fn from(value: T) -> #name { - let items = value.into_iter().collect(); + let items = value.into_iter().map(Into::into).collect(); Self(items) } @@ -405,6 +414,7 @@ mod test { #[test] fn codegen_inline() { let schema = get_schema(); + let resolved = ResolvedSchema::from_open_api(&schema); let mut params = 0; let mut unresolved = Vec::new(); @@ -425,7 +435,7 @@ mod test { continue; } params += 1; - if param.codegen().is_none() { + if param.codegen(&resolved).is_none() { unresolved.push(format!("`{}.{}`", path, inline.name)); } } diff --git a/torn-api-codegen/src/model/path.rs b/torn-api-codegen/src/model/path.rs index 7f534ce..319360b 100644 --- a/torn-api-codegen/src/model/path.rs +++ b/torn-api-codegen/src/model/path.rs @@ -14,6 +14,7 @@ use crate::openapi::{ use super::{ parameter::{Parameter, ParameterLocation, ParameterType}, union::Union, + ResolvedSchema, }; #[derive(Debug, Clone)] @@ -125,7 +126,7 @@ impl Path { }) } - pub fn codegen_request(&self) -> Option { + pub fn codegen_request(&self, resolved: &ResolvedSchema) -> Option { let name = if self.segments.len() == 1 { let Some(PathSegment::Constant(first)) = self.segments.first() else { return None; @@ -159,7 +160,7 @@ impl Path { let ty_name = format_ident!("{}", param.name); if is_inline { - ns.push_element(param.codegen()?); + ns.push_element(param.codegen(resolved)?); let path = ns.get_ident(); ( @@ -190,7 +191,7 @@ impl Path { ) } ParameterType::Array { .. } => { - ns.push_element(param.codegen()?); + ns.push_element(param.codegen(resolved)?); let ty_name = param.r#type.codegen_type_name(¶m.name); let path = ns.get_ident(); ( @@ -625,6 +626,7 @@ mod test { #[test] fn codegen_paths() { let schema = get_schema(); + let resolved = ResolvedSchema::from_open_api(&schema); let mut paths = 0; let mut unresolved = vec![]; @@ -636,7 +638,7 @@ mod test { continue; }; - if path.codegen_scope_call().is_none() || path.codegen_request().is_none() { + if path.codegen_scope_call().is_none() || path.codegen_request(&resolved).is_none() { unresolved.push(name); } } diff --git a/torn-api-codegen/src/openapi/parameter.rs b/torn-api-codegen/src/openapi/parameter.rs index 857fd85..38a298a 100644 --- a/torn-api-codegen/src/openapi/parameter.rs +++ b/torn-api-codegen/src/openapi/parameter.rs @@ -2,6 +2,8 @@ use std::borrow::Cow; use serde::Deserialize; +use super::r#type::OpenApiType; + #[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize)] #[serde(rename_all = "lowercase")] pub enum ParameterLocation { @@ -17,6 +19,7 @@ pub enum OpenApiParameterDefault<'a> { } #[derive(Debug, Clone, Deserialize, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] pub struct OpenApiParameterSchema<'a> { #[serde(rename = "$ref")] pub ref_path: Option<&'a str>, @@ -27,6 +30,7 @@ pub struct OpenApiParameterSchema<'a> { pub maximum: Option, pub minimum: Option, pub items: Option>>, + pub one_of: Option>>, } #[derive(Debug, Clone, Deserialize, PartialEq, Eq)] diff --git a/torn-api/build.rs b/torn-api/build.rs index cb27066..0d74a6b 100644 --- a/torn-api/build.rs +++ b/torn-api/build.rs @@ -1,12 +1,6 @@ use std::{env, fs, path::Path}; -use proc_macro2::TokenStream; -use torn_api_codegen::{ - model::{parameter::Parameter, path::Path as ApiPath, resolve, scope::Scope}, - openapi::schema::OpenApiSchema, -}; - -const DENY_LIST: &[&str] = &[]; +use torn_api_codegen::{model::ResolvedSchema, openapi::schema::OpenApiSchema}; fn main() { let out_dir = env::var_os("OUT_DIR").unwrap(); @@ -17,60 +11,21 @@ fn main() { let s = include_str!("./openapi.json"); let schema: OpenApiSchema = serde_json::from_str(s).unwrap(); + let resolved = ResolvedSchema::from_open_api(&schema); - let mut models_code = TokenStream::new(); - - for (name, model) in &schema.components.schemas { - if DENY_LIST.contains(name) { - continue; - } - let model = resolve(model, name, &schema.components.schemas); - if let Some(new_code) = model.codegen() { - models_code.extend(new_code); - } - } - - let models_file = syn::parse2(models_code).unwrap(); + let models_file = syn::parse2(resolved.codegen_models()).unwrap(); let models_pretty = prettyplease::unparse(&models_file); fs::write(&model_dest, models_pretty).unwrap(); - let mut params_code = TokenStream::new(); - - for (name, param) in &schema.components.parameters { - if let Some(code) = Parameter::from_schema(name, param).unwrap().codegen() { - params_code.extend(code); - } - } - - let params_file = syn::parse2(params_code).unwrap(); + let params_file = syn::parse2(resolved.codegen_parameters()).unwrap(); let params_pretty = prettyplease::unparse(¶ms_file); fs::write(¶ms_dest, params_pretty).unwrap(); - let mut requests_code = TokenStream::new(); - let mut paths = Vec::new(); - for (name, path) in &schema.paths { - let Some(path) = ApiPath::from_schema(name, path, &schema.components.parameters) else { - continue; - }; - if let Some(code) = path.codegen_request() { - requests_code.extend(code); - } - paths.push(path); - } - - let requests_file = syn::parse2(requests_code).unwrap(); + let requests_file = syn::parse2(resolved.codegen_requests()).unwrap(); let requests_pretty = prettyplease::unparse(&requests_file); fs::write(&requests_dest, requests_pretty).unwrap(); - let mut scope_code = TokenStream::new(); - let scopes = Scope::from_paths(paths); - for scope in scopes { - if let Some(code) = scope.codegen() { - scope_code.extend(code); - } - } - - let scopes_file = syn::parse2(scope_code).unwrap(); + let scopes_file = syn::parse2(resolved.codegen_scopes()).unwrap(); let scopes_pretty = prettyplease::unparse(&scopes_file); fs::write(&scopes_dest, scopes_pretty).unwrap(); } diff --git a/torn-api/src/scopes.rs b/torn-api/src/scopes.rs index 2751181..bc3e868 100644 --- a/torn-api/src/scopes.rs +++ b/torn-api/src/scopes.rs @@ -9,8 +9,8 @@ pub(super) mod test { use crate::{ executor::{ExecutorExt, ReqwestClient}, models::{ - AttackCode, FactionSelectionName, PersonalStatsCategoryEnum, PersonalStatsStatName, - UserListEnum, + faction_selection_name::FactionSelectionNameVariant, AttackCode, FactionSelectionName, + PersonalStatsCategoryEnum, PersonalStatsStatName, UserListEnum, }, }; @@ -67,7 +67,10 @@ pub(super) mod test { let r = client .faction() .for_selections(|b| { - b.selections([FactionSelectionName::Basic, FactionSelectionName::Balance]) + b.selections([ + FactionSelectionNameVariant::Basic, + FactionSelectionNameVariant::Balance, + ]) }) .await .unwrap(); @@ -424,7 +427,7 @@ pub(super) mod test { let forum_scope = ForumScope(&client); forum_scope - .threads_for_category_ids([2.into()].into(), |b| b) + .threads_for_category_ids([2].into(), |b| b) .await .unwrap(); } @@ -495,14 +498,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() { @@ -648,10 +651,7 @@ pub(super) mod test { let torn_scope = TornScope(&client); - torn_scope - .items_for_ids([1.into()].into(), |b| b) - .await - .unwrap(); + torn_scope.items_for_ids([1].into(), |b| b).await.unwrap(); } #[tokio::test]