Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xDimGG/node-steamapi
An object-oriented Steam API wrapper for Node.js developers.
https://github.com/xDimGG/node-steamapi
api-wrapper node nodejs object-oriented promise steam-api
Last synced: 3 months ago
JSON representation
An object-oriented Steam API wrapper for Node.js developers.
- Host: GitHub
- URL: https://github.com/xDimGG/node-steamapi
- Owner: xDimGG
- Created: 2017-08-30T03:45:42.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-06-30T02:46:15.000Z (4 months ago)
- Last Synced: 2024-07-28T18:14:26.607Z (3 months ago)
- Topics: api-wrapper, node, nodejs, object-oriented, promise, steam-api
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/steamapi
- Size: 246 KB
- Stars: 177
- Watchers: 10
- Forks: 43
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-steam - steamapi - A nice Steam API wrapper. (Packages / Node.js)
README
## SteamAPI
## Documentation
A list of all the methods SteamAPI provides is available [here](https://github.com/xDimGG/node-steamapi/blob/master/docs/classes/default.md#methods).## Breaking changes from 2.x to 3.x
- CommonJS Modules -> ES Modules
- Import using `import` statement instead of `require()`
- SteamAPI constructor now takes false as the first parameter if you don't want to supply a key
- Options for constructor have changes from `{ enabled, expires, disableWarnings }` to `{ language, currency, headers, baseAPI, baseStore, baseActions, inMemoryCacheEnabled, gameDetailCacheEnabled, gameDetailCacheTTL, userResolveCacheEnabled, userResolveCacheTTL }`
- Custom caching may be enabled by setting `inMemoryCacheEnabled: false` and setting `.gameDetailCache`/`.userResolveCache`. Must implement `CacheMap` interface in src/Cache.ts
- getFeaturedGames() returns object instead of array
- Server#game -> Server#gameDir
- App IDs are passed as numbers not strings (although a string will probably still work)
- Any other changes to the API can be found in https://github.com/xDimGG/node-steamapi/blob/master/PORT.md## Setup
### Installation
```
npm i steamapi
```
### Getting an API Key
Once signed into Steam, head over to http://steamcommunity.com/dev/apikey to generate an API key.
### Usage
First, we start by making a SteamAPI "user".
```js
import SteamAPI from 'steamapi';const steam = new SteamAPI('steam token');
```
Now, we can call methods on the `steam` object.For example, let's retrieve the SteamID64 of a user. SteamAPI provides a `resolve` method, which accepts URLs and IDs.
```js
steam.resolve('https://steamcommunity.com/id/DimGG').then(id => {
console.log(id); // 76561198146931523
});
```
Now let's take that ID, and fetch the user's profile.
```js
steam.getUserSummary('76561198146931523').then(summary => {
console.log(summary);
/**
UserSummary {
steamID: '76561198146931523',
avatar: {
small: 'https://avatars.steamstatic.com/7875e33529232d95cad28ea1054897618907fa03.jpg',
medium: 'https://avatars.steamstatic.com/7875e33529232d95cad28ea1054897618907fa03_medium.jpg',
large: 'https://avatars.steamstatic.com/7875e33529232d95cad28ea1054897618907fa03_full.jpg',
hash: '7875e33529232d95cad28ea1054897618907fa03'
},
url: 'https://steamcommunity.com/id/DimGG/',
visible: true,
personaState: 0,
personaStateFlags: 0,
allowsComments: true,
nickname: 'dim',
lastLogOffTimestamp: 1704553877,
createdTimestamp: 1406393110,
realName: undefined,
primaryGroupID: '103582791457347196',
gameID: undefined,
gameName: undefined,
gameServerIP: undefined,
gameServerID: undefined,
countryCode: 'US',
stateCode: undefined,
cityID: undefined
}
*/
});
```