tornapi-typescript 4.2.0 → 4.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +46 -49
- package/dist/index.js +50 -28
- package/dist/index.ts +107 -78
- package/dist/openapi.json +112 -41
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1278,6 +1278,7 @@ export interface PersonalStatsCrimesV2 {
|
|
|
1278
1278
|
cracking: number;
|
|
1279
1279
|
forgery: number;
|
|
1280
1280
|
scamming: number;
|
|
1281
|
+
arson: number;
|
|
1281
1282
|
};
|
|
1282
1283
|
version: string;
|
|
1283
1284
|
}
|
|
@@ -1623,7 +1624,7 @@ export interface UserPersonalStatsFullPublic {
|
|
|
1623
1624
|
}
|
|
1624
1625
|
export type UserPersonalStatsResponse = UserPersonalStatsFull | UserPersonalStatsFullPublic | UserPersonalStatsPopular | UserPersonalStatsCategory | UserPersonalStatsHistoric;
|
|
1625
1626
|
export type PersonalStatsCategoryEnum = "all" | "popular" | "attacking" | "battle_stats" | "jobs" | "trading" | "jail" | "hospital" | "finishing_hits" | "communication" | "crimes" | "bounties" | "investments" | "items" | "travel" | "drugs" | "missions" | "racing" | "networth" | "other" | "itemmarketcustomers" | "itemmarketsales" | "itemmarketrevenue" | "itemmarketfees";
|
|
1626
|
-
export type PersonalStatsStatName = "attackswon" | "attackslost" | "attacksdraw" | "attacksassisted" | "defendswon" | "defendslost" | "defendsstalemated" | "elo" | "yourunaway" | "theyrunaway" | "unarmoredwon" | "bestkillstreak" | "attackhits" | "attackmisses" | "attackdamage" | "bestdamage" | "onehitkills" | "attackcriticalhits" | "roundsfired" | "specialammoused" | "hollowammoused" | "tracerammoused" | "piercingammoused" | "incendiaryammoused" | "attacksstealthed" | "retals" | "moneymugged" | "largestmug" | "itemslooted" | "highestbeaten" | "respectforfaction" | "rankedwarhits" | "raidhits" | "territoryjoins" | "territoryclears" | "territorytime" | "jobpointsused" | "trainsreceived" | "marketitemsbought" | "auctionswon" | "auctionsells" | "itemssent" | "trades" | "cityitemsbought" | "pointsbought" | "pointssold" | "bazaarcustomers" | "bazaarsales" | "bazaarprofit" | "jailed" | "peoplebusted" | "failedbusts" | "peoplebought" | "peopleboughtspent" | "hospital" | "medicalitemsused" | "bloodwithdrawn" | "reviveskill" | "revives" | "revivesreceived" | "heavyhits" | "machinehits" | "riflehits" | "smghits" | "shotgunhits" | "pistolhits" | "temphits" | "piercinghits" | "slashinghits" | "clubbinghits" | "mechanicalhits" | "h2hhits" | "mailssent" | "friendmailssent" | "factionmailssent" | "companymailssent" | "spousemailssent" | "classifiedadsplaced" | "personalsplaced" | "criminaloffensesold" | "sellillegalgoods" | "theftold" | "autotheftcrime" | "drugdealscrime" | "computercrime" | "fraudold" | "murdercrime" | "othercrime" | "organizedcrimes" | "bountiesplaced" | "totalbountyspent" | "bountiescollected" | "totalbountyreward" | "bountiesreceived" | "receivedbountyvalue" | "cityfinds" | "dumpfinds" | "itemsdumped" | "booksread" | "boostersused" | "consumablesused" | "candyused" | "alcoholused" | "energydrinkused" | "statenhancersused" | "eastereggsfound" | "eastereggsused" | "virusescoded" | "traveltimes" | "timespenttraveling" | "itemsboughtabroad" | "attackswonabroad" | "defendslostabroad" | "argtravel" | "mextravel" | "uaetravel" | "hawtravel" | "japtravel" | "uktravel" | "satravel" | "switravel" | "chitravel" | "cantravel" | "caytravel" | "drugsused" | "overdosed" | "rehabs" | "rehabcost" | "cantaken" | "exttaken" | "kettaken" | "lsdtaken" | "opitaken" | "pcptaken" | "shrtaken" | "spetaken" | "victaken" | "xantaken" | "missionscompleted" | "contractscompleted" | "dukecontractscompleted" | "missioncreditsearned" | "racingskill" | "racingpointsearned" | "racesentered" | "raceswon" | "networth" | "timeplayed" | "activestreak" | "bestactivestreak" | "awards" | "refills" | "nerverefills" | "tokenrefills" | "meritsbought" | "daysbeendonator" | "criminaloffenses" | "vandalism" | "theft" | "counterfeiting" | "fraud" | "illicitservices" | "cybercrime" | "extortion" | "illegalproduction" | "currentkillstreak" | "strength" | "defense" | "speed" | "dexterity" | "totalstats" | "manuallabor" | "intelligence" | "endurance" | "totalworkingstats" | "moneyinvested" | "investedprofit" | "investamount" | "banktimeleft" | "stockprofits" | "stocklosses" | "stockfees" | "stocknetprofits" | "stockpayouts" | "networthwallet" | "networthvault" | "networthbank" | "networthcayman" | "networthpoints" | "networthitems" | "networthdisplaycase" | "networthbazaar" | "networthitemmarket" | "networthproperties" | "networthstockmarket" | "networthauctionhouse" | "networthbookie" | "networthcompany" | "networthenlistedcars" | "networthpiggybank" | "networthpending" | "networthloan" | "networthunpaidfees" | "huntingskill" | "searchforcashskill" | "bootleggingskill" | "graffitiskill" | "shopliftingskill" | "pickpocketingskill" | "cardskimmingskill" | "burglaryskill" | "hustlingskill" | "disposalskill" | "crackingskill" | "forgeryskill" | "scammingskill";
|
|
1627
|
+
export type PersonalStatsStatName = "attackswon" | "attackslost" | "attacksdraw" | "attacksassisted" | "defendswon" | "defendslost" | "defendsstalemated" | "elo" | "yourunaway" | "theyrunaway" | "unarmoredwon" | "bestkillstreak" | "attackhits" | "attackmisses" | "attackdamage" | "bestdamage" | "onehitkills" | "attackcriticalhits" | "roundsfired" | "specialammoused" | "hollowammoused" | "tracerammoused" | "piercingammoused" | "incendiaryammoused" | "attacksstealthed" | "retals" | "moneymugged" | "largestmug" | "itemslooted" | "highestbeaten" | "respectforfaction" | "rankedwarhits" | "raidhits" | "territoryjoins" | "territoryclears" | "territorytime" | "jobpointsused" | "trainsreceived" | "marketitemsbought" | "auctionswon" | "auctionsells" | "itemssent" | "trades" | "cityitemsbought" | "pointsbought" | "pointssold" | "bazaarcustomers" | "bazaarsales" | "bazaarprofit" | "jailed" | "peoplebusted" | "failedbusts" | "peoplebought" | "peopleboughtspent" | "hospital" | "medicalitemsused" | "bloodwithdrawn" | "reviveskill" | "revives" | "revivesreceived" | "heavyhits" | "machinehits" | "riflehits" | "smghits" | "shotgunhits" | "pistolhits" | "temphits" | "piercinghits" | "slashinghits" | "clubbinghits" | "mechanicalhits" | "h2hhits" | "mailssent" | "friendmailssent" | "factionmailssent" | "companymailssent" | "spousemailssent" | "classifiedadsplaced" | "personalsplaced" | "criminaloffensesold" | "sellillegalgoods" | "theftold" | "autotheftcrime" | "drugdealscrime" | "computercrime" | "fraudold" | "murdercrime" | "othercrime" | "organizedcrimes" | "bountiesplaced" | "totalbountyspent" | "bountiescollected" | "totalbountyreward" | "bountiesreceived" | "receivedbountyvalue" | "cityfinds" | "dumpfinds" | "itemsdumped" | "booksread" | "boostersused" | "consumablesused" | "candyused" | "alcoholused" | "energydrinkused" | "statenhancersused" | "eastereggsfound" | "eastereggsused" | "virusescoded" | "traveltimes" | "timespenttraveling" | "itemsboughtabroad" | "attackswonabroad" | "defendslostabroad" | "argtravel" | "mextravel" | "uaetravel" | "hawtravel" | "japtravel" | "uktravel" | "satravel" | "switravel" | "chitravel" | "cantravel" | "caytravel" | "drugsused" | "overdosed" | "rehabs" | "rehabcost" | "cantaken" | "exttaken" | "kettaken" | "lsdtaken" | "opitaken" | "pcptaken" | "shrtaken" | "spetaken" | "victaken" | "xantaken" | "missionscompleted" | "contractscompleted" | "dukecontractscompleted" | "missioncreditsearned" | "racingskill" | "racingpointsearned" | "racesentered" | "raceswon" | "networth" | "timeplayed" | "activestreak" | "bestactivestreak" | "awards" | "refills" | "nerverefills" | "tokenrefills" | "meritsbought" | "daysbeendonator" | "criminaloffenses" | "vandalism" | "theft" | "counterfeiting" | "fraud" | "illicitservices" | "cybercrime" | "extortion" | "illegalproduction" | "currentkillstreak" | "strength" | "defense" | "speed" | "dexterity" | "totalstats" | "manuallabor" | "intelligence" | "endurance" | "totalworkingstats" | "moneyinvested" | "investedprofit" | "investamount" | "banktimeleft" | "stockprofits" | "stocklosses" | "stockfees" | "stocknetprofits" | "stockpayouts" | "networthwallet" | "networthvault" | "networthbank" | "networthcayman" | "networthpoints" | "networthitems" | "networthdisplaycase" | "networthbazaar" | "networthitemmarket" | "networthproperties" | "networthstockmarket" | "networthauctionhouse" | "networthbookie" | "networthcompany" | "networthenlistedcars" | "networthpiggybank" | "networthpending" | "networthloan" | "networthunpaidfees" | "huntingskill" | "searchforcashskill" | "bootleggingskill" | "graffitiskill" | "shopliftingskill" | "pickpocketingskill" | "cardskimmingskill" | "burglaryskill" | "hustlingskill" | "disposalskill" | "crackingskill" | "forgeryskill" | "scammingskill" | "arsonskill";
|
|
1627
1628
|
export interface FactionRaidReport {
|
|
1628
1629
|
id: RaidWarId;
|
|
1629
1630
|
start: number;
|
|
@@ -2187,7 +2188,7 @@ export interface FactionCrimeSlot {
|
|
|
2187
2188
|
position_number: number;
|
|
2188
2189
|
item_requirement: {
|
|
2189
2190
|
id: ItemId;
|
|
2190
|
-
/** Shows if the item is reusable or consumed during the crime
|
|
2191
|
+
/** Shows if the item is reusable or consumed during the crime.<br><b>Important note: There may be alternative paths which won't consume the item, even if the item is non-reusable.</b> */
|
|
2191
2192
|
is_reusable: boolean;
|
|
2192
2193
|
/** Shows if user has the required item. */
|
|
2193
2194
|
is_available: boolean;
|
|
@@ -2466,7 +2467,7 @@ export interface MarketRentalDetails {
|
|
|
2466
2467
|
property: BasicProperty;
|
|
2467
2468
|
}
|
|
2468
2469
|
export interface MarketRentalsResponse {
|
|
2469
|
-
|
|
2470
|
+
rentals: MarketRentalDetails;
|
|
2470
2471
|
_metadata: RequestMetadataWithLinks;
|
|
2471
2472
|
}
|
|
2472
2473
|
export interface MarketPropertyDetails {
|
|
@@ -6355,14 +6356,14 @@ export interface UserV2 extends BaseSchema {
|
|
|
6355
6356
|
response: UserBasicResponse;
|
|
6356
6357
|
params: "striptags" | "timestamp";
|
|
6357
6358
|
};
|
|
6358
|
-
bounties: {
|
|
6359
|
-
response: UserBountiesResponse;
|
|
6360
|
-
params: "timestamp";
|
|
6361
|
-
};
|
|
6362
6359
|
battlestats: {
|
|
6363
6360
|
response: UserBattleStatsResponse;
|
|
6364
6361
|
params: "timestamp";
|
|
6365
6362
|
};
|
|
6363
|
+
bounties: {
|
|
6364
|
+
response: UserBountiesResponse;
|
|
6365
|
+
params: "timestamp";
|
|
6366
|
+
};
|
|
6366
6367
|
calendar: {
|
|
6367
6368
|
response: UserCalendarResponse;
|
|
6368
6369
|
params: "timestamp";
|
|
@@ -6625,11 +6626,11 @@ export interface FactionV2 extends BaseSchema {
|
|
|
6625
6626
|
};
|
|
6626
6627
|
raids: {
|
|
6627
6628
|
response: FactionRaidsResponse;
|
|
6628
|
-
params: "from" | "to" | "sort" | "timestamp";
|
|
6629
|
+
params: "from" | "to" | "sort" | "limit" | "timestamp";
|
|
6629
6630
|
};
|
|
6630
6631
|
rankedwars: {
|
|
6631
6632
|
response: FactionRankedWarResponse;
|
|
6632
|
-
params: "from" | "to" | "sort" | "timestamp";
|
|
6633
|
+
params: "offset" | "limit" | "from" | "to" | "sort" | "timestamp";
|
|
6633
6634
|
};
|
|
6634
6635
|
rankedwarreport: {
|
|
6635
6636
|
response: FactionRankedWarReportResponse;
|
|
@@ -6741,7 +6742,7 @@ export interface MarketV2 extends BaseSchema {
|
|
|
6741
6742
|
};
|
|
6742
6743
|
itemmarket: {
|
|
6743
6744
|
response: MarketItemMarketResponse;
|
|
6744
|
-
params: "id" | "bonus" | "offset" | "timestamp";
|
|
6745
|
+
params: "id" | "bonus" | "limit" | "offset" | "timestamp";
|
|
6745
6746
|
};
|
|
6746
6747
|
properties: {
|
|
6747
6748
|
response: MarketPropertiesResponse;
|
|
@@ -6845,7 +6846,7 @@ export interface TornV2 extends BaseSchema {
|
|
|
6845
6846
|
};
|
|
6846
6847
|
honors: {
|
|
6847
6848
|
response: TornHonorsResponse;
|
|
6848
|
-
params: "timestamp";
|
|
6849
|
+
params: "limit" | "offset" | "sort" | "timestamp";
|
|
6849
6850
|
};
|
|
6850
6851
|
hof: {
|
|
6851
6852
|
response: TornHofResponse;
|
|
@@ -6952,6 +6953,15 @@ export type ParamsV1<Sec extends SectionV1, Sel extends SelectionV1<Sec>> = Sect
|
|
|
6952
6953
|
export type ParamsV2<Sec extends SectionV2, Sel extends SelectionV2<Sec>> = SectionsV2Map[Sec]["selections"][Sel] extends {
|
|
6953
6954
|
params: any;
|
|
6954
6955
|
} ? SectionsV2Map[Sec]["selections"][Sel]["params"] : never;
|
|
6956
|
+
export type CommonArgument = {
|
|
6957
|
+
id?: string | number;
|
|
6958
|
+
key: string;
|
|
6959
|
+
comment?: string;
|
|
6960
|
+
};
|
|
6961
|
+
export type CommonArgumentV1<Sec extends SectionV1, Sel extends keyof SectionsV1Map[Sec]["selections"]> = {
|
|
6962
|
+
section: Sec;
|
|
6963
|
+
selections?: Sel[];
|
|
6964
|
+
} & CommonArgument;
|
|
6955
6965
|
export type GetArgumentV1<Sec extends SectionV1, Sel extends keyof SectionsV1Map[Sec]["selections"]> = ParamsV1<Sec, Sel> extends never ? {
|
|
6956
6966
|
section: Sec;
|
|
6957
6967
|
selections?: Sel[];
|
|
@@ -6967,20 +6977,19 @@ export type GetArgumentV1<Sec extends SectionV1, Sel extends keyof SectionsV1Map
|
|
|
6967
6977
|
key: string;
|
|
6968
6978
|
comment?: string;
|
|
6969
6979
|
};
|
|
6970
|
-
export type
|
|
6980
|
+
export type CommonArgumentV2<Sec extends SectionV2, Sel extends keyof SectionsV2Map[Sec]["selections"]> = {
|
|
6971
6981
|
section: Sec;
|
|
6972
6982
|
selections?: Sel[];
|
|
6973
|
-
|
|
6983
|
+
} & CommonArgument;
|
|
6984
|
+
export type GetArgumentV2<Sec extends SectionV2, Sel extends keyof SectionsV2Map[Sec]["selections"]> = ParamsV2<Sec, Sel> extends never ? {
|
|
6974
6985
|
params?: never;
|
|
6975
|
-
|
|
6976
|
-
comment?: string;
|
|
6977
|
-
} : {
|
|
6978
|
-
section: Sec;
|
|
6979
|
-
selections?: Sel[];
|
|
6980
|
-
id?: string | number;
|
|
6986
|
+
} & CommonArgumentV2<Sec, Sel> : {
|
|
6981
6987
|
params?: Partial<Record<ParamsV2<Sec, Sel>, string>>;
|
|
6982
|
-
|
|
6983
|
-
|
|
6988
|
+
} & CommonArgumentV2<Sec, Sel>;
|
|
6989
|
+
export type AdditionalArguments<CacheType> = {
|
|
6990
|
+
cache?: CacheType;
|
|
6991
|
+
expiry?: number;
|
|
6992
|
+
timeout?: number;
|
|
6984
6993
|
};
|
|
6985
6994
|
export type GetResponseSuccessV1<Sec extends SectionV1, Sel extends keyof SectionsV1Map[Sec]["selections"]> = SectionsV1Map[Sec]["selections"][Sel] extends {
|
|
6986
6995
|
response: any;
|
|
@@ -7007,45 +7016,33 @@ export type CacheV2<Sec extends SectionV2, Sel extends keyof SectionsV2Map[Sec][
|
|
|
7007
7016
|
set: (key: GetArgumentV2<Sec, Sel>, value: GetResponseV2<Sec, Sel>, expiry: number) => void | Promise<void>;
|
|
7008
7017
|
};
|
|
7009
7018
|
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
|
|
7010
|
-
export
|
|
7011
|
-
|
|
7019
|
+
export type HTTPClientCapabilities = "abort";
|
|
7020
|
+
export declare abstract class HTTPClient {
|
|
7021
|
+
abstract getJson(url: URL): Promise<any>;
|
|
7022
|
+
canAbort(): this is AbortableHTTPClient;
|
|
7023
|
+
}
|
|
7024
|
+
export declare abstract class AbortableHTTPClient extends HTTPClient {
|
|
7025
|
+
abstract getJson(url: URL): Promise<any>;
|
|
7026
|
+
abstract getJson(url: URL, timeout: number): Promise<any>;
|
|
7027
|
+
abstract getJson(url: URL, timeout: number | undefined): Promise<any>;
|
|
7028
|
+
canAbort(): this is AbortableHTTPClient;
|
|
7012
7029
|
}
|
|
7013
|
-
export declare class FetchHTTPClient
|
|
7014
|
-
getJson(url: URL): Promise<any>;
|
|
7030
|
+
export declare class FetchHTTPClient extends AbortableHTTPClient {
|
|
7031
|
+
getJson(url: URL, timeout?: number | undefined): Promise<any>;
|
|
7015
7032
|
}
|
|
7016
7033
|
interface ClientOptions {
|
|
7017
7034
|
httpClient?: HTTPClient;
|
|
7018
7035
|
defaultComment?: string;
|
|
7036
|
+
defaultTimeout?: number;
|
|
7019
7037
|
}
|
|
7020
7038
|
export declare class TornApiClient {
|
|
7021
7039
|
private readonly httpClient;
|
|
7022
7040
|
private readonly defaultComment?;
|
|
7041
|
+
private readonly defaultTimeout?;
|
|
7023
7042
|
constructor(options?: ClientOptions);
|
|
7024
|
-
getV1<Sec extends SectionV1, Sel extends SelectionV1<Sec>>({ section, selections, id, params, key, comment, cache, expiry, }: GetArgumentV1<Sec, Sel> &
|
|
7025
|
-
|
|
7026
|
-
expiry?: number;
|
|
7027
|
-
}): Promise<GetResponseV1<Sec, Sel>>;
|
|
7028
|
-
getV2<Sec extends SectionV2, Sel extends SelectionV2<Sec>>({ section, selections, id, params, key, comment, cache, expiry, }: GetArgumentV2<Sec, Sel> & {
|
|
7029
|
-
cache?: CacheV2<Sec, Sel>;
|
|
7030
|
-
expiry?: number;
|
|
7031
|
-
}): Promise<GetResponseV2<Sec, Sel>>;
|
|
7043
|
+
getV1<Sec extends SectionV1, Sel extends SelectionV1<Sec>>({ section, selections, id, params, key, comment, cache, expiry, timeout, }: GetArgumentV1<Sec, Sel> & AdditionalArguments<CacheV1<Sec, Sel>>): Promise<GetResponseV1<Sec, Sel>>;
|
|
7044
|
+
getV2<Sec extends SectionV2, Sel extends SelectionV2<Sec>>({ section, selections, id, params, key, comment, cache, expiry, timeout, }: GetArgumentV2<Sec, Sel> & AdditionalArguments<CacheV2<Sec, Sel>>): Promise<GetResponseV2<Sec, Sel>>;
|
|
7032
7045
|
private handleError;
|
|
7033
7046
|
private populateUrl;
|
|
7034
7047
|
}
|
|
7035
|
-
/**
|
|
7036
|
-
* @deprecated Move to TornApiClient instead of using this. Will be removed in an upcoming version.
|
|
7037
|
-
* @see TornApiClient
|
|
7038
|
-
*/
|
|
7039
|
-
export declare function tornApiGetV1<Sec extends SectionV1, Sel extends SelectionV1<Sec>>(options: GetArgumentV1<Sec, Sel> & {
|
|
7040
|
-
cache?: CacheV1<Sec, Sel>;
|
|
7041
|
-
expiry?: number;
|
|
7042
|
-
}): Promise<GetResponseV1<Sec, Sel>>;
|
|
7043
|
-
/**
|
|
7044
|
-
* @deprecated Move to TornApiClient instead of using this. Will be removed in an upcoming version.
|
|
7045
|
-
* @see TornApiClient
|
|
7046
|
-
*/
|
|
7047
|
-
export declare function tornApiGetV2<Sec extends SectionV2, Sel extends SelectionV2<Sec>>(options: GetArgumentV2<Sec, Sel> & {
|
|
7048
|
-
cache?: CacheV2<Sec, Sel>;
|
|
7049
|
-
expiry?: number;
|
|
7050
|
-
}): Promise<GetResponseV2<Sec, Sel>>;
|
|
7051
7048
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -34,20 +34,41 @@ export var TornApiError;
|
|
|
34
34
|
TornApiError[TornApiError["SELECTION_ONLY_AVAILABLE_API_V2"] = 23] = "SELECTION_ONLY_AVAILABLE_API_V2";
|
|
35
35
|
TornApiError[TornApiError["CLOSED_TEMPORARILY"] = 24] = "CLOSED_TEMPORARILY";
|
|
36
36
|
})(TornApiError || (TornApiError = {}));
|
|
37
|
-
export class
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
export class HTTPClient {
|
|
38
|
+
canAbort() {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export class AbortableHTTPClient extends HTTPClient {
|
|
43
|
+
canAbort() {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export class FetchHTTPClient extends AbortableHTTPClient {
|
|
48
|
+
async getJson(url, timeout = undefined) {
|
|
49
|
+
let response;
|
|
50
|
+
if (timeout !== undefined) {
|
|
51
|
+
const controller = new AbortController();
|
|
52
|
+
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
53
|
+
response = await fetch(url, { signal: controller.signal });
|
|
54
|
+
clearTimeout(timeoutId);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
response = await fetch(url);
|
|
58
|
+
}
|
|
40
59
|
return await response.json();
|
|
41
60
|
}
|
|
42
61
|
}
|
|
43
62
|
export class TornApiClient {
|
|
44
63
|
httpClient;
|
|
45
64
|
defaultComment;
|
|
65
|
+
defaultTimeout;
|
|
46
66
|
constructor(options = {}) {
|
|
47
67
|
this.httpClient = options.httpClient ?? new FetchHTTPClient();
|
|
48
68
|
this.defaultComment = options.defaultComment;
|
|
69
|
+
this.defaultTimeout = options.defaultTimeout;
|
|
49
70
|
}
|
|
50
|
-
async getV1({ section, selections, id, params = {}, key, comment, cache, expiry, }) {
|
|
71
|
+
async getV1({ section, selections, id, params = {}, key, comment, cache, expiry, timeout, }) {
|
|
51
72
|
const cached = await cache?.get({
|
|
52
73
|
section,
|
|
53
74
|
selections,
|
|
@@ -59,10 +80,18 @@ export class TornApiClient {
|
|
|
59
80
|
return cached;
|
|
60
81
|
const url = new URL(`https://api.torn.com/${section}/${id ?? ""}`);
|
|
61
82
|
this.populateUrl(url, key, (selections ?? []), comment, params ?? {});
|
|
62
|
-
|
|
63
|
-
.
|
|
64
|
-
|
|
65
|
-
|
|
83
|
+
if (this.httpClient.canAbort() && typeof timeout === "number") {
|
|
84
|
+
return this.httpClient
|
|
85
|
+
.getJson(url, timeout)
|
|
86
|
+
.then(addToCache)
|
|
87
|
+
.catch(this.handleError);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
return this.httpClient
|
|
91
|
+
.getJson(url)
|
|
92
|
+
.then(addToCache)
|
|
93
|
+
.catch(this.handleError);
|
|
94
|
+
}
|
|
66
95
|
function addToCache(response) {
|
|
67
96
|
if ("error" in response)
|
|
68
97
|
return response;
|
|
@@ -76,7 +105,7 @@ export class TornApiClient {
|
|
|
76
105
|
return response;
|
|
77
106
|
}
|
|
78
107
|
}
|
|
79
|
-
async getV2({ section, selections, id, params = {}, key, comment, cache, expiry, }) {
|
|
108
|
+
async getV2({ section, selections, id, params = {}, key, comment, cache, expiry, timeout, }) {
|
|
80
109
|
const cached = await cache?.get({
|
|
81
110
|
section,
|
|
82
111
|
selections,
|
|
@@ -88,10 +117,18 @@ export class TornApiClient {
|
|
|
88
117
|
return cached;
|
|
89
118
|
const url = new URL(`https://api.torn.com/v2/${section}/${id ?? ""}`);
|
|
90
119
|
this.populateUrl(url, key, (selections ?? []), comment, params ?? {});
|
|
91
|
-
|
|
92
|
-
.
|
|
93
|
-
|
|
94
|
-
|
|
120
|
+
if (this.httpClient.canAbort() && typeof timeout === "number") {
|
|
121
|
+
return this.httpClient
|
|
122
|
+
.getJson(url, timeout)
|
|
123
|
+
.then(addToCache)
|
|
124
|
+
.catch(this.handleError);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
return this.httpClient
|
|
128
|
+
.getJson(url)
|
|
129
|
+
.then(addToCache)
|
|
130
|
+
.catch(this.handleError);
|
|
131
|
+
}
|
|
95
132
|
function addToCache(response) {
|
|
96
133
|
if ("error" in response)
|
|
97
134
|
return response;
|
|
@@ -134,18 +171,3 @@ export class TornApiClient {
|
|
|
134
171
|
.forEach(([key, value]) => url.searchParams.set(key, value));
|
|
135
172
|
}
|
|
136
173
|
}
|
|
137
|
-
const DEFAULT_CLIENT = new TornApiClient();
|
|
138
|
-
/**
|
|
139
|
-
* @deprecated Move to TornApiClient instead of using this. Will be removed in an upcoming version.
|
|
140
|
-
* @see TornApiClient
|
|
141
|
-
*/
|
|
142
|
-
export async function tornApiGetV1(options) {
|
|
143
|
-
return DEFAULT_CLIENT.getV1(options);
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* @deprecated Move to TornApiClient instead of using this. Will be removed in an upcoming version.
|
|
147
|
-
* @see TornApiClient
|
|
148
|
-
*/
|
|
149
|
-
export async function tornApiGetV2(options) {
|
|
150
|
-
return DEFAULT_CLIENT.getV2(options);
|
|
151
|
-
}
|
package/dist/index.ts
CHANGED
|
@@ -6370,6 +6370,7 @@ export interface PersonalStatsCrimesV2 {
|
|
|
6370
6370
|
cracking: number;
|
|
6371
6371
|
forgery: number;
|
|
6372
6372
|
scamming: number;
|
|
6373
|
+
arson: number;
|
|
6373
6374
|
};
|
|
6374
6375
|
version: string;
|
|
6375
6376
|
}
|
|
@@ -7040,7 +7041,8 @@ export type PersonalStatsStatName =
|
|
|
7040
7041
|
| "disposalskill"
|
|
7041
7042
|
| "crackingskill"
|
|
7042
7043
|
| "forgeryskill"
|
|
7043
|
-
| "scammingskill"
|
|
7044
|
+
| "scammingskill"
|
|
7045
|
+
| "arsonskill";
|
|
7044
7046
|
|
|
7045
7047
|
export interface FactionRaidReport {
|
|
7046
7048
|
id: RaidWarId;
|
|
@@ -7689,7 +7691,7 @@ export interface FactionCrimeSlot {
|
|
|
7689
7691
|
position_number: number;
|
|
7690
7692
|
item_requirement: {
|
|
7691
7693
|
id: ItemId;
|
|
7692
|
-
/** Shows if the item is reusable or consumed during the crime
|
|
7694
|
+
/** Shows if the item is reusable or consumed during the crime.<br><b>Important note: There may be alternative paths which won't consume the item, even if the item is non-reusable.</b> */
|
|
7693
7695
|
is_reusable: boolean;
|
|
7694
7696
|
/** Shows if user has the required item. */
|
|
7695
7697
|
is_available: boolean;
|
|
@@ -8007,7 +8009,7 @@ export interface MarketRentalDetails {
|
|
|
8007
8009
|
}
|
|
8008
8010
|
|
|
8009
8011
|
export interface MarketRentalsResponse {
|
|
8010
|
-
|
|
8012
|
+
rentals: MarketRentalDetails;
|
|
8011
8013
|
_metadata: RequestMetadataWithLinks;
|
|
8012
8014
|
}
|
|
8013
8015
|
|
|
@@ -12067,14 +12069,14 @@ export interface UserV2 extends BaseSchema {
|
|
|
12067
12069
|
response: UserBasicResponse;
|
|
12068
12070
|
params: "striptags" | "timestamp";
|
|
12069
12071
|
};
|
|
12070
|
-
bounties: {
|
|
12071
|
-
response: UserBountiesResponse;
|
|
12072
|
-
params: "timestamp";
|
|
12073
|
-
};
|
|
12074
12072
|
battlestats: {
|
|
12075
12073
|
response: UserBattleStatsResponse;
|
|
12076
12074
|
params: "timestamp";
|
|
12077
12075
|
};
|
|
12076
|
+
bounties: {
|
|
12077
|
+
response: UserBountiesResponse;
|
|
12078
|
+
params: "timestamp";
|
|
12079
|
+
};
|
|
12078
12080
|
calendar: {
|
|
12079
12081
|
response: UserCalendarResponse;
|
|
12080
12082
|
params: "timestamp";
|
|
@@ -12377,11 +12379,11 @@ export interface FactionV2 extends BaseSchema {
|
|
|
12377
12379
|
};
|
|
12378
12380
|
raids: {
|
|
12379
12381
|
response: FactionRaidsResponse;
|
|
12380
|
-
params: "from" | "to" | "sort" | "timestamp";
|
|
12382
|
+
params: "from" | "to" | "sort" | "limit" | "timestamp";
|
|
12381
12383
|
};
|
|
12382
12384
|
rankedwars: {
|
|
12383
12385
|
response: FactionRankedWarResponse;
|
|
12384
|
-
params: "from" | "to" | "sort" | "timestamp";
|
|
12386
|
+
params: "offset" | "limit" | "from" | "to" | "sort" | "timestamp";
|
|
12385
12387
|
};
|
|
12386
12388
|
rankedwarreport: {
|
|
12387
12389
|
response: FactionRankedWarReportResponse;
|
|
@@ -12514,7 +12516,7 @@ export interface MarketV2 extends BaseSchema {
|
|
|
12514
12516
|
};
|
|
12515
12517
|
itemmarket: {
|
|
12516
12518
|
response: MarketItemMarketResponse;
|
|
12517
|
-
params: "id" | "bonus" | "offset" | "timestamp";
|
|
12519
|
+
params: "id" | "bonus" | "limit" | "offset" | "timestamp";
|
|
12518
12520
|
};
|
|
12519
12521
|
properties: {
|
|
12520
12522
|
response: MarketPropertiesResponse;
|
|
@@ -12628,7 +12630,7 @@ export interface TornV2 extends BaseSchema {
|
|
|
12628
12630
|
};
|
|
12629
12631
|
honors: {
|
|
12630
12632
|
response: TornHonorsResponse;
|
|
12631
|
-
params: "timestamp";
|
|
12633
|
+
params: "limit" | "offset" | "sort" | "timestamp";
|
|
12632
12634
|
};
|
|
12633
12635
|
hof: {
|
|
12634
12636
|
response: TornHofResponse;
|
|
@@ -12750,6 +12752,18 @@ export type ParamsV2<
|
|
|
12750
12752
|
? SectionsV2Map[Sec]["selections"][Sel]["params"]
|
|
12751
12753
|
: never;
|
|
12752
12754
|
|
|
12755
|
+
export type CommonArgument = {
|
|
12756
|
+
id?: string | number;
|
|
12757
|
+
key: string;
|
|
12758
|
+
comment?: string;
|
|
12759
|
+
};
|
|
12760
|
+
export type CommonArgumentV1<
|
|
12761
|
+
Sec extends SectionV1,
|
|
12762
|
+
Sel extends keyof SectionsV1Map[Sec]["selections"],
|
|
12763
|
+
> = {
|
|
12764
|
+
section: Sec;
|
|
12765
|
+
selections?: Sel[];
|
|
12766
|
+
} & CommonArgument;
|
|
12753
12767
|
export type GetArgumentV1<
|
|
12754
12768
|
Sec extends SectionV1,
|
|
12755
12769
|
Sel extends keyof SectionsV1Map[Sec]["selections"],
|
|
@@ -12771,27 +12785,29 @@ export type GetArgumentV1<
|
|
|
12771
12785
|
key: string;
|
|
12772
12786
|
comment?: string;
|
|
12773
12787
|
};
|
|
12788
|
+
export type CommonArgumentV2<
|
|
12789
|
+
Sec extends SectionV2,
|
|
12790
|
+
Sel extends keyof SectionsV2Map[Sec]["selections"],
|
|
12791
|
+
> = {
|
|
12792
|
+
section: Sec;
|
|
12793
|
+
selections?: Sel[];
|
|
12794
|
+
} & CommonArgument;
|
|
12774
12795
|
export type GetArgumentV2<
|
|
12775
12796
|
Sec extends SectionV2,
|
|
12776
12797
|
Sel extends keyof SectionsV2Map[Sec]["selections"],
|
|
12777
12798
|
> =
|
|
12778
12799
|
ParamsV2<Sec, Sel> extends never
|
|
12779
12800
|
? {
|
|
12780
|
-
section: Sec;
|
|
12781
|
-
selections?: Sel[];
|
|
12782
|
-
id?: string | number;
|
|
12783
12801
|
params?: never;
|
|
12784
|
-
|
|
12785
|
-
comment?: string;
|
|
12786
|
-
}
|
|
12802
|
+
} & CommonArgumentV2<Sec, Sel>
|
|
12787
12803
|
: {
|
|
12788
|
-
section: Sec;
|
|
12789
|
-
selections?: Sel[];
|
|
12790
|
-
id?: string | number;
|
|
12791
12804
|
params?: Partial<Record<ParamsV2<Sec, Sel>, string>>;
|
|
12792
|
-
|
|
12793
|
-
|
|
12794
|
-
|
|
12805
|
+
} & CommonArgumentV2<Sec, Sel>;
|
|
12806
|
+
export type AdditionalArguments<CacheType> = {
|
|
12807
|
+
cache?: CacheType;
|
|
12808
|
+
expiry?: number;
|
|
12809
|
+
timeout?: number;
|
|
12810
|
+
};
|
|
12795
12811
|
|
|
12796
12812
|
export type GetResponseSuccessV1<
|
|
12797
12813
|
Sec extends SectionV1,
|
|
@@ -12860,13 +12876,41 @@ type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (
|
|
|
12860
12876
|
? I
|
|
12861
12877
|
: never;
|
|
12862
12878
|
|
|
12863
|
-
export
|
|
12864
|
-
|
|
12879
|
+
export type HTTPClientCapabilities = "abort";
|
|
12880
|
+
|
|
12881
|
+
export abstract class HTTPClient {
|
|
12882
|
+
abstract getJson(url: URL): Promise<any>;
|
|
12883
|
+
|
|
12884
|
+
canAbort(): this is AbortableHTTPClient {
|
|
12885
|
+
return false;
|
|
12886
|
+
}
|
|
12887
|
+
}
|
|
12888
|
+
|
|
12889
|
+
export abstract class AbortableHTTPClient extends HTTPClient {
|
|
12890
|
+
abstract getJson(url: URL): Promise<any>;
|
|
12891
|
+
abstract getJson(url: URL, timeout: number): Promise<any>;
|
|
12892
|
+
abstract getJson(url: URL, timeout: number | undefined): Promise<any>;
|
|
12893
|
+
|
|
12894
|
+
canAbort(): this is AbortableHTTPClient {
|
|
12895
|
+
return true;
|
|
12896
|
+
}
|
|
12865
12897
|
}
|
|
12866
12898
|
|
|
12867
|
-
export class FetchHTTPClient
|
|
12868
|
-
async getJson(
|
|
12869
|
-
|
|
12899
|
+
export class FetchHTTPClient extends AbortableHTTPClient {
|
|
12900
|
+
async getJson(
|
|
12901
|
+
url: URL,
|
|
12902
|
+
timeout: number | undefined = undefined,
|
|
12903
|
+
): Promise<any> {
|
|
12904
|
+
let response: Response;
|
|
12905
|
+
if (timeout !== undefined) {
|
|
12906
|
+
const controller = new AbortController();
|
|
12907
|
+
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
12908
|
+
|
|
12909
|
+
response = await fetch(url, { signal: controller.signal });
|
|
12910
|
+
clearTimeout(timeoutId);
|
|
12911
|
+
} else {
|
|
12912
|
+
response = await fetch(url);
|
|
12913
|
+
}
|
|
12870
12914
|
|
|
12871
12915
|
return await response.json();
|
|
12872
12916
|
}
|
|
@@ -12875,15 +12919,18 @@ export class FetchHTTPClient implements HTTPClient {
|
|
|
12875
12919
|
interface ClientOptions {
|
|
12876
12920
|
httpClient?: HTTPClient;
|
|
12877
12921
|
defaultComment?: string;
|
|
12922
|
+
defaultTimeout?: number;
|
|
12878
12923
|
}
|
|
12879
12924
|
|
|
12880
12925
|
export class TornApiClient {
|
|
12881
12926
|
private readonly httpClient: HTTPClient;
|
|
12882
12927
|
private readonly defaultComment?: string;
|
|
12928
|
+
private readonly defaultTimeout?: number;
|
|
12883
12929
|
|
|
12884
12930
|
constructor(options: ClientOptions = {}) {
|
|
12885
12931
|
this.httpClient = options.httpClient ?? new FetchHTTPClient();
|
|
12886
12932
|
this.defaultComment = options.defaultComment;
|
|
12933
|
+
this.defaultTimeout = options.defaultTimeout;
|
|
12887
12934
|
}
|
|
12888
12935
|
|
|
12889
12936
|
async getV1<Sec extends SectionV1, Sel extends SelectionV1<Sec>>({
|
|
@@ -12895,10 +12942,11 @@ export class TornApiClient {
|
|
|
12895
12942
|
comment,
|
|
12896
12943
|
cache,
|
|
12897
12944
|
expiry,
|
|
12898
|
-
|
|
12899
|
-
|
|
12900
|
-
|
|
12901
|
-
|
|
12945
|
+
timeout,
|
|
12946
|
+
}: GetArgumentV1<Sec, Sel> &
|
|
12947
|
+
AdditionalArguments<CacheV1<Sec, Sel>>): Promise<
|
|
12948
|
+
GetResponseV1<Sec, Sel>
|
|
12949
|
+
> {
|
|
12902
12950
|
const cached = await cache?.get({
|
|
12903
12951
|
section,
|
|
12904
12952
|
selections,
|
|
@@ -12917,10 +12965,17 @@ export class TornApiClient {
|
|
|
12917
12965
|
params ?? {},
|
|
12918
12966
|
);
|
|
12919
12967
|
|
|
12920
|
-
|
|
12921
|
-
.
|
|
12922
|
-
|
|
12923
|
-
|
|
12968
|
+
if (this.httpClient.canAbort() && typeof timeout === "number") {
|
|
12969
|
+
return (this.httpClient as AbortableHTTPClient)
|
|
12970
|
+
.getJson(url, timeout)
|
|
12971
|
+
.then(addToCache)
|
|
12972
|
+
.catch(this.handleError);
|
|
12973
|
+
} else {
|
|
12974
|
+
return this.httpClient
|
|
12975
|
+
.getJson(url)
|
|
12976
|
+
.then(addToCache)
|
|
12977
|
+
.catch(this.handleError);
|
|
12978
|
+
}
|
|
12924
12979
|
|
|
12925
12980
|
function addToCache(
|
|
12926
12981
|
response: GetResponseV1<Sec, Sel>,
|
|
@@ -12950,10 +13005,11 @@ export class TornApiClient {
|
|
|
12950
13005
|
comment,
|
|
12951
13006
|
cache,
|
|
12952
13007
|
expiry,
|
|
12953
|
-
|
|
12954
|
-
|
|
12955
|
-
|
|
12956
|
-
|
|
13008
|
+
timeout,
|
|
13009
|
+
}: GetArgumentV2<Sec, Sel> &
|
|
13010
|
+
AdditionalArguments<CacheV2<Sec, Sel>>): Promise<
|
|
13011
|
+
GetResponseV2<Sec, Sel>
|
|
13012
|
+
> {
|
|
12957
13013
|
const cached = await cache?.get({
|
|
12958
13014
|
section,
|
|
12959
13015
|
selections,
|
|
@@ -12972,10 +13028,17 @@ export class TornApiClient {
|
|
|
12972
13028
|
params ?? {},
|
|
12973
13029
|
);
|
|
12974
13030
|
|
|
12975
|
-
|
|
12976
|
-
.
|
|
12977
|
-
|
|
12978
|
-
|
|
13031
|
+
if (this.httpClient.canAbort() && typeof timeout === "number") {
|
|
13032
|
+
return (this.httpClient as AbortableHTTPClient)
|
|
13033
|
+
.getJson(url, timeout)
|
|
13034
|
+
.then(addToCache)
|
|
13035
|
+
.catch(this.handleError);
|
|
13036
|
+
} else {
|
|
13037
|
+
return this.httpClient
|
|
13038
|
+
.getJson(url)
|
|
13039
|
+
.then(addToCache)
|
|
13040
|
+
.catch(this.handleError);
|
|
13041
|
+
}
|
|
12979
13042
|
|
|
12980
13043
|
function addToCache(
|
|
12981
13044
|
response: GetResponseV2<Sec, Sel>,
|
|
@@ -13035,37 +13098,3 @@ export class TornApiClient {
|
|
|
13035
13098
|
.forEach(([key, value]) => url.searchParams.set(key, value));
|
|
13036
13099
|
}
|
|
13037
13100
|
}
|
|
13038
|
-
|
|
13039
|
-
const DEFAULT_CLIENT = new TornApiClient();
|
|
13040
|
-
|
|
13041
|
-
/**
|
|
13042
|
-
* @deprecated Move to TornApiClient instead of using this. Will be removed in an upcoming version.
|
|
13043
|
-
* @see TornApiClient
|
|
13044
|
-
*/
|
|
13045
|
-
export async function tornApiGetV1<
|
|
13046
|
-
Sec extends SectionV1,
|
|
13047
|
-
Sel extends SelectionV1<Sec>,
|
|
13048
|
-
>(
|
|
13049
|
-
options: GetArgumentV1<Sec, Sel> & {
|
|
13050
|
-
cache?: CacheV1<Sec, Sel>;
|
|
13051
|
-
expiry?: number;
|
|
13052
|
-
},
|
|
13053
|
-
): Promise<GetResponseV1<Sec, Sel>> {
|
|
13054
|
-
return DEFAULT_CLIENT.getV1(options);
|
|
13055
|
-
}
|
|
13056
|
-
|
|
13057
|
-
/**
|
|
13058
|
-
* @deprecated Move to TornApiClient instead of using this. Will be removed in an upcoming version.
|
|
13059
|
-
* @see TornApiClient
|
|
13060
|
-
*/
|
|
13061
|
-
export async function tornApiGetV2<
|
|
13062
|
-
Sec extends SectionV2,
|
|
13063
|
-
Sel extends SelectionV2<Sec>,
|
|
13064
|
-
>(
|
|
13065
|
-
options: GetArgumentV2<Sec, Sel> & {
|
|
13066
|
-
cache?: CacheV2<Sec, Sel>;
|
|
13067
|
-
expiry?: number;
|
|
13068
|
-
},
|
|
13069
|
-
): Promise<GetResponseV2<Sec, Sel>> {
|
|
13070
|
-
return DEFAULT_CLIENT.getV2(options);
|
|
13071
|
-
}
|
package/dist/openapi.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"info": {
|
|
4
4
|
"title": "Torn API",
|
|
5
5
|
"description": "\n * The development of Torn's API v2 is still ongoing.\n * If selections remain unaltered, they will default to the API v1 version.\n * Unlike API v1, API v2 accepts both selections and IDs as path and query parameters.\n * If any discrepancies or errors are found, please submit a [bug report](https://www.torn.com/forums.php#/p=forums&f=19&b=0&a=0) on the Torn Forums.\n * In case you're using bots to check for changes on openapi.json file, make sure to specificy a custom user-agent header - CloudFlare sometimes prevents requests from default user-agents.",
|
|
6
|
-
"version": "4.2.
|
|
6
|
+
"version": "4.2.2"
|
|
7
7
|
},
|
|
8
8
|
"servers": [
|
|
9
9
|
{
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"api_key": []
|
|
157
157
|
}
|
|
158
158
|
],
|
|
159
|
-
"x-stability": "
|
|
159
|
+
"x-stability": "Stable"
|
|
160
160
|
}
|
|
161
161
|
},
|
|
162
162
|
"/user/basic": {
|
|
@@ -252,14 +252,14 @@
|
|
|
252
252
|
"x-stability": "Stable"
|
|
253
253
|
}
|
|
254
254
|
},
|
|
255
|
-
"/user/
|
|
255
|
+
"/user/battlestats": {
|
|
256
256
|
"get": {
|
|
257
257
|
"tags": [
|
|
258
258
|
"User"
|
|
259
259
|
],
|
|
260
|
-
"summary": "Get
|
|
261
|
-
"description": "Requires
|
|
262
|
-
"operationId": "
|
|
260
|
+
"summary": "Get your battlestats",
|
|
261
|
+
"description": "Requires limited access key. <br>",
|
|
262
|
+
"operationId": "b2395a36b6f5668ade16f460a593b236",
|
|
263
263
|
"parameters": [
|
|
264
264
|
{
|
|
265
265
|
"$ref": "#/components/parameters/ApiTimestamp"
|
|
@@ -277,7 +277,7 @@
|
|
|
277
277
|
"content": {
|
|
278
278
|
"application/json": {
|
|
279
279
|
"schema": {
|
|
280
|
-
"$ref": "#/components/schemas/
|
|
280
|
+
"$ref": "#/components/schemas/UserBattleStatsResponse"
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
}
|
|
@@ -291,14 +291,14 @@
|
|
|
291
291
|
"x-stability": "Stable"
|
|
292
292
|
}
|
|
293
293
|
},
|
|
294
|
-
"/user/
|
|
294
|
+
"/user/bounties": {
|
|
295
295
|
"get": {
|
|
296
296
|
"tags": [
|
|
297
297
|
"User"
|
|
298
298
|
],
|
|
299
|
-
"summary": "Get
|
|
300
|
-
"description": "Requires
|
|
301
|
-
"operationId": "
|
|
299
|
+
"summary": "Get bounties placed on you",
|
|
300
|
+
"description": "Requires public access key. <br>",
|
|
301
|
+
"operationId": "c85fd102a25aaec3aa98611d0da6c219",
|
|
302
302
|
"parameters": [
|
|
303
303
|
{
|
|
304
304
|
"$ref": "#/components/parameters/ApiTimestamp"
|
|
@@ -316,7 +316,7 @@
|
|
|
316
316
|
"content": {
|
|
317
317
|
"application/json": {
|
|
318
318
|
"schema": {
|
|
319
|
-
"$ref": "#/components/schemas/
|
|
319
|
+
"$ref": "#/components/schemas/UserBountiesResponse"
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
}
|
|
@@ -453,7 +453,7 @@
|
|
|
453
453
|
"api_key": []
|
|
454
454
|
}
|
|
455
455
|
],
|
|
456
|
-
"x-stability": "
|
|
456
|
+
"x-stability": "Stable"
|
|
457
457
|
}
|
|
458
458
|
},
|
|
459
459
|
"/user/{id}/competition": {
|
|
@@ -501,7 +501,7 @@
|
|
|
501
501
|
"api_key": []
|
|
502
502
|
}
|
|
503
503
|
],
|
|
504
|
-
"x-stability": "
|
|
504
|
+
"x-stability": "Stable"
|
|
505
505
|
}
|
|
506
506
|
},
|
|
507
507
|
"/user/cooldowns": {
|
|
@@ -540,7 +540,7 @@
|
|
|
540
540
|
"api_key": []
|
|
541
541
|
}
|
|
542
542
|
],
|
|
543
|
-
"x-stability": "
|
|
543
|
+
"x-stability": "Stable"
|
|
544
544
|
}
|
|
545
545
|
},
|
|
546
546
|
"/user/{crimeId}/crimes": {
|
|
@@ -717,7 +717,7 @@
|
|
|
717
717
|
"api_key": []
|
|
718
718
|
}
|
|
719
719
|
],
|
|
720
|
-
"x-stability": "
|
|
720
|
+
"x-stability": "Stable"
|
|
721
721
|
}
|
|
722
722
|
},
|
|
723
723
|
"/user/faction": {
|
|
@@ -756,7 +756,7 @@
|
|
|
756
756
|
"api_key": []
|
|
757
757
|
}
|
|
758
758
|
],
|
|
759
|
-
"x-stability": "
|
|
759
|
+
"x-stability": "Stable"
|
|
760
760
|
}
|
|
761
761
|
},
|
|
762
762
|
"/user/{id}/faction": {
|
|
@@ -804,7 +804,7 @@
|
|
|
804
804
|
"api_key": []
|
|
805
805
|
}
|
|
806
806
|
],
|
|
807
|
-
"x-stability": "
|
|
807
|
+
"x-stability": "Stable"
|
|
808
808
|
}
|
|
809
809
|
},
|
|
810
810
|
"/user/factionbalance": {
|
|
@@ -1354,7 +1354,7 @@
|
|
|
1354
1354
|
"api_key": []
|
|
1355
1355
|
}
|
|
1356
1356
|
],
|
|
1357
|
-
"x-stability": "
|
|
1357
|
+
"x-stability": "Stable"
|
|
1358
1358
|
}
|
|
1359
1359
|
},
|
|
1360
1360
|
"/user/{id}/icons": {
|
|
@@ -1402,7 +1402,7 @@
|
|
|
1402
1402
|
"api_key": []
|
|
1403
1403
|
}
|
|
1404
1404
|
],
|
|
1405
|
-
"x-stability": "
|
|
1405
|
+
"x-stability": "Stable"
|
|
1406
1406
|
}
|
|
1407
1407
|
},
|
|
1408
1408
|
"/user/itemmarket": {
|
|
@@ -1483,7 +1483,7 @@
|
|
|
1483
1483
|
"api_key": []
|
|
1484
1484
|
}
|
|
1485
1485
|
],
|
|
1486
|
-
"x-stability": "
|
|
1486
|
+
"x-stability": "Stable"
|
|
1487
1487
|
}
|
|
1488
1488
|
},
|
|
1489
1489
|
"/user/{id}/job": {
|
|
@@ -1531,7 +1531,7 @@
|
|
|
1531
1531
|
"api_key": []
|
|
1532
1532
|
}
|
|
1533
1533
|
],
|
|
1534
|
-
"x-stability": "
|
|
1534
|
+
"x-stability": "Stable"
|
|
1535
1535
|
}
|
|
1536
1536
|
},
|
|
1537
1537
|
"/user/jobpoints": {
|
|
@@ -1869,7 +1869,7 @@
|
|
|
1869
1869
|
"api_key": []
|
|
1870
1870
|
}
|
|
1871
1871
|
],
|
|
1872
|
-
"x-stability": "
|
|
1872
|
+
"x-stability": "Stable"
|
|
1873
1873
|
}
|
|
1874
1874
|
},
|
|
1875
1875
|
"/user/money": {
|
|
@@ -1950,7 +1950,7 @@
|
|
|
1950
1950
|
"api_key": []
|
|
1951
1951
|
}
|
|
1952
1952
|
],
|
|
1953
|
-
"x-stability": "
|
|
1953
|
+
"x-stability": "Stable"
|
|
1954
1954
|
}
|
|
1955
1955
|
},
|
|
1956
1956
|
"/user/newmessages": {
|
|
@@ -1989,7 +1989,7 @@
|
|
|
1989
1989
|
"api_key": []
|
|
1990
1990
|
}
|
|
1991
1991
|
],
|
|
1992
|
-
"x-stability": "
|
|
1992
|
+
"x-stability": "Stable"
|
|
1993
1993
|
}
|
|
1994
1994
|
},
|
|
1995
1995
|
"/user/notifications": {
|
|
@@ -2028,7 +2028,7 @@
|
|
|
2028
2028
|
"api_key": []
|
|
2029
2029
|
}
|
|
2030
2030
|
],
|
|
2031
|
-
"x-stability": "
|
|
2031
|
+
"x-stability": "Stable"
|
|
2032
2032
|
}
|
|
2033
2033
|
},
|
|
2034
2034
|
"/user/organizedcrime": {
|
|
@@ -2256,7 +2256,7 @@
|
|
|
2256
2256
|
"api_key": []
|
|
2257
2257
|
}
|
|
2258
2258
|
],
|
|
2259
|
-
"x-stability": "
|
|
2259
|
+
"x-stability": "Stable"
|
|
2260
2260
|
}
|
|
2261
2261
|
},
|
|
2262
2262
|
"/user/{id}/profile": {
|
|
@@ -2307,7 +2307,7 @@
|
|
|
2307
2307
|
"api_key": []
|
|
2308
2308
|
}
|
|
2309
2309
|
],
|
|
2310
|
-
"x-stability": "
|
|
2310
|
+
"x-stability": "Stable"
|
|
2311
2311
|
}
|
|
2312
2312
|
},
|
|
2313
2313
|
"/user/properties": {
|
|
@@ -2637,7 +2637,7 @@
|
|
|
2637
2637
|
"api_key": []
|
|
2638
2638
|
}
|
|
2639
2639
|
],
|
|
2640
|
-
"x-stability": "
|
|
2640
|
+
"x-stability": "Stable"
|
|
2641
2641
|
}
|
|
2642
2642
|
},
|
|
2643
2643
|
"/user/reports": {
|
|
@@ -2892,7 +2892,7 @@
|
|
|
2892
2892
|
"api_key": []
|
|
2893
2893
|
}
|
|
2894
2894
|
],
|
|
2895
|
-
"x-stability": "
|
|
2895
|
+
"x-stability": "Stable"
|
|
2896
2896
|
}
|
|
2897
2897
|
},
|
|
2898
2898
|
"/user/virus": {
|
|
@@ -2931,7 +2931,7 @@
|
|
|
2931
2931
|
"api_key": []
|
|
2932
2932
|
}
|
|
2933
2933
|
],
|
|
2934
|
-
"x-stability": "
|
|
2934
|
+
"x-stability": "Stable"
|
|
2935
2935
|
}
|
|
2936
2936
|
},
|
|
2937
2937
|
"/user/workstats": {
|
|
@@ -4484,6 +4484,9 @@
|
|
|
4484
4484
|
{
|
|
4485
4485
|
"$ref": "#/components/parameters/ApiSortDesc"
|
|
4486
4486
|
},
|
|
4487
|
+
{
|
|
4488
|
+
"$ref": "#/components/parameters/ApiLimit100Default20"
|
|
4489
|
+
},
|
|
4487
4490
|
{
|
|
4488
4491
|
"$ref": "#/components/parameters/ApiTimestamp"
|
|
4489
4492
|
},
|
|
@@ -4532,6 +4535,18 @@
|
|
|
4532
4535
|
"$ref": "#/components/schemas/FactionId"
|
|
4533
4536
|
}
|
|
4534
4537
|
},
|
|
4538
|
+
{
|
|
4539
|
+
"$ref": "#/components/parameters/ApiFrom"
|
|
4540
|
+
},
|
|
4541
|
+
{
|
|
4542
|
+
"$ref": "#/components/parameters/ApiTo"
|
|
4543
|
+
},
|
|
4544
|
+
{
|
|
4545
|
+
"$ref": "#/components/parameters/ApiSortDesc"
|
|
4546
|
+
},
|
|
4547
|
+
{
|
|
4548
|
+
"$ref": "#/components/parameters/ApiLimit100Default20"
|
|
4549
|
+
},
|
|
4535
4550
|
{
|
|
4536
4551
|
"$ref": "#/components/parameters/ApiTimestamp"
|
|
4537
4552
|
},
|
|
@@ -4568,17 +4583,26 @@
|
|
|
4568
4583
|
"Faction"
|
|
4569
4584
|
],
|
|
4570
4585
|
"summary": "Get ranked wars history for your faction",
|
|
4571
|
-
"description": "Requires public access key. <br>",
|
|
4586
|
+
"description": "Requires public access key. <br> Use offset to get older results which are always ordered descending.",
|
|
4572
4587
|
"operationId": "4f5d624a86e2d389a7a738b6b3ce8c9e",
|
|
4573
4588
|
"parameters": [
|
|
4574
4589
|
{
|
|
4575
|
-
"$ref": "#/components/parameters/
|
|
4590
|
+
"$ref": "#/components/parameters/ApiOffset"
|
|
4576
4591
|
},
|
|
4577
4592
|
{
|
|
4578
|
-
"$ref": "#/components/parameters/
|
|
4593
|
+
"$ref": "#/components/parameters/ApiLimit100Default20"
|
|
4579
4594
|
},
|
|
4580
4595
|
{
|
|
4581
|
-
"$ref": "#/components/parameters/
|
|
4596
|
+
"$ref": "#/components/parameters/ApiFrom",
|
|
4597
|
+
"description": "No longer has any impact on results."
|
|
4598
|
+
},
|
|
4599
|
+
{
|
|
4600
|
+
"$ref": "#/components/parameters/ApiTo",
|
|
4601
|
+
"description": "No longer has any impact on results."
|
|
4602
|
+
},
|
|
4603
|
+
{
|
|
4604
|
+
"$ref": "#/components/parameters/ApiSortDesc",
|
|
4605
|
+
"description": "No longer has any impact on results."
|
|
4582
4606
|
},
|
|
4583
4607
|
{
|
|
4584
4608
|
"$ref": "#/components/parameters/ApiTimestamp"
|
|
@@ -4616,7 +4640,7 @@
|
|
|
4616
4640
|
"Faction"
|
|
4617
4641
|
],
|
|
4618
4642
|
"summary": "Get a faction's ranked wars history",
|
|
4619
|
-
"description": "Requires public access key. <br> ",
|
|
4643
|
+
"description": "Requires public access key. <br> Use offset to get older results which are always ordered descending.",
|
|
4620
4644
|
"operationId": "5b6646714e5ae1cc397bdec877f55691",
|
|
4621
4645
|
"parameters": [
|
|
4622
4646
|
{
|
|
@@ -4628,6 +4652,12 @@
|
|
|
4628
4652
|
"$ref": "#/components/schemas/FactionId"
|
|
4629
4653
|
}
|
|
4630
4654
|
},
|
|
4655
|
+
{
|
|
4656
|
+
"$ref": "#/components/parameters/ApiOffset"
|
|
4657
|
+
},
|
|
4658
|
+
{
|
|
4659
|
+
"$ref": "#/components/parameters/ApiLimit100Default20"
|
|
4660
|
+
},
|
|
4631
4661
|
{
|
|
4632
4662
|
"$ref": "#/components/parameters/ApiTimestamp"
|
|
4633
4663
|
},
|
|
@@ -5174,6 +5204,18 @@
|
|
|
5174
5204
|
"$ref": "#/components/schemas/FactionId"
|
|
5175
5205
|
}
|
|
5176
5206
|
},
|
|
5207
|
+
{
|
|
5208
|
+
"$ref": "#/components/parameters/ApiFrom"
|
|
5209
|
+
},
|
|
5210
|
+
{
|
|
5211
|
+
"$ref": "#/components/parameters/ApiTo"
|
|
5212
|
+
},
|
|
5213
|
+
{
|
|
5214
|
+
"$ref": "#/components/parameters/ApiSortDesc"
|
|
5215
|
+
},
|
|
5216
|
+
{
|
|
5217
|
+
"$ref": "#/components/parameters/ApiLimit100"
|
|
5218
|
+
},
|
|
5177
5219
|
{
|
|
5178
5220
|
"$ref": "#/components/parameters/ApiTimestamp"
|
|
5179
5221
|
},
|
|
@@ -6519,6 +6561,9 @@
|
|
|
6519
6561
|
"$ref": "#/components/schemas/WeaponBonusEnum"
|
|
6520
6562
|
}
|
|
6521
6563
|
},
|
|
6564
|
+
{
|
|
6565
|
+
"$ref": "#/components/parameters/ApiLimit100Default20"
|
|
6566
|
+
},
|
|
6522
6567
|
{
|
|
6523
6568
|
"$ref": "#/components/parameters/ApiOffset"
|
|
6524
6569
|
},
|
|
@@ -7890,6 +7935,15 @@
|
|
|
7890
7935
|
"description": "Requires public access key. <br>",
|
|
7891
7936
|
"operationId": "4b7322594732b4e263f2e612f648e6a4",
|
|
7892
7937
|
"parameters": [
|
|
7938
|
+
{
|
|
7939
|
+
"$ref": "#/components/parameters/ApiLimitDefault20"
|
|
7940
|
+
},
|
|
7941
|
+
{
|
|
7942
|
+
"$ref": "#/components/parameters/ApiOffset"
|
|
7943
|
+
},
|
|
7944
|
+
{
|
|
7945
|
+
"$ref": "#/components/parameters/ApiSort"
|
|
7946
|
+
},
|
|
7893
7947
|
{
|
|
7894
7948
|
"$ref": "#/components/parameters/ApiTimestamp"
|
|
7895
7949
|
},
|
|
@@ -19868,7 +19922,8 @@
|
|
|
19868
19922
|
"disposal",
|
|
19869
19923
|
"cracking",
|
|
19870
19924
|
"forgery",
|
|
19871
|
-
"scamming"
|
|
19925
|
+
"scamming",
|
|
19926
|
+
"arson"
|
|
19872
19927
|
],
|
|
19873
19928
|
"properties": {
|
|
19874
19929
|
"search_for_cash": {
|
|
@@ -19918,6 +19973,10 @@
|
|
|
19918
19973
|
"scamming": {
|
|
19919
19974
|
"type": "integer",
|
|
19920
19975
|
"format": "int32"
|
|
19976
|
+
},
|
|
19977
|
+
"arson": {
|
|
19978
|
+
"type": "integer",
|
|
19979
|
+
"format": "int32"
|
|
19921
19980
|
}
|
|
19922
19981
|
},
|
|
19923
19982
|
"type": "object"
|
|
@@ -21888,7 +21947,8 @@
|
|
|
21888
21947
|
"disposalskill",
|
|
21889
21948
|
"crackingskill",
|
|
21890
21949
|
"forgeryskill",
|
|
21891
|
-
"scammingskill"
|
|
21950
|
+
"scammingskill",
|
|
21951
|
+
"arsonskill"
|
|
21892
21952
|
]
|
|
21893
21953
|
},
|
|
21894
21954
|
"FactionRaidReport": {
|
|
@@ -24449,7 +24509,7 @@
|
|
|
24449
24509
|
"$ref": "#/components/schemas/ItemId"
|
|
24450
24510
|
},
|
|
24451
24511
|
"is_reusable": {
|
|
24452
|
-
"description": "Shows if the item is reusable or consumed during the crime
|
|
24512
|
+
"description": "Shows if the item is reusable or consumed during the crime.<br><b>Important note: There may be alternative paths which won't consume the item, even if the item is non-reusable.</b>",
|
|
24453
24513
|
"type": "boolean"
|
|
24454
24514
|
},
|
|
24455
24515
|
"is_available": {
|
|
@@ -25866,11 +25926,11 @@
|
|
|
25866
25926
|
},
|
|
25867
25927
|
"MarketRentalsResponse": {
|
|
25868
25928
|
"required": [
|
|
25869
|
-
"
|
|
25929
|
+
"rentals",
|
|
25870
25930
|
"_metadata"
|
|
25871
25931
|
],
|
|
25872
25932
|
"properties": {
|
|
25873
|
-
"
|
|
25933
|
+
"rentals": {
|
|
25874
25934
|
"$ref": "#/components/schemas/MarketRentalDetails"
|
|
25875
25935
|
},
|
|
25876
25936
|
"_metadata": {
|
|
@@ -29254,6 +29314,17 @@
|
|
|
29254
29314
|
"minimum": 1
|
|
29255
29315
|
}
|
|
29256
29316
|
},
|
|
29317
|
+
"ApiLimitDefault20": {
|
|
29318
|
+
"name": "limit",
|
|
29319
|
+
"in": "query",
|
|
29320
|
+
"required": false,
|
|
29321
|
+
"schema": {
|
|
29322
|
+
"type": "integer",
|
|
29323
|
+
"format": "int32",
|
|
29324
|
+
"default": 20,
|
|
29325
|
+
"minimum": 1
|
|
29326
|
+
}
|
|
29327
|
+
},
|
|
29257
29328
|
"ApiTarget": {
|
|
29258
29329
|
"name": "target",
|
|
29259
29330
|
"in": "query",
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tornapi-typescript",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.2.
|
|
4
|
+
"version": "4.2.2",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"generate-types": "tsc && node build/index.js"
|
|
7
7
|
},
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@scalar/openapi-types": "^0.
|
|
10
|
-
"@types/node": "^22.18.
|
|
9
|
+
"@scalar/openapi-types": "^0.4.1",
|
|
10
|
+
"@types/node": "^22.18.10",
|
|
11
11
|
"prettier": "^3.6.2",
|
|
12
12
|
"typeconv": "^2.3.1",
|
|
13
|
-
"typescript": "^5.9.
|
|
13
|
+
"typescript": "^5.9.3"
|
|
14
14
|
},
|
|
15
15
|
"main": "./dist/index.js",
|
|
16
16
|
"types": "./dist/index.d.ts",
|