tornapi-typescript 0.0.6 → 0.1.0

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/README.md CHANGED
@@ -15,9 +15,7 @@ These types are generated in the following way:
15
15
 
16
16
  * load [openapi specification](https://www.torn.com/swagger/openapi.json)
17
17
  * clean the specification for better types
18
- * remove `type` when `allOf` is present, otherwise the specification is not valid
19
18
  * remove `type` when `oneOf` is present, for improved types
20
- * mark all fields as required, for improved types
21
19
  * convert the specification to Typescript definitions using [typeconv](https://github.com/grantila/typeconv)
22
20
  * clean the type definitions
23
21
  * remove all "[key: string]: any;", because typeconv adds it everywhere for some reason
package/dist/index.d.ts CHANGED
@@ -310,13 +310,6 @@ export type ItemUid = number;
310
310
 
311
311
  export type UserId = number;
312
312
 
313
- export type UserIdNullable = number | null;
314
-
315
- export type UserIdNullableDeprecated =
316
- /** This field is replaced with the 'user.id' and will be removed on the 1st of May 2025. */
317
- | number /** This field is replaced with the 'user.id' and will be removed on the 1st of May 2025. */
318
- | null;
319
-
320
313
  export type ReviveId = number;
321
314
 
322
315
  export type LogId = number;
@@ -325,8 +318,6 @@ export type LogCategoryId = number;
325
318
 
326
319
  export type FactionId = number;
327
320
 
328
- export type FactionIdNullable = number | null;
329
-
330
321
  export type FactionCrimeId = number;
331
322
 
332
323
  export type ChainId = number;
@@ -342,10 +333,8 @@ export type ForumThreadId = number;
342
333
  export type ForumPostId = number;
343
334
 
344
335
  export interface RequestLinks {
345
- next: /** Auto-generated link to get the next set of records. */
346
- string /** Auto-generated link to get the next set of records. */ | null;
347
- prev: /** Auto-generated link to get the prev set of records. */
348
- string /** Auto-generated link to get the prev set of records. */ | null;
336
+ next: string | null;
337
+ prev: string | null;
349
338
  }
350
339
 
351
340
  export interface RequestMetadata {
@@ -520,7 +509,7 @@ export interface AttackPlayer {
520
509
 
521
510
  export interface AttackPlayerSimplified {
522
511
  id: UserId;
523
- faction_id: FactionId & (number | null);
512
+ faction_id: FactionId | null;
524
513
  }
525
514
 
526
515
  export interface AttackingFinishingHitEffects {
@@ -577,11 +566,11 @@ export interface ReviveSimplified {
577
566
  id: ReviveId;
578
567
  reviver: {
579
568
  id: UserId;
580
- faction_id: FactionId & (number | null);
569
+ faction_id: FactionId | null;
581
570
  };
582
571
  target: {
583
572
  id: UserId;
584
- faction_id: FactionId & (number | null);
573
+ faction_id: FactionId | null;
585
574
  hospital_reason: string;
586
575
  early_discharge: boolean;
587
576
  last_action: number;
@@ -659,7 +648,7 @@ export interface FactionMember {
659
648
  has_early_discharge: boolean;
660
649
  last_action: UserLastAction;
661
650
  status: UserStatus;
662
- life: UserLife;
651
+ life?: UserLife;
663
652
  revive_setting: ReviveSetting;
664
653
  }
665
654
 
@@ -672,8 +661,8 @@ export interface UserLastAction {
672
661
 
673
662
  /** Unfortunately, current life value is often shown incorrectly, and the calculation for each member is very resource heavy, so this field is deprecated and will be removed on 1st of May, 2025. */
674
663
  export interface UserLife {
675
- current: number;
676
- maximum: number;
664
+ current?: number;
665
+ maximum?: number;
677
666
  }
678
667
 
679
668
  /** Details about a user's status. */
@@ -707,9 +696,7 @@ export interface FactionBasic {
707
696
  days_old: number;
708
697
  capacity: number;
709
698
  members: number;
710
- is_enlisted: /** Indicates if the faction is enlisted for ranked wars. Available only with faction AA permissions for your own faction. */
711
- | boolean /** Indicates if the faction is enlisted for ranked wars. Available only with faction AA permissions for your own faction. */
712
- | null;
699
+ is_enlisted: boolean | null;
713
700
  rank: FactionRank;
714
701
  best_chain: number;
715
702
  }
@@ -778,7 +765,7 @@ export interface FactionTerritoryWar {
778
765
  end: number | null;
779
766
  /** The score target of the war. */
780
767
  target: number;
781
- winner: number | null;
768
+ winner?: FactionId | null;
782
769
  /** The factions involved in the territory war. */
783
770
  factions: FactionTerritoryWarParticipant[];
784
771
  }
@@ -929,7 +916,7 @@ export interface FactionChainReportAttackerAttacks {
929
916
  retaliations: number;
930
917
  overseas: number;
931
918
  draws: number;
932
- escapes: number;
919
+ escapes?: number;
933
920
  losses: number;
934
921
  war: number;
935
922
  bonuses: number;
@@ -937,7 +924,7 @@ export interface FactionChainReportAttackerAttacks {
937
924
 
938
925
  export interface FactionCrimeUser {
939
926
  id: UserId;
940
- outcome: FactionCrimeUserOutcome;
927
+ outcome: FactionCrimeUserOutcome | null;
941
928
  /** The timestamp at which the user joined the slot. */
942
929
  joined_at: number;
943
930
  /** Current planning progress on the slot. */
@@ -974,12 +961,12 @@ export interface FactionCrimeSlot {
974
961
  /** Shows if user has the required item. */
975
962
  is_available: boolean;
976
963
  } | null;
977
- user_id: UserIdNullableDeprecated;
964
+ user_id?: UserId | null;
978
965
  user: FactionCrimeUser | null;
979
966
  /** This field is replaced with 'checkpoint_pass_rate' field and will be removed on 1st of May 2025. */
980
- success_chance: number;
967
+ success_chance?: number;
981
968
  /** This field is replaced with 'checkpoint_pass_rate' field and will be removed on 1st of May 2025. */
982
- crime_pass_rate: number;
969
+ crime_pass_rate?: number;
983
970
  /** 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. */
984
971
  checkpoint_pass_rate: number;
985
972
  }
@@ -991,16 +978,11 @@ export interface FactionCrime {
991
978
  status: FactionCrimeStatusEnum;
992
979
  /** The timestamp at which the crime was created. */
993
980
  created_at: number;
994
- planning_at: /** The timestamp at which the planning phase for the crime has begun. */
995
- | number /** The timestamp at which the planning phase for the crime has begun. */
996
- | null;
997
- ready_at: /** The timestamp at which the crime will be ready. */
998
- number /** The timestamp at which the crime will be ready. */ | null;
981
+ planning_at: number | null;
982
+ ready_at: number | null;
999
983
  /** The timestamp at which the crime will expire. */
1000
984
  expired_at: number;
1001
- executed_at: /** The timestamp at which the crime was executed. <br> Note: this value is null for all crimes executed before January 15th, 2025. */
1002
- | number /** The timestamp at which the crime was executed. <br> Note: this value is null for all crimes executed before January 15th, 2025. */
1003
- | null;
985
+ executed_at: number | null;
1004
986
  slots: FactionCrimeSlot[];
1005
987
  rewards: FactionCrimeReward | null;
1006
988
  }
@@ -1064,12 +1046,12 @@ export interface FactionRankedWarDetails {
1064
1046
  /** Timestamp the war ended at. */
1065
1047
  end: number;
1066
1048
  target: number;
1067
- winner: FactionId & (number | null);
1049
+ winner: FactionId | null;
1068
1050
  factions: {
1069
- id?: FactionId;
1070
- name?: string;
1071
- score?: number;
1072
- chain?: number;
1051
+ id: FactionId;
1052
+ name: string;
1053
+ score: number;
1054
+ chain: number;
1073
1055
  }[];
1074
1056
  }
1075
1057
 
@@ -1088,29 +1070,29 @@ export interface FactionRankedWarReportResponse {
1088
1070
  winner: FactionId;
1089
1071
  forfeit: boolean;
1090
1072
  factions: {
1091
- id?: FactionId;
1092
- name?: string;
1093
- score?: number;
1094
- attacks?: number;
1095
- rank?: {
1096
- before?: string;
1097
- after?: string;
1073
+ id: FactionId;
1074
+ name: string;
1075
+ score: number;
1076
+ attacks: number;
1077
+ rank: {
1078
+ before: string;
1079
+ after: string;
1098
1080
  };
1099
- rewards?: {
1100
- respect?: number;
1101
- points?: number;
1102
- items?: {
1103
- id?: ItemId;
1104
- name?: string;
1105
- quantity?: number;
1081
+ rewards: {
1082
+ respect: number;
1083
+ points: number;
1084
+ items: {
1085
+ id: ItemId;
1086
+ name: string;
1087
+ quantity: number;
1106
1088
  }[];
1107
1089
  };
1108
- members?: {
1109
- id?: UserId;
1110
- name?: string;
1111
- level?: number;
1112
- attacks?: number;
1113
- score?: number;
1090
+ members: {
1091
+ id: UserId;
1092
+ name: string;
1093
+ level: number;
1094
+ attacks: number;
1095
+ score: number;
1114
1096
  }[];
1115
1097
  }[];
1116
1098
  };
@@ -1118,10 +1100,10 @@ export interface FactionRankedWarReportResponse {
1118
1100
 
1119
1101
  export interface ForumCategoriesResponse {
1120
1102
  categories: {
1121
- id?: ForumId;
1122
- title?: string;
1123
- acronym?: string;
1124
- threads?: number;
1103
+ id: ForumId;
1104
+ title: string;
1105
+ acronym: string;
1106
+ threads: number;
1125
1107
  }[];
1126
1108
  }
1127
1109
 
@@ -1151,7 +1133,7 @@ export interface ForumThreadBase {
1151
1133
  /** Total number of times players have opened this thread. */
1152
1134
  views: number;
1153
1135
  author: ForumThreadAuthor;
1154
- last_poster: ForumThreadAuthor;
1136
+ last_poster: ForumThreadAuthor | null;
1155
1137
  first_post_time: number;
1156
1138
  last_post_time: number | null;
1157
1139
  has_poll: boolean;
@@ -1160,9 +1142,9 @@ export interface ForumThreadBase {
1160
1142
  }
1161
1143
 
1162
1144
  export interface ForumThreadExtended extends ForumThreadBase {
1163
- content?: string;
1164
- content_raw?: string;
1165
- poll?: ForumPoll;
1145
+ content: string;
1146
+ content_raw: string;
1147
+ poll: ForumPoll | null;
1166
1148
  }
1167
1149
 
1168
1150
  export interface ForumPost {
@@ -1175,10 +1157,9 @@ export interface ForumPost {
1175
1157
  is_edited: boolean;
1176
1158
  is_pinned: boolean;
1177
1159
  created_time: number;
1178
- edited_by: UserId;
1160
+ edited_by: UserId | null;
1179
1161
  has_quote: boolean;
1180
- quoted_post_id: /** 'quoted_post_id' is null when 'has_quote' is false. */
1181
- number /** 'quoted_post_id' is null when 'has_quote' is false. */ | null;
1162
+ quoted_post_id: number | null;
1182
1163
  /** 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. */
1183
1164
  content: string;
1184
1165
  likes: number;
@@ -1186,9 +1167,7 @@ export interface ForumPost {
1186
1167
  }
1187
1168
 
1188
1169
  export interface ForumThreadUserExtended extends ForumThreadBase {
1189
- new_posts?: /** Available only when requesting data for yourself (no id or your id) with at least 'Minimal' access type key. */
1190
- | number /** Available only when requesting data for yourself (no id or your id) with at least 'Minimal' access type key. */
1191
- | null;
1170
+ new_posts: number | null;
1192
1171
  }
1193
1172
 
1194
1173
  export interface ForumSubscribedThreadPostsCount {
@@ -1268,7 +1247,7 @@ export interface ItemMarketListingStackable {
1268
1247
  }
1269
1248
 
1270
1249
  export interface ItemMarketListingItemDetails {
1271
- uid: number;
1250
+ uid: ItemUid;
1272
1251
  stats: ItemMarketListingItemStats;
1273
1252
  bonuses: ItemMarketListingItemBonus[];
1274
1253
  rarity: ("yellow" | "orange" | "red") | null;
@@ -1277,7 +1256,8 @@ export interface ItemMarketListingItemDetails {
1277
1256
  export interface ItemMarketListingNonstackable {
1278
1257
  price: number;
1279
1258
  amount: number;
1280
- itemDetails: ItemMarketListingItemDetails;
1259
+ itemDetails?: ItemMarketListingItemDetails;
1260
+ item_details: ItemMarketListingItemDetails;
1281
1261
  }
1282
1262
 
1283
1263
  export interface ItemMarket {
@@ -1378,9 +1358,9 @@ export interface Race {
1378
1358
  end: number | null;
1379
1359
  };
1380
1360
  requirements: {
1381
- car_class: RaceClassEnum;
1382
- driver_class: RaceClassEnum;
1383
- car_item_id: ItemId;
1361
+ car_class: RaceClassEnum | null;
1362
+ driver_class: RaceClassEnum | null;
1363
+ car_item_id: ItemId | null;
1384
1364
  requires_stock_car: boolean;
1385
1365
  requires_password: boolean;
1386
1366
  join_fee: number;
@@ -1413,7 +1393,7 @@ export interface RacerDetails {
1413
1393
  }
1414
1394
 
1415
1395
  export interface RacingRaceDetailsResponse extends Race {
1416
- results?: RacerDetails[];
1396
+ results: RacerDetails[];
1417
1397
  }
1418
1398
 
1419
1399
  export type RacingSelectionName =
@@ -1448,7 +1428,7 @@ export interface TornCrime {
1448
1428
  id: number;
1449
1429
  name: string;
1450
1430
  category_id: number;
1451
- category_name: string;
1431
+ category_name?: string;
1452
1432
  enhancer_id: number;
1453
1433
  enhancer_name: string;
1454
1434
  unique_outcomes_count: number;
@@ -1491,14 +1471,9 @@ export interface TornHofResponse {
1491
1471
  }
1492
1472
 
1493
1473
  export interface FactionHofValues {
1494
- chain: /** Maximum chain achieved by the faction. Null if chosen category is 'rank' or 'respect'. */
1495
- | number /** Maximum chain achieved by the faction. Null if chosen category is 'rank' or 'respect'. */
1496
- | null;
1497
- chain_duration: /** The duration of the chain. Null if chosen category is 'rank' or 'respect'. */
1498
- | number /** The duration of the chain. Null if chosen category is 'rank' or 'respect'. */
1499
- | null;
1500
- respect: /** Null if chosen category is 'chain'. */
1501
- number /** Null if chosen category is 'chain'. */ | null;
1474
+ chain: number | null;
1475
+ chain_duration: number | null;
1476
+ respect: number | null;
1502
1477
  }
1503
1478
 
1504
1479
  export interface TornFactionHof {
@@ -1538,9 +1513,8 @@ export interface Bounty {
1538
1513
  target_id: UserId;
1539
1514
  target_name: string;
1540
1515
  target_level: number;
1541
- lister_id: UserId & (number | null);
1542
- lister_name: /** If the bounty is anonymous this field is null. */
1543
- string /** If the bounty is anonymous this field is null. */ | null;
1516
+ lister_id: UserId | null;
1517
+ lister_name: string | null;
1544
1518
  reward: number;
1545
1519
  reason: string | null;
1546
1520
  quantity: number;
@@ -1549,14 +1523,9 @@ export interface Bounty {
1549
1523
  }
1550
1524
 
1551
1525
  export interface AttackLogSummary {
1552
- id: UserId /** Id of the participant, could be null in stealthed attacks. */ &
1553
- (
1554
- | number /** Id of the participant, could be null in stealthed attacks. */
1555
- | null
1556
- );
1526
+ id: UserId | null;
1557
1527
  name: /** Name of the participant, could be null in stealthed attacks. */
1558
- | string /** Name of the participant, could be null in stealthed attacks. */
1559
- | null;
1528
+ string | null;
1560
1529
  hits: number;
1561
1530
  misses: number;
1562
1531
  damage: number;
@@ -1568,23 +1537,20 @@ export interface AttackLog {
1568
1537
  action: AttackActionEnum;
1569
1538
  icon: string;
1570
1539
  attacker: /** This value could be null in stealthed attacks. */
1571
- | {
1572
- id: UserId;
1573
- name: string;
1574
- item: /** This object could be null if there was no item being used in this turn or during this effect. */
1575
- | {
1576
- id: ItemId;
1577
- name: string;
1578
- } /** This object could be null if there was no item being used in this turn or during this effect. */
1579
- | null;
1580
- } /** This value could be null in stealthed attacks. */
1581
- | null;
1540
+ {
1541
+ id: UserId;
1542
+ name: string;
1543
+ item: /** This object could be null if there was no item being used in this turn or during this effect. */
1544
+ {
1545
+ id?: ItemId;
1546
+ name?: string;
1547
+ } | null;
1548
+ } | null;
1582
1549
  defender: /** This value could be null in stealthed attacks. */
1583
- | {
1584
- id: number;
1585
- name: string;
1586
- } /** This value could be null in stealthed attacks. */
1587
- | null;
1550
+ {
1551
+ id: UserId;
1552
+ name: string;
1553
+ } | null;
1588
1554
  }
1589
1555
 
1590
1556
  export interface AttackLogResponse {
@@ -1666,7 +1632,7 @@ export interface TornItem {
1666
1632
  requirement: string | null;
1667
1633
  image: string;
1668
1634
  type: TornItemTypeEnum;
1669
- sub_type: TornItemWeaponTypeEnum & (string | null);
1635
+ sub_type: TornItemWeaponTypeEnum | null;
1670
1636
  is_masked: boolean;
1671
1637
  is_tradable: boolean;
1672
1638
  is_found_in_city: boolean;
@@ -1680,7 +1646,7 @@ export interface TornItem {
1680
1646
  market_price: number;
1681
1647
  };
1682
1648
  circulation: number;
1683
- details: (TornItemWeaponDetails & TornItemArmorDetails) | null;
1649
+ details: TornItemWeaponDetails | TornItemArmorDetails | null;
1684
1650
  }
1685
1651
 
1686
1652
  export interface TornItemsResponse {
@@ -2155,7 +2121,7 @@ export interface PersonalStatsAttackingPublic {
2155
2121
  elo: number;
2156
2122
  unarmored_wins: number;
2157
2123
  highest_level_beaten: number;
2158
- escapes: {
2124
+ escapes?: {
2159
2125
  player: number;
2160
2126
  foes: number;
2161
2127
  };
@@ -2671,7 +2637,7 @@ export interface UserCrimeDetailsBootlegging {
2671
2637
  total: number;
2672
2638
  earnings: number;
2673
2639
  };
2674
- dvds_copied: number;
2640
+ dvds_copied?: number;
2675
2641
  }
2676
2642
 
2677
2643
  export interface UserCrimeDetailsGraffiti {
@@ -2693,8 +2659,8 @@ export interface UserCrimeDetailsCardSkimming {
2693
2659
  sold: number;
2694
2660
  lost: number;
2695
2661
  areas: {
2696
- id?: number;
2697
- amount?: number;
2662
+ id: number;
2663
+ amount: number;
2698
2664
  }[];
2699
2665
  };
2700
2666
  skimmers: {
@@ -2828,14 +2794,14 @@ export interface UserRacesResponse {
2828
2794
  }
2829
2795
 
2830
2796
  export interface UserRaceCarDetails extends RaceCar {
2831
- id?: RaceCarId;
2832
- name?: string;
2833
- worth?: number;
2834
- points_spent?: number;
2835
- races_entered?: number;
2836
- races_won?: number;
2837
- is_removed?: boolean;
2838
- parts?: RaceCarUpgradeId[];
2797
+ id: RaceCarId;
2798
+ name: string;
2799
+ worth: number;
2800
+ points_spent: number;
2801
+ races_entered: number;
2802
+ races_won: number;
2803
+ is_removed: boolean;
2804
+ parts: RaceCarUpgradeId[];
2839
2805
  }
2840
2806
 
2841
2807
  export interface UserEnlistedCarsResponse {
@@ -2853,7 +2819,7 @@ export interface UserForumThreadsResponse {
2853
2819
  }
2854
2820
 
2855
2821
  export interface UserForumSubscribedThreadsResponse {
2856
- forumSubscribedThreads: ForumSubscribedThread[];
2822
+ forumSubscribedThreads?: ForumSubscribedThread[];
2857
2823
  }
2858
2824
 
2859
2825
  export interface UserForumFeedResponse {
@@ -2927,7 +2893,7 @@ export interface UserItemMarkeListingItemDetails {
2927
2893
  name: string;
2928
2894
  type: string;
2929
2895
  rarity: ("yellow" | "orange" | "red") | null;
2930
- uid: number | null;
2896
+ uid: ItemUid | null;
2931
2897
  stats: ItemMarketListingItemStats | null;
2932
2898
  bonuses: ItemMarketListingItemBonus[];
2933
2899
  }
@@ -2965,7 +2931,7 @@ export interface UserList {
2965
2931
  id: UserId;
2966
2932
  name: string;
2967
2933
  level: number;
2968
- faction_id: FactionId & (number | null);
2934
+ faction_id: FactionId | null;
2969
2935
  last_action: UserLastAction;
2970
2936
  status: UserStatus;
2971
2937
  }