update openapi spec with links and callback for search

pull/2915/head
Rigel Kent 2020-06-27 11:43:43 +02:00
parent cc0e0d32ea
commit 2c31866430
No known key found for this signature in database
GPG Key ID: 5E53E96A494E452F
2 changed files with 94 additions and 20 deletions

View File

@ -205,7 +205,7 @@ async function createUser (req: express.Request, res: express.Response) {
Hooks.runAction('action:api.user.created', { body, user, account, videoChannel }) Hooks.runAction('action:api.user.created', { body, user, account, videoChannel })
return res.json({ return res.status(201).json({
user: { user: {
id: user.id, id: user.id,
account: { account: {

View File

@ -484,12 +484,30 @@ paths:
tags: tags:
- Users - Users
responses: responses:
'200': '201':
description: successful operation description: user created
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/AddUserResponse' $ref: '#/components/schemas/AddUserResponse'
links:
# GET /users/{id}
GetUserId:
operationId: getUserId
parameters:
id: '$response.body#/user/id'
# PUT /users/{id}
PutUserId:
operationId: putUserId
parameters:
id: '$response.body#/user/id'
# DELETE /users/{id}
DelUserId:
operationId: delUserId
parameters:
id: '$response.body#/user/id'
'403':
description: insufficient authority to create an admin or moderator
requestBody: requestBody:
content: content:
application/json: application/json:
@ -517,6 +535,8 @@ paths:
items: items:
$ref: '#/components/schemas/User' $ref: '#/components/schemas/User'
'/users/{id}': '/users/{id}':
parameters:
- $ref: '#/components/parameters/id'
delete: delete:
summary: Delete a user summary: Delete a user
security: security:
@ -524,8 +544,7 @@ paths:
- admin - admin
tags: tags:
- Users - Users
parameters: operationId: delUserId
- $ref: '#/components/parameters/id'
responses: responses:
'204': '204':
description: successful operation description: successful operation
@ -535,8 +554,7 @@ paths:
- OAuth2: [] - OAuth2: []
tags: tags:
- Users - Users
parameters: operationId: getUserId
- $ref: '#/components/parameters/id'
responses: responses:
'200': '200':
description: successful operation description: successful operation
@ -550,8 +568,7 @@ paths:
- OAuth2: [] - OAuth2: []
tags: tags:
- Users - Users
parameters: operationId: putUserId
- $ref: '#/components/parameters/id'
responses: responses:
'204': '204':
description: successful operation description: successful operation
@ -701,12 +718,28 @@ paths:
'200': '200':
description: successful operation description: successful operation
post: post:
tags:
- My Subscriptions
summary: Add subscription to my user summary: Add subscription to my user
security: security:
- OAuth2: - OAuth2:
- user - user
tags: requestBody:
- My Subscriptions content:
application/json:
schema:
type: object
properties:
uri:
type: string
format: uri
description: uri of the video channels to subscribe to
required:
- uri
examples:
default:
value:
uri: 008a0e54-375d-49d0-8379-143202e24152@video.lqdn.fr
responses: responses:
'200': '200':
description: successful operation description: successful operation
@ -816,7 +849,7 @@ paths:
- My Notifications - My Notifications
requestBody: requestBody:
content: content:
multipart/form-data: application/json:
schema: schema:
type: object type: object
properties: properties:
@ -849,7 +882,7 @@ paths:
- My Notifications - My Notifications
requestBody: requestBody:
content: content:
multipart/form-data: application/json:
schema: schema:
type: object type: object
properties: properties:
@ -1930,6 +1963,9 @@ paths:
type: integer type: integer
required: required:
- displayName - displayName
encoding:
thumbnailfile:
contentType: image/jpeg
/video-playlists/{id}: /video-playlists/{id}:
get: get:
@ -1978,6 +2014,9 @@ paths:
videoChannelId: videoChannelId:
description: Video channel in which the playlist will be published description: Video channel in which the playlist will be published
type: integer type: integer
encoding:
thumbnailfile:
contentType: image/jpeg
delete: delete:
summary: Delete a video playlist summary: Delete a video playlist
security: security:
@ -2242,6 +2281,8 @@ paths:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/CommentThreadPostResponse' $ref: '#/components/schemas/CommentThreadPostResponse'
'404':
description: video does not exist
requestBody: requestBody:
content: content:
application/json: application/json:
@ -2286,6 +2327,8 @@ paths:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/CommentThreadPostResponse' $ref: '#/components/schemas/CommentThreadPostResponse'
'404':
description: thread or video does not exist
requestBody: requestBody:
content: content:
application/json: application/json:
@ -2328,6 +2371,8 @@ paths:
responses: responses:
'204': '204':
description: successful operation description: successful operation
'404':
description: video does not exist
/search/videos: /search/videos:
get: get:
tags: tags:
@ -2390,6 +2435,9 @@ paths:
description: Get videos that have this maximum duration description: Get videos that have this maximum duration
schema: schema:
type: integer type: integer
callbacks:
'searchTarget === search-index':
$ref: '#/components/callbacks/searchIndex'
responses: responses:
'200': '200':
description: successful operation description: successful operation
@ -2397,6 +2445,8 @@ paths:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/VideoListResponse' $ref: '#/components/schemas/VideoListResponse'
'500':
description: search index unavailable
/search/video-channels: /search/video-channels:
get: get:
tags: tags:
@ -2416,6 +2466,9 @@ paths:
- $ref: '#/components/parameters/count' - $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/searchTarget' - $ref: '#/components/parameters/searchTarget'
- $ref: '#/components/parameters/sort' - $ref: '#/components/parameters/sort'
callbacks:
'searchTarget === search-index':
$ref: '#/components/callbacks/searchIndex'
responses: responses:
'200': '200':
description: successful operation description: successful operation
@ -2425,6 +2478,8 @@ paths:
type: array type: array
items: items:
$ref: '#/components/schemas/VideoChannel' $ref: '#/components/schemas/VideoChannel'
'500':
description: search index unavailable
/blocklist/accounts: /blocklist/accounts:
get: get:
tags: tags:
@ -3455,6 +3510,7 @@ components:
- 1 - 1
- 2 - 2
description: 'The user role (Admin = `0`, Moderator = `1`, User = `2`)' description: 'The user role (Admin = `0`, Moderator = `1`, User = `2`)'
example: 2
VideoStateConstant: VideoStateConstant:
properties: properties:
@ -4480,13 +4536,19 @@ components:
type: string type: string
format: date-time format: date-time
AddUserResponse: AddUserResponse:
properties:
user:
type: object
properties: properties:
id: id:
type: integer type: integer
uuid: example: 8
type: string account:
format: uuid type: object
example: 9c9de5e8-0a1e-484a-b099-e80766180a6d properties:
id:
type: integer
example: 37
VideoUploadResponse: VideoUploadResponse:
properties: properties:
video: video:
@ -5157,3 +5219,15 @@ components:
maxItems: 100 maxItems: 100
items: items:
$ref: '#/components/schemas/Plugin' $ref: '#/components/schemas/Plugin'
callbacks:
searchIndex:
'{%CONFIG.SEARCH.SEARCH_INDEX.URL%}/api/v1/search/videos/':
post:
summary: third-party search index MAY be used instead of the local index, if enabled by the instance admin. see `searchTarget`
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/VideoListResponse'