Documentation
¶
Overview ¶
Package steam is the library behind the steam command: the HTTP client, request shaping, and typed data models for the Steam game store.
Two base APIs:
- https://store.steampowered.com/api — store catalog (no key required)
- appreviews endpoint on store.steampowered.com (no key required)
Index ¶
- Constants
- Variables
- func ParseAppID(s string) (int, error)
- type Client
- func (c *Client) GameDetails(ctx context.Context, appid int) (GameDetail, error)
- func (c *Client) NewReleases(ctx context.Context, limit int) ([]Game, error)
- func (c *Client) Reviews(ctx context.Context, appid, limit int) ([]Review, error)
- func (c *Client) Search(ctx context.Context, query string, limit int) ([]Game, error)
- func (c *Client) Specials(ctx context.Context, limit int) ([]Game, error)
- func (c *Client) TopSellers(ctx context.Context, limit int) ([]Game, error)
- type Config
- type Domain
- type Game
- type GameDetail
- type Review
Constants ¶
const DefaultUserAgent = "steam/dev (+https://github.com/tamnd/steam-cli)"
DefaultUserAgent identifies the client to Steam.
const Host = "store.steampowered.com"
Host is the Steam store hostname, used by the kit domain driver.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when an app is unavailable or the API returns no data.
Functions ¶
func ParseAppID ¶
ParseAppID parses a bare integer or a Steam store URL into an appid. Accepted forms:
570 https://store.steampowered.com/app/570/ https://store.steampowered.com/app/570/Dota_2/
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the Steam store APIs.
func (*Client) GameDetails ¶
GameDetails returns full details for a single app by appid.
func (*Client) NewReleases ¶
NewReleases returns the newest released games on the store.
func (*Client) Reviews ¶
Reviews returns user reviews for appid. It paginates until limit is reached.
type Config ¶
type Config struct {
UserAgent string
Rate time.Duration
Retries int
Timeout time.Duration
// BaseURL overrides the Steam store API base for testing.
// Defaults to "https://store.steampowered.com/api".
BaseURL string
}
Config holds constructor parameters.
type Domain ¶ added in v0.1.1
type Domain struct{}
Domain is the steam kit driver. Register it with a blank import:
import _ "github.com/tamnd/steam-cli/steam"
func (Domain) Info ¶ added in v0.1.1
func (Domain) Info() kit.DomainInfo
type Game ¶
type Game struct {
Rank int `json:"rank"`
ID int `json:"id"`
Name string `json:"name"`
Price string `json:"price"`
Discount int `json:"discount"`
URL string `json:"url"`
}
Game is the record emitted for list commands: top-sellers, new-releases, specials, search.
type GameDetail ¶
type GameDetail struct {
ID int `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Description string `json:"description"`
Developers string `json:"developers"`
Publishers string `json:"publishers"`
Price string `json:"price"`
Discount int `json:"discount"`
Released string `json:"released"`
Metacritic int `json:"metacritic"`
Genres string `json:"genres"`
IsFree bool `json:"is_free"`
URL string `json:"url"`
}
GameDetail is the record emitted by the game command.