mirror of
https://github.com/notherealmarco/WASAPhoto.git
synced 2025-03-14 06:06: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:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Username already taken"
|
||||
status: "Username already taken"
|
||||
'404':
|
||||
description: The user does not exist.
|
||||
content:
|
||||
|
@ -81,7 +81,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "User not found"
|
||||
status: "User not found"
|
||||
|
||||
/users/{user_id}/followers:
|
||||
get:
|
||||
|
@ -121,7 +121,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "User not found"
|
||||
status: "User not found"
|
||||
/users/{user_id}/following:
|
||||
get:
|
||||
tags: ["followers"]
|
||||
|
@ -161,7 +161,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "User not found"
|
||||
status: "User not found"
|
||||
|
||||
/users/{user_id}/followers/{follower_uid}:
|
||||
parameters:
|
||||
|
@ -200,7 +200,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Forbidden"
|
||||
status: "Forbidden"
|
||||
'404':
|
||||
description: The resource does not exist.
|
||||
content:
|
||||
|
@ -208,15 +208,15 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "User not found"
|
||||
'400':
|
||||
status: "Resource not found"
|
||||
'400': # todo: not sure if this is the right error code
|
||||
description: Trying to follow a user that does not exist.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "User not found"
|
||||
status: "User not found"
|
||||
delete:
|
||||
tags: ["followers"]
|
||||
summary: Unfollows a user
|
||||
|
@ -234,7 +234,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "User not found"
|
||||
status: "User not found"
|
||||
|
||||
/users/{user_id}/bans/{ban_uid}:
|
||||
parameters:
|
||||
|
@ -267,7 +267,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Forbidden"
|
||||
status: "Forbidden"
|
||||
'404':
|
||||
description: The user does not exist.
|
||||
content:
|
||||
|
@ -275,7 +275,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "User not found"
|
||||
status: "User not found"
|
||||
|
||||
delete:
|
||||
tags: ["bans"]
|
||||
|
@ -294,7 +294,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Forbidden"
|
||||
status: "Forbidden"
|
||||
'404':
|
||||
description: The user is not banned by the user.
|
||||
content:
|
||||
|
@ -302,7 +302,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "User not found"
|
||||
status: "User not found"
|
||||
|
||||
/users/{user_id}/photos/{photo_id}/likes:
|
||||
get:
|
||||
|
@ -361,7 +361,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Resource not found"
|
||||
status: "Resource not found"
|
||||
|
||||
/users/{user_id}/photos/{photo_id}/likes/{liker_uid}:
|
||||
parameters:
|
||||
|
@ -400,7 +400,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Forbidden"
|
||||
status: "Forbidden"
|
||||
'404':
|
||||
description: Resource not found (or the author of the photo has banned the authorized user).
|
||||
content:
|
||||
|
@ -408,7 +408,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Resource not found"
|
||||
status: "Resource not found"
|
||||
'400':
|
||||
description: Bad URI (maybe liker_uid is invalid).
|
||||
content:
|
||||
|
@ -416,7 +416,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Bad photo_id"
|
||||
status: "Bad photo_id"
|
||||
delete:
|
||||
tags: ["likes"]
|
||||
summary: Unlikes a photo
|
||||
|
@ -434,7 +434,75 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
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}:
|
||||
get:
|
||||
|
@ -471,7 +539,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Resource not found"
|
||||
status: "Resource not found"
|
||||
|
||||
/users/{user_id}/photos:
|
||||
parameters:
|
||||
|
@ -516,15 +584,15 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Resource not found"
|
||||
status: "Resource not found"
|
||||
'400':
|
||||
description: Bad request, there is an error in one of the parameters.
|
||||
description: Some parameters are malformed.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Invalid limit or start_index"
|
||||
status: "Invalid start_index or limit value"
|
||||
|
||||
post:
|
||||
tags: ["photos"]
|
||||
|
@ -556,7 +624,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Resource not found"
|
||||
status: "Resource not found"
|
||||
|
||||
/users/{user_id}/photos/{photo_id}:
|
||||
parameters:
|
||||
|
@ -596,7 +664,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Resource not found"
|
||||
status: "Resource not found"
|
||||
delete:
|
||||
tags: ["photos"]
|
||||
summary: Deletes a photo
|
||||
|
@ -614,7 +682,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Unauthorized"
|
||||
status: "Unauthorized"
|
||||
'404':
|
||||
description: User or photo not found.
|
||||
content:
|
||||
|
@ -622,7 +690,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Resource not found"
|
||||
status: "Resource not found"
|
||||
|
||||
/users/{user_id}/photos/{photo_id}/comments:
|
||||
parameters:
|
||||
|
@ -683,7 +751,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Resource not found"
|
||||
status: "Resource not found"
|
||||
post:
|
||||
tags: ["comments"]
|
||||
summary: Comments a photo
|
||||
|
@ -709,7 +777,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Resource not found"
|
||||
status: "Resource not found"
|
||||
|
||||
/users/{user_id}/photos/{photo_id}/comments/{comment_id}:
|
||||
delete:
|
||||
|
@ -748,7 +816,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Unauthorized"
|
||||
status: "Unauthorized"
|
||||
'404':
|
||||
description: The comment does not exists.
|
||||
content:
|
||||
|
@ -756,7 +824,7 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/generic_response"
|
||||
example:
|
||||
error: "Resource not found"
|
||||
status: "Resource not found"
|
||||
|
||||
/stream: # todo review path
|
||||
get:
|
||||
|
|
Loading…
Reference in a new issue