owned

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package owned lists the games a user's store accounts own, installed or not: Steam (with the user's own Web API key), GOG (from GOG Galaxy's local database) and Epic (after a sign-in the user completes in the browser). It only reads; installing is left to the store's own app.

Index

Constants

This section is empty.

Variables

View Source
var EpicLoginURL = "https://www.epicgames.com/id/login?redirectUrl=" +
	url.QueryEscape("https://www.epicgames.com/id/api/redirect?clientId="+epicClientID+"&responseType=code")

EpicLoginURL is the page where the user signs in to Epic. After signing in it shows a short JSON text with an "authorizationCode".

View Source
var ErrNoAchievements = achievements.ErrNone

ErrNoAchievements means the store says the game has no achievements.

View Source
var ErrSteamPrivate = errors.New("Steam didn't list any games. In Steam, set your profile's Game details to Public, or check the key")

ErrSteamPrivate means Steam answered without a game list.

View Source
var GOGLoginURL = gogAuthHost + "/auth?client_id=" + gogClientID +
	"&redirect_uri=" + url.QueryEscape(gogRedirect) + "&response_type=code&layout=client2"

GOGLoginURL is the page where the user signs in to GOG. Afterwards the browser lands on a page whose address holds the code.

Functions

func EpicCode

func EpicCode(pasted string) (string, bool)

EpicCode finds the authorization code in what the user pasted: the code itself, or the whole JSON text the sign-in page shows.

func EpicLocale added in v1.6.0

func EpicLocale(steamLang string) string

EpicLocale is the Epic store locale for a Steam language name.

func GOG

func GOG(dbPath string) ([]library.Owned, error)

GOG lists the GOG games in GOG Galaxy's library, with Galaxy's playtime. Galaxy keeps it up to date while it runs; nothing is sent anywhere.

func GOGCode added in v1.6.0

func GOGCode(pasted string) (string, bool)

GOGCode finds the code in what the user pasted: the whole address the sign-in ended on, or the code alone.

func GOGUnlocks added in v1.6.0

func GOGUnlocks(dbPath, gogID string) (map[string]achievements.Unlock, error)

GOGUnlocks reads what GOG Galaxy's database knows the account unlocked in a game (by its product id): Galaxy syncs it while it runs.

func GalaxyDB

func GalaxyDB() string

GalaxyDB is GOG Galaxy's local database ("" when Galaxy isn't installed).

func SteamID

func SteamID() (string, error)

SteamID returns the steamID64 of the account Steam uses on this PC.

func ValidSteamKey

func ValidSteamKey(s string) bool

ValidSteamKey reports whether s looks like a Steam Web API key.

Types

type Client

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

Client makes the requests. The zero value is not usable; use NewClient.

func NewClient

func NewClient() *Client

NewClient makes a client that only reaches the allowlisted hosts.

func (*Client) Epic

func (c *Client) Epic(ctx context.Context, access string) ([]library.Owned, error)

Epic lists the games an Epic account owns (no DLC, no Unreal Engine assets). Epic doesn't report playtime here.

func (*Client) EpicAchievements added in v1.6.0

func (c *Client) EpicAchievements(ctx context.Context, sandbox, locale string) ([]achievements.Def, map[string]float64, error)

EpicAchievements are a game's achievements on Epic (by its sandbox, the namespace), with Epic's own rarity. No sign-in needed.

func (*Client) EpicPlayerAchievements added in v1.6.0

func (c *Client) EpicPlayerAchievements(ctx context.Context, access, account, sandbox string) (map[string]achievements.Unlock, error)

EpicPlayerAchievements is what a signed-in Epic account unlocked in a game.

func (*Client) EpicRefresh

func (c *Client) EpicRefresh(ctx context.Context, refresh string) (EpicToken, error)

EpicRefresh gets a new access token (and refresh token) for a signed-in account.

func (*Client) EpicSignIn

func (c *Client) EpicSignIn(ctx context.Context, code string) (EpicToken, error)

EpicSignIn trades the one-time code from the sign-in page for tokens.

func (*Client) GOGAchievements added in v1.6.0

func (c *Client) GOGAchievements(ctx context.Context, access, game, userID string) ([]achievements.Def, map[string]achievements.Unlock, map[string]float64, error)

GOGAchievements are a game's achievements with the account's progress and GOG's rarity, from gameplay.gog.com. game is the game's client id (from its goggame-<id>.info) or, failing that, its product id.

func (*Client) GOGRefresh added in v1.6.0

func (c *Client) GOGRefresh(ctx context.Context, refresh string) (GOGToken, error)

GOGRefresh gets a new access token (and refresh token).

func (*Client) GOGSignIn added in v1.6.0

func (c *Client) GOGSignIn(ctx context.Context, code string) (GOGToken, error)

GOGSignIn trades the one-time code for tokens.

func (*Client) Steam

func (c *Client) Steam(ctx context.Context, key, steamID string) ([]library.Owned, error)

Steam lists the games a Steam account owns, with Steam's playtime.

func (*Client) SteamAchievementSchema added in v1.6.0

func (c *Client) SteamAchievementSchema(ctx context.Context, key string, appID int, lang string) ([]achievements.Def, error)

SteamAchievementSchema is GetSchemaForGame: the game's achievements in language lang, with icon URLs. Needs the user's Web API key.

func (*Client) SteamPlayerAchievements added in v1.6.0

func (c *Client) SteamPlayerAchievements(ctx context.Context, key, steamID string, appID int) (map[string]achievements.Unlock, error)

SteamPlayerAchievements is GetPlayerAchievements: what the account unlocked, and when. Needs the key; the profile's game details must be public.

func (*Client) SteamRarity added in v1.6.0

func (c *Client) SteamRarity(ctx context.Context, appID int) (map[string]float64, error)

SteamRarity is GetGlobalAchievementPercentagesForApp: the share of all players who have each achievement. No key needed.

type EpicToken

type EpicToken struct {
	AccessToken  string    `json:"access_token"`
	RefreshToken string    `json:"refresh_token"`
	AccountID    string    `json:"account_id"`
	DisplayName  string    `json:"displayName"`
	ExpiresAt    time.Time `json:"expires_at"`
}

EpicToken is a signed-in Epic account. Only RefreshToken needs keeping (encrypted); an access token lasts a few hours.

type GOGToken added in v1.6.0

type GOGToken struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	UserID       string `json:"user_id"`
	ExpiresIn    int64  `json:"expires_in"`
}

GOGToken is a signed-in GOG account. Only RefreshToken is kept (encrypted).

type HTTPError

type HTTPError struct {
	Status int
	Body   string
}

HTTPError is a failed request.

func (*HTTPError) Error

func (e *HTTPError) Error() string

type Result

type Result struct {
	Store string
	Games []library.Owned
}

Result is one store's list.

Jump to

Keyboard shortcuts

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