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 EpicLocale(steamLang string) string
- func GOG(dbPath string) ([]library.Owned, error)
- func GOGCode(pasted string) (string, bool)
- func GOGUnlocks(dbPath, gogID string) (map[string]achievements.Unlock, 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) EpicAchievements(ctx context.Context, sandbox, locale string) ([]achievements.Def, map[string]float64, error)
- func (c *Client) EpicPlayerAchievements(ctx context.Context, access, account, sandbox string) (map[string]achievements.Unlock, 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) GOGAchievements(ctx context.Context, access, game, userID string) ([]achievements.Def, map[string]achievements.Unlock, map[string]float64, error)
- func (c *Client) GOGRefresh(ctx context.Context, refresh string) (GOGToken, error)
- func (c *Client) GOGSignIn(ctx context.Context, code string) (GOGToken, error)
- func (c *Client) Steam(ctx context.Context, key, steamID string) ([]library.Owned, error)
- func (c *Client) SteamAchievementSchema(ctx context.Context, key string, appID int, lang string) ([]achievements.Def, error)
- func (c *Client) SteamPlayerAchievements(ctx context.Context, key, steamID string, appID int) (map[string]achievements.Unlock, error)
- func (c *Client) SteamRarity(ctx context.Context, appID int) (map[string]float64, error)
- type EpicToken
- type GOGToken
- 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 ErrNoAchievements = achievements.ErrNone
ErrNoAchievements means the store says the game has no achievements.
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.
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 ¶
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
EpicLocale is the Epic store locale for a Steam language name.
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 GOGCode ¶ added in v1.6.0
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 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) 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 ¶
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.
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
GOGRefresh gets a new access token (and refresh token).
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.
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).