JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 19
  • Score
    100M100P100Q36726F
  • License MIT

A package for fetching game data from Steam APIs

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (steamgames) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    📦 steamgames

    GitHub npm npm

    A simple and typed TypeScript wrapper for the Steam Web and Store APIs. Query app lists, game details, and more with clean, promise-based functions.


    🚀 Features

    • 🔍 Get full Steam app list
    • 🆔 Convert app names to Steam IDs
    • 🎮 Fetch game details with filters
    • 🔌 Fully typed and ESM-compatible
    • ⚙️ Easily extendable API architecture

    📦 Installation

    npm install steamgames

    📦 steamgames Documentation

    This package provides convenient functions to fetch game data from the Steam API. Below are the available functions, their descriptions, and usage examples.


    Functions

    0. getSteamIDList

    Fetches the full list of Steam apps (games and software) from the Steam API.

    Signature:

    getSteamIDList(): Promise<ListAPIResponse>

    Returns: A promise that resolves to the full app list object as returned by the Steam API.

    Example:

    import { getSteamIDList } from 'steam-api-wrapper';
    
    async function showAppList() {
      const appList = await getSteamIDList();
      console.log(appList.applist.apps.app); // Array of { appid, name }
    }
    
    showAppList();

    1. getSteamGameDetails

    Fetches detailed information about a Steam game by its appid.

    Signature:

    getSteamGameDetails(appid: number, country?: string): Promise<APIResponse>

    Example:

    import { getSteamGameDetails } from 'steam-api-wrapper';
    
    const appid = 292030; // The Witcher 3: Wild Hunt
    const country = 'de'; // Optional country code
    
    getSteamGameDetails(appid, country).then(result => {
      if (result.success) {
        console.log('Game name:', result.data.name);
        console.log('Game price details:', result.data.price_overview);
      } else {
        console.log('No data exists for this game.');
      }
    });

    2. getSteamGameNamefromID

    Finds the game name for a given Steam appid.

    Signature:

    getSteamGameNamefromID(appid: string): Promise<string | undefined>

    Example:

    import { getSteamGameNamefromID } from 'steam-api-wrapper';
    
    getSteamGameNamefromID('292030').then(name => {
      if (name) {
        console.log('Game name:', name);
      } else {
        console.log('Game not found.');
      }
    });

    3. getSteamIDforGame

    Finds the Steam appid for a given game name (case-insensitive, substring match).

    Signature:

    getSteamIDforGame(gameName: string): Promise<number | undefined>

    Example:

    import { getSteamIDforGame } from 'steam-api-wrapper';
    
    getSteamIDforGame('Witcher 3').then(appid => {
      if (appid) {
        console.log('Found appid:', appid);
      } else {
        console.log('Game not found.');
      }
    });

    4. getSteamPriceOverview

    Fetches price overview for one or more Steam appids.

    Signature:

    getSteamPriceOverview(appids: number[], country?: string): Promise<PriceAPIResponse>

    Example:

    import { getSteamPriceOverview } from 'steam-api-wrapper';
    
    const appids = [3240220, 292030];
    const country = 'de';
    
    getSteamPriceOverview(appids, country).then(result => {
      for (const appid of appids) {
        const price = result[appid]?.data?.price_overview?.final_formatted;
        console.log(`Price of game with appid ${appid}:`, price);
      }
    });

    5. Combined Example: Get Game Name and Price

    Fetches the price and name for multiple appids using both getSteamPriceOverview and getSteamGameNamefromID.

    Example:

    import { getSteamPriceOverview } from 'steam-api-wrapper';
    import { getSteamGameNamefromID } from 'steam-api-wrapper';
    
    async function testGetSteamGameAPIs() {
      const appids = [3240220, 292030, 377160];
      const country = 'de'; // Example country code
    
      try {
        const result = await getSteamPriceOverview(appids, country);
    
        for (const appid of appids) {
          const price = result[appid]?.data?.price_overview?.final_formatted;
          const appiStr = String(appid);
          const name = await getSteamGameNamefromID(appiStr);
          console.log(`Current Price of  ${name}:`, price);
        }
      } catch (error) {
        console.error('Error fetching game details:', error);
      }
    }
    
    // Call the test
    testGetSteamGameAPIs();

    Notes

    • All functions are asynchronous and return Promises.
    • Make sure to handle errors using try/catch or .catch().
    • You can import these functions directly from the package after building and publishing.

    For more details, see the source code or open an issue on the repository.