Skip to content

API: the puzzle library — wishlist, unsolved, lend/borrow, sell/swap lists and a library summary for /me and /players/{id} - #202

Merged
JanMikes merged 1 commit into
mainfrom
api/puzzle-library
Aug 19, 2026
Merged

API: the puzzle library — wishlist, unsolved, lend/borrow, sell/swap lists and a library summary for /me and /players/{id}#202
JanMikes merged 1 commit into
mainfrom
api/puzzle-library

Conversation

@JanMikes

Copy link
Copy Markdown
Member

PR 5 of docs/features/api/v1-expansion-plan.md — the website's puzzle library page as the API, read-only.

Endpoint (/me/… PAT or collections:read; /players/{id}/… collections:read) Source / visibility (as on the web)
GET …/library summary: collections (+item_count), unsolved / wishlist / lend-borrow / sell-swap / solved counts + the owner's visibility per section
GET …/wishlist wishListVisibility
GET …/unsolved-puzzles system collection not yet solved + borrowed unsolved; unsolvedPuzzlesVisibility
GET …/lend-borrow lent + borrowed with direction, counterparty (id + display name), lent_at, notes; lendBorrowListVisibility
GET …/sell-swap public listing fields only; always public
  • Rule everywhere (PuzzleLibraryVisibility): the owner always sees their own (also via /players/{own id}); a private profile is zeroed for everyone else; otherwise the section's own setting — zeroed, never 403.
  • Every item carries statistics, difficulty, prediction (the token owner's own), solves (the list owner's) — one insightsFor() batch per list, size-independence asserted on all four lists; private/zeroed paths run no batch.
  • Embargoed images null; 45 tests incl. exact fixture values, gates, budgets, OpenAPI; README "Puzzle Library" section + /for-developers rows. Full suite green.

🤖 Generated with Claude Code

https://claude.ai/code/session_015uH2n4Y6gPLiYASEJwNr3H

…lists and a library summary for /me and /players/{id}

PR 5 of docs/features/api/v1-expansion-plan.md: the website's puzzle library
page as the API, read-only. Ten GET endpoints under one tag "Puzzle Library",
scope collections:read ("read the puzzle library"; PAT for the owner's own):

  /me/library, /players/{id}/library          - the page's summary: collections
      with item_count (system "default" + custom), and count + visibility of
      unsolved, wishlist, lend_borrow (lent/borrowed), sell_swap, solved
  /me/wishlist, /players/{id}/wishlist
  /me/unsolved-puzzles, /players/{id}/unsolved-puzzles  (borrowed unsolved first)
  /me/lend-borrow, /players/{id}/lend-borrow  (direction lent|borrowed, counterparty id + display name)
  /me/sell-swap, /players/{id}/sell-swap      (public offer fields, reserved-for never exposed)

Built from the very queries the web pages use (GetWishListItems, GetUnsolvedPuzzles
+ GetBorrowedPuzzles::unsolvedByHolderId, GetLentPuzzles + GetBorrowedPuzzles,
GetSellSwapListItems, the PuzzleLibraryController count queries). Visibility is
the website's rule in PuzzleLibraryVisibility: the player behind the token always
sees their own (also via /players/{their id}); a private profile hides everything
(zeroed, never 403); otherwise the section's own setting - a hidden list is
{count: 0, items: []} with no batch query, a hidden summary section count 0 +
"private". Items carry the four insight objects of a collection item through one
PuzzleResponseFactory::insightsFor() batch per list: prediction = the token
owner's own forecast, solves = the list owner's (PR 3b semantics), difficulty for
a member token owner, statistics always. hide_image_until => image null on
every list. Budgets asserted per endpoint and at two list sizes.

Docs: README "Puzzle Library Endpoints", for-developers rows, OpenAPI from the
attributes, plan §12 ticked with the measured budgets.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015uH2n4Y6gPLiYASEJwNr3H
@JanMikes
JanMikes merged commit 29c7d40 into main Aug 19, 2026
5 checks passed
@JanMikes
JanMikes deleted the api/puzzle-library branch August 19, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant