Skip to content

CottontailBunny/steamworkers-webapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SteamWebapi

npm version

Setup

Installation

npm i steamworkers-webapi

Getting an API Key

Once signed into Steam, head over to http://steamcommunity.com/dev/apikey to generate an API key.This key is very important

Usage

const SteamWebapi = require('steamworkers-webapi');
const steam = new SteamAPI('<apikey>');

Now, we can call methods on the steam object.

For example, let's retrieve the SteamID64 of a user. steam-webapi provides a resolve method, which accepts an vanity URL (You can set your vaniturl through the profile in steam platform)

steam.resolve('https://steamcommunity.com/id/yueQAQ').then(id => {
	console.log(id); // 76561198205559728

Now you can take that ID, and fetch for message

steam.getUserSummary('76561198146931523').then(summary => {
	console.log(summary);
	/**
	PlayerSummary {
                avatar: {
                    small: 'https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/5a/5a3abda990b840532b87678def187f3cda8285c1.jpg',
                    medium: 'https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/5a/5a3abda990b840532b87678def187f3cda8285c1_medium.jpg',
                    large: 'https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/5a/5a3abda990b840532b87678def187f3cda8285c1_full.jpg'
                },
                steamID: '76561198205559728',
                visibilityState: 3,
                nickname: '想和悦去吹吹风',
                commentPermission: 1,
                url: 'https://steamcommunity.com/id/yueQAQ/',
                avatarHash: '5a3abda990b840532b87678def187f3cda8285c1',
                lastLogOff: 1608990274,
                personaState: 1,
                realName: 'yue',
                primaryGroupID: '103582791429521408',
                created: 1421039116,
                personaStateFlags: '',
                countryCode: 'CO',
                stateCode: '01',
                cityID: 11040,
                gameServerIP: '',
                gameServerSteamID: '',
                gameExtraInfo: '',
                gameID: ''
                }
	*/
});

Documentation

SteamWebapi

new SteamWebapi(key, [options])

Sets Steam key for future use.

Param Type Default Description
key string Steam key

steam.get(path, [base], [key]) ⇒ Promise.<Object>

Returns: Promise.<Object> - JSON Response

Param Type Default Description
path string Path to request e.g '/IPlayerService/GetOwnedGames/v1?steamid=1234567534543'
[base] string "this.baseAPI" Base URL
[key] string "this.key" The key to use

steam.resolve(info) ⇒ Promise.<string>

Resolve info for steamid Rejects promise if a profile couldn't be resolved.

Returns: Promise.<string> - Profile ID

Param Type Description
info string Something to resolve e.g 'https://steamcommunity.com/id/yueQAQ'

steam.getUserSummary(id) ⇒ Promise.<PlayerSummary>

Get users summary. Returns: Promise.<PlayerSummary> - Summary

Param Type Description
id string User ID

steam.getUserOwnedGames(id) ⇒ Promise.<Array.<Game>>

Get users owned games.

Kind: instance method of SteamAPI
Returns: Promise.<Array.<Game>> - Owned games

Param Type Description
id string User ID

steam.getUserFriends(id) ⇒ Promise.<Array.<Friend>>

Get users friends.

Kind: instance method of SteamAPI
Returns: Promise.<Array.<Friend>> - Friends

Param Type Description
id string User ID

steam.getUserGroups(id) ⇒ Promise.<Array.<string>>

Get users groups.

Kind: instance method of SteamAPI
Returns: Promise.<Array.<string>> - Groups

Param Type Description
id string User ID

steam.getUserRecentGames(id) ⇒ Promise.<Array.<RecentGame>>

Get users recent games.

Kind: instance method of SteamAPI
Returns: Promise.<Array.<RecentGame>> - Recent games

Param Type Description
id string User ID

steam.getAppList() ⇒ Promise.<Array.<App>>

Get every single app on steam.

Kind: instance method of SteamAPI
Returns: Promise.<Array.<App>> - Array of apps

steam.getGameNews(app) ⇒ Promise.<Array.<Object>>

Get news for app id.

Kind: instance method of SteamAPI
Returns: Promise.<Array.<Object>> - App news for ID

Param Type Description
app string App ID

steam.getGameDetails(app, [force]) ⇒ Promise.<Object>

Get details for app id. Requests for this endpoint are limited to 200 every 5 minutes

Kind: instance method of SteamAPI
Returns: Promise.<Object> - App details for ID

Param Type Default Description
app string App ID
[force] boolean false Overwrite cache

steam.getGamePlayers(app) ⇒ Promise.<number>

Get number of current players for app id.

Kind: instance method of SteamAPI
Returns: Promise.<number> - Number of players

Param Type Description
app string App ID

steam.getNumberOfCurrentPlayers(app) ⇒ Promise.<Object>

Get schema for app id.

Kind: instance method of SteamAPI
Returns: Promise.<Object> - Schema

Param Type Description
app string App ID

About

some methods for requesting steam data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published