example.js
3.67 KB
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
/**
* For Details and more examples visit http://apidocjs.com
*/
/**
* @apiDefinePermission admin Admin access rights needed.
* Optionally you can write here further Informations about the permission.
*
* An "apiDefinePermission"-block can have an "apiVersion", so you can attach the block to a specific version.
*
* @apiVersion 0.3.0
*/
/**
* @apiDefinePermission admin This title is visible in version 0.1.0 and 0.2.0
* @apiVersion 0.1.0
*/
/**
* @api {get} /user/:id Read data of a User
* @apiVersion 0.3.0
* @apiName GetUser
* @apiGroup User
* @apiPermission admin
*
* @apiDescription Compare Verison 0.3.0 with 0.2.0 and you will see the green markers with new items in version 0.3.0 and red markers with removed items since 0.2.0.
*
* @apiParam {String} id The Users-ID.
*
* @apiSuccess {String} id The Users-ID.
* @apiSuccess {Date} registered Registration Date.
* @apiSuccess {Date} name Fullname of the User.
*
* @apiError NoAccessRight Only authenticated Admins can access the data.
* @apiError UserNotFound The <code>id</code> of the User was not found.
*
* @apiErrorExample Response (example):
* HTTP/1.1 401 Not Authenticated
* {
* "error": "NoAccessRight"
* }
*/
/**
* @api {get} /user/:id Read data of a User
* @apiVersion 0.2.0
* @apiName GetUser
* @apiGroup User
* @apiPermission admin
*
* @apiDescription Here you can describe the function.
* Multilines are possible.
*
* @apiParam {String} id The Users-ID.
*
* @apiSuccess {String} id The Users-ID.
* @apiSuccess {Date} name Fullname of the User.
*
* @apiError UserNotFound The <code>id</code> of the User was not found.
*/
/**
* @api {get} /user/:id Read data of a User
* @apiVersion 0.1.0
* @apiName GetUser
* @apiGroup User
* @apiPermission admin
*
* @apiDescription Here you can describe the function.
* Multilines are possible.
*
* @apiParam {String} id The Users-ID.
*
* @apiSuccess {String} id The Users-ID.
* @apiSuccess {Date} name Fullname of the User.
*
* @apiError UserNotFound The error description text in version 0.1.0.
*/
/**
* @apiDefineErrorStructure CreateUser
* @apiVersion 0.2.0
*
* @apiError NoAccessRight Only authenticated Admins can access the data.
* @apiError UserNameTooShort Minimum of 5 characters required.
*
* @apiErrorExample Response (example):
* HTTP/1.1 400 Bad Request
* {
* "error": "UserNameTooShort"
* }
*/
/**
* @api {post} /user Create a new User
* @apiVersion 0.3.0
* @apiName PostUser
* @apiGroup User
* @apiPermission none
*
* @apiDescription In this case "apiErrorStructure" is defined and used.
* Define blocks with params that will be used in several functions, so you dont have to rewrite them.
*
* @apiParam {String} name Name of the User.
*
* @apiSuccess {String} id The new Users-ID.
*
* @apiErrorStructure CreateUser
*/
/**
* @api {post} /user Create a User
* @apiVersion 0.2.0
* @apiName PostUser
* @apiGroup User
* @apiPermission none
*
* @apiDescription In this case "apiErrorStructure" is defined and used.
* Define blocks with params that will be used in several functions, so you dont have to rewrite them.
*
* @apiParam {String} name Name of the User.
*
* @apiSuccess {String} id The Users-ID.
*
* @apiErrorStructure CreateUser
*/
/**
* @api {put} /user/:id Change a new User
* @apiVersion 0.3.0
* @apiName PutUser
* @apiGroup User
* @apiPermission none
*
* @apiDescription This function has same errors like POST /user, but errors not defined again, they were included with "apiErrorStructure"
*
* @apiParam {String} name Name of the User.
*
* @apiErrorStructure CreateUser
*/