2023-01-25 11:06:33 +01:00
|
|
|
openapi: 3.0.2
|
2022-11-04 12:41:07 +01:00
|
|
|
info:
|
2022-11-08 15:00:53 +01:00
|
|
|
title: WASAPhoto API
|
2022-11-04 12:41:07 +01:00
|
|
|
description: |-
|
2022-11-08 15:00:53 +01:00
|
|
|
Keep in touch with your friends by sharing photos of special moments, thanks to WASAPhoto! You can
|
|
|
|
upload your photos directly from your PC, and they will be visible to everyone following you.
|
2022-11-22 17:13:31 +01:00
|
|
|
version: "3.0"
|
2022-11-19 14:54:36 +01:00
|
|
|
tags:
|
2022-11-26 15:17:52 +01:00
|
|
|
- name: login
|
2022-11-19 14:54:36 +01:00
|
|
|
description: Login API
|
|
|
|
- name: username
|
|
|
|
description: Operations related to username
|
|
|
|
- name: followers
|
|
|
|
description: Operations related to followers
|
|
|
|
- name: likes
|
|
|
|
description: Operations related to likes
|
|
|
|
- name: bans
|
|
|
|
description: Operations related to bans
|
|
|
|
- name: profile
|
|
|
|
description: Operations related to user profiles
|
|
|
|
- name: photos
|
|
|
|
description: Operations related to photos
|
|
|
|
- name: comments
|
|
|
|
description: Operations related to comments
|
|
|
|
- name: stream
|
|
|
|
description: Operations related to the user stream
|
2022-11-04 12:41:07 +01:00
|
|
|
paths:
|
|
|
|
/session:
|
|
|
|
post:
|
|
|
|
tags: ["login"]
|
|
|
|
summary: Logs in the user
|
|
|
|
description: |-
|
|
|
|
If the user does not exist, it will be created,
|
|
|
|
and an identifier is returned.
|
|
|
|
If the user exists, the user identifier is returned.
|
|
|
|
operationId: doLogin
|
|
|
|
requestBody:
|
|
|
|
$ref: "#/components/requestBodies/userDetails"
|
|
|
|
responses:
|
2022-11-24 15:29:46 +01:00
|
|
|
'201':
|
2022-11-15 23:23:33 +01:00
|
|
|
description: User log-in action successful.
|
2022-11-04 12:41:07 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-19 14:54:36 +01:00
|
|
|
$ref: "#/components/schemas/uid_object"
|
|
|
|
example:
|
|
|
|
user_id: "123e4567-e89b-12d3-a456-426655440000"
|
2022-12-10 02:05:39 +01:00
|
|
|
|
2022-11-15 23:23:33 +01:00
|
|
|
/users/{user_id}/username:
|
2022-11-08 14:53:34 +01:00
|
|
|
put:
|
2022-11-15 23:23:33 +01:00
|
|
|
tags: ["username"]
|
2022-11-08 14:53:34 +01:00
|
|
|
summary: Updates the username
|
2022-11-15 23:23:33 +01:00
|
|
|
description: Changes the username of the user with the given one.
|
2022-11-25 16:12:53 +01:00
|
|
|
operationId: setMyUserName
|
2022-11-15 23:31:33 +01:00
|
|
|
parameters:
|
|
|
|
- name: user_id
|
|
|
|
in: path
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/uid"
|
|
|
|
required: true
|
|
|
|
description: The user ID of the user to change the username to.
|
2022-11-04 12:41:07 +01:00
|
|
|
security:
|
|
|
|
- BearerAuth: []
|
2022-11-08 22:47:33 +01:00
|
|
|
requestBody:
|
|
|
|
$ref: "#/components/requestBodies/userDetails"
|
2022-11-04 12:41:07 +01:00
|
|
|
responses:
|
2022-11-18 17:22:28 +01:00
|
|
|
'204':
|
2022-11-15 23:23:33 +01:00
|
|
|
description: Update username action successful.
|
2022-11-08 14:53:34 +01:00
|
|
|
'409':
|
2022-11-19 14:54:36 +01:00
|
|
|
description: The chosen username is already taken by another users.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:00 +01:00
|
|
|
status: "Username already taken"
|
2022-11-15 23:50:56 +01:00
|
|
|
'404':
|
|
|
|
description: The user does not exist.
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "User not found"
|
2022-11-04 12:41:07 +01:00
|
|
|
|
2022-11-17 16:51:57 +01:00
|
|
|
/users/{user_id}/followers:
|
|
|
|
get:
|
|
|
|
tags: ["followers"]
|
|
|
|
summary: Gets user's followers
|
|
|
|
description: Get the followers list of the user
|
|
|
|
operationId: getUserFollowers
|
|
|
|
security:
|
|
|
|
- BearerAuth: []
|
|
|
|
parameters:
|
|
|
|
- name: user_id
|
|
|
|
in: path
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/uid"
|
|
|
|
required: true
|
|
|
|
description: The user ID of the user to follow.
|
|
|
|
responses:
|
|
|
|
'200':
|
|
|
|
description: Returns the user list
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
type: array
|
2022-11-19 14:54:36 +01:00
|
|
|
description: The list of followers.
|
|
|
|
minItems: 0
|
2022-11-24 15:25:25 +01:00
|
|
|
maxItems: 100
|
2022-11-17 16:51:57 +01:00
|
|
|
items:
|
|
|
|
$ref: "#/components/schemas/uid_name"
|
2022-11-19 14:54:36 +01:00
|
|
|
example:
|
|
|
|
- user_id: "123e4567-e89b-12d3-a456-426655440000"
|
2022-12-09 03:53:16 +01:00
|
|
|
name: "Maria"
|
2022-11-19 14:54:36 +01:00
|
|
|
- user_id: "123e4567-e89b-12d3-a456-426655440001"
|
2022-12-09 03:53:16 +01:00
|
|
|
name: "Filippo"
|
2022-11-17 16:51:57 +01:00
|
|
|
'404':
|
|
|
|
description: The user does not exist.
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "User not found"
|
2022-11-17 16:51:57 +01:00
|
|
|
/users/{user_id}/following:
|
|
|
|
get:
|
|
|
|
tags: ["followers"]
|
|
|
|
summary: Gets following users
|
|
|
|
description: Get the users that a user is following
|
|
|
|
operationId: getUserFollowing
|
|
|
|
security:
|
|
|
|
- BearerAuth: []
|
|
|
|
parameters:
|
|
|
|
- name: user_id
|
|
|
|
in: path
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/uid"
|
|
|
|
required: true
|
|
|
|
description: The user ID of the user to follow.
|
|
|
|
responses:
|
|
|
|
'200':
|
|
|
|
description: Returns the user list
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
type: array
|
2022-11-19 14:54:36 +01:00
|
|
|
minItems: 0
|
2022-11-22 16:52:50 +01:00
|
|
|
maxItems: 100
|
2022-11-19 14:54:36 +01:00
|
|
|
description: The list of users that the user is following.
|
2022-11-17 16:51:57 +01:00
|
|
|
items:
|
|
|
|
$ref: "#/components/schemas/uid_name"
|
2022-11-19 14:54:36 +01:00
|
|
|
example:
|
|
|
|
- user_id: "123e4567-e89b-12d3-a456-426655440000"
|
2022-12-09 03:53:16 +01:00
|
|
|
name: "Maria"
|
2022-11-19 14:54:36 +01:00
|
|
|
- user_id: "123e4567-e89b-12d3-a456-426655440001"
|
2022-12-09 03:53:16 +01:00
|
|
|
name: "Filippo"
|
2022-11-17 16:51:57 +01:00
|
|
|
'404':
|
|
|
|
description: The user does not exist.
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "User not found"
|
2022-11-17 16:51:57 +01:00
|
|
|
|
2022-11-15 23:23:33 +01:00
|
|
|
/users/{user_id}/followers/{follower_uid}:
|
2022-11-19 14:54:36 +01:00
|
|
|
parameters:
|
|
|
|
- name: user_id
|
|
|
|
in: path
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/uid"
|
|
|
|
required: true
|
|
|
|
description: The ID of the user to follow.
|
|
|
|
- name: follower_uid
|
|
|
|
in: path
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/uid"
|
|
|
|
required: true
|
|
|
|
description: The follower's user ID.
|
2022-11-15 23:23:33 +01:00
|
|
|
put:
|
2022-11-08 14:53:34 +01:00
|
|
|
tags: ["followers"]
|
|
|
|
summary: Follows a user
|
2022-11-04 12:41:07 +01:00
|
|
|
description: Starts following a user
|
|
|
|
operationId: followUser
|
|
|
|
security:
|
|
|
|
- BearerAuth: []
|
|
|
|
responses:
|
2022-11-21 09:43:09 +01:00
|
|
|
'201':
|
2022-11-15 23:23:33 +01:00
|
|
|
description: Follow user action successful.
|
2022-11-21 09:43:09 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-22 09:13:10 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
2022-11-21 09:43:09 +01:00
|
|
|
example:
|
|
|
|
status: "Success"
|
2022-11-15 23:23:33 +01:00
|
|
|
'403':
|
|
|
|
description: The user has no permission perform this action.
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Forbidden"
|
2022-11-15 23:50:56 +01:00
|
|
|
'404':
|
2022-11-20 20:16:06 +01:00
|
|
|
description: The resource does not exist.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:13:46 +01:00
|
|
|
status: "Resource not found"
|
2023-01-10 01:21:53 +01:00
|
|
|
'400':
|
2022-11-20 20:16:06 +01:00
|
|
|
description: Trying to follow a user that does not exist.
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "User not found"
|
2022-11-08 14:53:34 +01:00
|
|
|
delete:
|
|
|
|
tags: ["followers"]
|
|
|
|
summary: Unfollows a user
|
2022-11-04 12:41:07 +01:00
|
|
|
description: Stops following a user
|
|
|
|
operationId: unfollowUser
|
|
|
|
security:
|
|
|
|
- BearerAuth: []
|
|
|
|
responses:
|
2022-11-18 17:22:28 +01:00
|
|
|
'204':
|
2022-11-15 23:23:33 +01:00
|
|
|
description: Unfollow user action successful.
|
|
|
|
'404':
|
2022-11-15 23:50:56 +01:00
|
|
|
description: The user is not followed by follower_uid, or the user does not exist.
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "User not found"
|
2022-11-08 14:53:34 +01:00
|
|
|
|
2022-11-15 23:23:33 +01:00
|
|
|
/users/{user_id}/bans/{ban_uid}:
|
2022-11-19 14:54:36 +01:00
|
|
|
parameters:
|
|
|
|
- name: user_id
|
|
|
|
in: path
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/uid"
|
|
|
|
required: true
|
|
|
|
description: The user ID of the banning user.
|
|
|
|
- name: ban_uid
|
|
|
|
in: path
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/uid"
|
|
|
|
required: true
|
|
|
|
description: The user ID of the banned user.
|
2022-11-15 23:23:33 +01:00
|
|
|
put:
|
2022-11-08 14:53:34 +01:00
|
|
|
tags: ["bans"]
|
|
|
|
summary: Bans a user
|
2022-11-15 23:23:33 +01:00
|
|
|
description: Add a user to the list of banned users of the user.
|
2022-11-04 12:41:07 +01:00
|
|
|
operationId: banUser
|
|
|
|
security:
|
|
|
|
- BearerAuth: []
|
|
|
|
responses:
|
2022-11-23 11:19:38 +01:00
|
|
|
'201':
|
2022-11-15 23:23:33 +01:00
|
|
|
description: Ban user action successful.
|
2022-11-23 11:19:38 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
|
|
|
status: "Success"
|
|
|
|
'204':
|
|
|
|
description: The user is already banned.
|
2022-11-15 23:23:33 +01:00
|
|
|
'403':
|
|
|
|
description: The user has no permission to perform this action.
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Forbidden"
|
2022-11-15 23:50:56 +01:00
|
|
|
'404':
|
|
|
|
description: The user does not exist.
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "User not found"
|
2022-11-15 23:23:33 +01:00
|
|
|
|
2022-11-08 14:53:34 +01:00
|
|
|
delete:
|
|
|
|
tags: ["bans"]
|
|
|
|
summary: Unbans a user
|
2022-11-15 23:23:33 +01:00
|
|
|
description: Removes a ban from the list of banned users of the user.
|
2022-11-04 12:41:07 +01:00
|
|
|
operationId: unbanUser
|
|
|
|
security:
|
|
|
|
- BearerAuth: []
|
|
|
|
responses:
|
2022-11-18 17:22:28 +01:00
|
|
|
'204':
|
2022-11-15 23:23:33 +01:00
|
|
|
description: Unban user action successful.
|
|
|
|
'403':
|
|
|
|
description: The user has no permission to perform this action.
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Forbidden"
|
2022-11-15 23:23:33 +01:00
|
|
|
'404':
|
|
|
|
description: The user is not banned by the user.
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "User not found"
|
2022-11-04 12:41:07 +01:00
|
|
|
|
2022-11-17 16:51:57 +01:00
|
|
|
/users/{user_id}/photos/{photo_id}/likes:
|
|
|
|
get:
|
|
|
|
tags: ["likes"]
|
|
|
|
summary: Gets photo likes
|
|
|
|
description: Get the list of users liking a photo
|
|
|
|
operationId: getPhotoLikes
|
|
|
|
security:
|
|
|
|
- BearerAuth: []
|
|
|
|
parameters:
|
|
|
|
- name: user_id
|
|
|
|
in: path
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/uid"
|
|
|
|
required: true
|
|
|
|
description: The ID of the author of the photo.
|
|
|
|
- name: photo_id
|
|
|
|
in: path
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/photo_id"
|
|
|
|
required: true
|
|
|
|
description: The ID of the photo.
|
2022-11-22 16:06:31 +01:00
|
|
|
- name: limit
|
|
|
|
in: query
|
|
|
|
schema:
|
2022-11-22 16:51:16 +01:00
|
|
|
$ref: "#/components/schemas/limit"
|
2022-11-22 16:06:31 +01:00
|
|
|
description: The number of elements to show.
|
|
|
|
required: false
|
|
|
|
- name: start_index
|
|
|
|
in: query
|
|
|
|
schema:
|
2022-11-22 16:51:16 +01:00
|
|
|
$ref: "#/components/schemas/start_index"
|
2022-11-22 16:06:31 +01:00
|
|
|
description: The starting offset.
|
|
|
|
required: false
|
2022-11-17 16:51:57 +01:00
|
|
|
responses:
|
|
|
|
'200':
|
|
|
|
description: Returns the user list
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
type: array
|
2022-11-19 14:54:36 +01:00
|
|
|
minItems: 0
|
2022-11-22 16:52:50 +01:00
|
|
|
maxItems: 100
|
2022-11-17 16:51:57 +01:00
|
|
|
description: An array of users liking the photo.
|
|
|
|
items:
|
|
|
|
$ref: "#/components/schemas/uid_name"
|
2022-11-19 14:54:36 +01:00
|
|
|
example:
|
|
|
|
- user_id: "123e4567-e89b-12d3-a456-426655440000"
|
2022-12-09 03:53:16 +01:00
|
|
|
name: "Maria"
|
2022-11-19 14:54:36 +01:00
|
|
|
- user_id: "123e4567-e89b-12d3-a456-426655440001"
|
2022-12-09 03:53:16 +01:00
|
|
|
name: "Filippo"
|
2022-11-17 16:51:57 +01:00
|
|
|
'404':
|
|
|
|
description: The user or the photo does not exist.
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Resource not found"
|
2022-11-17 16:51:57 +01:00
|
|
|
|
2022-11-15 23:23:33 +01:00
|
|
|
/users/{user_id}/photos/{photo_id}/likes/{liker_uid}:
|
2022-11-19 14:54:36 +01:00
|
|
|
parameters:
|
|
|
|
- name: user_id
|
|
|
|
in: path
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/uid"
|
|
|
|
required: true
|
|
|
|
description: The ID of the author of the photo.
|
|
|
|
- name: liker_uid
|
|
|
|
in: path
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/uid"
|
|
|
|
required: true
|
|
|
|
description: The ID of the user who likes the photo.
|
|
|
|
- name: photo_id
|
|
|
|
in: path
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/photo_id"
|
|
|
|
required: true
|
|
|
|
description: The ID of the photo.
|
2022-11-15 23:23:33 +01:00
|
|
|
put:
|
|
|
|
tags: ["likes"]
|
|
|
|
summary: likes a Photo
|
|
|
|
description: Adds a like to a photo.
|
2022-11-04 18:28:03 +01:00
|
|
|
operationId: likePhoto
|
|
|
|
security:
|
|
|
|
- BearerAuth: []
|
|
|
|
responses:
|
2022-11-23 11:19:38 +01:00
|
|
|
'201':
|
2022-11-15 23:23:33 +01:00
|
|
|
description: Like photo action successful.
|
2022-11-23 11:19:38 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
|
|
|
status: "Success"
|
|
|
|
'204':
|
|
|
|
description: The user already likes the photo.
|
2022-11-15 23:23:33 +01:00
|
|
|
'403':
|
|
|
|
description: The user has no permission to perform this action.
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Forbidden"
|
2022-11-04 18:28:03 +01:00
|
|
|
'404':
|
2022-11-20 20:16:06 +01:00
|
|
|
description: Resource not found (or the author of the photo has banned the authorized user).
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Resource not found"
|
2022-11-20 20:16:06 +01:00
|
|
|
'400':
|
|
|
|
description: Bad URI (maybe liker_uid is invalid).
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Bad photo_id"
|
2022-11-08 14:53:34 +01:00
|
|
|
delete:
|
2022-11-15 23:23:33 +01:00
|
|
|
tags: ["likes"]
|
|
|
|
summary: Unlikes a photo
|
|
|
|
description: Removes a like from a photo
|
2022-11-04 18:28:03 +01:00
|
|
|
operationId: unlikePhoto
|
|
|
|
security:
|
|
|
|
- BearerAuth: []
|
|
|
|
responses:
|
2022-11-18 17:22:28 +01:00
|
|
|
'204':
|
2022-11-15 23:23:33 +01:00
|
|
|
description: Unlike photo action successful.
|
2022-11-04 18:28:03 +01:00
|
|
|
'404':
|
2022-11-15 23:50:56 +01:00
|
|
|
description: The user or photo does not exists, or the user is not liking the photo.
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Resource not found"
|
2022-11-22 22:11:00 +01:00
|
|
|
/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:
|
2022-12-10 01:05:44 +01:00
|
|
|
$ref: "#/components/schemas/search_result"
|
2022-11-22 22:11:00 +01:00
|
|
|
example:
|
|
|
|
- user_id: "123e4567-e89b-12d3-a456-426655440000"
|
2022-12-09 03:53:16 +01:00
|
|
|
name: "Maria"
|
2022-12-10 01:05:44 +01:00
|
|
|
followed: false
|
|
|
|
banned: false
|
2022-11-22 22:11:00 +01:00
|
|
|
- user_id: "123e4567-e89b-12d3-a456-426655440001"
|
2022-12-09 03:53:16 +01:00
|
|
|
name: "Filippo"
|
2022-12-10 01:05:44 +01:00
|
|
|
followed: true
|
|
|
|
banned: false
|
2022-11-22 22:11:00 +01:00
|
|
|
'404':
|
|
|
|
description: No user found.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Resource not found"
|
2022-11-22 22:11:00 +01:00
|
|
|
'400':
|
|
|
|
description: Some parameters are malformed.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Invalid start_index or limit value"
|
2022-11-22 22:11:00 +01:00
|
|
|
'401':
|
|
|
|
description: The user is not logged in.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Unauthorized"
|
2022-11-04 18:28:03 +01:00
|
|
|
|
2022-11-15 23:23:33 +01:00
|
|
|
/users/{user_id}:
|
2022-11-04 18:28:03 +01:00
|
|
|
get:
|
2022-11-08 14:53:34 +01:00
|
|
|
tags: ["profile"]
|
2022-11-08 15:10:12 +01:00
|
|
|
summary: Returns user profile
|
2022-11-15 23:23:33 +01:00
|
|
|
description: Returns the profile of a user, including user's photos, followers, and following users.
|
2022-11-04 18:28:03 +01:00
|
|
|
operationId: getUserProfile
|
2022-11-15 23:23:33 +01:00
|
|
|
security:
|
|
|
|
- BearerAuth: []
|
2022-11-04 18:28:03 +01:00
|
|
|
parameters:
|
2022-11-15 23:23:33 +01:00
|
|
|
- name: user_id
|
2022-11-04 18:28:03 +01:00
|
|
|
in: path
|
|
|
|
schema:
|
2022-11-15 23:23:33 +01:00
|
|
|
$ref: "#/components/schemas/uid"
|
|
|
|
description: The user ID of the user to get the profile of.
|
2022-11-04 18:28:03 +01:00
|
|
|
required: true
|
|
|
|
responses:
|
|
|
|
'200':
|
2022-11-15 23:23:33 +01:00
|
|
|
description: Returns the profile details of the given user.
|
2022-11-04 18:28:03 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-19 14:54:36 +01:00
|
|
|
$ref: "#/components/schemas/user_profile"
|
|
|
|
example:
|
2022-12-09 03:53:16 +01:00
|
|
|
name: "Maria"
|
2022-11-19 14:54:36 +01:00
|
|
|
followers: 25
|
|
|
|
following: 32
|
2022-11-22 17:45:18 +01:00
|
|
|
followed: true
|
2022-11-22 17:07:28 +01:00
|
|
|
photos: 50
|
2022-11-04 18:28:03 +01:00
|
|
|
'404':
|
2022-11-15 23:23:33 +01:00
|
|
|
description: User not found (or the authorized user is banned).
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Resource not found"
|
2022-11-15 23:50:56 +01:00
|
|
|
|
2022-11-15 23:23:33 +01:00
|
|
|
/users/{user_id}/photos:
|
2022-11-22 16:18:19 +01:00
|
|
|
parameters:
|
|
|
|
- name: user_id
|
|
|
|
in: path
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/uid"
|
|
|
|
required: true
|
|
|
|
description: The user ID of the user who uploads the photo.
|
|
|
|
|
|
|
|
get:
|
|
|
|
tags: ["photos"]
|
|
|
|
summary: Returns user photos
|
|
|
|
description: Returns the list of photos uploaded by a user.
|
|
|
|
operationId: getUserPhotos
|
|
|
|
security:
|
|
|
|
- BearerAuth: []
|
|
|
|
parameters:
|
|
|
|
- name: limit
|
|
|
|
in: query
|
|
|
|
schema:
|
2022-11-22 16:51:16 +01:00
|
|
|
$ref: "#/components/schemas/limit"
|
2022-11-22 16:18:19 +01:00
|
|
|
description: The number of elements to show.
|
|
|
|
required: false
|
|
|
|
- name: start_index
|
|
|
|
in: query
|
|
|
|
schema:
|
2022-11-22 16:51:16 +01:00
|
|
|
$ref: "#/components/schemas/start_index"
|
2022-11-22 16:18:19 +01:00
|
|
|
description: The starting offset.
|
|
|
|
required: false
|
|
|
|
responses:
|
|
|
|
'200':
|
|
|
|
description: Returns the user photos list
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/user_photo_stream"
|
|
|
|
'404':
|
|
|
|
description: User not found (or the authorized user is banned).
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Resource not found"
|
2022-11-22 16:18:19 +01:00
|
|
|
'400':
|
2022-11-22 22:13:46 +01:00
|
|
|
description: Some parameters are malformed.
|
2022-11-22 16:18:19 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:13:46 +01:00
|
|
|
status: "Invalid start_index or limit value"
|
2022-11-22 16:18:19 +01:00
|
|
|
|
2022-11-04 18:28:03 +01:00
|
|
|
post:
|
2022-11-08 14:53:34 +01:00
|
|
|
tags: ["photos"]
|
2022-11-04 18:28:03 +01:00
|
|
|
summary: Uploads a photo
|
2022-11-15 23:23:33 +01:00
|
|
|
description: Uploads a photo in the gallery of the authorized user.
|
2022-11-04 18:28:03 +01:00
|
|
|
operationId: uploadPhoto
|
|
|
|
security:
|
|
|
|
- BearerAuth: []
|
|
|
|
requestBody:
|
|
|
|
content:
|
2022-12-10 02:04:41 +01:00
|
|
|
image/jpg:
|
2022-11-04 18:28:03 +01:00
|
|
|
schema:
|
2022-12-10 02:04:41 +01:00
|
|
|
$ref: "#/components/schemas/image_jpg"
|
2022-11-04 18:28:03 +01:00
|
|
|
responses:
|
|
|
|
'201':
|
2022-11-15 23:23:33 +01:00
|
|
|
description: Upload photo action successful.
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
2022-11-19 14:54:36 +01:00
|
|
|
example:
|
2022-11-20 20:16:06 +01:00
|
|
|
status: "Resource created"
|
2022-11-15 23:50:56 +01:00
|
|
|
'404':
|
|
|
|
description: User not found (or the authorized user is banned).
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Resource not found"
|
2022-11-04 18:28:03 +01:00
|
|
|
|
2022-11-15 23:23:33 +01:00
|
|
|
/users/{user_id}/photos/{photo_id}:
|
2022-11-19 14:54:36 +01:00
|
|
|
parameters:
|
|
|
|
- name: user_id
|
|
|
|
in: path
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/uid"
|
|
|
|
description: The ID of the author of the photo.
|
|
|
|
required: true
|
|
|
|
- name: photo_id
|
|
|
|
in: path
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/photo_id"
|
|
|
|
description: The ID of the photo.
|
|
|
|
required: true
|
2022-11-04 18:28:03 +01:00
|
|
|
get:
|
2022-11-08 14:53:34 +01:00
|
|
|
tags: ["photos"]
|
2022-11-15 23:23:33 +01:00
|
|
|
summary: Downloads a photo
|
|
|
|
description: Returns the requested photo in binary format.
|
2022-11-04 18:28:03 +01:00
|
|
|
operationId: getUserPhoto
|
2022-11-15 23:23:33 +01:00
|
|
|
security:
|
|
|
|
- BearerAuth: []
|
2022-11-04 18:28:03 +01:00
|
|
|
responses:
|
|
|
|
'200':
|
2022-11-15 23:23:33 +01:00
|
|
|
description: The requested photo in binary format.
|
2022-11-04 18:28:03 +01:00
|
|
|
content:
|
2022-12-10 02:04:41 +01:00
|
|
|
image/jpg:
|
2022-11-04 18:28:03 +01:00
|
|
|
schema:
|
2022-12-10 02:04:41 +01:00
|
|
|
$ref: "#/components/schemas/image_jpg"
|
|
|
|
|
2022-11-04 18:28:03 +01:00
|
|
|
'404':
|
2022-11-15 23:50:56 +01:00
|
|
|
description: User or photo not found (or the authorized user is banned by the author of the photo).
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Resource not found"
|
2022-11-04 18:28:03 +01:00
|
|
|
delete:
|
2022-11-08 14:53:34 +01:00
|
|
|
tags: ["photos"]
|
2022-11-04 18:28:03 +01:00
|
|
|
summary: Deletes a photo
|
2022-11-15 23:23:33 +01:00
|
|
|
description: Deletes a photo in the gallery of the authorized user.
|
2022-11-04 18:28:03 +01:00
|
|
|
operationId: deletePhoto
|
|
|
|
security:
|
|
|
|
- BearerAuth: []
|
|
|
|
responses:
|
2022-11-18 17:22:28 +01:00
|
|
|
'204':
|
2022-11-15 23:23:33 +01:00
|
|
|
description: Delete photo action successful.
|
2022-11-04 18:28:03 +01:00
|
|
|
'401':
|
2022-11-15 23:23:33 +01:00
|
|
|
description: The user has no permission to delete that photo.
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Unauthorized"
|
2022-11-15 23:50:56 +01:00
|
|
|
'404':
|
|
|
|
description: User or photo not found.
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Resource not found"
|
2022-11-04 18:28:03 +01:00
|
|
|
|
2022-11-15 23:23:33 +01:00
|
|
|
/users/{user_id}/photos/{photo_id}/comments:
|
2022-11-19 14:54:36 +01:00
|
|
|
parameters:
|
|
|
|
- name: user_id
|
|
|
|
in: path
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/uid"
|
|
|
|
required: true
|
|
|
|
description: The ID of the author of the photo.
|
|
|
|
- name: photo_id
|
|
|
|
in: path
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/photo_id"
|
|
|
|
required: true
|
|
|
|
description: The ID of the photo.
|
2022-11-17 16:51:57 +01:00
|
|
|
get:
|
|
|
|
tags: ["comments"]
|
|
|
|
summary: Gets photo comments
|
|
|
|
description: Gets the list of comments of a photo
|
|
|
|
operationId: getPhotoComments
|
2022-11-22 16:06:31 +01:00
|
|
|
parameters:
|
|
|
|
- name: limit
|
|
|
|
in: query
|
|
|
|
schema:
|
2022-11-22 16:51:16 +01:00
|
|
|
$ref: "#/components/schemas/limit"
|
2022-11-22 16:06:31 +01:00
|
|
|
description: The number of elements to show.
|
|
|
|
required: false
|
|
|
|
- name: start_index
|
|
|
|
in: query
|
|
|
|
schema:
|
2022-11-22 16:51:16 +01:00
|
|
|
$ref: "#/components/schemas/start_index"
|
2022-11-22 16:06:31 +01:00
|
|
|
description: The starting offset.
|
|
|
|
required: false
|
2022-11-17 16:51:57 +01:00
|
|
|
security:
|
|
|
|
- BearerAuth: []
|
|
|
|
responses:
|
|
|
|
'200':
|
|
|
|
description: Returns the comments list
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-19 14:54:36 +01:00
|
|
|
$ref: "#/components/schemas/comments"
|
|
|
|
example:
|
|
|
|
- user_id: "a1b2c3d4-e5f6-a7b8-c9d0-e1f2a3b4c5d6"
|
|
|
|
name: "Maria"
|
|
|
|
comment: "Nice photo!"
|
2022-11-20 20:16:06 +01:00
|
|
|
comment_id: 1
|
2022-11-19 14:54:36 +01:00
|
|
|
date: "2020-11-20T12:00:00Z"
|
|
|
|
- user_id: "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d"
|
|
|
|
name: "John"
|
|
|
|
comment: "I like it!"
|
2022-11-20 20:16:06 +01:00
|
|
|
comment_id: 2
|
2022-11-19 14:54:36 +01:00
|
|
|
date: "2021-12-20T13:04:00Z"
|
2022-11-17 16:51:57 +01:00
|
|
|
'404':
|
|
|
|
description: The user or the photo does not exist.
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Resource not found"
|
2022-11-04 18:28:03 +01:00
|
|
|
post:
|
|
|
|
tags: ["comments"]
|
2022-11-15 23:23:33 +01:00
|
|
|
summary: Comments a photo
|
|
|
|
description: Adds a comment to a photo.
|
2022-11-04 18:28:03 +01:00
|
|
|
operationId: commentPhoto
|
|
|
|
security:
|
|
|
|
- BearerAuth: []
|
|
|
|
requestBody:
|
2022-11-15 23:23:33 +01:00
|
|
|
description: The comment to post.
|
2022-11-04 18:28:03 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-19 14:54:36 +01:00
|
|
|
$ref: "#/components/schemas/comment_request"
|
|
|
|
example:
|
|
|
|
comment: "Lovely!"
|
2022-11-04 18:28:03 +01:00
|
|
|
responses:
|
2022-11-23 11:19:38 +01:00
|
|
|
'201':
|
|
|
|
description: Comment photo action successful.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
|
|
|
status: "Created"
|
2022-11-04 18:28:03 +01:00
|
|
|
'404':
|
2022-11-15 23:50:56 +01:00
|
|
|
description: The user or the photo does not exists (or the author of the photo has banned the authorized user).
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Resource not found"
|
2022-11-04 18:28:03 +01:00
|
|
|
|
2022-11-15 23:23:33 +01:00
|
|
|
/users/{user_id}/photos/{photo_id}/comments/{comment_id}:
|
2022-11-04 18:28:03 +01:00
|
|
|
delete:
|
|
|
|
tags: ["comments"]
|
|
|
|
summary: Deletes a comment
|
2022-11-15 23:23:33 +01:00
|
|
|
description: Deletes a photo in the gallery of the authorized user.
|
2022-11-24 14:53:30 +01:00
|
|
|
operationId: uncommentPhoto
|
2022-11-04 18:28:03 +01:00
|
|
|
security:
|
|
|
|
- BearerAuth: []
|
|
|
|
parameters:
|
2022-11-15 23:23:33 +01:00
|
|
|
- name: user_id
|
2022-11-04 18:28:03 +01:00
|
|
|
in: path
|
2022-11-19 14:54:36 +01:00
|
|
|
description: The ID of the author of the photo.
|
2022-11-04 18:28:03 +01:00
|
|
|
schema:
|
2022-11-15 23:23:33 +01:00
|
|
|
$ref: "#/components/schemas/uid"
|
2022-11-04 18:28:03 +01:00
|
|
|
required: true
|
2022-11-15 23:23:33 +01:00
|
|
|
- name: photo_id
|
2022-11-19 14:54:36 +01:00
|
|
|
description: The ID of the photo.
|
2022-11-04 18:28:03 +01:00
|
|
|
in: path
|
|
|
|
schema:
|
2022-11-15 23:23:33 +01:00
|
|
|
$ref: "#/components/schemas/photo_id"
|
2022-11-04 18:28:03 +01:00
|
|
|
required: true
|
2022-11-15 23:23:33 +01:00
|
|
|
- name: comment_id
|
2022-11-19 14:54:36 +01:00
|
|
|
description: The ID of the comment to delete.
|
2022-11-04 18:28:03 +01:00
|
|
|
in: path
|
|
|
|
schema:
|
2022-11-15 23:23:33 +01:00
|
|
|
$ref: "#/components/schemas/comment_id"
|
2022-11-04 18:28:03 +01:00
|
|
|
required: true
|
|
|
|
responses:
|
2022-11-18 17:22:28 +01:00
|
|
|
'204':
|
2022-11-15 23:23:33 +01:00
|
|
|
description: Delete comment action successful.
|
|
|
|
'401':
|
|
|
|
description: The user has no permission to delete that comment.
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Unauthorized"
|
2022-11-15 23:23:33 +01:00
|
|
|
'404':
|
|
|
|
description: The comment does not exists.
|
2022-11-19 14:54:36 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-20 20:16:06 +01:00
|
|
|
$ref: "#/components/schemas/generic_response"
|
|
|
|
example:
|
2022-11-22 22:11:24 +01:00
|
|
|
status: "Resource not found"
|
2022-11-15 23:23:33 +01:00
|
|
|
|
2022-12-06 22:52:50 +01:00
|
|
|
/stream:
|
2022-11-04 18:28:03 +01:00
|
|
|
get:
|
|
|
|
tags: ["stream"]
|
2022-11-08 15:10:12 +01:00
|
|
|
summary: Returns user stream
|
2022-11-15 23:23:33 +01:00
|
|
|
description: Returns the photo stream of the authorized user.
|
2022-11-04 18:28:03 +01:00
|
|
|
operationId: getMyStream
|
|
|
|
security:
|
2022-11-15 23:23:33 +01:00
|
|
|
- BearerAuth: []
|
2022-11-04 18:28:03 +01:00
|
|
|
parameters:
|
|
|
|
- name: limit
|
|
|
|
in: query
|
|
|
|
schema:
|
2022-11-22 16:51:16 +01:00
|
|
|
$ref: "#/components/schemas/limit"
|
2022-11-15 23:23:33 +01:00
|
|
|
description: The number of elements to show.
|
2022-11-04 18:28:03 +01:00
|
|
|
required: false
|
2022-11-19 14:54:36 +01:00
|
|
|
- name: start_index
|
2022-11-04 18:28:03 +01:00
|
|
|
in: query
|
|
|
|
schema:
|
2022-11-22 16:51:16 +01:00
|
|
|
$ref: "#/components/schemas/start_index"
|
2022-11-15 23:23:33 +01:00
|
|
|
description: The starting offset.
|
2022-11-04 18:28:03 +01:00
|
|
|
required: false
|
|
|
|
responses:
|
|
|
|
'200':
|
2022-11-15 23:23:33 +01:00
|
|
|
description: The photo stream.
|
2022-11-04 18:28:03 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-15 23:23:33 +01:00
|
|
|
$ref: "#/components/schemas/photo_stream"
|
2022-11-19 14:54:36 +01:00
|
|
|
example:
|
|
|
|
- user_id: "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d"
|
2022-12-09 03:53:16 +01:00
|
|
|
name: "Federicus"
|
2022-11-22 17:07:28 +01:00
|
|
|
photo_id: 157
|
|
|
|
upload_time: "2020-11-20T12:00:00Z"
|
|
|
|
likes: 93
|
|
|
|
comments: 13
|
|
|
|
liked: true
|
2022-11-04 12:41:07 +01:00
|
|
|
|
|
|
|
components:
|
|
|
|
securitySchemes:
|
|
|
|
BearerAuth:
|
|
|
|
type: http
|
|
|
|
scheme: bearer
|
|
|
|
|
|
|
|
schemas:
|
2022-11-22 16:51:16 +01:00
|
|
|
start_index:
|
|
|
|
type: integer
|
|
|
|
description: The starting offset.
|
|
|
|
default: 0
|
|
|
|
limit:
|
|
|
|
type: integer
|
|
|
|
description: The number of elements to show.
|
|
|
|
default: 15
|
2022-11-15 23:23:33 +01:00
|
|
|
uid_name:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
user_id:
|
|
|
|
$ref: "#/components/schemas/uid"
|
|
|
|
name:
|
|
|
|
$ref: "#/components/schemas/name"
|
2022-11-19 14:54:36 +01:00
|
|
|
uid_object:
|
|
|
|
type: object
|
|
|
|
description: The user identifier.
|
|
|
|
properties:
|
|
|
|
user_id:
|
|
|
|
$ref: "#/components/schemas/uid"
|
2022-11-15 23:23:33 +01:00
|
|
|
uid:
|
|
|
|
type: string
|
2022-11-19 14:54:36 +01:00
|
|
|
minLength: 36
|
|
|
|
maxLength: 36
|
|
|
|
description: The user ID.
|
2022-11-15 23:23:33 +01:00
|
|
|
format: uuid
|
2022-12-23 02:23:29 +01:00
|
|
|
pattern: '^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$' # RFC 4122
|
2022-11-15 23:23:33 +01:00
|
|
|
example: "1b4e28ba-2fa1-11d2-883f-0016d3cca427"
|
2022-11-19 14:54:36 +01:00
|
|
|
name_object:
|
|
|
|
type: object
|
|
|
|
description: The username of the user.
|
|
|
|
properties:
|
|
|
|
name:
|
|
|
|
$ref: "#/components/schemas/name"
|
2022-11-04 18:28:03 +01:00
|
|
|
name:
|
|
|
|
type: string
|
2022-11-19 14:54:36 +01:00
|
|
|
description: The username of the user.
|
2022-11-04 18:28:03 +01:00
|
|
|
example: Maria
|
2022-11-19 14:54:36 +01:00
|
|
|
pattern: '^[a-zA-Z0-9_.]*$'
|
2022-11-04 18:28:03 +01:00
|
|
|
minLength: 3
|
|
|
|
maxLength: 16
|
2022-11-15 23:23:33 +01:00
|
|
|
photo_id:
|
2022-11-04 18:28:03 +01:00
|
|
|
type: integer
|
2022-11-15 23:23:33 +01:00
|
|
|
description: The ID of the photo.
|
2022-11-04 18:28:03 +01:00
|
|
|
example: 1527
|
2022-11-15 23:23:33 +01:00
|
|
|
comment_id:
|
2022-11-04 18:28:03 +01:00
|
|
|
type: integer
|
2022-11-15 23:23:33 +01:00
|
|
|
description: The ID of the comment.
|
2022-11-04 18:28:03 +01:00
|
|
|
example: 3
|
2022-11-15 23:23:33 +01:00
|
|
|
upload_time:
|
2022-11-04 18:28:03 +01:00
|
|
|
type: string
|
2022-11-24 15:23:56 +01:00
|
|
|
format: date-time
|
2022-11-24 15:20:47 +01:00
|
|
|
description: Upload time and date in RFC3339 format.
|
2022-12-06 22:52:50 +01:00
|
|
|
minLength: 20
|
2022-11-24 15:20:47 +01:00
|
|
|
maxLength: 25
|
2022-11-04 18:28:03 +01:00
|
|
|
likes:
|
|
|
|
type: integer
|
|
|
|
example: 90
|
2022-11-15 23:23:33 +01:00
|
|
|
description: Number of likes.
|
2022-11-22 17:07:28 +01:00
|
|
|
comments_n:
|
|
|
|
type: integer
|
|
|
|
example: 7
|
|
|
|
description: Number of comments on the photo.
|
2022-11-17 16:51:57 +01:00
|
|
|
followers_n:
|
|
|
|
type: integer
|
|
|
|
example: 420
|
|
|
|
description: Number of followers.
|
|
|
|
following_n:
|
|
|
|
type: integer
|
|
|
|
example: 69
|
|
|
|
description: Number of following users.
|
2022-11-22 17:45:18 +01:00
|
|
|
like_status:
|
2022-11-22 16:18:19 +01:00
|
|
|
type: boolean
|
|
|
|
example: true
|
|
|
|
description: Whether the user liked the photo.
|
2022-11-22 17:45:18 +01:00
|
|
|
follow_status:
|
|
|
|
type: boolean
|
|
|
|
example: false
|
|
|
|
description: Whether the user follows the other user.
|
2022-12-10 01:05:44 +01:00
|
|
|
ban_status:
|
|
|
|
type: boolean
|
|
|
|
example: false
|
|
|
|
description: Whether the user banned the other user.
|
2022-11-22 16:18:19 +01:00
|
|
|
photos_n:
|
|
|
|
type: integer
|
|
|
|
example: 90
|
|
|
|
description: Number of photos.
|
2022-12-10 01:05:44 +01:00
|
|
|
search_result:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
user_id:
|
|
|
|
$ref: "#/components/schemas/uid"
|
|
|
|
name:
|
|
|
|
$ref: "#/components/schemas/name"
|
|
|
|
followed:
|
|
|
|
$ref: "#/components/schemas/follow_status"
|
|
|
|
banned:
|
|
|
|
$ref: "#/components/schemas/ban_status"
|
2022-11-19 14:54:36 +01:00
|
|
|
user_profile:
|
|
|
|
type: object
|
|
|
|
description: The profile of the user.
|
|
|
|
properties:
|
2022-12-09 03:53:16 +01:00
|
|
|
name:
|
2022-11-19 14:54:36 +01:00
|
|
|
$ref: "#/components/schemas/name"
|
|
|
|
followers:
|
|
|
|
$ref: "#/components/schemas/followers_n"
|
|
|
|
following:
|
|
|
|
$ref: "#/components/schemas/following_n"
|
|
|
|
photos:
|
2022-11-22 16:18:19 +01:00
|
|
|
$ref: "#/components/schemas/photos_n"
|
2022-11-22 17:45:18 +01:00
|
|
|
followed:
|
|
|
|
$ref: "#/components/schemas/follow_status"
|
2022-12-12 12:37:30 +01:00
|
|
|
banned:
|
|
|
|
$ref: "#/components/schemas/ban_status"
|
2022-11-15 23:23:33 +01:00
|
|
|
user_photo_stream:
|
2022-11-04 18:28:03 +01:00
|
|
|
type: array
|
2022-11-19 14:54:36 +01:00
|
|
|
minItems: 0
|
2022-11-22 16:52:50 +01:00
|
|
|
maxItems: 100
|
2022-11-19 14:54:36 +01:00
|
|
|
description: An array of photos, upload time and likes.
|
2022-11-04 18:28:03 +01:00
|
|
|
items:
|
2022-11-19 14:54:36 +01:00
|
|
|
$ref: "#/components/schemas/user_photo_stream_item"
|
|
|
|
user_photo_stream_item:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
photo_id:
|
|
|
|
$ref: "#/components/schemas/photo_id"
|
|
|
|
upload_time:
|
|
|
|
$ref: "#/components/schemas/upload_time"
|
|
|
|
likes:
|
|
|
|
$ref: "#/components/schemas/likes"
|
2022-11-22 17:07:28 +01:00
|
|
|
comments:
|
|
|
|
$ref: "#/components/schemas/comments_n"
|
2022-11-22 16:18:19 +01:00
|
|
|
liked:
|
2022-11-22 17:45:18 +01:00
|
|
|
$ref: "#/components/schemas/like_status"
|
2022-11-15 23:23:33 +01:00
|
|
|
photo_stream:
|
2022-11-04 18:28:03 +01:00
|
|
|
type: array
|
2022-11-19 14:54:36 +01:00
|
|
|
minItems: 0
|
2022-11-22 16:52:50 +01:00
|
|
|
maxItems: 100
|
2022-11-19 14:54:36 +01:00
|
|
|
description: An array of photos, author, upload time and likes.
|
2022-11-04 18:28:03 +01:00
|
|
|
items:
|
2022-11-19 14:54:36 +01:00
|
|
|
$ref: "#/components/schemas/photo_stream_item"
|
|
|
|
photo_stream_item:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
user_id:
|
|
|
|
$ref: "#/components/schemas/uid"
|
2022-12-09 03:53:16 +01:00
|
|
|
name:
|
2022-11-19 14:54:36 +01:00
|
|
|
$ref: "#/components/schemas/name"
|
|
|
|
photo_id:
|
|
|
|
$ref: "#/components/schemas/photo_id"
|
|
|
|
upload_time:
|
|
|
|
$ref: "#/components/schemas/upload_time"
|
|
|
|
likes:
|
|
|
|
$ref: "#/components/schemas/likes"
|
2022-11-22 17:07:28 +01:00
|
|
|
comments:
|
|
|
|
$ref: "#/components/schemas/comments_n"
|
2022-11-22 16:18:19 +01:00
|
|
|
liked:
|
2022-11-22 17:45:18 +01:00
|
|
|
$ref: "#/components/schemas/like_status"
|
2022-11-19 14:54:36 +01:00
|
|
|
comments:
|
|
|
|
type: array
|
|
|
|
minItems: 0
|
2022-11-22 16:52:50 +01:00
|
|
|
maxItems: 100
|
2022-11-19 14:54:36 +01:00
|
|
|
description: An array of comments.
|
|
|
|
items:
|
|
|
|
$ref : "#/components/schemas/comment_item"
|
|
|
|
comment_item:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
user_id:
|
|
|
|
$ref: "#/components/schemas/uid"
|
|
|
|
name:
|
|
|
|
$ref: "#/components/schemas/name"
|
|
|
|
comment:
|
|
|
|
$ref: "#/components/schemas/comment"
|
2022-11-20 20:16:06 +01:00
|
|
|
comment_id:
|
|
|
|
$ref: "#/components/schemas/comment_id"
|
2022-11-19 14:54:36 +01:00
|
|
|
date:
|
|
|
|
$ref: "#/components/schemas/upload_time"
|
|
|
|
comment_request:
|
|
|
|
description: The comment to post.
|
|
|
|
type: object
|
|
|
|
properties:
|
2022-11-20 20:16:06 +01:00
|
|
|
user_id:
|
|
|
|
$ref: "#/components/schemas/uid"
|
2022-11-19 14:54:36 +01:00
|
|
|
comment:
|
|
|
|
$ref: "#/components/schemas/comment"
|
2022-11-17 16:51:57 +01:00
|
|
|
comment:
|
2022-12-22 18:08:03 +01:00
|
|
|
minLength: 1
|
2022-11-29 16:07:42 +01:00
|
|
|
maxLength: 255
|
2022-12-22 18:08:03 +01:00
|
|
|
pattern: "^(.){1,255}$" # everything except newlines
|
2022-11-17 16:51:57 +01:00
|
|
|
type: string
|
|
|
|
example: "What a lovely picture! 😊"
|
|
|
|
description: The comment's text
|
2022-12-10 02:04:41 +01:00
|
|
|
image_jpg:
|
|
|
|
description: The photo to upload.
|
|
|
|
type: string
|
|
|
|
format: binary
|
|
|
|
minLength: 1
|
|
|
|
maxLength: 10485760 # 10 MB
|
2022-12-22 18:08:03 +01:00
|
|
|
pattern: "((.|\n)*)" # this accepts everything
|
2022-11-19 14:54:36 +01:00
|
|
|
|
2022-11-20 20:16:06 +01:00
|
|
|
generic_response:
|
2022-11-19 14:54:36 +01:00
|
|
|
type: object
|
|
|
|
description: An object representing a success.
|
|
|
|
properties:
|
|
|
|
status:
|
|
|
|
type: string
|
2022-12-10 02:04:41 +01:00
|
|
|
minLength: 1
|
|
|
|
maxLength: 255
|
2022-11-24 15:23:56 +01:00
|
|
|
pattern: ".*"
|
2022-11-19 14:54:36 +01:00
|
|
|
description: The status of the request.
|
2022-11-20 20:16:06 +01:00
|
|
|
example: "Success"
|
2022-11-04 12:41:07 +01:00
|
|
|
|
|
|
|
requestBodies:
|
|
|
|
userDetails:
|
|
|
|
description: User details
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2022-11-19 14:54:36 +01:00
|
|
|
$ref: "#/components/schemas/name_object"
|
|
|
|
example:
|
|
|
|
name: "Maria"
|
2022-11-15 23:50:56 +01:00
|
|
|
required: true
|