{ "openapi": "3.0.0", "info": { "title": "API Documentation", "version": "1.0.0" }, "paths": { "/api/admin": { "post": { "summary": "Check if user is admin", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "userId": { "type": "string" } } } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" }, "isAdmin": { "type": "boolean" } } } } } } } } }, "/api/cars": { "get": { "summary": "Get all cars", "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Car" } } } } } } }, "post": { "summary": "Post a car", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "car": { "type": "string" }, "userId": { "type": "string" }, "batteryCurrent": { "type": "number" } } } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/api/changePassword": { "post": { "summary": "Change user password", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "newPassword": { "type": "string" }, "userId": { "type": "string" } } } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" } } } } } }, "500": { "description": "An error occurred while changing the password", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } } } } } } } } }, "/api/charge": { "get": { "summary": "Get intermediate charge", "parameters": [ { "in": "header", "name": "currentCharge", "schema": { "type": "string" }, "required": true }, { "in": "header", "name": "maxCharge", "schema": { "type": "string" }, "required": true }, { "in": "header", "name": "userId", "schema": { "type": "string" }, "required": true } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "charge": { "type": "string" } } } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } }, "post": { "summary": "Post a charge", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "charge": { "type": "string" }, "userId": { "type": "string" } } } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "400": { "description": "Failed. Charge or userId were null.", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "500": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/api/checkPassword": { "post": { "summary": "Check user password", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "currentPassword": { "type": "string" }, "userId": { "type": "string" } } } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" } } } } } }, "400": { "description": "Invalid current password", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } } } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } } } } } }, "500": { "description": "An error occurred while checking the password", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } } } } } } } } }, "/api/getuser": { "get": { "summary": "Get current user", "parameters": [ { "in": "query", "name": "id", "schema": { "type": "string" }, "required": true } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } }, "post": { "summary": "Change user level", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string" }, "level": { "type": "integer" }, "xp": { "type": "integer" } } } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/api/home": { "post": { "summary": "Post Okta user", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "email": { "type": "string" }, "oktaId": { "type": "string" } } } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" }, "uuid": { "type": "string" } } } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } }, "get": { "summary": "Get user by email", "parameters": [ { "in": "header", "name": "email", "schema": { "type": "string" }, "required": true } ], "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" }, "email": { "type": "string" } } } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/api/login": { "post": { "summary": "Check Login", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string" }, "password": { "type": "string" } } } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" }, "uuid": { "type": "string" } } } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/api/ports": { "get": { "summary": "Get ports by user ID", "parameters": [ { "in": "query", "name": "id", "schema": { "type": "string" }, "required": true } ], "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Port" } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } }, "post": { "summary": "Release port", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "portId": { "type": "string" }, "stationId": { "type": "string" } } } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/api/ports/allOccupiedPorts": { "get": { "summary": "Get all occupied ports", "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Port" } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/api/register": { "post": { "summary": "Register a new user", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "email": { "type": "string" }, "password": { "type": "string" } } } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/api/requests": { "post": { "summary": "Request a port", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "priority": { "type": "string" }, "requestedPortId": { "type": "string" }, "message": { "type": "string" }, "percent": { "type": "integer" } } } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "202": { "description": "Already requested", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } }, "get": { "summary": "Get my requests", "parameters": [ { "in": "query", "name": "id", "schema": { "type": "string" }, "required": true } ], "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Request" } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/api/requests/acceptRequest": { "post": { "summary": "Accept a request", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "fromUserId": { "type": "string" }, "requestedPortId": { "type": "string" } } } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Request" } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/api/requests/allRequests": { "get": { "summary": "Get all requests", "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Request" } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/api/requests/cancelRequest": { "post": { "summary": "Cancel a request", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "requestId": { "type": "integer" } } } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Request" } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/api/requests/charge": { "get": { "summary": "Get charge for a user", "parameters": [ { "in": "header", "name": "id", "schema": { "type": "string" }, "required": true } ], "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Charge" } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/api/requests/incomingRequests": { "get": { "summary": "Get incoming requests for a user", "parameters": [ { "in": "query", "name": "id", "schema": { "type": "string" }, "required": true } ], "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Request" } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/api/schuberg_api": { "get": { "summary": "Fetch data from API", "parameters": [ { "in": "header", "name": "Authorization", "schema": { "type": "string" }, "required": true } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/api/seeder": { "get": { "summary": "Seed the database", "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "500": { "description": "Internal Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/api/slack": { "post": { "summary": "Send a message to Slack", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "portId": { "type": "string" }, "userId": { "type": "string" }, "priority": { "type": "string" }, "message": { "type": "string" }, "description": { "type": "string" } } } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "500": { "description": "No slack webhook is set", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/api/stations": { "post": { "summary": "Reserve a port", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "userId": { "type": "string" }, "portId": { "type": "string" }, "stationId": { "type": "string" }, "occupiedTime": { "type": "string" } } } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "202": { "description": "User has already reserved a port", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/api/user": { "post": { "summary": "Update user admin status", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "userId": { "type": "string" } } } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" }, "user": { "$ref": "#/components/schemas/User" } } } } } } } }, "get": { "summary": "Get user by email", "parameters": [ { "in": "header", "name": "email", "schema": { "type": "string" }, "required": true } ], "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" }, "uuid": { "type": "string" } } } } } }, "400": { "description": "Failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/api/userExperience": { "post": { "summary": "Change user experience", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string" }, "xp": { "type": "integer" } } } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } } }, "components": { "schemas": { "User": { "type": "object", "properties": { "userId": { "type": "string" }, "level": { "type": "integer" }, "totalXp": { "type": "integer" }, "name": { "type": "string" }, "email": { "type": "string" }, "password": { "type": "string" }, "oktaId": { "type": "string" }, "isAdmin": { "type": "boolean" }, "BatteryMax": { "type": "number", "format": "float" }, "BatteryCurrent": { "type": "number", "format": "float" }, "carModel": { "type": "string" }, "lastChargeTime": { "type": "string" } } }, "Station": { "type": "object", "properties": { "stationId": { "type": "string" }, "locationId": { "type": "string" }, "overallStatus": { "type": "string" }, "coordinates": { "type": "string" }, "address": { "type": "object" }, "maxPower": { "type": "number", "format": "float" }, "portIds": { "type": "string" } } }, "Port": { "type": "object", "properties": { "portId": { "type": "string" }, "stationId": { "type": "string" }, "usedBy": { "type": "string" }, "emi3Id": { "type": "string" }, "status": { "type": "string" }, "maxPower": { "type": "number", "format": "float" }, "displayName": { "type": "string" }, "OccupiedTime": { "type": "string", "format": "date-time" }, "timeRemaining": { "type": "string", "format": "date-time" } } }, "Request": { "type": "object", "properties": { "requestId": { "type": "integer" }, "priority": { "type": "string" }, "fromUserId": { "type": "string" }, "requestedPortId": { "type": "string" }, "message": { "type": "string" }, "percent": { "type": "integer" } } } } }, "tags": [] }