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

This commit is contained in:
Marco Realacci 2022-11-21 01:33:25 +01:00
commit 9fc525e646

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:
@ -183,13 +191,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
@ -205,7 +225,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:
@ -236,13 +258,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"]
@ -259,13 +285,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:
@ -309,7 +339,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:
@ -346,13 +378,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
@ -368,7 +412,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:
@ -408,7 +454,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:
@ -438,15 +486,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:
@ -484,7 +534,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
@ -500,13 +552,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:
@ -540,17 +596,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
@ -574,7 +634,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:
@ -611,13 +673,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:
@ -783,12 +849,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:
@ -799,23 +869,14 @@ components:
example: "What a lovely picture! 😊" example: "What a lovely picture! 😊"
description: The comment's text description: The comment's text
generic_error: generic_response:
type: object
description: An object representing an error.
properties:
error:
type: string
description: The error message.
example: "The user does not exist."
generic_success:
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: