29 lines
1.4 KiB
Go
29 lines
1.4 KiB
Go
package api
|
|
|
|
// Video is the catalogue's copy of a video, as GET /api/videos/{id} serves it.
|
|
// It is deliberately not cms's video record of the same name: the catalogue
|
|
// publishes what a reader needs to show and play a video, and none of the
|
|
// ingestion detail — no storage key, no transcoding job id, no status, since
|
|
// a video that is not ready never reaches the catalogue at all.
|
|
type Video struct {
|
|
ID string `json:"id" example:"0f8fad5b-d9cb-469f-a165-70867728950e"`
|
|
Title string `json:"title" example:"The Evening Bulletin"`
|
|
PlaybackURL string `json:"playbackUrl" example:"https://d111111abcdef8.cloudfront.net/videos/abc123/index.m3u8"`
|
|
Categories []string `json:"categories" example:"documentary,news"`
|
|
}
|
|
|
|
// The search itself takes no body type: GET /api/videos reads its parameters
|
|
// — title, categories, limit and cursor — from the query string, so there is
|
|
// no request document to publish a schema for. They are documented as
|
|
// parameters on handlers.SearchVideos, and appear in the generated spec there.
|
|
|
|
// SearchResults is one page of search results.
|
|
type SearchResults struct {
|
|
// Videos are the matches, most relevant first. Never null: a search that
|
|
// matches nothing is an empty list.
|
|
Videos []Video `json:"videos"`
|
|
// NextCursor reaches the page after this one. Empty on the last page,
|
|
// which is how a reader knows there is no more to ask for.
|
|
NextCursor string `json:"nextCursor"`
|
|
}
|