API: the puzzle library — wishlist, unsolved, lend/borrow, sell/swap lists and a library summary for /me and /players/{id} - #202
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 5 of
docs/features/api/v1-expansion-plan.md— the website's puzzle library page as the API, read-only./me/…PAT orcollections:read;/players/{id}/…collections:read)GET …/libraryitem_count), unsolved / wishlist / lend-borrow / sell-swap / solved counts + the owner's visibility per sectionGET …/wishlistwishListVisibilityGET …/unsolved-puzzlesunsolvedPuzzlesVisibilityGET …/lend-borrowdirection, counterparty (id + display name),lent_at, notes;lendBorrowListVisibilityGET …/sell-swapPuzzleLibraryVisibility): 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.statistics,difficulty,prediction(the token owner's own),solves(the list owner's) — oneinsightsFor()batch per list, size-independence asserted on all four lists; private/zeroed paths run no batch.null; 45 tests incl. exact fixture values, gates, budgets, OpenAPI; README "Puzzle Library" section +/for-developersrows. Full suite green.🤖 Generated with Claude Code
https://claude.ai/code/session_015uH2n4Y6gPLiYASEJwNr3H