gameprices

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Go client: SuperDuperBundle Game Price API

go get github.com/superduperbundle/game-price-api/go
import gameprices "github.com/superduperbundle/game-price-api/go"

c := gameprices.New()
g, err := c.Lookup(ctx, "Elden Ring")
if err == nil && g != nil && g.Lowest != nil {
	fmt.Printf("%s: $%.2f at %s (%s)\n", g.Name, g.Lowest.Price, g.Lowest.StoreName, g.URL)
}
games, _ := c.BySteamIDs(ctx, 1245620, 1091500) // up to 50 per request

Lowest listed PC key prices in US dollars across the official stores and key stores SuperDuperBundle compares. No key needed; a free key raises the rate limit (c.APIKey). Docs and terms: https://superduperbundle.com/tools/api/

Code: MIT (see the repository LICENSE). When you show a price, link it to the game's URL (attribution required by the API terms).

Documentation

Overview

Package gameprices is the Go client for the SuperDuperBundle Game Price API (https://superduperbundle.com/tools/api/): the lowest listed PC game key price for a game, by name, Steam app ID or Steam store URL, with a link to the full comparison.

No dependencies, no API key needed (a free key raises the rate limit). Code: MIT. Data: under the API terms (https://superduperbundle.com/tools/api/#terms): whenever you display a price, show a visible link to SuperDuperBundle (link it to the game's URL).

Index

Constants

View Source
const (
	BaseURL  = "https://superduperbundle.com/api/v1"
	MaxBatch = 50
)

BaseURL is the API root. MaxBatch is the most Steam app IDs one request takes.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL    string
	APIKey     string // optional free key (sdb_...)
	AppName    string // optional: tags compare links so we can see which tools send visitors
	HTTPClient *http.Client
}

Client calls the API. Use New for the defaults.

func New

func New() *Client

New returns a client with a 15-second timeout.

func (*Client) BySteamIDs

func (c *Client) BySteamIDs(ctx context.Context, ids ...int) ([]Game, error)

BySteamIDs looks up to MaxBatch Steam app IDs in one request (unknown IDs are left out).

func (*Client) ByURL

func (c *Client) ByURL(ctx context.Context, pageURL string) (*Game, error)

ByURL looks up a Steam store page (store.steampowered.com/app/...) or one of our game pages.

func (*Client) Lookup

func (c *Client) Lookup(ctx context.Context, name string) (*Game, error)

Lookup returns the best match for a name, or nil when nothing matched.

func (*Client) Search

func (c *Client) Search(ctx context.Context, name string, limit int) ([]Game, error)

Search finds games by name (typos and nicknames such as "rdr2" are handled); limit 1-10.

type Error

type Error struct {
	Status     int
	Code       string
	Message    string
	RetryAfter int
}

Error is a non-2xx answer. RetryAfter is set (seconds) on 429.

func (*Error) Error

func (e *Error) Error() string

type Game

type Game struct {
	ID             string   `json:"id"`
	Name           string   `json:"name"`
	SteamAppID     *int     `json:"steam_app_id"`
	URL            string   `json:"url"`
	Image          *string  `json:"image"`
	State          string   `json:"state"`
	Currency       string   `json:"currency"`
	ListPrice      *float64 `json:"list_price"`
	Lowest         *Offer   `json:"lowest"`
	LowestSteamKey *Offer   `json:"lowest_steam_key"`
	StoreCount     int      `json:"store_count"`
	OfferCount     int      `json:"offer_count"`
	Offers         []Offer  `json:"offers"`
}

Game is one game's answer. State is "price", "free", "unreleased" or "not_on_sale".

type Offer

type Offer struct {
	Store       string  `json:"store"`
	StoreName   string  `json:"store_name"`
	StoreType   string  `json:"store_type"`
	Price       float64 `json:"price"`
	DRM         *string `json:"drm"`
	Region      *string `json:"region"`
	CheckedAt   *string `json:"checked_at"`
	DiscountPct *int    `json:"discount_pct,omitempty"`
}

Offer is one store's listed price for a game (US dollars).

type Response

type Response struct {
	API         string   `json:"api"`
	Count       int      `json:"count"`
	Results     []Game   `json:"results"`
	NotFound    []string `json:"not_found,omitempty"`
	Attribution struct {
		Text string `json:"text"`
		URL  string `json:"url"`
	} `json:"attribution"`
}

Response is the API envelope.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL