Comparing version 2.4.2 to 2.5.0
@@ -6,3 +6,3 @@ { | ||
"main": "index.js", | ||
"version": "2.4.2", | ||
"version": "2.5.0", | ||
"license": "MIT", | ||
@@ -9,0 +9,0 @@ "eslintConfig": { |
@@ -72,3 +72,3 @@ ## SteamAPI | ||
* [.getGameAchievements(app)](#SteamAPI+getGameAchievements) ⇒ <code>Promise.<Object></code> | ||
* [.getGameDetails(app, [force], [region])](#SteamAPI+getGameDetails) ⇒ <code>Promise.<Object></code> | ||
* [.getGameDetails(app, [force], [region], [language])](#SteamAPI+getGameDetails) ⇒ <code>Promise.<Object></code> | ||
* [.getGameNews(app)](#SteamAPI+getGameNews) ⇒ <code>Promise.<Array.<Object>></code> | ||
@@ -166,5 +166,7 @@ * [.getGamePlayers(app)](#SteamAPI+getGamePlayers) ⇒ <code>Promise.<number></code> | ||
### steamAPI.getGameDetails(app, [force], [region]) ⇒ <code>Promise.<Object></code> | ||
### steamAPI.getGameDetails(app, [force], [region], [language]) ⇒ <code>Promise.<Object></code> | ||
Get details for app id. | ||
<warn>Requests for this endpoint are limited to 200 every 5 minutes</warn> | ||
<warn>Not every `region` is supported. Only the following are valid: `us, ca, cc, es, de, fr, ru, nz, au, uk`.</warn> | ||
<warn>Not every `language` is supported. A list of available languages can be found [here](https://www.ibabbleon.com/Steam-Supported-Languages-API-Codes.html).</warn> | ||
@@ -178,3 +180,4 @@ **Kind**: instance method of [<code>SteamAPI</code>](#SteamAPI) | ||
| [force] | <code>boolean</code> | <code>false</code> | Overwrite cache | | ||
| [region] | <code>string</code> | <code>"us"</code> | Store region | | ||
| [region] | <code>string</code> | <code>"us"</code> | Currency region | | ||
| [language] | <code>string</code> | <code>"english"</code> | Description language | | ||
@@ -181,0 +184,0 @@ <a name="SteamAPI+getGameNews"></a> |
@@ -17,3 +17,4 @@ const SteamID = require('steamid'); | ||
const { version, name } = require('../package.json'); | ||
const regions = ['us', 'ca', 'cc', 'es', 'de', 'fr', 'ru', 'nz', 'au', 'uk']; | ||
const allowedRegions = ['us', 'ca', 'cc', 'es', 'de', 'fr', 'ru', 'nz', 'au', 'uk']; | ||
const allowedLanguages = ['arabic', 'bulgarian', 'schinese', 'tchinese', 'czech', 'danish', 'dutch', 'english', 'finnish', 'french', 'german', 'greek', 'hungarian', 'italian', 'japanese', 'koreana', 'norwegian', 'polish', 'brazilian', 'portuguese', 'romanian', 'russian', 'latam', 'spanish', 'swedish', 'thai', 'turkish', 'ukrainian', 'vietnamese']; | ||
const reApp = /^\d{1,7}$/; | ||
@@ -175,13 +176,17 @@ const reID = /^\d{17}$/; | ||
* <warn>Requests for this endpoint are limited to 200 every 5 minutes</warn> | ||
* <warn>Not every `region` is supported. Only the following are valid: `us, ca, cc, es, de, fr, ru, nz, au, uk`.</warn> | ||
* <warn>Not every `language` is supported. A list of available languages can be found [here](https://www.ibabbleon.com/Steam-Supported-Languages-API-Codes.html).</warn> | ||
* @param {string} app App ID | ||
* @param {boolean} [force=false] Overwrite cache | ||
* @param {string} [region=us] Store region | ||
* @param {string} [region=us] Currency region | ||
* @param {string} [language=english] Description language | ||
* @returns {Promise<Object>} App details for ID | ||
*/ | ||
getGameDetails(app, force = false, region = 'us') { | ||
getGameDetails(app, force = false, region = 'us', language = 'english') { | ||
if (!reApp.test(app)) return Promise.reject(TypeError('Invalid/no app provided')); | ||
if (!regions.includes(region)) return Promise.reject(TypeError('Invalid region provided')); | ||
if (!allowedRegions.includes(region)) return Promise.reject(TypeError('Invalid region provided')); | ||
if (!allowedLanguages.includes(language)) return Promise.reject(TypeError('Invalid language provided')); | ||
const request = () => this | ||
.get(`/appdetails?appids=${app}&cc=${region}`, this.baseStore) | ||
.get(`/appdetails?appids=${app}&cc=${region}&l=${language}`, this.baseStore) | ||
.then(json => json[app].success | ||
@@ -191,4 +196,5 @@ ? json[app].data | ||
); | ||
const key = `${app}-${region.toLowerCase()}`; | ||
const key = `${app}-${region}-${language}`; | ||
if (!force && this.options.enabled && this.cache.has(key) && this.cache.get(key)[0] > Date.now()) | ||
@@ -195,0 +201,0 @@ return Promise.resolve(this.cache.get(key)[1]); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40835
687
365