Documentation
¶
Overview ¶
Package steamspy exposes SteamSpy as a kit Domain driver. A multi-domain host (ant) enables it with a single blank import:
import _ "github.com/tamnd/steamspy-cli/steamspy"
The same Domain also builds the standalone steamspy binary (see cli/root.go), so the binary and a host share one source of truth.
Package steamspy is the library behind the steamspy command line: the HTTP client, request shaping, and the typed data models for SteamSpy (steamspy.com). No API key required.
The Client sets a real User-Agent, paces requests to stay polite, and retries transient failures (429 and 5xx).
Index ¶
- Constants
- type Client
- func (c *Client) App(ctx context.Context, appID int) (*Game, error)
- func (c *Client) Genre(ctx context.Context, genre string, page int) ([]Game, error)
- func (c *Client) Tag(ctx context.Context, tag string, page int) ([]Game, error)
- func (c *Client) Top(ctx context.Context, period string) ([]Game, error)
- type Config
- type Domain
- type Game
Constants ¶
const Host = "steamspy.com"
Host is the site this client talks to.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to steamspy over HTTP.
func (*Client) Genre ¶ added in v0.1.1
Genre fetches games in the given genre (paginated, page starts at 0).
type Config ¶ added in v0.1.1
type Config struct {
BaseURL string
UserAgent string
Rate time.Duration
Timeout time.Duration
Retries int
}
Config holds all tunable parameters for the Client.
func DefaultConfig ¶ added in v0.1.1
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults.
type Domain ¶
type Domain struct{}
Domain is the steamspy driver.
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, the hostnames a pasted link is matched against, and the identity reused for the binary's help and version.
type Game ¶ added in v0.1.1
type Game struct {
AppID int `json:"appid"`
Name string `json:"name"`
Developer string `json:"developer"`
Publisher string `json:"publisher"`
Positive int `json:"positive"`
Negative int `json:"negative"`
Owners string `json:"owners"` // e.g. "10,000,000 .. 20,000,000"
AverageForever int `json:"average_forever"` // average play time in minutes, all time
Average2Weeks int `json:"average_2weeks"` // average play time in minutes, last 2 weeks
Price string `json:"price"` // cents as string, "0" = free
CCU int `json:"ccu"` // current concurrent users
Languages string `json:"languages"`
Genre string `json:"genre"`
ScoreRank string `json:"score_rank"`
}
Game holds metadata and stats for one Steam game from SteamSpy.