tornapi-typescript 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +24 -24
- package/README.md +30 -27
- package/dist/index.d.ts +9 -10
- package/dist/openapi.json +74 -27
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
This is free and unencumbered software released into the public domain.
|
|
2
|
-
|
|
3
|
-
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
4
|
-
distribute this software, either in source code form or as a compiled
|
|
5
|
-
binary, for any purpose, commercial or non-commercial, and by any
|
|
6
|
-
means.
|
|
7
|
-
|
|
8
|
-
In jurisdictions that recognize copyright laws, the author or authors
|
|
9
|
-
of this software dedicate any and all copyright interest in the
|
|
10
|
-
software to the public domain. We make this dedication for the benefit
|
|
11
|
-
of the public at large and to the detriment of our heirs and
|
|
12
|
-
successors. We intend this dedication to be an overt act of
|
|
13
|
-
relinquishment in perpetuity of all present and future rights to this
|
|
14
|
-
software under copyright law.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
-
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
20
|
-
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
21
|
-
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
-
OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
-
|
|
24
|
-
For more information, please refer to <https://unlicense.org>
|
|
1
|
+
This is free and unencumbered software released into the public domain.
|
|
2
|
+
|
|
3
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
4
|
+
distribute this software, either in source code form or as a compiled
|
|
5
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
|
6
|
+
means.
|
|
7
|
+
|
|
8
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
|
9
|
+
of this software dedicate any and all copyright interest in the
|
|
10
|
+
software to the public domain. We make this dedication for the benefit
|
|
11
|
+
of the public at large and to the detriment of our heirs and
|
|
12
|
+
successors. We intend this dedication to be an overt act of
|
|
13
|
+
relinquishment in perpetuity of all present and future rights to this
|
|
14
|
+
software under copyright law.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
20
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
21
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
|
|
24
|
+
For more information, please refer to <https://unlicense.org>
|
package/README.md
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
# TornAPI Typescript
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
# TornAPI Typescript
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/tornapi-typescript)
|
|
4
|
+
[](https://www.npmjs.com/package/tornapi-typescript)
|
|
5
|
+
|
|
6
|
+
Automatically generated type definition in Typescript for [torn.com](https://torn.com) API V2.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
`npm i -D tornapi-typescript`
|
|
11
|
+
|
|
12
|
+
## Generation
|
|
13
|
+
|
|
14
|
+
These types are generated in the following way:
|
|
15
|
+
|
|
16
|
+
* load [openapi specification](https://www.torn.com/swagger/openapi.json)
|
|
17
|
+
* clean the specification for better types
|
|
18
|
+
* remove `type` when `allOf` is present, otherwise the specification is not valid
|
|
19
|
+
* remove `type` when `oneOf` is present, for improved types
|
|
20
|
+
* mark all fields as required, for improved types
|
|
21
|
+
* convert the specification to Typescript definitions using [typeconv](https://github.com/grantila/typeconv)
|
|
22
|
+
* clean the type definitions
|
|
23
|
+
* remove all "[key: string]: any;", because typeconv adds it everywhere for some reason
|
|
24
|
+
* remove all empty objects (caused by the above cleaning)
|
|
25
|
+
* run through prettier to have it look decent
|
|
26
|
+
|
|
27
|
+
## Contact
|
|
28
|
+
|
|
29
|
+
You can join the community in [our Discord server](https://discord.gg/2wb7GKN). There you can discuss anything related
|
|
30
|
+
to the Torn API, or other tools related to Torn. Issues can also be reported there, or as GitHub issue.
|
package/dist/index.d.ts
CHANGED
|
@@ -429,7 +429,6 @@ export type TornItemTypeEnum =
|
|
|
429
429
|
| "Car"
|
|
430
430
|
| "Clothing"
|
|
431
431
|
| "Collectible"
|
|
432
|
-
| "Defensive"
|
|
433
432
|
| "Drug"
|
|
434
433
|
| "Energy Drink"
|
|
435
434
|
| "Enhancer"
|
|
@@ -437,14 +436,10 @@ export type TornItemTypeEnum =
|
|
|
437
436
|
| "Jewelry"
|
|
438
437
|
| "Material"
|
|
439
438
|
| "Medical"
|
|
440
|
-
| "Melee"
|
|
441
439
|
| "Other"
|
|
442
440
|
| "Plushie"
|
|
443
|
-
| "Primary"
|
|
444
|
-
| "Secondary"
|
|
445
441
|
| "Special"
|
|
446
442
|
| "Supply Pack"
|
|
447
|
-
| "Temporary"
|
|
448
443
|
| "Tool"
|
|
449
444
|
| "Unused"
|
|
450
445
|
| "Weapon";
|
|
@@ -961,7 +956,9 @@ export interface FactionCrimeSlot {
|
|
|
961
956
|
} | null;
|
|
962
957
|
user_id: UserId;
|
|
963
958
|
user: FactionCrimeUser | null;
|
|
959
|
+
/** This field is replaced with 'crime_pass_rate' field and will be removed on 1st of May 2025. */
|
|
964
960
|
success_chance: number;
|
|
961
|
+
crime_pass_rate: number;
|
|
965
962
|
}
|
|
966
963
|
|
|
967
964
|
export interface FactionCrime {
|
|
@@ -971,9 +968,6 @@ export interface FactionCrime {
|
|
|
971
968
|
status: FactionCrimeStatusEnum;
|
|
972
969
|
/** The timestamp at which the crime was created. */
|
|
973
970
|
created_at: number;
|
|
974
|
-
initiated_at: /** Replaced by the 'planning_at' field (same value). This field will be removed in the future (1st Februrary 2025 or later). */
|
|
975
|
-
| number /** Replaced by the 'planning_at' field (same value). This field will be removed in the future (1st Februrary 2025 or later). */
|
|
976
|
-
| null;
|
|
977
971
|
planning_at: /** The timestamp at which the planning phase for the crime has begun. */
|
|
978
972
|
| number /** The timestamp at which the planning phase for the crime has begun. */
|
|
979
973
|
| null;
|
|
@@ -993,6 +987,10 @@ export interface FactionCrimesResponse {
|
|
|
993
987
|
_metadata: RequestMetadataWithLinks;
|
|
994
988
|
}
|
|
995
989
|
|
|
990
|
+
export interface FactionCrimeResponse {
|
|
991
|
+
crime: FactionCrime;
|
|
992
|
+
}
|
|
993
|
+
|
|
996
994
|
/** The following selections will fallback to API v1 and may change at any time: 'armor', 'boosters', 'caches', 'cesium', 'contributors', 'crimeexp', 'currency', 'donations', 'drugs', 'medical', 'positions', 'reports', 'stats', 'temporary', 'upgrades', 'weapons'. */
|
|
997
995
|
export type FactionSelectionName =
|
|
998
996
|
| "applications"
|
|
@@ -1002,6 +1000,7 @@ export type FactionSelectionName =
|
|
|
1002
1000
|
| "chain"
|
|
1003
1001
|
| "chainreport"
|
|
1004
1002
|
| "chains"
|
|
1003
|
+
| "crime"
|
|
1005
1004
|
| "crimes"
|
|
1006
1005
|
| "hof"
|
|
1007
1006
|
| "lookup"
|
|
@@ -1223,12 +1222,14 @@ export interface ItemMarketListingItemBonus {
|
|
|
1223
1222
|
id: number;
|
|
1224
1223
|
title: string;
|
|
1225
1224
|
description: string;
|
|
1225
|
+
value: number;
|
|
1226
1226
|
}
|
|
1227
1227
|
|
|
1228
1228
|
export interface ItemMarketListingItemStats {
|
|
1229
1229
|
damage: number | null;
|
|
1230
1230
|
accuracy: number | null;
|
|
1231
1231
|
armor: number | null;
|
|
1232
|
+
quality: number;
|
|
1232
1233
|
}
|
|
1233
1234
|
|
|
1234
1235
|
export interface ItemMarketItem {
|
|
@@ -1239,7 +1240,6 @@ export interface ItemMarketItem {
|
|
|
1239
1240
|
}
|
|
1240
1241
|
|
|
1241
1242
|
export interface ItemMarketListingStackable {
|
|
1242
|
-
id: number;
|
|
1243
1243
|
price: number;
|
|
1244
1244
|
amount: number;
|
|
1245
1245
|
}
|
|
@@ -1252,7 +1252,6 @@ export interface ItemMarketListingItemDetails {
|
|
|
1252
1252
|
}
|
|
1253
1253
|
|
|
1254
1254
|
export interface ItemMarketListingNonstackable {
|
|
1255
|
-
id: number;
|
|
1256
1255
|
price: number;
|
|
1257
1256
|
amount: number;
|
|
1258
1257
|
itemDetails: ItemMarketListingItemDetails;
|
package/dist/openapi.json
CHANGED
|
@@ -799,7 +799,7 @@
|
|
|
799
799
|
"get": {
|
|
800
800
|
"tags": [
|
|
801
801
|
"User",
|
|
802
|
-
"
|
|
802
|
+
"Stable"
|
|
803
803
|
],
|
|
804
804
|
"summary": "Get your current ongoing organized crime",
|
|
805
805
|
"description": "Requires minimal access key. <br>",
|
|
@@ -1740,7 +1740,7 @@
|
|
|
1740
1740
|
"get": {
|
|
1741
1741
|
"tags": [
|
|
1742
1742
|
"Faction",
|
|
1743
|
-
"
|
|
1743
|
+
"Stable"
|
|
1744
1744
|
],
|
|
1745
1745
|
"summary": "Get your faction's organized crimes",
|
|
1746
1746
|
"description": "Requires public minimal access key with faction API access permissions. <br> It's possible to get older entries either by timestamp range (from, to) or with offset.",
|
|
@@ -1818,6 +1818,44 @@
|
|
|
1818
1818
|
]
|
|
1819
1819
|
}
|
|
1820
1820
|
},
|
|
1821
|
+
"/faction/{id}/crime": {
|
|
1822
|
+
"get": {
|
|
1823
|
+
"tags": [
|
|
1824
|
+
"Faction",
|
|
1825
|
+
"Stable"
|
|
1826
|
+
],
|
|
1827
|
+
"summary": "Get a specific organized crime",
|
|
1828
|
+
"description": "Requires public minimal access key with faction API access permissions. <br>",
|
|
1829
|
+
"parameters": [
|
|
1830
|
+
{
|
|
1831
|
+
"name": "id",
|
|
1832
|
+
"in": "path",
|
|
1833
|
+
"description": "Crime id",
|
|
1834
|
+
"required": true,
|
|
1835
|
+
"schema": {
|
|
1836
|
+
"$ref": "#/components/schemas/ItemId"
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
],
|
|
1840
|
+
"responses": {
|
|
1841
|
+
"200": {
|
|
1842
|
+
"description": "Successful operation",
|
|
1843
|
+
"content": {
|
|
1844
|
+
"application/json": {
|
|
1845
|
+
"schema": {
|
|
1846
|
+
"$ref": "#/components/schemas/FactionCrimeResponse"
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
},
|
|
1852
|
+
"security": [
|
|
1853
|
+
{
|
|
1854
|
+
"api_key": []
|
|
1855
|
+
}
|
|
1856
|
+
]
|
|
1857
|
+
}
|
|
1858
|
+
},
|
|
1821
1859
|
"/faction/hof": {
|
|
1822
1860
|
"get": {
|
|
1823
1861
|
"tags": [
|
|
@@ -2463,6 +2501,9 @@
|
|
|
2463
2501
|
{
|
|
2464
2502
|
"$ref": "#/components/schemas/FactionCrimesResponse"
|
|
2465
2503
|
},
|
|
2504
|
+
{
|
|
2505
|
+
"$ref": "#/components/schemas/FactionCrimeResponse"
|
|
2506
|
+
},
|
|
2466
2507
|
{
|
|
2467
2508
|
"$ref": "#/components/schemas/FactionRankedWarReportResponse"
|
|
2468
2509
|
},
|
|
@@ -3553,7 +3594,6 @@
|
|
|
3553
3594
|
"description": "Requires public key. <br>",
|
|
3554
3595
|
"parameters": [
|
|
3555
3596
|
{
|
|
3556
|
-
"parameter": "LogId",
|
|
3557
3597
|
"name": "log",
|
|
3558
3598
|
"in": "query",
|
|
3559
3599
|
"description": "Code of the attack log. E.g. d51ad4fe6be884b309b142e2d1d4f807",
|
|
@@ -4799,7 +4839,6 @@
|
|
|
4799
4839
|
"Car",
|
|
4800
4840
|
"Clothing",
|
|
4801
4841
|
"Collectible",
|
|
4802
|
-
"Defensive",
|
|
4803
4842
|
"Drug",
|
|
4804
4843
|
"Energy Drink",
|
|
4805
4844
|
"Enhancer",
|
|
@@ -4807,14 +4846,10 @@
|
|
|
4807
4846
|
"Jewelry",
|
|
4808
4847
|
"Material",
|
|
4809
4848
|
"Medical",
|
|
4810
|
-
"Melee",
|
|
4811
4849
|
"Other",
|
|
4812
4850
|
"Plushie",
|
|
4813
|
-
"Primary",
|
|
4814
|
-
"Secondary",
|
|
4815
4851
|
"Special",
|
|
4816
4852
|
"Supply Pack",
|
|
4817
|
-
"Temporary",
|
|
4818
4853
|
"Tool",
|
|
4819
4854
|
"Unused",
|
|
4820
4855
|
"Weapon"
|
|
@@ -6560,6 +6595,11 @@
|
|
|
6560
6595
|
]
|
|
6561
6596
|
},
|
|
6562
6597
|
"success_chance": {
|
|
6598
|
+
"description": "This field is replaced with 'crime_pass_rate' field and will be removed on 1st of May 2025.",
|
|
6599
|
+
"type": "integer",
|
|
6600
|
+
"deprecated": true
|
|
6601
|
+
},
|
|
6602
|
+
"crime_pass_rate": {
|
|
6563
6603
|
"type": "integer"
|
|
6564
6604
|
}
|
|
6565
6605
|
},
|
|
@@ -6569,7 +6609,8 @@
|
|
|
6569
6609
|
"item_requirement",
|
|
6570
6610
|
"user_id",
|
|
6571
6611
|
"user",
|
|
6572
|
-
"success_chance"
|
|
6612
|
+
"success_chance",
|
|
6613
|
+
"crime_pass_rate"
|
|
6573
6614
|
]
|
|
6574
6615
|
},
|
|
6575
6616
|
"FactionCrime": {
|
|
@@ -6590,12 +6631,6 @@
|
|
|
6590
6631
|
"description": "The timestamp at which the crime was created.",
|
|
6591
6632
|
"type": "integer"
|
|
6592
6633
|
},
|
|
6593
|
-
"initiated_at": {
|
|
6594
|
-
"description": "Replaced by the 'planning_at' field (same value). This field will be removed in the future (1st Februrary 2025 or later).",
|
|
6595
|
-
"type": "integer",
|
|
6596
|
-
"nullable": true,
|
|
6597
|
-
"deprecated": true
|
|
6598
|
-
},
|
|
6599
6634
|
"planning_at": {
|
|
6600
6635
|
"description": "The timestamp at which the planning phase for the crime has begun.",
|
|
6601
6636
|
"type": "integer",
|
|
@@ -6641,7 +6676,6 @@
|
|
|
6641
6676
|
"difficulty",
|
|
6642
6677
|
"status",
|
|
6643
6678
|
"created_at",
|
|
6644
|
-
"initiated_at",
|
|
6645
6679
|
"planning_at",
|
|
6646
6680
|
"ready_at",
|
|
6647
6681
|
"expired_at",
|
|
@@ -6668,6 +6702,17 @@
|
|
|
6668
6702
|
"_metadata"
|
|
6669
6703
|
]
|
|
6670
6704
|
},
|
|
6705
|
+
"FactionCrimeResponse": {
|
|
6706
|
+
"properties": {
|
|
6707
|
+
"crime": {
|
|
6708
|
+
"$ref": "#/components/schemas/FactionCrime"
|
|
6709
|
+
}
|
|
6710
|
+
},
|
|
6711
|
+
"type": "object",
|
|
6712
|
+
"required": [
|
|
6713
|
+
"crime"
|
|
6714
|
+
]
|
|
6715
|
+
},
|
|
6671
6716
|
"FactionSelectionName": {
|
|
6672
6717
|
"description": "The following selections will fallback to API v1 and may change at any time: 'armor', 'boosters', 'caches', 'cesium', 'contributors', 'crimeexp', 'currency', 'donations', 'drugs', 'medical', 'positions', 'reports', 'stats', 'temporary', 'upgrades', 'weapons'.",
|
|
6673
6718
|
"type": "string",
|
|
@@ -6679,6 +6724,7 @@
|
|
|
6679
6724
|
"chain",
|
|
6680
6725
|
"chainreport",
|
|
6681
6726
|
"chains",
|
|
6727
|
+
"crime",
|
|
6682
6728
|
"crimes",
|
|
6683
6729
|
"hof",
|
|
6684
6730
|
"lookup",
|
|
@@ -7333,13 +7379,17 @@
|
|
|
7333
7379
|
},
|
|
7334
7380
|
"description": {
|
|
7335
7381
|
"type": "string"
|
|
7382
|
+
},
|
|
7383
|
+
"value": {
|
|
7384
|
+
"type": "integer"
|
|
7336
7385
|
}
|
|
7337
7386
|
},
|
|
7338
7387
|
"type": "object",
|
|
7339
7388
|
"required": [
|
|
7340
7389
|
"id",
|
|
7341
7390
|
"title",
|
|
7342
|
-
"description"
|
|
7391
|
+
"description",
|
|
7392
|
+
"value"
|
|
7343
7393
|
]
|
|
7344
7394
|
},
|
|
7345
7395
|
"ItemMarketListingItemStats": {
|
|
@@ -7358,13 +7408,18 @@
|
|
|
7358
7408
|
"type": "number",
|
|
7359
7409
|
"format": "float",
|
|
7360
7410
|
"nullable": true
|
|
7411
|
+
},
|
|
7412
|
+
"quality": {
|
|
7413
|
+
"type": "number",
|
|
7414
|
+
"format": "float"
|
|
7361
7415
|
}
|
|
7362
7416
|
},
|
|
7363
7417
|
"type": "object",
|
|
7364
7418
|
"required": [
|
|
7365
7419
|
"damage",
|
|
7366
7420
|
"accuracy",
|
|
7367
|
-
"armor"
|
|
7421
|
+
"armor",
|
|
7422
|
+
"quality"
|
|
7368
7423
|
]
|
|
7369
7424
|
},
|
|
7370
7425
|
"ItemMarketItem": {
|
|
@@ -7392,9 +7447,6 @@
|
|
|
7392
7447
|
},
|
|
7393
7448
|
"ItemMarketListingStackable": {
|
|
7394
7449
|
"properties": {
|
|
7395
|
-
"id": {
|
|
7396
|
-
"type": "integer"
|
|
7397
|
-
},
|
|
7398
7450
|
"price": {
|
|
7399
7451
|
"type": "integer"
|
|
7400
7452
|
},
|
|
@@ -7404,7 +7456,6 @@
|
|
|
7404
7456
|
},
|
|
7405
7457
|
"type": "object",
|
|
7406
7458
|
"required": [
|
|
7407
|
-
"id",
|
|
7408
7459
|
"price",
|
|
7409
7460
|
"amount"
|
|
7410
7461
|
]
|
|
@@ -7443,9 +7494,6 @@
|
|
|
7443
7494
|
},
|
|
7444
7495
|
"ItemMarketListingNonstackable": {
|
|
7445
7496
|
"properties": {
|
|
7446
|
-
"id": {
|
|
7447
|
-
"type": "integer"
|
|
7448
|
-
},
|
|
7449
7497
|
"price": {
|
|
7450
7498
|
"type": "integer"
|
|
7451
7499
|
},
|
|
@@ -7458,7 +7506,6 @@
|
|
|
7458
7506
|
},
|
|
7459
7507
|
"type": "object",
|
|
7460
7508
|
"required": [
|
|
7461
|
-
"id",
|
|
7462
7509
|
"price",
|
|
7463
7510
|
"amount",
|
|
7464
7511
|
"itemDetails"
|
|
@@ -8471,7 +8518,7 @@
|
|
|
8471
8518
|
}
|
|
8472
8519
|
},
|
|
8473
8520
|
"type": "object",
|
|
8474
|
-
"nullable":
|
|
8521
|
+
"nullable": true,
|
|
8475
8522
|
"required": [
|
|
8476
8523
|
"id",
|
|
8477
8524
|
"name"
|