HTTP API: submit a video for summarization #24

Open
opened 2026-07-27 13:54:08 +00:00 by mathias · 0 comments
Owner

Problem

The paste flow (internal/web/paste.go, docs/use-cases/paste_url.feature) already does the right thing, but it is reachable only from a form post in a browser session. An agent needs the same use case over HTTP.

Depends on #23.

Scope

POST /api/v1/videos

{ "url": "https://youtu.be/-EInjdpjKy0?si=..." }

Response 202 Accepted:

{ "video_id": "...", "provider_video_id": "...", "status": "queued" }
  • Reuse parseYouTubeVideoID verbatim — do not fork the parser. Tracking params (?si=) must be tolerated; add a case if not already covered.
  • Reuse the existing paste use case path so dedup, per-user scoping, and the shared rate gate behave identically to the browser flow.
  • Idempotent: re-submitting a video the caller already has returns 200 with the existing video_id, not a duplicate. This mirrors the existing dedup scenario.
  • Invalid or non-YouTube URL → 400 with a clear message, nothing created.
  • Video not found at the provider → 404, nothing created.

Non-goals

  • Waiting for the summary in the request. Submission is async; reading is #25.
  • Providers other than YouTube.

Acceptance

  • caveman: me queue a pasted video for the calling user, not summarize it inline
  • Red-first handler tests for each response case above
  • The four scenarios in paste_url.feature hold identically through the API path
  • ?si= and other tracking params accepted
  • Unauthenticated request → 401, nothing created
  • docs/use-cases/api_access.feature extended

Handoff

Branch from main, one file per commit, squash-merge PR back to main, human review gate.

## Problem The paste flow (`internal/web/paste.go`, `docs/use-cases/paste_url.feature`) already does the right thing, but it is reachable only from a form post in a browser session. An agent needs the same use case over HTTP. Depends on #23. ## Scope `POST /api/v1/videos` ```json { "url": "https://youtu.be/-EInjdpjKy0?si=..." } ``` Response `202 Accepted`: ```json { "video_id": "...", "provider_video_id": "...", "status": "queued" } ``` - Reuse `parseYouTubeVideoID` verbatim — do not fork the parser. Tracking params (`?si=`) must be tolerated; add a case if not already covered. - Reuse the existing paste use case path so dedup, per-user scoping, and the shared rate gate behave identically to the browser flow. - Idempotent: re-submitting a video the caller already has returns `200` with the existing `video_id`, not a duplicate. This mirrors the existing dedup scenario. - Invalid or non-YouTube URL → `400` with a clear message, nothing created. - Video not found at the provider → `404`, nothing created. ## Non-goals - Waiting for the summary in the request. Submission is async; reading is #25. - Providers other than YouTube. ## Acceptance - [ ] `caveman: me queue a pasted video for the calling user, not summarize it inline` - [ ] Red-first handler tests for each response case above - [ ] The four scenarios in `paste_url.feature` hold identically through the API path - [ ] `?si=` and other tracking params accepted - [ ] Unauthenticated request → 401, nothing created - [ ] `docs/use-cases/api_access.feature` extended ## Handoff Branch from `main`, one file per commit, squash-merge PR back to `main`, human review gate.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mathias/tapir#24