Skip to content

Latest commit

 

History

History
89 lines (62 loc) · 2.98 KB

File metadata and controls

89 lines (62 loc) · 2.98 KB

Version Downloads

a simple Advent of Code API written in C# - also checkout the Rust version

Documentation



Add NuGet package

dotnet add package AoCAPI
using AoC.API;

Session initialization

var client = new Session("session cookie", int year, int day); // Initializes a new Session instance
var client = new Session("session cookie", string input, Regex pattern); // Initializes a new Session instance
Info
The Regex overload needs to have a regex group named "year" and a group named "day".
How to name Regex groups
How to obtain session cookie

Features

Get input

string inputText = await client.GetInputTextAsync(); // Retrieves the input text of the AoC puzzle
string[] inputLines = await client.GetInputLinesAsync(); // Retrieves the input lines of the AoC puzzle

Get sample input

string sampleInputText = await client.GetSampleInputTextAsync(int nth); // Retrieves the nth sample input text of the AoC puzzle
string[] sampleInputLines = await client.GetSampleInputLinesAsync(int nth); // Retrieves the nth sample input lines of the AoC puzzle

Get achieved stars

Dictionary<int, int> achievedStars = await client.GetAllStarsAsync(); // Retrieves each year's number of stars earned (key: year, value: stars)

Submit answer

Response response = await client.SubmitAnswerAsync(int part, object answer); // Submits an answer to part 1 or 2 of the AoC puzzle. Returns a response type with a success status and a cooldown period



credits to:

Max - markdown info icons
Monday Morning Haskell - documentation on how to obtaining session cookie
Developer.Mozilla - documentation on how to name Regex groups