0.1.0 • Published 6 years ago
js-steam-api v0.1.0
Async Steam web API wrapper
Another wrapper arround Steam API. Supports promises and ES6 async/await. This module requires a Steam web API key which you can obtain from HERE.
Install
using npm:
$ npm install --save js-steam-api
using yarn:
$ yarn add js-steam-api
Usage
const Steam = require('js-steam-api');
const option = {
apiKey: YOUR_STEAM_API_KEY
}
const steam = new Steam(option);
// simple usage. get a single user summeries.
steam.GetPlayerSummaries({ steamIds: "steamId"})
.then(res => console.log(res.data))
.catch(err => console.log(err));
// or multiple users at a single request
steam.GetPlayerSummaries({ steamIds: ["steamId1", "steamId2"]})
.then(res => console.log(res.data))
.catch(err => console.log(err));
// also async/await supported
async () => {
try {
const response = await steam.GetPlayerSummaries({ steamIds: "steamId"});
console.log(response.data);
} catch(error) {
console.log(error);
}
};
API
constructor
- Construct a new Steam instance
- Has a setting object as argument that contains
- apiKey
Type: String
- You can obtain
apiKey
from https://steamcommunity.com/dev/apikey - Required
- format
- Should be one of
xml
,json
andvdf
. - Default value is
json
- Optional
- Should be one of
- apiKey
For simpilicity and Resemblance every methods has a single object as argument . In the documentaions we describe the object properties.
ISteamUser
ResolveVanityURL
- vanityUrl
Type: string
- The vanity URL to get a SteamID for
- Required
- vanityUrl
GetUserGroupList
- steamId
Type: string
- User Steam id to get user group list
- Required
- steamId
GetPlayerBans
- steamIds
Type: string or array of string
- Users Steam id to get Steam ban status
- can be a single id or array of ids for getting multiple users ban status at a single request
- Required
- steamIds
GetFriendList
- steamId
Type: string
- User Steam id to get user friend list
- Required
- steamId
GetPlayerSummaries
- steamIds
Type: string or array of string
- Users Steam id to get Steam summeries
- can be a single id or array of ids for getting multiple users summeries at a single request
- Required
- version
Type: string
- Should be one of
v1
orv2
. - Value is
v1
- Optional
- steamIds
Contributing
If you'd like to contribute, please fork the repository and make changes as you'd like. Pull requests are warmly welcome.
License
This project is licensed under the MIT License - see the LICENSE file for details