{ "openapi": "3.0.1", "info": { "title": "API", "description": "Documentation", "contact": { "email": "luka.dumancic49@gmail.com" }, "license": { "name": "MIT", "url": "https://opensource.org/licenses/MIT" }, "version": "1.0.0" }, "tags": [ { "name": "user", "description": "Operations about user" } ], "paths": { "/api/users": { "get": { "tags": ["user"], "summary": "Get list of users", "operationId": "getUsers", "responses": { "200": { "description": "Successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User", "type": "string" } } } } } }, "post": { "tags": ["user"], "summary": "Create a user", "operationId": "createUser", "requestBody": { "description": "Created user object", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserDto" } } }, "required": true }, "responses": { "201": { "description": "User created successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "400": { "description": "Invalid payload supplied", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/api/users/{id}": { "get": { "tags": ["user"], "summary": "Get a user by id", "operationId": "getUserById", "security": [{ "bearerAuth": [] }], "parameters": [ { "name": "id", "in": "path", "description": "The id of a user", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "400": { "description": "Invalid id supplied", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "User not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "put": { "tags": ["user"], "summary": "Update a user", "operationId": "updateUser", "security": [{ "bearerAuth": [] }], "parameters": [ { "name": "id", "in": "path", "description": "id of a user to update", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "description": "Updated user object", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserDto" } } }, "required": true }, "responses": { "200": { "description": "Successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "400": { "description": "Invalid payload supplied", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "User not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "delete": { "tags": ["user"], "summary": "Delete a user", "operationId": "deleteUserById", "security": [{ "bearerAuth": [] }], "parameters": [ { "name": "id", "in": "path", "description": "The id of user to be deleted", "required": true, "schema": { "type": "integer" } } ], "responses": { "204": { "description": "User deleted successfully" }, "400": { "description": "Invalid id supplied", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/api/login": { "post": { "tags": ["user"], "summary": "Login user", "operationId": "getToken", "security": [{ "bearerAuth": [] }], "requestBody": { "description": "Created user object", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserDto" } } }, "required": true }, "responses": { "200": { "description": "Successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "400": { "description": "Invalid id supplied", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "User not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/api/users/{id}/stocks": { "get": { "tags": ["stock"], "summary": "Get user stock by ticker", "operationId": "getUserById", "security": [{ "bearerAuth": [] }], "parameters": [ { "name": "id", "in": "path", "description": "The id of a user", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User", "type": "string" } } } } } }, "post": { "tags": ["stock"], "summary": "Get user stock by ticker", "operationId": "getUserById", "security": [{ "bearerAuth": [] }], "parameters": [ { "name": "id", "in": "path", "description": "The id of a user", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "description": "Created stock object", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/StockDto" } } }, "required": true }, "responses": { "201": { "description": "User created successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "400": { "description": "Invalid payload supplied", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/api/users/{id}/stocks/{ticker}": { "get": { "tags": ["stock"], "summary": "Get user stock by ticker", "operationId": "getUserById", "security": [{ "bearerAuth": [] }], "parameters": [ { "name": "id", "in": "path", "description": "The id of a user", "required": true, "schema": { "type": "integer" } }, { "name": "ticker", "in": "path", "description": "The stock ticker", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Stock" } } } }, "400": { "description": "Invalid id supplied", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "User not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "put": { "tags": ["stock"], "summary": "Update a stock", "operationId": "updateUser", "security": [{ "bearerAuth": [] }], "parameters": [ { "name": "id", "in": "path", "description": "The id of a user", "required": true, "schema": { "type": "integer" } }, { "name": "ticker", "in": "path", "description": "The stock ticker", "required": true, "schema": { "type": "string" } } ], "requestBody": { "description": "Updated stock object", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/StockDto" } } }, "required": true }, "responses": { "200": { "description": "Successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "400": { "description": "Invalid payload supplied", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "User not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "delete": { "tags": ["stock"], "summary": "Delete user's stock", "operationId": "deleteuserStock", "security": [{ "bearerAuth": [] }], "parameters": [ { "name": "id", "in": "path", "description": "The id of a user", "required": true, "schema": { "type": "integer" } }, { "name": "ticker", "in": "path", "description": "The stock ticker", "required": true, "schema": { "type": "string" } } ], "responses": { "204": { "description": "User deleted successfully" }, "400": { "description": "Invalid id supplied", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/api/users/{id}/tasks": { "get": { "tags": ["task"], "summary": "Get user tasks", "operationId": "getTasksByUserId", "security": [{ "bearerAuth": [] }], "parameters": [ { "name": "id", "in": "path", "description": "The id of a user", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Task", "type": "string" } } } } } }, "post": { "tags": ["task"], "summary": "Get user tasks by user", "operationId": "getUserById", "security": [{ "bearerAuth": [] }], "parameters": [ { "name": "id", "in": "path", "description": "The id of a user", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "description": "Created stock object", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TaskDto" } } }, "required": true }, "responses": { "201": { "description": "User created successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Task" } } } }, "400": { "description": "Invalid payload supplied", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/api/users/{id}/tasks/{taskId}": { "get": { "tags": ["task"], "summary": "Get user tasks by task id", "operationId": "getUserById", "security": [{ "bearerAuth": [] }], "parameters": [ { "name": "id", "in": "path", "description": "The id of a user", "required": true, "schema": { "type": "integer" } }, { "name": "taskId", "in": "path", "description": "The stock ticker", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Task" } } } }, "400": { "description": "Invalid id supplied", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "User not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "put": { "tags": ["task"], "summary": "Update a task", "operationId": "updateUser", "security": [{ "bearerAuth": [] }], "parameters": [ { "name": "id", "in": "path", "description": "The id of a user", "required": true, "schema": { "type": "integer" } }, { "name": "taskId", "in": "path", "description": "The stock ticker", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "description": "Updated stock object", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TaskDto" } } }, "required": true }, "responses": { "200": { "description": "Successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Task" } } } }, "400": { "description": "Invalid payload supplied", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "User not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "delete": { "tags": ["task"], "summary": "Delete user's task", "operationId": "deleteuserStock", "security": [{ "bearerAuth": [] }], "parameters": [ { "name": "id", "in": "path", "description": "The id of a user", "required": true, "schema": { "type": "integer" } }, { "name": "taskId", "in": "path", "description": "The stock ticker", "required": true, "schema": { "type": "integer" } } ], "responses": { "204": { "description": "User deleted successfully" }, "400": { "description": "Invalid id supplied", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } } }, "security": [{ "bearerAuth": [] }], "components": { "securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" } }, "schemas": { "UserDto": { "type": "object", "properties": { "username": { "type": "string" }, "password": { "type": "string" } } }, "User": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64" }, "username": { "type": "string" }, "password": { "type": "string" } } }, "StockDto": { "type": "object", "properties": { "ticker": { "type": "string" } } }, "Stock": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64" }, "userId": { "type": "integer", "format": "int64" }, "ticker": { "type": "string" }, "data": { "type": "object" } } }, "TaskDto": { "type": "object", "properties": { "title": { "type": "string" }, "description": { "type": "string" } } }, "Task": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64" }, "userId": { "type": "integer", "format": "int64" }, "title": { "type": "string" }, "description": { "type": "object" } } }, "Error": { "type": "object", "properties": { "error": { "message": "string" } } }, "ApiResponse": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "type": { "type": "string" }, "message": { "type": "string" } } } } } }