-
Notifications
You must be signed in to change notification settings - Fork 16
/
ExampleAPI.jrgen.json
298 lines (298 loc) · 8.41 KB
/
ExampleAPI.jrgen.json
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
{
"$schema": "https://rawgit.com/mzernetsch/jrgen/master/jrgen-spec.schema.json",
"jrgen": "1.2",
"jsonrpc": "2.0",
"info": {
"title": "Example API",
"description": [
"An example api which handles various rpc requests.",
"This api follows the json-rpc 2.0 specification. More information available at http://www.jsonrpc.org/specification."
],
"version": "1.0",
"servers": [
{
"url": "https://www.example.org",
"description": "Production environment"
},
{
"url": "https://www.test.example.org",
"description": "Test environment"
}
]
},
"definitions": {
"session": {
"type": "object",
"properties": {
"session_token": {
"description": "Bearer token of the created session.",
"examples": ["123456890"],
"type": "string",
"minLength": 1
},
"validity": {
"description": "Validity of the session token in seconds.",
"examples": [3600],
"type": "number",
"multipleOf": 1
}
},
"required": ["session_token"]
}
},
"methods": {
"Session.Login": {
"summary": "Creates a new session.",
"description": "Authenticates the user using the provided credentials and creates a new session.",
"tags": ["Session"],
"params": {
"type": "object",
"properties": {
"name": {
"description": "Name of the user to create a session for.",
"examples": ["admin"],
"type": "string",
"minLength": 1
},
"password": {
"description": "Password of the user to create a session for.",
"examples": ["123456"],
"type": "string",
"minLength": 1
}
},
"required": ["name", "password"]
},
"result": {
"$ref": "#/definitions/session"
},
"errors": [
{
"description": "The provided credentials are invalid.",
"code": 1,
"message": "InvalidCredentials"
}
]
},
"Session.Logout": {
"summary": "Destroys an existing session.",
"tags": ["Session"],
"result": {
"description": "Always '0'.",
"examples": [0],
"type": "number",
"minimum": 0,
"maximum": 0
},
"errors": [
{
"description": "Session could not be found.",
"code": 2,
"message": "NotFound"
}
]
},
"Session.KeepAlive": {
"summary": "Refreshs an existing session.",
"description": "Refreshs an existing session so that it keeps alive and doesn't time out. This method does nothing but refreshing the timeout.",
"tags": ["Session"],
"result": {
"description": "Always '0'.",
"examples": [0],
"type": "number",
"minimum": 0,
"maximum": 0
},
"errors": [
{
"description": "Session could not be found.",
"code": 2,
"message": "NotFound"
}
]
},
"User.Add": {
"summary": "Adds a new user.",
"tags": ["User"],
"params": {
"type": "object",
"properties": {
"name": {
"description": "Name of the user to add.",
"examples": ["user"],
"anyOf": [
{ "type": "string", "minLength": 1 },
{ "type": "number", "multipleOf": 1 }
]
},
"email": {
"description": "Email of the user to add.",
"examples": ["user@example.org"],
"type": "string",
"allOf": [{ "type": "string", "format": "email" }]
},
"address": {
"description": "Address of the user to add.",
"type": "array",
"items": [
{
"description": "Address number.",
"examples": [1600],
"type": "number",
"minimum": 1
},
{
"description": "Name of the street.",
"examples": ["Pennsylvania"],
"type": "string",
"minLength": 1
},
{
"description": "Type of the street.",
"examples": ["Avenue"],
"type": "string",
"enum": ["Street", "Avenue", "Boulevard"]
},
{
"description": "City quadrant of the address",
"examples": ["NW"],
"type": "string",
"enum": ["NW", "NE", "SW", "SE"]
}
]
},
"password": {
"description": "Password of the user to add.",
"examples": ["1234567890"],
"type": "string",
"minLength": 1
}
},
"required": ["name", "email", "password"]
},
"result": {
"description": "Always '0'.",
"examples": [0],
"type": "number",
"minimum": 0,
"maximum": 0
},
"errors": [
{
"description": "A user with that name already exists.",
"code": 3,
"message": "Already exists"
}
]
},
"User.Delete": {
"summary": "Deletes an existing user.",
"tags": ["User"],
"params": {
"oneOf": [
{
"type": "object",
"properties": {
"name": {
"description": "Name of the user to delete.",
"examples": ["user"],
"type": "string",
"minLength": 1,
"pattern": "^(A|B)\\-.*$"
}
},
"required": ["name"]
},
{
"type": "object",
"properties": {
"id": {
"description": "Id of the user to delete.",
"examples": ["1"],
"type": "string",
"minLength": 1
}
},
"required": ["id"]
}
]
},
"result": {
"description": "Always '0'.",
"examples": [0],
"type": "number",
"minimum": 0,
"maximum": 0
},
"errors": [
{
"description": "A user with that name could not be found.",
"code": 2,
"message": "Not found"
}
]
},
"User.GetAll": {
"summary": "Returns all users.",
"description": "This method returns an array with information about all existing users.",
"tags": ["User"],
"result": {
"description": "List of all existing users.",
"type": "array",
"items": {
"description": "Information about a user.",
"type": "object",
"properties": {
"name": {
"description": "Name of the user.",
"examples": ["user"],
"type": "string",
"minLength": 1
},
"email": {
"description": "Email of the user.",
"examples": ["user@example.org"],
"type": "string",
"format": "email"
},
"address": {
"description": "Address of the user to add.",
"type": "array",
"items": [
{
"name": "number",
"description": "Address number.",
"examples": [1600],
"type": "number",
"minimum": 1
},
{
"name": "street_name",
"description": "Name of the street.",
"examples": ["Pennsylvania"],
"type": "string",
"minLength": 1
},
{
"name": "street_type",
"description": "Type of the street.",
"examples": ["Avenue"],
"type": "string",
"enum": ["Street", "Avenue", "Boulevard"]
},
{
"name": "direction",
"description": "City quadrant of the address",
"examples": ["NW"],
"type": "string",
"enum": ["NW", "NE", "SW", "SE"]
}
]
}
},
"required": ["name", "email", "address"]
}
}
}
}
}