Documentation ¶
Index ¶
Constants ¶
View Source
const ( // CorrectAnswer is the goal. CorrectAnswer = "That's the right answer!" // AlreadySolved means our solution is already there. AlreadySolved = "Did you already complete it?" // WrongAnswer means the solution was incorrect. WrongAnswer = "That's not the right answer;" // WaitMore means you have to wait more. WaitMore = "You gave an answer too recently;" // NoSession means the provided token was not valid. NoSession = "To play, please identify yourself" )
View Source
const RequestTimout = 10
RequestTimout is the timeout of a request in seconds.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { SessionToken string HTTPClient HTTPClient // contains filtered or unexported fields }
Client for Advent of Code.
func (*Client) DownloadAndSaveInput ¶
DownloadAndSaveInput downloads and saves the requested input file.
func (*Client) DownloadInput ¶
func (c *Client) DownloadInput(year, day int) (io.ReadCloser, error)
DownloadInput downloads the requested input file.
type DownloadError ¶
type DownloadError struct {
StatusCode int
}
DownloadError occurs when the AoC server returns with a status code other than 200.
func (DownloadError) Error ¶
func (e DownloadError) Error() string
type HTTPClient ¶
HTTPClient is a simple interface for http.Client. Reason: mock client in tests.
type IncorrectAnswerError ¶
IncorrectAnswerError occurs when the provided answer is not correct.
func (IncorrectAnswerError) Error ¶
func (e IncorrectAnswerError) Error() string
type NetworkError ¶
type NetworkError struct {
Original error
}
NetworkError occurs when something went wrong with the HTTP request.
func (NetworkError) Error ¶
func (e NetworkError) Error() string
type SubmitError ¶
type SubmitError struct {
StatusCode int
}
SubmitError occurs when the AoC server returns with a status code other than 200.
func (SubmitError) Error ¶
func (e SubmitError) Error() string
Click to show internal directories.
Click to hide internal directories.