feat(docs): add admin-only GET endpoint to list archived episodes with Swagger documentation
This commit is contained in:
parent
17f60c9ccb
commit
77c0c1586b
@ -16,6 +16,39 @@ const docTemplate = `{
|
|||||||
"basePath": "{{.BasePath}}",
|
"basePath": "{{.BasePath}}",
|
||||||
"paths": {
|
"paths": {
|
||||||
"/api/v1/archive": {
|
"/api/v1/archive": {
|
||||||
|
"get": {
|
||||||
|
"description": "List all rows from ` + "`" + `current_archive` + "`" + ` (admin only).",
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"archive"
|
||||||
|
],
|
||||||
|
"summary": "List archive",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/httpapi.ArchiveResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"403": {
|
||||||
|
"description": "admin only",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/httpapi.HTTPError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "list failed",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/httpapi.HTTPError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"post": {
|
"post": {
|
||||||
"description": "Move one or many IDs from ` + "`" + `current` + "`" + ` to ` + "`" + `current_archive` + "`" + `.",
|
"description": "Move one or many IDs from ` + "`" + `current` + "`" + ` to ` + "`" + `current_archive` + "`" + `.",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
@ -406,6 +439,47 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
|
"httpapi.ArchiveResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"current_ep": {
|
||||||
|
"type": "boolean",
|
||||||
|
"example": false
|
||||||
|
},
|
||||||
|
"date_archived": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "2024-03-01T15:04:05Z"
|
||||||
|
},
|
||||||
|
"date_created": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "2024-02-01T15:04:05Z"
|
||||||
|
},
|
||||||
|
"ep_num": {
|
||||||
|
"type": "integer",
|
||||||
|
"example": 1
|
||||||
|
},
|
||||||
|
"ep_title": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Pilot"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer",
|
||||||
|
"example": 123
|
||||||
|
},
|
||||||
|
"playback_length": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "00:24:00"
|
||||||
|
},
|
||||||
|
"season_name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Season 1"
|
||||||
|
},
|
||||||
|
"start_time": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "10:00:00"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"httpapi.CreateShowReq": {
|
"httpapi.CreateShowReq": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
@ -544,6 +618,15 @@ const docTemplate = `{
|
|||||||
"httpapi.FirebaseOAuthRes": {
|
"httpapi.FirebaseOAuthRes": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"admin": {
|
||||||
|
"type": "boolean",
|
||||||
|
"example": true
|
||||||
|
},
|
||||||
|
"custom_claims": {
|
||||||
|
"description": "CustomClaims echoes back custom claims; only include non-sensitive claims.",
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": true
|
||||||
|
},
|
||||||
"email": {
|
"email": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"example": "user@example.com"
|
"example": "user@example.com"
|
||||||
|
|||||||
@ -14,6 +14,39 @@
|
|||||||
"basePath": "/",
|
"basePath": "/",
|
||||||
"paths": {
|
"paths": {
|
||||||
"/api/v1/archive": {
|
"/api/v1/archive": {
|
||||||
|
"get": {
|
||||||
|
"description": "List all rows from `current_archive` (admin only).",
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"archive"
|
||||||
|
],
|
||||||
|
"summary": "List archive",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/httpapi.ArchiveResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"403": {
|
||||||
|
"description": "admin only",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/httpapi.HTTPError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "list failed",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/httpapi.HTTPError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"post": {
|
"post": {
|
||||||
"description": "Move one or many IDs from `current` to `current_archive`.",
|
"description": "Move one or many IDs from `current` to `current_archive`.",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
@ -404,6 +437,47 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
|
"httpapi.ArchiveResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"current_ep": {
|
||||||
|
"type": "boolean",
|
||||||
|
"example": false
|
||||||
|
},
|
||||||
|
"date_archived": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "2024-03-01T15:04:05Z"
|
||||||
|
},
|
||||||
|
"date_created": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "2024-02-01T15:04:05Z"
|
||||||
|
},
|
||||||
|
"ep_num": {
|
||||||
|
"type": "integer",
|
||||||
|
"example": 1
|
||||||
|
},
|
||||||
|
"ep_title": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Pilot"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer",
|
||||||
|
"example": 123
|
||||||
|
},
|
||||||
|
"playback_length": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "00:24:00"
|
||||||
|
},
|
||||||
|
"season_name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Season 1"
|
||||||
|
},
|
||||||
|
"start_time": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "10:00:00"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"httpapi.CreateShowReq": {
|
"httpapi.CreateShowReq": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
@ -542,6 +616,15 @@
|
|||||||
"httpapi.FirebaseOAuthRes": {
|
"httpapi.FirebaseOAuthRes": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"admin": {
|
||||||
|
"type": "boolean",
|
||||||
|
"example": true
|
||||||
|
},
|
||||||
|
"custom_claims": {
|
||||||
|
"description": "CustomClaims echoes back custom claims; only include non-sensitive claims.",
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": true
|
||||||
|
},
|
||||||
"email": {
|
"email": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"example": "user@example.com"
|
"example": "user@example.com"
|
||||||
|
|||||||
@ -1,5 +1,35 @@
|
|||||||
basePath: /
|
basePath: /
|
||||||
definitions:
|
definitions:
|
||||||
|
httpapi.ArchiveResponse:
|
||||||
|
properties:
|
||||||
|
current_ep:
|
||||||
|
example: false
|
||||||
|
type: boolean
|
||||||
|
date_archived:
|
||||||
|
example: "2024-03-01T15:04:05Z"
|
||||||
|
type: string
|
||||||
|
date_created:
|
||||||
|
example: "2024-02-01T15:04:05Z"
|
||||||
|
type: string
|
||||||
|
ep_num:
|
||||||
|
example: 1
|
||||||
|
type: integer
|
||||||
|
ep_title:
|
||||||
|
example: Pilot
|
||||||
|
type: string
|
||||||
|
id:
|
||||||
|
example: 123
|
||||||
|
type: integer
|
||||||
|
playback_length:
|
||||||
|
example: "00:24:00"
|
||||||
|
type: string
|
||||||
|
season_name:
|
||||||
|
example: Season 1
|
||||||
|
type: string
|
||||||
|
start_time:
|
||||||
|
example: "10:00:00"
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
httpapi.CreateShowReq:
|
httpapi.CreateShowReq:
|
||||||
properties:
|
properties:
|
||||||
ep_num:
|
ep_num:
|
||||||
@ -99,6 +129,14 @@ definitions:
|
|||||||
type: object
|
type: object
|
||||||
httpapi.FirebaseOAuthRes:
|
httpapi.FirebaseOAuthRes:
|
||||||
properties:
|
properties:
|
||||||
|
admin:
|
||||||
|
example: true
|
||||||
|
type: boolean
|
||||||
|
custom_claims:
|
||||||
|
additionalProperties: true
|
||||||
|
description: CustomClaims echoes back custom claims; only include non-sensitive
|
||||||
|
claims.
|
||||||
|
type: object
|
||||||
email:
|
email:
|
||||||
example: user@example.com
|
example: user@example.com
|
||||||
type: string
|
type: string
|
||||||
@ -169,6 +207,28 @@ info:
|
|||||||
version: "1.0"
|
version: "1.0"
|
||||||
paths:
|
paths:
|
||||||
/api/v1/archive:
|
/api/v1/archive:
|
||||||
|
get:
|
||||||
|
description: List all rows from `current_archive` (admin only).
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/httpapi.ArchiveResponse'
|
||||||
|
type: array
|
||||||
|
"403":
|
||||||
|
description: admin only
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/httpapi.HTTPError'
|
||||||
|
"500":
|
||||||
|
description: list failed
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/httpapi.HTTPError'
|
||||||
|
summary: List archive
|
||||||
|
tags:
|
||||||
|
- archive
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user