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
- type Client
- func (c *Client) BySteamIDs(ctx context.Context, ids ...int) ([]Game, error)
- func (c *Client) ByURL(ctx context.Context, pageURL string) (*Game, error)
- func (c *Client) Lookup(ctx context.Context, name string) (*Game, error)
- func (c *Client) Search(ctx context.Context, name string, limit int) ([]Game, error)
- type Error
- type Game
- type Offer
- type Response
Constants ¶
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 (*Client) BySteamIDs ¶
BySteamIDs looks up to MaxBatch Steam app IDs in one request (unknown IDs are left out).
func (*Client) ByURL ¶
ByURL looks up a Steam store page (store.steampowered.com/app/...) or one of our game pages.
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).