Merge remote-tracking branch 'origin/api_dev' into api_dev

This commit is contained in:
Marco Realacci 2022-11-21 14:34:07 +01:00
commit ecf90cdc84

View file

@ -71,13 +71,17 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "Username already taken"
'404': '404':
description: The user does not exist. description: The user does not exist.
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "User not found"
/users/{user_id}/followers: /users/{user_id}/followers:
get: get:
@ -115,7 +119,9 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "User not found"
/users/{user_id}/following: /users/{user_id}/following:
get: get:
tags: ["followers"] tags: ["followers"]
@ -152,7 +158,9 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "User not found"
/users/{user_id}/followers/{follower_uid}: /users/{user_id}/followers/{follower_uid}:
parameters: parameters:
@ -189,13 +197,25 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "Forbidden"
'404': '404':
description: The user does not exist. description: The resource does not exist.
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "User not found"
'400':
description: Trying to follow a user that does not exist.
content:
application/json:
schema:
$ref: "#/components/schemas/generic_response"
example:
error: "User not found"
delete: delete:
tags: ["followers"] tags: ["followers"]
summary: Unfollows a user summary: Unfollows a user
@ -211,7 +231,9 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "User not found"
/users/{user_id}/bans/{ban_uid}: /users/{user_id}/bans/{ban_uid}:
parameters: parameters:
@ -242,13 +264,17 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "Forbidden"
'404': '404':
description: The user does not exist. description: The user does not exist.
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "User not found"
delete: delete:
tags: ["bans"] tags: ["bans"]
@ -265,13 +291,17 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "Forbidden"
'404': '404':
description: The user is not banned by the user. description: The user is not banned by the user.
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "User not found"
/users/{user_id}/photos/{photo_id}/likes: /users/{user_id}/photos/{photo_id}/likes:
get: get:
@ -315,7 +345,9 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "Resource not found"
/users/{user_id}/photos/{photo_id}/likes/{liker_uid}: /users/{user_id}/photos/{photo_id}/likes/{liker_uid}:
parameters: parameters:
@ -352,13 +384,25 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "Forbidden"
'404': '404':
description: The user or the photo does not exists (or the author of the photo has banned the authorized user). description: Resource not found (or the author of the photo has banned the authorized user).
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "Resource not found"
'400':
description: Bad URI (maybe liker_uid is invalid).
content:
application/json:
schema:
$ref: "#/components/schemas/generic_response"
example:
error: "Bad photo_id"
delete: delete:
tags: ["likes"] tags: ["likes"]
summary: Unlikes a photo summary: Unlikes a photo
@ -374,7 +418,9 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "Resource not found"
/users/{user_id}: /users/{user_id}:
get: get:
@ -414,7 +460,9 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "Resource not found"
/users/{user_id}/photos: /users/{user_id}/photos:
post: post:
@ -444,15 +492,17 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_success" $ref: "#/components/schemas/generic_response"
example: example:
status: "Created" status: "Resource created"
'404': '404':
description: User not found (or the authorized user is banned). description: User not found (or the authorized user is banned).
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "Resource not found"
/users/{user_id}/photos/{photo_id}: /users/{user_id}/photos/{photo_id}:
parameters: parameters:
@ -490,7 +540,9 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "Resource not found"
delete: delete:
tags: ["photos"] tags: ["photos"]
summary: Deletes a photo summary: Deletes a photo
@ -506,13 +558,17 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "Unauthorized"
'404': '404':
description: User or photo not found. description: User or photo not found.
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "Resource not found"
/users/{user_id}/photos/{photo_id}/comments: /users/{user_id}/photos/{photo_id}/comments:
parameters: parameters:
@ -546,17 +602,21 @@ paths:
- user_id: "a1b2c3d4-e5f6-a7b8-c9d0-e1f2a3b4c5d6" - user_id: "a1b2c3d4-e5f6-a7b8-c9d0-e1f2a3b4c5d6"
name: "Maria" name: "Maria"
comment: "Nice photo!" comment: "Nice photo!"
comment_id: 1
date: "2020-11-20T12:00:00Z" date: "2020-11-20T12:00:00Z"
- user_id: "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d" - user_id: "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d"
name: "John" name: "John"
comment: "I like it!" comment: "I like it!"
comment_id: 2
date: "2021-12-20T13:04:00Z" date: "2021-12-20T13:04:00Z"
'404': '404':
description: The user or the photo does not exist. description: The user or the photo does not exist.
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "Resource not found"
post: post:
tags: ["comments"] tags: ["comments"]
summary: Comments a photo summary: Comments a photo
@ -580,7 +640,9 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "Resource not found"
/users/{user_id}/photos/{photo_id}/comments/{comment_id}: /users/{user_id}/photos/{photo_id}/comments/{comment_id}:
delete: delete:
@ -617,13 +679,17 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "Unauthorized"
'404': '404':
description: The comment does not exists. description: The comment does not exists.
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/generic_error" $ref: "#/components/schemas/generic_response"
example:
error: "Resource not found"
/stream: # todo review path /stream: # todo review path
get: get:
@ -789,12 +855,16 @@ components:
$ref: "#/components/schemas/name" $ref: "#/components/schemas/name"
comment: comment:
$ref: "#/components/schemas/comment" $ref: "#/components/schemas/comment"
comment_id:
$ref: "#/components/schemas/comment_id"
date: date:
$ref: "#/components/schemas/upload_time" $ref: "#/components/schemas/upload_time"
comment_request: comment_request:
description: The comment to post. description: The comment to post.
type: object type: object
properties: properties:
user_id:
$ref: "#/components/schemas/uid"
comment: comment:
$ref: "#/components/schemas/comment" $ref: "#/components/schemas/comment"
comment: comment:
@ -804,24 +874,15 @@ components:
type: string type: string
example: "What a lovely picture! 😊" example: "What a lovely picture! 😊"
description: The comment's text description: The comment's text
generic_error:
type: object
description: An object representing an error.
properties:
error:
type: string
description: The error message.
example: "The user does not exist."
generic_success: generic_response:
type: object type: object
description: An object representing a success. description: An object representing a success.
properties: properties:
status: status:
type: string type: string
description: The status of the request. description: The status of the request.
example: "Created" example: "Success"
requestBodies: requestBodies:
userDetails: userDetails: