Socket
Socket
Sign inDemoInstall

steamapi

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

steamapi - npm Package Compare versions

Comparing version 2.3.1 to 2.4.1

src/structures/OwnedGame.js

2

index.js

@@ -1,1 +0,1 @@

module.exports = require('./src/SteamAPI');
module.exports = require('./src/SteamAPI');

@@ -6,6 +6,17 @@ {

"main": "index.js",
"version": "2.3.1",
"version": "2.4.1",
"license": "MIT",
"eslintConfig": {
"extends": "eslint-config-dim"
"extends": "eslint-config-dim",
"env": {
"node": true,
"browser": true
},
"parserOptions": {
"ecmaVersion": "latest"
},
"rules": {
"eol-last": ["error", "always"],
"no-shadow": "off"
}
},

@@ -12,0 +23,0 @@ "keywords": [

@@ -8,3 +8,3 @@ ## SteamAPI

<a href="https://www.npmjs.com/package/steamapi"><img src="https://img.shields.io/npm/v/steamapi.svg?maxAge=3600" alt="NPM" /></a>
<a href="https://discord.dim.codes"><img src="https://img.shields.io/discord/204352669731520512.svg?maxAge=3600" alt="Discord" /></a>
<a href="https://discord.gg/6d698nhnKx"><img src="https://img.shields.io/discord/204352669731520512.svg?maxAge=3600" alt="Discord" /></a>
</p>

@@ -84,7 +84,7 @@ </div>

* [.getUserLevel(id)](#SteamAPI+getUserLevel) ⇒ <code>Promise.&lt;number&gt;</code>
* [.getUserOwnedGames(id, [includeF2P])](#SteamAPI+getUserOwnedGames) ⇒ <code>Promise.&lt;Array.&lt;Game&gt;&gt;</code>
* [.getUserRecentGames(id, [count])](#SteamAPI+getUserRecentGames) ⇒ <code>Promise.&lt;Array.&lt;RecentGame&gt;&gt;</code>
* [.getUserOwnedGames(id, [includeF2P])](#SteamAPI+getUserOwnedGames) ⇒ <code>Promise.&lt;Array.&lt;OwnedGame&gt;&gt;</code>
* [.getUserRecentGames(id, [count])](#SteamAPI+getUserRecentGames) ⇒ <code>Promise.&lt;Array.&lt;Game&gt;&gt;</code>
* [.getUserServers([hide], [key])](#SteamAPI+getUserServers) ⇒ <code>Promise.&lt;PlayerServers&gt;</code>
* [.getUserStats(id, app)](#SteamAPI+getUserStats) ⇒ <code>Promise.&lt;PlayerStats&gt;</code>
* [.getUserSummary(id)](#SteamAPI+getUserSummary) ⇒ <code>Promise.&lt;PlayerSummary&gt;</code>
* [.getUserSummary(id)](#SteamAPI+getUserSummary) ⇒ <code>Promise.&lt;(PlayerSummary\|Array.&lt;PlayerSummary&gt;)&gt;</code>

@@ -256,3 +256,3 @@ <a name="new_SteamAPI_new"></a>

### steamAPI.getUserBans(id) ⇒ <code>Promise.&lt;(PlayerBans\|Array.&lt;PlayerBans&gt;)&gt;</code>
Get users bans.
Get users bans. If an array of IDs is passed in, this returns an array of PlayerBans

@@ -304,7 +304,7 @@ **Kind**: instance method of [<code>SteamAPI</code>](#SteamAPI)

### steamAPI.getUserOwnedGames(id, [includeF2P]) ⇒ <code>Promise.&lt;Array.&lt;Game&gt;&gt;</code>
### steamAPI.getUserOwnedGames(id, [includeF2P]) ⇒ <code>Promise.&lt;Array.&lt;OwnedGame&gt;&gt;</code>
Get users owned games.
**Kind**: instance method of [<code>SteamAPI</code>](#SteamAPI)
**Returns**: <code>Promise.&lt;Array.&lt;Game&gt;&gt;</code> - Owned games
**Returns**: <code>Promise.&lt;Array.&lt;OwnedGame&gt;&gt;</code> - Owned games

@@ -318,7 +318,7 @@ | Param | Type | Default | Description |

### steamAPI.getUserRecentGames(id, [count]) ⇒ <code>Promise.&lt;Array.&lt;RecentGame&gt;&gt;</code>
### steamAPI.getUserRecentGames(id, [count]) ⇒ <code>Promise.&lt;Array.&lt;Game&gt;&gt;</code>
Get users recent games.
**Kind**: instance method of [<code>SteamAPI</code>](#SteamAPI)
**Returns**: <code>Promise.&lt;Array.&lt;RecentGame&gt;&gt;</code> - Recent games
**Returns**: <code>Promise.&lt;Array.&lt;Game&gt;&gt;</code> - Recent games

@@ -358,10 +358,10 @@ | Param | Type | Description |

### steamAPI.getUserSummary(id) ⇒ <code>Promise.&lt;PlayerSummary&gt;</code>
Get users summary.
### steamAPI.getUserSummary(id) ⇒ <code>Promise.&lt;(PlayerSummary\|Array.&lt;PlayerSummary&gt;)&gt;</code>
Get users summary. If an array of IDs is passed in, this returns an array of PlayerSummary
**Kind**: instance method of [<code>SteamAPI</code>](#SteamAPI)
**Returns**: <code>Promise.&lt;PlayerSummary&gt;</code> - Summary
**Returns**: <code>Promise.&lt;(PlayerSummary\|Array.&lt;PlayerSummary&gt;)&gt;</code> - Summary
| Param | Type | Description |
| --- | --- | --- |
| id | <code>string</code> | User ID |
| id | <code>string</code> \| <code>Array.&lt;string&gt;</code> | User ID(s) |

@@ -9,3 +9,3 @@ const SteamID = require('steamid');

const PlayerBans = require('./structures/PlayerBans');
const RecentGame = require('./structures/RecentGame');
const OwnedGame = require('./structures/OwnedGame');
const Friend = require('./structures/Friend');

@@ -118,3 +118,3 @@ const Server = require('./structures/Server');

? this.resolveCache.set(id, json.response.steamid).get(id)
: Promise.reject(new TypeError(json.response.message))
: Promise.reject(new TypeError(json.response.message)),
);

@@ -189,3 +189,3 @@ }

? json[app].data
: Promise.reject(new Error('No app found'))
: Promise.reject(new Error('No app found')),
);

@@ -255,3 +255,3 @@ const key = `${app}-${region.toLowerCase()}`;

? json.response.servers.map(server => new Server(server))
: Promise.reject(new Error(json.response.message))
: Promise.reject(new Error(json.response.message)),
);

@@ -274,3 +274,3 @@ }

? new PlayerAchievements(json.playerstats)
: Promise.reject(new Error(json.playerstats.message))
: Promise.reject(new Error(json.playerstats.message)),
);

@@ -293,3 +293,3 @@ }

/**
* Get users bans.
* Get users bans. If an array of IDs is passed in, this returns an array of PlayerBans
* @param {string|string[]} id User ID(s)

@@ -308,3 +308,3 @@ * @returns {Promise<PlayerBans|PlayerBans[]>} Ban info

: new PlayerBans(json.players[0])
: Promise.reject(new Error('No players found'))
: Promise.reject(new Error('No players found')),
);

@@ -338,3 +338,3 @@ }

? json.response.groups.map(group => group.gid)
: Promise.reject(new Error(json.response.message))
: Promise.reject(new Error(json.response.message)),
);

@@ -360,3 +360,3 @@ }

* @param {boolean} [includeF2P=true] Whether to include user's free-to-play games or not
* @returns {Promise<Game[]>} Owned games
* @returns {Promise<OwnedGame[]>} Owned games
*/

@@ -368,3 +368,3 @@ getUserOwnedGames(id, includeF2P = true) {

.get(`/IPlayerService/GetOwnedGames/v1?steamid=${id}${includeF2P ? '&include_played_free_games=1' : ''}&include_appinfo=1`)
.then(json => json.response.games ? json.response.games.map(game => new Game(game)) : Promise.reject(new Error('No games found')));
.then(json => json.response.games ? json.response.games.map(game => new OwnedGame(game)) : Promise.reject(new Error('No games found')));
}

@@ -376,3 +376,3 @@

* @param {number} [count] Optionally limit the number of games to fetch to some number
* @returns {Promise<RecentGame[]>} Recent games
* @returns {Promise<Game[]>} Recent games
*/

@@ -386,3 +386,3 @@ getUserRecentGames(id, count) {

.get(`/IPlayerService/GetRecentlyPlayedGames/v1?steamid=${id}${count ? `&count=${count}` : ''}`)
.then(json => json.response.total_count ? json.response.games.map(game => new RecentGame(game)) : []);
.then(json => json.response.total_count ? json.response.games.map(game => new Game(game)) : []);
}

@@ -418,5 +418,5 @@

/**
* Get users summary.
* @param {string} id User ID
* @returns {Promise<PlayerSummary>} Summary
* Get users summary. If an array of IDs is passed in, this returns an array of PlayerSummary
* @param {string|string[]} id User ID(s)
* @returns {Promise<PlayerSummary|PlayerSummary[]>} Summary
*/

@@ -433,3 +433,3 @@ getUserSummary(id) {

: new PlayerSummary(json.response.players[0])
: Promise.reject(new Error('No players found'))
: Promise.reject(new Error('No players found')),
);

@@ -436,0 +436,0 @@ }

@@ -19,2 +19,2 @@ class Achievement {

module.exports = Achievement;
module.exports = Achievement;

@@ -22,2 +22,2 @@ class Badge {

module.exports = Badge;
module.exports = Badge;

@@ -20,2 +20,2 @@ const Player = require('./Player');

module.exports = Friend;
module.exports = Friend;

@@ -1,2 +0,4 @@

const cdn = 'https://steamcdn-a.akamaihd.net/steamcommunity/public/images/apps';
const appBase = 'https://steamcdn-a.akamaihd.net/steam/apps';
const communityBase = 'https://steamcdn-a.akamaihd.net/steamcommunity/public/images/apps';
const cfBase = 'https://cdn.cloudflare.steamstatic.com/steam/apps';

@@ -9,7 +11,31 @@ class Game {

this.playTime2 = game.playtime_2weeks || 0;
this.logoURL = `${cdn}/${game.appid}/${game.img_logo_url}.jpg`;
this.iconURL = `${cdn}/${game.appid}/${game.img_icon_url}.jpg`;
// img_logo_url used to be a part of the api, now removed, but still documented
this.logoURL = game.img_logo_url ? `${communityBase}/${this.appID}/${game.img_logo_url}.jpg` : null;
// tiny app icon
this.iconURL = `${communityBase}/${this.appID}/${game.img_icon_url}.jpg`;
// Some of the following URLs aren't guaranteed to exist
// large sized header used on the store page
this.headerURL = `${cfBase}/${this.appID}/header.jpg`;
// medium sized header image
this.headerMediumURL = `${cfBase}/${this.appID}/capsule_231x87.jpg`;
// small header image used on user pages
this.smallHeaderURL = `${cfBase}/${this.appID}/capsule_184x69.jpg`;
// tiny header image used on app bundles
this.tinyHeaderURL = `${cfBase}/${this.appID}/capsule_sm_120.jpg`;
// the following URLs are courtesy of
// https://www.reddit.com/r/steamgrid/comments/d6ha6f/universal_link_for_downloading_games_cover/
// game page background
this.backgroundURL = `${appBase}/${this.appID}/library_hero.jpg`;
// game cover
this.backgroundURL = `${appBase}/${this.appID}/library_600x900_2x.jpg`;
// large transparent logo that appears in user's library
this.logoURL = `${appBase}/${this.appID}/logo.png`;
}
}
module.exports = Game;
module.exports = Game;

@@ -29,2 +29,2 @@ class GameServer {

module.exports = GameServer;
module.exports = GameServer;

@@ -11,2 +11,2 @@ class Player {

module.exports = Player;
module.exports = Player;

@@ -13,2 +13,2 @@ const Achievement = require('./Achievement');

module.exports = PlayerAchievements;
module.exports = PlayerAchievements;

@@ -13,2 +13,2 @@ const Badge = require('./Badge');

module.exports = PlayerBadges;
module.exports = PlayerBadges;

@@ -24,2 +24,2 @@ const Player = require('./Player');

module.exports = PlayerBans;
module.exports = PlayerBans;

@@ -35,2 +35,2 @@ const GameServer = require('./GameServer');

module.exports = PlayerServers;
module.exports = PlayerServers;

@@ -16,2 +16,2 @@ const Player = require('./Player');

module.exports = PlayerStats;
module.exports = PlayerStats;

@@ -48,2 +48,2 @@ const Player = require('./Player');

module.exports = PlayerSummary;
module.exports = PlayerSummary;

@@ -15,2 +15,2 @@ class Server {

module.exports = Server;
module.exports = Server;

@@ -18,2 +18,2 @@ /**

return object;
};
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc