owned

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: AGPL-3.0 Imports: 19 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 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.

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

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