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 ¶
- Variables
- func EpicCode(pasted string) (string, bool)
- func GOG(dbPath string) ([]library.Owned, error)
- func GalaxyDB() string
- func SteamID() (string, error)
- func ValidSteamKey(s string) bool
- type Client
- func (c *Client) Epic(ctx context.Context, access string) ([]library.Owned, error)
- func (c *Client) EpicRefresh(ctx context.Context, refresh string) (EpicToken, error)
- func (c *Client) EpicSignIn(ctx context.Context, code string) (EpicToken, error)
- func (c *Client) Steam(ctx context.Context, key, steamID string) ([]library.Owned, error)
- type EpicToken
- type HTTPError
- type Result
Constants ¶
This section is empty.
Variables ¶
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".
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 ¶
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 ¶
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 ValidSteamKey ¶
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 ¶
Epic lists the games an Epic account owns (no DLC, no Unreal Engine assets). Epic doesn't report playtime here.
func (*Client) EpicRefresh ¶
EpicRefresh gets a new access token (and refresh token) for a signed-in account.
func (*Client) EpicSignIn ¶
EpicSignIn trades the one-time code from the sign-in page for tokens.
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.