Members
baseUrl :String
API Base url. Constant
Type:
- String
- Source:
Methods
callAPI(endpoint, params, requiresAuth)
Makes a call to the GW2 API.
Parameters:
Name | Type | Description |
---|---|---|
endpoint |
||
params |
||
requiresAuth |
- Source:
Returns:
Promise
getAccount() → {Promise}
Gets account information.
- Source:
Returns:
- Type
- Promise
getAccountAchievements(autoTranslateAchievements) → {Array}
Gets Account achievements.
Parameters:
Name | Type | Description |
---|---|---|
autoTranslateAchievements |
Boolean | If this is set to true, it will automatically call the achievement endpoint to get more details as part of the return. |
- Source:
Returns:
Account achievements.
- Type
- Array
getAccountBank(autoTranslateItems) → {Promise}
Gets items from the account bank.
Parameters:
Name | Type | Description |
---|---|---|
autoTranslateItems |
Boolean | Whether or not to automatically call the item endpoint. |
- Source:
Returns:
- Type
- Promise
getAccountDyes(autoTranslateItems) → {Promise}
Gets unlocked account dyes.
Parameters:
Name | Type | Description |
---|---|---|
autoTranslateItems |
Boolean |
- Source:
Returns:
- Type
- Promise
getAccountFinishers(autoTranslate) → {Promise}
Gets the account's finishers.
Parameters:
Name | Type | Description |
---|---|---|
autoTranslate |
Boolean |
- Source:
Returns:
- Type
- Promise
getAccountMasteries(autoTranslateMasteries) → {Promise}
Gets the account's masteries.
Parameters:
Name | Type | Description |
---|---|---|
autoTranslateMasteries |
Boolean |
- Source:
Returns:
- Type
- Promise
getAccountMaterials(autoTranslateItems) → {Promise}
Gets the account's material storage.
Parameters:
Name | Type | Description |
---|---|---|
autoTranslateItems |
Boolean |
- Source:
Returns:
- Type
- Promise
getAccountMinis(autoTranslateItems) → {Promise}
Gets the account's unlocked minis.
Parameters:
Name | Type | Description |
---|---|---|
autoTranslateItems |
Boolean |
- Source:
Returns:
- Type
- Promise
getAccountSkins(autoTranslateItems) → {Promise}
Gets the account's item skins.
Parameters:
Name | Type | Description |
---|---|---|
autoTranslateItems |
Boolean |
- Source:
Returns:
- Type
- Promise
getAchievementCategories(categoryIds) → {Promise}
Gets achievement categories. Examples being "Slayer, Hero of Tyria"
Parameters:
Name | Type | Description |
---|---|---|
categoryIds |
Int | Array |
- Source:
Returns:
- Type
- Promise
getAchievementGroups(groupIds) → {Promise}
Gets achievement groups. Examples being "Heart of Thorns, Central Tyria"
Parameters:
Name | Type | Description |
---|---|---|
groupIds |
String | Array |
- Source:
Returns:
- Type
- Promise
getAchievements(achievementIds)
Gets achievements. If no ids are passed, this will return an array of all
possible achievement ids.
Parameters:
Name | Type | Description |
---|---|---|
achievementIds |
int | array |
- Source:
Returns:
Promise
getAPIKey()
Loads the API key from the local storage.
- Source:
Returns:
string
getBuildId() → {Promise}
Returns the current build id.
- Source:
Returns:
- Type
- Promise
getCache() → {boolean}
Gets the boolean cache setting.
- Source:
Returns:
- Type
- boolean
getCharacters(characterName)
Loads the characters associated with the assigned API token.
Requires authenticaion
Parameters:
Name | Type | Description |
---|---|---|
characterName |
string |
- Source:
Returns:
Promise
getColors(colorIds) → {Promise}
Gets Dye Colors. If no ids are passed, all possible ids are returned.
Parameters:
Name | Type | Description |
---|---|---|
colorIds |
int | Array |
- Source:
Returns:
- Type
- Promise
getCommerceExchange(gemOrCoin, quantity) → {Promise}
Returns the current gem buy and sell prices.
Quantity _must_ be higher than needed to buy a single coin or gem.
Parameters:
Name | Type | Description |
---|---|---|
gemOrCoin |
String | The string 'gem' for gold cost to buy gems. 'coin' for gem price for coins. |
quantity |
Int | The number of coins or gems to exchange (this is a required parameter). |
- Source:
Returns:
- Type
- Promise
getCommerceListings(itemIds) → {Promise}
Gets commerce listings. If no item ids are passed, it will return
a list of all possible ids.
Parameters:
Name | Type | Description |
---|---|---|
itemIds |
Int | Array | Either an Int or Array of items |
- Source:
Returns:
- Type
- Promise
getCommerceTransactions(current, secondLevel) → {Promise}
Gets an account's commerce transactions.
Parameters:
Name | Type | Description |
---|---|---|
current |
Boolean | If true, this will query current transactions. Otherwise it will query historical transactions. |
secondLevel |
String | Either "buys" or "Sells" |
- Source:
Returns:
- Type
- Promise
getContinents()
Returns the continents list
- Source:
Returns:
Promise
getCurrencies(currencyIds)
Gets currencies. If no ids are passed, this will return an array of all
possible material ids.
Parameters:
Name | Type | Description |
---|---|---|
currencyIds |
int | array |
- Source:
Returns:
Promise
getDailyAchievements(autoTranslate)
Gets daily achievements. This will return an object with the various achievement
categories as keys. The current keys are "wvw", "pvp", and "pve"
Parameters:
Name | Type | Description |
---|---|---|
autoTranslate |
Boolean |
- Source:
Returns:
Promise
getDeeperInfo(endpointFunc, Items, chunkSize) → {Promise}
Helper method to convert a list of ids (or objects with an id parameter)
into more useful information via the passed endpointFunc.
It chunks the array into chunkSize pieces and makes that many api calls
in parallel.
Usually used for the account calls that don't return full details on equipment,
for example.
Parameters:
Name | Type | Description |
---|---|---|
endpointFunc |
function | The function to call to get more details. Must be in the GW2API object and must return a promise. |
Items |
Array | An array of items to transform. Either an array of ints or objects. |
chunkSize |
Int | How large each batch call should be. Defaults to 100. |
- Source:
Returns:
- Type
- Promise
getEmblems(foreOrBack, assetIds) → {Promise}
Returns the assets required to render emblems.
Parameters:
Name | Type | Description |
---|---|---|
foreOrBack |
String | Either the string "foregrounds" or "backgrounds" |
assetIds |
Int | Array |
- Source:
Returns:
- Type
- Promise
getFiles(fileIds) → {Promise}
Returns commonly requested files.
Parameters:
Name | Type | Description |
---|---|---|
fileIds |
String | Array | Either a string file id or an array of ids. |
- Source:
Returns:
- Type
- Promise
getFinishers(finisherIds) → {Promise}
Loads Finishers
Parameters:
Name | Type | Description |
---|---|---|
finisherIds |
Array.<number> |
- Source:
Returns:
- Type
- Promise
getGuildPermissions(permissionIds) → {Promise}
Gets info about guild permissions (unauthenticated).
Parameters:
Name | Type | Description |
---|---|---|
permissionIds |
String | Array |
- Source:
Returns:
- Type
- Promise
getGuildUpgrades(upgradeIds) → {Promise}
Gets info about guild upgrades (unauthenticated).
Parameters:
Name | Type | Description |
---|---|---|
upgradeIds |
Int | Array |
- Source:
Returns:
- Type
- Promise
getItems(itemIds)
Gets a list of items. If no ids are passed, you'll get an array of all ids back.
Parameters:
Name | Type | Description |
---|---|---|
itemIds |
int | array |
- Source:
Returns:
Promise
getLang() → {string}
Gets the current language, which some api endpoints use.
- Source:
Returns:
langcode
- Type
- string
getMasteries(masteryIds) → {Promise}
Loads Masteries
Parameters:
Name | Type | Description |
---|---|---|
masteryIds |
Array.<number> |
- Source:
Returns:
- Type
- Promise
getMaterials(materialIds)
Gets materials. If no ids are passed, this will return an array of all
possible material ids.
Parameters:
Name | Type | Description |
---|---|---|
materialIds |
int | array |
- Source:
Returns:
Promise
getMinis(miniIds) → {Promise}
Gets minis. If no ids are passed, this will return an array of all
possible mini ids.
Parameters:
Name | Type | Description |
---|---|---|
miniIds |
Int | Array |
- Source:
Returns:
- Type
- Promise
getOneOrMany(string, mixed, boolean)
Helper function to do the common endpoint/{id} or ?ids={}
Parameters:
Name | Type | Description |
---|---|---|
string |
endpoint | |
mixed |
ids | |
boolean |
requiresAuth |
- Source:
Returns:
Promise
getProfessionSkills(profession, skillType, includeBundles) → {Promise}
[Helper Method] Gets skills for a particular profession.
Parameters:
Name | Type | Description |
---|---|---|
profession |
String | The string key to match profession on. |
skillType |
String | |
includeBundles |
Boolean |
- Source:
Returns:
- Type
- Promise
getProfessionSpecializations(profession) → {Promise}
Gets a list of profession specializations.
Parameters:
Name | Type | Description |
---|---|---|
profession |
String | Profession name. Remember to uppercase the first letter. |
- Source:
Returns:
- Type
- Promise
getPVPGames(gameIds) → {Promise}
Gets PVP Game details. If ids are not passed a list of all game ids
are returned.
Parameters:
Name | Type | Description |
---|---|---|
gameIds |
String | Array |
- Source:
Returns:
- Type
- Promise
getPVPStats() → {Promise}
Gets overall account pvp statistics.
- Source:
Returns:
- Type
- Promise
getQuaggans(quagganIds) → {Promise}
Returns a list of Quaggans!
Parameters:
Name | Type | Description |
---|---|---|
quagganIds |
String | Array |
- Source:
Returns:
- Type
- Promise
getRecipes(recipeIds)
Gets recipes. If no ids are passed, this will return an array of all
possible recipe ids.
Parameters:
Name | Type | Description |
---|---|---|
recipeIds |
int | array |
- Source:
Returns:
Promise
getSkills(skillIds) → {Promise}
Gets skills. If no ids are passed, this will return an array of all possible
skills.
Parameters:
Name | Type | Description |
---|---|---|
skillIds |
int | array |
- Source:
Returns:
- Type
- Promise
getSkins(skinIds) → {Promise}
Gets Skins. If no ids are passed, this returns an array of all skins.
Parameters:
Name | Type | Description |
---|---|---|
skinIds |
Int | Array |
- Source:
Returns:
- Type
- Promise
getSpecializations(specializationIds) → {Promise}
Gets Specializations. If no ids are passed this will return an array of all
ids.
Parameters:
Name | Type | Description |
---|---|---|
specializationIds |
Int | Array |
- Source:
Returns:
- Type
- Promise
getStorage() → {object}
Gets the storage solution.
- Source:
Returns:
Storage solution.
- Type
- object
getTokenInfo() → {Promise}
Returns info about a given token. This token must be first set via
this.setAPIKey.
- Source:
Returns:
- Type
- Promise
getTraits(traitIds) → {Promise}
Gets a list of traits from the passed ids. If no traitIds are passed
all trait ids are returned.
Parameters:
Name | Type | Description |
---|---|---|
traitIds |
Int | Array |
- Source:
Returns:
- Type
- Promise
getUseAuthHeader() → {boolean}
Getter for useAuthHeader.
- Source:
Returns:
- Type
- boolean
getWallet(handleCurrencyTranslation)
Gets the wallet information associated with the current API token.
Parameters:
Name | Type | Description |
---|---|---|
handleCurrencyTranslation |
boolean |
- Source:
Returns:
Promise
getWVWMatches(worldId, matchIds) → {Promise}
Gets WVW Matches.
Parameters:
Name | Type | Description |
---|---|---|
worldId |
Int | A world who's id is participating in the match. |
matchIds |
String | Array | String match id, or an array of match ids. |
- Source:
Returns:
- Type
- Promise
getWVWObjectives(objectiveIds) → {Promise}
Gets WVW Objectives
Parameters:
Name | Type | Description |
---|---|---|
objectiveIds |
String | Array |
- Source:
Returns:
- Type
- Promise
searchRecipes(inputItem, outputItem) → {Promise}
Searches for recipes which match an item id. inputItem and outputItem
are mutually exclusive.
Parameters:
Name | Type | Description |
---|---|---|
inputItem |
Int | Search for recipes containing this item. |
outputItem |
Int | Search for recipes which will produce this item. |
- Source:
Returns:
- Type
- Promise
setAPIKey(key)
Stores the API key in storage.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | API Key to use for requests. |
- Source:
Returns:
this
setCache(cache)
Turns caching on or off.
Parameters:
Name | Type | Description |
---|---|---|
cache |
boolean | Enable or disable cache. |
- Source:
setLang(langCode)
Sets the language code. Should be the ISO code (en_US for example).
Parameters:
Name | Type | Description |
---|---|---|
langCode |
string | Target language code. |
- Source:
Returns:
this
setStorage(storage)
Set the storage solution.
The solution should have a getItem and setItem method, but can be anything.
Parameters:
Name | Type | Description |
---|---|---|
storage |
object | Storage solution. Defaults to localStorage if available. Null if not. |
- Source:
setStoreInCache(storeInCache)
Enables or disables storing API results in cache.
This is distinct from setCache, which turns all caching on or off.
This setting would be used to update the cache but not actually return
the results.
Parameters:
Name | Type | Description |
---|---|---|
storeInCache |
boolean | Whether or not to store results in cache. |
- Source:
setUseAuthHeader(useAuthHeader) → {GW2API}
Setter for the useAuthHeader property.
Typically you'll set this to false if you're in a browser
because the API doesn't support OPTIONS.
Parameters:
Name | Type | Description |
---|---|---|
useAuthHeader |
boolean |
- Source:
Returns:
- Type
- GW2API