mirror of
https://github.com/notherealmarco/WASAPhoto.git
synced 2025-03-14 14:16:15 +01:00
Merge branch 'api_dev' into dev
This commit is contained in:
commit
e475a6a339
1 changed files with 98 additions and 30 deletions
128
doc/api.yaml
128
doc/api.yaml
|
@ -73,7 +73,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "Username already taken"
|
status: "Username already taken"
|
||||||
'404':
|
'404':
|
||||||
description: The user does not exist.
|
description: The user does not exist.
|
||||||
content:
|
content:
|
||||||
|
@ -81,7 +81,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "User not found"
|
status: "User not found"
|
||||||
|
|
||||||
/users/{user_id}/followers:
|
/users/{user_id}/followers:
|
||||||
get:
|
get:
|
||||||
|
@ -121,7 +121,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "User not found"
|
status: "User not found"
|
||||||
/users/{user_id}/following:
|
/users/{user_id}/following:
|
||||||
get:
|
get:
|
||||||
tags: ["followers"]
|
tags: ["followers"]
|
||||||
|
@ -161,7 +161,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "User not found"
|
status: "User not found"
|
||||||
|
|
||||||
/users/{user_id}/followers/{follower_uid}:
|
/users/{user_id}/followers/{follower_uid}:
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -200,7 +200,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "Forbidden"
|
status: "Forbidden"
|
||||||
'404':
|
'404':
|
||||||
description: The resource does not exist.
|
description: The resource does not exist.
|
||||||
content:
|
content:
|
||||||
|
@ -208,15 +208,15 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "User not found"
|
status: "Resource not found"
|
||||||
'400':
|
'400': # todo: not sure if this is the right error code
|
||||||
description: Trying to follow a user that does not exist.
|
description: Trying to follow a user that does not exist.
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "User not found"
|
status: "User not found"
|
||||||
delete:
|
delete:
|
||||||
tags: ["followers"]
|
tags: ["followers"]
|
||||||
summary: Unfollows a user
|
summary: Unfollows a user
|
||||||
|
@ -234,7 +234,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "User not found"
|
status: "User not found"
|
||||||
|
|
||||||
/users/{user_id}/bans/{ban_uid}:
|
/users/{user_id}/bans/{ban_uid}:
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -267,7 +267,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "Forbidden"
|
status: "Forbidden"
|
||||||
'404':
|
'404':
|
||||||
description: The user does not exist.
|
description: The user does not exist.
|
||||||
content:
|
content:
|
||||||
|
@ -275,7 +275,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "User not found"
|
status: "User not found"
|
||||||
|
|
||||||
delete:
|
delete:
|
||||||
tags: ["bans"]
|
tags: ["bans"]
|
||||||
|
@ -294,7 +294,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "Forbidden"
|
status: "Forbidden"
|
||||||
'404':
|
'404':
|
||||||
description: The user is not banned by the user.
|
description: The user is not banned by the user.
|
||||||
content:
|
content:
|
||||||
|
@ -302,7 +302,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "User not found"
|
status: "User not found"
|
||||||
|
|
||||||
/users/{user_id}/photos/{photo_id}/likes:
|
/users/{user_id}/photos/{photo_id}/likes:
|
||||||
get:
|
get:
|
||||||
|
@ -361,7 +361,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "Resource not found"
|
status: "Resource not found"
|
||||||
|
|
||||||
/users/{user_id}/photos/{photo_id}/likes/{liker_uid}:
|
/users/{user_id}/photos/{photo_id}/likes/{liker_uid}:
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -400,7 +400,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "Forbidden"
|
status: "Forbidden"
|
||||||
'404':
|
'404':
|
||||||
description: Resource not found (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:
|
||||||
|
@ -408,7 +408,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "Resource not found"
|
status: "Resource not found"
|
||||||
'400':
|
'400':
|
||||||
description: Bad URI (maybe liker_uid is invalid).
|
description: Bad URI (maybe liker_uid is invalid).
|
||||||
content:
|
content:
|
||||||
|
@ -416,7 +416,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "Bad photo_id"
|
status: "Bad photo_id"
|
||||||
delete:
|
delete:
|
||||||
tags: ["likes"]
|
tags: ["likes"]
|
||||||
summary: Unlikes a photo
|
summary: Unlikes a photo
|
||||||
|
@ -434,7 +434,75 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "Resource not found"
|
status: "Resource not found"
|
||||||
|
/users:
|
||||||
|
get:
|
||||||
|
tags: ["search"]
|
||||||
|
summary: Search users by username
|
||||||
|
description: Search users whose username contains the given string.
|
||||||
|
operationId: searchUsers
|
||||||
|
security:
|
||||||
|
- BearerAuth: []
|
||||||
|
parameters:
|
||||||
|
- name: query
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/name"
|
||||||
|
required: true
|
||||||
|
description: The username to search.
|
||||||
|
- name: limit
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/limit"
|
||||||
|
description: The number of elements to show.
|
||||||
|
required: false
|
||||||
|
- name: start_index
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/start_index"
|
||||||
|
description: The starting offset.
|
||||||
|
required: false
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Returns the user list
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
minItems: 0
|
||||||
|
maxItems: 100
|
||||||
|
description: An array of users whose username contains the given string.
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/uid_name"
|
||||||
|
example:
|
||||||
|
- user_id: "123e4567-e89b-12d3-a456-426655440000"
|
||||||
|
username: "Maria"
|
||||||
|
- user_id: "123e4567-e89b-12d3-a456-426655440001"
|
||||||
|
username: "Filippo"
|
||||||
|
'404':
|
||||||
|
description: No user found.
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/generic_response"
|
||||||
|
example:
|
||||||
|
status: "Resource not found"
|
||||||
|
'400':
|
||||||
|
description: Some parameters are malformed.
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/generic_response"
|
||||||
|
example:
|
||||||
|
status: "Invalid start_index or limit value"
|
||||||
|
'401':
|
||||||
|
description: The user is not logged in.
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/generic_response"
|
||||||
|
example:
|
||||||
|
status: "Unauthorized"
|
||||||
|
|
||||||
/users/{user_id}:
|
/users/{user_id}:
|
||||||
get:
|
get:
|
||||||
|
@ -471,7 +539,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "Resource not found"
|
status: "Resource not found"
|
||||||
|
|
||||||
/users/{user_id}/photos:
|
/users/{user_id}/photos:
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -516,15 +584,15 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "Resource not found"
|
status: "Resource not found"
|
||||||
'400':
|
'400':
|
||||||
description: Bad request, there is an error in one of the parameters.
|
description: Some parameters are malformed.
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "Invalid limit or start_index"
|
status: "Invalid start_index or limit value"
|
||||||
|
|
||||||
post:
|
post:
|
||||||
tags: ["photos"]
|
tags: ["photos"]
|
||||||
|
@ -556,7 +624,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "Resource not found"
|
status: "Resource not found"
|
||||||
|
|
||||||
/users/{user_id}/photos/{photo_id}:
|
/users/{user_id}/photos/{photo_id}:
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -596,7 +664,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "Resource not found"
|
status: "Resource not found"
|
||||||
delete:
|
delete:
|
||||||
tags: ["photos"]
|
tags: ["photos"]
|
||||||
summary: Deletes a photo
|
summary: Deletes a photo
|
||||||
|
@ -614,7 +682,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "Unauthorized"
|
status: "Unauthorized"
|
||||||
'404':
|
'404':
|
||||||
description: User or photo not found.
|
description: User or photo not found.
|
||||||
content:
|
content:
|
||||||
|
@ -622,7 +690,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "Resource not found"
|
status: "Resource not found"
|
||||||
|
|
||||||
/users/{user_id}/photos/{photo_id}/comments:
|
/users/{user_id}/photos/{photo_id}/comments:
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -683,7 +751,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "Resource not found"
|
status: "Resource not found"
|
||||||
post:
|
post:
|
||||||
tags: ["comments"]
|
tags: ["comments"]
|
||||||
summary: Comments a photo
|
summary: Comments a photo
|
||||||
|
@ -709,7 +777,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "Resource not found"
|
status: "Resource not found"
|
||||||
|
|
||||||
/users/{user_id}/photos/{photo_id}/comments/{comment_id}:
|
/users/{user_id}/photos/{photo_id}/comments/{comment_id}:
|
||||||
delete:
|
delete:
|
||||||
|
@ -748,7 +816,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "Unauthorized"
|
status: "Unauthorized"
|
||||||
'404':
|
'404':
|
||||||
description: The comment does not exists.
|
description: The comment does not exists.
|
||||||
content:
|
content:
|
||||||
|
@ -756,7 +824,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/generic_response"
|
$ref: "#/components/schemas/generic_response"
|
||||||
example:
|
example:
|
||||||
error: "Resource not found"
|
status: "Resource not found"
|
||||||
|
|
||||||
/stream: # todo review path
|
/stream: # todo review path
|
||||||
get:
|
get:
|
||||||
|
|
Loading…
Reference in a new issue