-
Notifications
You must be signed in to change notification settings - Fork 1
/
apiary.apib
133 lines (99 loc) · 3.38 KB
/
apiary.apib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
FORMAT: 1A
# RESTChess
# Group Home
## Home [/]
The home page.
+ Model
{
"_links": {
"self": { "href": "/" },
"games": [
{ "href": "/chess-game/23j89nuklyedsio/" }
],
"bot-queue": { "href": "/queue/bot" },
"human-queue": { "href": "/queue/human" }
}
}
### Read homepage [GET]
+ Response 200 (application/hal+json)
[Home][]
# Group Chess Game
## Chess Game [/chess-game/23j89nuklyedsio/]
A chess game.
+ Model
{
"current-state" : "tag:chess.mogsie.com,2001:game-in-progress",
"data" : {
"board" : "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
},
"recent-events" : [
{
"type" : "work-completed",
"name": "make-a-move",
"data": {
"move" : "e4"
}
}
],
"_links": {
"curies" : [
{
"name": "workflow",
"href": "http://TBD/{rel}",
"templated": true
}
],
"workflow:make-decisions": {
"href": "/chess-game/23j89nuklyedsio/make-decisions"
}
}
}
### Retrieve game status [GET]
+ Response 200 (application/vnd.mogsie.workflow.decisions+json)
[Chess Game][]
## Decisions [/chess-game/23j89nuklyedsio/make-decisions]
The decisions a client needs to make for a game.
### Make game decisions [POST]
+ Request (application/vnd.mogsie.workflow.decisions+json)
+ Body
{
"current-state" : "tag:chess.mogsie.com,2001:game-in-progress",
"data" : {
"board" : "rnbqkbnr/pppp1ppp/8/4p3/8/8/PPPPPPPP/RNBQKBNR b KQkq - 0 1"
},
"decisions": [
{
"type": "schedule-work",
"name": "make-a-move",
"queue": "bots",
"work": {
"type": "http://mogsie.com/static/workflow/make-chess-move",
"input": {
"board" : "rnbqkbnr/pppp1ppp/8/4p3/8/8/PPPPPPPP/RNBQKBNR b KQkq - 0 1",
"legal-moves" : [ "a5", "a6", "b5", "b6", "c5", "c6" ]
}
}
}
]
}
+ Response 201
# Group Queues
## Queue [/queues/{id}]
Retrieve the next work-order from the queue. May be expanded in the future to contain a collection of work orders.
+ Model
{
"type": "http://mogsie.com/static/workflow/make-chess-move",
"input": {
"board" : "rnbqkbnr/pppp1ppp/8/4p3/8/8/PPPPPPPP/RNBQKBNR b KQkq - 0 1",
"legal-moves" : [ "a5", "a6", "b5", "b6", "c5", "c6" ]
},
"complete": "/work-orders/7d7e587b-9d8c-48bd-bdec-35e0707f173f"
}
### Get a work order [GET]
+ Response 200 (application/vnd.mogsie.work-order+json)
[Queue][]
## Work Orders [/work-orders/{id}]
### Complete a work order [POST]
+ Request (application/x-www-form-urlencoded)
move=b5
+ Response 200