Skip to content

feat: Add GET /list/<pubkey> endpoint (BUD-12)#4

Merged
kengirie merged 1 commit into
mainfrom
feat/list-endpoint
May 6, 2026
Merged

feat: Add GET /list/<pubkey> endpoint (BUD-12)#4
kengirie merged 1 commit into
mainfrom
feat/list-endpoint

Conversation

@kengirie

@kengirie kengirie commented May 6, 2026

Copy link
Copy Markdown
Owner

No description provided.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds BUD-12 support for listing blobs owned by a pubkey via a new GET /list/<pubkey> HTTP endpoint, including optional auth validation and cursor/limit filtering, plus response serialization and tests.

Changes:

  • Implement GET /list/<pubkey> request handling with query params (since, until, limit, cursor) and optional Authorization validation (t=list).
  • Add Success_list response kind and JSON serialization for descriptor arrays.
  • Extend DB interface/implementation with list_by_pubkey and add unit + E2E test coverage for list behavior.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/test_http_response.ml Adds unit tests for Success_list HTTP response formatting (empty + populated arrays).
lib/shell/http_server.ml Adds routing/handler logic for GET /list/<pubkey> including query parsing, cursor handling, and optional auth.
lib/shell/http_response.ml Introduces Success_list response generation and refactors descriptor JSON conversion.
lib/shell/db_intf.ml Extends DB interface with list_by_pubkey for BUD-12 listing.
lib/shell/blossom_db.ml Implements list_by_pubkey SQL query and maps rows to Domain.blob_descriptor.
lib/core/auth.ml Adds List action (t=list) support to auth validation.
e2e/test_list.ml Adds E2E coverage for list sorting, filters, pagination, and auth behaviors.
e2e/nostr_signer.ml Adds helper to sign t=list auth events for E2E tests.
e2e/main.ml Wires list E2E tests into the runner output sequence.
e2e/dune Registers the new test_list module in the E2E library.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/shell/http_server.ml
Error "Invalid cursor"
else
(match BlobService.get_metadata ~storage:data_dir ~db ~sha256:sha with
| Ok meta -> Ok (Some (meta.uploaded, sha))
Comment thread lib/shell/blossom_db.ml
Comment on lines +240 to +247
let cursor_uploaded, cursor_sha256 = match cursor with
| None -> 0L, ""
| Some (u, s) -> u, s
in
let result =
Caqti_eio.Pool.use (fun (module C : Caqti_eio.CONNECTION) ->
C.collect_list Db.list_blobs_by_pubkey
(pubkey, since, until, cursor_uploaded, cursor_sha256, limit)
("sha256", `String descriptor.sha256);
("size", `Int descriptor.size);
("type", `String descriptor.mime_type);
("uploaded", `Int (Int64.to_int descriptor.uploaded));
@kengirie kengirie merged commit 133d956 into main May 6, 2026
6 checks passed
@kengirie kengirie deleted the feat/list-endpoint branch May 6, 2026 08:55
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.

2 participants