From 740df4a3aa615268e9d52b896b0abc5687181701 Mon Sep 17 00:00:00 2001 From: Eli Mallon Date: Wed, 20 May 2026 13:01:37 -0700 Subject: [PATCH] build fixes --- .../place-stream-media-getuploadstatus.md | 19 +++- .../media/place-stream-media-getvideolist.md | 105 ++++++++++++++++++ .../content/docs/lex-reference/openapi.json | 98 ++++++++++++++++ lexicons/place/stream/media/getVideoList.json | 2 +- pkg/spxrpc/place_stream_media.go | 2 +- pkg/spxrpc/place_stream_media_getvideolist.go | 13 +-- pkg/spxrpc/stubs.go | 28 ++--- pkg/streamplace/mediagetUploadStatus.go | 2 +- pkg/streamplace/mediagetVideoList.go | 19 ++-- 9 files changed, 245 insertions(+), 43 deletions(-) create mode 100644 js/docs/src/content/docs/lex-reference/media/place-stream-media-getvideolist.md diff --git a/js/docs/src/content/docs/lex-reference/media/place-stream-media-getuploadstatus.md b/js/docs/src/content/docs/lex-reference/media/place-stream-media-getuploadstatus.md index 437a9e04..e1021d4b 100644 --- a/js/docs/src/content/docs/lex-reference/media/place-stream-media-getuploadstatus.md +++ b/js/docs/src/content/docs/lex-reference/media/place-stream-media-getuploadstatus.md @@ -28,12 +28,13 @@ Get the processing status of a previously created upload. Only accessible by the **Schema Type:** `object` -| Name | Type | Req'd | Description | Constraints | -| ------------ | --------------------------------- | ----- | ------------------------------------------------------------------------------- | ------------------------------------------------------ | -| `status` | `string` | ✅ | Current processing status of the upload. | Known Values: `pending`, `processing`, `done`, `error` | -| `tracks` | Array of [`#trackRef`](#trackref) | ❌ | Published track records. Present when status is 'done'. | | -| `durationMs` | `integer` | ❌ | Duration of the processed video in milliseconds. Present when status is 'done'. | | -| `error` | `string` | ❌ | Error message. Present when status is 'error'. | | +| Name | Type | Req'd | Description | Constraints | +| ------------ | --------------------------------- | ----- | ------------------------------------------------------------------------------------ | ------------------------------------------------------ | +| `status` | `string` | ✅ | Current processing status of the upload. | Known Values: `pending`, `processing`, `done`, `error` | +| `progress` | `integer` | ❌ | Processing progress percentage (0-100). Only meaningful when status is 'processing'. | Min: 0
Max: 100 | +| `tracks` | Array of [`#trackRef`](#trackref) | ❌ | Published track records. Present when status is 'done'. | | +| `durationMs` | `integer` | ❌ | Duration of the processed video in milliseconds. Present when status is 'done'. | | +| `error` | `string` | ❌ | Error message. Present when status is 'error'. | | **Possible Errors:** @@ -87,6 +88,12 @@ Get the processing status of a previously created upload. Only accessible by the "knownValues": ["pending", "processing", "done", "error"], "description": "Current processing status of the upload." }, + "progress": { + "type": "integer", + "minimum": 0, + "maximum": 100, + "description": "Processing progress percentage (0-100). Only meaningful when status is 'processing'." + }, "tracks": { "type": "array", "description": "Published track records. Present when status is 'done'.", diff --git a/js/docs/src/content/docs/lex-reference/media/place-stream-media-getvideolist.md b/js/docs/src/content/docs/lex-reference/media/place-stream-media-getvideolist.md new file mode 100644 index 00000000..b153ea01 --- /dev/null +++ b/js/docs/src/content/docs/lex-reference/media/place-stream-media-getvideolist.md @@ -0,0 +1,105 @@ +--- +title: place.stream.media.getVideoList +description: Reference for the place.stream.media.getVideoList lexicon +--- + +**Lexicon Version:** 1 + +## Definitions + + + +### `main` + +**Type:** `query` + +List videos for a given repo DID, newest first. Returns hydrated video views with author info and view counts. + +**Parameters:** + +| Name | Type | Req'd | Description | Constraints | +| -------- | --------- | ----- | ------------------------------------------- | ------------------------------------- | +| `repo` | `string` | ✅ | DID of the repo whose videos to list. | Format: `did` | +| `limit` | `integer` | ❌ | Maximum number of videos to return. | Min: 1
Max: 100
Default: `25` | +| `cursor` | `string` | ❌ | Pagination cursor from a previous response. | | + +**Output:** + +- **Encoding:** `application/json` +- **Schema:** + +**Schema Type:** `object` + +| Name | Type | Req'd | Description | Constraints | +| -------- | -------------------------------------------------------------------------------------------------------- | ----- | -------------------------------------------- | ----------- | +| `videos` | Array of [`place.stream.media.getVideo#videoView`](/lex-reference/place-stream-media-getvideo#videoview) | ✅ | | | +| `cursor` | `string` | ❌ | Pagination cursor for the next page, if any. | | + +**Possible Errors:** + +- `RepoNotFound`: No repo indexed at the supplied DID. + +--- + +## Lexicon Source + +```json +{ + "lexicon": 1, + "id": "place.stream.media.getVideoList", + "defs": { + "main": { + "type": "query", + "description": "List videos for a given repo DID, newest first. Returns hydrated video views with author info and view counts.", + "parameters": { + "type": "params", + "required": ["repo"], + "properties": { + "repo": { + "type": "string", + "format": "did", + "description": "DID of the repo whose videos to list." + }, + "limit": { + "type": "integer", + "minimum": 1, + "maximum": 100, + "default": 25, + "description": "Maximum number of videos to return." + }, + "cursor": { + "type": "string", + "description": "Pagination cursor from a previous response." + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["videos"], + "properties": { + "videos": { + "type": "array", + "items": { + "type": "ref", + "ref": "place.stream.media.getVideo#videoView" + } + }, + "cursor": { + "type": "string", + "description": "Pagination cursor for the next page, if any." + } + } + } + }, + "errors": [ + { + "name": "RepoNotFound", + "description": "No repo indexed at the supplied DID." + } + ] + } + } +} +``` diff --git a/js/docs/src/content/docs/lex-reference/openapi.json b/js/docs/src/content/docs/lex-reference/openapi.json index 3788f91f..1578853c 100644 --- a/js/docs/src/content/docs/lex-reference/openapi.json +++ b/js/docs/src/content/docs/lex-reference/openapi.json @@ -1837,6 +1837,12 @@ "type": "string", "description": "Current processing status of the upload." }, + "progress": { + "type": "integer", + "description": "Processing progress percentage (0-100). Only meaningful when status is 'processing'.", + "minimum": 0, + "maximum": 100 + }, "tracks": { "type": "array", "description": "Published track records. Present when status is 'done'.", @@ -1953,6 +1959,98 @@ ] } }, + "/xrpc/place.stream.media.getVideoList": { + "get": { + "summary": "List videos for a given repo DID, newest first. Returns hydrated video views with author info and view counts.", + "operationId": "place.stream.media.getVideoList", + "tags": ["place.stream.media"], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "videos": { + "type": "array", + "items": { + "$ref": "#/components/schemas/place.stream.media.getVideo_videoView" + } + }, + "cursor": { + "type": "string", + "description": "Pagination cursor for the next page, if any." + } + }, + "required": ["videos"] + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": ["error", "message"], + "properties": { + "error": { + "type": "string", + "oneOf": [ + { + "const": "RepoNotFound" + } + ] + }, + "message": { + "type": "string" + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "repo", + "in": "query", + "required": true, + "description": "DID of the repo whose videos to list.", + "schema": { + "type": "string", + "description": "DID of the repo whose videos to list.", + "format": "did" + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "description": "Maximum number of videos to return.", + "schema": { + "type": "integer", + "description": "Maximum number of videos to return.", + "default": 25, + "minimum": 1, + "maximum": 100 + } + }, + { + "name": "cursor", + "in": "query", + "required": false, + "description": "Pagination cursor from a previous response.", + "schema": { + "type": "string", + "description": "Pagination cursor from a previous response." + } + } + ] + } + }, "/xrpc/place.stream.live.denyTeleport": { "post": { "summary": "Deny an incoming teleport request.", diff --git a/lexicons/place/stream/media/getVideoList.json b/lexicons/place/stream/media/getVideoList.json index b1f08faf..80e1253f 100644 --- a/lexicons/place/stream/media/getVideoList.json +++ b/lexicons/place/stream/media/getVideoList.json @@ -37,7 +37,7 @@ "type": "array", "items": { "type": "ref", - "ref": "lex:place.stream.media.getVideo#videoView" + "ref": "place.stream.media.getVideo#videoView" } }, "cursor": { diff --git a/pkg/spxrpc/place_stream_media.go b/pkg/spxrpc/place_stream_media.go index 26ad576b..40b10684 100644 --- a/pkg/spxrpc/place_stream_media.go +++ b/pkg/spxrpc/place_stream_media.go @@ -107,7 +107,7 @@ func (s *Server) handlePlaceStreamMediaGetUploadStatus(ctx context.Context, uplo } case "processing": out.Status = "processing" - p := upload.ProcessingProgress + p := int64(upload.ProcessingProgress) out.Progress = &p default: // "" or any other value: upload not yet fully received diff --git a/pkg/spxrpc/place_stream_media_getvideolist.go b/pkg/spxrpc/place_stream_media_getvideolist.go index cccb8e60..c5997259 100644 --- a/pkg/spxrpc/place_stream_media_getvideolist.go +++ b/pkg/spxrpc/place_stream_media_getvideolist.go @@ -12,7 +12,7 @@ import ( // handlePlaceStreamMediaGetVideoList returns a paginated, hydrated // list of video records for a given repo DID. -func (s *Server) handlePlaceStreamMediaGetVideoList(ctx context.Context, repo string, limit *int, cursor *string) (*placestream.MediaGetVideoList_Output, error) { +func (s *Server) handlePlaceStreamMediaGetVideoList(ctx context.Context, cursor string, limit int, repo string) (*placestream.MediaGetVideoList_Output, error) { if repo == "" { return nil, echo.NewHTTPError(http.StatusBadRequest, "repo is required") } @@ -21,16 +21,11 @@ func (s *Server) handlePlaceStreamMediaGetVideoList(ctx context.Context, repo st } l := 25 - if limit != nil && *limit > 0 && *limit <= 100 { - l = *limit + if limit > 0 && limit <= 100 { + l = limit } - c := "" - if cursor != nil { - c = *cursor - } - - out, err := s.model.GetVideoList(ctx, repo, l, c) + out, err := s.model.GetVideoList(ctx, repo, l, cursor) if err != nil { return nil, echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } diff --git a/pkg/spxrpc/stubs.go b/pkg/spxrpc/stubs.go index 4fcc8163..24642c37 100644 --- a/pkg/spxrpc/stubs.go +++ b/pkg/spxrpc/stubs.go @@ -8,7 +8,6 @@ import ( appbsky "github.com/bluesky-social/indigo/api/bsky" "github.com/labstack/echo/v4" "go.opentelemetry.io/otel" - "net/http" placestream "stream.place/streamplace/pkg/streamplace" ) @@ -728,28 +727,23 @@ func (s *Server) HandlePlaceStreamMediaGetVideo(c echo.Context) error { func (s *Server) HandlePlaceStreamMediaGetVideoList(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandlePlaceStreamMediaGetVideoList") defer span.End() - repo := c.QueryParam("repo") - limitStr := c.QueryParam("limit") - cursorStr := c.QueryParam("cursor") + cursor := c.QueryParam("cursor") - var limit *int - if limitStr != "" { - l, err := strconv.Atoi(limitStr) + var limit int + if p := c.QueryParam("limit"); p != "" { + var err error + limit, err = strconv.Atoi(p) if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, "limit must be an integer") + return err } - limit = &l - } - - var cursor *string - if cursorStr != "" { - cursor = &cursorStr + } else { + limit = 25 } - + repo := c.QueryParam("repo") var out *placestream.MediaGetVideoList_Output var handleErr error - // func (s *Server) handlePlaceStreamMediaGetVideoList(ctx context.Context,repo string, limit *int, cursor *string) (*placestream.MediaGetVideoList_Output, error) - out, handleErr = s.handlePlaceStreamMediaGetVideoList(ctx, repo, limit, cursor) + // func (s *Server) handlePlaceStreamMediaGetVideoList(ctx context.Context,cursor string,limit int,repo string) (*placestream.MediaGetVideoList_Output, error) + out, handleErr = s.handlePlaceStreamMediaGetVideoList(ctx, cursor, limit, repo) if handleErr != nil { return handleErr } diff --git a/pkg/streamplace/mediagetUploadStatus.go b/pkg/streamplace/mediagetUploadStatus.go index b642452b..1f4016af 100644 --- a/pkg/streamplace/mediagetUploadStatus.go +++ b/pkg/streamplace/mediagetUploadStatus.go @@ -17,7 +17,7 @@ type MediaGetUploadStatus_Output struct { // error: Error message. Present when status is 'error'. Error *string `json:"error,omitempty" cborgen:"error,omitempty"` // progress: Processing progress percentage (0-100). Only meaningful when status is 'processing'. - Progress *int `json:"progress,omitempty" cborgen:"progress,omitempty"` + Progress *int64 `json:"progress,omitempty" cborgen:"progress,omitempty"` // status: Current processing status of the upload. Status string `json:"status" cborgen:"status"` // tracks: Published track records. Present when status is 'done'. diff --git a/pkg/streamplace/mediagetVideoList.go b/pkg/streamplace/mediagetVideoList.go index e58f9027..9a8940d6 100644 --- a/pkg/streamplace/mediagetVideoList.go +++ b/pkg/streamplace/mediagetVideoList.go @@ -12,24 +12,27 @@ import ( // MediaGetVideoList_Output is the output of a place.stream.media.getVideoList call. type MediaGetVideoList_Output struct { - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` - Videos []*MediaGetVideo_VideoView `json:"videos" cborgen:"videos"` + // cursor: Pagination cursor for the next page, if any. + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` + Videos []*MediaGetVideo_VideoView `json:"videos" cborgen:"videos"` } // MediaGetVideoList calls the XRPC method "place.stream.media.getVideoList". // +// cursor: Pagination cursor from a previous response. +// limit: Maximum number of videos to return. // repo: DID of the repo whose videos to list. -func MediaGetVideoList(ctx context.Context, c lexutil.LexClient, repo string, limit *int, cursor *string) (*MediaGetVideoList_Output, error) { +func MediaGetVideoList(ctx context.Context, c lexutil.LexClient, cursor string, limit int64, repo string) (*MediaGetVideoList_Output, error) { var out MediaGetVideoList_Output params := map[string]interface{}{} - params["repo"] = repo - if limit != nil { - params["limit"] = *limit + if cursor != "" { + params["cursor"] = cursor } - if cursor != nil { - params["cursor"] = *cursor + if limit != 0 { + params["limit"] = limit } + params["repo"] = repo if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.media.getVideoList", params, nil, &out); err != nil { return nil, err } -- 2.51.2