194 lines
4.5 KiB
YAML
194 lines
4.5 KiB
YAML
basePath: /
|
|
definitions:
|
|
httpapi.CurrentResponse:
|
|
properties:
|
|
id:
|
|
type: integer
|
|
start_time:
|
|
type: string
|
|
type: object
|
|
httpapi.HTTPError:
|
|
properties:
|
|
error:
|
|
example: invalid payload
|
|
type: string
|
|
type: object
|
|
httpapi.MoveReq:
|
|
type: object
|
|
httpapi.MoveRes:
|
|
properties:
|
|
deleted:
|
|
type: integer
|
|
deleted_ids:
|
|
items:
|
|
type: integer
|
|
type: array
|
|
inserted:
|
|
type: integer
|
|
moved_ids:
|
|
items:
|
|
type: integer
|
|
type: array
|
|
skipped:
|
|
type: integer
|
|
skipped_ids:
|
|
items:
|
|
type: integer
|
|
type: array
|
|
type: object
|
|
httpapi.SetCurrentReq:
|
|
properties:
|
|
id:
|
|
example: 123
|
|
type: integer
|
|
start_time:
|
|
example: "21:00:00"
|
|
type: string
|
|
required:
|
|
- id
|
|
- start_time
|
|
type: object
|
|
host: localhost:8082
|
|
info:
|
|
contact: {}
|
|
description: Backend API for watch-party app.
|
|
title: Watch Party Backend API
|
|
version: "1.0"
|
|
paths:
|
|
/api/v1/archive:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Move one or many IDs from `current` to `current_archive`.
|
|
parameters:
|
|
- description: IDs to move
|
|
in: body
|
|
name: body
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/httpapi.MoveReq'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/httpapi.MoveRes'
|
|
"400":
|
|
description: empty ids
|
|
schema:
|
|
$ref: '#/definitions/httpapi.HTTPError'
|
|
"500":
|
|
description: move failed
|
|
schema:
|
|
$ref: '#/definitions/httpapi.HTTPError'
|
|
summary: Move shows to archive
|
|
tags:
|
|
- archive
|
|
/api/v1/current:
|
|
get:
|
|
description: Returns the current row from `current` table.
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/httpapi.CurrentResponse'
|
|
"404":
|
|
description: no current row found
|
|
schema:
|
|
$ref: '#/definitions/httpapi.HTTPError'
|
|
"500":
|
|
description: query failed
|
|
schema:
|
|
$ref: '#/definitions/httpapi.HTTPError'
|
|
summary: Get current show
|
|
tags:
|
|
- current
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Set the current show ID and start time.
|
|
parameters:
|
|
- description: Current show payload
|
|
in: body
|
|
name: body
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/httpapi.SetCurrentReq'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/httpapi.CurrentResponse'
|
|
"400":
|
|
description: invalid payload or invalid time
|
|
schema:
|
|
$ref: '#/definitions/httpapi.HTTPError'
|
|
"404":
|
|
description: id not found
|
|
schema:
|
|
$ref: '#/definitions/httpapi.HTTPError'
|
|
"500":
|
|
description: update failed
|
|
schema:
|
|
$ref: '#/definitions/httpapi.HTTPError'
|
|
summary: Set current show
|
|
tags:
|
|
- current
|
|
/api/v1/shows:
|
|
delete:
|
|
description: Delete a row from `current` by ID.
|
|
parameters:
|
|
- description: Show ID
|
|
format: int64
|
|
in: query
|
|
name: id
|
|
required: true
|
|
type: integer
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"204":
|
|
description: No Content
|
|
"400":
|
|
description: invalid id
|
|
schema:
|
|
$ref: '#/definitions/httpapi.HTTPError'
|
|
"404":
|
|
description: id not found
|
|
schema:
|
|
$ref: '#/definitions/httpapi.HTTPError'
|
|
"500":
|
|
description: delete failed
|
|
schema:
|
|
$ref: '#/definitions/httpapi.HTTPError'
|
|
summary: Delete show
|
|
tags:
|
|
- shows
|
|
get:
|
|
description: List all rows from `current` table.
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
items:
|
|
$ref: '#/definitions/httpapi.CurrentResponse'
|
|
type: array
|
|
"500":
|
|
description: list failed
|
|
schema:
|
|
$ref: '#/definitions/httpapi.HTTPError'
|
|
summary: List current shows
|
|
tags:
|
|
- shows
|
|
schemes:
|
|
- http
|
|
- https
|
|
swagger: "2.0"
|