Skip to content

Commit df712bd

Browse files
authored
Merge pull request #9 from M2GIL/dev
v1
2 parents 0689424 + 6f71561 commit df712bd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+4785
-244
lines changed

LICENSE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"THE BEER-WARE LICENSE" (Revision 42):
2+
gdn.anthony@gmail.com wrote this file. As long as you retain this notice you
3+
can do whatever you want with this stuff. If we meet some day, and you think
4+
this stuff is worth it, you can buy me a beer in return.
5+
6+
M2GIL 2017

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1-
# iataaa-server
1+
# Iataaa Server
2+
Iataaa Server is web platform which manages draught game beetween web services.
23

4+
## Getting Started
5+
### Building the project
6+
Execute `mvn clean install` in the root directory to build maven project.
37

8+
### Deploy the project
9+
Execute `mvn spring-boot:run` in the root directory to deploy spring boot project.
10+
11+
Navigate to http://localhost:8080.
12+
13+
You can to change the default port in `/src/main/resources/application.properties`
14+
15+
## Documentation
16+
* [See the docs](https://github.com/M2GIL/IAtaaa-server/wiki/Communication)

deploy.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
mvn spring-boot:run

docs/endpoints/games.raml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
get :
2+
description : Get game names.
3+
responses :
4+
200 :
5+
body :
6+
application/json :
7+
type : GameLibrary.GamesNamesResponse
8+
example :
9+
content :
10+
- game1
11+
- game2
12+
status : OK
13+
post :
14+
description : Create game.
15+
body:
16+
application/json:
17+
type: GameLibrary.GamePlayers
18+
responses :
19+
204 :
20+
description : Game created.
21+
409 :
22+
description : Error in creation game.
23+
body :
24+
application/json :
25+
type : GameLibrary.GamesPlayersResponse
26+
example :
27+
content :
28+
- #1
29+
gameID: aiGame1
30+
players :
31+
- p1
32+
- p2
33+
- #2
34+
gameID: aiGame2
35+
players :
36+
- p3
37+
- p4
38+
status : PLAYERS_NO_FOUND
39+
40+
41+
/{gameId} :
42+
get :
43+
description : Get game with game id.
44+
responses :
45+
200 :
46+
body :
47+
application/json :
48+
type : GameLibrary.GamesStatusResponse
49+
example:
50+
content :
51+
id : string
52+
players :
53+
- #1
54+
type : IA
55+
name : ai1
56+
url : localhost:9999
57+
difficulty : HARD
58+
- #2
59+
type : IA
60+
name : ai2
61+
url : localhost:9998
62+
difficulty : HARD
63+
board :
64+
list :
65+
- 1
66+
- 1
67+
- 1
68+
- 1
69+
- 1
70+
- 1
71+
- 1
72+
- 1
73+
- 1
74+
- 1
75+
- 1
76+
- 1
77+
- 1
78+
- 1
79+
- 1
80+
- 1
81+
- 1
82+
- 1
83+
- 1
84+
- 1
85+
- 0
86+
- 0
87+
- 0
88+
- 0
89+
- 0
90+
- 0
91+
- 0
92+
- 0
93+
- 0
94+
- 0
95+
- 3
96+
- 3
97+
- 3
98+
- 3
99+
- 3
100+
- 3
101+
- 3
102+
- 3
103+
- 3
104+
- 3
105+
- 3
106+
- 3
107+
- 3
108+
- 3
109+
- 3
110+
- 3
111+
- 3
112+
- 3
113+
- 3
114+
- 3
115+
whiteTurn : true
116+
status : OK
117+
118+
delete :
119+
description : Delete game with game id.
120+
responses :
121+
204 :
122+
description : Game deleted.
123+
404 :
124+
description : Game not found.

docs/endpoints/players.raml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
post :
2+
description : Create player.
3+
body:
4+
application/json:
5+
type: PlayerLibrary.Player
6+
responses :
7+
204 :
8+
description : Player created.
9+
400 :
10+
description : Error in request.
11+
body:
12+
application/json:
13+
type: PlayerLibrary.PlayerResponse
14+
example :
15+
content :
16+
type : IA
17+
name : ia1
18+
url : localhost:9999
19+
difficulty : HARD
20+
status : NAME_PLAYER_NOT_AVAILABLE
21+
22+
get :
23+
description : Get players.
24+
responses :
25+
200 :
26+
body:
27+
application/json:
28+
type: PlayerLibrary.PlayersResponse
29+
example :
30+
content :
31+
- #1
32+
type : IA
33+
name : ia1
34+
url : localhost:9999
35+
difficulty : HARD
36+
- #2
37+
type : IA
38+
name : ia2
39+
url : localhost:9998
40+
difficulty : HARD
41+
status : OK
42+
43+
/{name} :
44+
get :
45+
description : Get player with name.
46+
responses :
47+
200 :
48+
body:
49+
application/json:
50+
type: PlayerLibrary.PlayerResponse
51+
example :
52+
content :
53+
type : IA
54+
name : ia1
55+
url : localhost:9999
56+
difficulty : HARD
57+
status : OK
58+
/{playerId} :
59+
delete :
60+
description : Get player with name.
61+
responses :
62+
204 :
63+
description : Player deleted.
64+
404 :
65+
description : Player not found.

docs/iataaa.raml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#%RAML 1.0
2+
title: Iataaa
3+
version: v1.0
4+
baseUri: /api
5+
mediaType: application/json
6+
7+
uses:
8+
PlayerLibrary : types/playerLibrary.raml
9+
GameLibrary : types/gameLibrary.raml
10+
ResponseLibrary : types/responseLibrary.raml
11+
12+
/games : !include endpoints/games.raml
13+
/players : !include endpoints/players.raml

docs/toHtml.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
raml2html iataaa.raml > ../index.html
4+
5+
if [ $? -eq 0 ]; then
6+
nohup xdg-open ../index.html >/dev/null 2>&1
7+
fi

docs/types/gameLibrary.raml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#%RAML 1.0 Library
2+
3+
uses:
4+
PlayerLibrary : playerLibrary.raml
5+
ResponseLibrary : responseLibrary.raml
6+
7+
types :
8+
9+
Case :
10+
type : integer
11+
description: It's pawn code. 0 = EMPTY, 1 = BLACK PWAN, 2 = BLACK KING, 3 = WHITE PWAN and 4 = WHITE KING
12+
minimum: 0
13+
maximum: 4
14+
15+
Board :
16+
type : object
17+
properties:
18+
list : Case[]
19+
20+
GameStatus :
21+
type : object
22+
properties :
23+
id : string
24+
players : PlayerLibrary.Player[]
25+
board : Board
26+
whiteTurn : boolean
27+
28+
GamePlayers :
29+
type : object
30+
properties :
31+
gameID : string
32+
players :
33+
type : string[]
34+
description : Players Names.
35+
example:
36+
gameID: aiGame
37+
players :
38+
- p1
39+
- p2
40+
41+
# -------------------
42+
# RESPONSE
43+
# -------------------
44+
GamesStatusResponse :
45+
type : object
46+
properties:
47+
content : GameStatus
48+
status : ResponseLibrary.StatusType
49+
50+
GamesNamesResponse :
51+
type : object
52+
properties:
53+
content : string[]
54+
status : ResponseLibrary.StatusType
55+
56+
GamesPlayersResponse :
57+
type : object
58+
properties:
59+
content : GamePlayers[]
60+
status : ResponseLibrary.StatusType

docs/types/playerLibrary.raml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#%RAML 1.0 Library
2+
3+
uses:
4+
ResponseLibrary : responseLibrary.raml
5+
6+
types :
7+
PlayerType :
8+
enum: [IA, HUMAN]
9+
10+
Difficulty :
11+
enum : [EASY, MEDIUM, HARD]
12+
13+
Player :
14+
type : object
15+
properties :
16+
type : PlayerType
17+
name : string
18+
url : string
19+
difficulty : Difficulty
20+
example:
21+
type : IA
22+
name : ia1
23+
url : localhost:9999
24+
difficulty : HARD
25+
26+
27+
# -------------------
28+
# RESPONSE
29+
# -------------------
30+
PlayerResponse :
31+
type : object
32+
properties:
33+
content : Player
34+
status : ResponseLibrary.StatusType
35+
36+
PlayersResponse :
37+
type : object
38+
properties:
39+
content : Player[]
40+
status : ResponseLibrary.StatusType

docs/types/responseLibrary.raml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#%RAML 1.0 Library
2+
3+
types :
4+
StatusType :
5+
type : string
6+
enum : [
7+
OK,
8+
ERROR,
9+
INVALIDE_ARGUMENT,
10+
PLAYERS_NO_FOUND,
11+
NAME_PLAYER_NOT_AVAILABLE,
12+
NAME_GAME_NOT_AVAILABLE,
13+
BUSY_IA
14+
]

0 commit comments

Comments
 (0)