steamspy

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

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

View Source
const Host = "steamspy.com"

Host is the site this client talks to.

Variables

This section is empty.

Functions

This section is empty.

Types

type App added in v0.1.2

type App struct {
	AppID     int    `kit:"id" json:"appid"`
	Name      string `json:"name"`
	Developer string `json:"developer"`
	Genre     string `json:"genre"`
	Owners    string `json:"owners"`
	Positive  int    `json:"positive"`
	Negative  int    `json:"negative"`
	Price     string `json:"price"`
	AvgHours  string `json:"avg_hours"`
	TopTags   string `json:"top_tags"`
}

App is the output record for a Steam game.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client talks to steamspy over HTTP.

func NewClient

func NewClient(cfg Config) *Client

NewClient returns a Client configured with cfg.

func (*Client) App added in v0.1.1

func (c *Client) App(ctx context.Context, appID int) (*App, error)

App fetches game details for a given Steam app ID.

func (*Client) Genre added in v0.1.1

func (c *Client) Genre(ctx context.Context, genre string, limit int) ([]App, error)

Genre fetches games in the given genre, sorted by Positive desc, limited to limit.

func (*Client) Search added in v0.1.2

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

Search searches games by name term, limited to limit results.

func (*Client) Top added in v0.1.1

func (c *Client) Top(ctx context.Context, limit int) ([]App, error)

Top fetches the top 100 games by 2-week players, sorted by Positive desc, limited to limit.

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) Classify

func (Domain) Classify(input string) (uriType, id string, err error)

Classify turns an input into the canonical (type, id).

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.

func (Domain) Locate

func (Domain) Locate(t, id string) (string, error)

Locate returns the live https URL for a (type, id).

func (Domain) Register

func (Domain) Register(app *kit.App)

Register installs the client factory and every operation onto app.

Jump to

Keyboard shortcuts

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