-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagger.yaml
740 lines (737 loc) · 20.5 KB
/
swagger.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
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
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
openapi: 3.0.0
info:
title: Bootcamper
description: Bootcamper API for searching bootcamps.
version: 1.0.0
servers:
- url: 'https://api.bootcamper.pawel.in'
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
security:
- bearerAuth: []
tags:
- name: Auth
description: >-
Routes for user authentication including signup, signin, forgot password,
etc
- name: Bootcamps
description: 'Bootcamps Create, Read, Update, Delete, Filter and Sort functionalities.'
- name: Courses
description: All APIs related to courses.
- name: Reviews
description: User reviews for bootcamps and courses.
- name: Admin
description: CRUD functionalities for users only available to admins
paths:
/api/v1/auth/signup:
post:
tags:
- Auth
summary: SignUp
description: Registers a new user.
requestBody:
content:
application/json:
schema:
type: object
example:
name: Pawel Borkar
username: pawel
email: hi@pawel.in
password: Pawel@123!
role: publisher
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/auth/signin:
post:
tags:
- Auth
summary: SignIn
description: Login User
requestBody:
content:
application/json:
schema:
type: object
example:
usernameOrEmail: hi@pawel.in
password: Pawel@1234
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/auth/logout:
get:
tags:
- Auth
summary: Logout
description: Logout User
responses:
'200':
description: Successful response
/api/v1/auth/me:
post:
tags:
- Auth
summary: Get Logged in User
description: Get the current logged in user by sending token
requestBody:
content: {}
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/auth/forgot-password:
post:
tags:
- Auth
summary: Forgot Password
description: >-
Generates reset token and sends an email to the user in order to reset
the password with an expiration time of 10 mins.
requestBody:
content:
application/json:
schema:
type: object
example:
usernameOrEmail: user
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/auth/reset-password/{resetToken}:
put:
tags:
- Auth
summary: Reset Password
description: Reset user password using token.
parameters:
- name: resetToken
in: path # Specify "path" as the location
required: true # Mark it as required
schema:
type: string
description: reset token received via email
example: '31cab4ef9ca4fe05aa800eaf334e9a9402ee06ce' # Example bootcamp ID
requestBody:
content:
application/json:
schema:
type: object
example:
password: Seneca@1234
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/auth/update-details:
put:
tags:
- Auth
summary: Update User Details
description: Update the details of the logged in user.
requestBody:
content:
application/json:
schema:
type: object
example:
name: User
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/auth/update-password:
put:
tags:
- Auth
summary: Update User Password
description: Update the password of the current logged in user.
requestBody:
content:
application/json:
schema:
type: object
example:
currentPassword: User@1234
newPassword: Abc@1234
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/bootcamps:
get:
tags:
- Bootcamps
summary: Get All Bootcamps
description: |-
- Fetch all bootcamps information from database.
- Includes pagination, filtering, etc.
responses:
'200':
description: Successful response
content:
application/json: {}
post:
tags:
- Bootcamps
summary: Create New Bootcamp
description: |-
- **Create New Bootcamp**
| **Access** | | |
| --- | --- | --- |
| Roles | Admin <br> | User |
requestBody:
content:
application/json:
schema:
type: object
example:
name: ModernTech Bootcamp
description: >-
ModernTech has one goal, and that is to make you a rockstar
developer and/or designer with a six figure salary. We teach
both development and UI/UX
website: 'https://moderntech.com'
phone: (222) 222-2222
email: enroll@moderntech.com
address: '220 Pawtucket St, Lowell, MA 01854'
careers:
- Web Development
- UI/UX
- Mobile Development
housing: false
jobAssistance: true
jobGuarantee: false
acceptGi: true
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/bootcamps/{bootcampId}:
get:
tags:
- Bootcamps
summary: Get Single Bootcamp
description: '- Get single bootcamp by ID.'
operationId: getSingleBootcamp
parameters:
- name: bootcampId
in: path # Specify "path" as the location
required: true # Mark it as required
schema:
type: string
description: The ID of the bootcamp
example: '5d725a1b7b292f5f8ceff788' # Example bootcamp ID
responses:
'200':
description: Successful response
content:
application/json: {}
put:
tags:
- Bootcamps
summary: Update Single Bootcamp
description: '- Update Single Bootcamp in Database.'
operationId: updateBootcamp
parameters:
- name: bootcampId
in: path # Specify "path" as the location
required: true # Mark it as required
schema:
type: string
description: The ID of the bootcamp
example: '5d725a1b7b292f5f8ceff788'
requestBody:
content:
application/json:
schema:
type: object
example:
email: enroll@newera.com
responses:
'200':
description: Successful response
content:
application/json: {}
delete:
tags:
- Bootcamps
summary: Delete Single Bootcamp
description: '- Delete Single Bootcamp in Database.'
operationId: deleteBootcamp
parameters:
- name: bootcampId
in: path # Specify "path" as the location
required: true # Mark it as required
schema:
type: string
description: The ID of the bootcamp
example: '5d725a1b7b292f5f8ceff788'
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/bootcamps/radius/:
get:
tags:
- Bootcamps
summary: 'Get Bootcamps by Radius '
description: Get all bootcamps within a specific radius
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/bootcamps/:
get:
tags:
- Bootcamps
summary: Filter & Sort bootcamps
description: Filter out the bootcamps from the database.
parameters:
- name: select
in: query
schema:
type: string
example: name
- name: sort
in: query
schema:
type: string
example: '-name'
- name: page
in: query
schema:
type: integer
example: '1'
- name: limit
in: query
schema:
type: integer
example: '1'
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/bootcamps/{bootcampId}/photo:
put:
tags:
- Courses
summary: Upload Image
description: Upload image for the bootcamp
operationId: bootcampUploadPhoto
parameters:
- name: courseId
in: path # Specify "path" as the location
required: true # Mark it as required
schema:
type: string
description: The ID of the course
example: '5d725cfec4ded7bcb480eaa5'
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
file:
type: string
format: binary
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/courses:
get:
tags:
- Courses
summary: Get All Courses
description: Get all the courses available at the platform
parameters:
- name: select
in: query
schema:
type: string
example: title
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/bootcamps/{bootcampId}/courses:
get:
tags:
- Courses
summary: Get Courses for a Bootcamp
description: Get all the courses for a specific bootcamp
operationId: getCourses
parameters:
- name: bootcampId
in: path # Specify "path" as the location
required: true # Mark it as required
schema:
type: string
description: The ID of the bootcamp
example: '5d725a1b7b292f5f8ceff788'
responses:
'200':
description: Successful response
content:
application/json: {}
post:
tags:
- Courses
summary: Create New Course
description: Add a new course into the bootcamp
operationId: createCourse
parameters:
- name: bootcampId
in: path # Specify "path" as the location
required: true # Mark it as required
schema:
type: string
description: The ID of the bootcamp
example: '5d725a1b7b292f5f8ceff788'
requestBody:
content:
application/json:
schema:
type: object
example:
title: Web Design & Development
description: >-
Get started building websites and web apps with
HTML/CSS/JavaScript/PHP. We teach you
weeks: 10
tuition: 12000
level: beginner
scholarshipsAvailable: true
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/courses/{courseId}:
get:
tags:
- Courses
summary: Get Single Course By Id
description: Get a single course from the database by sending it's id in the params.
operationId: getCourse
parameters:
- name: courseId
in: path # Specify "path" as the location
required: true # Mark it as required
schema:
type: string
description: The ID of the course
example: '5d725cfec4ded7bcb480eaa5'
responses:
'200':
description: Successful response
content:
application/json: {}
put:
tags:
- Courses
summary: Update Single Course
description: Update a course with an id
operationId: updateCourse
parameters:
- name: courseId
in: path # Specify "path" as the location
required: true # Mark it as required
schema:
type: string
description: The ID of the course
example: '5d725cfec4ded7bcb480eaa5'
requestBody:
content:
application/json:
schema:
type: object
example:
tuition: 11100
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/bootcamps/{bootcampId}/courses/{courseId}:
delete:
tags:
- Courses
summary: Delete Single Course
description: Delete a course from the bootcamp.
operationId: deleteCourse
parameters:
- name: bootcampId
in: path # Specify "path" as the location
required: true # Mark it as required
schema:
type: string
description: The ID of the bootcamp
example: '5d725a1b7b292f5f8ceff788'
- name: courseId
in: path # Specify "path" as the location
required: true # Mark it as required
schema:
type: string
description: The ID of the course
example: '5d725cfec4ded7bcb480eaa5'
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/reviews:
get:
tags:
- Reviews
summary: Get All Reviews
description: >-
Get all reviews from database and populate with bootcamp name and
description.
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/bootcamps/{bootcampId}/reviews:
get:
tags:
- Reviews
summary: Get Reviews For Bootcamp
description: Fetch the reviews for a specific bootcamp.
operationId: getAllReviews
parameters:
- name: bootcampId
in: path # Specify "path" as the location
required: true # Mark it as required
schema:
type: string
description: The ID of the bootcamp
example: '5d725a1b7b292f5f8ceff788'
responses:
'200':
description: Successful response
content:
application/json: {}
post:
tags:
- Reviews
summary: Add Review
description: Add a review to the bootcamp.
operationId: addReview
parameters:
- name: bootcampId
in: path # Specify "path" as the location
required: true # Mark it as required
schema:
type: string
description: The ID of the bootcamp
example: '5d725a1b7b292f5f8ceff788'
requestBody:
content:
application/json:
schema:
type: object
example:
title: Superb Job!
description: Got a very high paying job because of this.
rating: '10'
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/reviews/{reviewId}:
get:
tags:
- Reviews
summary: Get Single Review
description: >-
Fetch a review from database with an id and populate bootcamp with name
and description.
operationId: getAllReviews
parameters:
- name: reviewId
in: path # Specify "path" as the location
required: true # Mark it as required
schema:
type: string
description: The ID of the review
example: '5d725a1b7b292f5f8ceff788'
responses:
'200':
description: Successful response
content:
application/json: {}
put:
tags:
- Reviews
summary: Update Review For A Bootcamp
description: Update a review for a bootcamp.
operationId: updateReview
parameters:
- name: reviewId
in: path # Specify "path" as the location
required: true # Mark it as required
schema:
type: string
description: The ID of the review
example: '5d7a514b5d2c12c7449be020'
requestBody:
content:
application/json:
schema:
type: object
example:
title: Nice Experience!
description: Experienced faculty and super smart peers.
rating: 8
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/bootcamps/{bootcampId}/reviews/{reviewId}:
delete:
tags:
- Reviews
summary: Delete A Review
description: Deletes a review from the bootcamp.
operationId: deleteReview
parameters:
- name: bootcampId
in: path # Specify "path" as the location
required: true # Mark it as required
schema:
type: string
description: The ID of the bootcamp
example: '5d725a1b7b292f5f8ceff788'
- name: reviewId
in: path # Specify "path" as the location
required: true # Mark it as required
schema:
type: string
description: The ID of the review
example: '5d7a514b5d2c12c7449be020'
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/users:
get:
tags:
- Admin
summary: Get All Users
responses:
'200':
description: Successful response
content:
application/json: {}
post:
tags:
- Admin
summary: Create New User
requestBody:
content:
application/json:
schema:
type: object
example:
name: Admin
username: admins
email: admin@oss.org
password: pawel123!
role: publisher
responses:
'200':
description: Successful response
content:
application/json: {}
/api/v1/users/{userId}:
get:
tags:
- Admin
summary: Get Single User
description: Get single user details from database by sending id in the params
operationId: getUser
parameters:
- name: userId
in: path # Specify "path" as the location
required: true # Mark it as required
schema:
type: string
description: The ID of the review
example: '5d7a514b5d2c12c7449be020'
responses:
'200':
description: Successful response
content:
application/json: {}
put:
tags:
- Admin
summary: Update User
description: Updates the user details and role
operationId: updateUser
parameters:
- name: userId
in: path # Specify "path" as the location
required: true # Mark it as required
schema:
type: string
description: The ID of the review
example: '5d7a514b5d2c12c7449be020'
requestBody:
content:
application/json:
schema:
type: object
example:
role: publisher
responses:
'200':
description: Successful response
content:
application/json: {}
delete:
tags:
- Admin
summary: Delete User
description: Deletes a user
operationId: deleteUser
parameters:
- name: userId
in: path # Specify "path" as the location
required: true # Mark it as required
schema:
type: string
description: The ID of the review
example: '5d7a514b5d2c12c7449be020'
responses:
'200':
description: Successful response
content:
application/json: {}