@bryan-hoang/aoc-client
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@bryan-hoang/aoc-client

npm version npm downloads bundle size license

standard-readme compliant

A TS library for Advent of Code.

It was primarily developed to build the @bryan-hoang/aoc-cli command-line tool, but it can also be integrated into other projects.

Table of Contents

Install

# ✨ Auto-detect
npx nypm install @bryan-hoang/aoc-client

# npm
npm install @bryan-hoang/aoc-client

# yarn
yarn add @bryan-hoang/aoc-client

# pnpm
pnpm install @bryan-hoang/aoc-client

# bun
bun install @bryan-hoang/aoc-client

# deno
deno install @bryan-hoang/aoc-client

Usage

Importing:

ESM (Node.js, Bun, Deno)

import { AocClientBuilder, AocClient } from "@bryan-hoang/aoc-client";

CommonJS (Legacy Node.js)

const { AocClientBuilder, AocClient } = require("@bryan-hoang/aoc-client");

CDN (Deno, Bun and Browsers)

import {
  AocClientBuilder,
  AocClient,
} from "https://esm.sh/@bryan-hoang/aoc-client";

API:

🏭 AocClientBuilder

Methods

⚙️ buildClient

Method Type
buildClient () => AocClient

⚙️ #validateBuild

Method Type
#validateBuild () => asserts this is this and { _sessionCookie: string; _year: number; _day: number; }

⚙️ getSessionCookieFromDefaultLocations

Method Type
getSessionCookieFromDefaultLocations () => AocClientBuilder

⚙️ getSessionCookieFromFile

Method Type
getSessionCookieFromFile (file: string) => AocClientBuilder

⚙️ getDefaultSessionCookieFile

Method Type
getDefaultSessionCookieFile () => string

⚙️ sessionCookie

Method Type
sessionCookie (sessionCookie: string) => AocClientBuilder

⚙️ year

Method Type
year (year: number) => AocClientBuilder

⚙️ day

Method Type
day (day: number) => AocClientBuilder

⚙️ latestPuzzleDay

Method Type
latestPuzzleDay () => AocClientBuilder

⚙️ latestEventYear

Method Type
latestEventYear () => AocClientBuilder

⚙️ overwriteFiles

Method Type
overwriteFiles (overwriteFiles: boolean) => AocClientBuilder

🏭 AocClient

Methods

⚙️ getBuilder

Method Type
getBuilder () => AocClientBuilder

⚙️ ensureDayUnlocked

Method Type
ensureDayUnlocked () => void

⚙️ isDayUnlocked

Method Type
isDayUnlocked () => boolean

Maintainers

@bryan-hoang

Contributing

PRs accepted.

Small note: if editing the README, please conform to the standard-readme specification.

License

MIT © 2024 Bryan Hoang


🤖 auto updated with automd

Readme

Keywords

none

Package Sidebar

Install

npm i @bryan-hoang/aoc-client

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

68.6 kB

Total Files

10

Last publish

Collaborators

  • bryan-hoang