· 6 years ago · Oct 28, 2019, 02:32 PM
1openapi: 3.0.2
2# Coach == Tutor
3# Tutorant == student of the Tutor
4# CoachProfile == Data of a Coach in the Coach AND Student table
5# This means deleting a CoachProfile deletes the Coach from the Coach table and the Student table
6# Note the only field that may be changed from the Coach table is the workload
7
8#to be done
9#authentication
10
11servers:
12 - description: SwaggerHub API Auto Mocking
13 url: https://virtserver.swaggerhub.com/barendmosch/TinderClone/1.0.0
14 - description: Server URL
15 url: https://tinderclonev120190930031733.azurewebsites.net
16
17info:
18 description: This is the MBO-HBO Tinder Clone API
19 version: "1.0.0"
20 title: MBO Tinder API
21 contact:
22 email: 586141@student.inholland.nl
23 license:
24 name: Apache 2.0
25 url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
26
27security:
28 - BasicAuth: [] #username:password -> base64encoded string
29
30paths:
31 /api/student/{studentID}:
32 get:
33 tags:
34 - Studentdata
35 summary: get data call
36 operationId: dataCall
37 description: Returns the student data based on the student number.
38 parameters:
39 - in: path
40 name: studentID
41 description: The student's personal id.
42 required: true
43 schema:
44 type: integer
45 responses:
46 '200':
47 description: Return student data.
48 content:
49 application/json:
50 schema:
51 type: array
52 items:
53 $ref: '#/components/schemas/Student'
54 '401':
55 description: Student password is not accepted.
56 '404':
57 description: Student number not in database.
58 '429':
59 description: Too many request on the database.
60 '503':
61 description: External component or service is unavailable at the moment.
62 put:
63 tags:
64 - Studentdata
65 summary: update data information
66 operationId: dataUpdate
67 description: Update a student data based on filters.
68 parameters:
69 - in: path
70 name: studentID
71 description: The student's personal id.
72 required: true
73 schema:
74 type: integer
75 requestBody:
76 description: all info that is needed to create the coach + profile
77 required: true
78 content:
79 application/json:
80 schema:
81 $ref: '#/components/schemas/Student'
82 responses:
83 '200':
84 description: modified.
85 '400':
86 description: Undocumented filter parameter.
87 '401':
88 description: Student password is not accepted.
89 '404':
90 description: Student number not in database.
91 '429':
92 description: Too many request on the database.
93 '503':
94 description: External component or service is unavailable at the moment.
95 /api/students/search:
96 get:
97 tags:
98 - Studentdata
99 summary: search for student profiles
100 operationId: searchCall
101 description: Returns a list of student profiles from the database filtered by filters.
102 # No parameters returns back every profile.
103 parameters:
104 - in: query
105 name: studentID
106 description: The student number is the students personal id.
107 required: false
108 schema:
109 type: integer
110 - in: query
111 name: firstName
112 description: The first name of the student.
113 required: false
114 schema:
115 type: string
116 - in: query
117 name: surName
118 description: The surname of the student.
119 required: false
120 schema:
121 type: string
122 - in: query
123 name: phoneNumber
124 description: The phoneNumber of the student.
125 required: false
126 schema:
127 type: string
128 - in: query
129 name: interests
130 description: The interests of the student.
131 required: false
132 schema:
133 type: array
134 items:
135 type: string
136 - in: query
137 name: degree
138 description: The degree of the student.
139 required: false
140 schema:
141 type: string
142 - in: query
143 name: study
144 required: false
145 description: The study of the student.
146 schema:
147 type: string
148 - in: query
149 name: studyYear
150 description: The study year of the student.
151 required: false
152 schema:
153 type: integer
154 responses:
155 '200':
156 description: Return list of student profiles.
157 content:
158 application/json:
159 schema:
160 $ref: '#/components/schemas/Student'
161 '400':
162 description: Undocumented filter parameter.
163 '401':
164 description: Student password is not accepted.
165 '404':
166 description: Student number not in database.
167 '429':
168 description: Too many requests
169 '503':
170 description: External component or service is unavailable at the moment.
171 /api/profile/coach:
172 get:
173 tags:
174 - Coach profile
175 summary: get all coach profiles.
176 operationId: GetAllCoachProfiles
177 description: Get all coach profiles.
178 responses:
179 '200':
180 description: Returned profiles
181 content:
182 application/json:
183 schema:
184 type: array
185 items:
186 $ref: '#/components/schemas/CoachProfile'
187 '400':
188 description: Undocumented filter parameter.
189 '401':
190 description: Student password is not accepted.
191 '429':
192 description: Too many requests
193 '503':
194 description: External component or service is unavailable at the moment.
195 post:
196 tags:
197 - Coach profile
198 summary: create user profile for a coach
199 operationId: CreateCoachProfile
200 description: Creates a new coach profile.
201 requestBody:
202 description: all info that is needed to create the coach + profile
203 required: true
204 content:
205 application/json:
206 schema:
207 $ref: '#/components/schemas/CoachProfile'
208 responses:
209 '201':
210 description: Has been created.
211 '401':
212 description: Student password is not accepted.
213 '404':
214 description: Student number not in database.
215 '409':
216 description: Student number already exists.
217 '429':
218 description: Too many request on the database
219 '503':
220 description: External component or service is unavailable at the moment.
221 /api/profile/coach/{studentID}:
222 get:
223 tags:
224 - Coach profile
225 summary: get coach and his profile
226 operationId: GetCoachProfileByID
227 description: Returns requested coach.
228 parameters:
229 - in: path
230 name: studentID
231 description: The student number is the students personal id.
232 required: true
233 schema:
234 type: integer
235 responses:
236 '200':
237 description: Return coach + his student profile.
238 content:
239 application/json:
240 schema:
241 type: array
242 items:
243 $ref: '#/components/schemas/CoachProfile'
244 '400':
245 description: Undocumented filter parameter.
246 '401':
247 description: Student password is not accepted.
248 '404':
249 description: Student number not in database.
250 '429':
251 description: Too many requests
252 '503':
253 description: External component or service is unavailable at the moment.
254 delete:
255 tags:
256 - Coach profile
257 summary: delete coach profile information
258 operationId: DeleteCoachProfileByID
259 description: Delete a coach profile.
260 parameters:
261 - in: path
262 name: studentID
263 description: The student's personal id.
264 required: true
265 schema:
266 type: integer
267 responses:
268 '204':
269 description: Delete was successful.
270 '400':
271 description: Delete has failed.
272 '401':
273 description: Student password is not accepted.
274 '404':
275 description: Delete has failed no studentnumber exists.
276 '429':
277 description: Too many request on the database.
278 '503':
279 description: External component or service is unavailable at the moment.
280 /api/profile/tutorant:
281 get:
282 tags:
283 - Tutorant profile
284 summary: get all tutorant profiles
285 operationId: tutorantProfileGet
286 description: Get all tutorant profiles.
287 responses:
288 '200':
289 description: Returned profiles
290 content:
291 application/json:
292 schema:
293 type: array
294 items:
295 $ref: '#/components/schemas/TutorantProfile'
296 '401':
297 description: Student password is not accepted.
298 '404':
299 description: Student number not in database.
300 '409':
301 description: Student number already exists.
302 '429':
303 description: Too many request on the database
304 '503':
305 description: External component or service is unavailable at the moment.
306 post:
307 tags:
308 - Tutorant profile
309 summary: create user profile for a tutorant
310 operationId: tutorantProfileCreate
311 description: Creates a new tutorant profile.
312 requestBody:
313 description: all info that is needed to create the tutorant + profile
314 required: true
315 content:
316 application/json:
317 schema:
318 $ref: '#/components/schemas/TutorantProfile'
319 responses:
320 '201':
321 description: Has been created.
322 '401':
323 description: Student password is not accepted.
324 '404':
325 description: Student number not in database.
326 '409':
327 description: Student number already exists.
328 '429':
329 description: Too many request on the database
330 '503':
331 description: External component or service is unavailable at the moment.
332 /api/profile/tutorant/{studentID}:
333 get:
334 tags:
335 - Tutorant profile
336 summary: get tutorant and his profile.
337 operationId: tutorantProfileCall
338 description: Returns requested coach.
339 parameters:
340 - in: path
341 name: studentID
342 description: The student number is the students personal id.
343 required: true
344 schema:
345 type: integer
346 responses:
347 '200':
348 description: Return tutorant + his student profile.
349 content:
350 application/json:
351 schema:
352 type: array
353 items:
354 $ref: '#/components/schemas/TutorantProfile'
355 '400':
356 description: Undocumented filter parameter.
357 '401':
358 description: Student password is not accepted.
359 '404':
360 description: Student number not in database.
361 '429':
362 description: Too many requests
363 '503':
364 description: External component or service is unavailable at the moment.
365 delete:
366 tags:
367 - Tutorant profile
368 summary: delete tutorant profile information
369 operationId: tutorantProfileDelete
370 description: Delete a tutorant profile.
371 parameters:
372 - in: path
373 name: studentID
374 description: The student's personal id.
375 required: true
376 schema:
377 type: integer
378 responses:
379 '204':
380 description: Delete was successful.
381 '400':
382 description: Delete has failed.
383 '401':
384 description: Student password is not accepted.
385 '404':
386 description: Delete has failed, no studentnumber exists.
387 '429':
388 description: Too many request on the database.
389 '503':
390 description: External component or service is unavailable at the moment.
391 /api/coach/{studentID}:
392 get:
393 tags:
394 - Coach profile
395 summary: get coach and workload
396 operationId: GetCoachByID
397 description: Returns requested coach and his maximum workload.
398 parameters:
399 - in: path
400 name: studentID
401 description: The student number is the students personal id.
402 required: true
403 schema:
404 type: integer
405 responses:
406 '200':
407 description: Return coach profile.
408 content:
409 application/json:
410 schema:
411 type: array
412 items:
413 $ref: '#/components/schemas/Coach'
414 '400':
415 description: Undocumented filter parameter.
416 '401':
417 description: Student password is not accepted.
418 '404':
419 description: Student number not in database.
420 '429':
421 description: Too many requests
422 '503':
423 description: External component or service is unavailable at the moment.
424 put:
425 tags:
426 - Coach profile
427 summary: update coach and workload
428 operationId: UpdateCoachByID
429 description: Returns requested coach and his maximum workload.
430 parameters:
431 - in: path
432 name: studentID
433 description: The student number is the students personal id.
434 required: true
435 schema:
436 type: integer
437 requestBody:
438 description: studentID (ignored) and workload of the coach (studentID of the path is used)
439 required: true
440 content:
441 application/json:
442 schema:
443 $ref: '#/components/schemas/Coach'
444 responses:
445 '204':
446 description: Update was successful.
447 '400':
448 description: Undocumented filter parameter.
449 '401':
450 description: Student password is not accepted.
451 '404':
452 description: Student number not in database.
453 '429':
454 description: Too many requests
455 '503':
456 description: External component or service is unavailable at the moment.
457 /api/coachTutorant:
458 post:
459 tags:
460 - CoachTutorant
461 summary: create coach tutorant connection
462 operationId: coachTutorantCreate
463 description: Creates a new coach with tutorant connection.
464 requestBody:
465 description: all info that is needed to create the coach tutorant conenction.
466 required: true
467 content:
468 application/json:
469 schema:
470 $ref: '#/components/schemas/CoachTutorantConnection'
471 responses:
472 '201':
473 description: Has been created.
474 '401':
475 description: Student password is not accepted.
476 '404':
477 description: Student number not in database.
478 '409':
479 description: Student number already exists.
480 '429':
481 description: Too many request on the database
482 '503':
483 description: External component or service is unavailable at the moment.
484 /api/coachTutorant/coach/{studentID}:
485 get:
486 tags:
487 - CoachTutorant
488 summary: get all coach connections with their tutorants.
489 operationId: coachTutorantConnectionsGet
490 description: get all coach connections with their tutorants.
491 parameters:
492 - in: path
493 name: studentID
494 description: The student number is the students personal id.
495 required: true
496 schema:
497 type: integer
498 responses:
499 '200':
500 description: Returned coach connections.
501 content:
502 application/json:
503 schema:
504 type: array
505 items:
506 $ref: '#/components/schemas/CoachTutorantConnection'
507 '400':
508 description: Undocumented filter parameter.
509 '401':
510 description: Student password is not accepted.
511 '404':
512 description: Student number not in database.
513 '429':
514 description: Too many requests
515 '503':
516 description: External component or service is unavailable at the moment.
517 delete:
518 tags:
519 - CoachTutorant
520 operationId: coachTutorantConnectionDelete
521 description: Delete all connections to coach.
522 parameters:
523 - in: path
524 name: studentID
525 schema:
526 type: integer
527 description: ID of the student.
528 required: true
529 responses:
530 '204':
531 description: Deleted connections
532 '401':
533 description: Student password is not accepted.
534 '404':
535 description: messageID Coach and tutorant number don't match any message.
536 '429':
537 description: Too many request on the database.
538 '503':
539 description: External component or service is unavailable at the moment.
540 /api/coachTutorant/tutorant/{studentID}:
541 get:
542 tags:
543 - CoachTutorant
544 summary: get tutorant connection with his coach.
545 operationId: tutorantCoachConnectionGet
546 description: Get the connection the tutorant has with his coach, to find out who his coach is.
547 parameters:
548 - in: path
549 name: studentID
550 description: The student number is the students personal id.
551 required: true
552 schema:
553 type: integer
554 responses:
555 '200':
556 description: Returned tutorant coach connection.
557 content:
558 application/json:
559 schema:
560 type: array
561 items:
562 $ref: '#/components/schemas/CoachTutorantConnection'
563 '400':
564 description: Undocumented filter parameter.
565 '401':
566 description: Student password is not accepted.
567 '404':
568 description: Student number not in database.
569 '429':
570 description: Too many requests
571 '503':
572 description: External component or service is unavailable at the moment.
573 put:
574 tags:
575 - CoachTutorant
576 summary: modify coachTutorant connection
577 operationId: coachTutorantConnectionUpdate
578 description: Modify the info in the coachTutorant connection, used to change the status.
579 parameters:
580 - in: path
581 name: studentID
582 description: The student number is the students personal id.
583 required: true
584 schema:
585 type: integer
586 requestBody:
587 description: all info that is needed to create the coach tutorant connection.
588 required: true
589 content:
590 application/json:
591 schema:
592 $ref: '#/components/schemas/CoachTutorantConnection'
593 responses:
594 '200':
595 description: modified.
596 '400':
597 description: Undocumented filter parameter.
598 '401':
599 description: Student password is not accepted.
600 '404':
601 description: Student number not in database.
602 '429':
603 description: Too many request on the database.
604 '503':
605 description: External component or service is unavailable at the moment.
606 delete:
607 tags:
608 - CoachTutorant
609 operationId: tutorantCoachConnectionDelete
610 description: Delete tutorant connection to coach.
611 parameters:
612 - in: path
613 name: studentID
614 schema:
615 type: integer
616 description: ID of the student.
617 required: true
618 responses:
619 '204':
620 description: Delete connection
621 '401':
622 description: Student password is not accepted.
623 '429':
624 description: Too many request on the database.
625 '503':
626 description: External component or service is unavailable at the moment.
627 /api/messages/{coachID}/{tutorantID}:
628 get:
629 tags:
630 - Messages
631 summary: get messages
632 operationId: messagesCall
633 description: Returns some messages, default number of last messages is 20 that will be returned.
634 parameters:
635 - in: path
636 name: coachID
637 schema:
638 type: integer
639 description: The coach his student number.
640 required: true
641 - in: path
642 name: tutorantID
643 schema:
644 type: integer
645 description: The tutorant his student number.
646 required: true
647 - in: query
648 name: amountOfMessages
649 schema:
650 type: integer
651 description: The number of messages that will be returned.
652 required: true
653 responses:
654 '200':
655 description: Return an array of "message".
656 content:
657 application/json:
658 schema:
659 type: array
660 items:
661 $ref: '#/components/schemas/Messages'
662 '401':
663 description: Student password is not accepted.
664 '404':
665 description: Coach and tutorant number don't match any messages.
666 '429':
667 description: Too many request on the database.
668 '503':
669 description: External component or service is unavailable at the moment.
670 /api/message/{messageID}:
671 #think about if we need this one, or remove, because why would we only get one message?
672 get:
673 tags:
674 - Message
675 summary: get message
676 operationId: messageCall
677 description: Returns a specific message.
678 parameters:
679 - in: path
680 name: messageID
681 schema:
682 type: integer
683 description: Specific message ID.
684 required: true
685 responses:
686 '200':
687 description: Return the requested message.
688 content:
689 application/json:
690 schema:
691 type: array
692 items:
693 $ref: '#/components/schemas/Message'
694 '401':
695 description: Student password is not accepted.
696 '404':
697 description: messageID Coach and tutorant number don't match any message.
698 '429':
699 description: Too many request on the database.
700 '503':
701 description: External component or service is unavailable at the moment.
702 put:
703 tags:
704 - Message
705 summary: modify message
706 operationId: messageUpdate
707 description: Changes the messages by the user's choice.
708 parameters:
709 - in: path
710 name: messageID
711 schema:
712 type: integer
713 description: Specific message ID.
714 required: true
715 - in: query
716 name: coachStudentID
717 schema:
718 type: integer
719 description: The coach his student number.
720 required: true
721 - in: query
722 name: tutorantStudentID
723 schema:
724 type: integer
725 description: The tutorant his student number.
726 required: true
727 - in: query
728 name: payload
729 schema:
730 type: integer
731 description: The modified messaged.
732 required: true
733 responses:
734 '201':
735 description: Modified the requested message.
736 content:
737 application/json:
738 schema:
739 type: array
740 items:
741 $ref: '#/components/schemas/Message'
742 '401':
743 description: Student password is not accepted.
744 '404':
745 description: messageID Coach and tutorant number don't match any message.
746 '429':
747 description: Too many request on the database.
748 '503':
749 description: External component or service is unavailable at the moment.
750 delete:
751 tags:
752 - Message
753 summary: delete a message
754 operationId: messageDelete
755 description: Delete a specific message.
756 parameters:
757 - in: path
758 name: messageID
759 schema:
760 type: integer
761 description: Specific message ID.
762 required: true
763 responses:
764 '204':
765 description: Deleted the requested message.
766 '401':
767 description: Student password is not accepted.
768 '404':
769 description: messageID Coach and tutorant number don't match any message.
770 '429':
771 description: Too many request on the database.
772 '503':
773 description: External component or service is unavailable at the moment.
774 /api/message:
775 post:
776 tags:
777 - Message
778 summary: post message
779 operationId: messagePost
780 description: post a message to the API.
781 requestBody:
782 description: all info needed to create message.
783 required: true
784 content:
785 application/json:
786 schema:
787 $ref: '#/components/schemas/Message'
788 responses:
789 '201':
790 description: successfully posted the message.
791 '401':
792 description: Student password is not accepted.
793 '404':
794 description: Coach or/and tutorant number don't exist in database.
795 '429':
796 description: Too many request on the database.
797 '503':
798 description: External component or service is unavailable at the moment.
799
800components:
801 securitySchemes:
802 BasicAuth:
803 type: http
804 scheme: basic
805 schemas:
806 # Is a profile.
807 Student:
808 type: object
809 required:
810 - studentID
811 properties:
812 studentID:
813 type: integer
814 example: 578123
815 firstName:
816 type: string
817 example: "Yuki"
818 surName:
819 type: string
820 example: "Basthiaan"
821 phoneNumber:
822 type: string
823 example: "0645236582"
824 interests:
825 type: string
826 example: "Programming (C only), Servers, Cisco"
827 photo:
828 type: string
829 example: "https://i.redd.it/xmulu1f6urt11.jpg"
830 description:
831 type: string
832 example: "I am a hbo student."
833 # Degree: havo || vwo || mbo || hbo || wo
834 degree:
835 type: string
836 example: "hbo"
837 study:
838 type: string
839 example: "Informatica"
840 # hbo: 1st, 2nd, 3rd, 4th year
841 studyYear:
842 type: integer
843 example: 2
844 TutorantProfile:
845 type: object
846 required:
847 - profile
848 - student
849 properties:
850 profile:
851 type: object
852 $ref: '#/components/schemas/Student'
853 student:
854 type: object
855 $ref: '#/components/schemas/Tutorant'
856 Tutorant:
857 type: object
858 required:
859 - studentID
860 properties:
861 studentID:
862 type: integer
863 example: 520438
864 # User profile of the coach and coach object.
865 CoachProfile:
866 type: object
867 required:
868 - profile
869 - coach
870 properties:
871 profile:
872 type: object
873 $ref: '#/components/schemas/Student'
874 coach:
875 type: object
876 $ref: '#/components/schemas/Coach'
877 # Coach studentID and workload.
878 Coach:
879 type: object
880 required:
881 - studentID
882 - workload
883 properties:
884 studentID:
885 type: integer
886 example: 520438
887 workload:
888 type: integer
889 example: 2
890 # Coach with a Tutorant pair. Status of the request as well.
891 CoachTutorantConnection:
892 type: object
893 required:
894 - studentIDCoach
895 - studentIDTutorant
896 - status
897 properties:
898 studentIDCoach:
899 type: integer
900 example: 520438
901 studentIDTutorant:
902 type: integer
903 example: 590549
904 status:
905 type: string
906 example: "pending"
907 # Chat system
908 Messages:
909 properties:
910 list:
911 type: array
912 items:
913 type: object
914 $ref: '#/components/schemas/Message'
915 Message:
916 type: object
917 required:
918 - messageID
919 - type
920 - payload
921 - created
922 - lastModified
923 properties:
924 messageID:
925 type: integer
926 # couchStudentNumber + tutorantStudentNumber + increment creates a unique id.
927 # Saved as separate fields.
928 example: 590539510539
929 #coachStudentID:
930 # type: integer
931 # example: 590539
932 #tutorantStudentID:
933 # type: integer
934 # example: 510539
935 type:
936 type: string
937 example: "text"
938 payload:
939 type: object
940 example: {"text": "Interesting message!"}
941 created:
942 type: string
943 example: "2019-05-01T00:00:00Z"
944 # if put modified message: different
945 # else: same as created.
946 lastModified:
947 type: string
948 example: "2019-06-01T00:00:00Z"
949 # Generic fail message
950 Fail:
951 type: object
952 properties:
953 Message:
954 type: string