Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# AGENTS.md

A Motoko client library for the Spotify Web API, generated from Spotify's OpenAPI spec by OpenAPI Generator and distributed as a [mops](https://mops.one) package.

## Build / typecheck

This is a library, not an application; the repository defines no build, test, lint, or format script. Dependencies are managed with mops (`mops install`), and `mops.lock` must stay in sync with `mops.toml`. Validate changes by type-checking the Motoko sources with the Motoko compiler (`moc`); the toolchain pins `moc = "1.4.1"` in `mops.toml`, so use that version.

## Generated code — do not hand-edit

Most of the repository is regenerated by OpenAPI Generator. Edits to generated files are lost on the next regeneration. Change the generator templates/spec upstream instead.

Generated (see `.openapi-generator/FILES` for the authoritative list):

- `src/Apis/*.mo` — one module per API tag (Albums, Tracks, Player, ...).
- `src/Models/*.mo` — one module per OpenAPI schema (143 files).
- `src/Config.mo`, `README.md`, `icp.yaml`.

Hand-maintained files: `SKILL.md`, `CHANGELOG.md`, `mops.toml`, and this file.

## Layout

- `src/Apis/` — API operation modules.
- `src/Models/` — request/response data types.
- `.openapi-generator/` — generator metadata; `FILES` lists every generated path, `VERSION` pins the generator version.

## Conventions

- `src/Config.mo` defines `Config` and `defaultConfig`; callers customize via record-update syntax (`{ defaultConfig with auth = ?#bearer "..." }`). `defaultConfig.baseUrl` is `https://api.spotify.com/v1` and `cycles` is `30_000_000_000`.
- Each operation has a module-level form (`async* T`, `config` as first argument) and a class-level form (`async T`, config captured at construction).
- API calls are HTTP outcalls from the IC management canister and consume cycles; the canister must be funded before calling endpoints.
- Authentication tokens are supplied by the caller via `Config.auth`; never hardcode or log them.
- `mops.toml` `[dependencies]` pins exact versions, including a forked `serde-core`; keep `mops.lock` in sync (`mops install`).
- Record notable changes in `CHANGELOG.md` (Keep a Changelog format, Semantic Versioning); bump `version` in `mops.toml` for releases.
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See @AGENTS.md