aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-06-27 11:43:43 +0200
committerRigel Kent <sendmemail@rigelk.eu>2020-06-27 13:12:34 +0200
commit2c318664305fd2723586ad939e64f958d9d447ff (patch)
tree4b7f4b505e5d1a8081d1048de7ccde8e54793ee0
parentcc0e0d32ea7f65475630bcdee1f1fa8a8c71eb05 (diff)
downloadPeerTube-2c318664305fd2723586ad939e64f958d9d447ff.tar.gz
PeerTube-2c318664305fd2723586ad939e64f958d9d447ff.tar.zst
PeerTube-2c318664305fd2723586ad939e64f958d9d447ff.zip
update openapi spec with links and callback for search
-rw-r--r--server/controllers/api/users/index.ts2
-rw-r--r--support/doc/api/openapi.yaml112
2 files changed, 94 insertions, 20 deletions
diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts
index c8e9eaeaa..732a6faa3 100644
--- a/server/controllers/api/users/index.ts
+++ b/server/controllers/api/users/index.ts
@@ -205,7 +205,7 @@ async function createUser (req: express.Request, res: express.Response) {
205 205
206 Hooks.runAction('action:api.user.created', { body, user, account, videoChannel }) 206 Hooks.runAction('action:api.user.created', { body, user, account, videoChannel })
207 207
208 return res.json({ 208 return res.status(201).json({
209 user: { 209 user: {
210 id: user.id, 210 id: user.id,
211 account: { 211 account: {
diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml
index 6c1ffee4f..3b06a2568 100644
--- a/support/doc/api/openapi.yaml
+++ b/support/doc/api/openapi.yaml
@@ -484,12 +484,30 @@ paths:
484 tags: 484 tags:
485 - Users 485 - Users
486 responses: 486 responses:
487 '200': 487 '201':
488 description: successful operation 488 description: user created
489 content: 489 content:
490 application/json: 490 application/json:
491 schema: 491 schema:
492 $ref: '#/components/schemas/AddUserResponse' 492 $ref: '#/components/schemas/AddUserResponse'
493 links:
494 # GET /users/{id}
495 GetUserId:
496 operationId: getUserId
497 parameters:
498 id: '$response.body#/user/id'
499 # PUT /users/{id}
500 PutUserId:
501 operationId: putUserId
502 parameters:
503 id: '$response.body#/user/id'
504 # DELETE /users/{id}
505 DelUserId:
506 operationId: delUserId
507 parameters:
508 id: '$response.body#/user/id'
509 '403':
510 description: insufficient authority to create an admin or moderator
493 requestBody: 511 requestBody:
494 content: 512 content:
495 application/json: 513 application/json:
@@ -517,6 +535,8 @@ paths:
517 items: 535 items:
518 $ref: '#/components/schemas/User' 536 $ref: '#/components/schemas/User'
519 '/users/{id}': 537 '/users/{id}':
538 parameters:
539 - $ref: '#/components/parameters/id'
520 delete: 540 delete:
521 summary: Delete a user 541 summary: Delete a user
522 security: 542 security:
@@ -524,8 +544,7 @@ paths:
524 - admin 544 - admin
525 tags: 545 tags:
526 - Users 546 - Users
527 parameters: 547 operationId: delUserId
528 - $ref: '#/components/parameters/id'
529 responses: 548 responses:
530 '204': 549 '204':
531 description: successful operation 550 description: successful operation
@@ -535,8 +554,7 @@ paths:
535 - OAuth2: [] 554 - OAuth2: []
536 tags: 555 tags:
537 - Users 556 - Users
538 parameters: 557 operationId: getUserId
539 - $ref: '#/components/parameters/id'
540 responses: 558 responses:
541 '200': 559 '200':
542 description: successful operation 560 description: successful operation
@@ -550,8 +568,7 @@ paths:
550 - OAuth2: [] 568 - OAuth2: []
551 tags: 569 tags:
552 - Users 570 - Users
553 parameters: 571 operationId: putUserId
554 - $ref: '#/components/parameters/id'
555 responses: 572 responses:
556 '204': 573 '204':
557 description: successful operation 574 description: successful operation
@@ -701,12 +718,28 @@ paths:
701 '200': 718 '200':
702 description: successful operation 719 description: successful operation
703 post: 720 post:
721 tags:
722 - My Subscriptions
704 summary: Add subscription to my user 723 summary: Add subscription to my user
705 security: 724 security:
706 - OAuth2: 725 - OAuth2:
707 - user 726 - user
708 tags: 727 requestBody:
709 - My Subscriptions 728 content:
729 application/json:
730 schema:
731 type: object
732 properties:
733 uri:
734 type: string
735 format: uri
736 description: uri of the video channels to subscribe to
737 required:
738 - uri
739 examples:
740 default:
741 value:
742 uri: 008a0e54-375d-49d0-8379-143202e24152@video.lqdn.fr
710 responses: 743 responses:
711 '200': 744 '200':
712 description: successful operation 745 description: successful operation
@@ -816,7 +849,7 @@ paths:
816 - My Notifications 849 - My Notifications
817 requestBody: 850 requestBody:
818 content: 851 content:
819 multipart/form-data: 852 application/json:
820 schema: 853 schema:
821 type: object 854 type: object
822 properties: 855 properties:
@@ -849,7 +882,7 @@ paths:
849 - My Notifications 882 - My Notifications
850 requestBody: 883 requestBody:
851 content: 884 content:
852 multipart/form-data: 885 application/json:
853 schema: 886 schema:
854 type: object 887 type: object
855 properties: 888 properties:
@@ -1930,6 +1963,9 @@ paths:
1930 type: integer 1963 type: integer
1931 required: 1964 required:
1932 - displayName 1965 - displayName
1966 encoding:
1967 thumbnailfile:
1968 contentType: image/jpeg
1933 1969
1934 /video-playlists/{id}: 1970 /video-playlists/{id}:
1935 get: 1971 get:
@@ -1978,6 +2014,9 @@ paths:
1978 videoChannelId: 2014 videoChannelId:
1979 description: Video channel in which the playlist will be published 2015 description: Video channel in which the playlist will be published
1980 type: integer 2016 type: integer
2017 encoding:
2018 thumbnailfile:
2019 contentType: image/jpeg
1981 delete: 2020 delete:
1982 summary: Delete a video playlist 2021 summary: Delete a video playlist
1983 security: 2022 security:
@@ -2242,6 +2281,8 @@ paths:
2242 application/json: 2281 application/json:
2243 schema: 2282 schema:
2244 $ref: '#/components/schemas/CommentThreadPostResponse' 2283 $ref: '#/components/schemas/CommentThreadPostResponse'
2284 '404':
2285 description: video does not exist
2245 requestBody: 2286 requestBody:
2246 content: 2287 content:
2247 application/json: 2288 application/json:
@@ -2286,6 +2327,8 @@ paths:
2286 application/json: 2327 application/json:
2287 schema: 2328 schema:
2288 $ref: '#/components/schemas/CommentThreadPostResponse' 2329 $ref: '#/components/schemas/CommentThreadPostResponse'
2330 '404':
2331 description: thread or video does not exist
2289 requestBody: 2332 requestBody:
2290 content: 2333 content:
2291 application/json: 2334 application/json:
@@ -2328,6 +2371,8 @@ paths:
2328 responses: 2371 responses:
2329 '204': 2372 '204':
2330 description: successful operation 2373 description: successful operation
2374 '404':
2375 description: video does not exist
2331 /search/videos: 2376 /search/videos:
2332 get: 2377 get:
2333 tags: 2378 tags:
@@ -2390,6 +2435,9 @@ paths:
2390 description: Get videos that have this maximum duration 2435 description: Get videos that have this maximum duration
2391 schema: 2436 schema:
2392 type: integer 2437 type: integer
2438 callbacks:
2439 'searchTarget === search-index':
2440 $ref: '#/components/callbacks/searchIndex'
2393 responses: 2441 responses:
2394 '200': 2442 '200':
2395 description: successful operation 2443 description: successful operation
@@ -2397,6 +2445,8 @@ paths:
2397 application/json: 2445 application/json:
2398 schema: 2446 schema:
2399 $ref: '#/components/schemas/VideoListResponse' 2447 $ref: '#/components/schemas/VideoListResponse'
2448 '500':
2449 description: search index unavailable
2400 /search/video-channels: 2450 /search/video-channels:
2401 get: 2451 get:
2402 tags: 2452 tags:
@@ -2416,6 +2466,9 @@ paths:
2416 - $ref: '#/components/parameters/count' 2466 - $ref: '#/components/parameters/count'
2417 - $ref: '#/components/parameters/searchTarget' 2467 - $ref: '#/components/parameters/searchTarget'
2418 - $ref: '#/components/parameters/sort' 2468 - $ref: '#/components/parameters/sort'
2469 callbacks:
2470 'searchTarget === search-index':
2471 $ref: '#/components/callbacks/searchIndex'
2419 responses: 2472 responses:
2420 '200': 2473 '200':
2421 description: successful operation 2474 description: successful operation
@@ -2425,6 +2478,8 @@ paths:
2425 type: array 2478 type: array
2426 items: 2479 items:
2427 $ref: '#/components/schemas/VideoChannel' 2480 $ref: '#/components/schemas/VideoChannel'
2481 '500':
2482 description: search index unavailable
2428 /blocklist/accounts: 2483 /blocklist/accounts:
2429 get: 2484 get:
2430 tags: 2485 tags:
@@ -3455,6 +3510,7 @@ components:
3455 - 1 3510 - 1
3456 - 2 3511 - 2
3457 description: 'The user role (Admin = `0`, Moderator = `1`, User = `2`)' 3512 description: 'The user role (Admin = `0`, Moderator = `1`, User = `2`)'
3513 example: 2
3458 3514
3459 VideoStateConstant: 3515 VideoStateConstant:
3460 properties: 3516 properties:
@@ -4481,12 +4537,18 @@ components:
4481 format: date-time 4537 format: date-time
4482 AddUserResponse: 4538 AddUserResponse:
4483 properties: 4539 properties:
4484 id: 4540 user:
4485 type: integer 4541 type: object
4486 uuid: 4542 properties:
4487 type: string 4543 id:
4488 format: uuid 4544 type: integer
4489 example: 9c9de5e8-0a1e-484a-b099-e80766180a6d 4545 example: 8
4546 account:
4547 type: object
4548 properties:
4549 id:
4550 type: integer
4551 example: 37
4490 VideoUploadResponse: 4552 VideoUploadResponse:
4491 properties: 4553 properties:
4492 video: 4554 video:
@@ -5156,4 +5218,16 @@ components:
5156 type: array 5218 type: array
5157 maxItems: 100 5219 maxItems: 100
5158 items: 5220 items:
5159 $ref: '#/components/schemas/Plugin' \ No newline at end of file 5221 $ref: '#/components/schemas/Plugin'
5222 callbacks:
5223 searchIndex:
5224 '{%CONFIG.SEARCH.SEARCH_INDEX.URL%}/api/v1/search/videos/':
5225 post:
5226 summary: third-party search index MAY be used instead of the local index, if enabled by the instance admin. see `searchTarget`
5227 responses:
5228 '200':
5229 description: successful operation
5230 content:
5231 application/json:
5232 schema:
5233 $ref: '#/components/schemas/VideoListResponse' \ No newline at end of file