poe-js-sdk
Version:
TypeScript SDK for the Path of Exile API
234 lines • 8.19 kB
TypeScript
import { Profile, League, Character, StashTab, PvpMatch, LeagueAccount, RateLimitInfo, Realm, Ladder, EventLadderEntry, PvPLadderTeamEntry } from '../types';
/**
* Configuration for {@link PoEApiClient}.
*/
export interface ClientConfig {
accessToken?: string;
userAgent: string;
baseURL?: string;
}
/**
* Official Path of Exile API client (PoE1 + limited PoE2).
*
* - Respects server rate limits automatically (parses X-Rate-Limit headers and Retry-After)
* - Requires a compliant User-Agent (e.g. `OAuth myapp/1.0.0 (contact: you@example.com)`)
* - Returns typed envelopes that mirror the official docs
*
* @see https://www.pathofexile.com/developer/docs/reference
* @see https://www.pathofexile.com/developer/docs/index#ratelimits
*/
export declare class PoEApiClient {
private client;
private rateLimitInfo;
private nextAvailableAt;
/**
* Create a new PoE API client.
* @param config Client configuration (User-Agent required)
*/
constructor(config: ClientConfig);
private updateRateLimitInfo;
/**
* Get the latest parsed rate limit header values.
* Includes optional `*-State` and `Retry-After` values when present.
*/
getRateLimitInfo(): RateLimitInfo;
/**
* Update the access token used for Authorization header (Bearer scheme).
*/
setAccessToken(token: string): void;
private updateWaitFromHeaders;
/**
* Get account profile.
* @see https://www.pathofexile.com/developer/docs/reference#profile
*/
getProfile(): Promise<Profile>;
/**
* List leagues.
* @see https://www.pathofexile.com/developer/docs/reference#leagues-list
*/
getLeagues(realmOrOptions?: Realm | {
realm?: Realm;
type?: 'main' | 'event' | 'season';
season?: string;
limit?: number;
offset?: number;
}): Promise<{
leagues: League[];
}>;
/**
* Get a specific league by id.
* @see https://www.pathofexile.com/developer/docs/reference#leagues-get
*/
getLeague(leagueId: string, realm?: Realm): Promise<{
league: League | null;
}>;
/**
* Get league ladder (PoE1 only).
* @see https://www.pathofexile.com/developer/docs/reference#leagues-ladder
*/
getLeagueLadder(leagueId: string, options?: {
realm?: Exclude<Realm, 'poe2'>;
offset?: number;
limit?: number;
sort?: 'xp' | 'depth' | 'depthsolo' | 'ancestor' | 'time' | 'score' | 'class';
class?: 'scion' | 'marauder' | 'ranger' | 'witch' | 'duelist' | 'templar' | 'shadow';
}): Promise<{
league: League;
ladder: Ladder;
}>;
/**
* Get league event ladder (PoE1 only).
* @see https://www.pathofexile.com/developer/docs/reference#leagues-event-ladder
*/
getLeagueEventLadder(leagueId: string, options?: {
realm?: Exclude<Realm, 'poe2'>;
offset?: number;
limit?: number;
}): Promise<{
league: League;
ladder: {
total: number;
entries: EventLadderEntry[];
};
}>;
/**
* List account characters.
* @see https://www.pathofexile.com/developer/docs/reference#characters-list
*/
getCharacters(realm?: Realm): Promise<{
characters: Character[];
}>;
/**
* Get a character by name with equipment, inventory, and passives.
* @see https://www.pathofexile.com/developer/docs/reference#characters-get
*/
getCharacter(name: string, realm?: Realm): Promise<{
character: Character | null;
}>;
/**
* List account stash tabs for a league (PoE1 only).
* @see https://www.pathofexile.com/developer/docs/reference#stashes-list
*/
getStashes(league: string, realm?: Exclude<Realm, 'poe2'>): Promise<{
stashes: StashTab[];
}>;
/**
* Get a specific stash or substash (PoE1 only).
* @see https://www.pathofexile.com/developer/docs/reference#stashes-get
*/
getStash(league: string, stashId: string, substashId?: string, realm?: Realm): Promise<{
stash: StashTab | null;
}>;
/**
* Get league account info such as atlas passives (PoE1 only).
* @see https://www.pathofexile.com/developer/docs/reference#leagueaccounts
*/
getLeagueAccount(league: string, realm?: Realm): Promise<{
league_account: LeagueAccount;
}>;
/**
* List PvP matches (PoE1 only).
* @see https://www.pathofexile.com/developer/docs/reference#matches-list
*/
getPvpMatches(realmOrOptions?: Realm | {
realm?: Exclude<Realm, 'poe2'>;
type?: 'upcoming' | 'season' | 'league';
season?: string;
league?: string;
}): Promise<{
matches: PvpMatch[];
}>;
/**
* Get a PvP match by id (PoE1 only).
* @see https://www.pathofexile.com/developer/docs/reference#matches-get
*/
getPvpMatch(matchId: string, realm?: Realm): Promise<{
match: PvpMatch | null;
}>;
/**
* Get PvP match ladder (PoE1 only).
* @see https://www.pathofexile.com/developer/docs/reference#matches-ladder
*/
getPvpMatchLadder(matchId: string, options?: {
realm?: Exclude<Realm, 'poe2'>;
limit?: number;
offset?: number;
}): Promise<{
match: PvpMatch;
ladder: {
total: number;
entries: PvPLadderTeamEntry[];
};
}>;
/**
* Get public stashes stream page (PoE1 only).
* @see https://www.pathofexile.com/developer/docs/reference#publicstashes-list
*/
getPublicStashes(options?: {
realm?: Realm;
id?: string;
}): Promise<import('../types').PublicStashesResponse>;
/**
* Get currency exchange markets history.
* @see https://www.pathofexile.com/developer/docs/reference#currencyexchange-list
*/
getCurrencyExchange(realm?: Exclude<Realm, 'pc'> | 'poe2', id?: string): Promise<import('../types').CurrencyExchangeResponse>;
/**
* List item filters on the account.
* @see https://www.pathofexile.com/developer/docs/reference#itemfilters-list
*/
getItemFilters(): Promise<{
filters: import('../types').ItemFilter[];
}>;
/**
* Get an item filter by id.
* @see https://www.pathofexile.com/developer/docs/reference#itemfilters-get
*/
getItemFilter(filterId: string): Promise<{
filter: import('../types').ItemFilter;
}>;
/**
* Create an item filter. Optionally validate against current game version.
* @see https://www.pathofexile.com/developer/docs/reference#itemfilters-post
*/
createItemFilter(filter: Partial<import('../types').ItemFilter> & {
filter_name: string;
realm: string;
filter: string;
}, options?: {
validate?: boolean;
}): Promise<{
filter: import('../types').ItemFilter;
}>;
/**
* Update an item filter (partial). Optionally validate.
* @see https://www.pathofexile.com/developer/docs/reference#itemfilters-patch
*/
updateItemFilter(filterId: string, patch: Partial<import('../types').ItemFilter>, options?: {
validate?: boolean;
}): Promise<{
filter: import('../types').ItemFilter;
}>;
/**
* Get account leagues including private (PoE1 only).
* @see https://www.pathofexile.com/developer/docs/reference#accountleagues-list
*/
getAccountLeagues(realm?: Exclude<Realm, 'poe2'>): Promise<{
leagues: League[];
}>;
/**
* List guild stash tabs for a league (PoE1 only; special scope required).
* @see https://www.pathofexile.com/developer/docs/reference#guildstashes-list
*/
getGuildStashes(league: string, realm?: Exclude<Realm, 'poe2'>): Promise<{
stashes: StashTab[];
}>;
/**
* Get a guild stash or substash (PoE1 only; special scope required).
* @see https://www.pathofexile.com/developer/docs/reference#guildstashes-get
*/
getGuildStash(league: string, stashId: string, substashId?: string, realm?: Exclude<Realm, 'poe2'>): Promise<{
stash: StashTab | null;
}>;
}
//# sourceMappingURL=api-client.d.ts.map