openapi: 3.0.0 info: title: ADA Space API version: '1.0' servers: - description: Local Server url: http://localhost:8080 paths: /users: get: tags: - Users summary: Get all users responses: '200': description: A list of users content: application/json: schema: type: array items: $ref: '#/components/schemas/User' post: tags: - Users summary: Create a new user requestBody: required: true content: application/json: schema: type: object properties: username: type: string minLength: 5 password: type: string minLength: 5 name: type: string minLength: 1 responses: '200': description: A user session content: application/json: schema: $ref: '#/components/schemas/Session' /users/{id}: get: tags: - Users summary: Get a user specified by the requested ID parameters: - in: path name: id schema: type: string format: uuid required: true description: ID of the user to get responses: '200': description: A user object content: application/json: schema: $ref: '#/components/schemas/User' /users/login: post: tags: - Users summary: Login with an existing user security: - BasicAuth: [] responses: '200': description: A user session content: application/json: schema: $ref: '#/components/schemas/Session' /users/logout: post: tags: - Users summary: Logout the current authenticated user security: - BearerAuth: [] responses: '200': description: A user session content: application/json: schema: $ref: '#/components/schemas/Session' /users/avatar: put: tags: - Users summary: Update current authenticated user avatar security: - BearerAuth: [] requestBody: content: image/png: schema: type: string format: binary image/jpeg: schema: type: string format: binary responses: '200': description: A user object content: application/json: schema: $ref: '#/components/schemas/User' delete: tags: - Users summary: Delete current authenticated user avatar security: - BearerAuth: [] responses: '200': description: A user object content: application/json: schema: $ref: '#/components/schemas/User' /users/me: get: tags: - Users summary: Get current authenticated user security: - BearerAuth: [] responses: '200': description: A user json object content: application/json: schema: $ref: '#/components/schemas/User' /posts: get: tags: - Posts summary: Get all posts parameters: - in: query name: user_id schema: type: string format: uuid description: Filter by the given user ID responses: '200': description: A list of posts content: application/json: schema: type: array items: $ref: '#/components/schemas/Post' post: tags: - Posts summary: Create a new post on behalf of current authenticated user security: - BearerAuth: [] requestBody: required: true content: text/plain: schema: type: string description: The content of the post multipart/form-data: schema: type: object properties: text: type: string media: type: string format: binary responses: '200': description: A post json object content: application/json: schema: $ref: '#/components/schemas/Post' /posts/{id}: get: tags: - Posts summary: Get a post specified by the requested ID parameters: - in: path name: id schema: type: string format: uuid required: true description: ID of the post to get responses: '200': description: A post json object content: application/json: schema: $ref: '#/components/schemas/Post' patch: tags: - Posts summary: Update a post specified by the requested ID parameters: - in: path name: id schema: type: string format: uuid required: true description: ID of the post to update security: - BearerAuth: [] requestBody: required: true content: text/plain: schema: type: string responses: '200': description: A post json object content: application/json: schema: $ref: '#/components/schemas/Post' delete: tags: - Posts summary: Delete a post specified by the requested ID parameters: - in: path name: id schema: type: string format: uuid required: true description: ID of the post to delete security: - BearerAuth: [] responses: '200': description: A post json object content: application/json: schema: $ref: '#/components/schemas/Post' /posts/paginated: get: tags: - Posts summary: Get all posts with paginated response parameters: - in: query name: user_id schema: type: string format: uuid description: Filter by the given user id - in: query name: page schema: type: integer default: 1 description: The number of the page - in: query name: per schema: type: integer default: 10 description: The number of items per page responses: '200': description: A list of posts and pagination metadata content: application/json: schema: $ref: '#/components/schemas/Page' /posts/comments/{id}: get: tags: - Posts summary: Get all comments of a post specified by the requested ID responses: '200': description: A list of posts content: application/json: schema: type: array items: $ref: '#/components/schemas/Post' post: tags: - Posts summary: Create a new post on behalf of current authenticated user as comment of a post specified by the requested ID parameters: - in: path name: id schema: type: string format: uuid required: true description: ID of the post to comment security: - BearerAuth: [] requestBody: required: true content: text/plain: schema: type: string description: The content of the post multipart/form-data: schema: type: object properties: content: type: string media: type: string format: binary /likes/liking_users/{post_id}: get: tags: - Likes summary: Get a post liking users parameters: - in: path name: post_id schema: type: string format: uuid required: true description: ID of the post to request liking users responses: '200': description: A user json object content: application/json: schema: type: array items: $ref: '#/components/schemas/User' /likes/liked_posts/{user_id}: get: tags: - Likes summary: Get a user liked posts parameters: - in: path name: user_id schema: type: string format: uuid required: true description: ID of the user to request liked posts responses: '200': description: A list of posts content: application/json: schema: type: array items: $ref: '#/components/schemas/Post' /reports/{post_id}: get: tags: - Reports summary: Get a post reports parameters: - in: path name: post_id schema: type: string format: uuid required: true description: ID of the post to request reports responses: '200': description: A list of reports content: application/json: schema: type: array items: type: string post: tags: - Reports summary: Report the specified post security: - BearerAuth: [] requestBody: required: true content: text/plain: schema: type: string description: The reason of the report /likes/{post_id}: get: tags: - Likes summary: Get all likes from a specified post parameters: - in: path name: id schema: type: string format: uuid required: true description: ID of the post to get the likes responses: '200': description: Array of likes json objects content: application/json: schema: type: array items: $ref: '#/components/schemas/Like' post: tags: - Likes summary: Like the target post on behalf of the authenticated user parameters: - in: path name: post_id schema: type: string format: uuid required: true description: ID of the post to like requestBody: required: false content: text/plain: schema: type: string description: The like reaction example: ❤️ responses: '204': description: The post was successfully liked delete: tags: - Likes summary: Unlike the target post on behalf of the authenticated user security: - BearerAuth: [] parameters: - in: path name: post_id schema: type: string format: uuid required: true description: ID of the post to unlike responses: '204': description: The post was successfully unliked components: schemas: User: type: object properties: id: type: string format: uuid description: The user ID. username: type: string description: The user username. name: type: string description: The user name. avatar: type: string description: The user avatar media path. required: - id - username - name Session: type: object properties: token: type: string example: 23rg8cSx5n8UNkItcoYWqA== user: $ref: '#/components/schemas/User' Post: type: object properties: id: type: string format: uuid description: The post ID. text: type: string description: The post text. media: type: string description: The post media path. user_id: type: string format: uuid description: The post user ID. user: $ref: '#/components/schemas/User' like_count: type: integer format: int32 created_at: type: string format: date-time description: The post creation timestamp. updated_at: type: string format: date-time description: The post update timestamp. required: - id - text - user_id - created_at Page: type: object properties: items: type: array description: The page's items. items: $ref: '#/components/schemas/Post' metadata: type: object properties: page: type: integer description: Current page number. Starts at `1`. per: type: integer description: Max items per page. total: type: integer description: Total number of pages. Like: type: object properties: reaction: type: string description: a single emoji representing a reaction. This field is optional. post_id: type: string format: uuid description: The post user ID. user_id: type: string format: uuid description: The user ID. id: type: string format: uuid description: The like ID. user: $ref: '#/components/schemas/User' required: - id - post_id - user_id - created_at securitySchemes: BasicAuth: type: http scheme: basic BearerAuth: type: http scheme: bearer bearerFormat: JWT