166 lines
No EOL
3.8 KiB
YAML
166 lines
No EOL
3.8 KiB
YAML
get:
|
|
summary: Get user titles
|
|
parameters:
|
|
- $ref: '../parameters/cursor.yaml'
|
|
- $ref: "../parameters/title_sort.yaml"
|
|
- in: path
|
|
name: user_id
|
|
required: true
|
|
schema:
|
|
type: string
|
|
- in: query
|
|
name: sort_forward
|
|
schema:
|
|
type: boolean
|
|
default: true
|
|
- in: query
|
|
name: word
|
|
schema:
|
|
type: string
|
|
- in: query
|
|
name: status
|
|
schema:
|
|
type: array
|
|
items:
|
|
$ref: '../schemas/enums/TitleStatus.yaml'
|
|
description: List of title statuses to filter
|
|
style: form
|
|
explode: false
|
|
- in: query
|
|
name: watch_status
|
|
schema:
|
|
type: array
|
|
items:
|
|
$ref: '../schemas/enums/UserTitleStatus.yaml'
|
|
style: form
|
|
explode: false
|
|
- in: query
|
|
name: rating
|
|
schema:
|
|
type: number
|
|
format: double
|
|
- in: query
|
|
name: my_rate
|
|
schema:
|
|
type: integer
|
|
format: int32
|
|
- in: query
|
|
name: release_year
|
|
schema:
|
|
type: integer
|
|
format: int32
|
|
- in: query
|
|
name: release_season
|
|
schema:
|
|
$ref: '../schemas/enums/ReleaseSeason.yaml'
|
|
- in: query
|
|
name: limit
|
|
schema:
|
|
type: integer
|
|
format: int32
|
|
default: 10
|
|
- in: query
|
|
name: fields
|
|
schema:
|
|
type: string
|
|
default: all
|
|
responses:
|
|
'200':
|
|
description: List of user titles
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
data:
|
|
type: array
|
|
items:
|
|
$ref: '../schemas/UserTitle.yaml'
|
|
cursor:
|
|
$ref: '../schemas/CursorObj.yaml'
|
|
required:
|
|
- data
|
|
- cursor
|
|
'204':
|
|
description: No titles found
|
|
'400':
|
|
description: Request params are not correct
|
|
'404':
|
|
description: User not found
|
|
'500':
|
|
description: Unknown server error
|
|
|
|
post:
|
|
summary: Add a title to a user
|
|
description: User adding title to list af watched, status required
|
|
operationId: addUserTitle
|
|
parameters:
|
|
- name: user_id
|
|
in: path
|
|
required: true
|
|
schema:
|
|
type: integer
|
|
format: int64
|
|
description: ID of the user to assign the title to
|
|
example: 123
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
required:
|
|
- user_id
|
|
- title_id
|
|
- status
|
|
properties:
|
|
user_id:
|
|
type: integer
|
|
format: int64
|
|
title_id:
|
|
type: integer
|
|
format: int64
|
|
status:
|
|
$ref: ../schemas/enums/UserTitleStatus.yaml
|
|
rate:
|
|
type: integer
|
|
format: int32
|
|
review_id:
|
|
type: integer
|
|
format: int64
|
|
ctime:
|
|
type: string
|
|
format: date-time
|
|
|
|
responses:
|
|
'200':
|
|
description: Title successfully added to user
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
# success:
|
|
# type: boolean
|
|
# example: true
|
|
# error:
|
|
# type: string
|
|
# nullable: true
|
|
# example: null
|
|
data:
|
|
$ref: '../schemas/UserTitleMini.yaml'
|
|
# required:
|
|
# - success
|
|
# - error
|
|
'400':
|
|
description: Invalid request body (missing fields, invalid types, etc.)
|
|
'401':
|
|
description: Unauthorized — missing or invalid auth token
|
|
'403':
|
|
description: Forbidden — user not allowed to assign titles to this user
|
|
'404':
|
|
description: User or Title not found
|
|
'409':
|
|
description: Conflict — title already assigned to user (if applicable)
|
|
'500':
|
|
description: Internal server error |