openapi: 3.0.0 servers: - description: Swagger url: "http://localhost:8080/" info: version: "0.1.4" title: GoalAim description: The API for the GoalAIm app paths: "/authentification/register": post: tags: - Authentification description: Route to create a new user operationId: register requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/Login" responses: "200": description: "User successfully created" "409": $ref: "#/components/responses/Conflict" "500": $ref: "#/components/responses/DatabaseError" "/authentification/login": post: tags: - Authentification description: Route to log a user operationId: login requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/Login" responses: "200": description: "Login : Success" headers: Authorization: description: "Token to use for all the protected routes" schema: type: string "401": $ref: "#/components/responses/Unauthorized" "500": $ref: "#/components/responses/DatabaseError" "/steam/time_played": post: tags: - Steam description: Get Steam Time Played. operationId: steam_time_played security: - jsonWebToken: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SteamHeader" responses: "200": description: "Return a JSON structure" content: application/json: schema: $ref: "#/components/schemas/SteamResponse" "400": $ref: "#/components/responses/BadRequest" "412": $ref: "#/components/responses/TokenParsingError" "/authentification/logout": get: tags: - Authentification description: Route to logout a user operationId: logout security: - jsonWebToken: [] responses: "200": description: "Authentification : Logout Success" "401": $ref: "#/components/responses/Unauthorized" "500": $ref: "#/components/responses/DatabaseError" "/api/ping": get: tags: - Ping description: Route to test the API and if you are logged in. operationId: ping security: - jsonWebToken: [] responses: "200": description: "Ping : Success" content: text/plain: schema: type: string example: "I am ping and protected!" "401": $ref: "#/components/responses/Unauthorized" "412": $ref: "#/components/responses/TokenParsingError" "500": description: "Internal Error" content: text/plain: schema: oneOf: - $ref: "#/components/schemas/InternalError" - $ref: "#/components/schemas/DatabaseConnectionError" - $ref: "#/components/schemas/DatabaseError" components: securitySchemes: jsonWebToken: type: apiKey in: header name: Authorization schemas: Login: type: object properties: username: type: string password: type: string DatabaseError: type: string example: "Database error: my_error" DatabaseConnectionError: type: string example: "Database connection error: my_error" InternalError: type: string example: "my_error" ######## STEAM ######## SteamHeader: type: object properties: steam_id: type: string SteamResponse: type: object properties: response: $ref: "#/components/schemas/SteamGameInfo" SteamGameInfo: type: object properties: game_count: type: integer format: int64 games: type: array items: $ref: "#/components/schemas/SteamGame" SteamGame: type: object properties: appid: type: integer format: int64 playtime_2weeks: type: integer format: int64 nullable: true playtime_forever: type: integer format: int64 img_icon_url: type: string nullable: true img_logo_url: type: string nullable: true has_community_visible_stats: type: string nullable: true ############################################# responses: NotFound: description: The specified resource was not found content: text/plain: schema: type: string BadRequest: description: BadRequest content: text/plain: schema: type: string example: "Empty parameter" Unauthorized: description: Unauthorized content: text/plain: schema: type: string example: "Bad credentials" Conflict: description: Conflict content: text/plain: schema: type: string example: "User already exist" DatabaseError: description: Database Error content: text/plain: schema: type: string example: "Database error: my_error" DatabaseConnectionError: description: Database Connection Error content: text/plain: schema: type: string example: "Database connection error: my_error" InternalError: description: Internal Error content: text/plain: schema: type: string TokenParsingError: description: Token Parsing Error content: text/plain: schema: type: string