Skip to content

antoniosubasic/AoC.API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

a simple Advent of Code API written in C#

Topics

Resources

License

Stars

Watchers

Forks

Languages