-
Notifications
You must be signed in to change notification settings - Fork 30
/
api-document.yaml
214 lines (209 loc) · 5.95 KB
/
api-document.yaml
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
swagger: "2.0"
info:
description: "TechTrain MISSION ゲームAPI入門仕様\n
まずはこのAPI仕様に沿って機能を実装してみましょう。\n
\n
この画面の各APIの「Try it out」->「Execute」を利用することで\n
ローカル環境で起動中のAPIにAPIリクエストをすることができます。"
version: "1.0.0"
title: "TechTrain MISSION Game API"
host: "localhost:8080"
tags:
- name: "user"
description: "ユーザ関連API"
- name: "gacha"
description: "ガチャ関連API"
- name: "character"
description: "キャラクター関連API"
schemes:
- "http"
paths:
/user/create:
post:
tags:
- "user"
summary: "ユーザ情報作成API"
description: "ユーザ情報を作成します。\n
ユーザの名前情報をリクエストで受け取り、ユーザIDと認証用のトークンを生成しデータベースへ保存します。"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Request Body"
required: true
schema:
$ref: "#/definitions/UserCreateRequest"
responses:
200:
"description": "A successful response."
"schema":
"$ref": "#/definitions/UserCreateResponse"
/user/get:
get:
tags:
- "user"
summary: "ユーザ情報取得API"
description: "ユーザ情報を取得します。\n
ユーザの認証と特定の処理はリクエストヘッダのx-tokenを読み取ってデータベースに照会をします。"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "header"
name: "x-token"
description: "認証トークン"
required: true
type: "string"
responses:
200:
"description": "A successful response."
"schema":
"$ref": "#/definitions/UserGetResponse"
/user/update:
put:
tags:
- "user"
summary: "ユーザ情報更新API"
description: "ユーザ情報の更新をします。\n
初期実装では名前の更新を行います。"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "header"
name: "x-token"
description: "認証トークン"
required: true
type: "string"
- in: "body"
name: "body"
description: "Request Body"
required: true
schema:
$ref: "#/definitions/UserUpdateRequest"
responses:
200:
"description": "A successful response."
/gacha/draw:
post:
tags:
- "gacha"
summary: "ガチャ実行API"
description: "ガチャを引いてキャラクターを取得する処理を実装します。\n
獲得したキャラクターはユーザ所持キャラクターテーブルへ保存します。\n
同じ種類のキャラクターでもユーザは複数所持することができます。\n
\n
キャラクターの確率は等倍ではなく、任意に変更できるようテーブルを設計しましょう。"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "header"
name: "x-token"
description: "認証トークン"
required: true
type: "string"
- in: "body"
name: "body"
description: "Request Body"
required: true
schema:
$ref: "#/definitions/GachaDrawRequest"
responses:
200:
"description": "A successful response."
"schema":
"$ref": "#/definitions/GachaDrawResponse"
/character/list:
get:
tags:
- "character"
summary: "ユーザ所持キャラクター一覧取得API"
description: "ユーザが所持しているキャラクター一覧情報を取得します。"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "header"
name: "x-token"
description: "認証トークン"
required: true
type: "string"
responses:
200:
"description": "A successful response."
"schema":
"$ref": "#/definitions/CharacterListResponse"
definitions:
UserCreateRequest:
type: "object"
properties:
name:
type: "string"
description: "ユーザ名"
UserCreateResponse:
type: "object"
properties:
token:
type: "string"
description: "クライアント側で保存するトークン"
UserGetResponse:
type: "object"
properties:
name:
type: "string"
description: "ユーザ名"
UserUpdateRequest:
type: "object"
properties:
name:
type: "string"
description: "ユーザ名"
GachaDrawRequest:
type: "object"
properties:
times:
type: "integer"
description: "実行回数"
GachaDrawResponse:
type: "object"
properties:
results:
type: "array"
items:
$ref: "#/definitions/GachaResult"
GachaResult:
type: "object"
properties:
characterID:
type: "string"
description: "キャラクターID"
name:
type: "string"
description: "キャラクター名"
CharacterListResponse:
type: "object"
properties:
characters:
type: "array"
items:
$ref: "#/definitions/UserCharacter"
UserCharacter:
type: "object"
properties:
userCharacterID:
type: "string"
description: "ユニークID"
characterID:
type: "string"
description: "キャラクターID"
name:
type: "string"
description: "キャラクター名"