advent-of-code-api

Advent of Code REST API bindings and servant API https://github.com/mstksg/advent-of-code-api#readme

Version on this page:0.2.2.0
LTS Haskell 14.17:0.1.2.3
Stackage Nightly 2019-12-13:0.2.7.0
Latest on Hackage:0.2.7.0

See all snapshots advent-of-code-api appears in

BSD-3-Clause licensed by Justin Le
Maintained by justin@jle.im

Module documentation for 0.2.2.0

This version can be pinned in stack with:advent-of-code-api-0.2.2.0@sha256:9d33abaf374a961c4fb1243105e512a3b9b1f44ef81a78408c6bf9ea19c4a76d,2290

advent-of-code-api

advent-of-code-api on Hackage Build Status

Haskell bindings for Advent of Code REST API. Caches and throttles requests automatically, and parses responses into meaningful data types.

Specify your requests with AoC and AoCOpts, and run them with runAoC.

Examples:

-- Fetch prompts for day 5
runAoC myOpts $ AoCPrompt (mkDay_ 5)

-- Fetch input for day 8
runAoC myOpts $ AoCInput (mkDay_ 8)

-- Submit answer "hello" for Day 10, Part 1
runAoC myOpts $ AoCSubmit (mkDay_ 10) Part1 "hello"

Please use responsibly. All actions are rate-limited to a default of one request every three seconds, with ability to adjust up to as fast as a hard-coded limit of one request per second.

The neatly exported bindings (handling cookies/authentication, cacheing, throttling) are in Advent.

Session Keys

Session keys are required for all commands, but if you enter a bogus key you should be able to get at least Part 1 from AoCPrompt.

The session key can be found by logging in on a web client and checking the cookies. You can usually check these with in-browser developer tools.

Servant API

A Servant API (for integrating with servant for features like mock servers, documentation and low-level client methods) is also exported in Advent.API. The Servant API also parses into meaningful types, but lacks management of cookies/auth, cacheing, and throttling. Please use especially responsibly.

Changes

Changelog

Version 0.2.2.0

November 9, 2019

https://github.com/mstksg/advent-of-code-api/releases/tag/v0.2.2.0

  • Rewrote submission response parser using megaparsec for better errors

Version 0.2.1.0

November 5, 2019

https://github.com/mstksg/advent-of-code-api/releases/tag/v0.2.1.0

  • Export Day constructor from Advent

Version 0.2.0.0

November 4, 2019

https://github.com/mstksg/advent-of-code-api/releases/tag/v0.2.0.0

  • Switch from libcurl to servant, which allows for shedding of external dependencies.
  • Support leaderboard API with data type.
  • Expose raw servant API and client functions, for those who want to build documentation or a mock server or low-level client.

Version 0.1.2.X

Version 0.1.2.0

December 7, 2018

https://github.com/mstksg/advent-of-code-api/releases/tag/v0.1.2.0

  • Fixed cache to store prompts at .html instead of .yaml
  • SubIncorrect and SubWait now include fields for wait times.
  • Re-implemented submission result parsers using attoparsec

Version 0.1.1.0

December 7, 2018

https://github.com/mstksg/advent-of-code-api/releases/tag/v0.1.1.0

  • More robust parser for submission results. Also now reports “hints” if possible.

Version 0.1.0.0

December 5, 2018

https://github.com/mstksg/advent-of-code-api/releases/tag/v0.1.0.0

  • Initial Release
comments powered byDisqus