Trim comments to the non-obvious why
Drop narration, history and restated-code comments across the repo, keep short ones for security boundaries, upstream quirks and ordering constraints, and record the convention in CLAUDE.md. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -8,10 +8,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// This file wraps the two public Steam Web API endpoints used by the home
|
||||
// page. Results are cached by the caller (handlers.Store, 5 minute TTL) to
|
||||
// stay well inside Steam's rate limits.
|
||||
|
||||
// SteamRecentGame is one game from GetRecentlyPlayedGames. Playtimes are in
|
||||
// minutes.
|
||||
type SteamRecentGame struct {
|
||||
@@ -30,10 +26,7 @@ type SteamRecentGamesResponse struct {
|
||||
} `json:"response"`
|
||||
}
|
||||
|
||||
// SteamPlayerSummary is the subset of GetPlayerSummaries we care about.
|
||||
// PersonaState is Steam's online status enum: 0 = offline, anything higher
|
||||
// is some flavour of online (online, busy, away, snooze, looking to trade or
|
||||
// play), which is why the caller treats "> 0" as online.
|
||||
// PersonaState > 0 is some kind of online.
|
||||
type SteamPlayerSummary struct {
|
||||
PersonaState int `json:"personastate"`
|
||||
}
|
||||
@@ -45,11 +38,8 @@ type SteamPlayerSummariesResponse struct {
|
||||
} `json:"response"`
|
||||
}
|
||||
|
||||
// FetchRecentlyPlayedGames returns the three most recently played games.
|
||||
//
|
||||
// Steam answers with HTTP 200 and an empty envelope for a private profile or
|
||||
// a bad key, so an empty slice and no error is the normal "nothing to show"
|
||||
// result rather than a failure.
|
||||
// Steam answers 200 with nothing for a private profile or bad key, so empty
|
||||
// is not an error.
|
||||
func FetchRecentlyPlayedGames(apiKey, steamID string) ([]SteamRecentGame, error) {
|
||||
url := fmt.Sprintf("https://api.steampowered.com/IPlayerService/GetRecentlyPlayedGames/v1/?key=%s&steamid=%s&count=3", apiKey, steamID)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user