mirror of
https://github.com/notherealmarco/WASAPhoto.git
synced 2025-03-14 06:06:15 +01:00
Merge remote-tracking branch 'origin/api_dev' into dev
This commit is contained in:
commit
9fc525e646
1 changed files with 100 additions and 39 deletions
139
doc/api.yaml
139
doc/api.yaml
|
@ -71,13 +71,17 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_error"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Username already taken"
|
||||
'404':
|
||||
description: The user does not exist.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_error"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "User not found"
|
||||
|
||||
/users/{user_id}/followers:
|
||||
get:
|
||||
|
@ -115,7 +119,9 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_error"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "User not found"
|
||||
/users/{user_id}/following:
|
||||
get:
|
||||
tags: ["followers"]
|
||||
|
@ -152,7 +158,9 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_error"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "User not found"
|
||||
|
||||
/users/{user_id}/followers/{follower_uid}:
|
||||
parameters:
|
||||
|
@ -183,13 +191,25 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_error"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Forbidden"
|
||||
'404':
|
||||
description: The user does not exist.
|
||||
description: The resource does not exist.
|
||||
content:
|
||||
application/json:
|
||||
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:
|
||||
tags: ["followers"]
|
||||
summary: Unfollows a user
|
||||
|
@ -205,7 +225,9 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_error"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "User not found"
|
||||
|
||||
/users/{user_id}/bans/{ban_uid}:
|
||||
parameters:
|
||||
|
@ -236,13 +258,17 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_error"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Forbidden"
|
||||
'404':
|
||||
description: The user does not exist.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_error"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "User not found"
|
||||
|
||||
delete:
|
||||
tags: ["bans"]
|
||||
|
@ -259,13 +285,17 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_error"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Forbidden"
|
||||
'404':
|
||||
description: The user is not banned by the user.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_error"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "User not found"
|
||||
|
||||
/users/{user_id}/photos/{photo_id}/likes:
|
||||
get:
|
||||
|
@ -309,7 +339,9 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
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}:
|
||||
parameters:
|
||||
|
@ -346,13 +378,25 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_error"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Forbidden"
|
||||
'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:
|
||||
application/json:
|
||||
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:
|
||||
tags: ["likes"]
|
||||
summary: Unlikes a photo
|
||||
|
@ -368,7 +412,9 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_error"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Resource not found"
|
||||
|
||||
/users/{user_id}:
|
||||
get:
|
||||
|
@ -408,7 +454,9 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_error"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Resource not found"
|
||||
|
||||
/users/{user_id}/photos:
|
||||
post:
|
||||
|
@ -438,15 +486,17 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_success"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
status: "Created"
|
||||
status: "Resource created"
|
||||
'404':
|
||||
description: User not found (or the authorized user is banned).
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_error"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Resource not found"
|
||||
|
||||
/users/{user_id}/photos/{photo_id}:
|
||||
parameters:
|
||||
|
@ -484,7 +534,9 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_error"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Resource not found"
|
||||
delete:
|
||||
tags: ["photos"]
|
||||
summary: Deletes a photo
|
||||
|
@ -500,13 +552,17 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_error"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Unauthorized"
|
||||
'404':
|
||||
description: User or photo not found.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_error"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Resource not found"
|
||||
|
||||
/users/{user_id}/photos/{photo_id}/comments:
|
||||
parameters:
|
||||
|
@ -540,17 +596,21 @@ paths:
|
|||
- user_id: "a1b2c3d4-e5f6-a7b8-c9d0-e1f2a3b4c5d6"
|
||||
name: "Maria"
|
||||
comment: "Nice photo!"
|
||||
comment_id: 1
|
||||
date: "2020-11-20T12:00:00Z"
|
||||
- user_id: "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d"
|
||||
name: "John"
|
||||
comment: "I like it!"
|
||||
comment_id: 2
|
||||
date: "2021-12-20T13:04:00Z"
|
||||
'404':
|
||||
description: The user or the photo does not exist.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_error"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Resource not found"
|
||||
post:
|
||||
tags: ["comments"]
|
||||
summary: Comments a photo
|
||||
|
@ -574,7 +634,9 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
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}:
|
||||
delete:
|
||||
|
@ -611,13 +673,17 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_error"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Unauthorized"
|
||||
'404':
|
||||
description: The comment does not exists.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_error"
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Resource not found"
|
||||
|
||||
/stream: # todo review path
|
||||
get:
|
||||
|
@ -783,12 +849,16 @@ components:
|
|||
$ref: "#/components/schemas/name"
|
||||
comment:
|
||||
$ref: "#/components/schemas/comment"
|
||||
comment_id:
|
||||
$ref: "#/components/schemas/comment_id"
|
||||
date:
|
||||
$ref: "#/components/schemas/upload_time"
|
||||
comment_request:
|
||||
description: The comment to post.
|
||||
type: object
|
||||
properties:
|
||||
user_id:
|
||||
$ref: "#/components/schemas/uid"
|
||||
comment:
|
||||
$ref: "#/components/schemas/comment"
|
||||
comment:
|
||||
|
@ -799,23 +869,14 @@ components:
|
|||
example: "What a lovely picture! 😊"
|
||||
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
|
||||
description: An object representing a success.
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
description: The status of the request.
|
||||
example: "Created"
|
||||
example: "Success"
|
||||
|
||||
requestBodies:
|
||||
userDetails:
|
||||
|
|
Loading…
Reference in a new issue