Code Monkey home page Code Monkey logo

steam's Introduction

Steam

Node.js CI codecov semantic-release: angular

Interface to the Steam Web API, fully typed, written in TypeScript. (Wrapper for the Steam Web API)

Steam

Valve provides these APIs so website developers can use data from Steam in new and interesting ways. They allow developers to query Steam for information that they can present on their own sites.

The Steam Web API is a RESTful web service designed to be called from a web browser using JavaScript, or from a server using a standard HTTP library.

I designed this library to make it easy to use the Steam Web API in your projects - Contributions are more than welcome! Feel free to submit your ideas by opening a new issue or creating a Pull Request.

Features / Roadmap

  • News
  • Player
  • User
  • User Stats

News

  • Get News For App

Player

  • Get Owned Games
  • Get Recently Played Games

User

  • Get PlayerSummaries
  • Get IFriend List

User Stats

  • Get Player Achievements
  • Get Global Achievements Percentages For App
  • Get User Stats For Game

Installation

# With npm
npm install @varandas/steam

# Or with yarn
yarn add @varandas/steam

Usage

Please note that you need to register for a Steam Web API key.

Also be aware that the Steam Web API only works on a node environment. Requests made from the browser will fail.

With es6 modules

import SteamApi, { IGetNewsForAppParams, IGetNewsForAppResponse } from '@varandas/steam'

// Create a new client
const steamApi = new SteamApi("YOUR_STEAM_API_KEY")

// Get the services as needed
const newsService = steamApi.getNewsService()
const playerService = steamApi.getPlayerService()
const userService = steamApi.getUserService()
const userStatsService = steamApi.getUserStatsService()

Or with commonjs

const SteamApi = require('@varandas/steam').default

Documentation

SteamApi

// Main class, use it to create the services. 
const steamApi = new SteamApi("YOUR_STEAM_API_KEY")

News Service

// Get the news service from the client
const newsService = steamApi.getNewsService()

// Get News For App
const news = await newsService.getNewsForApp({
  appid: 440,
  count: 3,
  maxlength: 300,
})

User Service

// Get the user service
const userService = steamApi.getUserService()

// Get Player Summaries
const users = await userService.getPlayerSummaries({
  steamids: ['76561198000000000', '76561198000000001'],
})

// Get IFriend List
const friends = await userService.getFriendList({
  steamid: '76561198000000000',
  relationship: 'all',
})

User Stats Service

// Get the user stats service
const userStatsService = steamApi.getUserStatsService()

// Get Player Achievements
const achievements = await userStatsService.getPlayerAchievements({
  steamid: '76561198000000000',
  appid: 440,
})

// Get Global Achievements Percentages For App
const achievements = await userStatsService.getGlobalAchievementsPercentagesForApp({
  gameid: 440,
})

// Get User Stats For Game
const stats = await userStatsService.getUserStatsForGame({
  steamid: '76561198000000000',
  appid: 440,
})

Player Service

// Get the player service
const playerService = steamApi.getPlayerService()

// Get Owned Games
const games = await playerService.getOwnedGames({
  steamId: '76561198000000000',
  includeAppInfo: true,
  includePlayedFreeGames: true,
})

// Get Recently Played Games
const games = await playerService.getRecentlyPlayedGames({
  steamid: '76561198000000000',
  count: 3,
})

License

MIT - 2023 André Varandas

Disclaimer

This project is not affiliated with Valve Corporation or Steam. All trademarks are property of their respective owners in the US and other countries. ©2023 Valve Corporation. Steam and the Steam logo are trademarks and/or registered trademarks of Valve Corporation in the U.S. and/or other countries.

steam's People

Contributors

andrevarandas avatar dependabot[bot] avatar

Stargazers

Devyn Spencer avatar Fabian Wimmer avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.