├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── api_method_list.md ├── demos ├── example.js ├── example_games.js ├── example_league_listing.js ├── example_with_promises.js ├── example_with_promises_generators.js └── list_available_methods.js ├── index.js ├── package.json └── test └── index.js /.gitignore: -------------------------------------------------------------------------------- 1 | # Intellij project files 2 | *.iws 3 | *.iml 4 | .idea/ 5 | *.iml 6 | 7 | # Npm 8 | node_modules 9 | npm-debug.log 10 | 11 | # node-steam-webapi 12 | STEAM_KEY 13 | extra -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # Intellij project files 2 | *.iws 3 | *.iml 4 | .idea/ 5 | *.iml 6 | 7 | # Npm 8 | node_modules 9 | npm-debug.log 10 | 11 | # node-steam-webapi 12 | STEAM_KEY 13 | extra -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Steam WebAPI library for node.js 2 | ========================== 3 | *Supports Node v0.8.26 (or newer) but might work on older versions* 4 | 5 | A [Steam API Key](http://steamcommunity.com/dev/apikey) is needed for many of the methods in the API and is a requirement for this library. 6 | 7 | All the methods are created at runtime (available after Steam.ready, which retrieves the API methods), rather than compile-time, so this should theoretically support all (existing and future) Steam API methods. 8 | No need to worry about calling the correct API version, as it will always be the latest. If you must use a different version simply pass in a {'version': x} option into a method. 9 | 10 | 11 | [List of methods](https://github.com/jonbo/node-steam-webapi/blob/master/api_method_list.md) 12 | 13 | To install: 14 | 15 | npm install steam-webapi 16 | 17 | ## Example 18 | 19 | ```js 20 | var Steam = require('steam-webapi'); 21 | 22 | // Set global Steam API Key 23 | Steam.key = "YOUR API KEY"; 24 | 25 | Steam.ready(function(err) { 26 | if (err) return console.log(err); 27 | 28 | var steam = new Steam(); 29 | 30 | // Retrieve the steam ID from a steam username/communityID 31 | steam.resolveVanityURL({vanityurl:'jonbo'}, function(err, data) { 32 | console.log(data); 33 | // data -> { steamid: '76561197968620915', success: 1 } 34 | 35 | // Get the Player's TF2 Backpack items 36 | data.gameid = Steam.TF2; 37 | 38 | // getPlayerItems requires { gameid, steamid } 39 | steam.getPlayerItems(data, function (err, data) { 40 | console.log(data); 41 | // data -> { status: 1, num_backpack_slots: 1100, items: [...], ...} 42 | 43 | }); 44 | }); 45 | 46 | }); 47 | ``` 48 | 49 | ## Example with generators and promises 50 | 51 | ```js 52 | // Requires node 0.11+ and "node --harmony" 53 | 54 | var Steam = require('steam-webapi'); 55 | var Promise = require('bluebird'); 56 | 57 | // Set global Steam API Key 58 | Steam.key = "YOUR API KEY"; 59 | 60 | Steam.ready(Promise.coroutine(function*(err) { 61 | if (err) return console.log(err); 62 | 63 | // Creates an promise wielding function for every method (with Async attached at the end) 64 | Promise.promisifyAll(Steam.prototype); 65 | 66 | var steam = new Steam(); 67 | 68 | // Retrieve the steam ID from a steam username/communityID 69 | var data = yield steam.resolveVanityURLAsync({vanityurl:'jonbo'}); 70 | console.log(data); 71 | // data -> { steamid: '76561197968620915', success: 1 } 72 | 73 | // Get the Player's TF2 Backpack items 74 | data.gameid = Steam.TF2; 75 | data = yield steam.getPlayerItemsAsync(data); 76 | console.log(data); 77 | // data -> { status: 1, num_backpack_slots: 1100, items: [...], ...} 78 | 79 | })); 80 | ``` 81 | 82 | 83 | If you plan on only using this for TF2 data only (or just want to default to it), the first example can be rewritten. 84 | 85 | ```js 86 | var steam = new Steam({gameid: Steam.TF2, appid:Steam.TF2}); 87 | 88 | steam.resolveVanityURL({vanityurl:'jonbo'}, function(err, data) { 89 | 90 | // No need for data.gameid = Steam.TF2; here 91 | 92 | steam.getPlayerItems(data, function (err, data) { 93 | console.log(data); 94 | // data -> { status: 1, num_backpack_slots: 1100, items: [...], ...} 95 | }); 96 | }); 97 | ``` 98 | 99 | It works the same for 'key' and other fields. 100 | 101 | # Tests 102 | ``` 103 | $ npm run test 104 | ``` 105 | 106 | # License 107 | 108 | MIT -------------------------------------------------------------------------------- /api_method_list.md: -------------------------------------------------------------------------------- 1 | Generated on Sun, 07 Jun 2015 20:00:50 GMT 2 | 3 | * > 'key' is needed for most methods even if not specified* 4 | 5 | 6 | * > 'version' is needed if you want to specify a lower one* 7 | 8 | 9 | * > 'language' is available on some methods even if not listed.* 10 | 11 | 12 | ## getGameServersStatus(steamObj, cb) 13 | version 1 {ICSGOServers_730} 14 | ####steamObj 15 | 16 | - {int} `gameid` : The game id 17 | 18 | ## getFantasyPlayerStats(steamObj, cb) 19 | version 1 {IDOTA2Fantasy_205790} 20 | ####steamObj 21 | 22 | - {int} `gameid` : The game id 23 | 24 | - {uint32} `FantasyLeagueID` : The fantasy league ID 25 | 26 | - (optional) {uint32} `StartTime` : An optional filter for minimum timestamp 27 | 28 | - (optional) {uint32} `EndTime` : An optional filter for maximum timestamp 29 | 30 | - (optional) {uint64} `matchid` : An optional filter for a specific match 31 | 32 | - (optional) {uint32} `SeriesID` : An optional filter for a specific series 33 | 34 | - (optional) {uint32} `PlayerAccountID` : An optional filter for a specific player 35 | 36 | ## getPlayerOfficialInfo(steamObj, cb) 37 | version 1 {IDOTA2Fantasy_205790} 38 | ####steamObj 39 | 40 | - {int} `gameid` : The game id 41 | 42 | - {uint32} `accountid` : The account ID to look up 43 | 44 | ## getFantasyPlayerStats(steamObj, cb) 45 | version 1 {IDOTA2Fantasy_570} 46 | ####steamObj 47 | 48 | - {int} `gameid` : The game id 49 | 50 | - {uint32} `FantasyLeagueID` : The fantasy league ID 51 | 52 | - (optional) {uint32} `StartTime` : An optional filter for minimum timestamp 53 | 54 | - (optional) {uint32} `EndTime` : An optional filter for maximum timestamp 55 | 56 | - (optional) {uint64} `matchid` : An optional filter for a specific match 57 | 58 | - (optional) {uint32} `SeriesID` : An optional filter for a specific series 59 | 60 | - (optional) {uint32} `PlayerAccountID` : An optional filter for a specific player 61 | 62 | ## getPlayerOfficialInfo(steamObj, cb) 63 | version 1 {IDOTA2Fantasy_570} 64 | ####steamObj 65 | 66 | - {int} `gameid` : The game id 67 | 68 | - {uint32} `accountid` : The account ID to look up 69 | 70 | ## getLeagueListing(steamObj, cb) 71 | version 1 {IDOTA2Match_205790} 72 | ####steamObj 73 | 74 | - {int} `gameid` : The game id 75 | 76 | ## getLiveLeagueGames(steamObj, cb) 77 | version 1 {IDOTA2Match_205790} 78 | ####steamObj 79 | 80 | - {int} `gameid` : The game id 81 | 82 | - (optional) {uint32} `league_id` : Only show matches of the specified league id 83 | 84 | - (optional) {uint64} `match_id` : Only show matches of the specified match id 85 | 86 | ## getMatchDetails(steamObj, cb) 87 | version 1 {IDOTA2Match_205790} 88 | ####steamObj 89 | 90 | - {int} `gameid` : The game id 91 | 92 | - {uint64} `match_id` : Match id 93 | 94 | ## getMatchHistory(steamObj, cb) 95 | version 1 {IDOTA2Match_205790} 96 | ####steamObj 97 | 98 | - {int} `gameid` : The game id 99 | 100 | - (optional) {uint32} `hero_id` : The ID of the hero that must be in the matches being queried 101 | 102 | - (optional) {uint32} `game_mode` : Which game mode to return matches for 103 | 104 | - (optional) {uint32} `skill` : The average skill range of the match, these can be [1-3] with lower numbers being lower skill. Ignored if an account ID is specified 105 | 106 | - (optional) {string} `min_players` : Minimum number of human players that must be in a match for it to be returned 107 | 108 | - (optional) {string} `account_id` : An account ID to get matches from. This will fail if the user has their match history hidden 109 | 110 | - (optional) {string} `league_id` : The league ID to return games from 111 | 112 | - (optional) {uint64} `start_at_match_id` : The minimum match ID to start from 113 | 114 | - (optional) {string} `matches_requested` : The number of requested matches to return 115 | 116 | - (optional) {string} `tournament_games_only` : Whether or not tournament games should only be returned 117 | 118 | ## getMatchHistoryBySequenceNum(steamObj, cb) 119 | version 1 {IDOTA2Match_205790} 120 | ####steamObj 121 | 122 | - {int} `gameid` : The game id 123 | 124 | - (optional) {uint64} `start_at_match_seq_num` : 125 | 126 | - (optional) {uint32} `matches_requested` : 127 | 128 | ## getScheduledLeagueGames(steamObj, cb) 129 | version 1 {IDOTA2Match_205790} 130 | ####steamObj 131 | 132 | - {int} `gameid` : The game id 133 | 134 | - (optional) {uint32} `date_min` : The starting time stamp to collect scheduled games from. If ignored, it will use the current time 135 | 136 | - (optional) {uint32} `date_max` : The ending time stamp. If this is more than 7 days past the starting time stamp, it will be clamped to 7 days. 137 | 138 | ## getTeamInfoByTeamID(steamObj, cb) 139 | version 1 {IDOTA2Match_205790} 140 | ####steamObj 141 | 142 | - {int} `gameid` : The game id 143 | 144 | - (optional) {uint64} `start_at_team_id` : 145 | 146 | - (optional) {uint32} `teams_requested` : 147 | 148 | ## getTournamentPlayerStats(steamObj, cb) 149 | version 1 {IDOTA2Match_205790} 150 | ####steamObj 151 | 152 | - {int} `gameid` : The game id 153 | 154 | - {string} `account_id` : 155 | 156 | - (optional) {string} `league_id` : 157 | 158 | - (optional) {string} `hero_id` : 159 | 160 | - (optional) {string} `time_frame` : 161 | 162 | - (optional) {uint64} `match_id` : 163 | 164 | ## getLeagueListing(steamObj, cb) 165 | version 1 {IDOTA2Match_570} 166 | ####steamObj 167 | 168 | - {int} `gameid` : The game id 169 | 170 | ## getLiveLeagueGames(steamObj, cb) 171 | version 1 {IDOTA2Match_570} 172 | ####steamObj 173 | 174 | - {int} `gameid` : The game id 175 | 176 | - (optional) {uint32} `league_id` : Only show matches of the specified league id 177 | 178 | - (optional) {uint64} `match_id` : Only show matches of the specified match id 179 | 180 | ## getMatchDetails(steamObj, cb) 181 | version 1 {IDOTA2Match_570} 182 | ####steamObj 183 | 184 | - {int} `gameid` : The game id 185 | 186 | - {uint64} `match_id` : Match id 187 | 188 | ## getMatchHistory(steamObj, cb) 189 | version 1 {IDOTA2Match_570} 190 | ####steamObj 191 | 192 | - {int} `gameid` : The game id 193 | 194 | - (optional) {uint32} `hero_id` : The ID of the hero that must be in the matches being queried 195 | 196 | - (optional) {uint32} `game_mode` : Which game mode to return matches for 197 | 198 | - (optional) {uint32} `skill` : The average skill range of the match, these can be [1-3] with lower numbers being lower skill. Ignored if an account ID is specified 199 | 200 | - (optional) {string} `min_players` : Minimum number of human players that must be in a match for it to be returned 201 | 202 | - (optional) {string} `account_id` : An account ID to get matches from. This will fail if the user has their match history hidden 203 | 204 | - (optional) {string} `league_id` : The league ID to return games from 205 | 206 | - (optional) {uint64} `start_at_match_id` : The minimum match ID to start from 207 | 208 | - (optional) {string} `matches_requested` : The number of requested matches to return 209 | 210 | - (optional) {string} `tournament_games_only` : Whether or not tournament games should only be returned 211 | 212 | ## getMatchHistoryBySequenceNum(steamObj, cb) 213 | version 1 {IDOTA2Match_570} 214 | ####steamObj 215 | 216 | - {int} `gameid` : The game id 217 | 218 | - (optional) {uint64} `start_at_match_seq_num` : 219 | 220 | - (optional) {uint32} `matches_requested` : 221 | 222 | ## getScheduledLeagueGames(steamObj, cb) 223 | version 1 {IDOTA2Match_570} 224 | ####steamObj 225 | 226 | - {int} `gameid` : The game id 227 | 228 | - (optional) {uint32} `date_min` : The starting time stamp to collect scheduled games from. If ignored, it will use the current time 229 | 230 | - (optional) {uint32} `date_max` : The ending time stamp. If this is more than 7 days past the starting time stamp, it will be clamped to 7 days. 231 | 232 | ## getTeamInfoByTeamID(steamObj, cb) 233 | version 1 {IDOTA2Match_570} 234 | ####steamObj 235 | 236 | - {int} `gameid` : The game id 237 | 238 | - (optional) {uint64} `start_at_team_id` : 239 | 240 | - (optional) {uint32} `teams_requested` : 241 | 242 | ## getTournamentPlayerStats(steamObj, cb) 243 | version 1 {IDOTA2Match_570} 244 | ####steamObj 245 | 246 | - {int} `gameid` : The game id 247 | 248 | - {string} `account_id` : 249 | 250 | - (optional) {string} `league_id` : 251 | 252 | - (optional) {string} `hero_id` : 253 | 254 | - (optional) {string} `time_frame` : 255 | 256 | - (optional) {uint64} `match_id` : 257 | 258 | ## setSteamAccountPurchased(steamObj, cb) 259 | version 1 {IDOTA2Ticket_570} 260 | ####steamObj 261 | 262 | - {int} `gameid` : The game id 263 | 264 | - {uint32} `eventid` : Event ID 265 | 266 | - {uint64} `steamid` : The 64-bit Steam ID 267 | 268 | ## steamAccountValidForEvent(steamObj, cb) 269 | version 1 {IDOTA2Ticket_570} 270 | ####steamObj 271 | 272 | - {int} `gameid` : The game id 273 | 274 | - {uint32} `eventid` : Event ID 275 | 276 | - {uint64} `steamid` : The 64-bit Steam ID 277 | 278 | ## getEventStatsForAccount(steamObj, cb) 279 | version 1 {IEconDOTA2_205790} 280 | ####steamObj 281 | 282 | - {int} `gameid` : The game id 283 | 284 | - {uint32} `eventid` : The League ID of the compendium you're looking for. 285 | 286 | - {uint32} `accountid` : The account ID to look up. 287 | 288 | - (optional) {string} `language` : The language to provide hero names in. 289 | 290 | ## getGameItems(steamObj, cb) 291 | version 1 {IEconDOTA2_205790} 292 | ####steamObj 293 | 294 | - {int} `gameid` : The game id 295 | 296 | - (optional) {string} `language` : The language to provide item names in. 297 | 298 | ## getHeroes(steamObj, cb) 299 | version 1 {IEconDOTA2_205790} 300 | ####steamObj 301 | 302 | - {int} `gameid` : The game id 303 | 304 | - (optional) {string} `language` : The language to provide hero names in. 305 | 306 | - (optional) {bool} `itemizedonly` : Return a list of itemized heroes only. 307 | 308 | ## getItemIconPath(steamObj, cb) 309 | version 1 {IEconDOTA2_205790} 310 | ####steamObj 311 | 312 | - {int} `gameid` : The game id 313 | 314 | - {string} `iconname` : The item icon name to get the CDN path of 315 | 316 | ## getRarities(steamObj, cb) 317 | version 1 {IEconDOTA2_205790} 318 | ####steamObj 319 | 320 | - {int} `gameid` : The game id 321 | 322 | - (optional) {string} `language` : The language to provide rarity names in. 323 | 324 | ## getTournamentPrizePool(steamObj, cb) 325 | version 1 {IEconDOTA2_205790} 326 | ####steamObj 327 | 328 | - {int} `gameid` : The game id 329 | 330 | - (optional) {uint32} `leagueid` : The ID of the league to get the prize pool of 331 | 332 | ## getEmoticonAccessForUser(steamObj, cb) 333 | version 1 {IEconDOTA2_570} 334 | ####steamObj 335 | 336 | - {int} `gameid` : The game id 337 | 338 | - {uint64} `steamid` : Steam ID of user. 339 | 340 | ## getEmoticons(steamObj, cb) 341 | version 1 {IEconDOTA2_570} 342 | ####steamObj 343 | 344 | - {int} `gameid` : The game id 345 | 346 | ## getEventStatsForAccount(steamObj, cb) 347 | version 1 {IEconDOTA2_570} 348 | ####steamObj 349 | 350 | - {int} `gameid` : The game id 351 | 352 | - {uint32} `eventid` : The League ID of the compendium you're looking for. 353 | 354 | - {uint32} `accountid` : The account ID to look up. 355 | 356 | - (optional) {string} `language` : The language to provide hero names in. 357 | 358 | ## getGameItems(steamObj, cb) 359 | version 1 {IEconDOTA2_570} 360 | ####steamObj 361 | 362 | - {int} `gameid` : The game id 363 | 364 | - (optional) {string} `language` : The language to provide item names in. 365 | 366 | ## getHeroes(steamObj, cb) 367 | version 1 {IEconDOTA2_570} 368 | ####steamObj 369 | 370 | - {int} `gameid` : The game id 371 | 372 | - (optional) {string} `language` : The language to provide hero names in. 373 | 374 | - (optional) {bool} `itemizedonly` : Return a list of itemized heroes only. 375 | 376 | ## getItemIconPath(steamObj, cb) 377 | version 1 {IEconDOTA2_570} 378 | ####steamObj 379 | 380 | - {int} `gameid` : The game id 381 | 382 | - {string} `iconname` : The item icon name to get the CDN path of 383 | 384 | ## getRarities(steamObj, cb) 385 | version 1 {IEconDOTA2_570} 386 | ####steamObj 387 | 388 | - {int} `gameid` : The game id 389 | 390 | - (optional) {string} `language` : The language to provide rarity names in. 391 | 392 | ## getTournamentPrizePool(steamObj, cb) 393 | version 1 {IEconDOTA2_570} 394 | ####steamObj 395 | 396 | - {int} `gameid` : The game id 397 | 398 | - (optional) {uint32} `leagueid` : The ID of the league to get the prize pool of 399 | 400 | ## getPlayerItems(steamObj, cb) 401 | version 1 {IEconItems_205790} 402 | ####steamObj 403 | 404 | - {int} `gameid` : The game id 405 | 406 | - {uint64} `steamid` : The Steam ID to fetch items for 407 | 408 | ## getSchema(steamObj, cb) 409 | version 1 {IEconItems_205790} 410 | ####steamObj 411 | 412 | - {int} `gameid` : The game id 413 | 414 | - (optional) {string} `language` : The language to return the names in. Defaults to returning string keys. 415 | 416 | ## getSchemaURL(steamObj, cb) 417 | version 1 {IEconItems_205790} 418 | ####steamObj 419 | 420 | - {int} `gameid` : The game id 421 | 422 | ## getStoreMetaData(steamObj, cb) 423 | version 1 {IEconItems_205790} 424 | ####steamObj 425 | 426 | - {int} `gameid` : The game id 427 | 428 | - (optional) {string} `language` : The language to results in. 429 | 430 | ## getPlayerItems(steamObj, cb) 431 | version 1 {IEconItems_218620} 432 | ####steamObj 433 | 434 | - {int} `gameid` : The game id 435 | 436 | - {uint64} `steamid` : The Steam ID to fetch items for 437 | 438 | ## getPlayerItems(steamObj, cb) 439 | version 1 {IEconItems_221540} 440 | ####steamObj 441 | 442 | - {int} `gameid` : The game id 443 | 444 | - {uint64} `steamid` : The Steam ID to fetch items for 445 | 446 | ## getPlayerItems(steamObj, cb) 447 | version 1 {IEconItems_238460} 448 | ####steamObj 449 | 450 | - {int} `gameid` : The game id 451 | 452 | - {uint64} `steamid` : The Steam ID to fetch items for 453 | 454 | ## getPlayerItems(steamObj, cb) 455 | version 1 {IEconItems_440} 456 | ####steamObj 457 | 458 | - {int} `gameid` : The game id 459 | 460 | - {uint64} `steamid` : The Steam ID to fetch items for 461 | 462 | ## getSchema(steamObj, cb) 463 | version 1 {IEconItems_440} 464 | ####steamObj 465 | 466 | - {int} `gameid` : The game id 467 | 468 | - (optional) {string} `language` : The language to return the names in. Defaults to returning string keys. 469 | 470 | ## getSchemaURL(steamObj, cb) 471 | version 1 {IEconItems_440} 472 | ####steamObj 473 | 474 | - {int} `gameid` : The game id 475 | 476 | ## getStoreMetaData(steamObj, cb) 477 | version 1 {IEconItems_440} 478 | ####steamObj 479 | 480 | - {int} `gameid` : The game id 481 | 482 | - (optional) {string} `language` : The language to results in. 483 | 484 | ## getStoreStatus(steamObj, cb) 485 | version 1 {IEconItems_440} 486 | ####steamObj 487 | 488 | - {int} `gameid` : The game id 489 | 490 | ## getPlayerItems(steamObj, cb) 491 | version 1 {IEconItems_570} 492 | ####steamObj 493 | 494 | - {int} `gameid` : The game id 495 | 496 | - {uint64} `steamid` : The Steam ID to fetch items for 497 | 498 | ## getSchema(steamObj, cb) 499 | version 1 {IEconItems_570} 500 | ####steamObj 501 | 502 | - {int} `gameid` : The game id 503 | 504 | - (optional) {string} `language` : The language to return the names in. Defaults to returning string keys. 505 | 506 | ## getSchemaURL(steamObj, cb) 507 | version 1 {IEconItems_570} 508 | ####steamObj 509 | 510 | - {int} `gameid` : The game id 511 | 512 | ## getStoreMetaData(steamObj, cb) 513 | version 1 {IEconItems_570} 514 | ####steamObj 515 | 516 | - {int} `gameid` : The game id 517 | 518 | - (optional) {string} `language` : The language to results in. 519 | 520 | ## getPlayerItems(steamObj, cb) 521 | version 1 {IEconItems_620} 522 | ####steamObj 523 | 524 | - {int} `gameid` : The game id 525 | 526 | - {uint64} `steamid` : The Steam ID to fetch items for 527 | 528 | ## getSchema(steamObj, cb) 529 | version 1 {IEconItems_620} 530 | ####steamObj 531 | 532 | - {int} `gameid` : The game id 533 | 534 | - (optional) {string} `language` : The language to return the names in. Defaults to returning string keys. 535 | 536 | ## getPlayerItems(steamObj, cb) 537 | version 1 {IEconItems_730} 538 | ####steamObj 539 | 540 | - {int} `gameid` : The game id 541 | 542 | - {uint64} `steamid` : The Steam ID to fetch items for 543 | 544 | ## getSchema(steamObj, cb) 545 | version 2 {IEconItems_730} 546 | ####steamObj 547 | 548 | - {int} `gameid` : The game id 549 | 550 | - (optional) {string} `language` : The language to return the names in. Defaults to returning string keys. 551 | 552 | ## getSchemaURL(steamObj, cb) 553 | version 2 {IEconItems_730} 554 | ####steamObj 555 | 556 | - {int} `gameid` : The game id 557 | 558 | ## getStoreMetaData(steamObj, cb) 559 | version 1 {IEconItems_730} 560 | ####steamObj 561 | 562 | - {int} `gameid` : The game id 563 | 564 | - (optional) {string} `language` : The language to results in. 565 | 566 | ## getPlayerItems(steamObj, cb) 567 | version 1 {IEconItems_841} 568 | ####steamObj 569 | 570 | - {int} `gameid` : The game id 571 | 572 | - {uint64} `steamid` : The Steam ID to fetch items for 573 | 574 | ## getSchema(steamObj, cb) 575 | version 1 {IEconItems_841} 576 | ####steamObj 577 | 578 | - {int} `gameid` : The game id 579 | 580 | - (optional) {string} `language` : The language to return the names in. Defaults to returning string keys. 581 | 582 | ## getClientVersion(steamObj, cb) 583 | version 1 {IGCVersion_205790} 584 | ####steamObj 585 | 586 | - {int} `gameid` : The game id 587 | 588 | ## getServerVersion(steamObj, cb) 589 | version 1 {IGCVersion_205790} 590 | ####steamObj 591 | 592 | - {int} `gameid` : The game id 593 | 594 | ## getClientVersion(steamObj, cb) 595 | version 1 {IGCVersion_440} 596 | ####steamObj 597 | 598 | - {int} `gameid` : The game id 599 | 600 | ## getServerVersion(steamObj, cb) 601 | version 1 {IGCVersion_440} 602 | ####steamObj 603 | 604 | - {int} `gameid` : The game id 605 | 606 | ## getClientVersion(steamObj, cb) 607 | version 1 {IGCVersion_570} 608 | ####steamObj 609 | 610 | - {int} `gameid` : The game id 611 | 612 | ## getServerVersion(steamObj, cb) 613 | version 1 {IGCVersion_570} 614 | ####steamObj 615 | 616 | - {int} `gameid` : The game id 617 | 618 | ## getServerVersion(steamObj, cb) 619 | version 1 {IGCVersion_730} 620 | ####steamObj 621 | 622 | - {int} `gameid` : The game id 623 | 624 | ## getBucketizedData(steamObj, cb) 625 | version 1 {IPortal2Leaderboards_620} 626 | ####steamObj 627 | 628 | - {int} `gameid` : The game id 629 | 630 | - {string} `leaderboardName` : The leaderboard name to fetch data for. 631 | 632 | ## getBucketizedData(steamObj, cb) 633 | version 1 {IPortal2Leaderboards_841} 634 | ####steamObj 635 | 636 | - {int} `gameid` : The game id 637 | 638 | - {string} `leaderboardName` : The leaderboard name to fetch data for. 639 | 640 | ## getAppList(steamObj, cb) 641 | version 1 {ISteamApps} 642 | #### No steamObj params 643 | 644 | ## getAppList(steamObj, cb) 645 | version 2 {ISteamApps} 646 | #### No steamObj params 647 | 648 | ## getServersAtAddress(steamObj, cb) 649 | version 1 {ISteamApps} 650 | ####steamObj 651 | 652 | - {string} `addr` : IP or IP:queryport to list 653 | 654 | ## upToDateCheck(steamObj, cb) 655 | version 1 {ISteamApps} 656 | ####steamObj 657 | 658 | - {uint32} `appid` : AppID of game 659 | 660 | - {uint32} `version` : The installed version of the game 661 | 662 | ## setClientFilters(steamObj, cb) 663 | version 1 {ISteamCDN} 664 | ####steamObj 665 | 666 | - {string} `key` : access key 667 | 668 | - {string} `cdnname` : Steam name of CDN property 669 | 670 | - (optional) {string} `allowedipblocks` : comma-separated list of allowed IP address blocks in CIDR format - blank for not used 671 | 672 | - (optional) {string} `allowedasns` : comma-separated list of allowed client network AS numbers - blank for not used 673 | 674 | - (optional) {string} `allowedipcountries` : comma-separated list of allowed client IP country codes in ISO 3166-1 format - blank for not used 675 | 676 | ## getCMList(steamObj, cb) 677 | version 1 {ISteamDirectory} 678 | ####steamObj 679 | 680 | - {uint32} `cellid` : Client's Steam cell ID 681 | 682 | - (optional) {uint32} `maxcount` : Max number of servers to return 683 | 684 | ## getAssetClassInfo(steamObj, cb) 685 | version 1 {ISteamEconomy} 686 | ####steamObj 687 | 688 | - {uint32} `appid` : Must be a steam economy app. 689 | 690 | - (optional) {string} `language` : The user's local language 691 | 692 | - {uint32} `class_count` : Number of classes requested. Must be at least one. 693 | 694 | - {uint64} `classid0` : Class ID of the nth class. 695 | 696 | - (optional) {uint64} `instanceid0` : Instance ID of the nth class. 697 | 698 | ## getAssetPrices(steamObj, cb) 699 | version 1 {ISteamEconomy} 700 | ####steamObj 701 | 702 | - {uint32} `appid` : Must be a steam economy app. 703 | 704 | - (optional) {string} `currency` : The currency to filter for 705 | 706 | - (optional) {string} `language` : The user's local language 707 | 708 | ## paymentOutNotification(steamObj, cb) 709 | version 1 {ISteamEnvoy} 710 | #### No steamObj params 711 | 712 | ## paymentOutReversalNotification(steamObj, cb) 713 | version 1 {ISteamEnvoy} 714 | #### No steamObj params 715 | 716 | ## getNewsForApp(steamObj, cb) 717 | version 1 {ISteamNews} 718 | ####steamObj 719 | 720 | - {uint32} `appid` : AppID to retrieve news for 721 | 722 | - (optional) {uint32} `maxlength` : Maximum length for the content to return, if this is 0 the full content is returned, if it's less then a blurb is generated to fit. 723 | 724 | - (optional) {uint32} `enddate` : Retrieve posts earlier than this date (unix epoch timestamp) 725 | 726 | - (optional) {uint32} `count` : # of posts to retrieve (default 20) 727 | 728 | ## getNewsForApp(steamObj, cb) 729 | version 2 {ISteamNews} 730 | ####steamObj 731 | 732 | - {uint32} `appid` : AppID to retrieve news for 733 | 734 | - (optional) {uint32} `maxlength` : Maximum length for the content to return, if this is 0 the full content is returned, if it's less then a blurb is generated to fit. 735 | 736 | - (optional) {uint32} `enddate` : Retrieve posts earlier than this date (unix epoch timestamp) 737 | 738 | - (optional) {uint32} `count` : # of posts to retrieve (default 20) 739 | 740 | - (optional) {string} `feeds` : Comma-seperated list of feed names to return news for 741 | 742 | ## payPalPaymentsHubPaymentNotification(steamObj, cb) 743 | version 1 {ISteamPayPalPaymentsHub} 744 | #### No steamObj params 745 | 746 | ## getCollectionDetails(steamObj, cb) 747 | version 1 {ISteamRemoteStorage} 748 | ####steamObj 749 | 750 | - {uint32} `collectioncount` : Number of collections being requested 751 | 752 | - {uint64} `publishedfileids[0]` : collection ids to get the details for 753 | 754 | ## getPublishedFileDetails(steamObj, cb) 755 | version 1 {ISteamRemoteStorage} 756 | ####steamObj 757 | 758 | - {uint32} `itemcount` : Number of items being requested 759 | 760 | - {uint64} `publishedfileids[0]` : published file id to look up 761 | 762 | ## getUGCFileDetails(steamObj, cb) 763 | version 1 {ISteamRemoteStorage} 764 | ####steamObj 765 | 766 | - (optional) {uint64} `steamid` : If specified, only returns details if the file is owned by the SteamID specified 767 | 768 | - {uint64} `ugcid` : ID of UGC file to get info for 769 | 770 | - {uint32} `appid` : appID of product 771 | 772 | ## getFriendList(steamObj, cb) 773 | version 1 {ISteamUser} 774 | ####steamObj 775 | 776 | - {string} `key` : access key 777 | 778 | - {uint64} `steamid` : SteamID of user 779 | 780 | - (optional) {string} `relationship` : relationship type (ex: friend) 781 | 782 | ## getPlayerBans(steamObj, cb) 783 | version 1 {ISteamUser} 784 | ####steamObj 785 | 786 | - {string} `key` : access key 787 | 788 | - {string} `steamids` : Comma-delimited list of SteamIDs 789 | 790 | ## getPlayerSummaries(steamObj, cb) 791 | version 1 {ISteamUser} 792 | ####steamObj 793 | 794 | - {string} `key` : access key 795 | 796 | - {string} `steamids` : Comma-delimited list of SteamIDs 797 | 798 | ## getPlayerSummaries(steamObj, cb) 799 | version 2 {ISteamUser} 800 | ####steamObj 801 | 802 | - {string} `key` : access key 803 | 804 | - {string} `steamids` : Comma-delimited list of SteamIDs (max: 100) 805 | 806 | ## getUserGroupList(steamObj, cb) 807 | version 1 {ISteamUser} 808 | ####steamObj 809 | 810 | - {string} `key` : access key 811 | 812 | - {uint64} `steamid` : SteamID of user 813 | 814 | ## resolveVanityURL(steamObj, cb) 815 | version 1 {ISteamUser} 816 | ####steamObj 817 | 818 | - {string} `key` : access key 819 | 820 | - {string} `vanityurl` : The vanity URL to get a SteamID for 821 | 822 | - (optional) {int32} `url_type` : The type of vanity URL. 1 (default): Individual profile, 2: Group, 3: Official game group 823 | 824 | ## authenticateUser(steamObj, cb) 825 | version 1 {ISteamUserAuth} 826 | ####steamObj 827 | 828 | - {uint64} `steamid` : Should be the users steamid, unencrypted. 829 | 830 | - {rawbinary} `sessionkey` : Should be a 32 byte random blob of data, which is then encrypted with RSA using the Steam system's public key. Randomness is important here for security. 831 | 832 | - {rawbinary} `encrypted_loginkey` : Should be the users hashed loginkey, AES encrypted with the sessionkey. 833 | 834 | ## authenticateUserTicket(steamObj, cb) 835 | version 1 {ISteamUserAuth} 836 | ####steamObj 837 | 838 | - {string} `key` : access key 839 | 840 | - {uint32} `appid` : appid of game 841 | 842 | - {string} `ticket` : Ticket from GetAuthSessionTicket. 843 | 844 | ## getTokenDetails(steamObj, cb) 845 | version 1 {ISteamUserOAuth} 846 | ####steamObj 847 | 848 | - {string} `access_token` : OAuth2 token for which to return details 849 | 850 | ## getGlobalAchievementPercentagesForApp(steamObj, cb) 851 | version 1 {ISteamUserStats} 852 | ####steamObj 853 | 854 | - {uint64} `gameid` : GameID to retrieve the achievement percentages for 855 | 856 | ## getGlobalAchievementPercentagesForApp(steamObj, cb) 857 | version 2 {ISteamUserStats} 858 | ####steamObj 859 | 860 | - {uint64} `gameid` : GameID to retrieve the achievement percentages for 861 | 862 | ## getGlobalStatsForGame(steamObj, cb) 863 | version 1 {ISteamUserStats} 864 | ####steamObj 865 | 866 | - {uint32} `appid` : AppID that we're getting global stats for 867 | 868 | - {uint32} `count` : Number of stats get data for 869 | 870 | - {string} `name[0]` : Names of stat to get data for 871 | 872 | - (optional) {uint32} `startdate` : Start date for daily totals (unix epoch timestamp) 873 | 874 | - (optional) {uint32} `enddate` : End date for daily totals (unix epoch timestamp) 875 | 876 | ## getNumberOfCurrentPlayers(steamObj, cb) 877 | version 1 {ISteamUserStats} 878 | ####steamObj 879 | 880 | - {uint32} `appid` : AppID that we're getting user count for 881 | 882 | ## getPlayerAchievements(steamObj, cb) 883 | version 1 {ISteamUserStats} 884 | ####steamObj 885 | 886 | - {string} `key` : access key 887 | 888 | - {uint64} `steamid` : SteamID of user 889 | 890 | - {uint32} `appid` : AppID to get achievements for 891 | 892 | - (optional) {string} `l` : Language to return strings for 893 | 894 | ## getSchemaForGame(steamObj, cb) 895 | version 1 {ISteamUserStats} 896 | ####steamObj 897 | 898 | - {string} `key` : access key 899 | 900 | - {uint32} `appid` : appid of game 901 | 902 | - (optional) {string} `l` : localized langauge to return (english, french, etc.) 903 | 904 | ## getSchemaForGame(steamObj, cb) 905 | version 2 {ISteamUserStats} 906 | ####steamObj 907 | 908 | - {string} `key` : access key 909 | 910 | - {uint32} `appid` : appid of game 911 | 912 | - (optional) {string} `l` : localized language to return (english, french, etc.) 913 | 914 | ## getUserStatsForGame(steamObj, cb) 915 | version 1 {ISteamUserStats} 916 | ####steamObj 917 | 918 | - {string} `key` : access key 919 | 920 | - {uint64} `steamid` : SteamID of user 921 | 922 | - {uint32} `appid` : appid of game 923 | 924 | ## getUserStatsForGame(steamObj, cb) 925 | version 2 {ISteamUserStats} 926 | ####steamObj 927 | 928 | - {string} `key` : access key 929 | 930 | - {uint64} `steamid` : SteamID of user 931 | 932 | - {uint32} `appid` : appid of game 933 | 934 | ## getServerInfo(steamObj, cb) 935 | version 1 {ISteamWebAPIUtil} 936 | #### No steamObj params 937 | 938 | ## getSupportedAPIList(steamObj, cb) 939 | version 1 {ISteamWebAPIUtil} 940 | ####steamObj 941 | 942 | - (optional) {string} `key` : access key 943 | 944 | ## pollStatus(steamObj, cb) 945 | version 1 {ISteamWebUserPresenceOAuth} 946 | ####steamObj 947 | 948 | - {string} `steamid` : Steam ID of the user 949 | 950 | - {uint64} `umqid` : UMQ Session ID 951 | 952 | - {uint32} `message` : Message that was last known to the user 953 | 954 | - (optional) {uint32} `pollid` : Caller-specific poll id 955 | 956 | - (optional) {uint32} `sectimeout` : Long-poll timeout in seconds 957 | 958 | - (optional) {uint32} `secidletime` : How many seconds is client considering itself idle, e.g. screen is off 959 | 960 | - (optional) {uint32} `use_accountids` : Boolean, 0 (default): return steamid_from in output, 1: return accountid_from 961 | 962 | ## getGoldenWrenches(steamObj, cb) 963 | version 2 {ITFItems_440} 964 | ####steamObj 965 | 966 | - {int} `gameid` : The game id 967 | 968 | ## getItemID(steamObj, cb) 969 | version 1 {ITFPromos_205790} 970 | ####steamObj 971 | 972 | - {int} `gameid` : The game id 973 | 974 | - {uint64} `steamid` : The Steam ID to fetch items for 975 | 976 | - {uint32} `promoid` : The promo ID to grant an item for 977 | 978 | ## grantItem(steamObj, cb) 979 | version 1 {ITFPromos_205790} 980 | ####steamObj 981 | 982 | - {int} `gameid` : The game id 983 | 984 | - {uint64} `steamid` : The Steam ID to fetch items for 985 | 986 | - {uint32} `promoid` : The promo ID to grant an item for 987 | 988 | ## getItemID(steamObj, cb) 989 | version 1 {ITFPromos_440} 990 | ####steamObj 991 | 992 | - {int} `gameid` : The game id 993 | 994 | - {uint64} `steamid` : The Steam ID to fetch items for 995 | 996 | - {uint32} `promoid` : The promo ID to grant an item for 997 | 998 | ## grantItem(steamObj, cb) 999 | version 1 {ITFPromos_440} 1000 | ####steamObj 1001 | 1002 | - {int} `gameid` : The game id 1003 | 1004 | - {uint64} `steamid` : The Steam ID to fetch items for 1005 | 1006 | - {uint32} `promoid` : The promo ID to grant an item for 1007 | 1008 | ## getItemID(steamObj, cb) 1009 | version 1 {ITFPromos_570} 1010 | ####steamObj 1011 | 1012 | - {int} `gameid` : The game id 1013 | 1014 | - {uint64} `steamid` : The Steam ID to fetch items for 1015 | 1016 | - {uint32} `promoid` : The promo ID to grant an item for 1017 | 1018 | ## grantItem(steamObj, cb) 1019 | version 1 {ITFPromos_570} 1020 | ####steamObj 1021 | 1022 | - {int} `gameid` : The game id 1023 | 1024 | - {uint64} `steamid` : The Steam ID to fetch items for 1025 | 1026 | - {uint32} `promoid` : The promo ID to grant an item for 1027 | 1028 | ## getItemID(steamObj, cb) 1029 | version 1 {ITFPromos_620} 1030 | ####steamObj 1031 | 1032 | - {int} `gameid` : The game id 1033 | 1034 | - {uint64} `steamid` : The Steam ID to fetch items for 1035 | 1036 | - {uint32} `PromoID` : The promo ID to grant an item for 1037 | 1038 | ## grantItem(steamObj, cb) 1039 | version 1 {ITFPromos_620} 1040 | ####steamObj 1041 | 1042 | - {int} `gameid` : The game id 1043 | 1044 | - {uint64} `steamid` : The Steam ID to fetch items for 1045 | 1046 | - {uint32} `PromoID` : The promo ID to grant an item for 1047 | 1048 | ## getItemID(steamObj, cb) 1049 | version 1 {ITFPromos_730} 1050 | ####steamObj 1051 | 1052 | - {int} `gameid` : The game id 1053 | 1054 | - {uint64} `steamid` : The Steam ID to fetch items for 1055 | 1056 | - {uint32} `PromoID` : The promo ID to grant an item for 1057 | 1058 | ## grantItem(steamObj, cb) 1059 | version 1 {ITFPromos_730} 1060 | ####steamObj 1061 | 1062 | - {int} `gameid` : The game id 1063 | 1064 | - {uint64} `steamid` : The Steam ID to fetch items for 1065 | 1066 | - {uint32} `PromoID` : The promo ID to grant an item for 1067 | 1068 | ## getItemID(steamObj, cb) 1069 | version 1 {ITFPromos_841} 1070 | ####steamObj 1071 | 1072 | - {int} `gameid` : The game id 1073 | 1074 | - {uint64} `steamid` : The Steam ID to fetch items for 1075 | 1076 | - {uint32} `PromoID` : The promo ID to grant an item for 1077 | 1078 | ## grantItem(steamObj, cb) 1079 | version 1 {ITFPromos_841} 1080 | ####steamObj 1081 | 1082 | - {int} `gameid` : The game id 1083 | 1084 | - {uint64} `steamid` : The Steam ID to fetch items for 1085 | 1086 | - {uint32} `PromoID` : The promo ID to grant an item for 1087 | 1088 | ## getAccountList(steamObj, cb) 1089 | version 1 {IGameServersService} 1090 | ####steamObj 1091 | 1092 | - {string} `key` : Access key 1093 | 1094 | ## createAccount(steamObj, cb) 1095 | version 1 {IGameServersService} 1096 | ####steamObj 1097 | 1098 | - {string} `key` : Access key 1099 | 1100 | - {uint32} `appid` : The app to use the account for 1101 | 1102 | - {string} `memo` : The memo to set on the new account 1103 | 1104 | ## setMemo(steamObj, cb) 1105 | version 1 {IGameServersService} 1106 | ####steamObj 1107 | 1108 | - {string} `key` : Access key 1109 | 1110 | - {uint64} `steamid` : The SteamID of the game server to set the memo on 1111 | 1112 | - {string} `memo` : The memo to set on the new account 1113 | 1114 | ## resetLoginToken(steamObj, cb) 1115 | version 1 {IGameServersService} 1116 | ####steamObj 1117 | 1118 | - {string} `key` : Access key 1119 | 1120 | - {uint64} `steamid` : The SteamID of the game server to reset the login token of 1121 | 1122 | ## getAccountPublicInfo(steamObj, cb) 1123 | version 1 {IGameServersService} 1124 | ####steamObj 1125 | 1126 | - {string} `key` : Access key 1127 | 1128 | - {uint64} `steamid` : The SteamID of the game server to get info on 1129 | 1130 | ## getServerSteamIDsByIP(steamObj, cb) 1131 | version 1 {IGameServersService} 1132 | ####steamObj 1133 | 1134 | - {string} `key` : Access key 1135 | 1136 | - {string} `server_ips` : 1137 | 1138 | ## getServerIPsBySteamID(steamObj, cb) 1139 | version 1 {IGameServersService} 1140 | ####steamObj 1141 | 1142 | - {string} `key` : Access key 1143 | 1144 | - {uint64} `server_steamids` : 1145 | 1146 | ## queryFiles(steamObj, cb) 1147 | version 1 {IPublishedFileService} 1148 | ####steamObj 1149 | 1150 | - {string} `key` : Access key 1151 | 1152 | - {uint32} `query_type` : enumeration EPublishedFileQueryType in clientenums.h 1153 | 1154 | - {uint32} `page` : Current page 1155 | 1156 | - (optional) {uint32} `numperpage` : (Optional) The number of results, per page to return. 1157 | 1158 | - {uint32} `creator_appid` : App that created the files 1159 | 1160 | - {uint32} `appid` : App that consumes the files 1161 | 1162 | - {string} `requiredtags` : Tags to match on. See match_all_tags parameter below 1163 | 1164 | - {string} `excludedtags` : (Optional) Tags that must NOT be present on a published file to satisfy the query. 1165 | 1166 | - (optional) {bool} `match_all_tags` : If true, then items must have all the tags specified, otherwise they must have at least one of the tags. 1167 | 1168 | - {string} `required_flags` : Required flags that must be set on any returned items 1169 | 1170 | - {string} `omitted_flags` : Flags that must not be set on any returned items 1171 | 1172 | - {string} `search_text` : Text to match in the item's title or description 1173 | 1174 | - {uint32} `filetype` : EPublishedFileInfoMatchingFileType 1175 | 1176 | - {uint64} `child_publishedfileid` : Find all items that reference the given item. 1177 | 1178 | - {uint32} `days` : If query_type is k_PublishedFileQueryType_RankedByTrend, then this is the number of days to get votes for [1,7]. 1179 | 1180 | - {bool} `include_recent_votes_only` : If query_type is k_PublishedFileQueryType_RankedByTrend, then limit result set just to items that have votes within the day range given 1181 | 1182 | - (optional) {uint32} `cache_max_age_seconds` : Allow stale data to be returned for the specified number of seconds. 1183 | 1184 | - {bool} `totalonly` : (Optional) If true, only return the total number of files that satisfy this query. 1185 | 1186 | - {bool} `return_vote_data` : Return vote data 1187 | 1188 | - {bool} `return_tags` : Return tags in the file details 1189 | 1190 | - {bool} `return_kv_tags` : Return key-value tags in the file details 1191 | 1192 | - {bool} `return_previews` : Return preview image and video details in the file details 1193 | 1194 | - {bool} `return_children` : Return child item ids in the file details 1195 | 1196 | - {bool} `return_short_description` : Populate the short_description field instead of file_description 1197 | 1198 | - {bool} `return_for_sale_data` : Return pricing information, if applicable 1199 | 1200 | - (optional) {bool} `return_metadata` : Populate the metadata 1201 | 1202 | ## recordOfflinePlaytime(steamObj, cb) 1203 | version 1 {IPlayerService} 1204 | ####steamObj 1205 | 1206 | - {uint64} `steamid` : 1207 | 1208 | - {string} `ticket` : 1209 | 1210 | - {{message}} `play_sessions` : 1211 | 1212 | ## getRecentlyPlayedGames(steamObj, cb) 1213 | version 1 {IPlayerService} 1214 | ####steamObj 1215 | 1216 | - {string} `key` : Access key 1217 | 1218 | - {uint64} `steamid` : The player we're asking about 1219 | 1220 | - {uint32} `count` : The number of games to return (0/unset: all) 1221 | 1222 | ## getOwnedGames(steamObj, cb) 1223 | version 1 {IPlayerService} 1224 | ####steamObj 1225 | 1226 | - {string} `key` : Access key 1227 | 1228 | - {uint64} `steamid` : The player we're asking about 1229 | 1230 | - {bool} `include_appinfo` : true if we want additional details (name, icon) about each game 1231 | 1232 | - {bool} `include_played_free_games` : Free games are excluded by default. If this is set, free games the user has played will be returned. 1233 | 1234 | - {uint32} `appids_filter` : if set, restricts result set to the passed in apps 1235 | 1236 | ## getSteamLevel(steamObj, cb) 1237 | version 1 {IPlayerService} 1238 | ####steamObj 1239 | 1240 | - {string} `key` : Access key 1241 | 1242 | - {uint64} `steamid` : The player we're asking about 1243 | 1244 | ## getBadges(steamObj, cb) 1245 | version 1 {IPlayerService} 1246 | ####steamObj 1247 | 1248 | - {string} `key` : Access key 1249 | 1250 | - {uint64} `steamid` : The player we're asking about 1251 | 1252 | ## getCommunityBadgeProgress(steamObj, cb) 1253 | version 1 {IPlayerService} 1254 | ####steamObj 1255 | 1256 | - {string} `key` : Access key 1257 | 1258 | - {uint64} `steamid` : The player we're asking about 1259 | 1260 | - {int32} `badgeid` : The badge we're asking about 1261 | 1262 | ## isPlayingSharedGame(steamObj, cb) 1263 | version 1 {IPlayerService} 1264 | ####steamObj 1265 | 1266 | - {string} `key` : Access key 1267 | 1268 | - {uint64} `steamid` : The player we're asking about 1269 | 1270 | - {uint32} `appid_playing` : The game player is currently playing 1271 | 1272 | ## getTradeOffers(steamObj, cb) 1273 | version 1 {IEconService} 1274 | ####steamObj 1275 | 1276 | - {string} `key` : Access key 1277 | 1278 | - {bool} `get_sent_offers` : Request the list of sent offers. 1279 | 1280 | - {bool} `get_received_offers` : Request the list of received offers. 1281 | 1282 | - {bool} `get_descriptions` : If set, the item display data for the items included in the returned trade offers will also be returned. 1283 | 1284 | - {string} `language` : The language to use when loading item display data. 1285 | 1286 | - {bool} `active_only` : Indicates we should only return offers which are still active, or offers that have changed in state since the time_historical_cutoff 1287 | 1288 | - {bool} `historical_only` : Indicates we should only return offers which are not active. 1289 | 1290 | - {uint32} `time_historical_cutoff` : When active_only is set, offers updated since this time will also be returned 1291 | 1292 | ## getTradeOffer(steamObj, cb) 1293 | version 1 {IEconService} 1294 | ####steamObj 1295 | 1296 | - {string} `key` : Access key 1297 | 1298 | - {uint64} `tradeofferid` : 1299 | 1300 | - {string} `language` : 1301 | 1302 | ## getTradeOffersSummary(steamObj, cb) 1303 | version 1 {IEconService} 1304 | ####steamObj 1305 | 1306 | - {string} `key` : Access key 1307 | 1308 | - {uint32} `time_last_visit` : The time the user last visited. If not passed, will use the time the user last visited the trade offer page. 1309 | 1310 | ## declineTradeOffer(steamObj, cb) 1311 | version 1 {IEconService} 1312 | ####steamObj 1313 | 1314 | - {string} `key` : Access key 1315 | 1316 | - {uint64} `tradeofferid` : 1317 | 1318 | ## cancelTradeOffer(steamObj, cb) 1319 | version 1 {IEconService} 1320 | ####steamObj 1321 | 1322 | - {string} `key` : Access key 1323 | 1324 | - {uint64} `tradeofferid` : 1325 | 1326 | ## reportCheatData(steamObj, cb) 1327 | version 1 {ICheatReportingService} 1328 | ####steamObj 1329 | 1330 | - {string} `key` : Access key 1331 | 1332 | - {uint64} `steamid` : steamid of the user running and reporting the cheat. 1333 | 1334 | - {uint32} `appid` : The appid. 1335 | 1336 | - {string} `pathandfilename` : path and file name of the cheat executable. 1337 | 1338 | - {string} `webcheaturl` : web url where the cheat was found and downloaded. 1339 | 1340 | - {uint64} `time_now` : local system time now. 1341 | 1342 | - {uint64} `time_started` : local system time when cheat process started. ( 0 if not yet run ) 1343 | 1344 | - {uint64} `time_stopped` : local system time when cheat process stopped. ( 0 if still running ) 1345 | 1346 | - {string} `cheatname` : descriptive name for the cheat. 1347 | 1348 | - {uint32} `game_process_id` : process ID of the running game. 1349 | 1350 | - {uint32} `cheat_process_id` : process ID of the cheat process that ran 1351 | 1352 | ## reportAccountRecoveryData(steamObj, cb) 1353 | version 1 {IAccountRecoveryService} 1354 | ####steamObj 1355 | 1356 | - {string} `loginuser_list` : 1357 | 1358 | - {string} `install_config` : 1359 | 1360 | - {string} `shasentryfile` : 1361 | 1362 | - {string} `machineid` : 1363 | 1364 | ## retrieveAccountRecoveryData(steamObj, cb) 1365 | version 1 {IAccountRecoveryService} 1366 | ####steamObj 1367 | 1368 | - {string} `requesthandle` : 1369 | -------------------------------------------------------------------------------- /demos/example.js: -------------------------------------------------------------------------------- 1 | var Steam = require('..'); 2 | var fs = require('fs'); 3 | 4 | // Create a file called STEAM_KEY and stick your API key in it 5 | // (or insert it here) 6 | var steamAPIKey = ''; 7 | if (steamAPIKey.length === 0) { 8 | try { steamAPIKey = fs.readFileSync('../STEAM_KEY').toString();} 9 | catch(e) { 10 | try { steamAPIKey = fs.readFileSync('./STEAM_KEY').toString(); } 11 | catch(e) { console.log('No API key provided'); } 12 | } 13 | } 14 | 15 | Steam.ready(steamAPIKey, function(err) { 16 | if (err) return console.log(err); 17 | 18 | var steam = new Steam({key: steamAPIKey, gameid:Steam.TF2}); 19 | 20 | steam.resolveVanityURL({vanityurl:'jonbo'}, function(err, data) { 21 | console.log(data); // data -> { steamid: '76561197968620915', success: 1 } 22 | 23 | //data.gameid = Steam.TF2; 24 | 25 | // getPlayerItems requires { gameid, steamid } 26 | steam.getPlayerItems(data, function (err, data) { 27 | console.log(data); // data -> { status: 1, num_backpack_slots: 1100, items: [...], ...} 28 | 29 | }); 30 | }); 31 | 32 | }); 33 | 34 | -------------------------------------------------------------------------------- /demos/example_games.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var Steam = require('..'); 3 | //Steam.devMode = true; 4 | 5 | // Create a file called STEAM_KEY and stick your API key in it 6 | // (or insert it here) 7 | Steam.key = ''; 8 | if (Steam.key.length === 0) { 9 | try { Steam.key = fs.readFileSync('../STEAM_KEY').toString();} 10 | catch(e) { 11 | try { Steam.key = fs.readFileSync('./STEAM_KEY').toString(); } 12 | catch(e) { console.log('No API key provided'); } 13 | } 14 | } 15 | 16 | Steam.ready(function(err) { 17 | if (err) return console.log(err); 18 | var steam = new Steam(); 19 | 20 | steam.resolveVanityURL({vanityurl:'jonbo'}, function(err, data) { 21 | console.log(data); 22 | data.include_appinfo = true; 23 | data.include_played_free_games=true; 24 | data.appids_filter=""; 25 | steam.getOwnedGames(data, function(err,data) { 26 | console.log(data); 27 | }); 28 | }) 29 | }); 30 | -------------------------------------------------------------------------------- /demos/example_league_listing.js: -------------------------------------------------------------------------------- 1 | var Steam = require('..'); 2 | var fs = require('fs'); 3 | 4 | // Create a file called STEAM_KEY and stick your API key in it 5 | // (or insert it here) 6 | var steamAPIKey = ''; 7 | if (steamAPIKey.length === 0) { 8 | try { steamAPIKey = fs.readFileSync('../STEAM_KEY').toString();} 9 | catch(e) { 10 | try { steamAPIKey = fs.readFileSync('./STEAM_KEY').toString(); } 11 | catch(e) { console.log('No API key provided'); } 12 | } 13 | } 14 | 15 | Steam.ready(steamAPIKey, function(err) { 16 | if (err) return console.log(err); 17 | 18 | var steam = new Steam({key: steamAPIKey}); 19 | 20 | 21 | steam.getLeagueListing({gameid:Steam.DOTA2}, function(err, listing) { 22 | console.log("Without 'language' field:"); 23 | console.log(listing); 24 | }); 25 | 26 | steam.getLeagueListing({gameid:Steam.DOTA2, language:'en'}, function(err, listing) { 27 | console.log("With 'language' field:"); 28 | console.log(listing); 29 | }); 30 | }); -------------------------------------------------------------------------------- /demos/example_with_promises.js: -------------------------------------------------------------------------------- 1 | var Steam = require('..'); 2 | var fs = require('fs'); 3 | var Promise = require('bluebird'); 4 | 5 | // Create a file called STEAM_KEY and stick your API key in it 6 | // (or insert it here) 7 | var steamAPIKey = ''; 8 | if (steamAPIKey.length === 0) { 9 | try { steamAPIKey = fs.readFileSync('../STEAM_KEY').toString();} 10 | catch(e) { 11 | try { steamAPIKey = fs.readFileSync('./STEAM_KEY').toString(); } 12 | catch(e) { console.log('No API key provided'); } 13 | } 14 | } 15 | 16 | Steam.ready(steamAPIKey, function(err) { 17 | if (err) return console.log(err); 18 | 19 | // Creates an promise wielding function for every method (with Async attached at the end) 20 | Promise.promisifyAll(Steam.prototype); 21 | 22 | var steam = new Steam({key: steamAPIKey}); 23 | 24 | steam.resolveVanityURLAsync({vanityurl:'jonbo'}).bind(steam) 25 | .then(function(data) { 26 | console.log(data); // data -> { steamid: '76561197968620915', success: 1 } 27 | data.gameid = Steam.TF2; 28 | return data; 29 | }) 30 | .then(steam.getPlayerItemsAsync) 31 | .then(function(data) { 32 | console.log(data); // data -> { status: 1, num_backpack_slots: 1100, items: [...], ...} 33 | }); 34 | 35 | }); 36 | 37 | 38 | -------------------------------------------------------------------------------- /demos/example_with_promises_generators.js: -------------------------------------------------------------------------------- 1 | // Requires node 0.11+ and "node --harmony" 2 | 3 | var Steam = require('..'); 4 | var fs = require('fs'); 5 | var Promise = require('bluebird'); 6 | 7 | // Create a file called STEAM_KEY and stick your API key in it 8 | // (or insert it here) 9 | var steamAPIKey = ''; 10 | if (steamAPIKey.length === 0) { 11 | try { steamAPIKey = fs.readFileSync('../STEAM_KEY').toString();} 12 | catch(e) { 13 | try { steamAPIKey = fs.readFileSync('./STEAM_KEY').toString(); } 14 | catch(e) { console.log('No API key provided'); } 15 | } 16 | } 17 | 18 | Steam.ready(steamAPIKey, Promise.coroutine(function*(err) { 19 | if (err) return console.log(err); 20 | 21 | // Creates an promise wielding function for every method (with Async attached at the end) 22 | Promise.promisifyAll(Steam.prototype); 23 | 24 | var steam = new Steam({key: steamAPIKey}); 25 | 26 | var data = yield steam.resolveVanityURLAsync({vanityurl:'jonbo'}); 27 | console.log(data); // data -> { steamid: '76561197968620915', success: 1 } 28 | 29 | data.gameid = Steam.TF2; 30 | data = yield steam.getPlayerItemsAsync(data); 31 | console.log(data); // data -> { status: 1, num_backpack_slots: 1100, items: [...], ...} 32 | 33 | })); 34 | -------------------------------------------------------------------------------- /demos/list_available_methods.js: -------------------------------------------------------------------------------- 1 | var Steam = require('..'); 2 | var fs = require('fs'); 3 | 4 | // Create a file called STEAM_KEY and stick your API key in it 5 | // (or insert it here) 6 | var steamAPIKey = ''; 7 | if (steamAPIKey.length === 0) { 8 | try { steamAPIKey = fs.readFileSync('../STEAM_KEY').toString();} 9 | catch(e) { 10 | try { steamAPIKey = fs.readFileSync('./STEAM_KEY').toString(); } 11 | catch(e) { console.log('No API key provided'); } 12 | } 13 | } 14 | 15 | Steam.ready(steamAPIKey, function(err) { 16 | 17 | if (err) return console.log(err); 18 | var steam = new Steam({key:steamAPIKey}); 19 | 20 | console.log("Generated on "+(new Date()).toUTCString()); 21 | console.log("\n* > 'key' is needed for most methods even if not specified*"+"\n"); 22 | console.log("\n* > 'version' is needed if you want to specify a lower one*"+"\n"); 23 | console.log("\n* > 'language' is available on some methods even if not listed.*"+"\n"); 24 | 25 | steam.getSupportedAPIList({}, function(err, data) { 26 | var interfaces = data.apilist.interfaces, methods, params; 27 | var _interface, _method, param; 28 | for (var i=0; i 0) { 72 | var key = parameters.key, 73 | format = parameters.format, 74 | input = parameters; 75 | delete input['key']; 76 | delete input['format']; 77 | parameters = { 78 | key: key, 79 | input_json: JSON.stringify(input) 80 | }; 81 | if(format){ 82 | parameters.format = format; 83 | } 84 | } 85 | parameters = querystring.stringify(parameters); 86 | } 87 | 88 | var options = { 89 | method: httpMethod, 90 | host : get(this, null, 'host'), 91 | path : '/' + interfaceName + '/' + funcName + '/' + version 92 | }; 93 | if (httpMethod === "GET") { 94 | options.path += '/?' + parameters; 95 | } 96 | else if (httpMethod === "POST") { 97 | options.headers = { 98 | 'Content-Type': 'application/x-www-form-urlencoded', 99 | 'Content-Length': Buffer.byteLength(parameters) 100 | }; 101 | options.data = parameters; 102 | } 103 | 104 | request(this, options, callback); 105 | 106 | }; 107 | 108 | /** 109 | * Helper method to get a value by searching for it by priority 110 | * 111 | * First checking the options object passed in to the method call 112 | * then the instance object properties 113 | * or finally the global Steam object 114 | */ 115 | 116 | // 117 | function get(self, steamObj, key) { 118 | steamObj = steamObj || {}; 119 | if (steamObj[key] !== undefined) { 120 | return steamObj[key]; 121 | } 122 | else if (self[key] !== undefined) { 123 | return self[key]; 124 | } 125 | else if (Steam[key] !== undefined) { 126 | return Steam[key]; 127 | } 128 | else { 129 | throw new Error("Missing required field: "+key); 130 | } 131 | } 132 | 133 | // Handle the actual HTTP request 134 | function request(self, options, callback) { 135 | var _http = get(self, options, 'secure')? https : http; 136 | 137 | if (Steam.devMode) console.log(options); 138 | 139 | var req = _http.request(options, function(res) { 140 | var data, dataStr = ''; 141 | 142 | res.on('data', function (chunk) { 143 | dataStr += chunk; 144 | }); 145 | res.on('end', function(){ 146 | 147 | var statusCode = res.statusCode; 148 | if (statusCode !== 200) { 149 | 150 | if (statusCode === 401) { 151 | return callback(new Error('Invalid API Key')); 152 | } 153 | else { 154 | return callback(new Error("HTTP "+statusCode+" "+http.STATUS_CODES[statusCode])); 155 | } 156 | 157 | } 158 | 159 | // Ensure it is complete and valid JSON 160 | try { 161 | data = JSON.parse(dataStr); 162 | } 163 | catch (e) { 164 | return callback(new Error('Unable to parse JSON data')); 165 | } 166 | 167 | // Trim or simplify data object if it's entirely wrapped in data.response or data.result 168 | if ((data.response instanceof Object) && (Object.keys(data).length === 1)) { 169 | data = data.response; 170 | } 171 | if ((data.result instanceof Object) && Object.keys(data).length === 1) { 172 | data = data.result; 173 | } 174 | callback(null, data); 175 | }) 176 | 177 | }); 178 | 179 | req.end(options.data); 180 | 181 | req.on('error', function(err) { 182 | callback(err); 183 | }); 184 | 185 | } 186 | 187 | // Get the parameters from the steamObj passed in or Steam instance 188 | function getParams(self, steamObj, requiredParams, optionalParams) { 189 | // Required params will throw exception if they don't exist 190 | var paramObj = {}; 191 | for (var i = 0, len = requiredParams.length; i < len; i++) { 192 | var paramName = requiredParams[i]; 193 | 194 | // Support array arguments 195 | paramName = paramName.replace("[0]",""); 196 | 197 | paramObj[paramName] = get(self, steamObj, paramName); 198 | } 199 | 200 | // Ignore the thrown exception on optionalParams if field isn't given 201 | for (var i = 0, len = optionalParams.length; i < len; i++) { 202 | var paramName = optionalParams[i]; 203 | 204 | // Support array arguments 205 | paramName = paramName.replace("[0]",""); 206 | 207 | try { 208 | paramObj[paramName] = get(self, steamObj, paramName); 209 | } catch(e) { 210 | 211 | } 212 | 213 | } 214 | return paramObj; 215 | } 216 | 217 | // Add some easy references to the new method 218 | function addInterfaceMethod(interfaceName, funcName, fN) { 219 | 220 | // Store a reference to every interface/method 221 | if (Steam.INTERFACES[interfaceName] === undefined) { 222 | Steam.INTERFACES[interfaceName] = {}; 223 | } 224 | Steam.INTERFACES[interfaceName][funcName] = fN; 225 | 226 | // Camel case the method name 227 | var name = funcName.substr(0,1).toLowerCase() + funcName.substr(1); 228 | 229 | // Add method to Steam's prototype 230 | if (!isMultiGameInterface(interfaceName)) { 231 | steam[name] = fN; 232 | } 233 | // If multiple interfaces use the same method name 234 | // Create a new method that requires a gameid property to find the correct method 235 | // and call the steam method automatically 236 | else { 237 | // We only need to do this once 238 | if (steam[name] !== undefined) return; 239 | 240 | // e.g. Turns 'IEconItems_440' into 'IEconItems' 241 | var multi_interface_name = interfaceName.split('_')[0]; 242 | 243 | // Add method to Steam's prototype 244 | steam[name] = function(steamObj, callback) { 245 | var gameid = get(this, steamObj, 'gameid'); 246 | 247 | var interface_name = multi_interface_name + '_' + gameid; 248 | 249 | Steam.INTERFACES[interface_name][funcName].call(this, steamObj, callback); 250 | }; 251 | } 252 | 253 | } 254 | 255 | // Builds the method and add references 256 | function buildSteamWrapperMethod(interfaceName, funcName, defaultVersion, httpMethod, requiredParams, optionalParams) { 257 | 258 | // Always include the key and language fields, if available 259 | // GetSupportedAPIList doesn't always list them. 260 | optionalParams.push('key'); 261 | optionalParams.push('language'); 262 | 263 | // Require gameid for methods with the same name in the different interfaces 264 | if (isMultiGameInterface(interfaceName)) { 265 | requiredParams.push('gameid'); 266 | } 267 | 268 | var wrapperMethod = function(steamObj, callback) { 269 | var params = getParams(this, steamObj, requiredParams, optionalParams); 270 | var version = steamObj.version || defaultVersion; 271 | this.request(interfaceName, funcName, version, httpMethod, params, callback); 272 | }; 273 | 274 | addInterfaceMethod(interfaceName, funcName, wrapperMethod); 275 | } 276 | 277 | // All we need to get started, we will build and attach the rest later (down below) 278 | buildSteamWrapperMethod('ISteamWebAPIUtil', 'GetSupportedAPIList', 1, "GET", [], ['key']); 279 | 280 | // Retrieve all Steam WebAPI http methods and add to our class prototype 281 | function retrieveSteamAPIMethods(key, callback) { 282 | 283 | var _steam = new Steam(); 284 | _steam.getSupportedAPIList({key:key}, function(err, data) { 285 | 286 | if (err) return callback(err); 287 | 288 | var apiList = data.apilist; 289 | if (apiList === undefined) return callback(new Error('No data returned')); 290 | 291 | apiList = apiList.interfaces; 292 | 293 | // List of interfaces 294 | for (var i= 0; i true, ISteamNews -> false 324 | function isMultiGameInterface(_interface) { 325 | return _interface.indexOf('_') !== -1; 326 | } 327 | 328 | 329 | 330 | // Object extend 331 | function extend(destination, source) { 332 | for (var property in source) { 333 | if (source.hasOwnProperty((property))) { 334 | destination[property] = source[property]; 335 | } 336 | 337 | } 338 | return destination; 339 | } 340 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "steam-webapi", 3 | "version" : "0.6.5", 4 | "description": "Steam WebAPI wrapper", 5 | "keywords" : [ 6 | "steam", "tf2", "team fortress 2", "dota2", "csgo", "portal 2" 7 | ], 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/jonbo/node-steam-webapi" 11 | }, 12 | "dependencies" : { 13 | "qs": "~1.2.2" 14 | }, 15 | 16 | "devDependencies": { 17 | "mocha": "~1.21.4", 18 | "should": "~4.0.4" 19 | }, 20 | "license": "MIT", 21 | "main" : "index.js", 22 | 23 | "scripts": { 24 | "test": "./node_modules/.bin/mocha --require should --harmony-generators --reporter spec --bail", 25 | "demo1": "node demos/example.js", 26 | "demo2": "npm install bluebird && node demos/example_with_promises.js", 27 | "demo3": "npm install bluebird && node --harmony demos/example_with_promises_generators.js", 28 | "demo4": "node demos/example_games.js", 29 | "demo5": "node demos/example_league_listing.js", 30 | "list": "node demos/list_available_methods > api_method_list.md", 31 | "clean": "rm -rf node_modules" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var Steam = require('..'); 3 | 4 | // Create a file called STEAM_KEY and stick your API key in it 5 | // (or insert it here) 6 | var steamAPIKey = ''; 7 | try{ steamAPIKey = fs.readFileSync('../STEAM_KEY').toString(); } catch(e) {} 8 | try{ steamAPIKey = fs.readFileSync('./STEAM_KEY').toString(); } catch(e) {} 9 | 10 | describe('Node-Steam-WebAPI', function() { 11 | this.timeout(10000); // Steam is slow sometimes 12 | 13 | describe('Initializing', function() { 14 | 15 | it('(you) should have provided a SteamAPI key', function() { 16 | steamAPIKey.should.not.be.empty; 17 | }); 18 | 19 | it('should get list of methods (old alternative)', function(done) { 20 | Steam.ready(steamAPIKey, function(err) { 21 | if (err) return done(err); 22 | 23 | Steam.prototype.resolveVanityURL.should.be.a.Function; 24 | Steam.prototype.getPlayerItems.should.be.a.Function; 25 | Steam.prototype.getFriendList.should.be.a.Function; 26 | 27 | // For the next test 28 | delete Steam.prototype.resolveVanityURL; 29 | delete Steam.prototype.getPlayerItems; 30 | delete Steam.prototype.getFriendList; 31 | 32 | done(); 33 | }); 34 | }); 35 | 36 | it('should get list of methods', function(done) { 37 | Steam.key = steamAPIKey; 38 | Steam.ready(function(err) { 39 | if (err) return done(err); 40 | 41 | Steam.prototype.resolveVanityURL.should.be.a.Function; 42 | Steam.prototype.getPlayerItems.should.be.a.Function; 43 | Steam.prototype.getFriendList.should.be.a.Function; 44 | 45 | done(); 46 | }); 47 | }); 48 | 49 | }); 50 | 51 | describe('Retrieve a TF2 backpack', function() { 52 | it('should work with key in global', function(done) { 53 | var steam = new Steam({gameid:Steam.TF2}); 54 | 55 | steam.resolveVanityURL({vanityurl:'jonbo'}, function(err, data) { 56 | if (err) return done(err); 57 | steam.getPlayerItems(data, function (err, data) { 58 | if (err) return done(err); 59 | 60 | data.status.should.be.ok; 61 | data.items.length.should.be.above(1); 62 | done(); 63 | }); 64 | }); 65 | }); 66 | it('should not work with no key provided', function(done) { 67 | Steam.key = undefined; 68 | var steam = new Steam({gameid:Steam.TF2}); 69 | 70 | try { 71 | steam.resolveVanityURL({vanityurl: 'jonbo'}, function (err, data) { 72 | if (err) return done(err); 73 | steam.getPlayerItems(data, function (err, data) { 74 | if (err) return done(err); 75 | 76 | data.status.should.be.ok; 77 | data.items.length.should.be.above(1); 78 | done(); 79 | }); 80 | }); 81 | } catch (e) { 82 | // should throw 83 | return done(); 84 | } 85 | done(new Error('Did not throw error with no key')); 86 | }); 87 | 88 | it('should work with key in instance', function(done) { 89 | Steam.key = undefined; 90 | var steam = new Steam({key: steamAPIKey, gameid:Steam.TF2}); 91 | 92 | steam.resolveVanityURL({vanityurl:'jonbo'}, function(err, data) { 93 | if (err) return done(err); 94 | steam.getPlayerItems(data, function (err, data) { 95 | if (err) return done(err); 96 | 97 | data.status.should.be.ok; 98 | data.items.length.should.be.above(1); 99 | done(); 100 | }); 101 | }); 102 | }); 103 | 104 | it('should work with key in options', function(done) { 105 | Steam.key = undefined; 106 | var steam = new Steam({gameid:Steam.TF2}); 107 | 108 | steam.resolveVanityURL({key: steamAPIKey, vanityurl:'jonbo'}, function(err, data) { 109 | if (err) return done(err); 110 | 111 | data.key = steamAPIKey; 112 | steam.getPlayerItems(data, function (err, data) { 113 | if (err) return done(err); 114 | 115 | data.status.should.be.ok; 116 | data.items.length.should.be.above(1); 117 | done(); 118 | }); 119 | }); 120 | }); 121 | 122 | 123 | }); 124 | describe('Special cases', function() { 125 | it('should work with array arguments and POST methods', function(done) { 126 | var steam = new Steam({key:steamAPIKey}); 127 | steam.getPublishedFileDetails( 128 | {publishedfileids:[173705800, 173705716], itemcount:2}, 129 | function(err, data) { 130 | data.publishedfiledetails.should.have.lengthOf(2); 131 | done(); 132 | } 133 | ); 134 | }); 135 | }); 136 | 137 | }); --------------------------------------------------------------------------------