Skip to main content

Module session

Module session 

Source
Expand description

The endpoints.

Each one is a free function over the Transport the request goes out through - input_text, samples, stars, submit and the rest. Session is the same set of calls with the transport already in hand: it holds the session cookie and the one HTTP client built from it, so a program that has a session does not pass a transport around. The methods delegate to the functions, so the two are the same code and neither can drift from the other.

Which puzzle a call is about is an argument either way, so one session serves a whole event without rebuilding a client per call - and so a caller keeping the transport in a type of its own pays that cost once too.

Nothing here is throttled or cached; see the crate documentation for why that is the caller’s decision.

Structs§

Session
An authenticated conversation with Advent of Code.

Enums§

Verdict
How Advent of Code judged a submitted answer.

Functions§

accepted_answer
The answer a puzzle’s page shows as accepted for part.
input_lines
Downloads a puzzle’s personal input as lines.
input_text
Downloads a puzzle’s personal input, without its trailing newline.
sample_lines
The nth sample block on a puzzle’s page, as lines.
sample_text
The nth sample block on a puzzle’s page, counting from one.
samples
Every sample block on a puzzle’s page, in the order they appear.
stars
How many stars the account behind transport has earned in each event.
submit
Submits an answer and reports how the site judged it.