API version 1.0

This commit is contained in:
Marco Realacci 2022-11-08 14:53:34 +01:00
parent c9a315b1f2
commit 83763dd783

View file

@ -29,54 +29,71 @@ paths:
type: string type: string
example: '* imagine a Bearer token *' example: '* imagine a Bearer token *'
/setUsername: /session/username/{username}:
post: put:
tags: ["login", "profile settings"] tags: ["login"]
summary: Changes the username summary: Updates the username
description: Changes the username of the user with the given one description: Changes the username of the user with the given one
operationId: setMyUsername operationId: setMyUsername
security: security:
- BearerAuth: [] - BearerAuth: []
requestBody: parameters:
$ref: "#/components/requestBodies/userDetails" - name: username
in: path
schema:
$ref: "#/components/schemas/name"
required: true
description: The username to update
responses: responses:
'200': '200':
description: Set username action successful description: Update username action successful
'409':
description: The chosen username is already taken
/interactions/followUser: /followers/{username}:
post: post:
tags: ["users interaction"] tags: ["followers"]
summary: Follow a user summary: Follows a user
description: Starts following a user description: Starts following a user
operationId: followUser operationId: followUser
security: security:
- BearerAuth: [] - BearerAuth: []
requestBody: parameters:
$ref: "#/components/requestBodies/userDetails" - name: username
in: path
schema:
$ref: "#/components/schemas/name"
required: true
description: The user to follow
responses: responses:
'200': '200':
description: Follow user action successful description: Follow user action successful
'409': '409':
description: The user is already followed by the user description: The user is already followed by the user
/interactions/unfollowUser: delete:
post: tags: ["followers"]
tags: ["users interaction"] summary: Unfollows a user
summary: Unfollow a user
description: Stops following a user description: Stops following a user
operationId: unfollowUser operationId: unfollowUser
security: security:
- BearerAuth: [] - BearerAuth: []
requestBody: parameters:
$ref: "#/components/requestBodies/userDetails" - name: username
in: path
schema:
$ref: "#/components/schemas/name"
required: true
description: The user to unfollow
responses: responses:
'200': '200':
description: Unfollow user action successful description: Unfollow user action successful
'409': '409':
description: The user is not followed by the user description: The user is not followed by the user
/interactions/banUser:
/bans:
post: post:
tags: ["users interaction"] tags: ["bans"]
summary: Ban a user summary: Bans a user
description: Bans a user //edit this please description: Bans a user //edit this please
operationId: banUser operationId: banUser
security: security:
@ -88,59 +105,82 @@ paths:
description: Ban user action successful description: Ban user action successful
'409': '409':
description: The user is already banned by the user description: The user is already banned by the user
/interactions/unbanUser: /bans/{username}:
post: delete:
tags: ["users interaction"] tags: ["bans"]
summary: Unban a user summary: Unbans a user
description: Unbans a user //todo edit this please description: Unbans a user //todo edit this please
operationId: unbanUser operationId: unbanUser
security: security:
- BearerAuth: [] - BearerAuth: []
requestBody: parameters:
$ref: "#/components/requestBodies/userDetails" - name: username
in: path
schema:
$ref: "#/components/schemas/name"
required: true
description: The user to unfollow
responses: responses:
'200': '200':
description: Unban user action successful description: Unban user action successful
'409': '409':
description: The user was not banned by the user description: The user was not banned by the user
/interactions/likePhoto: /photos/{username}/{photoID}/likes:
post: post:
tags: ["users interaction"] tags: ["photos"]
summary: Like a photo #todo review summary: Like a photo #todo review
description: aaa #todo review description: aaa #todo review
operationId: likePhoto operationId: likePhoto
security: security:
- BearerAuth: [] - BearerAuth: []
requestBody: parameters:
$ref: "#/components/requestBodies/photoDetails" - name: username
in: path
schema:
$ref: "#/components/schemas/name"
required: true
description: The owner of the picture to like
- name: photoID
in: path
schema:
$ref: "#/components/schemas/photoID"
required: true
description: The ID of the photo to like
responses: responses:
'200': '200':
description: Like photo action successful description: Like photo action successful
'404': '404':
description: The photo does not exists, or the author of the photo has banned the user description: The photo does not exists, or the author of the photo has banned the user
/interactions/unlikePhoto: delete:
post: tags: ["photos"]
tags: ["users interaction"]
summary: Unlike a photo #todo review summary: Unlike a photo #todo review
description: aaa #todo review description: aaa #todo review
operationId: unlikePhoto operationId: unlikePhoto
security: security:
- BearerAuth: [] - BearerAuth: []
requestBody: parameters:
$ref: "#/components/requestBodies/photoDetails" - name: username
in: path
schema:
$ref: "#/components/schemas/name"
required: true
description: The owner of the picture to unlike
- name: photoID
in: path
schema:
$ref: "#/components/schemas/photoID"
required: true
description: The ID of the photo to unlike
responses: responses:
'200': '200':
description: Unlike photo action successful description: Unlike photo action successful
'404': '404':
description: The photo does not exists description: The photo does not exists or the user was not liking the photo
'409':
description: The user was not liking the photo
/profile/{username}: #todo maybe username not here
/photos/{username}: #todo maybe username not here
get: get:
tags: ["photo management"] tags: ["profile"]
summary: Return user profile summary: Return user profile
description: todo description: todo
operationId: getUserProfile operationId: getUserProfile
@ -161,19 +201,22 @@ paths:
type: object type: object
properties: properties:
followers: followers:
type: integer type: array
description: Number of users that follows the user description: Array of users that the user is following
example: 420 items:
followering: $ref: "#/components/schemas/name"
type: integer following:
description: Number of users that the user is following type: array
example: 69 description: Array of users that are following the user
items:
$ref: "#/components/schemas/name"
photos: photos:
$ref: "#/components/schemas/userPhotoStream" $ref: "#/components/schemas/userPhotoStream"
'404': '404':
description: User not found or has banned the requesting user description: User not found or has banned the requesting user
/photos:
post: post:
tags: ["photo management"] tags: ["photos"]
summary: Uploads a photo summary: Uploads a photo
description: Uploads a photo in the gallery of the authorized user description: Uploads a photo in the gallery of the authorized user
operationId: uploadPhoto operationId: uploadPhoto
@ -196,7 +239,7 @@ paths:
/photos/{username}/{photoID}: /photos/{username}/{photoID}:
get: get:
tags: ["photo management"] tags: ["photos"]
summary: Download a photo summary: Download a photo
description: Returns the requested photo description: Returns the requested photo
operationId: getUserPhoto operationId: getUserPhoto
@ -225,7 +268,7 @@ paths:
'403': '403':
description: Requesting user has no permission to see the photo (banned or not following) description: Requesting user has no permission to see the photo (banned or not following)
delete: delete:
tags: ["photo management"] tags: ["photos"]
summary: Deletes a photo summary: Deletes a photo
description: Deletes a photo in the gallery of the authorized user description: Deletes a photo in the gallery of the authorized user
operationId: deletePhoto operationId: deletePhoto