torn-client 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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
|
|
|
@@ -3990,7 +4006,7 @@ declare class FactionEndpoint {
|
|
|
3990
4006
|
to?: number;
|
|
3991
4007
|
cat?: "all" | "current" | "all" | "recruiting" | "planning" | "failure" | "successful" | "expired" | "available" | "completed" | FactionNewsCategory | FactionRankedWarsCategoryEnum | ReportTypeEnum | FactionWarfareTypeEnum | FactionTerritoryWarsCategoryEnum;
|
|
3992
4008
|
stat?: FactionStatEnum;
|
|
3993
|
-
filters?: "created_at" | "executed_at" | "ready_at" | "expired_at";
|
|
4009
|
+
filters?: "created_at" | "executed_at" | "ready_at" | "expired_at" | "incoming" | "outgoing";
|
|
3994
4010
|
striptags?: "true" | "false";
|
|
3995
4011
|
sort?: "DESC" | "ASC";
|
|
3996
4012
|
offset?: number;
|
|
@@ -5070,6 +5086,7 @@ declare class UserEndpoint {
|
|
|
5070
5086
|
sort?: "DESC" | "ASC";
|
|
5071
5087
|
cat?: ReportTypeEnum | UserListEnum | PersonalStatsCategoryEnum | RacingRaceTypeEnum;
|
|
5072
5088
|
stat?: PersonalStatsStatName[];
|
|
5089
|
+
filters?: "incoming" | "outgoing";
|
|
5073
5090
|
striptags?: "true" | "false";
|
|
5074
5091
|
offset?: number;
|
|
5075
5092
|
timestamp?: string;
|
|
@@ -5308,4 +5325,4 @@ declare class TornRateLimitError extends Error {
|
|
|
5308
5325
|
constructor(message: string);
|
|
5309
5326
|
}
|
|
5310
5327
|
|
|
5311
|
-
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 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 };
|
|
5328
|
+
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
|
|
|
@@ -3990,7 +4006,7 @@ declare class FactionEndpoint {
|
|
|
3990
4006
|
to?: number;
|
|
3991
4007
|
cat?: "all" | "current" | "all" | "recruiting" | "planning" | "failure" | "successful" | "expired" | "available" | "completed" | FactionNewsCategory | FactionRankedWarsCategoryEnum | ReportTypeEnum | FactionWarfareTypeEnum | FactionTerritoryWarsCategoryEnum;
|
|
3992
4008
|
stat?: FactionStatEnum;
|
|
3993
|
-
filters?: "created_at" | "executed_at" | "ready_at" | "expired_at";
|
|
4009
|
+
filters?: "created_at" | "executed_at" | "ready_at" | "expired_at" | "incoming" | "outgoing";
|
|
3994
4010
|
striptags?: "true" | "false";
|
|
3995
4011
|
sort?: "DESC" | "ASC";
|
|
3996
4012
|
offset?: number;
|
|
@@ -5070,6 +5086,7 @@ declare class UserEndpoint {
|
|
|
5070
5086
|
sort?: "DESC" | "ASC";
|
|
5071
5087
|
cat?: ReportTypeEnum | UserListEnum | PersonalStatsCategoryEnum | RacingRaceTypeEnum;
|
|
5072
5088
|
stat?: PersonalStatsStatName[];
|
|
5089
|
+
filters?: "incoming" | "outgoing";
|
|
5073
5090
|
striptags?: "true" | "false";
|
|
5074
5091
|
offset?: number;
|
|
5075
5092
|
timestamp?: string;
|
|
@@ -5308,4 +5325,4 @@ declare class TornRateLimitError extends Error {
|
|
|
5308
5325
|
constructor(message: string);
|
|
5309
5326
|
}
|
|
5310
5327
|
|
|
5311
|
-
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 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 };
|
|
5328
|
+
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?.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=
|
|
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 g=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 h=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?.filters!==void 0&&{filters:e.filters},...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 g(t),this.property=new h(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=g;exports.MarketIdContext=w;exports.MarketPropertyTypeIdContext=E;exports.PaginatedResponse=q;exports.PropertyEndpoint=h;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
|