This repository has been archived by the owner on Dec 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
api.raml
507 lines (506 loc) · 18.8 KB
/
api.raml
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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
#%RAML 1.0
title: SPAMD-UL
version: 4.0.0
mediaType: application/json
uses:
types: ./libraries/types.raml
/api/users:
description: Collection of users
post:
description: Add a new user
body:
application/json:
type: types.User
example: !include examples/users/post-users-request.json
responses:
201:
description: Id for newly created account of user
body:
application/json:
type: types.AccountIdObject
example: !include examples/users/post-users-response.json
400:
description: Error adding user
/{accountId}:
description: User with given account id
uriParameters:
accountId:
type: types.AccountId
get:
description: Get the user's information
responses:
200:
description: Requested user
body:
application/json:
type: types.User
example: !include examples/users/get-users-response.json
400:
description: Error getting user
404:
description: User not found
/bills:
description: Collection of bills for user
get:
description: Get the user's bills
responses:
200:
description: Requested user's bills
body:
application/json:
type: types.Bill[]
example: !include examples/users/get-users-bills-response.json
400:
description: Error getting user's bills
404:
description: User not found
/{billId}:
description: Bill of user with given bill id
uriParameters:
billId:
type: types.BillId
post:
description: Pay an amount of the user's bills
body:
application/json:
type: types.BillPayment
example: !include examples/users/post-users-bills-request.json
responses:
200:
description: Bill after payment
body:
application/json:
type: types.Bill
example: !include examples/users/post-users-bills-response.json
400:
description: Error paying user's bills
404:
description: User or bill not found
/cars:
description: Collection of cars for user
post:
description: Add a new car to user
body:
application/json:
type: types.Car
example: !include examples/users/post-users-cars-request.json
responses:
201:
description: Car successfully added to user
400:
description: Error adding car to user
404:
description: User not found
409:
description: License plate already exists
get:
description: Get all cars of user
responses:
201:
description: All cars of user
body:
application/json:
type: types.Car[]
example: !include examples/users/get-users-cars-request.json
400:
description: Error getting cars of user
404:
description: User not found
/accessPasses:
description: Collection of access passes for user
post:
description: Add a access pass to user
body:
application/json:
type: types.AccessPass
examples:
"Without car": !include examples/users/post-users-access-passes-request-without-car.json
"One day a week per semester": !include examples/users/post-users-access-passes-request-one-day-a-week-per-semester.json
"One semester": !include examples/users/post-users-access-passes-request-one-semester.json
"Two semesters": !include examples/users/post-users-access-passes-request-two-semesters.json
"Three semesters": !include examples/users/post-users-access-passes-request-three-semesters.json
responses:
201:
description: Code for newly added access pass
body:
application/json:
type: types.AccessPassCodeObject
example: !include examples/users/post-users-access-passes-response.json
400:
description: Error adding access pass to user
404:
description: User or license plate not found
/bicycleAccessPasses:
description: Collection of access passes for user
post:
description: Add a access pass for bicycle to user
body:
application/json:
type: types.BicycleAccessPass
examples:
"With postal": !include examples/users/post-users-bicycle-access-passes-request-with-postal.json
"With email": !include examples/users/post-users-bicycle-access-passes-request-with-email.json
"With ssp": !include examples/users/post-users-bicycle-access-passes-request-with-ssp.json
responses:
201:
description: Code for newly added access pass
body:
application/json:
type: types.AccessPassCodeObject
example: !include examples/users/post-users-access-passes-response.json
400:
description: Error adding access pass to user
404:
description: User not found
/parkingStickers:
description: Collection of parking stickers for user
post:
description: Add a parking sticker to user
body:
application/json:
type: types.ParkingSticker
examples:
"Send via postal carrier": !include examples/users/post-users-parking-stickers-request-postal.json
"Sent via email": !include examples/users/post-users-parking-stickers-request-email.json
"Sent via SSP": !include examples/users/post-users-parking-stickers-request-ssp.json
responses:
201:
description: Code for newly added parking sticker
body:
application/json:
type: types.ParkingStickerCodeObject
example: !include examples/users/post-users-parking-stickers-response.json
400:
description: Error adding parking sticker to user
404:
description: User not found
/api/parkingAreas:
description: Collection of parking areas
get:
description: Get all parking areas
responses:
200:
description: All parking areas
body:
application/json:
type: types.ParkingArea[]
example: !include examples/parkingAreas/get-parking-areas-response.json
400:
description: Error getting all parking areas
/api/gates:
description: Gate entry for campus access
/entry:
/validateAccessPassWithCode:
/{code}:
description: Validates an access pass for entering with a given code
uriParameters:
code:
type: types.AccessPassCode
post:
description: Validate the access pass with given code
body:
application/json:
type: types.AccessDateTimeObject
example: !include examples/gates/post-gates-entry-validate-access-pass-request.json
responses:
202:
description: Access status of access pass is granted
body:
application/json:
type: types.AccessStatusObject
example: !include examples/gates/post-gates-entry-validate-access-pass-response-granted.json
400:
description: Error validating access pass
403:
description: Access status of access pass is refused
body:
application/json:
type: types.AccessStatusObject
example: !include examples/gates/post-gates-entry-validate-access-pass-response-refused.json
404:
description: Access pass not found
/validateAccessPassWithLicensePlate:
/{licensePlate}:
description: Validates an access pass for given license plate
uriParameters:
licensePlate:
type: types.LicensePlate
post:
description: Validate the access pass with given license plate
body:
application/json:
type: types.AccessDateTimeObject
example: !include examples/gates/post-gates-entry-validate-access-pass-request.json
responses:
202:
description: Access status of access pass is granted
body:
application/json:
type: types.AccessStatusObject
example: !include examples/gates/post-gates-entry-validate-access-pass-response-granted.json
400:
description: Error validating access pass
403:
description: Access status of access pass is refused
body:
application/json:
type: types.AccessStatusObject
example: !include examples/gates/post-gates-entry-validate-access-pass-response-refused.json
404:
description: Access pass or license plate not found
/exit:
/validateAccessPassWithCode:
/{code}:
description: Validates an access pass for entering with a given code
uriParameters:
code:
type: types.AccessPassCode
post:
description: Validate the access pass with given code
responses:
200:
description: Gate exit was successful
404 :
description: Access pass not found
/validateAccessPassWithLicensePlate:
/{licensePlate}:
description: Validates an access pass for given license plate
uriParameters:
licensePlate:
type: types.LicensePlate
post:
description: Validate the access pass with given license plate
responses:
200:
description: Gate exit was successful
404 :
description: Access pass or license plate not found
/api/offenses:
description: Collection of offenses
/types:
description: Collection of all possible offense types
get:
description: Get all possible offense types
responses:
200:
description: All offense types
body:
application/json:
type: types.OffenseType[]
example: !include examples/offenses/get-offense-types-response.json
400:
description: Error getting offense types
/validate:
description: Validations of offenses
post:
description: Check offense for the parking sticker
body:
application/json:
type: types.OffenseValidation
example: !include examples/offenses/get-offenses-validate-request.json
responses:
200:
description: |
List of offense types of parking sticker code
An offense with a valid parking sticker code will generate a bill to its associated
user, with the exception of an offense for an invalid (or absent) parking sticker code.
In that case, the offense type will be correctly responded but no bill will be
generated, since it would be impossible to find a user.
body:
application/json:
type: types.OffenseType[]
examples:
"With offense types": !include examples/offenses/get-offenses-validate-response-with-offense-types.json
"Without offense type": !include examples/offenses/get-offenses-validate-response-without-offense-type.json
400:
description: Error getting offense type for parking sticker
404:
description: Parking sticker not found
/api/initiatives:
description: Collection of funding initiatives
post:
description: Add a new funding initiative
body:
application/json:
type: types.Initiative
example: !include examples/initiatives/post-initiatives-request.json
responses:
201:
description: Funding initiative successfully added
body:
application/json:
type: types.InitiativeCodeObject
example: !include examples/initiatives/post-initiatives-response.json
400:
description: Error adding funding initiative
get:
description: Get all funding initiatives
responses:
200:
description: All funding initiatives
body:
application/json:
type: types.Initiative[]
example: !include examples/initiatives/get-initiatives-response.json
400:
description: Error getting funding initiative
/{initiativeCode}:
description: An initiative with given code
uriParameters:
initiativeCode:
type: types.InitiativeCode
post:
description: Add amount to initiative
body:
application/json:
type: types.InitiativeAmountToAdd
example: !include examples/initiatives/post-initiatives-added-amount-request.json
responses:
200:
description: Amount successfully added to initiative
400:
description: Error adding amount to initiative
404:
description: Initiative not not found
get:
description: Get information about an initiative
responses:
200:
description: Information about an initiative
body:
application/json:
type: types.Initiative
example: !include examples/initiatives/get-initiative-response.json
400:
description: Error getting initiative
404:
description: Initiative not found
/availableAmount:
description: Available amount for funding initiatives
get:
description: Get available amount for funding initiatives
responses:
200:
description: Available amount for funding initiatives
body:
application/json:
type: types.AvailableAmountForInitiatives
example: !include examples/initiatives/get-initiatives-available-amount-response.json
400:
description: Error getting funding initiative
/api/carbonCredits:
description: Information about carbon credits purchased with generated profits
post:
description: Enable or disabled monthly payment of carbon credits
body:
application/json:
type: types.CarbonCreditMonthlyPaymentStatusObject
example: !include examples/carbonCredits/post-carbon-credits-request.json
responses:
200:
description: Carbon credit monthly payment status successfully changed
400:
description: Error changing carbon credit monthly payment status
get:
description: Get amount of purchased carbon credits
responses:
200:
description: Amount of purchased carbon credits
body:
application/json:
type: types.CarbonCreditAmount
example: !include examples/carbonCredits/get-carbon-credits-request.json
400:
description: Error getting amount of purchased carbon credits
/api/reports:
description: Various reports available for the application
/profits:
description: Profits generated by parking stickers, access passes and offenses
/parkingStickers:
description: Profits generated by parking stickers
get:
description: Get profits generated by parking stickers for given year
queryParameters:
year:
description : Year for profits query
required: false
default: Current year
type: types.Year
responses:
200:
description: Report of profits generated by parking stickers for given year
body:
application/json:
type: types.ReportPeriod[]
example: !include examples/reports/get-reports-profits-parking-stickers-response.json
400:
description: Error getting profits for parking stickers
/accessPasses:
description: Profits generated by access passes
get:
description: Get profits generated by access passes for given year
queryParameters:
year:
description : Year for profits query
required: false
default: Current year
type: types.Year
byConsumptionType:
description : Separate access passes profits by consumption type (true or false)
required: false
default: false
type: string
responses:
200:
description: Report of profits generated by access passes for given year
body:
application/json:
type: types.ReportPeriod[]
examples:
notByConsumptionType: !include examples/reports/get-reports-profits-access-passes-response.json
byConsumptionType: !include examples/reports/get-reports-profits-access-passes-by-consumption-type-response.json
400:
description: Error getting profits for access passes
/offenses:
description: Profits generated by offenses
get:
description: Get profits generated by offenses for given year
queryParameters:
year:
description : Year for profits query
required: false
default: Current year
type: types.Year
responses:
200:
description: Profits generated by offenses for given year
body:
application/json:
type: types.ReportPeriod[]
example: !include examples/reports/get-reports-profits-offenses-response.json
400:
description: Error getting profits for offenses
/parkingAreas:
description: Gate entries by parking areas
get:
description: Get gate entries by parking areas for given parameters
queryParameters:
reportType:
type: types.ReportType
default: monthly
month:
description: Month for dayOfMonth or summary report type
type: String
default: Current month
responses:
200:
description: Gate entries by parking areas for given parameters
body:
application/json:
type: types.ReportPeriod[]
examples:
"Monthly report type": !include examples/reports/get-reports-parking-areas-monthly-response.json
"Day of month report type": !include examples/reports/get-reports-parking-areas-day-of-month-response.json
"Summary report type": !include examples/reports/get-reports-parking-areas-summary-response.json
400:
description: Error getting gate entires by parking areas