Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

An object-oriented Steam API wrapper for Node.js developers.

NotificationsYou must be signed in to change notification settings

xDimGG/node-steamapi

Repository files navigation

NPMDiscord

Documentation

A list of all the methods SteamAPI provides is availablehere.

Breaking changes from 2.x to 3.x

  • CommonJS Modules -> ES Modules
  • Import usingimport statement instead ofrequire()
  • 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 settinginMemoryCacheEnabled: false and setting<SteamAPI>.gameDetailCache/<SteamAPI>.userResolveCache. Must implementCacheMap<K, V> 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 inhttps://github.com/xDimGG/node-steamapi/blob/master/PORT.md

Setup

Installation

npm i steamapi

Getting an API Key

Once signed into Steam, head over tohttp://steamcommunity.com/dev/apikey to generate an API key.

Usage

First, we start by making a SteamAPI "user".

importSteamAPIfrom'steamapi';conststeam=newSteamAPI('steam token');

Now, we can call methods on thesteam object.

For example, let's retrieve the SteamID64 of a user. SteamAPI provides aresolve method, which accepts URLs and IDs.

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.

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}*/});

About

An object-oriented Steam API wrapper for Node.js developers.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp