torn-client 0.1.7 → 0.1.9

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.mts CHANGED
@@ -549,6 +549,9 @@ type FactionCrime = {
549
549
  /** @category Models */
550
550
  type FactionCrimeId = number;
551
551
 
552
+ /** @category Models */
553
+ type FactionCrimeItemOutcomeEnum = "lost" | "used";
554
+
552
555
  /** @category Models */
553
556
  type FactionCrimeResponse = {
554
557
  crime: FactionCrime;
@@ -604,10 +607,23 @@ type FactionCrimeStatusEnum = "Recruiting" | "Planning" | "Successful" | "Failur
604
607
  type FactionCrimeUser = {
605
608
  id: UserId;
606
609
  outcome: FactionCrimeUserOutcome | unknown;
610
+ outcome_duration?: number | unknown;
611
+ item_outcome: FactionCrimeUserItemOutcome | unknown;
607
612
  joined_at: number;
608
613
  progress: number;
609
614
  };
610
615
 
616
+ /** @category Models */
617
+ type FactionCrimeUserItemOutcome = {
618
+ owned_by: FactionCrimeUserItemOutcomeEnum;
619
+ item_id: ItemId;
620
+ item_uid: ItemUid;
621
+ outcome: FactionCrimeItemOutcomeEnum;
622
+ };
623
+
624
+ /** @category Models */
625
+ type FactionCrimeUserItemOutcomeEnum = "user" | "faction";
626
+
611
627
  /** @category Models */
612
628
  type FactionCrimeUserOutcome = "Successful" | "Failed" | "Jailed" | "Injured" | "Hospitalized";
613
629
 
@@ -1438,6 +1454,12 @@ type JobPositionLawEnum = "Law Student" | "Paralegal" | "Probate Lawyer" | "Tria
1438
1454
  /** @category Models */
1439
1455
  type JobPositionMedicalEnum = "Medical Student" | "Houseman" | "Senior Houseman" | "GP" | "Consultant" | "Surgeon" | "Brain Surgeon";
1440
1456
 
1457
+ /** @category Models */
1458
+ type KeyInfoAvailableLog = {
1459
+ category_id: LogCategoryId;
1460
+ log_ids: LogId[];
1461
+ };
1462
+
1441
1463
  /** @category Models */
1442
1464
  type KeyInfoResponse = {
1443
1465
  info: {
@@ -1464,6 +1486,10 @@ type KeyInfoResponse = {
1464
1486
  faction_id?: FactionId | unknown;
1465
1487
  company: boolean;
1466
1488
  company_id?: CompanyId | unknown;
1489
+ log: {
1490
+ custom_permissions: boolean;
1491
+ available: KeyInfoAvailableLog[];
1492
+ };
1467
1493
  };
1468
1494
  };
1469
1495
  };
@@ -3484,6 +3510,28 @@ type UserListResponse = {
3484
3510
  _metadata: RequestMetadataWithLinks;
3485
3511
  };
3486
3512
 
3513
+ /** @category Models */
3514
+ type UserLog = {
3515
+ id: UserLogId;
3516
+ timestamp: number;
3517
+ details: {
3518
+ id: LogId;
3519
+ title: string;
3520
+ category: string;
3521
+ };
3522
+ data: Record<string, unknown>;
3523
+ params: Record<string, unknown>;
3524
+ };
3525
+
3526
+ /** @category Models */
3527
+ type UserLogId = string;
3528
+
3529
+ /** @category Models */
3530
+ type UserLogsResponse = {
3531
+ log: UserLog[];
3532
+ _metadata: RequestMetadataWithLinks;
3533
+ };
3534
+
3487
3535
  /** @category Models */
3488
3536
  type UserLookupResponse = {
3489
3537
  selections: UserSelectionName[];
@@ -3680,6 +3728,7 @@ declare class FactionEndpoint {
3680
3728
  * @param params - Optional query parameters
3681
3729
  */
3682
3730
  attacks(params?: {
3731
+ filters?: "incoming" | "outgoing";
3683
3732
  limit?: number;
3684
3733
  sort?: "DESC" | "ASC";
3685
3734
  to?: number;
@@ -3691,6 +3740,7 @@ declare class FactionEndpoint {
3691
3740
  * @param params - Optional query parameters
3692
3741
  */
3693
3742
  attacksfull(params?: {
3743
+ filters?: "incoming" | "outgoing";
3694
3744
  limit?: number;
3695
3745
  sort?: "DESC" | "ASC";
3696
3746
  to?: number;
@@ -3837,6 +3887,7 @@ declare class FactionEndpoint {
3837
3887
  * @param params - Optional query parameters
3838
3888
  */
3839
3889
  revives(params?: {
3890
+ filters?: "incoming" | "outgoing";
3840
3891
  limit?: number;
3841
3892
  sort?: "DESC" | "ASC";
3842
3893
  to?: number;
@@ -3849,6 +3900,7 @@ declare class FactionEndpoint {
3849
3900
  * @param params - Optional query parameters
3850
3901
  */
3851
3902
  revivesfull(params?: {
3903
+ filters?: "incoming" | "outgoing";
3852
3904
  limit?: number;
3853
3905
  sort?: "DESC" | "ASC";
3854
3906
  to?: number;
@@ -4776,6 +4828,7 @@ declare class UserEndpoint {
4776
4828
  * @param params - Optional query parameters
4777
4829
  */
4778
4830
  attacks(params?: {
4831
+ filters?: "incoming" | "outgoing";
4779
4832
  limit?: number;
4780
4833
  sort?: "DESC" | "ASC";
4781
4834
  to?: number;
@@ -4787,6 +4840,7 @@ declare class UserEndpoint {
4787
4840
  * @param params - Optional query parameters
4788
4841
  */
4789
4842
  attacksfull(params?: {
4843
+ filters?: "incoming" | "outgoing";
4790
4844
  limit?: number;
4791
4845
  sort?: "DESC" | "ASC";
4792
4846
  to?: number;
@@ -4905,6 +4959,18 @@ declare class UserEndpoint {
4905
4959
  sort?: "DESC" | "ASC";
4906
4960
  timestamp?: string;
4907
4961
  }): Promise<PaginatedResponse<UserListResponse> & UserListResponse>;
4962
+ /**
4963
+ * Get your logs
4964
+ * @param params - Optional query parameters
4965
+ */
4966
+ log(params?: {
4967
+ log?: LogId[];
4968
+ cat?: LogCategoryId;
4969
+ limit?: number;
4970
+ to?: number;
4971
+ from?: number;
4972
+ timestamp?: string;
4973
+ }): Promise<PaginatedResponse<UserLogsResponse> & UserLogsResponse>;
4908
4974
  /**
4909
4975
  * Get your current ongoing organized crime
4910
4976
  * @param params - Optional query parameters
@@ -4972,6 +5038,7 @@ declare class UserEndpoint {
4972
5038
  * @param params - Optional query parameters
4973
5039
  */
4974
5040
  revives(params?: {
5041
+ filters?: "incoming" | "outgoing";
4975
5042
  limit?: number;
4976
5043
  sort?: "DESC" | "ASC";
4977
5044
  to?: number;
@@ -4984,6 +5051,7 @@ declare class UserEndpoint {
4984
5051
  * @param params - Optional query parameters
4985
5052
  */
4986
5053
  revivesfull(params?: {
5054
+ filters?: "incoming" | "outgoing";
4987
5055
  limit?: number;
4988
5056
  sort?: "DESC" | "ASC";
4989
5057
  to?: number;
@@ -5256,4 +5324,4 @@ declare class TornRateLimitError extends Error {
5256
5324
  constructor(message: string);
5257
5325
  }
5258
5326
 
5259
- export { type AmmoId, type ApiKeyAccessTypeEnum, type ApiKeyBalancing, type Attack, type AttackActionEnum, type AttackCode, type AttackFinishingHitEffect, type AttackId, type AttackLog, type AttackLogResponse, type AttackLogSummary, type AttackPlayer, type AttackPlayerFaction, type AttackPlayerSimplified, type AttackSimplified, type AttackingFinishingHitEffects, type BasicProperty, type BasicUser, type Bazaar, type BazaarAdvancedItemSales, type BazaarBargainSales, type BazaarBulkSales, type BazaarDollarSales, type BazaarRecentFavorites, type BazaarResponse, type BazaarResponseSpecialized, type BazaarSpecialized, type BazaarTotalFavorites, type BazaarWeekly, type BazaarWeeklyCustomers, type BazaarWeeklyIncome, type Bounty, type ChainId, type CompanyId, type CountryEnum, type DirtyBombId, type EducationId, type Faction, type FactionApplication, type FactionApplicationStatusEnum, type FactionApplicationsResponse, type FactionAttackResult, type FactionAttacksFullResponse, type FactionAttacksResponse, type FactionBalance, type FactionBalanceResponse, type FactionBasic, type FactionBasicResponse, type FactionBranchDetails, type FactionBranchId, type FactionBranchStateEnum, type FactionChain, FactionChainIdContext, type FactionChainReport, type FactionChainReportAttacker, type FactionChainReportAttackerAttacks, type FactionChainReportAttackerRespect, type FactionChainReportBonus, type FactionChainReportDetails, type FactionChainReportResponse, type FactionChainWarfare, type FactionChainsResponse, type FactionContributor, type FactionContributorsResponse, type FactionCrime, type FactionCrimeId, FactionCrimeIdContext, type FactionCrimeResponse, type FactionCrimeReward, type FactionCrimeRewardItem, type FactionCrimeRewardPayout, type FactionCrimeSlot, type FactionCrimeStatusEnum, type FactionCrimeUser, type FactionCrimeUserOutcome, type FactionCrimesResponse, FactionEndpoint, type FactionHofResponse, type FactionHofStats, type FactionHofValues, type FactionId, FactionIdContext, type FactionLookupResponse, type FactionMember, type FactionMembersResponse, type FactionNews, type FactionNewsCategory, type FactionNewsResponse, type FactionOngoingChain, type FactionOngoingChainResponse, type FactionOrganizedCrimePayoutType, type FactionPact, type FactionPosition, type FactionPositionAbilityEnum, type FactionPositionsResponse, type FactionRacketsResponse, type FactionRaidReport, type FactionRaidReportAttacker, type FactionRaidReportFaction, type FactionRaidReportUser, type FactionRaidWar, FactionRaidWarIdContext, type FactionRaidWarParticipant, type FactionRaidWarReportResponse, type FactionRaidWarfare, type FactionRaidWarfareFaction, type FactionRaidsResponse, type FactionRank, type FactionRankEnum, type FactionRankedWar, type FactionRankedWarDetails, FactionRankedWarIdContext, type FactionRankedWarParticipant, type FactionRankedWarReportResponse, type FactionRankedWarResponse, type FactionRankedWarsCategoryEnum, type FactionResponse, type FactionSearch, type FactionSearchLeader, type FactionSearchResponse, type FactionSelectionName, type FactionStat, type FactionStatEnum, type FactionStatsResponse, type FactionTerritoriesOwnershipResponse, type FactionTerritoriesResponse, type FactionTerritory, type FactionTerritoryEnum, type FactionTerritoryOwnership, type FactionTerritoryWar, type FactionTerritoryWarFaction, type FactionTerritoryWarFactionWallPlayers, type FactionTerritoryWarFinished, type FactionTerritoryWarFinishedFaction, FactionTerritoryWarIdContext, type FactionTerritoryWarOngoing, type FactionTerritoryWarOngoingFaction, type FactionTerritoryWarParticipant, type FactionTerritoryWarReport, type FactionTerritoryWarReportFaction, type FactionTerritoryWarReportMembers, type FactionTerritoryWarReportResponse, type FactionTerritoryWarResultEnum, type FactionTerritoryWarfare, type FactionTerritoryWarsCategoryEnum, type FactionTerritoryWarsHistoryResponse, type FactionTerritoryWarsResponse, type FactionUpgradeDetails, type FactionUpgrades, type FactionUpgradesResponse, type FactionWarfareDirtyBomb, type FactionWarfareDirtyBombPlanter, type FactionWarfareDirtyBombTargetFaction, type FactionWarfareResponse, type FactionWarfareTypeEnum, type FactionWars, type FactionWarsResponse, type ForumCategoriesResponse, ForumCategoryIdsContext, ForumEndpoint, type ForumFeed, type ForumFeedTypeEnum, type ForumId, type ForumLookupResponse, type ForumPoll, type ForumPollVote, type ForumPost, type ForumPostId, type ForumPostsResponse, type ForumResponse, type ForumSelectionName, type ForumSubscribedThread, type ForumSubscribedThreadPostsCount, type ForumThreadAuthor, type ForumThreadBase, type ForumThreadExtended, type ForumThreadId, ForumThreadIdContext, type ForumThreadResponse, type ForumThreadUserExtended, type ForumThreadsResponse, type HofValue, type HofValueFloat, type HofValueString, type ItemId, type ItemMarket, type ItemMarketItem, type ItemMarketListingItemBonus, type ItemMarketListingItemDetails, type ItemMarketListingItemStats, type ItemMarketListingNonstackable, type ItemMarketListingStackable, type ItemModId, type ItemUid, type JobPositionArmyEnum, type JobPositionCasinoEnum, type JobPositionEducationEnum, type JobPositionGrocerEnum, type JobPositionLawEnum, type JobPositionMedicalEnum, KeyEndpoint, type KeyInfoResponse, type KeyLogResponse, type KeyResponse, type KeySelectionName, type LogCategoryId, type LogId, MarketEndpoint, MarketIdContext, type MarketItemMarketResponse, type MarketLookupResponse, type MarketPropertiesResponse, type MarketPropertyDetails, MarketPropertyTypeIdContext, type MarketRentalDetails, type MarketRentalsResponse, type MarketResponse, type MarketSelectionName, type MarketSpecializedBazaarCategoryEnum, type OrganizedCrimeName, PaginatedResponse, type Parameters, type PersonalStatsAttackingExtended, type PersonalStatsAttackingPopular, type PersonalStatsAttackingPublic, type PersonalStatsBattleStats, type PersonalStatsBounties, type PersonalStatsCategoryEnum, type PersonalStatsCommunication, type PersonalStatsCrimes, type PersonalStatsCrimesPopular, type PersonalStatsCrimesV1, type PersonalStatsCrimesV2, type PersonalStatsDrugs, type PersonalStatsFinishingHits, type PersonalStatsHistoricStat, type PersonalStatsHospital, type PersonalStatsHospitalPopular, type PersonalStatsInvestments, type PersonalStatsItems, type PersonalStatsItemsPopular, type PersonalStatsJail, type PersonalStatsJobsExtended, type PersonalStatsJobsPublic, type PersonalStatsMissions, type PersonalStatsNetworthExtended, type PersonalStatsNetworthPublic, type PersonalStatsOther, type PersonalStatsOtherPopular, type PersonalStatsRacing, type PersonalStatsStatName, type PersonalStatsTrading, type PersonalStatsTravel, type PersonalStatsTravelPopular, PropertyEndpoint, type PropertyId, PropertyIdContext, type PropertyLookupResponse, type PropertyModificationEnum, type PropertyPropertyResponse, type PropertyResponse, type PropertySelectionName, type PropertyStaffEnum, type PropertyTypeId, type Race, type RaceCar, type RaceCarId, type RaceCarUpgrade, type RaceCarUpgradeCategory, type RaceCarUpgradeId, type RaceCarUpgradeSubCategory, type RaceClassEnum, type RaceId, type RaceRecord, type RaceStatusEnum, type RaceTrack, type RaceTrackId, type RacerDetails, type RacingCarUpgradesResponse, type RacingCarsResponse, RacingEndpoint, type RacingLookupResponse, type RacingRaceDetails, type RacingRaceDetailsResponse, RacingRaceIdContext, type RacingRaceTypeEnum, type RacingRacesResponse, type RacingResponse, type RacingSelectionName, RacingTrackIdContext, type RacingTrackRecordsResponse, type RacingTracksResponse, type RaidWarId, type RankedWarId, type RateLimitMode, type Report, type ReportAnonymousBounties, type ReportBase, type ReportCompanyFinancials, type ReportFriendOrFoe, type ReportFriendOrFoeUser, type ReportHistory, type ReportHistoryCompany, type ReportHistoryFaction, type ReportInvestment, type ReportMoney, type ReportMostWanted, type ReportReport, type ReportStats, type ReportStockAnalysis, type ReportTrueLevel, type ReportTypeEnum, type ReportWarrantDetails, type ReportsResponse, type RequestLinks, type RequestMetadata, type RequestMetadataWithLinks, type RequestMetadataWithLinksAndTotal, type Requester, type Revive, type ReviveId, type ReviveSetting, type ReviveSimplified, type RevivesFullResponse, type RevivesResponse, type SelectionCategoryEnum, type TerritoryWarId, type TimestampResponse, TornAPI, type TornAPIOptions, TornApiError, type TornBountiesResponse, type TornCalendarActivity, type TornCalendarResponse, type TornCrime, type TornCrimeId, TornCrimeIdContext, type TornCrimesResponse, type TornEducation, type TornEducationCourses, type TornEducationPrerequisites, type TornEducationResponse, type TornEducationRewards, TornEndpoint, type TornFactionHof, type TornFactionHofCategory, type TornFactionHofResponse, type TornFactionTree, type TornFactionTreeBranch, type TornFactionTreeResponse, type TornHof, type TornHofBasic, type TornHofCategory, type TornHofResponse, type TornHofWithOffenses, TornIdsContext, type TornItem, type TornItemAmmo, type TornItemAmmoResponse, type TornItemAmmoTypeEnum, type TornItemArmorCoverage, type TornItemArmorCoveragePartEnum, type TornItemArmorDetails, type TornItemBaseStats, type TornItemCategory, type TornItemMods, type TornItemModsResponse, type TornItemTypeEnum, type TornItemWeaponCategoryEnum, type TornItemWeaponDetails, type TornItemWeaponTypeEnum, type TornItemsResponse, type TornLog, type TornLogCategoriesResponse, type TornLogCategory, TornLogCategoryIdContext, type TornLogTypesResponse, type TornLookupResponse, type TornOrganizedCrime, type TornOrganizedCrimePositionId, type TornOrganizedCrimeRequiredItem, type TornOrganizedCrimeResponse, type TornOrganizedCrimeScope, type TornOrganizedCrimeSlot, type TornOrganizedCrimeSpawn, type TornProperties, type TornRacket, type TornRacketReward, type TornRacketType, TornRateLimitError, type TornResponse, type TornSelectionName, type TornSubcrime, type TornSubcrimesResponse, type TornTerritoriesNoLinksResponse, type TornTerritoriesResponse, type TornTerritory, type TornTerritoryCoordinates, type User, type UserBountiesResponse, type UserCalendar, type UserCalendarResponse, type UserCrime, type UserCrimeAttempts, type UserCrimeDetailsBootlegging, type UserCrimeDetailsCardSkimming, type UserCrimeDetailsCracking, type UserCrimeDetailsGraffiti, type UserCrimeDetailsHustling, type UserCrimeDetailsScamming, type UserCrimeDetailsShoplifting, UserCrimeIdContext, type UserCrimeRewardAmmo, type UserCrimeRewardItem, type UserCrimeRewards, type UserCrimeUniques, type UserCrimeUniquesReward, type UserCrimeUniquesRewardAmmo, type UserCrimeUniquesRewardAmmoEnum, type UserCrimeUniquesRewardMoney, type UserCrimesResponse, type UserCurrentEducation, type UserEducation, type UserEducationResponse, UserEndpoint, type UserEnlistedCarsResponse, type UserFactionBalance, type UserFactionBalanceResponse, type UserForumFeedResponse, type UserForumFriendsResponse, type UserForumPostsResponse, type UserForumSubscribedThreadsResponse, type UserForumThreadsResponse, type UserHofResponse, type UserHofStats, type UserId, UserIdContext, type UserItemMarkeListingItemDetails, type UserItemMarketListing, type UserItemMarketResponse, type UserJobRanks, type UserJobRanksResponse, type UserLastAction, type UserList, type UserListEnum, type UserListResponse, type UserLookupResponse, type UserOrganizedCrimeResponse, type UserPersonalStatsCategory, type UserPersonalStatsFull, type UserPersonalStatsFullPublic, type UserPersonalStatsHistoric, type UserPersonalStatsPopular, type UserPersonalStatsResponse, type UserPropertiesResponse, type UserPropertyBasicDetails, type UserPropertyDetails, type UserPropertyDetailsExtended, type UserPropertyDetailsExtendedForRent, type UserPropertyDetailsExtendedForSale, type UserPropertyDetailsExtendedRented, type UserPropertyDetailsExtendedWithRent, type UserPropertyResponse, type UserRaceCarDetails, type UserRacesResponse, type UserRacingRecordsResponse, type UserResponse, type UserSelectionName, type UserStatus, type UserSubcrime, type WeaponBonusEnum };
5327
+ export { type AmmoId, type ApiKeyAccessTypeEnum, type ApiKeyBalancing, type Attack, type AttackActionEnum, type AttackCode, type AttackFinishingHitEffect, type AttackId, type AttackLog, type AttackLogResponse, type AttackLogSummary, type AttackPlayer, type AttackPlayerFaction, type AttackPlayerSimplified, type AttackSimplified, type AttackingFinishingHitEffects, type BasicProperty, type BasicUser, type Bazaar, type BazaarAdvancedItemSales, type BazaarBargainSales, type BazaarBulkSales, type BazaarDollarSales, type BazaarRecentFavorites, type BazaarResponse, type BazaarResponseSpecialized, type BazaarSpecialized, type BazaarTotalFavorites, type BazaarWeekly, type BazaarWeeklyCustomers, type BazaarWeeklyIncome, type Bounty, type ChainId, type CompanyId, type CountryEnum, type DirtyBombId, type EducationId, type Faction, type FactionApplication, type FactionApplicationStatusEnum, type FactionApplicationsResponse, type FactionAttackResult, type FactionAttacksFullResponse, type FactionAttacksResponse, type FactionBalance, type FactionBalanceResponse, type FactionBasic, type FactionBasicResponse, type FactionBranchDetails, type FactionBranchId, type FactionBranchStateEnum, type FactionChain, FactionChainIdContext, type FactionChainReport, type FactionChainReportAttacker, type FactionChainReportAttackerAttacks, type FactionChainReportAttackerRespect, type FactionChainReportBonus, type FactionChainReportDetails, type FactionChainReportResponse, type FactionChainWarfare, type FactionChainsResponse, type FactionContributor, type FactionContributorsResponse, type FactionCrime, type FactionCrimeId, FactionCrimeIdContext, type FactionCrimeItemOutcomeEnum, type FactionCrimeResponse, type FactionCrimeReward, type FactionCrimeRewardItem, type FactionCrimeRewardPayout, type FactionCrimeSlot, type FactionCrimeStatusEnum, type FactionCrimeUser, type FactionCrimeUserItemOutcome, type FactionCrimeUserItemOutcomeEnum, type FactionCrimeUserOutcome, type FactionCrimesResponse, FactionEndpoint, type FactionHofResponse, type FactionHofStats, type FactionHofValues, type FactionId, FactionIdContext, type FactionLookupResponse, type FactionMember, type FactionMembersResponse, type FactionNews, type FactionNewsCategory, type FactionNewsResponse, type FactionOngoingChain, type FactionOngoingChainResponse, type FactionOrganizedCrimePayoutType, type FactionPact, type FactionPosition, type FactionPositionAbilityEnum, type FactionPositionsResponse, type FactionRacketsResponse, type FactionRaidReport, type FactionRaidReportAttacker, type FactionRaidReportFaction, type FactionRaidReportUser, type FactionRaidWar, FactionRaidWarIdContext, type FactionRaidWarParticipant, type FactionRaidWarReportResponse, type FactionRaidWarfare, type FactionRaidWarfareFaction, type FactionRaidsResponse, type FactionRank, type FactionRankEnum, type FactionRankedWar, type FactionRankedWarDetails, FactionRankedWarIdContext, type FactionRankedWarParticipant, type FactionRankedWarReportResponse, type FactionRankedWarResponse, type FactionRankedWarsCategoryEnum, type FactionResponse, type FactionSearch, type FactionSearchLeader, type FactionSearchResponse, type FactionSelectionName, type FactionStat, type FactionStatEnum, type FactionStatsResponse, type FactionTerritoriesOwnershipResponse, type FactionTerritoriesResponse, type FactionTerritory, type FactionTerritoryEnum, type FactionTerritoryOwnership, type FactionTerritoryWar, type FactionTerritoryWarFaction, type FactionTerritoryWarFactionWallPlayers, type FactionTerritoryWarFinished, type FactionTerritoryWarFinishedFaction, FactionTerritoryWarIdContext, type FactionTerritoryWarOngoing, type FactionTerritoryWarOngoingFaction, type FactionTerritoryWarParticipant, type FactionTerritoryWarReport, type FactionTerritoryWarReportFaction, type FactionTerritoryWarReportMembers, type FactionTerritoryWarReportResponse, type FactionTerritoryWarResultEnum, type FactionTerritoryWarfare, type FactionTerritoryWarsCategoryEnum, type FactionTerritoryWarsHistoryResponse, type FactionTerritoryWarsResponse, type FactionUpgradeDetails, type FactionUpgrades, type FactionUpgradesResponse, type FactionWarfareDirtyBomb, type FactionWarfareDirtyBombPlanter, type FactionWarfareDirtyBombTargetFaction, type FactionWarfareResponse, type FactionWarfareTypeEnum, type FactionWars, type FactionWarsResponse, type ForumCategoriesResponse, ForumCategoryIdsContext, ForumEndpoint, type ForumFeed, type ForumFeedTypeEnum, type ForumId, type ForumLookupResponse, type ForumPoll, type ForumPollVote, type ForumPost, type ForumPostId, type ForumPostsResponse, type ForumResponse, type ForumSelectionName, type ForumSubscribedThread, type ForumSubscribedThreadPostsCount, type ForumThreadAuthor, type ForumThreadBase, type ForumThreadExtended, type ForumThreadId, ForumThreadIdContext, type ForumThreadResponse, type ForumThreadUserExtended, type ForumThreadsResponse, type HofValue, type HofValueFloat, type HofValueString, type ItemId, type ItemMarket, type ItemMarketItem, type ItemMarketListingItemBonus, type ItemMarketListingItemDetails, type ItemMarketListingItemStats, type ItemMarketListingNonstackable, type ItemMarketListingStackable, type ItemModId, type ItemUid, type JobPositionArmyEnum, type JobPositionCasinoEnum, type JobPositionEducationEnum, type JobPositionGrocerEnum, type JobPositionLawEnum, type JobPositionMedicalEnum, KeyEndpoint, type KeyInfoAvailableLog, type KeyInfoResponse, type KeyLogResponse, type KeyResponse, type KeySelectionName, type LogCategoryId, type LogId, MarketEndpoint, MarketIdContext, type MarketItemMarketResponse, type MarketLookupResponse, type MarketPropertiesResponse, type MarketPropertyDetails, MarketPropertyTypeIdContext, type MarketRentalDetails, type MarketRentalsResponse, type MarketResponse, type MarketSelectionName, type MarketSpecializedBazaarCategoryEnum, type OrganizedCrimeName, PaginatedResponse, type Parameters, type PersonalStatsAttackingExtended, type PersonalStatsAttackingPopular, type PersonalStatsAttackingPublic, type PersonalStatsBattleStats, type PersonalStatsBounties, type PersonalStatsCategoryEnum, type PersonalStatsCommunication, type PersonalStatsCrimes, type PersonalStatsCrimesPopular, type PersonalStatsCrimesV1, type PersonalStatsCrimesV2, type PersonalStatsDrugs, type PersonalStatsFinishingHits, type PersonalStatsHistoricStat, type PersonalStatsHospital, type PersonalStatsHospitalPopular, type PersonalStatsInvestments, type PersonalStatsItems, type PersonalStatsItemsPopular, type PersonalStatsJail, type PersonalStatsJobsExtended, type PersonalStatsJobsPublic, type PersonalStatsMissions, type PersonalStatsNetworthExtended, type PersonalStatsNetworthPublic, type PersonalStatsOther, type PersonalStatsOtherPopular, type PersonalStatsRacing, type PersonalStatsStatName, type PersonalStatsTrading, type PersonalStatsTravel, type PersonalStatsTravelPopular, PropertyEndpoint, type PropertyId, PropertyIdContext, type PropertyLookupResponse, type PropertyModificationEnum, type PropertyPropertyResponse, type PropertyResponse, type PropertySelectionName, type PropertyStaffEnum, type PropertyTypeId, type Race, type RaceCar, type RaceCarId, type RaceCarUpgrade, type RaceCarUpgradeCategory, type RaceCarUpgradeId, type RaceCarUpgradeSubCategory, type RaceClassEnum, type RaceId, type RaceRecord, type RaceStatusEnum, type RaceTrack, type RaceTrackId, type RacerDetails, type RacingCarUpgradesResponse, type RacingCarsResponse, RacingEndpoint, type RacingLookupResponse, type RacingRaceDetails, type RacingRaceDetailsResponse, RacingRaceIdContext, type RacingRaceTypeEnum, type RacingRacesResponse, type RacingResponse, type RacingSelectionName, RacingTrackIdContext, type RacingTrackRecordsResponse, type RacingTracksResponse, type RaidWarId, type RankedWarId, type RateLimitMode, type Report, type ReportAnonymousBounties, type ReportBase, type ReportCompanyFinancials, type ReportFriendOrFoe, type ReportFriendOrFoeUser, type ReportHistory, type ReportHistoryCompany, type ReportHistoryFaction, type ReportInvestment, type ReportMoney, type ReportMostWanted, type ReportReport, type ReportStats, type ReportStockAnalysis, type ReportTrueLevel, type ReportTypeEnum, type ReportWarrantDetails, type ReportsResponse, type RequestLinks, type RequestMetadata, type RequestMetadataWithLinks, type RequestMetadataWithLinksAndTotal, type Requester, type Revive, type ReviveId, type ReviveSetting, type ReviveSimplified, type RevivesFullResponse, type RevivesResponse, type SelectionCategoryEnum, type TerritoryWarId, type TimestampResponse, TornAPI, type TornAPIOptions, TornApiError, type TornBountiesResponse, type TornCalendarActivity, type TornCalendarResponse, type TornCrime, type TornCrimeId, TornCrimeIdContext, type TornCrimesResponse, type TornEducation, type TornEducationCourses, type TornEducationPrerequisites, type TornEducationResponse, type TornEducationRewards, TornEndpoint, type TornFactionHof, type TornFactionHofCategory, type TornFactionHofResponse, type TornFactionTree, type TornFactionTreeBranch, type TornFactionTreeResponse, type TornHof, type TornHofBasic, type TornHofCategory, type TornHofResponse, type TornHofWithOffenses, TornIdsContext, type TornItem, type TornItemAmmo, type TornItemAmmoResponse, type TornItemAmmoTypeEnum, type TornItemArmorCoverage, type TornItemArmorCoveragePartEnum, type TornItemArmorDetails, type TornItemBaseStats, type TornItemCategory, type TornItemMods, type TornItemModsResponse, type TornItemTypeEnum, type TornItemWeaponCategoryEnum, type TornItemWeaponDetails, type TornItemWeaponTypeEnum, type TornItemsResponse, type TornLog, type TornLogCategoriesResponse, type TornLogCategory, TornLogCategoryIdContext, type TornLogTypesResponse, type TornLookupResponse, type TornOrganizedCrime, type TornOrganizedCrimePositionId, type TornOrganizedCrimeRequiredItem, type TornOrganizedCrimeResponse, type TornOrganizedCrimeScope, type TornOrganizedCrimeSlot, type TornOrganizedCrimeSpawn, type TornProperties, type TornRacket, type TornRacketReward, type TornRacketType, TornRateLimitError, type TornResponse, type TornSelectionName, type TornSubcrime, type TornSubcrimesResponse, type TornTerritoriesNoLinksResponse, type TornTerritoriesResponse, type TornTerritory, type TornTerritoryCoordinates, type User, type UserBountiesResponse, type UserCalendar, type UserCalendarResponse, type UserCrime, type UserCrimeAttempts, type UserCrimeDetailsBootlegging, type UserCrimeDetailsCardSkimming, type UserCrimeDetailsCracking, type UserCrimeDetailsGraffiti, type UserCrimeDetailsHustling, type UserCrimeDetailsScamming, type UserCrimeDetailsShoplifting, UserCrimeIdContext, type UserCrimeRewardAmmo, type UserCrimeRewardItem, type UserCrimeRewards, type UserCrimeUniques, type UserCrimeUniquesReward, type UserCrimeUniquesRewardAmmo, type UserCrimeUniquesRewardAmmoEnum, type UserCrimeUniquesRewardMoney, type UserCrimesResponse, type UserCurrentEducation, type UserEducation, type UserEducationResponse, UserEndpoint, type UserEnlistedCarsResponse, type UserFactionBalance, type UserFactionBalanceResponse, type UserForumFeedResponse, type UserForumFriendsResponse, type UserForumPostsResponse, type UserForumSubscribedThreadsResponse, type UserForumThreadsResponse, type UserHofResponse, type UserHofStats, type UserId, UserIdContext, type UserItemMarkeListingItemDetails, type UserItemMarketListing, type UserItemMarketResponse, type UserJobRanks, type UserJobRanksResponse, type UserLastAction, type UserList, type UserListEnum, type UserListResponse, type UserLog, type UserLogId, type UserLogsResponse, type UserLookupResponse, type UserOrganizedCrimeResponse, type UserPersonalStatsCategory, type UserPersonalStatsFull, type UserPersonalStatsFullPublic, type UserPersonalStatsHistoric, type UserPersonalStatsPopular, type UserPersonalStatsResponse, type UserPropertiesResponse, type UserPropertyBasicDetails, type UserPropertyDetails, type UserPropertyDetailsExtended, type UserPropertyDetailsExtendedForRent, type UserPropertyDetailsExtendedForSale, type UserPropertyDetailsExtendedRented, type UserPropertyDetailsExtendedWithRent, type UserPropertyResponse, type UserRaceCarDetails, type UserRacesResponse, type UserRacingRecordsResponse, type UserResponse, type UserSelectionName, type UserStatus, type UserSubcrime, type WeaponBonusEnum };
package/dist/index.d.ts CHANGED
@@ -549,6 +549,9 @@ type FactionCrime = {
549
549
  /** @category Models */
550
550
  type FactionCrimeId = number;
551
551
 
552
+ /** @category Models */
553
+ type FactionCrimeItemOutcomeEnum = "lost" | "used";
554
+
552
555
  /** @category Models */
553
556
  type FactionCrimeResponse = {
554
557
  crime: FactionCrime;
@@ -604,10 +607,23 @@ type FactionCrimeStatusEnum = "Recruiting" | "Planning" | "Successful" | "Failur
604
607
  type FactionCrimeUser = {
605
608
  id: UserId;
606
609
  outcome: FactionCrimeUserOutcome | unknown;
610
+ outcome_duration?: number | unknown;
611
+ item_outcome: FactionCrimeUserItemOutcome | unknown;
607
612
  joined_at: number;
608
613
  progress: number;
609
614
  };
610
615
 
616
+ /** @category Models */
617
+ type FactionCrimeUserItemOutcome = {
618
+ owned_by: FactionCrimeUserItemOutcomeEnum;
619
+ item_id: ItemId;
620
+ item_uid: ItemUid;
621
+ outcome: FactionCrimeItemOutcomeEnum;
622
+ };
623
+
624
+ /** @category Models */
625
+ type FactionCrimeUserItemOutcomeEnum = "user" | "faction";
626
+
611
627
  /** @category Models */
612
628
  type FactionCrimeUserOutcome = "Successful" | "Failed" | "Jailed" | "Injured" | "Hospitalized";
613
629
 
@@ -1438,6 +1454,12 @@ type JobPositionLawEnum = "Law Student" | "Paralegal" | "Probate Lawyer" | "Tria
1438
1454
  /** @category Models */
1439
1455
  type JobPositionMedicalEnum = "Medical Student" | "Houseman" | "Senior Houseman" | "GP" | "Consultant" | "Surgeon" | "Brain Surgeon";
1440
1456
 
1457
+ /** @category Models */
1458
+ type KeyInfoAvailableLog = {
1459
+ category_id: LogCategoryId;
1460
+ log_ids: LogId[];
1461
+ };
1462
+
1441
1463
  /** @category Models */
1442
1464
  type KeyInfoResponse = {
1443
1465
  info: {
@@ -1464,6 +1486,10 @@ type KeyInfoResponse = {
1464
1486
  faction_id?: FactionId | unknown;
1465
1487
  company: boolean;
1466
1488
  company_id?: CompanyId | unknown;
1489
+ log: {
1490
+ custom_permissions: boolean;
1491
+ available: KeyInfoAvailableLog[];
1492
+ };
1467
1493
  };
1468
1494
  };
1469
1495
  };
@@ -3484,6 +3510,28 @@ type UserListResponse = {
3484
3510
  _metadata: RequestMetadataWithLinks;
3485
3511
  };
3486
3512
 
3513
+ /** @category Models */
3514
+ type UserLog = {
3515
+ id: UserLogId;
3516
+ timestamp: number;
3517
+ details: {
3518
+ id: LogId;
3519
+ title: string;
3520
+ category: string;
3521
+ };
3522
+ data: Record<string, unknown>;
3523
+ params: Record<string, unknown>;
3524
+ };
3525
+
3526
+ /** @category Models */
3527
+ type UserLogId = string;
3528
+
3529
+ /** @category Models */
3530
+ type UserLogsResponse = {
3531
+ log: UserLog[];
3532
+ _metadata: RequestMetadataWithLinks;
3533
+ };
3534
+
3487
3535
  /** @category Models */
3488
3536
  type UserLookupResponse = {
3489
3537
  selections: UserSelectionName[];
@@ -3680,6 +3728,7 @@ declare class FactionEndpoint {
3680
3728
  * @param params - Optional query parameters
3681
3729
  */
3682
3730
  attacks(params?: {
3731
+ filters?: "incoming" | "outgoing";
3683
3732
  limit?: number;
3684
3733
  sort?: "DESC" | "ASC";
3685
3734
  to?: number;
@@ -3691,6 +3740,7 @@ declare class FactionEndpoint {
3691
3740
  * @param params - Optional query parameters
3692
3741
  */
3693
3742
  attacksfull(params?: {
3743
+ filters?: "incoming" | "outgoing";
3694
3744
  limit?: number;
3695
3745
  sort?: "DESC" | "ASC";
3696
3746
  to?: number;
@@ -3837,6 +3887,7 @@ declare class FactionEndpoint {
3837
3887
  * @param params - Optional query parameters
3838
3888
  */
3839
3889
  revives(params?: {
3890
+ filters?: "incoming" | "outgoing";
3840
3891
  limit?: number;
3841
3892
  sort?: "DESC" | "ASC";
3842
3893
  to?: number;
@@ -3849,6 +3900,7 @@ declare class FactionEndpoint {
3849
3900
  * @param params - Optional query parameters
3850
3901
  */
3851
3902
  revivesfull(params?: {
3903
+ filters?: "incoming" | "outgoing";
3852
3904
  limit?: number;
3853
3905
  sort?: "DESC" | "ASC";
3854
3906
  to?: number;
@@ -4776,6 +4828,7 @@ declare class UserEndpoint {
4776
4828
  * @param params - Optional query parameters
4777
4829
  */
4778
4830
  attacks(params?: {
4831
+ filters?: "incoming" | "outgoing";
4779
4832
  limit?: number;
4780
4833
  sort?: "DESC" | "ASC";
4781
4834
  to?: number;
@@ -4787,6 +4840,7 @@ declare class UserEndpoint {
4787
4840
  * @param params - Optional query parameters
4788
4841
  */
4789
4842
  attacksfull(params?: {
4843
+ filters?: "incoming" | "outgoing";
4790
4844
  limit?: number;
4791
4845
  sort?: "DESC" | "ASC";
4792
4846
  to?: number;
@@ -4905,6 +4959,18 @@ declare class UserEndpoint {
4905
4959
  sort?: "DESC" | "ASC";
4906
4960
  timestamp?: string;
4907
4961
  }): Promise<PaginatedResponse<UserListResponse> & UserListResponse>;
4962
+ /**
4963
+ * Get your logs
4964
+ * @param params - Optional query parameters
4965
+ */
4966
+ log(params?: {
4967
+ log?: LogId[];
4968
+ cat?: LogCategoryId;
4969
+ limit?: number;
4970
+ to?: number;
4971
+ from?: number;
4972
+ timestamp?: string;
4973
+ }): Promise<PaginatedResponse<UserLogsResponse> & UserLogsResponse>;
4908
4974
  /**
4909
4975
  * Get your current ongoing organized crime
4910
4976
  * @param params - Optional query parameters
@@ -4972,6 +5038,7 @@ declare class UserEndpoint {
4972
5038
  * @param params - Optional query parameters
4973
5039
  */
4974
5040
  revives(params?: {
5041
+ filters?: "incoming" | "outgoing";
4975
5042
  limit?: number;
4976
5043
  sort?: "DESC" | "ASC";
4977
5044
  to?: number;
@@ -4984,6 +5051,7 @@ declare class UserEndpoint {
4984
5051
  * @param params - Optional query parameters
4985
5052
  */
4986
5053
  revivesfull(params?: {
5054
+ filters?: "incoming" | "outgoing";
4987
5055
  limit?: number;
4988
5056
  sort?: "DESC" | "ASC";
4989
5057
  to?: number;
@@ -5256,4 +5324,4 @@ declare class TornRateLimitError extends Error {
5256
5324
  constructor(message: string);
5257
5325
  }
5258
5326
 
5259
- export { type AmmoId, type ApiKeyAccessTypeEnum, type ApiKeyBalancing, type Attack, type AttackActionEnum, type AttackCode, type AttackFinishingHitEffect, type AttackId, type AttackLog, type AttackLogResponse, type AttackLogSummary, type AttackPlayer, type AttackPlayerFaction, type AttackPlayerSimplified, type AttackSimplified, type AttackingFinishingHitEffects, type BasicProperty, type BasicUser, type Bazaar, type BazaarAdvancedItemSales, type BazaarBargainSales, type BazaarBulkSales, type BazaarDollarSales, type BazaarRecentFavorites, type BazaarResponse, type BazaarResponseSpecialized, type BazaarSpecialized, type BazaarTotalFavorites, type BazaarWeekly, type BazaarWeeklyCustomers, type BazaarWeeklyIncome, type Bounty, type ChainId, type CompanyId, type CountryEnum, type DirtyBombId, type EducationId, type Faction, type FactionApplication, type FactionApplicationStatusEnum, type FactionApplicationsResponse, type FactionAttackResult, type FactionAttacksFullResponse, type FactionAttacksResponse, type FactionBalance, type FactionBalanceResponse, type FactionBasic, type FactionBasicResponse, type FactionBranchDetails, type FactionBranchId, type FactionBranchStateEnum, type FactionChain, FactionChainIdContext, type FactionChainReport, type FactionChainReportAttacker, type FactionChainReportAttackerAttacks, type FactionChainReportAttackerRespect, type FactionChainReportBonus, type FactionChainReportDetails, type FactionChainReportResponse, type FactionChainWarfare, type FactionChainsResponse, type FactionContributor, type FactionContributorsResponse, type FactionCrime, type FactionCrimeId, FactionCrimeIdContext, type FactionCrimeResponse, type FactionCrimeReward, type FactionCrimeRewardItem, type FactionCrimeRewardPayout, type FactionCrimeSlot, type FactionCrimeStatusEnum, type FactionCrimeUser, type FactionCrimeUserOutcome, type FactionCrimesResponse, FactionEndpoint, type FactionHofResponse, type FactionHofStats, type FactionHofValues, type FactionId, FactionIdContext, type FactionLookupResponse, type FactionMember, type FactionMembersResponse, type FactionNews, type FactionNewsCategory, type FactionNewsResponse, type FactionOngoingChain, type FactionOngoingChainResponse, type FactionOrganizedCrimePayoutType, type FactionPact, type FactionPosition, type FactionPositionAbilityEnum, type FactionPositionsResponse, type FactionRacketsResponse, type FactionRaidReport, type FactionRaidReportAttacker, type FactionRaidReportFaction, type FactionRaidReportUser, type FactionRaidWar, FactionRaidWarIdContext, type FactionRaidWarParticipant, type FactionRaidWarReportResponse, type FactionRaidWarfare, type FactionRaidWarfareFaction, type FactionRaidsResponse, type FactionRank, type FactionRankEnum, type FactionRankedWar, type FactionRankedWarDetails, FactionRankedWarIdContext, type FactionRankedWarParticipant, type FactionRankedWarReportResponse, type FactionRankedWarResponse, type FactionRankedWarsCategoryEnum, type FactionResponse, type FactionSearch, type FactionSearchLeader, type FactionSearchResponse, type FactionSelectionName, type FactionStat, type FactionStatEnum, type FactionStatsResponse, type FactionTerritoriesOwnershipResponse, type FactionTerritoriesResponse, type FactionTerritory, type FactionTerritoryEnum, type FactionTerritoryOwnership, type FactionTerritoryWar, type FactionTerritoryWarFaction, type FactionTerritoryWarFactionWallPlayers, type FactionTerritoryWarFinished, type FactionTerritoryWarFinishedFaction, FactionTerritoryWarIdContext, type FactionTerritoryWarOngoing, type FactionTerritoryWarOngoingFaction, type FactionTerritoryWarParticipant, type FactionTerritoryWarReport, type FactionTerritoryWarReportFaction, type FactionTerritoryWarReportMembers, type FactionTerritoryWarReportResponse, type FactionTerritoryWarResultEnum, type FactionTerritoryWarfare, type FactionTerritoryWarsCategoryEnum, type FactionTerritoryWarsHistoryResponse, type FactionTerritoryWarsResponse, type FactionUpgradeDetails, type FactionUpgrades, type FactionUpgradesResponse, type FactionWarfareDirtyBomb, type FactionWarfareDirtyBombPlanter, type FactionWarfareDirtyBombTargetFaction, type FactionWarfareResponse, type FactionWarfareTypeEnum, type FactionWars, type FactionWarsResponse, type ForumCategoriesResponse, ForumCategoryIdsContext, ForumEndpoint, type ForumFeed, type ForumFeedTypeEnum, type ForumId, type ForumLookupResponse, type ForumPoll, type ForumPollVote, type ForumPost, type ForumPostId, type ForumPostsResponse, type ForumResponse, type ForumSelectionName, type ForumSubscribedThread, type ForumSubscribedThreadPostsCount, type ForumThreadAuthor, type ForumThreadBase, type ForumThreadExtended, type ForumThreadId, ForumThreadIdContext, type ForumThreadResponse, type ForumThreadUserExtended, type ForumThreadsResponse, type HofValue, type HofValueFloat, type HofValueString, type ItemId, type ItemMarket, type ItemMarketItem, type ItemMarketListingItemBonus, type ItemMarketListingItemDetails, type ItemMarketListingItemStats, type ItemMarketListingNonstackable, type ItemMarketListingStackable, type ItemModId, type ItemUid, type JobPositionArmyEnum, type JobPositionCasinoEnum, type JobPositionEducationEnum, type JobPositionGrocerEnum, type JobPositionLawEnum, type JobPositionMedicalEnum, KeyEndpoint, type KeyInfoResponse, type KeyLogResponse, type KeyResponse, type KeySelectionName, type LogCategoryId, type LogId, MarketEndpoint, MarketIdContext, type MarketItemMarketResponse, type MarketLookupResponse, type MarketPropertiesResponse, type MarketPropertyDetails, MarketPropertyTypeIdContext, type MarketRentalDetails, type MarketRentalsResponse, type MarketResponse, type MarketSelectionName, type MarketSpecializedBazaarCategoryEnum, type OrganizedCrimeName, PaginatedResponse, type Parameters, type PersonalStatsAttackingExtended, type PersonalStatsAttackingPopular, type PersonalStatsAttackingPublic, type PersonalStatsBattleStats, type PersonalStatsBounties, type PersonalStatsCategoryEnum, type PersonalStatsCommunication, type PersonalStatsCrimes, type PersonalStatsCrimesPopular, type PersonalStatsCrimesV1, type PersonalStatsCrimesV2, type PersonalStatsDrugs, type PersonalStatsFinishingHits, type PersonalStatsHistoricStat, type PersonalStatsHospital, type PersonalStatsHospitalPopular, type PersonalStatsInvestments, type PersonalStatsItems, type PersonalStatsItemsPopular, type PersonalStatsJail, type PersonalStatsJobsExtended, type PersonalStatsJobsPublic, type PersonalStatsMissions, type PersonalStatsNetworthExtended, type PersonalStatsNetworthPublic, type PersonalStatsOther, type PersonalStatsOtherPopular, type PersonalStatsRacing, type PersonalStatsStatName, type PersonalStatsTrading, type PersonalStatsTravel, type PersonalStatsTravelPopular, PropertyEndpoint, type PropertyId, PropertyIdContext, type PropertyLookupResponse, type PropertyModificationEnum, type PropertyPropertyResponse, type PropertyResponse, type PropertySelectionName, type PropertyStaffEnum, type PropertyTypeId, type Race, type RaceCar, type RaceCarId, type RaceCarUpgrade, type RaceCarUpgradeCategory, type RaceCarUpgradeId, type RaceCarUpgradeSubCategory, type RaceClassEnum, type RaceId, type RaceRecord, type RaceStatusEnum, type RaceTrack, type RaceTrackId, type RacerDetails, type RacingCarUpgradesResponse, type RacingCarsResponse, RacingEndpoint, type RacingLookupResponse, type RacingRaceDetails, type RacingRaceDetailsResponse, RacingRaceIdContext, type RacingRaceTypeEnum, type RacingRacesResponse, type RacingResponse, type RacingSelectionName, RacingTrackIdContext, type RacingTrackRecordsResponse, type RacingTracksResponse, type RaidWarId, type RankedWarId, type RateLimitMode, type Report, type ReportAnonymousBounties, type ReportBase, type ReportCompanyFinancials, type ReportFriendOrFoe, type ReportFriendOrFoeUser, type ReportHistory, type ReportHistoryCompany, type ReportHistoryFaction, type ReportInvestment, type ReportMoney, type ReportMostWanted, type ReportReport, type ReportStats, type ReportStockAnalysis, type ReportTrueLevel, type ReportTypeEnum, type ReportWarrantDetails, type ReportsResponse, type RequestLinks, type RequestMetadata, type RequestMetadataWithLinks, type RequestMetadataWithLinksAndTotal, type Requester, type Revive, type ReviveId, type ReviveSetting, type ReviveSimplified, type RevivesFullResponse, type RevivesResponse, type SelectionCategoryEnum, type TerritoryWarId, type TimestampResponse, TornAPI, type TornAPIOptions, TornApiError, type TornBountiesResponse, type TornCalendarActivity, type TornCalendarResponse, type TornCrime, type TornCrimeId, TornCrimeIdContext, type TornCrimesResponse, type TornEducation, type TornEducationCourses, type TornEducationPrerequisites, type TornEducationResponse, type TornEducationRewards, TornEndpoint, type TornFactionHof, type TornFactionHofCategory, type TornFactionHofResponse, type TornFactionTree, type TornFactionTreeBranch, type TornFactionTreeResponse, type TornHof, type TornHofBasic, type TornHofCategory, type TornHofResponse, type TornHofWithOffenses, TornIdsContext, type TornItem, type TornItemAmmo, type TornItemAmmoResponse, type TornItemAmmoTypeEnum, type TornItemArmorCoverage, type TornItemArmorCoveragePartEnum, type TornItemArmorDetails, type TornItemBaseStats, type TornItemCategory, type TornItemMods, type TornItemModsResponse, type TornItemTypeEnum, type TornItemWeaponCategoryEnum, type TornItemWeaponDetails, type TornItemWeaponTypeEnum, type TornItemsResponse, type TornLog, type TornLogCategoriesResponse, type TornLogCategory, TornLogCategoryIdContext, type TornLogTypesResponse, type TornLookupResponse, type TornOrganizedCrime, type TornOrganizedCrimePositionId, type TornOrganizedCrimeRequiredItem, type TornOrganizedCrimeResponse, type TornOrganizedCrimeScope, type TornOrganizedCrimeSlot, type TornOrganizedCrimeSpawn, type TornProperties, type TornRacket, type TornRacketReward, type TornRacketType, TornRateLimitError, type TornResponse, type TornSelectionName, type TornSubcrime, type TornSubcrimesResponse, type TornTerritoriesNoLinksResponse, type TornTerritoriesResponse, type TornTerritory, type TornTerritoryCoordinates, type User, type UserBountiesResponse, type UserCalendar, type UserCalendarResponse, type UserCrime, type UserCrimeAttempts, type UserCrimeDetailsBootlegging, type UserCrimeDetailsCardSkimming, type UserCrimeDetailsCracking, type UserCrimeDetailsGraffiti, type UserCrimeDetailsHustling, type UserCrimeDetailsScamming, type UserCrimeDetailsShoplifting, UserCrimeIdContext, type UserCrimeRewardAmmo, type UserCrimeRewardItem, type UserCrimeRewards, type UserCrimeUniques, type UserCrimeUniquesReward, type UserCrimeUniquesRewardAmmo, type UserCrimeUniquesRewardAmmoEnum, type UserCrimeUniquesRewardMoney, type UserCrimesResponse, type UserCurrentEducation, type UserEducation, type UserEducationResponse, UserEndpoint, type UserEnlistedCarsResponse, type UserFactionBalance, type UserFactionBalanceResponse, type UserForumFeedResponse, type UserForumFriendsResponse, type UserForumPostsResponse, type UserForumSubscribedThreadsResponse, type UserForumThreadsResponse, type UserHofResponse, type UserHofStats, type UserId, UserIdContext, type UserItemMarkeListingItemDetails, type UserItemMarketListing, type UserItemMarketResponse, type UserJobRanks, type UserJobRanksResponse, type UserLastAction, type UserList, type UserListEnum, type UserListResponse, type UserLookupResponse, type UserOrganizedCrimeResponse, type UserPersonalStatsCategory, type UserPersonalStatsFull, type UserPersonalStatsFullPublic, type UserPersonalStatsHistoric, type UserPersonalStatsPopular, type UserPersonalStatsResponse, type UserPropertiesResponse, type UserPropertyBasicDetails, type UserPropertyDetails, type UserPropertyDetailsExtended, type UserPropertyDetailsExtendedForRent, type UserPropertyDetailsExtendedForSale, type UserPropertyDetailsExtendedRented, type UserPropertyDetailsExtendedWithRent, type UserPropertyResponse, type UserRaceCarDetails, type UserRacesResponse, type UserRacingRecordsResponse, type UserResponse, type UserSelectionName, type UserStatus, type UserSubcrime, type WeaponBonusEnum };
5327
+ export { type AmmoId, type ApiKeyAccessTypeEnum, type ApiKeyBalancing, type Attack, type AttackActionEnum, type AttackCode, type AttackFinishingHitEffect, type AttackId, type AttackLog, type AttackLogResponse, type AttackLogSummary, type AttackPlayer, type AttackPlayerFaction, type AttackPlayerSimplified, type AttackSimplified, type AttackingFinishingHitEffects, type BasicProperty, type BasicUser, type Bazaar, type BazaarAdvancedItemSales, type BazaarBargainSales, type BazaarBulkSales, type BazaarDollarSales, type BazaarRecentFavorites, type BazaarResponse, type BazaarResponseSpecialized, type BazaarSpecialized, type BazaarTotalFavorites, type BazaarWeekly, type BazaarWeeklyCustomers, type BazaarWeeklyIncome, type Bounty, type ChainId, type CompanyId, type CountryEnum, type DirtyBombId, type EducationId, type Faction, type FactionApplication, type FactionApplicationStatusEnum, type FactionApplicationsResponse, type FactionAttackResult, type FactionAttacksFullResponse, type FactionAttacksResponse, type FactionBalance, type FactionBalanceResponse, type FactionBasic, type FactionBasicResponse, type FactionBranchDetails, type FactionBranchId, type FactionBranchStateEnum, type FactionChain, FactionChainIdContext, type FactionChainReport, type FactionChainReportAttacker, type FactionChainReportAttackerAttacks, type FactionChainReportAttackerRespect, type FactionChainReportBonus, type FactionChainReportDetails, type FactionChainReportResponse, type FactionChainWarfare, type FactionChainsResponse, type FactionContributor, type FactionContributorsResponse, type FactionCrime, type FactionCrimeId, FactionCrimeIdContext, type FactionCrimeItemOutcomeEnum, type FactionCrimeResponse, type FactionCrimeReward, type FactionCrimeRewardItem, type FactionCrimeRewardPayout, type FactionCrimeSlot, type FactionCrimeStatusEnum, type FactionCrimeUser, type FactionCrimeUserItemOutcome, type FactionCrimeUserItemOutcomeEnum, type FactionCrimeUserOutcome, type FactionCrimesResponse, FactionEndpoint, type FactionHofResponse, type FactionHofStats, type FactionHofValues, type FactionId, FactionIdContext, type FactionLookupResponse, type FactionMember, type FactionMembersResponse, type FactionNews, type FactionNewsCategory, type FactionNewsResponse, type FactionOngoingChain, type FactionOngoingChainResponse, type FactionOrganizedCrimePayoutType, type FactionPact, type FactionPosition, type FactionPositionAbilityEnum, type FactionPositionsResponse, type FactionRacketsResponse, type FactionRaidReport, type FactionRaidReportAttacker, type FactionRaidReportFaction, type FactionRaidReportUser, type FactionRaidWar, FactionRaidWarIdContext, type FactionRaidWarParticipant, type FactionRaidWarReportResponse, type FactionRaidWarfare, type FactionRaidWarfareFaction, type FactionRaidsResponse, type FactionRank, type FactionRankEnum, type FactionRankedWar, type FactionRankedWarDetails, FactionRankedWarIdContext, type FactionRankedWarParticipant, type FactionRankedWarReportResponse, type FactionRankedWarResponse, type FactionRankedWarsCategoryEnum, type FactionResponse, type FactionSearch, type FactionSearchLeader, type FactionSearchResponse, type FactionSelectionName, type FactionStat, type FactionStatEnum, type FactionStatsResponse, type FactionTerritoriesOwnershipResponse, type FactionTerritoriesResponse, type FactionTerritory, type FactionTerritoryEnum, type FactionTerritoryOwnership, type FactionTerritoryWar, type FactionTerritoryWarFaction, type FactionTerritoryWarFactionWallPlayers, type FactionTerritoryWarFinished, type FactionTerritoryWarFinishedFaction, FactionTerritoryWarIdContext, type FactionTerritoryWarOngoing, type FactionTerritoryWarOngoingFaction, type FactionTerritoryWarParticipant, type FactionTerritoryWarReport, type FactionTerritoryWarReportFaction, type FactionTerritoryWarReportMembers, type FactionTerritoryWarReportResponse, type FactionTerritoryWarResultEnum, type FactionTerritoryWarfare, type FactionTerritoryWarsCategoryEnum, type FactionTerritoryWarsHistoryResponse, type FactionTerritoryWarsResponse, type FactionUpgradeDetails, type FactionUpgrades, type FactionUpgradesResponse, type FactionWarfareDirtyBomb, type FactionWarfareDirtyBombPlanter, type FactionWarfareDirtyBombTargetFaction, type FactionWarfareResponse, type FactionWarfareTypeEnum, type FactionWars, type FactionWarsResponse, type ForumCategoriesResponse, ForumCategoryIdsContext, ForumEndpoint, type ForumFeed, type ForumFeedTypeEnum, type ForumId, type ForumLookupResponse, type ForumPoll, type ForumPollVote, type ForumPost, type ForumPostId, type ForumPostsResponse, type ForumResponse, type ForumSelectionName, type ForumSubscribedThread, type ForumSubscribedThreadPostsCount, type ForumThreadAuthor, type ForumThreadBase, type ForumThreadExtended, type ForumThreadId, ForumThreadIdContext, type ForumThreadResponse, type ForumThreadUserExtended, type ForumThreadsResponse, type HofValue, type HofValueFloat, type HofValueString, type ItemId, type ItemMarket, type ItemMarketItem, type ItemMarketListingItemBonus, type ItemMarketListingItemDetails, type ItemMarketListingItemStats, type ItemMarketListingNonstackable, type ItemMarketListingStackable, type ItemModId, type ItemUid, type JobPositionArmyEnum, type JobPositionCasinoEnum, type JobPositionEducationEnum, type JobPositionGrocerEnum, type JobPositionLawEnum, type JobPositionMedicalEnum, KeyEndpoint, type KeyInfoAvailableLog, type KeyInfoResponse, type KeyLogResponse, type KeyResponse, type KeySelectionName, type LogCategoryId, type LogId, MarketEndpoint, MarketIdContext, type MarketItemMarketResponse, type MarketLookupResponse, type MarketPropertiesResponse, type MarketPropertyDetails, MarketPropertyTypeIdContext, type MarketRentalDetails, type MarketRentalsResponse, type MarketResponse, type MarketSelectionName, type MarketSpecializedBazaarCategoryEnum, type OrganizedCrimeName, PaginatedResponse, type Parameters, type PersonalStatsAttackingExtended, type PersonalStatsAttackingPopular, type PersonalStatsAttackingPublic, type PersonalStatsBattleStats, type PersonalStatsBounties, type PersonalStatsCategoryEnum, type PersonalStatsCommunication, type PersonalStatsCrimes, type PersonalStatsCrimesPopular, type PersonalStatsCrimesV1, type PersonalStatsCrimesV2, type PersonalStatsDrugs, type PersonalStatsFinishingHits, type PersonalStatsHistoricStat, type PersonalStatsHospital, type PersonalStatsHospitalPopular, type PersonalStatsInvestments, type PersonalStatsItems, type PersonalStatsItemsPopular, type PersonalStatsJail, type PersonalStatsJobsExtended, type PersonalStatsJobsPublic, type PersonalStatsMissions, type PersonalStatsNetworthExtended, type PersonalStatsNetworthPublic, type PersonalStatsOther, type PersonalStatsOtherPopular, type PersonalStatsRacing, type PersonalStatsStatName, type PersonalStatsTrading, type PersonalStatsTravel, type PersonalStatsTravelPopular, PropertyEndpoint, type PropertyId, PropertyIdContext, type PropertyLookupResponse, type PropertyModificationEnum, type PropertyPropertyResponse, type PropertyResponse, type PropertySelectionName, type PropertyStaffEnum, type PropertyTypeId, type Race, type RaceCar, type RaceCarId, type RaceCarUpgrade, type RaceCarUpgradeCategory, type RaceCarUpgradeId, type RaceCarUpgradeSubCategory, type RaceClassEnum, type RaceId, type RaceRecord, type RaceStatusEnum, type RaceTrack, type RaceTrackId, type RacerDetails, type RacingCarUpgradesResponse, type RacingCarsResponse, RacingEndpoint, type RacingLookupResponse, type RacingRaceDetails, type RacingRaceDetailsResponse, RacingRaceIdContext, type RacingRaceTypeEnum, type RacingRacesResponse, type RacingResponse, type RacingSelectionName, RacingTrackIdContext, type RacingTrackRecordsResponse, type RacingTracksResponse, type RaidWarId, type RankedWarId, type RateLimitMode, type Report, type ReportAnonymousBounties, type ReportBase, type ReportCompanyFinancials, type ReportFriendOrFoe, type ReportFriendOrFoeUser, type ReportHistory, type ReportHistoryCompany, type ReportHistoryFaction, type ReportInvestment, type ReportMoney, type ReportMostWanted, type ReportReport, type ReportStats, type ReportStockAnalysis, type ReportTrueLevel, type ReportTypeEnum, type ReportWarrantDetails, type ReportsResponse, type RequestLinks, type RequestMetadata, type RequestMetadataWithLinks, type RequestMetadataWithLinksAndTotal, type Requester, type Revive, type ReviveId, type ReviveSetting, type ReviveSimplified, type RevivesFullResponse, type RevivesResponse, type SelectionCategoryEnum, type TerritoryWarId, type TimestampResponse, TornAPI, type TornAPIOptions, TornApiError, type TornBountiesResponse, type TornCalendarActivity, type TornCalendarResponse, type TornCrime, type TornCrimeId, TornCrimeIdContext, type TornCrimesResponse, type TornEducation, type TornEducationCourses, type TornEducationPrerequisites, type TornEducationResponse, type TornEducationRewards, TornEndpoint, type TornFactionHof, type TornFactionHofCategory, type TornFactionHofResponse, type TornFactionTree, type TornFactionTreeBranch, type TornFactionTreeResponse, type TornHof, type TornHofBasic, type TornHofCategory, type TornHofResponse, type TornHofWithOffenses, TornIdsContext, type TornItem, type TornItemAmmo, type TornItemAmmoResponse, type TornItemAmmoTypeEnum, type TornItemArmorCoverage, type TornItemArmorCoveragePartEnum, type TornItemArmorDetails, type TornItemBaseStats, type TornItemCategory, type TornItemMods, type TornItemModsResponse, type TornItemTypeEnum, type TornItemWeaponCategoryEnum, type TornItemWeaponDetails, type TornItemWeaponTypeEnum, type TornItemsResponse, type TornLog, type TornLogCategoriesResponse, type TornLogCategory, TornLogCategoryIdContext, type TornLogTypesResponse, type TornLookupResponse, type TornOrganizedCrime, type TornOrganizedCrimePositionId, type TornOrganizedCrimeRequiredItem, type TornOrganizedCrimeResponse, type TornOrganizedCrimeScope, type TornOrganizedCrimeSlot, type TornOrganizedCrimeSpawn, type TornProperties, type TornRacket, type TornRacketReward, type TornRacketType, TornRateLimitError, type TornResponse, type TornSelectionName, type TornSubcrime, type TornSubcrimesResponse, type TornTerritoriesNoLinksResponse, type TornTerritoriesResponse, type TornTerritory, type TornTerritoryCoordinates, type User, type UserBountiesResponse, type UserCalendar, type UserCalendarResponse, type UserCrime, type UserCrimeAttempts, type UserCrimeDetailsBootlegging, type UserCrimeDetailsCardSkimming, type UserCrimeDetailsCracking, type UserCrimeDetailsGraffiti, type UserCrimeDetailsHustling, type UserCrimeDetailsScamming, type UserCrimeDetailsShoplifting, UserCrimeIdContext, type UserCrimeRewardAmmo, type UserCrimeRewardItem, type UserCrimeRewards, type UserCrimeUniques, type UserCrimeUniquesReward, type UserCrimeUniquesRewardAmmo, type UserCrimeUniquesRewardAmmoEnum, type UserCrimeUniquesRewardMoney, type UserCrimesResponse, type UserCurrentEducation, type UserEducation, type UserEducationResponse, UserEndpoint, type UserEnlistedCarsResponse, type UserFactionBalance, type UserFactionBalanceResponse, type UserForumFeedResponse, type UserForumFriendsResponse, type UserForumPostsResponse, type UserForumSubscribedThreadsResponse, type UserForumThreadsResponse, type UserHofResponse, type UserHofStats, type UserId, UserIdContext, type UserItemMarkeListingItemDetails, type UserItemMarketListing, type UserItemMarketResponse, type UserJobRanks, type UserJobRanksResponse, type UserLastAction, type UserList, type UserListEnum, type UserListResponse, type UserLog, type UserLogId, type UserLogsResponse, type UserLookupResponse, type UserOrganizedCrimeResponse, type UserPersonalStatsCategory, type UserPersonalStatsFull, type UserPersonalStatsFullPublic, type UserPersonalStatsHistoric, type UserPersonalStatsPopular, type UserPersonalStatsResponse, type UserPropertiesResponse, type UserPropertyBasicDetails, type UserPropertyDetails, type UserPropertyDetailsExtended, type UserPropertyDetailsExtendedForRent, type UserPropertyDetailsExtendedForSale, type UserPropertyDetailsExtendedRented, type UserPropertyDetailsExtendedWithRent, type UserPropertyResponse, type UserRaceCarDetails, type UserRacesResponse, type UserRacingRecordsResponse, type UserResponse, type UserSelectionName, type UserStatus, type UserSubcrime, type WeaponBonusEnum };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- 'use strict';var a=class{requester;constructor(e){this.requester=e;}async applications(e){let t="/faction/applications",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async attacks(e){let t="/faction/attacks",s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async attacksfull(e){let t="/faction/attacksfull",s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async balance(e){let t="/faction/balance",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async basic(e){let t="/faction/basic",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async chain(e){let t="/faction/chain",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async chains(e){let t="/faction/chains",s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async chainreport(e){let t="/faction/chainreport",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async contributors(e){let t="/faction/contributors",s={...e?.stat!==void 0&&{stat:e.stat},...e?.cat!==void 0&&{cat:e.cat},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async crimes(e){let t="/faction/crimes",s={...e?.cat!==void 0&&{cat:e.cat},...e?.filters!==void 0&&{filters:e.filters},...e?.offset!==void 0&&{offset:e.offset},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.sort!==void 0&&{sort:e.sort},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async hof(e){let t="/faction/hof",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async members(e){let t="/faction/members",s={...e?.striptags!==void 0&&{striptags:e.striptags},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async news(e){let t="/faction/news",s={...e?.striptags!==void 0&&{striptags:e.striptags},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.cat!==void 0&&{cat:e.cat},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async positions(e){let t="/faction/positions",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async rackets(e){let t="/faction/rackets",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async raids(e){let t="/faction/raids",s={...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.sort!==void 0&&{sort:e.sort},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async rankedwars(e){let t="/faction/rankedwars",s={...e?.cat!==void 0&&{cat:e.cat},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.sort!==void 0&&{sort:e.sort},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async reports(e){let t="/faction/reports",s={...e?.cat!==void 0&&{cat:e.cat},...e?.target!==void 0&&{target:e.target},...e?.limit!==void 0&&{limit:e.limit},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async revives(e){let t="/faction/revives",s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.striptags!==void 0&&{striptags:e.striptags},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async revivesfull(e){let t="/faction/revivesFull",s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.striptags!==void 0&&{striptags:e.striptags},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async search(e){let t="/faction/search",s={...e?.name!==void 0&&{name:e.name},...e?.filters&&{filters:e.filters.join(",")},...e?.limit!==void 0&&{limit:e.limit},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async stats(e){let t="/faction/stats",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async territory(e){let t="/faction/territory",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async territoryownership(e){let t="/faction/territoryownership",s={...e?.offset!==void 0&&{offset:e.offset},...e?.limit!==void 0&&{limit:e.limit},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async territorywars(e){let t="/faction/territorywars",s={...e?.cat!==void 0&&{cat:e.cat},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.sort!==void 0&&{sort:e.sort},...e?.limit!==void 0&&{limit:e.limit},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async upgrades(e){let t="/faction/upgrades",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async warfare(e){let t="/faction/warfare",s={...e?.cat!==void 0&&{cat:e.cat},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async wars(e){let t="/faction/wars",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async lookup(e){let t="/faction/lookup",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async timestamp(e){let t="/faction/timestamp",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async get(e){let t="/faction",s={...e?.selections&&{selections:e.selections.join(",")},...e?.id!==void 0&&{id:e.id},...e?.limit!==void 0&&{limit:e.limit},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.cat!==void 0&&{cat:e.cat},...e?.stat!==void 0&&{stat:e.stat},...e?.filters!==void 0&&{filters:e.filters},...e?.striptags!==void 0&&{striptags:e.striptags},...e?.sort!==void 0&&{sort:e.sort},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}withId(e){return new F(this.requester,e)}withChainId(e){return new T(this.requester,e)}withCrimeId(e){return new k(this.requester,e)}withRaidWarId(e){return new I(this.requester,e)}withRankedWarId(e){return new C(this.requester,e)}withTerritoryWarId(e){return new x(this.requester,e)}},F=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async basic(e){let t=`/faction/${this.contextId}/basic`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async chain(e){let t=`/faction/${this.contextId}/chain`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async chains(e){let t=`/faction/${this.contextId}/chains`,s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async hof(e){let t=`/faction/${this.contextId}/hof`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async members(e){let t=`/faction/${this.contextId}/members`,s={...e?.striptags!==void 0&&{striptags:e.striptags},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async raids(e){let t=`/faction/${this.contextId}/raids`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async rankedwars(e){let t=`/faction/${this.contextId}/rankedwars`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async territory(e){let t=`/faction/${this.contextId}/territory`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async territorywars(e){let t=`/faction/${this.contextId}/territorywars`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async wars(e){let t=`/faction/${this.contextId}/wars`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async get(){let e=`/faction/${this.contextId}`,t={};return this.requester(e,t)}},T=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async chainreport(e){let t=`/faction/${this.contextId}/chainreport`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}},k=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async crime(e){let t=`/faction/${this.contextId}/crime`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}},I=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async raidreport(e){let t=`/faction/${this.contextId}/raidreport`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}},C=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async rankedwarreport(e){let t=`/faction/${this.contextId}/rankedwarreport`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}},x=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async territorywarreport(e){let t=`/faction/${this.contextId}/territorywarreport`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}};var f=class{requester;constructor(e){this.requester=e;}async categories(e){let t="/forum/categories",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async threads(e){let t="/forum/threads",s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async lookup(e){let t="/forum/lookup",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async timestamp(e){let t="/forum/timestamp",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async get(e){let t="/forum",s={...e?.selections&&{selections:e.selections.join(",")},...e?.id!==void 0&&{id:e.id},...e?.striptags!==void 0&&{striptags:e.striptags},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}withThreadId(e){return new v(this.requester,e)}withCategoryIds(e){return new S(this.requester,e)}},v=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async posts(e){let t=`/forum/${this.contextId}/posts`,s={...e?.offset!==void 0&&{offset:e.offset},...e?.striptags!==void 0&&{striptags:e.striptags},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async thread(e){let t=`/forum/${this.contextId}/thread`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}},S=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async threads(e){let t=`/forum/${this.contextId}/threads`,s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}};var l=class{requester;constructor(e){this.requester=e;}async log(e){let t="/key/log",s={...e?.limit!==void 0&&{limit:e.limit},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async info(e){let t="/key/info",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async get(e){let t="/key",s={...e?.selections&&{selections:e.selections.join(",")},...e?.limit!==void 0&&{limit:e.limit},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}};var h=class{requester;constructor(e){this.requester=e;}async bazaar(e){let t="/market/bazaar",s={...e?.cat!==void 0&&{cat:e.cat},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async lookup(e){let t="/market/lookup",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async timestamp(e){let t="/market/timestamp",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async get(e){let t="/market",s={...e?.selections&&{selections:e.selections.join(",")},...e?.id!==void 0&&{id:e.id},...e?.cat!==void 0&&{cat:e.cat},...e?.bonus!==void 0&&{bonus:e.bonus},...e?.sort!==void 0&&{sort:e.sort},...e?.offset!==void 0&&{offset:e.offset},...e?.limit!==void 0&&{limit:e.limit},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}withId(e){return new w(this.requester,e)}withPropertyTypeId(e){return new E(this.requester,e)}},w=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async bazaar(e){let t=`/market/${this.contextId}/bazaar`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async itemmarket(e){let t=`/market/${this.contextId}/itemmarket`,s={...e?.bonus!==void 0&&{bonus:e.bonus},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}},E=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async properties(e){let t=`/market/${this.contextId}/properties`,s={...e?.offset!==void 0&&{offset:e.offset},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async rentals(e){let t=`/market/${this.contextId}/rentals`,s={...e?.offset!==void 0&&{offset:e.offset},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}};var y=class{requester;constructor(e){this.requester=e;}withId(e){return new U(this.requester,e)}async lookup(e){let t="/property/lookup",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async timestamp(e){let t="/property/timestamp",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async get(e){let t="/property",s={...e?.selections&&{selections:e.selections.join(",")},...e?.id!==void 0&&{id:e.id},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}},U=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async get(e){let t=`/property/${this.contextId}/property`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}};var R=class{requester;constructor(e){this.requester=e;}async cars(e){let t="/racing/cars",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async carupgrades(e){let t="/racing/carupgrades",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async races(e){let t="/racing/races",s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.cat!==void 0&&{cat:e.cat},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async tracks(e){let t="/racing/tracks",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async lookup(e){let t="/racing/lookup",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async timestamp(e){let t="/racing/timestamp",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async get(e){let t="/racing",s={...e?.selections&&{selections:e.selections.join(",")},...e?.id!==void 0&&{id:e.id},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.cat!==void 0&&{cat:e.cat},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}withRaceId(e){return new A(this.requester,e)}withTrackId(e){return new M(this.requester,e)}},A=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async race(e){let t=`/racing/${this.contextId}/race`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}},M=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async records(e){let t=`/racing/${this.contextId}/records`,s={...e?.cat!==void 0&&{cat:e.cat},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}};var g=class{requester;constructor(e){this.requester=e;}async attacklog(e){let t="/torn/attacklog",s={...e?.log!==void 0&&{log:e.log},...e?.offset!==void 0&&{offset:e.offset},...e?.sort!==void 0&&{sort:e.sort},...e?.striptags!==void 0&&{striptags:e.striptags},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async bounties(e){let t="/torn/bounties",s={...e?.limit!==void 0&&{limit:e.limit},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async calendar(e){let t="/torn/calendar",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async crimes(e){let t="/torn/crimes",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async education(e){let t="/torn/education",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async factionhof(e){let t="/torn/factionhof",s={...e?.limit!==void 0&&{limit:e.limit},...e?.offset!==void 0&&{offset:e.offset},...e?.cat!==void 0&&{cat:e.cat},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async factiontree(e){let t="/torn/factiontree",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async hof(e){let t="/torn/hof",s={...e?.limit!==void 0&&{limit:e.limit},...e?.offset!==void 0&&{offset:e.offset},...e?.cat!==void 0&&{cat:e.cat},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async itemammo(e){let t="/torn/itemammo",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async itemmods(e){let t="/torn/itemmods",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async items(e){let t="/torn/items",s={...e?.cat!==void 0&&{cat:e.cat},...e?.sort!==void 0&&{sort:e.sort},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async logcategories(e){let t="/torn/logcategories",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async logtypes(e){let t="/torn/logtypes",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async organizedcrimes(e){let t="/torn/organizedcrimes",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async properties(e){let t="/torn/properties",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async territory(e){let t="/torn/territory",s={...e?.ids&&{ids:e.ids.join(",")},...e?.offset!==void 0&&{offset:e.offset},...e?.limit!==void 0&&{limit:e.limit},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async lookup(e){let t="/torn/lookup",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async timestamp(e){let t="/torn/timestamp",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async get(e){let t="/torn",s={...e?.selections&&{selections:e.selections.join(",")},...e?.id!==void 0&&{id:e.id},...e?.striptags!==void 0&&{striptags:e.striptags},...e?.limit!==void 0&&{limit:e.limit},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.sort!==void 0&&{sort:e.sort},...e?.cat!==void 0&&{cat:e.cat},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}withIds(e){return new L(this.requester,e)}withLogCategoryId(e){return new K(this.requester,e)}withCrimeId(e){return new D(this.requester,e)}},L=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async items(e){let t=`/torn/${this.contextId}/items`,s={...e?.sort!==void 0&&{sort:e.sort},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}},K=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async logtypes(e){let t=`/torn/${this.contextId}/logtypes`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}},D=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async subcrimes(e){let t=`/torn/${this.contextId}/subcrimes`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}};var b=class{requester;constructor(e){this.requester=e;}async attacks(e){let t="/user/attacks",s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async attacksfull(e){let t="/user/attacksfull",s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async bounties(e){let t="/user/bounties",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async calendar(e){let t="/user/calendar",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async education(e){let t="/user/education",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async enlistedcars(e){let t="/user/enlistedcars",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async factionbalance(e){let t="/user/factionbalance",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async forumfeed(e){let t="/user/forumfeed",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async forumfriends(e){let t="/user/forumfriends",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async forumposts(e){let t="/user/forumposts",s={...e?.striptags!==void 0&&{striptags:e.striptags},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async forumsubscribedthreads(e){let t="/user/forumsubscribedthreads",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async forumthreads(e){let t="/user/forumthreads",s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async hof(e){let t="/user/hof",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async itemmarket(e){let t="/user/itemmarket",s={...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async jobranks(e){let t="/user/jobranks",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async list(e){let t="/user/list",s={...e?.cat!==void 0&&{cat:e.cat},...e?.limit!==void 0&&{limit:e.limit},...e?.offset!==void 0&&{offset:e.offset},...e?.sort!==void 0&&{sort:e.sort},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async organizedcrime(e){let t="/user/organizedcrime",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async personalstats(e){let t="/user/personalstats",s={...e?.cat!==void 0&&{cat:e.cat},...e?.stat&&{stat:e.stat.join(",")},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async properties(e){let t="/user/properties",s={...e?.offset!==void 0&&{offset:e.offset},...e?.limit!==void 0&&{limit:e.limit},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async property(e){let t="/user/property",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async races(e){let t="/user/races",s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.cat!==void 0&&{cat:e.cat},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async racingrecords(e){let t="/user/racingrecords",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async reports(e){let t="/user/reports",s={...e?.cat!==void 0&&{cat:e.cat},...e?.target!==void 0&&{target:e.target},...e?.limit!==void 0&&{limit:e.limit},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async revives(e){let t="/user/revives",s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.striptags!==void 0&&{striptags:e.striptags},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async revivesfull(e){let t="/user/revivesFull",s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.striptags!==void 0&&{striptags:e.striptags},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async lookup(e){let t="/user/lookup",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async timestamp(e){let t="/user/timestamp",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async get(e){let t="/user",s={...e?.selections&&{selections:e.selections.join(",")},...e?.id!==void 0&&{id:e.id},...e?.limit!==void 0&&{limit:e.limit},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.sort!==void 0&&{sort:e.sort},...e?.cat!==void 0&&{cat:e.cat},...e?.stat&&{stat:e.stat.join(",")},...e?.striptags!==void 0&&{striptags:e.striptags},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}withId(e){return new W(this.requester,e)}withCrimeId(e){return new $(this.requester,e)}},W=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async bounties(e){let t=`/user/${this.contextId}/bounties`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async forumposts(e){let t=`/user/${this.contextId}/forumposts`,s={...e?.striptags!==void 0&&{striptags:e.striptags},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async forumthreads(e){let t=`/user/${this.contextId}/forumthreads`,s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async hof(e){let t=`/user/${this.contextId}/hof`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async personalstats(e){let t=`/user/${this.contextId}/personalstats`,s={...e?.cat!==void 0&&{cat:e.cat},...e?.stat&&{stat:e.stat.join(",")},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async properties(e){let t=`/user/${this.contextId}/properties`,s={...e?.offset!==void 0&&{offset:e.offset},...e?.limit!==void 0&&{limit:e.limit},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async property(e){let t=`/user/${this.contextId}/property`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async get(){let e=`/user/${this.contextId}`,t={};return this.requester(e,t)}},$=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async crimes(e){let t=`/user/${this.contextId}/crimes`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}};var c=class extends Error{code;constructor(e){super(e.error),this.name="TornApiError",this.code=e.code;}},d=class extends Error{constructor(e){super(e),this.name="TornRateLimitError";}};var q=class{nextUrl;prevUrl;requester;constructor(e,t,s,r){Object.assign(this,e),this.nextUrl=t,this.prevUrl=s,this.requester=r;}async fetchPage(e){if(!e)return null;let t=new URL(e),s=t.pathname.substring(3),r={};for(let[u,n]of t.searchParams.entries())r[u]=n;return this.requester(s,r)}next(){return this.fetchPage(this.nextUrl)}prev(){return this.fetchPage(this.prevUrl)}};var z=i=>i instanceof Error,N=i=>typeof i=="object"&&i!==null&&"error"in i&&typeof i.error=="object"&&i.error!==null&&"code"in i.error&&"error"in i.error,j=i=>typeof i=="object"&&i!==null&&"_metadata"in i&&typeof i._metadata=="object"&&i._metadata!==null&&"links"in i._metadata,P=class{apiKeys;rateLimitMode;comment;headers;apiUrl;apiKeyBalancing;verbose;apiKeyIndex=0;requestTimestamps=new Map;constructor(e){if(!e.apiKeys||e.apiKeys.length===0)throw new Error("At least one API key must be provided.");this.apiKeys=e.apiKeys,this.rateLimitMode=e.rateLimitMode??"autoDelay",this.comment=e.comment,this.headers=e.headers??{},this.apiUrl=e.apiUrl??"https://api.torn.com/v2",this.apiKeyBalancing=e.apiKeyBalancing??"roundRobin",this.verbose=!!e.verbose;for(let t of this.apiKeys)this.requestTimestamps.set(t,[]);}log(...e){this.verbose&&console.log("[TornClient]",...e);}requester=this.makeRequest.bind(this);isKeyAvailable(e){if(this.rateLimitMode==="ignore")return true;let s=Date.now()-6e4,r=(this.requestTimestamps.get(e)??[]).filter(u=>u>s);return this.requestTimestamps.set(e,r),r.length<100}findAvailableKey(){for(let e=0;e<this.apiKeys.length;e++){let t=this.getApiKey();if(this.isKeyAvailable(t))return t}return null}getMinWaitTime(){let e=Date.now(),t=60100;for(let s of this.apiKeys){let r=this.requestTimestamps.get(s)??[];if(r.length>=100){let u=r[0],n=6e4-(e-u)+100;n<t&&(t=n);}}return Math.max(0,t)}getApiKey(){if(this.apiKeys.length===1)return this.apiKeys[0];if(this.apiKeyBalancing==="random"){let t=Math.floor(Math.random()*this.apiKeys.length);return this.apiKeys[t]}let e=this.apiKeys[this.apiKeyIndex];return this.apiKeyIndex=(this.apiKeyIndex+1)%this.apiKeys.length,e}async makeRequest(e,t){this.log("Request received:",e,t);let s=this.findAvailableKey();if(!s){if(this.rateLimitMode==="autoDelay"){let n=this.getMinWaitTime();this.log(`All keys are on cooldown. Delaying for ${n}ms...`),await new Promise(o=>setTimeout(o,n)),s=this.findAvailableKey();}if(!s){let n=new d("Rate limit of 100 requests/minute exceeded for all available keys");throw this.log("Rate limit exceeded for all keys"),n}}this.log(`Using API key: ${s.slice(0,5)}...`);let r=new URL(`${this.apiUrl}${e}`);for(let[n,o]of Object.entries(t))o!=null&&n!=="key"&&n!=="comment"&&r.searchParams.set(n,String(o));this.comment&&r.searchParams.set("comment",this.comment);let u={headers:{Accept:"application/json",Authorization:`ApiKey ${s}`,...this.headers}};try{this.log("Fetching:",r.toString());let n=await fetch(r.toString(),u);if(this.rateLimitMode!=="ignore"){let p=this.requestTimestamps.get(s)??[];p.push(Date.now()),this.requestTimestamps.set(s,p);}if(!n.ok)throw new Error(`Request failed with status ${n.status}: ${n.statusText}`);let o=await n.json();if(N(o))throw new c(o.error);let m;return j(o)?m=new q(o,o._metadata.links.next,o._metadata.links.prev,this.requester):m=o,this.log("Response data:",m),m}catch(n){let o=z(n)?n:new Error("An unknown error occurred");throw this.log("Request failed:",o.message),o}}getRateLimitInfo(){let e=Date.now(),t=e-6e4,s={};for(let r of this.apiKeys){let u=(this.requestTimestamps.get(r)??[]).filter(H=>H>t),n=u.length,o=Math.max(0,100-n),m=u[0]??null,p=m?Math.max(0,6e4-(e-m)):0;s[r.slice(0,5)]={used:n,remaining:o,resetInMs:p};}return s}};var B=class{user;faction;market;property;racing;forum;key;torn;rateLimitMode;requestHandler;constructor(e){if(!e.apiKeys||e.apiKeys.length===0)throw new Error("At least one API key is required to initialize the client.");this.rateLimitMode=e.rateLimitMode??"autoDelay",this.requestHandler=new P(e);let t=this.requestHandler.requester;this.user=new b(t),this.faction=new a(t),this.market=new h(t),this.property=new y(t),this.racing=new R(t),this.forum=new f(t),this.torn=new g(t),this.key=new l(t);}getRateLimitInfo(){return this.requestHandler.getRateLimitInfo()}};
2
- exports.FactionChainIdContext=T;exports.FactionCrimeIdContext=k;exports.FactionEndpoint=a;exports.FactionIdContext=F;exports.FactionRaidWarIdContext=I;exports.FactionRankedWarIdContext=C;exports.FactionTerritoryWarIdContext=x;exports.ForumCategoryIdsContext=S;exports.ForumEndpoint=f;exports.ForumThreadIdContext=v;exports.KeyEndpoint=l;exports.MarketEndpoint=h;exports.MarketIdContext=w;exports.MarketPropertyTypeIdContext=E;exports.PaginatedResponse=q;exports.PropertyEndpoint=y;exports.PropertyIdContext=U;exports.RacingEndpoint=R;exports.RacingRaceIdContext=A;exports.RacingTrackIdContext=M;exports.TornAPI=B;exports.TornApiError=c;exports.TornCrimeIdContext=D;exports.TornEndpoint=g;exports.TornIdsContext=L;exports.TornLogCategoryIdContext=K;exports.TornRateLimitError=d;exports.UserCrimeIdContext=$;exports.UserEndpoint=b;exports.UserIdContext=W;//# sourceMappingURL=index.js.map
1
+ 'use strict';var a=class{requester;constructor(e){this.requester=e;}async applications(e){let t="/faction/applications",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async attacks(e){let t="/faction/attacks",s={...e?.filters!==void 0&&{filters:e.filters},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async attacksfull(e){let t="/faction/attacksfull",s={...e?.filters!==void 0&&{filters:e.filters},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async balance(e){let t="/faction/balance",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async basic(e){let t="/faction/basic",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async chain(e){let t="/faction/chain",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async chains(e){let t="/faction/chains",s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async chainreport(e){let t="/faction/chainreport",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async contributors(e){let t="/faction/contributors",s={...e?.stat!==void 0&&{stat:e.stat},...e?.cat!==void 0&&{cat:e.cat},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async crimes(e){let t="/faction/crimes",s={...e?.cat!==void 0&&{cat:e.cat},...e?.filters!==void 0&&{filters:e.filters},...e?.offset!==void 0&&{offset:e.offset},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.sort!==void 0&&{sort:e.sort},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async hof(e){let t="/faction/hof",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async members(e){let t="/faction/members",s={...e?.striptags!==void 0&&{striptags:e.striptags},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async news(e){let t="/faction/news",s={...e?.striptags!==void 0&&{striptags:e.striptags},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.cat!==void 0&&{cat:e.cat},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async positions(e){let t="/faction/positions",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async rackets(e){let t="/faction/rackets",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async raids(e){let t="/faction/raids",s={...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.sort!==void 0&&{sort:e.sort},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async rankedwars(e){let t="/faction/rankedwars",s={...e?.cat!==void 0&&{cat:e.cat},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.sort!==void 0&&{sort:e.sort},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async reports(e){let t="/faction/reports",s={...e?.cat!==void 0&&{cat:e.cat},...e?.target!==void 0&&{target:e.target},...e?.limit!==void 0&&{limit:e.limit},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async revives(e){let t="/faction/revives",s={...e?.filters!==void 0&&{filters:e.filters},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.striptags!==void 0&&{striptags:e.striptags},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async revivesfull(e){let t="/faction/revivesFull",s={...e?.filters!==void 0&&{filters:e.filters},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.striptags!==void 0&&{striptags:e.striptags},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async search(e){let t="/faction/search",s={...e?.name!==void 0&&{name:e.name},...e?.filters&&{filters:e.filters.join(",")},...e?.limit!==void 0&&{limit:e.limit},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async stats(e){let t="/faction/stats",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async territory(e){let t="/faction/territory",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async territoryownership(e){let t="/faction/territoryownership",s={...e?.offset!==void 0&&{offset:e.offset},...e?.limit!==void 0&&{limit:e.limit},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async territorywars(e){let t="/faction/territorywars",s={...e?.cat!==void 0&&{cat:e.cat},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.sort!==void 0&&{sort:e.sort},...e?.limit!==void 0&&{limit:e.limit},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async upgrades(e){let t="/faction/upgrades",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async warfare(e){let t="/faction/warfare",s={...e?.cat!==void 0&&{cat:e.cat},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async wars(e){let t="/faction/wars",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async lookup(e){let t="/faction/lookup",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async timestamp(e){let t="/faction/timestamp",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async get(e){let t="/faction",s={...e?.selections&&{selections:e.selections.join(",")},...e?.id!==void 0&&{id:e.id},...e?.limit!==void 0&&{limit:e.limit},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.cat!==void 0&&{cat:e.cat},...e?.stat!==void 0&&{stat:e.stat},...e?.filters!==void 0&&{filters:e.filters},...e?.striptags!==void 0&&{striptags:e.striptags},...e?.sort!==void 0&&{sort:e.sort},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}withId(e){return new F(this.requester,e)}withChainId(e){return new T(this.requester,e)}withCrimeId(e){return new I(this.requester,e)}withRaidWarId(e){return new k(this.requester,e)}withRankedWarId(e){return new C(this.requester,e)}withTerritoryWarId(e){return new x(this.requester,e)}},F=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async basic(e){let t=`/faction/${this.contextId}/basic`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async chain(e){let t=`/faction/${this.contextId}/chain`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async chains(e){let t=`/faction/${this.contextId}/chains`,s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async hof(e){let t=`/faction/${this.contextId}/hof`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async members(e){let t=`/faction/${this.contextId}/members`,s={...e?.striptags!==void 0&&{striptags:e.striptags},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async raids(e){let t=`/faction/${this.contextId}/raids`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async rankedwars(e){let t=`/faction/${this.contextId}/rankedwars`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async territory(e){let t=`/faction/${this.contextId}/territory`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async territorywars(e){let t=`/faction/${this.contextId}/territorywars`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async wars(e){let t=`/faction/${this.contextId}/wars`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async get(){let e=`/faction/${this.contextId}`,t={};return this.requester(e,t)}},T=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async chainreport(e){let t=`/faction/${this.contextId}/chainreport`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}},I=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async crime(e){let t=`/faction/${this.contextId}/crime`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}},k=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async raidreport(e){let t=`/faction/${this.contextId}/raidreport`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}},C=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async rankedwarreport(e){let t=`/faction/${this.contextId}/rankedwarreport`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}},x=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async territorywarreport(e){let t=`/faction/${this.contextId}/territorywarreport`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}};var f=class{requester;constructor(e){this.requester=e;}async categories(e){let t="/forum/categories",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async threads(e){let t="/forum/threads",s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async lookup(e){let t="/forum/lookup",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async timestamp(e){let t="/forum/timestamp",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async get(e){let t="/forum",s={...e?.selections&&{selections:e.selections.join(",")},...e?.id!==void 0&&{id:e.id},...e?.striptags!==void 0&&{striptags:e.striptags},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}withThreadId(e){return new v(this.requester,e)}withCategoryIds(e){return new S(this.requester,e)}},v=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async posts(e){let t=`/forum/${this.contextId}/posts`,s={...e?.offset!==void 0&&{offset:e.offset},...e?.striptags!==void 0&&{striptags:e.striptags},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async thread(e){let t=`/forum/${this.contextId}/thread`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}},S=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async threads(e){let t=`/forum/${this.contextId}/threads`,s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}};var l=class{requester;constructor(e){this.requester=e;}async log(e){let t="/key/log",s={...e?.limit!==void 0&&{limit:e.limit},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async info(e){let t="/key/info",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async get(e){let t="/key",s={...e?.selections&&{selections:e.selections.join(",")},...e?.limit!==void 0&&{limit:e.limit},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}};var h=class{requester;constructor(e){this.requester=e;}async bazaar(e){let t="/market/bazaar",s={...e?.cat!==void 0&&{cat:e.cat},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async lookup(e){let t="/market/lookup",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async timestamp(e){let t="/market/timestamp",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async get(e){let t="/market",s={...e?.selections&&{selections:e.selections.join(",")},...e?.id!==void 0&&{id:e.id},...e?.cat!==void 0&&{cat:e.cat},...e?.bonus!==void 0&&{bonus:e.bonus},...e?.sort!==void 0&&{sort:e.sort},...e?.offset!==void 0&&{offset:e.offset},...e?.limit!==void 0&&{limit:e.limit},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}withId(e){return new w(this.requester,e)}withPropertyTypeId(e){return new E(this.requester,e)}},w=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async bazaar(e){let t=`/market/${this.contextId}/bazaar`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async itemmarket(e){let t=`/market/${this.contextId}/itemmarket`,s={...e?.bonus!==void 0&&{bonus:e.bonus},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}},E=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async properties(e){let t=`/market/${this.contextId}/properties`,s={...e?.offset!==void 0&&{offset:e.offset},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async rentals(e){let t=`/market/${this.contextId}/rentals`,s={...e?.offset!==void 0&&{offset:e.offset},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}};var g=class{requester;constructor(e){this.requester=e;}withId(e){return new U(this.requester,e)}async lookup(e){let t="/property/lookup",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async timestamp(e){let t="/property/timestamp",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async get(e){let t="/property",s={...e?.selections&&{selections:e.selections.join(",")},...e?.id!==void 0&&{id:e.id},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}},U=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async get(e){let t=`/property/${this.contextId}/property`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}};var y=class{requester;constructor(e){this.requester=e;}async cars(e){let t="/racing/cars",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async carupgrades(e){let t="/racing/carupgrades",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async races(e){let t="/racing/races",s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.cat!==void 0&&{cat:e.cat},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async tracks(e){let t="/racing/tracks",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async lookup(e){let t="/racing/lookup",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async timestamp(e){let t="/racing/timestamp",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async get(e){let t="/racing",s={...e?.selections&&{selections:e.selections.join(",")},...e?.id!==void 0&&{id:e.id},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.cat!==void 0&&{cat:e.cat},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}withRaceId(e){return new A(this.requester,e)}withTrackId(e){return new L(this.requester,e)}},A=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async race(e){let t=`/racing/${this.contextId}/race`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}},L=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async records(e){let t=`/racing/${this.contextId}/records`,s={...e?.cat!==void 0&&{cat:e.cat},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}};var R=class{requester;constructor(e){this.requester=e;}async attacklog(e){let t="/torn/attacklog",s={...e?.log!==void 0&&{log:e.log},...e?.offset!==void 0&&{offset:e.offset},...e?.sort!==void 0&&{sort:e.sort},...e?.striptags!==void 0&&{striptags:e.striptags},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async bounties(e){let t="/torn/bounties",s={...e?.limit!==void 0&&{limit:e.limit},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async calendar(e){let t="/torn/calendar",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async crimes(e){let t="/torn/crimes",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async education(e){let t="/torn/education",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async factionhof(e){let t="/torn/factionhof",s={...e?.limit!==void 0&&{limit:e.limit},...e?.offset!==void 0&&{offset:e.offset},...e?.cat!==void 0&&{cat:e.cat},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async factiontree(e){let t="/torn/factiontree",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async hof(e){let t="/torn/hof",s={...e?.limit!==void 0&&{limit:e.limit},...e?.offset!==void 0&&{offset:e.offset},...e?.cat!==void 0&&{cat:e.cat},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async itemammo(e){let t="/torn/itemammo",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async itemmods(e){let t="/torn/itemmods",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async items(e){let t="/torn/items",s={...e?.cat!==void 0&&{cat:e.cat},...e?.sort!==void 0&&{sort:e.sort},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async logcategories(e){let t="/torn/logcategories",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async logtypes(e){let t="/torn/logtypes",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async organizedcrimes(e){let t="/torn/organizedcrimes",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async properties(e){let t="/torn/properties",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async territory(e){let t="/torn/territory",s={...e?.ids&&{ids:e.ids.join(",")},...e?.offset!==void 0&&{offset:e.offset},...e?.limit!==void 0&&{limit:e.limit},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async lookup(e){let t="/torn/lookup",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async timestamp(e){let t="/torn/timestamp",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async get(e){let t="/torn",s={...e?.selections&&{selections:e.selections.join(",")},...e?.id!==void 0&&{id:e.id},...e?.striptags!==void 0&&{striptags:e.striptags},...e?.limit!==void 0&&{limit:e.limit},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.sort!==void 0&&{sort:e.sort},...e?.cat!==void 0&&{cat:e.cat},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}withIds(e){return new M(this.requester,e)}withLogCategoryId(e){return new K(this.requester,e)}withCrimeId(e){return new D(this.requester,e)}},M=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async items(e){let t=`/torn/${this.contextId}/items`,s={...e?.sort!==void 0&&{sort:e.sort},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}},K=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async logtypes(e){let t=`/torn/${this.contextId}/logtypes`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}},D=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async subcrimes(e){let t=`/torn/${this.contextId}/subcrimes`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}};var b=class{requester;constructor(e){this.requester=e;}async attacks(e){let t="/user/attacks",s={...e?.filters!==void 0&&{filters:e.filters},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async attacksfull(e){let t="/user/attacksfull",s={...e?.filters!==void 0&&{filters:e.filters},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async bounties(e){let t="/user/bounties",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async calendar(e){let t="/user/calendar",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async education(e){let t="/user/education",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async enlistedcars(e){let t="/user/enlistedcars",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async factionbalance(e){let t="/user/factionbalance",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async forumfeed(e){let t="/user/forumfeed",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async forumfriends(e){let t="/user/forumfriends",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async forumposts(e){let t="/user/forumposts",s={...e?.striptags!==void 0&&{striptags:e.striptags},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async forumsubscribedthreads(e){let t="/user/forumsubscribedthreads",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async forumthreads(e){let t="/user/forumthreads",s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async hof(e){let t="/user/hof",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async itemmarket(e){let t="/user/itemmarket",s={...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async jobranks(e){let t="/user/jobranks",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async list(e){let t="/user/list",s={...e?.cat!==void 0&&{cat:e.cat},...e?.limit!==void 0&&{limit:e.limit},...e?.offset!==void 0&&{offset:e.offset},...e?.sort!==void 0&&{sort:e.sort},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async log(e){let t="/user/log",s={...e?.log&&{log:e.log.join(",")},...e?.cat!==void 0&&{cat:e.cat},...e?.limit!==void 0&&{limit:e.limit},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async organizedcrime(e){let t="/user/organizedcrime",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async personalstats(e){let t="/user/personalstats",s={...e?.cat!==void 0&&{cat:e.cat},...e?.stat&&{stat:e.stat.join(",")},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async properties(e){let t="/user/properties",s={...e?.offset!==void 0&&{offset:e.offset},...e?.limit!==void 0&&{limit:e.limit},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async property(e){let t="/user/property",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async races(e){let t="/user/races",s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.cat!==void 0&&{cat:e.cat},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async racingrecords(e){let t="/user/racingrecords",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async reports(e){let t="/user/reports",s={...e?.cat!==void 0&&{cat:e.cat},...e?.target!==void 0&&{target:e.target},...e?.limit!==void 0&&{limit:e.limit},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async revives(e){let t="/user/revives",s={...e?.filters!==void 0&&{filters:e.filters},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.striptags!==void 0&&{striptags:e.striptags},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async revivesfull(e){let t="/user/revivesFull",s={...e?.filters!==void 0&&{filters:e.filters},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.to!==void 0&&{to:e.to},...e?.from!==void 0&&{from:e.from},...e?.striptags!==void 0&&{striptags:e.striptags},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async lookup(e){let t="/user/lookup",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async timestamp(e){let t="/user/timestamp",s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async get(e){let t="/user",s={...e?.selections&&{selections:e.selections.join(",")},...e?.id!==void 0&&{id:e.id},...e?.limit!==void 0&&{limit:e.limit},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.sort!==void 0&&{sort:e.sort},...e?.cat!==void 0&&{cat:e.cat},...e?.stat&&{stat:e.stat.join(",")},...e?.striptags!==void 0&&{striptags:e.striptags},...e?.offset!==void 0&&{offset:e.offset},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}withId(e){return new W(this.requester,e)}withCrimeId(e){return new $(this.requester,e)}},W=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async bounties(e){let t=`/user/${this.contextId}/bounties`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async forumposts(e){let t=`/user/${this.contextId}/forumposts`,s={...e?.striptags!==void 0&&{striptags:e.striptags},...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async forumthreads(e){let t=`/user/${this.contextId}/forumthreads`,s={...e?.limit!==void 0&&{limit:e.limit},...e?.sort!==void 0&&{sort:e.sort},...e?.from!==void 0&&{from:e.from},...e?.to!==void 0&&{to:e.to},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async hof(e){let t=`/user/${this.contextId}/hof`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async personalstats(e){let t=`/user/${this.contextId}/personalstats`,s={...e?.cat!==void 0&&{cat:e.cat},...e?.stat&&{stat:e.stat.join(",")},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async properties(e){let t=`/user/${this.contextId}/properties`,s={...e?.offset!==void 0&&{offset:e.offset},...e?.limit!==void 0&&{limit:e.limit},...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async property(e){let t=`/user/${this.contextId}/property`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}async get(){let e=`/user/${this.contextId}`,t={};return this.requester(e,t)}},$=class{requester;contextId;constructor(e,t){this.requester=e,this.contextId=t;}async crimes(e){let t=`/user/${this.contextId}/crimes`,s={...e?.timestamp!==void 0&&{timestamp:e.timestamp}};return this.requester(t,s)}};var c=class extends Error{code;constructor(e){super(e.error),this.name="TornApiError",this.code=e.code;}},d=class extends Error{constructor(e){super(e),this.name="TornRateLimitError";}};var q=class{nextUrl;prevUrl;requester;constructor(e,t,s,r){Object.assign(this,e),this.nextUrl=t,this.prevUrl=s,this.requester=r;}async fetchPage(e){if(!e)return null;let t=new URL(e),s=t.pathname.substring(3),r={};for(let[u,n]of t.searchParams.entries())r[u]=n;return this.requester(s,r)}next(){return this.fetchPage(this.nextUrl)}prev(){return this.fetchPage(this.prevUrl)}};var j=i=>i instanceof Error,z=i=>typeof i=="object"&&i!==null&&"error"in i&&typeof i.error=="object"&&i.error!==null&&"code"in i.error&&"error"in i.error,N=i=>typeof i=="object"&&i!==null&&"_metadata"in i&&typeof i._metadata=="object"&&i._metadata!==null&&"links"in i._metadata,P=class{apiKeys;rateLimitMode;comment;headers;apiUrl;apiKeyBalancing;verbose;apiKeyIndex=0;requestTimestamps=new Map;constructor(e){if(!e.apiKeys||e.apiKeys.length===0)throw new Error("At least one API key must be provided.");this.apiKeys=e.apiKeys,this.rateLimitMode=e.rateLimitMode??"autoDelay",this.comment=e.comment,this.headers=e.headers??{},this.apiUrl=e.apiUrl??"https://api.torn.com/v2",this.apiKeyBalancing=e.apiKeyBalancing??"roundRobin",this.verbose=!!e.verbose;for(let t of this.apiKeys)this.requestTimestamps.set(t,[]);}log(...e){this.verbose&&console.log("[TornClient]",...e);}requester=this.makeRequest.bind(this);isKeyAvailable(e){if(this.rateLimitMode==="ignore")return true;let s=Date.now()-6e4,r=(this.requestTimestamps.get(e)??[]).filter(u=>u>s);return this.requestTimestamps.set(e,r),r.length<100}findAvailableKey(){for(let e=0;e<this.apiKeys.length;e++){let t=this.getApiKey();if(this.isKeyAvailable(t))return t}return null}getMinWaitTime(){let e=Date.now(),t=60100;for(let s of this.apiKeys){let r=this.requestTimestamps.get(s)??[];if(r.length>=100){let u=r[0],n=6e4-(e-u)+100;n<t&&(t=n);}}return Math.max(0,t)}getApiKey(){if(this.apiKeys.length===1)return this.apiKeys[0];if(this.apiKeyBalancing==="random"){let t=Math.floor(Math.random()*this.apiKeys.length);return this.apiKeys[t]}let e=this.apiKeys[this.apiKeyIndex];return this.apiKeyIndex=(this.apiKeyIndex+1)%this.apiKeys.length,e}async makeRequest(e,t){this.log("Request received:",e,t);let s=this.findAvailableKey();if(!s){if(this.rateLimitMode==="autoDelay"){let n=this.getMinWaitTime();this.log(`All keys are on cooldown. Delaying for ${n}ms...`),await new Promise(o=>setTimeout(o,n)),s=this.findAvailableKey();}if(!s){let n=new d("Rate limit of 100 requests/minute exceeded for all available keys");throw this.log("Rate limit exceeded for all keys"),n}}this.log(`Using API key: ${s.slice(0,5)}...`);let r=new URL(`${this.apiUrl}${e}`);for(let[n,o]of Object.entries(t))o!=null&&n!=="key"&&n!=="comment"&&r.searchParams.set(n,String(o));this.comment&&r.searchParams.set("comment",this.comment);let u={headers:{Accept:"application/json",Authorization:`ApiKey ${s}`,...this.headers}};try{this.log("Fetching:",r.toString());let n=await fetch(r.toString(),u);if(this.rateLimitMode!=="ignore"){let p=this.requestTimestamps.get(s)??[];p.push(Date.now()),this.requestTimestamps.set(s,p);}if(!n.ok)throw new Error(`Request failed with status ${n.status}: ${n.statusText}`);let o=await n.json();if(z(o))throw new c(o.error);let m;return N(o)?m=new q(o,o._metadata.links.next,o._metadata.links.prev,this.requester):m=o,this.log("Response data:",m),m}catch(n){let o=j(n)?n:new Error("An unknown error occurred");throw this.log("Request failed:",o.message),o}}getRateLimitInfo(){let e=Date.now(),t=e-6e4,s={};for(let r of this.apiKeys){let u=(this.requestTimestamps.get(r)??[]).filter(H=>H>t),n=u.length,o=Math.max(0,100-n),m=u[0]??null,p=m?Math.max(0,6e4-(e-m)):0;s[r.slice(0,5)]={used:n,remaining:o,resetInMs:p};}return s}};var B=class{user;faction;market;property;racing;forum;key;torn;rateLimitMode;requestHandler;constructor(e){if(!e.apiKeys||e.apiKeys.length===0)throw new Error("At least one API key is required to initialize the client.");this.rateLimitMode=e.rateLimitMode??"autoDelay",this.requestHandler=new P(e);let t=this.requestHandler.requester;this.user=new b(t),this.faction=new a(t),this.market=new h(t),this.property=new g(t),this.racing=new y(t),this.forum=new f(t),this.torn=new R(t),this.key=new l(t);}getRateLimitInfo(){return this.requestHandler.getRateLimitInfo()}};
2
+ exports.FactionChainIdContext=T;exports.FactionCrimeIdContext=I;exports.FactionEndpoint=a;exports.FactionIdContext=F;exports.FactionRaidWarIdContext=k;exports.FactionRankedWarIdContext=C;exports.FactionTerritoryWarIdContext=x;exports.ForumCategoryIdsContext=S;exports.ForumEndpoint=f;exports.ForumThreadIdContext=v;exports.KeyEndpoint=l;exports.MarketEndpoint=h;exports.MarketIdContext=w;exports.MarketPropertyTypeIdContext=E;exports.PaginatedResponse=q;exports.PropertyEndpoint=g;exports.PropertyIdContext=U;exports.RacingEndpoint=y;exports.RacingRaceIdContext=A;exports.RacingTrackIdContext=L;exports.TornAPI=B;exports.TornApiError=c;exports.TornCrimeIdContext=D;exports.TornEndpoint=R;exports.TornIdsContext=M;exports.TornLogCategoryIdContext=K;exports.TornRateLimitError=d;exports.UserCrimeIdContext=$;exports.UserEndpoint=b;exports.UserIdContext=W;//# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map