Skip to content

Commit

Permalink
Merge pull request #9 from M2GIL/dev
Browse files Browse the repository at this point in the history
v1
  • Loading branch information
z3ddycus committed Feb 11, 2017
2 parents 0689424 + 6f71561 commit df712bd
Show file tree
Hide file tree
Showing 72 changed files with 4,785 additions and 244 deletions.
6 changes: 6 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"THE BEER-WARE LICENSE" (Revision 42):
[email protected] wrote this file. As long as you retain this notice you
can do whatever you want with this stuff. If we meet some day, and you think
this stuff is worth it, you can buy me a beer in return.

M2GIL 2017
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# iataaa-server
# Iataaa Server
Iataaa Server is web platform which manages draught game beetween web services.

## Getting Started
### Building the project
Execute `mvn clean install` in the root directory to build maven project.

### Deploy the project
Execute `mvn spring-boot:run` in the root directory to deploy spring boot project.

Navigate to http://localhost:8080.

You can to change the default port in `/src/main/resources/application.properties`

## Documentation
* [See the docs](https://github.com/M2GIL/IAtaaa-server/wiki/Communication)
3 changes: 3 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

mvn spring-boot:run
124 changes: 124 additions & 0 deletions docs/endpoints/games.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
get :
description : Get game names.
responses :
200 :
body :
application/json :
type : GameLibrary.GamesNamesResponse
example :
content :
- game1
- game2
status : OK
post :
description : Create game.
body:
application/json:
type: GameLibrary.GamePlayers
responses :
204 :
description : Game created.
409 :
description : Error in creation game.
body :
application/json :
type : GameLibrary.GamesPlayersResponse
example :
content :
- #1
gameID: aiGame1
players :
- p1
- p2
- #2
gameID: aiGame2
players :
- p3
- p4
status : PLAYERS_NO_FOUND


/{gameId} :
get :
description : Get game with game id.
responses :
200 :
body :
application/json :
type : GameLibrary.GamesStatusResponse
example:
content :
id : string
players :
- #1
type : IA
name : ai1
url : localhost:9999
difficulty : HARD
- #2
type : IA
name : ai2
url : localhost:9998
difficulty : HARD
board :
list :
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 3
- 3
- 3
- 3
- 3
- 3
- 3
- 3
- 3
- 3
- 3
- 3
- 3
- 3
- 3
- 3
- 3
- 3
- 3
- 3
whiteTurn : true
status : OK

delete :
description : Delete game with game id.
responses :
204 :
description : Game deleted.
404 :
description : Game not found.
65 changes: 65 additions & 0 deletions docs/endpoints/players.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
post :
description : Create player.
body:
application/json:
type: PlayerLibrary.Player
responses :
204 :
description : Player created.
400 :
description : Error in request.
body:
application/json:
type: PlayerLibrary.PlayerResponse
example :
content :
type : IA
name : ia1
url : localhost:9999
difficulty : HARD
status : NAME_PLAYER_NOT_AVAILABLE

get :
description : Get players.
responses :
200 :
body:
application/json:
type: PlayerLibrary.PlayersResponse
example :
content :
- #1
type : IA
name : ia1
url : localhost:9999
difficulty : HARD
- #2
type : IA
name : ia2
url : localhost:9998
difficulty : HARD
status : OK

/{name} :
get :
description : Get player with name.
responses :
200 :
body:
application/json:
type: PlayerLibrary.PlayerResponse
example :
content :
type : IA
name : ia1
url : localhost:9999
difficulty : HARD
status : OK
/{playerId} :
delete :
description : Get player with name.
responses :
204 :
description : Player deleted.
404 :
description : Player not found.
13 changes: 13 additions & 0 deletions docs/iataaa.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#%RAML 1.0
title: Iataaa
version: v1.0
baseUri: /api
mediaType: application/json

uses:
PlayerLibrary : types/playerLibrary.raml
GameLibrary : types/gameLibrary.raml
ResponseLibrary : types/responseLibrary.raml

/games : !include endpoints/games.raml
/players : !include endpoints/players.raml
7 changes: 7 additions & 0 deletions docs/toHtml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

raml2html iataaa.raml > ../index.html

if [ $? -eq 0 ]; then
nohup xdg-open ../index.html >/dev/null 2>&1
fi
60 changes: 60 additions & 0 deletions docs/types/gameLibrary.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#%RAML 1.0 Library

uses:
PlayerLibrary : playerLibrary.raml
ResponseLibrary : responseLibrary.raml

types :

Case :
type : integer
description: It's pawn code. 0 = EMPTY, 1 = BLACK PWAN, 2 = BLACK KING, 3 = WHITE PWAN and 4 = WHITE KING
minimum: 0
maximum: 4

Board :
type : object
properties:
list : Case[]

GameStatus :
type : object
properties :
id : string
players : PlayerLibrary.Player[]
board : Board
whiteTurn : boolean

GamePlayers :
type : object
properties :
gameID : string
players :
type : string[]
description : Players Names.
example:
gameID: aiGame
players :
- p1
- p2

# -------------------
# RESPONSE
# -------------------
GamesStatusResponse :
type : object
properties:
content : GameStatus
status : ResponseLibrary.StatusType

GamesNamesResponse :
type : object
properties:
content : string[]
status : ResponseLibrary.StatusType

GamesPlayersResponse :
type : object
properties:
content : GamePlayers[]
status : ResponseLibrary.StatusType
40 changes: 40 additions & 0 deletions docs/types/playerLibrary.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#%RAML 1.0 Library

uses:
ResponseLibrary : responseLibrary.raml

types :
PlayerType :
enum: [IA, HUMAN]

Difficulty :
enum : [EASY, MEDIUM, HARD]

Player :
type : object
properties :
type : PlayerType
name : string
url : string
difficulty : Difficulty
example:
type : IA
name : ia1
url : localhost:9999
difficulty : HARD


# -------------------
# RESPONSE
# -------------------
PlayerResponse :
type : object
properties:
content : Player
status : ResponseLibrary.StatusType

PlayersResponse :
type : object
properties:
content : Player[]
status : ResponseLibrary.StatusType
14 changes: 14 additions & 0 deletions docs/types/responseLibrary.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#%RAML 1.0 Library

types :
StatusType :
type : string
enum : [
OK,
ERROR,
INVALIDE_ARGUMENT,
PLAYERS_NO_FOUND,
NAME_PLAYER_NOT_AVAILABLE,
NAME_GAME_NOT_AVAILABLE,
BUSY_IA
]
Loading

0 comments on commit df712bd

Please sign in to comment.