Documentation ¶
Overview ¶
Package aoc implements a simple client for the AoC website.
Index ¶
Constants ¶
const AoCWebsite = "https://adventofcode.com/"
AoCWebsite is the default website of Advent of Code.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { // Get the value associated with key. Get(ctx context.Context, key string) ([]byte, error) // Set the value associated with key to val. Set(ctx context.Context, key string, val []byte) error }
Cache stores temporary data.
type Client ¶
type Client struct { // SessionCookie to use. Must be set to access user data. SessionCookie string // BaseURL of the AoC website. Defaults to AoCWebsite. BaseURL string // Event to use, where needed. Defaults to current year. Event string // Cache for temporary data. If nil, no cache is used. Cache Cache Jar http.CookieJar // contains filtered or unexported fields }
Client to the AoC Website. The zero value is valid and uses sensible defaults.
func (*Client) Input ¶
Input fetches the input for the given day and writes it to w. If day is 0, it defaults to the most recent day.
func (*Client) Leaderboard ¶
Leaderboard fetches the private leaderboard with the given id.
type DirCache ¶
type DirCache string
DirCache stores data in a directory. If empty, defaults to filepath.Join(os.UserCacheDir(), "aoc", "cache")
type Leaderboard ¶
type Leaderboard struct { Owner int Event string Members []LeaderboardMember }
Leaderboard is the data for a private leaderboard.
func (*Leaderboard) UnmarshalJSON ¶
func (b *Leaderboard) UnmarshalJSON(buf []byte) error
UnmarshalJSON implements json.Unmarshaler.
type LeaderboardMember ¶
type LeaderboardMember struct { ID int Name string Stars int LastStar time.Time LocalScore int GlobalScore int Days []LeaderboardMemberDay }
LeaderboardMember is the data for the member of a private leaderboard.
type LeaderboardMemberDay ¶
type LeaderboardMemberDay struct { Day int Part1 *LeaderboardStar Part2 *LeaderboardStar }
LeaderboardMemberDay represents the stars a given LeaderboardMember got on a given day.
type LeaderboardStar ¶
LeaderboardStar represents a star gotten by a LeaderboardMember on a LeaderboardMemberDay.