Compare commits
3 commits
5076a5d733
...
6482c951a1
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6482c951a1 | ||
![]() |
4a6c007bc4 | ||
![]() |
8ecd9a88d3 |
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -227,6 +227,7 @@ dependencies = [
|
||||||
"iana-time-zone",
|
"iana-time-zone",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
|
"serde",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"windows-link",
|
"windows-link",
|
||||||
]
|
]
|
||||||
|
@ -2271,10 +2272,11 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "torn-api"
|
name = "torn-api"
|
||||||
version = "1.2.0"
|
version = "1.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bon",
|
"bon",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
"chrono",
|
||||||
"futures",
|
"futures",
|
||||||
"http",
|
"http",
|
||||||
"prettyplease",
|
"prettyplease",
|
||||||
|
@ -2291,7 +2293,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "torn-api-codegen"
|
name = "torn-api-codegen"
|
||||||
version = "0.2.4"
|
version = "0.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "torn-api-codegen"
|
name = "torn-api-codegen"
|
||||||
authors = ["Pyrit [2111649]"]
|
authors = ["Pyrit [2111649]"]
|
||||||
version = "0.2.4"
|
version = "0.3.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Contains the v2 torn API model descriptions and codegen for the bindings"
|
description = "Contains the v2 torn API model descriptions and codegen for the bindings"
|
||||||
license-file = { workspace = true }
|
license-file = { workspace = true }
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"info": {
|
"info": {
|
||||||
"title": "Torn API",
|
"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.",
|
"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": [
|
"servers": [
|
||||||
{
|
{
|
||||||
|
@ -1226,6 +1226,69 @@
|
||||||
"x-stability": "Stable"
|
"x-stability": "Stable"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/user/reports": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"User"
|
||||||
|
],
|
||||||
|
"summary": "Get your reports",
|
||||||
|
"description": "Requires limited access key. <br>\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": {
|
"/user/revives": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
|
@ -2787,6 +2850,69 @@
|
||||||
"x-stability": "Stable"
|
"x-stability": "Stable"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/faction/reports": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"Faction"
|
||||||
|
],
|
||||||
|
"summary": "Get faction reports",
|
||||||
|
"description": "Requires limited access key. <br>\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": {
|
"/faction/revives": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
|
@ -3998,15 +4124,6 @@
|
||||||
{
|
{
|
||||||
"$ref": "#/components/parameters/ApiOffsetNoDefault"
|
"$ref": "#/components/parameters/ApiOffsetNoDefault"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "cat",
|
|
||||||
"in": "query",
|
|
||||||
"description": "Selection category",
|
|
||||||
"required": false,
|
|
||||||
"schema": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"$ref": "#/components/parameters/ApiTimestamp"
|
"$ref": "#/components/parameters/ApiTimestamp"
|
||||||
},
|
},
|
||||||
|
@ -5983,6 +6100,37 @@
|
||||||
"E"
|
"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": {
|
"ApiKeyAccessTypeEnum": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
|
@ -11450,6 +11598,551 @@
|
||||||
},
|
},
|
||||||
"type": "object"
|
"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": {
|
"UserCurrentEducation": {
|
||||||
"required": [
|
"required": [
|
||||||
"id",
|
"id",
|
||||||
|
@ -12412,7 +13105,7 @@
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"value": {
|
"value": {
|
||||||
"type": "integer",
|
"type": "number",
|
||||||
"format": "float"
|
"format": "float"
|
||||||
},
|
},
|
||||||
"rank": {
|
"rank": {
|
||||||
|
@ -12434,7 +13127,7 @@
|
||||||
"rank": {
|
"rank": {
|
||||||
"oneOf": [
|
"oneOf": [
|
||||||
{
|
{
|
||||||
"type": "number",
|
"type": "integer",
|
||||||
"format": "int32"
|
"format": "int32"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -21603,6 +22296,16 @@
|
||||||
"minimum": 1
|
"minimum": 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ApiTarget": {
|
||||||
|
"name": "target",
|
||||||
|
"in": "query",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32",
|
||||||
|
"minimum": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
"ApiSort": {
|
"ApiSort": {
|
||||||
"name": "sort",
|
"name": "sort",
|
||||||
"in": "query",
|
"in": "query",
|
||||||
|
|
|
@ -61,10 +61,7 @@ impl Model {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{
|
use crate::openapi::schema::OpenApiSchema;
|
||||||
model::r#enum::{EnumRepr, EnumVariant},
|
|
||||||
openapi::schema::OpenApiSchema,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn resolve_newtypes() {
|
fn resolve_newtypes() {
|
||||||
|
|
|
@ -15,6 +15,7 @@ pub enum PrimitiveType {
|
||||||
I64,
|
I64,
|
||||||
String,
|
String,
|
||||||
Float,
|
Float,
|
||||||
|
DateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
|
@ -35,6 +36,9 @@ impl PropertyType {
|
||||||
Self::Primitive(PrimitiveType::String) => {
|
Self::Primitive(PrimitiveType::String) => {
|
||||||
Some(format_ident!("String").into_token_stream())
|
Some(format_ident!("String").into_token_stream())
|
||||||
}
|
}
|
||||||
|
Self::Primitive(PrimitiveType::DateTime) => {
|
||||||
|
Some(quote! { chrono::DateTime<chrono::Utc> })
|
||||||
|
}
|
||||||
Self::Primitive(PrimitiveType::Float) => Some(format_ident!("f64").into_token_stream()),
|
Self::Primitive(PrimitiveType::Float) => Some(format_ident!("f64").into_token_stream()),
|
||||||
Self::Ref(path) => {
|
Self::Ref(path) => {
|
||||||
let name = path.strip_prefix("#/components/schemas/")?;
|
let name = path.strip_prefix("#/components/schemas/")?;
|
||||||
|
@ -211,6 +215,7 @@ impl Property {
|
||||||
PrimitiveType::Float
|
PrimitiveType::Float
|
||||||
}
|
}
|
||||||
(Some("string"), None) => PrimitiveType::String,
|
(Some("string"), None) => PrimitiveType::String,
|
||||||
|
(Some("string"), Some("date")) => PrimitiveType::DateTime,
|
||||||
(Some("boolean"), None) => PrimitiveType::Bool,
|
(Some("boolean"), None) => PrimitiveType::Bool,
|
||||||
_ => return None,
|
_ => return None,
|
||||||
};
|
};
|
||||||
|
|
|
@ -303,12 +303,7 @@ The default value [Self::{}](self::{}#variant.{})"#,
|
||||||
let mut code = inner.codegen().unwrap_or_default();
|
let mut code = inner.codegen().unwrap_or_default();
|
||||||
|
|
||||||
let name = format_ident!("{}", outer_name);
|
let name = format_ident!("{}", outer_name);
|
||||||
let inner_ty = if matches!(items.as_ref(), ParameterType::Schema { type_name: _ }) {
|
let inner_ty = items.codegen_type_name(&inner_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! {
|
code.extend(quote! {
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "torn-api"
|
name = "torn-api"
|
||||||
version = "1.2.0"
|
version = "1.3.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Auto-generated bindings for the v2 torn api"
|
description = "Auto-generated bindings for the v2 torn api"
|
||||||
license-file = { workspace = true }
|
license-file = { workspace = true }
|
||||||
|
@ -31,12 +31,13 @@ futures = { version = "0.3", default-features = false, features = [
|
||||||
"std",
|
"std",
|
||||||
"async-await",
|
"async-await",
|
||||||
] }
|
] }
|
||||||
|
chrono = { version = "0.4.41", features = ["serde"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
|
|
||||||
[build-dependencies]
|
[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"] }
|
syn = { workspace = true, features = ["parsing"] }
|
||||||
proc-macro2 = { workspace = true }
|
proc-macro2 = { workspace = true }
|
||||||
prettyplease = "0.2"
|
prettyplease = "0.2"
|
||||||
|
|
|
@ -366,6 +366,15 @@ pub(super) mod test {
|
||||||
faction_scope.lookup(|b| b).await.unwrap();
|
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]
|
#[tokio::test]
|
||||||
async fn forum_categories() {
|
async fn forum_categories() {
|
||||||
let client = test_client().await;
|
let client = test_client().await;
|
||||||
|
@ -954,4 +963,11 @@ pub(super) mod test {
|
||||||
|
|
||||||
client.user().attacks(|b| b).await.unwrap();
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue