tornapi-typescript 0.0.5 → 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
@@ -283,6 +283,13 @@ export type FactionApplicationStatusEnum =
283
283
 
284
284
  export type FactionRankedWarsCategoryEnum = "all" | "ongoing";
285
285
 
286
+ export type FactionCrimeUserOutcome =
287
+ | "Successful"
288
+ | "Failed"
289
+ | "Jailed"
290
+ | "Injured"
291
+ | "Hospitalized";
292
+
286
293
  export type RaceId = number;
287
294
 
288
295
  export type RaceTrackId = number;
@@ -326,10 +333,8 @@ export type ForumThreadId = number;
326
333
  export type ForumPostId = number;
327
334
 
328
335
  export interface RequestLinks {
329
- next: /** Auto-generated link to get the next set of records. */
330
- string /** Auto-generated link to get the next set of records. */ | null;
331
- prev: /** Auto-generated link to get the prev set of records. */
332
- string /** Auto-generated link to get the prev set of records. */ | null;
336
+ next: string | null;
337
+ prev: string | null;
333
338
  }
334
339
 
335
340
  export interface RequestMetadata {
@@ -504,7 +509,7 @@ export interface AttackPlayer {
504
509
 
505
510
  export interface AttackPlayerSimplified {
506
511
  id: UserId;
507
- faction_id: FactionId & (number | null);
512
+ faction_id: FactionId | null;
508
513
  }
509
514
 
510
515
  export interface AttackingFinishingHitEffects {
@@ -561,11 +566,11 @@ export interface ReviveSimplified {
561
566
  id: ReviveId;
562
567
  reviver: {
563
568
  id: UserId;
564
- faction_id: FactionId & (number | null);
569
+ faction_id: FactionId | null;
565
570
  };
566
571
  target: {
567
572
  id: UserId;
568
- faction_id: FactionId & (number | null);
573
+ faction_id: FactionId | null;
569
574
  hospital_reason: string;
570
575
  early_discharge: boolean;
571
576
  last_action: number;
@@ -643,7 +648,7 @@ export interface FactionMember {
643
648
  has_early_discharge: boolean;
644
649
  last_action: UserLastAction;
645
650
  status: UserStatus;
646
- life: UserLife;
651
+ life?: UserLife;
647
652
  revive_setting: ReviveSetting;
648
653
  }
649
654
 
@@ -656,8 +661,8 @@ export interface UserLastAction {
656
661
 
657
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. */
658
663
  export interface UserLife {
659
- current: number;
660
- maximum: number;
664
+ current?: number;
665
+ maximum?: number;
661
666
  }
662
667
 
663
668
  /** Details about a user's status. */
@@ -691,9 +696,7 @@ export interface FactionBasic {
691
696
  days_old: number;
692
697
  capacity: number;
693
698
  members: number;
694
- is_enlisted: /** Indicates if the faction is enlisted for ranked wars. Available only with faction AA permissions for your own faction. */
695
- | boolean /** Indicates if the faction is enlisted for ranked wars. Available only with faction AA permissions for your own faction. */
696
- | null;
699
+ is_enlisted: boolean | null;
697
700
  rank: FactionRank;
698
701
  best_chain: number;
699
702
  }
@@ -762,7 +765,7 @@ export interface FactionTerritoryWar {
762
765
  end: number | null;
763
766
  /** The score target of the war. */
764
767
  target: number;
765
- winner: number | null;
768
+ winner?: FactionId | null;
766
769
  /** The factions involved in the territory war. */
767
770
  factions: FactionTerritoryWarParticipant[];
768
771
  }
@@ -913,7 +916,7 @@ export interface FactionChainReportAttackerAttacks {
913
916
  retaliations: number;
914
917
  overseas: number;
915
918
  draws: number;
916
- escapes: number;
919
+ escapes?: number;
917
920
  losses: number;
918
921
  war: number;
919
922
  bonuses: number;
@@ -921,6 +924,7 @@ export interface FactionChainReportAttackerAttacks {
921
924
 
922
925
  export interface FactionCrimeUser {
923
926
  id: UserId;
927
+ outcome: FactionCrimeUserOutcome | null;
924
928
  /** The timestamp at which the user joined the slot. */
925
929
  joined_at: number;
926
930
  /** Current planning progress on the slot. */
@@ -944,23 +948,27 @@ export interface FactionCrimeReward {
944
948
  money: number;
945
949
  items: FactionCrimeRewardItem[];
946
950
  respect: number;
951
+ scope: number;
947
952
  payout: FactionCrimeRewardPayout | null;
948
953
  }
949
954
 
950
955
  export interface FactionCrimeSlot {
951
956
  position: string;
952
957
  item_requirement: {
953
- id?: ItemId;
958
+ id: ItemId;
954
959
  /** Shows if the item is reusable or consumed during the crime. */
955
- is_reusable?: boolean;
960
+ is_reusable: boolean;
956
961
  /** Shows if user has the required item. */
957
- is_available?: boolean;
962
+ is_available: boolean;
958
963
  } | null;
959
- user_id: UserId;
964
+ user_id?: UserId | null;
960
965
  user: FactionCrimeUser | null;
961
- /** This field is replaced with 'crime_pass_rate' field and will be removed on 1st of May 2025. */
962
- success_chance: number;
963
- crime_pass_rate: number;
966
+ /** This field is replaced with 'checkpoint_pass_rate' field and will be removed on 1st of May 2025. */
967
+ success_chance?: number;
968
+ /** This field is replaced with 'checkpoint_pass_rate' field and will be removed on 1st of May 2025. */
969
+ crime_pass_rate?: number;
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. */
971
+ checkpoint_pass_rate: number;
964
972
  }
965
973
 
966
974
  export interface FactionCrime {
@@ -970,16 +978,11 @@ export interface FactionCrime {
970
978
  status: FactionCrimeStatusEnum;
971
979
  /** The timestamp at which the crime was created. */
972
980
  created_at: number;
973
- planning_at: /** The timestamp at which the planning phase for the crime has begun. */
974
- | number /** The timestamp at which the planning phase for the crime has begun. */
975
- | null;
976
- ready_at: /** The timestamp at which the crime will be ready. */
977
- number /** The timestamp at which the crime will be ready. */ | null;
981
+ planning_at: number | null;
982
+ ready_at: number | null;
978
983
  /** The timestamp at which the crime will expire. */
979
984
  expired_at: number;
980
- executed_at: /** The timestamp at which the crime was executed. <br> Note: this value is null for all crimes executed before January 15th, 2025. */
981
- | number /** The timestamp at which the crime was executed. <br> Note: this value is null for all crimes executed before January 15th, 2025. */
982
- | null;
985
+ executed_at: number | null;
983
986
  slots: FactionCrimeSlot[];
984
987
  rewards: FactionCrimeReward | null;
985
988
  }
@@ -1043,12 +1046,12 @@ export interface FactionRankedWarDetails {
1043
1046
  /** Timestamp the war ended at. */
1044
1047
  end: number;
1045
1048
  target: number;
1046
- winner: FactionId & (number | null);
1049
+ winner: FactionId | null;
1047
1050
  factions: {
1048
- id?: FactionId;
1049
- name?: string;
1050
- score?: number;
1051
- chain?: number;
1051
+ id: FactionId;
1052
+ name: string;
1053
+ score: number;
1054
+ chain: number;
1052
1055
  }[];
1053
1056
  }
1054
1057
 
@@ -1067,29 +1070,29 @@ export interface FactionRankedWarReportResponse {
1067
1070
  winner: FactionId;
1068
1071
  forfeit: boolean;
1069
1072
  factions: {
1070
- id?: FactionId;
1071
- name?: string;
1072
- score?: number;
1073
- attacks?: number;
1074
- rank?: {
1075
- before?: string;
1076
- after?: string;
1073
+ id: FactionId;
1074
+ name: string;
1075
+ score: number;
1076
+ attacks: number;
1077
+ rank: {
1078
+ before: string;
1079
+ after: string;
1077
1080
  };
1078
- rewards?: {
1079
- respect?: number;
1080
- points?: number;
1081
- items?: {
1082
- id?: ItemId;
1083
- name?: string;
1084
- quantity?: number;
1081
+ rewards: {
1082
+ respect: number;
1083
+ points: number;
1084
+ items: {
1085
+ id: ItemId;
1086
+ name: string;
1087
+ quantity: number;
1085
1088
  }[];
1086
1089
  };
1087
- members?: {
1088
- id?: UserId;
1089
- name?: string;
1090
- level?: number;
1091
- attacks?: number;
1092
- score?: number;
1090
+ members: {
1091
+ id: UserId;
1092
+ name: string;
1093
+ level: number;
1094
+ attacks: number;
1095
+ score: number;
1093
1096
  }[];
1094
1097
  }[];
1095
1098
  };
@@ -1097,10 +1100,10 @@ export interface FactionRankedWarReportResponse {
1097
1100
 
1098
1101
  export interface ForumCategoriesResponse {
1099
1102
  categories: {
1100
- id?: ForumId;
1101
- title?: string;
1102
- acronym?: string;
1103
- threads?: number;
1103
+ id: ForumId;
1104
+ title: string;
1105
+ acronym: string;
1106
+ threads: number;
1104
1107
  }[];
1105
1108
  }
1106
1109
 
@@ -1130,7 +1133,7 @@ export interface ForumThreadBase {
1130
1133
  /** Total number of times players have opened this thread. */
1131
1134
  views: number;
1132
1135
  author: ForumThreadAuthor;
1133
- last_poster: ForumThreadAuthor;
1136
+ last_poster: ForumThreadAuthor | null;
1134
1137
  first_post_time: number;
1135
1138
  last_post_time: number | null;
1136
1139
  has_poll: boolean;
@@ -1139,9 +1142,9 @@ export interface ForumThreadBase {
1139
1142
  }
1140
1143
 
1141
1144
  export interface ForumThreadExtended extends ForumThreadBase {
1142
- content?: string;
1143
- content_raw?: string;
1144
- poll?: ForumPoll;
1145
+ content: string;
1146
+ content_raw: string;
1147
+ poll: ForumPoll | null;
1145
1148
  }
1146
1149
 
1147
1150
  export interface ForumPost {
@@ -1154,10 +1157,9 @@ export interface ForumPost {
1154
1157
  is_edited: boolean;
1155
1158
  is_pinned: boolean;
1156
1159
  created_time: number;
1157
- edited_by: UserId;
1160
+ edited_by: UserId | null;
1158
1161
  has_quote: boolean;
1159
- quoted_post_id: /** 'quoted_post_id' is null when 'has_quote' is false. */
1160
- number /** 'quoted_post_id' is null when 'has_quote' is false. */ | null;
1162
+ quoted_post_id: number | null;
1161
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. */
1162
1164
  content: string;
1163
1165
  likes: number;
@@ -1165,9 +1167,7 @@ export interface ForumPost {
1165
1167
  }
1166
1168
 
1167
1169
  export interface ForumThreadUserExtended extends ForumThreadBase {
1168
- new_posts?: /** Available only when requesting data for yourself (no id or your id) with at least 'Minimal' access type key. */
1169
- | number /** Available only when requesting data for yourself (no id or your id) with at least 'Minimal' access type key. */
1170
- | null;
1170
+ new_posts: number | null;
1171
1171
  }
1172
1172
 
1173
1173
  export interface ForumSubscribedThreadPostsCount {
@@ -1247,7 +1247,7 @@ export interface ItemMarketListingStackable {
1247
1247
  }
1248
1248
 
1249
1249
  export interface ItemMarketListingItemDetails {
1250
- uid: number;
1250
+ uid: ItemUid;
1251
1251
  stats: ItemMarketListingItemStats;
1252
1252
  bonuses: ItemMarketListingItemBonus[];
1253
1253
  rarity: ("yellow" | "orange" | "red") | null;
@@ -1256,7 +1256,8 @@ export interface ItemMarketListingItemDetails {
1256
1256
  export interface ItemMarketListingNonstackable {
1257
1257
  price: number;
1258
1258
  amount: number;
1259
- itemDetails: ItemMarketListingItemDetails;
1259
+ itemDetails?: ItemMarketListingItemDetails;
1260
+ item_details: ItemMarketListingItemDetails;
1260
1261
  }
1261
1262
 
1262
1263
  export interface ItemMarket {
@@ -1357,9 +1358,9 @@ export interface Race {
1357
1358
  end: number | null;
1358
1359
  };
1359
1360
  requirements: {
1360
- car_class: RaceClassEnum;
1361
- driver_class: RaceClassEnum;
1362
- car_item_id: ItemId;
1361
+ car_class: RaceClassEnum | null;
1362
+ driver_class: RaceClassEnum | null;
1363
+ car_item_id: ItemId | null;
1363
1364
  requires_stock_car: boolean;
1364
1365
  requires_password: boolean;
1365
1366
  join_fee: number;
@@ -1392,7 +1393,7 @@ export interface RacerDetails {
1392
1393
  }
1393
1394
 
1394
1395
  export interface RacingRaceDetailsResponse extends Race {
1395
- results?: RacerDetails[];
1396
+ results: RacerDetails[];
1396
1397
  }
1397
1398
 
1398
1399
  export type RacingSelectionName =
@@ -1427,7 +1428,7 @@ export interface TornCrime {
1427
1428
  id: number;
1428
1429
  name: string;
1429
1430
  category_id: number;
1430
- category_name: string;
1431
+ category_name?: string;
1431
1432
  enhancer_id: number;
1432
1433
  enhancer_name: string;
1433
1434
  unique_outcomes_count: number;
@@ -1470,14 +1471,9 @@ export interface TornHofResponse {
1470
1471
  }
1471
1472
 
1472
1473
  export interface FactionHofValues {
1473
- chain: /** Maximum chain achieved by the faction. Null if chosen category is 'rank' or 'respect'. */
1474
- | number /** Maximum chain achieved by the faction. Null if chosen category is 'rank' or 'respect'. */
1475
- | null;
1476
- chain_duration: /** The duration of the chain. Null if chosen category is 'rank' or 'respect'. */
1477
- | number /** The duration of the chain. Null if chosen category is 'rank' or 'respect'. */
1478
- | null;
1479
- respect: /** Null if chosen category is 'chain'. */
1480
- number /** Null if chosen category is 'chain'. */ | null;
1474
+ chain: number | null;
1475
+ chain_duration: number | null;
1476
+ respect: number | null;
1481
1477
  }
1482
1478
 
1483
1479
  export interface TornFactionHof {
@@ -1517,9 +1513,8 @@ export interface Bounty {
1517
1513
  target_id: UserId;
1518
1514
  target_name: string;
1519
1515
  target_level: number;
1520
- lister_id: UserId & (number | null);
1521
- lister_name: /** If the bounty is anonymous this field is null. */
1522
- string /** If the bounty is anonymous this field is null. */ | null;
1516
+ lister_id: UserId | null;
1517
+ lister_name: string | null;
1523
1518
  reward: number;
1524
1519
  reason: string | null;
1525
1520
  quantity: number;
@@ -1528,14 +1523,9 @@ export interface Bounty {
1528
1523
  }
1529
1524
 
1530
1525
  export interface AttackLogSummary {
1531
- id: UserId /** Id of the participant, could be null in stealthed attacks. */ &
1532
- (
1533
- | number /** Id of the participant, could be null in stealthed attacks. */
1534
- | null
1535
- );
1526
+ id: UserId | null;
1536
1527
  name: /** Name of the participant, could be null in stealthed attacks. */
1537
- | string /** Name of the participant, could be null in stealthed attacks. */
1538
- | null;
1528
+ string | null;
1539
1529
  hits: number;
1540
1530
  misses: number;
1541
1531
  damage: number;
@@ -1547,23 +1537,20 @@ export interface AttackLog {
1547
1537
  action: AttackActionEnum;
1548
1538
  icon: string;
1549
1539
  attacker: /** This value could be null in stealthed attacks. */
1550
- | {
1551
- id: UserId;
1552
- name: string;
1553
- item: /** This object could be null if there was no item being used in this turn or during this effect. */
1554
- | {
1555
- id: ItemId;
1556
- name: string;
1557
- } /** This object could be null if there was no item being used in this turn or during this effect. */
1558
- | null;
1559
- } /** This value could be null in stealthed attacks. */
1560
- | 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;
1561
1549
  defender: /** This value could be null in stealthed attacks. */
1562
- | {
1563
- id: number;
1564
- name: string;
1565
- } /** This value could be null in stealthed attacks. */
1566
- | null;
1550
+ {
1551
+ id: UserId;
1552
+ name: string;
1553
+ } | null;
1567
1554
  }
1568
1555
 
1569
1556
  export interface AttackLogResponse {
@@ -1616,7 +1603,7 @@ export interface TornItemWeaponDetails {
1616
1603
  base_stats: TornItemBaseStats;
1617
1604
  category: TornItemWeaponCategoryEnum;
1618
1605
  ammo: {
1619
- "": AmmoId;
1606
+ id: AmmoId;
1620
1607
  name: string;
1621
1608
  magazine_rounds: number;
1622
1609
  rate_of_fire: {
@@ -1645,7 +1632,7 @@ export interface TornItem {
1645
1632
  requirement: string | null;
1646
1633
  image: string;
1647
1634
  type: TornItemTypeEnum;
1648
- sub_type: TornItemWeaponTypeEnum & (string | null);
1635
+ sub_type: TornItemWeaponTypeEnum | null;
1649
1636
  is_masked: boolean;
1650
1637
  is_tradable: boolean;
1651
1638
  is_found_in_city: boolean;
@@ -1659,7 +1646,7 @@ export interface TornItem {
1659
1646
  market_price: number;
1660
1647
  };
1661
1648
  circulation: number;
1662
- details: (TornItemWeaponDetails & TornItemArmorDetails) | null;
1649
+ details: TornItemWeaponDetails | TornItemArmorDetails | null;
1663
1650
  }
1664
1651
 
1665
1652
  export interface TornItemsResponse {
@@ -2134,7 +2121,7 @@ export interface PersonalStatsAttackingPublic {
2134
2121
  elo: number;
2135
2122
  unarmored_wins: number;
2136
2123
  highest_level_beaten: number;
2137
- escapes: {
2124
+ escapes?: {
2138
2125
  player: number;
2139
2126
  foes: number;
2140
2127
  };
@@ -2650,7 +2637,7 @@ export interface UserCrimeDetailsBootlegging {
2650
2637
  total: number;
2651
2638
  earnings: number;
2652
2639
  };
2653
- dvds_copied: number;
2640
+ dvds_copied?: number;
2654
2641
  }
2655
2642
 
2656
2643
  export interface UserCrimeDetailsGraffiti {
@@ -2672,8 +2659,8 @@ export interface UserCrimeDetailsCardSkimming {
2672
2659
  sold: number;
2673
2660
  lost: number;
2674
2661
  areas: {
2675
- id?: number;
2676
- amount?: number;
2662
+ id: number;
2663
+ amount: number;
2677
2664
  }[];
2678
2665
  };
2679
2666
  skimmers: {
@@ -2807,14 +2794,14 @@ export interface UserRacesResponse {
2807
2794
  }
2808
2795
 
2809
2796
  export interface UserRaceCarDetails extends RaceCar {
2810
- id?: RaceCarId;
2811
- name?: string;
2812
- worth?: number;
2813
- points_spent?: number;
2814
- races_entered?: number;
2815
- races_won?: number;
2816
- is_removed?: boolean;
2817
- 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[];
2818
2805
  }
2819
2806
 
2820
2807
  export interface UserEnlistedCarsResponse {
@@ -2832,7 +2819,7 @@ export interface UserForumThreadsResponse {
2832
2819
  }
2833
2820
 
2834
2821
  export interface UserForumSubscribedThreadsResponse {
2835
- forumSubscribedThreads: ForumSubscribedThread[];
2822
+ forumSubscribedThreads?: ForumSubscribedThread[];
2836
2823
  }
2837
2824
 
2838
2825
  export interface UserForumFeedResponse {
@@ -2906,7 +2893,7 @@ export interface UserItemMarkeListingItemDetails {
2906
2893
  name: string;
2907
2894
  type: string;
2908
2895
  rarity: ("yellow" | "orange" | "red") | null;
2909
- uid: number | null;
2896
+ uid: ItemUid | null;
2910
2897
  stats: ItemMarketListingItemStats | null;
2911
2898
  bonuses: ItemMarketListingItemBonus[];
2912
2899
  }
@@ -2944,7 +2931,7 @@ export interface UserList {
2944
2931
  id: UserId;
2945
2932
  name: string;
2946
2933
  level: number;
2947
- faction_id: FactionId & (number | null);
2934
+ faction_id: FactionId | null;
2948
2935
  last_action: UserLastAction;
2949
2936
  status: UserStatus;
2950
2937
  }