|
1
|
|
|
// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT |
|
2
|
|
|
// This file was generated by swaggo/swag |
|
3
|
|
|
package docs |
|
4
|
|
|
|
|
5
|
|
|
import ( |
|
6
|
|
|
"bytes" |
|
7
|
|
|
"encoding/json" |
|
8
|
|
|
"strings" |
|
9
|
|
|
"text/template" |
|
10
|
|
|
|
|
11
|
|
|
"github.com/swaggo/swag" |
|
12
|
|
|
) |
|
13
|
|
|
|
|
14
|
|
|
var doc = `{ |
|
15
|
|
|
"schemes": {{ marshal .Schemes }}, |
|
16
|
|
|
"swagger": "2.0", |
|
17
|
|
|
"info": { |
|
18
|
|
|
"description": "{{escape .Description}}", |
|
19
|
|
|
"title": "{{.Title}}", |
|
20
|
|
|
"termsOfService": "http://swagger.io/terms/", |
|
21
|
|
|
"contact": { |
|
22
|
|
|
"name": "API Support", |
|
23
|
|
|
"email": "[email protected]" |
|
24
|
|
|
}, |
|
25
|
|
|
"license": { |
|
26
|
|
|
"name": "Apache 2.0", |
|
27
|
|
|
"url": "http://www.apache.org/licenses/LICENSE-2.0.html" |
|
28
|
|
|
}, |
|
29
|
|
|
"version": "{{.Version}}" |
|
30
|
|
|
}, |
|
31
|
|
|
"host": "{{.Host}}", |
|
32
|
|
|
"basePath": "{{.BasePath}}", |
|
33
|
|
|
"paths": { |
|
34
|
|
|
"/v1/cards/": { |
|
35
|
|
|
"get": { |
|
36
|
|
|
"description": "Get every cards. Shouldn't really be used", |
|
37
|
|
|
"produces": [ |
|
38
|
|
|
"application/json" |
|
39
|
|
|
], |
|
40
|
|
|
"tags": [ |
|
41
|
|
|
"Card" |
|
42
|
|
|
], |
|
43
|
|
|
"summary": "get all cards", |
|
44
|
|
|
"responses": { |
|
45
|
|
|
"200": { |
|
46
|
|
|
"description": "OK", |
|
47
|
|
|
"schema": { |
|
48
|
|
|
"type": "array", |
|
49
|
|
|
"items": { |
|
50
|
|
|
"$ref": "#/definitions/models.Card" |
|
51
|
|
|
} |
|
52
|
|
|
} |
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
} |
|
56
|
|
|
}, |
|
57
|
|
|
"/v1/cards/deck/{deckID}": { |
|
58
|
|
|
"get": { |
|
59
|
|
|
"description": "Get every cards from a deck", |
|
60
|
|
|
"produces": [ |
|
61
|
|
|
"application/json" |
|
62
|
|
|
], |
|
63
|
|
|
"tags": [ |
|
64
|
|
|
"Card" |
|
65
|
|
|
], |
|
66
|
|
|
"summary": "get a list of card", |
|
67
|
|
|
"parameters": [ |
|
68
|
|
|
{ |
|
69
|
|
|
"type": "integer", |
|
70
|
|
|
"description": "Deck ID", |
|
71
|
|
|
"name": "deckID", |
|
72
|
|
|
"in": "path", |
|
73
|
|
|
"required": true |
|
74
|
|
|
} |
|
75
|
|
|
], |
|
76
|
|
|
"responses": { |
|
77
|
|
|
"200": { |
|
78
|
|
|
"description": "OK", |
|
79
|
|
|
"schema": { |
|
80
|
|
|
"type": "array", |
|
81
|
|
|
"items": { |
|
82
|
|
|
"$ref": "#/definitions/models.Card" |
|
83
|
|
|
} |
|
84
|
|
|
} |
|
85
|
|
|
} |
|
86
|
|
|
} |
|
87
|
|
|
} |
|
88
|
|
|
}, |
|
89
|
|
|
"/v1/cards/id/{id}": { |
|
90
|
|
|
"get": { |
|
91
|
|
|
"description": "Get a card by tech id", |
|
92
|
|
|
"produces": [ |
|
93
|
|
|
"application/json" |
|
94
|
|
|
], |
|
95
|
|
|
"tags": [ |
|
96
|
|
|
"Card" |
|
97
|
|
|
], |
|
98
|
|
|
"summary": "get a card", |
|
99
|
|
|
"parameters": [ |
|
100
|
|
|
{ |
|
101
|
|
|
"type": "integer", |
|
102
|
|
|
"description": "Card ID", |
|
103
|
|
|
"name": "id", |
|
104
|
|
|
"in": "path", |
|
105
|
|
|
"required": true |
|
106
|
|
|
} |
|
107
|
|
|
], |
|
108
|
|
|
"responses": { |
|
109
|
|
|
"200": { |
|
110
|
|
|
"description": "OK", |
|
111
|
|
|
"schema": { |
|
112
|
|
|
"$ref": "#/definitions/models.Card" |
|
113
|
|
|
} |
|
114
|
|
|
} |
|
115
|
|
|
} |
|
116
|
|
|
} |
|
117
|
|
|
}, |
|
118
|
|
|
"/v1/cards/next": { |
|
119
|
|
|
"get": { |
|
120
|
|
|
"description": "Get next card", |
|
121
|
|
|
"produces": [ |
|
122
|
|
|
"application/json" |
|
123
|
|
|
], |
|
124
|
|
|
"tags": [ |
|
125
|
|
|
"Card" |
|
126
|
|
|
], |
|
127
|
|
|
"summary": "get a card", |
|
128
|
|
|
"responses": { |
|
129
|
|
|
"200": { |
|
130
|
|
|
"description": "OK", |
|
131
|
|
|
"schema": { |
|
132
|
|
|
"$ref": "#/definitions/models.Card" |
|
133
|
|
|
} |
|
134
|
|
|
} |
|
135
|
|
|
} |
|
136
|
|
|
} |
|
137
|
|
|
}, |
|
138
|
|
|
"/v1/cards/response": { |
|
139
|
|
|
"post": { |
|
140
|
|
|
"description": "Post a response and check it", |
|
141
|
|
|
"produces": [ |
|
142
|
|
|
"application/json" |
|
143
|
|
|
], |
|
144
|
|
|
"tags": [ |
|
145
|
|
|
"Card" |
|
146
|
|
|
], |
|
147
|
|
|
"summary": "post a response", |
|
148
|
|
|
"responses": { |
|
149
|
|
|
"200": { |
|
150
|
|
|
"description": "OK", |
|
151
|
|
|
"schema": { |
|
152
|
|
|
"type": "array", |
|
153
|
|
|
"items": { |
|
154
|
|
|
"$ref": "#/definitions/models.Card" |
|
155
|
|
|
} |
|
156
|
|
|
} |
|
157
|
|
|
} |
|
158
|
|
|
} |
|
159
|
|
|
} |
|
160
|
|
|
}, |
|
161
|
|
|
"/v1/cards/today": { |
|
162
|
|
|
"get": { |
|
163
|
|
|
"description": "Get next today card", |
|
164
|
|
|
"produces": [ |
|
165
|
|
|
"application/json" |
|
166
|
|
|
], |
|
167
|
|
|
"tags": [ |
|
168
|
|
|
"Card" |
|
169
|
|
|
], |
|
170
|
|
|
"summary": "get a card", |
|
171
|
|
|
"responses": { |
|
172
|
|
|
"200": { |
|
173
|
|
|
"description": "OK", |
|
174
|
|
|
"schema": { |
|
175
|
|
|
"$ref": "#/definitions/models.Card" |
|
176
|
|
|
} |
|
177
|
|
|
} |
|
178
|
|
|
} |
|
179
|
|
|
} |
|
180
|
|
|
}, |
|
181
|
|
|
"/v1/decks": { |
|
182
|
|
|
"get": { |
|
183
|
|
|
"description": "Get every deck. Shouldn't really be used, consider using /v1/decks/public instead !", |
|
184
|
|
|
"produces": [ |
|
185
|
|
|
"application/json" |
|
186
|
|
|
], |
|
187
|
|
|
"tags": [ |
|
188
|
|
|
"Deck" |
|
189
|
|
|
], |
|
190
|
|
|
"summary": "get all decks", |
|
191
|
|
|
"responses": { |
|
192
|
|
|
"200": { |
|
193
|
|
|
"description": "OK", |
|
194
|
|
|
"schema": { |
|
195
|
|
|
"$ref": "#/definitions/models.Deck" |
|
196
|
|
|
} |
|
197
|
|
|
} |
|
198
|
|
|
} |
|
199
|
|
|
} |
|
200
|
|
|
}, |
|
201
|
|
|
"/v1/decks/public": { |
|
202
|
|
|
"get": { |
|
203
|
|
|
"description": "Get all public deck", |
|
204
|
|
|
"produces": [ |
|
205
|
|
|
"application/json" |
|
206
|
|
|
], |
|
207
|
|
|
"tags": [ |
|
208
|
|
|
"Deck" |
|
209
|
|
|
], |
|
210
|
|
|
"summary": "get a list of deck", |
|
211
|
|
|
"responses": { |
|
212
|
|
|
"200": { |
|
213
|
|
|
"description": "OK", |
|
214
|
|
|
"schema": { |
|
215
|
|
|
"type": "model" |
|
216
|
|
|
} |
|
217
|
|
|
} |
|
218
|
|
|
} |
|
219
|
|
|
} |
|
220
|
|
|
}, |
|
221
|
|
|
"/v1/decks/user/{userID}": { |
|
222
|
|
|
"get": { |
|
223
|
|
|
"description": "Get decks a user is sub to", |
|
224
|
|
|
"produces": [ |
|
225
|
|
|
"application/json" |
|
226
|
|
|
], |
|
227
|
|
|
"tags": [ |
|
228
|
|
|
"Deck" |
|
229
|
|
|
], |
|
230
|
|
|
"summary": "get a list of deck", |
|
231
|
|
|
"parameters": [ |
|
232
|
|
|
{ |
|
233
|
|
|
"type": "integer", |
|
234
|
|
|
"description": "user ID", |
|
235
|
|
|
"name": "userID", |
|
236
|
|
|
"in": "path", |
|
237
|
|
|
"required": true |
|
238
|
|
|
} |
|
239
|
|
|
], |
|
240
|
|
|
"responses": { |
|
241
|
|
|
"200": { |
|
242
|
|
|
"description": "OK", |
|
243
|
|
|
"schema": { |
|
244
|
|
|
"type": "array", |
|
245
|
|
|
"items": { |
|
246
|
|
|
"$ref": "#/definitions/models.Deck" |
|
247
|
|
|
} |
|
248
|
|
|
} |
|
249
|
|
|
} |
|
250
|
|
|
} |
|
251
|
|
|
} |
|
252
|
|
|
}, |
|
253
|
|
|
"/v1/decks/{id}": { |
|
254
|
|
|
"get": { |
|
255
|
|
|
"description": "Get a deck by tech ID", |
|
256
|
|
|
"produces": [ |
|
257
|
|
|
"application/json" |
|
258
|
|
|
], |
|
259
|
|
|
"tags": [ |
|
260
|
|
|
"Deck" |
|
261
|
|
|
], |
|
262
|
|
|
"summary": "get a deck", |
|
263
|
|
|
"parameters": [ |
|
264
|
|
|
{ |
|
265
|
|
|
"type": "integer", |
|
266
|
|
|
"description": "Deck ID", |
|
267
|
|
|
"name": "id", |
|
268
|
|
|
"in": "path", |
|
269
|
|
|
"required": true |
|
270
|
|
|
} |
|
271
|
|
|
], |
|
272
|
|
|
"responses": { |
|
273
|
|
|
"200": { |
|
274
|
|
|
"description": "OK", |
|
275
|
|
|
"schema": { |
|
276
|
|
|
"type": "model" |
|
277
|
|
|
} |
|
278
|
|
|
} |
|
279
|
|
|
} |
|
280
|
|
|
} |
|
281
|
|
|
}, |
|
282
|
|
|
"/v1/users": { |
|
283
|
|
|
"get": { |
|
284
|
|
|
"description": "Get all users. Shouldn't really be used", |
|
285
|
|
|
"produces": [ |
|
286
|
|
|
"application/json" |
|
287
|
|
|
], |
|
288
|
|
|
"tags": [ |
|
289
|
|
|
"User" |
|
290
|
|
|
], |
|
291
|
|
|
"summary": "get a list of user", |
|
292
|
|
|
"responses": { |
|
293
|
|
|
"200": { |
|
294
|
|
|
"description": "OK", |
|
295
|
|
|
"schema": { |
|
296
|
|
|
"$ref": "#/definitions/models.User" |
|
297
|
|
|
} |
|
298
|
|
|
} |
|
299
|
|
|
} |
|
300
|
|
|
} |
|
301
|
|
|
}, |
|
302
|
|
|
"/v1/users/id/{id}": { |
|
303
|
|
|
"get": { |
|
304
|
|
|
"description": "Get an user by ID.", |
|
305
|
|
|
"produces": [ |
|
306
|
|
|
"application/json" |
|
307
|
|
|
], |
|
308
|
|
|
"tags": [ |
|
309
|
|
|
"User" |
|
310
|
|
|
], |
|
311
|
|
|
"summary": "get an user", |
|
312
|
|
|
"parameters": [ |
|
313
|
|
|
{ |
|
314
|
|
|
"type": "integer", |
|
315
|
|
|
"description": "ID", |
|
316
|
|
|
"name": "id", |
|
317
|
|
|
"in": "path", |
|
318
|
|
|
"required": true |
|
319
|
|
|
} |
|
320
|
|
|
], |
|
321
|
|
|
"responses": { |
|
322
|
|
|
"200": { |
|
323
|
|
|
"description": "OK", |
|
324
|
|
|
"schema": { |
|
325
|
|
|
"$ref": "#/definitions/models.User" |
|
326
|
|
|
} |
|
327
|
|
|
} |
|
328
|
|
|
} |
|
329
|
|
|
} |
|
330
|
|
|
} |
|
331
|
|
|
}, |
|
332
|
|
|
"definitions": { |
|
333
|
|
|
"models.Card": { |
|
334
|
|
|
"type": "object", |
|
335
|
|
|
"properties": { |
|
336
|
|
|
"card_answer": { |
|
337
|
|
|
"type": "string", |
|
338
|
|
|
"example": "42" |
|
339
|
|
|
}, |
|
340
|
|
|
"card_explication": { |
|
341
|
|
|
"type": "string", |
|
342
|
|
|
"example": "The number 42 is the answer to life has written in a very famous book" |
|
343
|
|
|
}, |
|
344
|
|
|
"card_format": { |
|
345
|
|
|
"type": "string", |
|
346
|
|
|
"example": "Date / Name / Country" |
|
347
|
|
|
}, |
|
348
|
|
|
"card_image": { |
|
349
|
|
|
"description": "Should be an url", |
|
350
|
|
|
"type": "string" |
|
351
|
|
|
}, |
|
352
|
|
|
"card_question": { |
|
353
|
|
|
"type": "string", |
|
354
|
|
|
"example": "What's the answer to life ?" |
|
355
|
|
|
}, |
|
356
|
|
|
"card_tips": { |
|
357
|
|
|
"type": "string", |
|
358
|
|
|
"example": "The answer is from a book" |
|
359
|
|
|
}, |
|
360
|
|
|
"card_type": { |
|
361
|
|
|
"type": "integer", |
|
362
|
|
|
"example": 0 |
|
363
|
|
|
}, |
|
364
|
|
|
"deck": { |
|
365
|
|
|
"$ref": "#/definitions/models.Deck" |
|
366
|
|
|
}, |
|
367
|
|
|
"deck_id": { |
|
368
|
|
|
"type": "integer", |
|
369
|
|
|
"example": 1 |
|
370
|
|
|
} |
|
371
|
|
|
} |
|
372
|
|
|
}, |
|
373
|
|
|
"models.Deck": { |
|
374
|
|
|
"type": "object", |
|
375
|
|
|
"properties": { |
|
376
|
|
|
"deck_banner": { |
|
377
|
|
|
"type": "string", |
|
378
|
|
|
"example": "A banner url" |
|
379
|
|
|
}, |
|
380
|
|
|
"deck_description": { |
|
381
|
|
|
"type": "string", |
|
382
|
|
|
"example": "A simple demo deck" |
|
383
|
|
|
}, |
|
384
|
|
|
"deck_name": { |
|
385
|
|
|
"type": "string", |
|
386
|
|
|
"example": "First Deck" |
|
387
|
|
|
}, |
|
388
|
|
|
"deck_status": { |
|
389
|
|
|
"description": "1: Draft - 2: Private - 3: Published", |
|
390
|
|
|
"type": "integer", |
|
391
|
|
|
"example": 0 |
|
392
|
|
|
} |
|
393
|
|
|
} |
|
394
|
|
|
}, |
|
395
|
|
|
"models.User": { |
|
396
|
|
|
"type": "object", |
|
397
|
|
|
"properties": { |
|
398
|
|
|
"email": { |
|
399
|
|
|
"type": "string" |
|
400
|
|
|
}, |
|
401
|
|
|
"user_avatar": { |
|
402
|
|
|
"type": "string", |
|
403
|
|
|
"example": "avatar url" |
|
404
|
|
|
}, |
|
405
|
|
|
"user_bio": { |
|
406
|
|
|
"type": "string", |
|
407
|
|
|
"example": "A simple demo bio" |
|
408
|
|
|
}, |
|
409
|
|
|
"user_discord": { |
|
410
|
|
|
"description": "This is unique", |
|
411
|
|
|
"type": "string", |
|
412
|
|
|
"example": "282233191916634113" |
|
413
|
|
|
}, |
|
414
|
|
|
"user_name": { |
|
415
|
|
|
"description": "This should be unique", |
|
416
|
|
|
"type": "string", |
|
417
|
|
|
"example": "Yume" |
|
418
|
|
|
}, |
|
419
|
|
|
"user_permissions": { |
|
420
|
|
|
"description": "0: User; 1: Mod; 2: Admin", |
|
421
|
|
|
"type": "integer", |
|
422
|
|
|
"example": 0 |
|
423
|
|
|
} |
|
424
|
|
|
} |
|
425
|
|
|
} |
|
426
|
|
|
} |
|
427
|
|
|
}` |
|
428
|
|
|
|
|
429
|
|
|
type swaggerInfo struct { |
|
430
|
|
|
Version string |
|
431
|
|
|
Host string |
|
432
|
|
|
BasePath string |
|
433
|
|
|
Schemes []string |
|
434
|
|
|
Title string |
|
435
|
|
|
Description string |
|
436
|
|
|
} |
|
437
|
|
|
|
|
438
|
|
|
// SwaggerInfo holds exported Swagger Info so clients can modify it |
|
439
|
|
|
var SwaggerInfo = swaggerInfo{ |
|
440
|
|
|
Version: "1.0", |
|
441
|
|
|
Host: "localhost:1813", |
|
442
|
|
|
BasePath: "/api", |
|
443
|
|
|
Schemes: []string{}, |
|
444
|
|
|
Title: "Memnix", |
|
445
|
|
|
Description: "This is a sample swagger for Fiber", |
|
446
|
|
|
} |
|
447
|
|
|
|
|
448
|
|
|
type s struct{} |
|
449
|
|
|
|
|
450
|
|
|
func (s *s) ReadDoc() string { |
|
451
|
|
|
sInfo := SwaggerInfo |
|
452
|
|
|
sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1) |
|
453
|
|
|
|
|
454
|
|
|
t, err := template.New("swagger_info").Funcs(template.FuncMap{ |
|
455
|
|
|
"marshal": func(v interface{}) string { |
|
456
|
|
|
a, _ := json.Marshal(v) |
|
457
|
|
|
return string(a) |
|
458
|
|
|
}, |
|
459
|
|
|
"escape": func(v interface{}) string { |
|
460
|
|
|
// escape tabs |
|
461
|
|
|
str := strings.Replace(v.(string), "\t", "\\t", -1) |
|
462
|
|
|
// replace " with \", and if that results in \\", replace that with \\\" |
|
463
|
|
|
str = strings.Replace(str, "\"", "\\\"", -1) |
|
464
|
|
|
return strings.Replace(str, "\\\\\"", "\\\\\\\"", -1) |
|
465
|
|
|
}, |
|
466
|
|
|
}).Parse(doc) |
|
467
|
|
|
if err != nil { |
|
468
|
|
|
return doc |
|
469
|
|
|
} |
|
470
|
|
|
|
|
471
|
|
|
var tpl bytes.Buffer |
|
472
|
|
|
if err := t.Execute(&tpl, sInfo); err != nil { |
|
473
|
|
|
return doc |
|
474
|
|
|
} |
|
475
|
|
|
|
|
476
|
|
|
return tpl.String() |
|
477
|
|
|
} |
|
478
|
|
|
|
|
479
|
|
|
func init() { |
|
480
|
|
|
swag.Register(swag.Name, &s{}) |
|
481
|
|
|
} |
|
482
|
|
|
|