watch-party/backend/docs/swagger.yaml

275 lines
6.4 KiB
YAML

basePath: /
definitions:
httpapi.CreateShowReq:
properties:
ep_num:
example: 1
type: integer
ep_title:
example: Pilot
type: string
playback_length:
example: "00:24:00"
type: string
season_name:
example: Season 1
type: string
start_time:
description: optional; defaults to 22:00:00
example: "10:00:00"
type: string
required:
- ep_num
- ep_title
- playback_length
- season_name
type: object
httpapi.CurrentResponse:
properties:
current_ep:
example: false
type: boolean
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.HTTPError:
properties:
error:
example: invalid payload
type: string
type: object
httpapi.MoveReq:
properties:
id:
example: 123
type: integer
ids:
items:
type: integer
type: array
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
post:
consumes:
- application/json
description: Insert a new show into `current`.
parameters:
- description: New show payload
in: body
name: body
required: true
schema:
$ref: '#/definitions/httpapi.CreateShowReq'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/httpapi.CurrentResponse'
"400":
description: invalid payload or invalid time/duration
schema:
$ref: '#/definitions/httpapi.HTTPError'
"500":
description: create failed
schema:
$ref: '#/definitions/httpapi.HTTPError'
summary: Create show
tags:
- shows
schemes:
- http
- https
swagger: "2.0"