Documentation ¶
Index ¶
- Constants
- Variables
- func NewLeaderboardViewport(content, title string)
- func NewPuzzleViewport(puzzle *Puzzle)
- type Day
- type DayLB
- type LeaderboardModel
- type LoadUserModel
- type Placing
- type Puzzle
- func (p *Puzzle) Display()
- func (p *Puzzle) GetBucketName() string
- func (p *Puzzle) GetID() string
- func (p *Puzzle) GetPrettyPageData() []string
- func (p *Puzzle) GetUserInput() ([]byte, error)
- func (p *Puzzle) MarshalData() ([]byte, error)
- func (p *Puzzle) ReloadPuzzleData() error
- func (p *Puzzle) SaveResource()
- func (p *Puzzle) SubmitAnswer(answer string, part int) (int, string)
- type PuzzleModel
- type Submission
- type User
- type Value
- type ViewableLB
- type Year
- type YearLB
Constants ¶
const ( IncorrectAnswer int = iota CorrectAnswer WarningAnswer // Not submitted, but weird behavior NeutralAnswer // Not submitted, but no warning )
Answer Response types
const PUZZLE_URL = "https://adventofcode.com/%v/day/%v"
Base URL for a single day's puzzle
Variables ¶
var UseHighPerformanceRenderer = true
var ViewportWidth = 80
Functions ¶
func NewLeaderboardViewport ¶
func NewLeaderboardViewport(content, title string)
func NewPuzzleViewport ¶
func NewPuzzleViewport(puzzle *Puzzle)
Types ¶
type DayLB ¶
DayLB is the model to handle a specific day's leaderboard
func (*DayLB) GetContent ¶
GetContent will get the lb content in a printable format
func (*DayLB) LoadPositions ¶
LoadPositions will get all of the daily positions
type LeaderboardModel ¶
type LeaderboardModel struct {
// contains filtered or unexported fields
}
func (LeaderboardModel) Init ¶
func (m LeaderboardModel) Init() tea.Cmd
func (LeaderboardModel) View ¶
func (m LeaderboardModel) View() string
type LoadUserModel ¶
type LoadUserModel struct {
// contains filtered or unexported fields
}
LoadUserModel is the BubbleTea model for loading and displaying a user's information
func (LoadUserModel) Init ¶
func (m LoadUserModel) Init() tea.Cmd
func (LoadUserModel) View ¶
func (m LoadUserModel) View() string
type Placing ¶
type Placing struct { DisplayName string UserID string Position int IsSupporter bool // UserLink is the link for the username UserLink string // SponsorLink is the link for the user's associated sponsor SponsorLink string // FinishTime is only used for daily leaderboards FinishTime string // Score is only used for yearly leaderboards Score int }
Placing represents a single placing on a leaderboard
type Puzzle ¶
type Puzzle struct { SessionToken string Day int Year int BucketID string URL string Title string ArticleOne []string AnswerOne string ArticleTwo []string AnswerTwo string UserInput []byte Submissions map[int][]*Submission LockoutEnd time.Time }
Puzzle represents a single day's puzzle. Consists of user info as well as page display info.
func LoadOrCreatePuzzle ¶
LoadOrCreatePuzzle attempts to load the requested puzzle from storage. If it's unable to be loaded, it will attempt to be created, loading the information from the website.
func (*Puzzle) GetBucketName ¶
func (*Puzzle) GetPrettyPageData ¶
GetPrettyPageData parses the puzzle's stored information and displays it in a visually pleasing way.
func (*Puzzle) GetUserInput ¶
GetUserInput returns the input for the associated puzzle.
func (*Puzzle) MarshalData ¶
func (*Puzzle) ReloadPuzzleData ¶
Reloads puzzle information from the server
func (*Puzzle) SaveResource ¶
func (p *Puzzle) SaveResource()
type PuzzleModel ¶
type PuzzleModel struct {
// contains filtered or unexported fields
}
func (PuzzleModel) Init ¶
func (m PuzzleModel) Init() tea.Cmd
func (PuzzleModel) View ¶
func (m PuzzleModel) View() string
type Submission ¶
type Submission struct {
// contains filtered or unexported fields
}
func NewSubmission ¶
func NewSubmission(data *http.Response, answer string) (*Submission, error)
type User ¶
User represents a session token and accompanying puzzles.
func NewUser ¶
Creates a new user based on a provided session token. If none is provided, it'll be loaded from environment variable or from config file.
func (*User) LoadDisplayName ¶
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Possible submission value for a puzzle
type ViewableLB ¶
type YearLB ¶
YearLB is the model to handle the leaderboard for a year as a whole
func (*YearLB) GetContent ¶
GetContent will get the lb content in a printable format
func (*YearLB) LoadPositions ¶
LoadPositions will get all of the yearly positions