tornapi-typescript 4.2.3 → 4.3.1

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/dist/index.d.ts CHANGED
@@ -5,10 +5,14 @@
5
5
  * - {@link https://github.com/grantila/typeconv}
6
6
  */
7
7
  export type RaceClassEnum = "A" | "B" | "C" | "D" | "E";
8
+ export type MissionDifficultyEnum = "Very easy" | "Easy" | "Medium" | "Hard" | "Very hard" | "Expert";
9
+ export type MissionStatusEnum = "Accepted" | "Available" | "Failed" | "Completed";
10
+ export type MissionRewardUpgrade = "Item" | "Ammo" | "Upgrade";
8
11
  export type UserDonatorStatusEnum = "Donator" | "Subscriber";
9
12
  export type UserMessageTypeEnum = "Company newsletter" | "Faction newsletter" | "Warning" | "User message";
10
13
  export type JobTypeEnum = "Army" | "Casino" | "Education" | "Grocer" | "Law" | "Medical";
11
14
  export type UserMaritalStatusEnum = "Engaged" | "Newlywed" | "Married";
15
+ export type UserLastActionStatusEnum = "Online" | "Idle" | "Offline";
12
16
  export type UserPlaneImageTypeEnum = "private_jet" | "light_aircraft" | "airliner";
13
17
  export type UserFlyMethodEnum = "Private" | "Business" | "Airstrip" | "Standard";
14
18
  export type UserStatusStateEnum = "Abroad" | "Awoken" | "Dormant" | "Fallen" | "Federal" | "Hospital" | "Jail" | "Okay" | "Traveling";
@@ -352,6 +356,50 @@ export interface ReportsResponse {
352
356
  _metadata: RequestMetadataWithLinks;
353
357
  }
354
358
  export type SelectionCategoryEnum = ReportTypeEnum | UserListEnum | PersonalStatsCategoryEnum | RacingRaceTypeEnum;
359
+ export interface MissionRewardDetailsAmmo {
360
+ id: AmmoId;
361
+ name: string;
362
+ type: TornItemAmmoTypeEnum;
363
+ }
364
+ export interface MissionRewardDetailsUpgrade {
365
+ id: ItemModId;
366
+ name: string;
367
+ }
368
+ export interface MissionRewardDetailsItem {
369
+ id: ItemId;
370
+ name: string;
371
+ type: TornItemTypeEnum;
372
+ sub_type: TornItemWeaponTypeEnum | null;
373
+ }
374
+ export interface UserMissionsResponse {
375
+ missions: {
376
+ credits: number;
377
+ givers: {
378
+ id: UserId;
379
+ name: string;
380
+ contracts: {
381
+ title: string;
382
+ difficulty: MissionDifficultyEnum;
383
+ status: MissionStatusEnum;
384
+ created_at: number;
385
+ started_at: number | null;
386
+ expires_at: number | null;
387
+ completed_at: number | null;
388
+ rewards: {
389
+ money: number;
390
+ credits: number;
391
+ } | null;
392
+ }[];
393
+ }[];
394
+ rewards: {
395
+ type: MissionRewardUpgrade;
396
+ details: MissionRewardDetailsAmmo | MissionRewardDetailsUpgrade | MissionRewardDetailsItem;
397
+ amount: number;
398
+ cost: number;
399
+ expires_at: number;
400
+ }[];
401
+ };
402
+ }
355
403
  export interface UserVirus {
356
404
  item: {
357
405
  id: ItemId;
@@ -1009,7 +1057,7 @@ export interface UserListResponse {
1009
1057
  list: UserList[];
1010
1058
  _metadata: RequestMetadataWithLinks;
1011
1059
  }
1012
- /** The following selections will fallback to API v1 and may change at any time: 'ammo','bazaar','criminalrecord','discord','display','equipment','gym','inventory','missions','networth','perks','stocks','weaponexp'. */
1060
+ /** The following selections will fallback to API v1 and may change at any time: 'ammo','bazaar','criminalrecord','discord','display','equipment','gym','inventory','networth','perks','stocks','weaponexp'. */
1013
1061
  export type UserSelectionName = string;
1014
1062
  export interface UserLookupResponse {
1015
1063
  selections: UserSelectionName[];
@@ -1903,7 +1951,7 @@ export interface FactionMember {
1903
1951
  }
1904
1952
  /** Details about a user's last action. */
1905
1953
  export interface UserLastAction {
1906
- status: string;
1954
+ status: UserLastActionStatusEnum;
1907
1955
  timestamp: number;
1908
1956
  relative: string;
1909
1957
  }
@@ -6468,6 +6516,10 @@ export interface UserV2 extends BaseSchema {
6468
6516
  response: UserMessagesResponse;
6469
6517
  params: "limit" | "from" | "to" | "sort" | "timestamp";
6470
6518
  };
6519
+ missions: {
6520
+ response: UserMissionsResponse;
6521
+ params: "timestamp";
6522
+ };
6471
6523
  money: {
6472
6524
  response: UserMoneyResponse;
6473
6525
  params: "timestamp";
package/dist/index.ts CHANGED
@@ -9,6 +9,22 @@
9
9
 
10
10
  export type RaceClassEnum = "A" | "B" | "C" | "D" | "E";
11
11
 
12
+ export type MissionDifficultyEnum =
13
+ | "Very easy"
14
+ | "Easy"
15
+ | "Medium"
16
+ | "Hard"
17
+ | "Very hard"
18
+ | "Expert";
19
+
20
+ export type MissionStatusEnum =
21
+ | "Accepted"
22
+ | "Available"
23
+ | "Failed"
24
+ | "Completed";
25
+
26
+ export type MissionRewardUpgrade = "Item" | "Ammo" | "Upgrade";
27
+
12
28
  export type UserDonatorStatusEnum = "Donator" | "Subscriber";
13
29
 
14
30
  export type UserMessageTypeEnum =
@@ -27,6 +43,8 @@ export type JobTypeEnum =
27
43
 
28
44
  export type UserMaritalStatusEnum = "Engaged" | "Newlywed" | "Married";
29
45
 
46
+ export type UserLastActionStatusEnum = "Online" | "Idle" | "Offline";
47
+
30
48
  export type UserPlaneImageTypeEnum =
31
49
  | "private_jet"
32
50
  | "light_aircraft"
@@ -5296,6 +5314,57 @@ export type SelectionCategoryEnum =
5296
5314
  | PersonalStatsCategoryEnum
5297
5315
  | RacingRaceTypeEnum;
5298
5316
 
5317
+ export interface MissionRewardDetailsAmmo {
5318
+ id: AmmoId;
5319
+ name: string;
5320
+ type: TornItemAmmoTypeEnum;
5321
+ }
5322
+
5323
+ export interface MissionRewardDetailsUpgrade {
5324
+ id: ItemModId;
5325
+ name: string;
5326
+ }
5327
+
5328
+ export interface MissionRewardDetailsItem {
5329
+ id: ItemId;
5330
+ name: string;
5331
+ type: TornItemTypeEnum;
5332
+ sub_type: TornItemWeaponTypeEnum | null;
5333
+ }
5334
+
5335
+ export interface UserMissionsResponse {
5336
+ missions: {
5337
+ credits: number;
5338
+ givers: {
5339
+ id: UserId;
5340
+ name: string;
5341
+ contracts: {
5342
+ title: string;
5343
+ difficulty: MissionDifficultyEnum;
5344
+ status: MissionStatusEnum;
5345
+ created_at: number;
5346
+ started_at: number | null;
5347
+ expires_at: number | null;
5348
+ completed_at: number | null;
5349
+ rewards: {
5350
+ money: number;
5351
+ credits: number;
5352
+ } | null;
5353
+ }[];
5354
+ }[];
5355
+ rewards: {
5356
+ type: MissionRewardUpgrade;
5357
+ details:
5358
+ | MissionRewardDetailsAmmo
5359
+ | MissionRewardDetailsUpgrade
5360
+ | MissionRewardDetailsItem;
5361
+ amount: number;
5362
+ cost: number;
5363
+ expires_at: number;
5364
+ }[];
5365
+ };
5366
+ }
5367
+
5299
5368
  export interface UserVirus {
5300
5369
  item: {
5301
5370
  id: ItemId;
@@ -6081,7 +6150,7 @@ export interface UserListResponse {
6081
6150
  _metadata: RequestMetadataWithLinks;
6082
6151
  }
6083
6152
 
6084
- /** The following selections will fallback to API v1 and may change at any time: 'ammo','bazaar','criminalrecord','discord','display','equipment','gym','inventory','missions','networth','perks','stocks','weaponexp'. */
6153
+ /** The following selections will fallback to API v1 and may change at any time: 'ammo','bazaar','criminalrecord','discord','display','equipment','gym','inventory','networth','perks','stocks','weaponexp'. */
6085
6154
  export type UserSelectionName = string;
6086
6155
 
6087
6156
  export interface UserLookupResponse {
@@ -7369,7 +7438,7 @@ export interface FactionMember {
7369
7438
 
7370
7439
  /** Details about a user's last action. */
7371
7440
  export interface UserLastAction {
7372
- status: string;
7441
+ status: UserLastActionStatusEnum;
7373
7442
  timestamp: number;
7374
7443
  relative: string;
7375
7444
  }
@@ -12195,6 +12264,10 @@ export interface UserV2 extends BaseSchema {
12195
12264
  response: UserMessagesResponse;
12196
12265
  params: "limit" | "from" | "to" | "sort" | "timestamp";
12197
12266
  };
12267
+ missions: {
12268
+ response: UserMissionsResponse;
12269
+ params: "timestamp";
12270
+ };
12198
12271
  money: {
12199
12272
  response: UserMoneyResponse;
12200
12273
  params: "timestamp";
package/dist/openapi.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "info": {
4
4
  "title": "Torn API",
5
5
  "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.",
6
- "version": "4.2.3"
6
+ "version": "4.3.1"
7
7
  },
8
8
  "servers": [
9
9
  {
@@ -1872,6 +1872,45 @@
1872
1872
  "x-stability": "Stable"
1873
1873
  }
1874
1874
  },
1875
+ "/user/missions": {
1876
+ "get": {
1877
+ "tags": [
1878
+ "User"
1879
+ ],
1880
+ "summary": "Get your current missions information",
1881
+ "description": "Requires minimal access key. <br>",
1882
+ "operationId": "98a38ba406509483a08bde6bee6f676c",
1883
+ "parameters": [
1884
+ {
1885
+ "$ref": "#/components/parameters/ApiTimestamp"
1886
+ },
1887
+ {
1888
+ "$ref": "#/components/parameters/ApiComment"
1889
+ },
1890
+ {
1891
+ "$ref": "#/components/parameters/ApiKeyMinimal"
1892
+ }
1893
+ ],
1894
+ "responses": {
1895
+ "200": {
1896
+ "description": "Successful operation",
1897
+ "content": {
1898
+ "application/json": {
1899
+ "schema": {
1900
+ "$ref": "#/components/schemas/UserMissionsResponse"
1901
+ }
1902
+ }
1903
+ }
1904
+ }
1905
+ },
1906
+ "security": [
1907
+ {
1908
+ "api_key": []
1909
+ }
1910
+ ],
1911
+ "x-stability": "Unstable"
1912
+ }
1913
+ },
1875
1914
  "/user/money": {
1876
1915
  "get": {
1877
1916
  "tags": [
@@ -3268,6 +3307,9 @@
3268
3307
  {
3269
3308
  "$ref": "#/components/schemas/UserListResponse"
3270
3309
  },
3310
+ {
3311
+ "$ref": "#/components/schemas/UserMissionsResponse"
3312
+ },
3271
3313
  {
3272
3314
  "$ref": "#/components/schemas/UserPersonalStatsResponse"
3273
3315
  },
@@ -9010,6 +9052,34 @@
9010
9052
  "E"
9011
9053
  ]
9012
9054
  },
9055
+ "MissionDifficultyEnum": {
9056
+ "type": "string",
9057
+ "enum": [
9058
+ "Very easy",
9059
+ "Easy",
9060
+ "Medium",
9061
+ "Hard",
9062
+ "Very hard",
9063
+ "Expert"
9064
+ ]
9065
+ },
9066
+ "MissionStatusEnum": {
9067
+ "type": "string",
9068
+ "enum": [
9069
+ "Accepted",
9070
+ "Available",
9071
+ "Failed",
9072
+ "Completed"
9073
+ ]
9074
+ },
9075
+ "MissionRewardUpgrade": {
9076
+ "type": "string",
9077
+ "enum": [
9078
+ "Item",
9079
+ "Ammo",
9080
+ "Upgrade"
9081
+ ]
9082
+ },
9013
9083
  "UserDonatorStatusEnum": {
9014
9084
  "type": "string",
9015
9085
  "enum": [
@@ -9045,6 +9115,14 @@
9045
9115
  "Married"
9046
9116
  ]
9047
9117
  },
9118
+ "UserLastActionStatusEnum": {
9119
+ "type": "string",
9120
+ "enum": [
9121
+ "Online",
9122
+ "Idle",
9123
+ "Offline"
9124
+ ]
9125
+ },
9048
9126
  "UserPlaneImageTypeEnum": {
9049
9127
  "type": "string",
9050
9128
  "enum": [
@@ -15510,6 +15588,247 @@
15510
15588
  }
15511
15589
  ]
15512
15590
  },
15591
+ "MissionRewardDetailsAmmo": {
15592
+ "required": [
15593
+ "id",
15594
+ "name",
15595
+ "type"
15596
+ ],
15597
+ "properties": {
15598
+ "id": {
15599
+ "$ref": "#/components/schemas/AmmoId"
15600
+ },
15601
+ "name": {
15602
+ "type": "string"
15603
+ },
15604
+ "type": {
15605
+ "$ref": "#/components/schemas/TornItemAmmoTypeEnum"
15606
+ }
15607
+ },
15608
+ "type": "object"
15609
+ },
15610
+ "MissionRewardDetailsUpgrade": {
15611
+ "required": [
15612
+ "id",
15613
+ "name"
15614
+ ],
15615
+ "properties": {
15616
+ "id": {
15617
+ "$ref": "#/components/schemas/ItemModId"
15618
+ },
15619
+ "name": {
15620
+ "type": "string"
15621
+ }
15622
+ },
15623
+ "type": "object"
15624
+ },
15625
+ "MissionRewardDetailsItem": {
15626
+ "required": [
15627
+ "id",
15628
+ "name",
15629
+ "type",
15630
+ "sub_type"
15631
+ ],
15632
+ "properties": {
15633
+ "id": {
15634
+ "$ref": "#/components/schemas/ItemId"
15635
+ },
15636
+ "name": {
15637
+ "type": "string"
15638
+ },
15639
+ "type": {
15640
+ "$ref": "#/components/schemas/TornItemTypeEnum"
15641
+ },
15642
+ "sub_type": {
15643
+ "oneOf": [
15644
+ {
15645
+ "$ref": "#/components/schemas/TornItemWeaponTypeEnum"
15646
+ },
15647
+ {
15648
+ "type": "null"
15649
+ }
15650
+ ]
15651
+ }
15652
+ },
15653
+ "type": "object"
15654
+ },
15655
+ "UserMissionsResponse": {
15656
+ "required": [
15657
+ "missions"
15658
+ ],
15659
+ "properties": {
15660
+ "missions": {
15661
+ "required": [
15662
+ "credits",
15663
+ "givers",
15664
+ "rewards"
15665
+ ],
15666
+ "properties": {
15667
+ "credits": {
15668
+ "type": "integer",
15669
+ "format": "int32"
15670
+ },
15671
+ "givers": {
15672
+ "type": "array",
15673
+ "items": {
15674
+ "required": [
15675
+ "id",
15676
+ "name",
15677
+ "contracts"
15678
+ ],
15679
+ "properties": {
15680
+ "id": {
15681
+ "$ref": "#/components/schemas/UserId"
15682
+ },
15683
+ "name": {
15684
+ "type": "string"
15685
+ },
15686
+ "contracts": {
15687
+ "type": "array",
15688
+ "items": {
15689
+ "required": [
15690
+ "title",
15691
+ "difficulty",
15692
+ "status",
15693
+ "created_at",
15694
+ "started_at",
15695
+ "expires_at",
15696
+ "completed_at",
15697
+ "rewards"
15698
+ ],
15699
+ "properties": {
15700
+ "title": {
15701
+ "type": "string"
15702
+ },
15703
+ "difficulty": {
15704
+ "$ref": "#/components/schemas/MissionDifficultyEnum"
15705
+ },
15706
+ "status": {
15707
+ "$ref": "#/components/schemas/MissionStatusEnum"
15708
+ },
15709
+ "created_at": {
15710
+ "type": "integer",
15711
+ "format": "int32"
15712
+ },
15713
+ "started_at": {
15714
+ "description": "Null if the status is 'Available'.",
15715
+ "oneOf": [
15716
+ {
15717
+ "type": "integer",
15718
+ "format": "int32"
15719
+ },
15720
+ {
15721
+ "type": "null"
15722
+ }
15723
+ ]
15724
+ },
15725
+ "expires_at": {
15726
+ "description": "Null if the status is not 'Accepted'.",
15727
+ "oneOf": [
15728
+ {
15729
+ "type": "integer",
15730
+ "format": "int32"
15731
+ },
15732
+ {
15733
+ "type": "null"
15734
+ }
15735
+ ]
15736
+ },
15737
+ "completed_at": {
15738
+ "description": "Null if the status is not 'Failed' or 'Completed'.",
15739
+ "oneOf": [
15740
+ {
15741
+ "type": "integer",
15742
+ "format": "int32"
15743
+ },
15744
+ {
15745
+ "type": "null"
15746
+ }
15747
+ ]
15748
+ },
15749
+ "rewards": {
15750
+ "description": "Null if the status is not 'Completed'.",
15751
+ "oneOf": [
15752
+ {
15753
+ "required": [
15754
+ "money",
15755
+ "credits"
15756
+ ],
15757
+ "properties": {
15758
+ "money": {
15759
+ "type": "integer",
15760
+ "format": "int32"
15761
+ },
15762
+ "credits": {
15763
+ "type": "integer",
15764
+ "format": "int32"
15765
+ }
15766
+ },
15767
+ "type": "object"
15768
+ },
15769
+ {
15770
+ "type": "null"
15771
+ }
15772
+ ]
15773
+ }
15774
+ },
15775
+ "type": "object"
15776
+ }
15777
+ }
15778
+ },
15779
+ "type": "object"
15780
+ }
15781
+ },
15782
+ "rewards": {
15783
+ "type": "array",
15784
+ "items": {
15785
+ "required": [
15786
+ "type",
15787
+ "details",
15788
+ "amount",
15789
+ "cost",
15790
+ "expires_at"
15791
+ ],
15792
+ "properties": {
15793
+ "type": {
15794
+ "$ref": "#/components/schemas/MissionRewardUpgrade"
15795
+ },
15796
+ "details": {
15797
+ "description": "The response depends on the 'type' value.",
15798
+ "oneOf": [
15799
+ {
15800
+ "$ref": "#/components/schemas/MissionRewardDetailsAmmo"
15801
+ },
15802
+ {
15803
+ "$ref": "#/components/schemas/MissionRewardDetailsUpgrade"
15804
+ },
15805
+ {
15806
+ "$ref": "#/components/schemas/MissionRewardDetailsItem"
15807
+ }
15808
+ ]
15809
+ },
15810
+ "amount": {
15811
+ "type": "integer",
15812
+ "format": "int32"
15813
+ },
15814
+ "cost": {
15815
+ "type": "integer",
15816
+ "format": "int32"
15817
+ },
15818
+ "expires_at": {
15819
+ "type": "integer",
15820
+ "format": "int32"
15821
+ }
15822
+ },
15823
+ "type": "object"
15824
+ }
15825
+ }
15826
+ },
15827
+ "type": "object"
15828
+ }
15829
+ },
15830
+ "type": "object"
15831
+ },
15513
15832
  "UserVirus": {
15514
15833
  "required": [
15515
15834
  "item",
@@ -18699,7 +19018,7 @@
18699
19018
  "UserSelectionName": {
18700
19019
  "oneOf": [
18701
19020
  {
18702
- "description": "The following selections will fallback to API v1 and may change at any time: 'ammo','bazaar','criminalrecord','discord','display','equipment','gym','inventory','missions','networth','perks','stocks','weaponexp'.",
19021
+ "description": "The following selections will fallback to API v1 and may change at any time: 'ammo','bazaar','criminalrecord','discord','display','equipment','gym','inventory','networth','perks','stocks','weaponexp'.",
18703
19022
  "type": "string",
18704
19023
  "enum": [
18705
19024
  "attacks",
@@ -18734,6 +19053,7 @@
18734
19053
  "medals",
18735
19054
  "merits",
18736
19055
  "messages",
19056
+ "missions",
18737
19057
  "money",
18738
19058
  "newevents",
18739
19059
  "newmessages",
@@ -18762,7 +19082,6 @@
18762
19082
  "equipment",
18763
19083
  "gym",
18764
19084
  "inventory",
18765
- "missions",
18766
19085
  "networth",
18767
19086
  "perks",
18768
19087
  "stocks",
@@ -23192,7 +23511,7 @@
23192
23511
  ],
23193
23512
  "properties": {
23194
23513
  "status": {
23195
- "type": "string"
23514
+ "$ref": "#/components/schemas/UserLastActionStatusEnum"
23196
23515
  },
23197
23516
  "timestamp": {
23198
23517
  "type": "integer",
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "tornapi-typescript",
3
3
  "type": "module",
4
- "version": "4.2.3",
4
+ "version": "4.3.1",
5
5
  "scripts": {
6
6
  "generate-types": "tsc && node build/index.js"
7
7
  },
8
8
  "devDependencies": {
9
9
  "@scalar/openapi-types": "^0.5.0",
10
- "@types/node": "^22.18.10",
10
+ "@types/node": "^24.9.1",
11
11
  "prettier": "^3.6.2",
12
12
  "typeconv": "^2.3.1",
13
13
  "typescript": "^5.9.3"