1212
1313# TODO: Email and password once rewritten with new frontend
1414# TODO: https://swagger.io/docs/specification/links/
15+ # TODO: https://stackoverflow.com/questions/47447403/how-to-define-different-responses-for-same-http-status-code-in-openapi-swagger
1516
1617tags :
1718 - name : Authentication
@@ -537,6 +538,231 @@ paths:
537538 type : array
538539 items :
539540 $ref : ' #/components/schemas/Match'
541+ /conversations :
542+ get :
543+ summary : Get your open conversations
544+ operationId : getConversations
545+ tags :
546+ - Messages
547+ responses :
548+ " 200 " :
549+ description : Returned list of matches
550+ content :
551+ application/json :
552+ schema :
553+ type : object
554+ properties :
555+ success :
556+ type : boolean
557+ description : If the request is a success
558+ example : true
559+ code :
560+ type : integer
561+ description : The status code
562+ example : 200
563+ conversations :
564+ type : array
565+ items :
566+ $ref : ' #/components/schemas/Conversation'
567+ /messages/send :
568+ post :
569+ summary : Send a message
570+ operationId : sendMessage
571+ tags :
572+ - Messages
573+ responses :
574+ " 400 " :
575+ $ref : ' #/components/responses/BadRequest'
576+ " 404 " :
577+ $ref : ' #/components/responses/NotFound'
578+ " 200 " :
579+ description : Like user successfully
580+ content :
581+ application/json :
582+ schema :
583+ type : object
584+ properties :
585+ success :
586+ type : boolean
587+ description : If the request is a success
588+ example : true
589+ code :
590+ type : integer
591+ description : The status code
592+ example : 200
593+ message :
594+ type : string
595+ example : Message successfully sent to X.
596+ /conversations/{with_uid} :
597+ get :
598+ summary : Get the messages between you and another user
599+ operationId : conversationWithUID
600+ tags :
601+ - Messages
602+ parameters :
603+ - name : with_uid
604+ in : path
605+ required : true
606+ description : The id of the user to get messages with. Either username, email or id
607+ schema :
608+ type : string
609+ responses :
610+ " 404 " :
611+ $ref : ' #/components/responses/NotFound'
612+ " 400 " :
613+ $ref : ' #/components/responses/BadRequest'
614+ " 200 " :
615+ description : Returned the conversation between users
616+ content :
617+ application/json :
618+ schema :
619+ type : object
620+ properties :
621+ success :
622+ type : boolean
623+ description : If the request is a success
624+ example : true
625+ code :
626+ type : integer
627+ description : The status code
628+ example : 200
629+ messages :
630+ type : array
631+ items :
632+ $ref : ' #/components/schemas/Message'
633+ /messages/see/{with_uid} :
634+ post :
635+ summary : Mark as seen all the latest messages
636+ operationId : seeMessagesWithUID
637+ tags :
638+ - Messages
639+ parameters :
640+ - name : with_uid
641+ in : path
642+ required : true
643+ description : The id of the user to mark messages as seen. Either username, email or id
644+ schema :
645+ type : string
646+ responses :
647+ " 404 " :
648+ $ref : ' #/components/responses/NotFound'
649+ " 200 " :
650+ description : Messages marked as seen.
651+ content :
652+ application/json :
653+ schema :
654+ type : object
655+ properties :
656+ success :
657+ type : boolean
658+ description : If the request is a success
659+ example : true
660+ code :
661+ type : integer
662+ description : The status code
663+ example : 200
664+ message :
665+ type : string
666+ example : Messages marked as seen.
667+ /messages/like/{message_id} :
668+ post :
669+ summary : Like a message
670+ operationId : likeMessage
671+ tags :
672+ - Messages
673+ parameters :
674+ - name : message_id
675+ in : path
676+ required : true
677+ description : The id of the message to like
678+ schema :
679+ type : integer
680+ responses :
681+ " 404 " :
682+ $ref : ' #/components/responses/NotFound'
683+ " 400 " :
684+ $ref : ' #/components/responses/BadRequest'
685+ " 200 " :
686+ description : Message liked.
687+ content :
688+ application/json :
689+ schema :
690+ type : object
691+ properties :
692+ success :
693+ type : boolean
694+ description : If the request is a success
695+ example : true
696+ code :
697+ type : integer
698+ description : The status code
699+ example : 200
700+ message :
701+ type : string
702+ example : Liked message X.
703+ /messages/unlike/{message_id} :
704+ post :
705+ summary : Unlike a message
706+ operationId : unlikeMessage
707+ tags :
708+ - Messages
709+ parameters :
710+ - name : message_id
711+ in : path
712+ required : true
713+ description : The id of the message to unlike
714+ schema :
715+ type : integer
716+ responses :
717+ " 404 " :
718+ $ref : ' #/components/responses/NotFound'
719+ " 400 " :
720+ $ref : ' #/components/responses/BadRequest'
721+ " 200 " :
722+ description : Message unliked.
723+ content :
724+ application/json :
725+ schema :
726+ type : object
727+ properties :
728+ success :
729+ type : boolean
730+ description : If the request is a success
731+ example : true
732+ code :
733+ type : integer
734+ description : The status code
735+ example : 200
736+ message :
737+ type : string
738+ example : Unliked message X.
739+ /messages/unseen :
740+ get :
741+ summary : Returns all the unseen messages
742+ operationId : unseenMessages
743+ tags :
744+ - Messages
745+ responses :
746+ " 200 " :
747+ description : Returns a list of unseen messages
748+ content :
749+ application/json :
750+ schema :
751+ type : object
752+ properties :
753+ success :
754+ type : boolean
755+ description : If the request is a success
756+ example : true
757+ code :
758+ type : integer
759+ description : The status code
760+ example : 200
761+ messages :
762+ type : array
763+ items :
764+ $ref : ' #/components/schemas/UnseenMessage'
765+
540766
541767servers :
542768 - url : https://api.matcha.com
@@ -990,4 +1216,93 @@ components:
9901216 user_2 :
9911217 type : string
9921218 example : 2
993- description : The user id of one of the user for the match
1219+ description : The user id of one of the user for the match
1220+ Conversation :
1221+ type : object
1222+ properties :
1223+ last_message_content :
1224+ type : string
1225+ example : Ok for tonight !
1226+ description : The last message sent to the conversation content
1227+ last_message_timestamp :
1228+ type : date
1229+ example : Wed, 16 Sep 2020 15:38:15 GMT
1230+ description : The last message sent to the conversation timestamp
1231+ is_unseen :
1232+ type : boolean
1233+ example : true
1234+ description : Is the last message of the conversation from the other user unseen
1235+ with_user :
1236+ type : string
1237+ example : 2
1238+ description : The user id of the person the conversation is with
1239+ Message :
1240+ type : object
1241+ properties :
1242+ id :
1243+ type : integer
1244+ example : 1
1245+ description : The unique id of the message
1246+ timestamp :
1247+ type : date
1248+ description : When was the message sent
1249+ example : Wed, 16 Sep 2020 15:38:15 GMT
1250+ seen_timestamp :
1251+ type : date
1252+ description : When was the message seen
1253+ example : Wed, 16 Sep 2020 15:39:15 GMT
1254+ content :
1255+ type : string
1256+ example : See you tonight !
1257+ description : The content of the message
1258+ is_seen :
1259+ type : boolean
1260+ example : true
1261+ description : Is the message seen
1262+ is_liked :
1263+ type : boolean
1264+ example : false
1265+ description : Is the message liked
1266+ from_user :
1267+ type : string
1268+ example : 2
1269+ description : The user id who sent the message
1270+ to_user :
1271+ type : string
1272+ example : 1
1273+ description : The user id who received the message
1274+ UnseenMessage :
1275+ type : object
1276+ properties :
1277+ id :
1278+ type : integer
1279+ example : 1
1280+ description : The unique id of the message
1281+ timestamp :
1282+ type : date
1283+ description : When was the message sent
1284+ example : Wed, 16 Sep 2020 15:38:15 GMT
1285+ seen_timestamp :
1286+ type : date
1287+ description : When was the message seen
1288+ example : Wed, 16 Sep 2020 15:39:15 GMT
1289+ content :
1290+ type : string
1291+ example : See you tonight !
1292+ description : The content of the message
1293+ is_seen :
1294+ type : boolean
1295+ example : false
1296+ description : Is the message seen
1297+ is_liked :
1298+ type : boolean
1299+ example : false
1300+ description : Is the message liked
1301+ from_user :
1302+ type : string
1303+ example : 2
1304+ description : The user id who sent the message
1305+ to_user :
1306+ type : string
1307+ example : 1
1308+ description : The user id who received the message
0 commit comments