openapi: 3.0.0 info: title: Gamenight version: '1.0' contact: name: Dennis Brentjes email: dennis@brentj.es url: 'https://brentj.es' description: Api specification for a Gamenight server license: name: MIT servers: - url: 'http://localhost:8080' description: Gamenight paths: /token: post: summary: 'Login a user.' operationId: post-token responses: '200': $ref: '#/components/responses/TokenResponse' '401': $ref: '#/components/responses/FailureResponse' requestBody: $ref: '#/components/requestBodies/LoginRequest' description: Submit your credentials to get a JWT-token to use with the rest of the api. parameters: [] /refresh_token: post: summary: 'Refresh a user token' operationId: post-refresh-tokenz responses: '200': $ref: '#/components/responses/TokenResponse' '401': $ref: '#/components/responses/FailureResponse' description: Refresh your JWT-token without logging in again. parameters: [] security: - JWT-Auth: [] /users: get: summary: 'Get all users' responses: '200': $ref: '#/components/responses/UsersResponse' '400': $ref: '#/components/responses/FailureResponse' '401': $ref: '#/components/responses/FailureResponse' security: - JWT-Auth: [] post: summary: 'Registers a user into gamenight.' operationId: post-user requestBody: $ref: '#/components/requestBodies/RegisterRequest' responses: '200': description: '' '422': $ref: '#/components/responses/FailureResponse' description: 'Create a new user given a registration token and user information, username and email must be unique, and password and password_repeat must match.' parameters: [ ] security: - JWT-Auth: [ ] /user/{userId}: get: description: 'Get a user from primary id' parameters: - in: path name: userId schema: type: string required: true description: Uuid of user to get responses: '200': $ref: '#/components/responses/UserResponse' '401': $ref: '#/components/responses/FailureResponse' '404': $ref: '#/components/responses/FailureResponse' '422': $ref: '#/components/responses/FailureResponse' security: - JWT-Auth: [] /user/{userId}/owned_games: get: summary: Get owned games of user parameters: - in: path name: userId schema: type: string required: true description: Uuid of user to get owned games for. responses: '200': $ref: '#/components/responses/OwnedGamesResponse' '401': $ref: '#/components/responses/FailureResponse' '422': $ref: '#/components/responses/FailureResponse' security: - JWT-Auth: [ ] /gamenights: get: summary: Get a all gamenights responses: '200': $ref: '#/components/responses/GamenightsResponse' '400': $ref: '#/components/responses/FailureResponse' '401': $ref: '#/components/responses/FailureResponse' operationId: get-gamenights security: - JWT-Auth: [] description: Retrieve the list of gamenights on this gamenight server. Requires authorization. post: summary: 'Gets the gamenight' operationId: post-gamenight responses: '200': description: OK '401': $ref: '#/components/responses/FailureResponse' '422': $ref: '#/components/responses/FailureResponse' security: - JWT-Auth: [ ] requestBody: $ref: '#/components/requestBodies/AddGamenight' description: 'Add a gamenight by providing a name and a date, only available when providing an JWT token.' /gamenight/{gamenightId}: get: summary: '' parameters: - in: path name: gamenightId schema: type: string required: true description: Uuid of gamenight to get. operationId: get-gamenight responses: '200': $ref: '#/components/responses/GamenightResponse' '401': $ref: '#/components/responses/FailureResponse' '422': $ref: '#/components/responses/FailureResponse' security: - JWT-Auth: [] /gamenight/{gamenightId}/participants: get: summary: Get all participants for a gamenight parameters: - in: path name: gamenightId schema: type: string required: true description: Uuid of gamenight to get participants for. responses: '200': $ref: '#/components/responses/ParticipantsResponse' '400': $ref: '#/components/responses/FailureResponse' '401': $ref: '#/components/responses/FailureResponse' requestBody: $ref: '#/components/requestBodies/GetParticipants' security: - JWT-Auth: [ ] description: Retrieve the participants of a single gamenight by id. post: summary: Add a participant parameters: - in: path name: gamenightId schema: type: string required: true description: Uuid of gamenight to add participants for. responses: '200': description: OK '401': $ref: '#/components/responses/FailureResponse' '422': $ref: '#/components/responses/FailureResponse' requestBody: $ref: '#/components/requestBodies/UserIdRequestBody' security: - JWT-Auth: [] /gamenight/{gamenightId}/participant/{userId}: delete: parameters: - in: path name: gamenightId schema: type: string required: true description: Uuid of gamenight to delete participant for - in: path name: userId schema: type: string required: true description: Uuid of the of the participant to remove responses: '200': description: "OK" '401': $ref: '#/components/responses/FailureResponse' '422': $ref: '#/components/responses/FailureResponse' requestBody: $ref: '#/components/requestBodies/LeaveGamenight' security: - JWT-Auth: [ ] /games: get: responses: '200': $ref: '#/components/responses/GamesResponse' '401': $ref: '#/components/responses/FailureResponse' '422': $ref: '#/components/responses/FailureResponse' security: - JWT-Auth: [] post: responses: '200': $ref: '#/components/responses/GameIdResponse' '401': $ref: '#/components/responses/FailureResponse' '422': $ref: '#/components/responses/FailureResponse' requestBody: $ref: '#/components/requestBodies/AddGameRequest' security: - JWT-Auth: [ ] /game/{gameId}: get: summary: Get this specific game parameters: - in: path name: gameId schema: type: string required: true description: Uuid of game to get. responses: '200': $ref: '#/components/responses/GameResponse' '401': $ref: '#/components/responses/FailureResponse' '422': $ref: '#/components/responses/FailureResponse' security: - JWT-Auth: [] delete: summary: Delete this game. parameters: - in: path name: gameId schema: type: string required: true description: Uuid of game to delete. responses: '200': description: "Ok" '401': $ref: '#/components/responses/FailureResponse' '422': $ref: '#/components/responses/FailureResponse' requestBody: $ref: '#/components/requestBodies/RemoveGameRequest' security: - JWT-Auth: [ ] put: summary: Changes this game resource parameters: - in: path name: gameId schema: type: string required: true description: Uuid of game to change. responses: '200': description: "OK" '401': $ref: '#/components/responses/FailureResponse' '422': $ref: '#/components/responses/FailureResponse' requestBody: $ref: '#/components/requestBodies/EditGameRequest' security: - JWT-Auth: [] /game/{gameId}/owners: post: summary: Own this game parameters: - in: path name: gameId schema: type: string required: true description: Uuid of game to own. requestBody: $ref: '#/components/requestBodies/OwnGameRequestBody' responses: '200': description: "OK" '401': $ref: '#/components/responses/FailureResponse' '422': $ref: '#/components/responses/FailureResponse' security: - JWT-Auth: [] /game/{gameId}/owner/{userId}: delete: summary: Own this game parameters: - in: path name: gameId schema: type: string required: true description: Uuid of game that user no longer owns. - in: path name: userId schema: type: string required: true description: Uuid of user that no longer owns. responses: '200': description: "OK" '401': $ref: '#/components/responses/FailureResponse' '422': $ref: '#/components/responses/FailureResponse' security: - JWT-Auth: [] /locations: get: responses: '200': $ref: '#/components/responses/LocationsResponse' '401': $ref: '#/components/responses/FailureResponse' '422': $ref: '#/components/responses/FailureResponse' security: - JWT-Auth: [ ] post: responses: '200': $ref: '#/components/responses/LocationIdResponse' '401': $ref: '#/components/responses/FailureResponse' '422': $ref: '#/components/responses/FailureResponse' requestBody: $ref: '#/components/requestBodies/AddLocationRequest' security: - JWT-Auth: [ ] /location/{locationId}: get: summary: gets this location parameters: - in: path name: locationId schema: type: string required: true description: Uuid of location to get. responses: '200': $ref: '#/components/responses/LocationResponse' '401': $ref: '#/components/responses/FailureResponse' '422': $ref: '#/components/responses/FailureResponse' security: - JWT-Auth: [] /location/{locationId}/authorized_users/: get: summary: gets this locations authorized users parameters: - in: path name: locationId schema: type: string required: true description: Uuid of location to get authorized users for. responses: '200': $ref: "#/components/responses/UserIdsResponse" '401': $ref: '#/components/responses/FailureResponse' '422': $ref: '#/components/responses/FailureResponse' security: - JWT-Auth: [ ] post: summary: Authorize a user parameters: - in: path name: locationId schema: type: string required: true description: Uuid location to authorize for. responses: '200': description: 'Ok' '401': $ref: '#/components/responses/FailureResponse' '422': $ref: '#/components/responses/FailureResponse' requestBody: $ref: '#/components/requestBodies/UserIdRequestBody' security: - JWT-Auth: [] /location/{locationId}/authorized_user/{userId}: delete: parameters: - in: path name: locationId schema: type: string required: true description: Uuid of location to deauthorize for. - in: path name: userId schema: type: string required: true description: Uuid of user ot deauthorize. responses: '200': description: 'Ok' '401': $ref: '#/components/responses/FailureResponse' '422': $ref: '#/components/responses/FailureResponse' security: - JWT-Auth: [ ] components: schemas: Gamenight: title: Gamenight type: object properties: id: type: string name: type: string location_id: type: string datetime: type: string owner_id: type: string required: - id - name - datetime - owner_id Participants: title: participants type: object properties: participants: type: array items: type: string required: - participants Failure: title: Failure type: object properties: message: type: string description: 'Failure Reason' Token: title: Token type: object properties: jwt_token: type: string Login: title: Login type: object properties: username: type: string password: type: string required: - username - password Registration: title: Registration type: object properties: username: type: string email: type: string password: type: string password_repeat: type: string registration_token: type: string required: - username - email - password - password_repeat - registration_token UserId: title: UserId type: object properties: user_id: type: string required: - user_id OwnGame: title: OwnGame type: object properties: user_id: type: string location_id: type: string required: - user_id OwnedGame: title: OwnedGame type: object properties: user_id: type: string game_id: type: string location_id: type: string required: - user_id - game_id LocationId: title: LocationId type: object properties: location_id: type: string required: - location_id AddGamenightRequestBody: title: AddGamenightRequestBody type: object properties: name: type: string datetime: type: string required: - name - datetime GamenightId: title: GamenightId type: object properties: gamenight_id: type: string required: - gamenight_id GameId: title: GameId type: object properties: game_id: type: string required: - game_id User: type: object properties: id: type: string username: type: string email: type: string required: - id - username Game: type: object properties: id: type: string name: type: string required: - id - name AddGameRequestBody: type: object properties: name: type: string required: - name EditGameRequestBody: type: object properties: id: type: string name: type: string required: - id - name GameIdsResponse: type: array items: $ref: "#/components/schemas/GameId" UserIdsResponse: type: array items: $ref: "#/components/schemas/UserId" AddLocationRequestBody: type: object properties: name: type: string address: type: string note: type: string required: - name Location: type: object properties: id: type: string name: type: string address: type: string note: type: string required: - id - name requestBodies: UserIdRequestBody: content: application/json: schema: $ref: '#/components/schemas/UserId' OwnGameRequestBody: content: application/json: schema: $ref: '#/components/schemas/OwnGame' LoginRequest: content: application/json: schema: $ref: '#/components/schemas/Login' RegisterRequest: content: application/json: schema: $ref: '#/components/schemas/Registration' AddGamenight: content: application/json: schema: $ref: '#/components/schemas/AddGamenightRequestBody' GetParticipants: content: application/json: schema: $ref: '#/components/schemas/GamenightId' JoinGamenight: content: application/json: schema: $ref: '#/components/schemas/GamenightId' LeaveGamenight: content: application/json: schema: $ref: '#/components/schemas/GamenightId' AddGameRequest: content: application/json: schema: $ref: '#/components/schemas/AddGameRequestBody' EditGameRequest: content: application/json: schema: $ref: '#/components/schemas/EditGameRequestBody' RemoveGameRequest: content: application/json: schema: $ref: '#/components/schemas/GameId' AddLocationRequest: content: application/json: schema: $ref: '#/components/schemas/AddLocationRequestBody' responses: TokenResponse: description: Example response content: application/json: schema: $ref: '#/components/schemas/Token' FailureResponse: description: Example response content: application/json: schema: $ref: '#/components/schemas/Failure' ParticipantsResponse: description: Response with a list of participant uuids content: application/json: schema: $ref: '#/components/schemas/Participants' GamenightsResponse: description: Example response content: application/json: schema: type: array items: $ref: '#/components/schemas/Gamenight' UsersResponse: description: List of all Users content: application/json: schema: type: array items: $ref: '#/components/schemas/User' GamenightResponse: description: A gamenight being hosted content: application/json: schema: $ref: '#/components/schemas/Gamenight' UserResponse: description: A user in the gamenight system content: application/json: schema: $ref: '#/components/schemas/User' GamesResponse: description: A list of Games in this gamenight instance. content: application/json: schema: type: array items: $ref: '#/components/schemas/Game' GameResponse: description: A game. content: application/json: schema: $ref: '#/components/schemas/Game' GameIdResponse: description: a game id content: application/json: schema: $ref: '#/components/schemas/GameId' GameIdsResponse: description: A list of game ids. content: application/json: schema: $ref: '#/components/schemas/GameIdsResponse' UserIdsResponse: description: A list of user ids. content: application/json: schema: $ref: '#/components/schemas/UserIdsResponse' LocationResponse: description: A location content: application/json: schema: $ref: '#/components/schemas/Location' LocationIdResponse: description: A location Id content: application/json: schema: $ref: '#/components/schemas/LocationId' LocationsResponse: description: A list of all LocationsResponse content: application/json: schema: type: array items: $ref: '#/components/schemas/Location' OwnedGamesResponse: description: A list of OwnedGames content: application/json: schema: type: array items: $ref: '#/components/schemas/OwnedGame' securitySchemes: JWT-Auth: type: http scheme: bearer bearerFormat: JWT description: ''