{"swagger":"2.0","info":{"description":"Features","version":"1.0.0","title":"557 API","contact":{"email":"haoyuxia@seas.upenn.edu"},"license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"tags":[{"name":"admins","description":"Secured Admin-only calls"},{"name":"developers","description":"Operations available to regular developers"}],"paths":{"/topics":{"get":{"tags":["all groups page API"],"summary":"feature 10 -> get popular topics when click on filters","operationId":"getTopics","description":"get all topics","produces":["application/json"],"responses":{"200":{"description":"Success","schema":{"type":"array","items":{"$ref":"#/definitions/Topic"}}},"400":{"description":"request error"}}}},"/groups/{userId}":{"get":{"tags":["all groups page API"],"summary":"feature 10, 14, 21 -> get groups with or without topics","operationId":"getTopicGroups","description":"get groups with chosen one or more topics(in query)","parameters":[{"in":"query","name":"topic","type":"boolean"},{"in":"query","name":"sort","type":"string"},{"in":"path","name":"userId","required":true,"type":"integer"}],"produces":["application/json"],"responses":{"200":{"description":"Success","schema":{"type":"array","items":{"type":"object","properties":{"members":{"type":"integer"},"isJoined":{"type":"boolean"},"group":{"$ref":"#/definitions/Group"}}}}},"400":{"description":"request error"}}}},"/group/{groupId}/info/{userId}":{"get":{"tags":["specific group API"],"summary":"get current group Info","operationId":"getGroup","description":"get all groupInfo of current group","produces":["application/json"],"parameters":[{"in":"path","name":"groupId","required":true,"type":"integer"},{"in":"path","name":"userId","required":true,"type":"integer"}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"members":{"type":"integer"},"isJoined":{"type":"boolean"},"isAdmin":{"type":"boolean"},"group":{"$ref":"#/definitions/Group"}}}},"404":{"description":"group not found"}}}},"/group/{groupId}":{"post":{"tags":["specific group API"],"summary":"feature 11 -> add a post to a group","operationId":"addPost","description":"add a post","produces":["application/json"],"parameters":[{"in":"path","name":"groupId","required":true,"type":"integer"},{"in":"body","name":"post","schema":{"type":"object","properties":{"userId":{"type":"integer"},"groupId":{"type":"integer"},"flagged":{"type":"integer"},"title":{"type":"string"},"content":{"type":"string"},"attachment":{"format":"binary"}}}}],"responses":{"201":{"description":"post created successfully","schema":{"type":"integer"}},"400":{"description":"post not valid"},"404":{"description":"group not found"}}}},"/group/{groupId}/posts/{userId}":{"get":{"tags":["specific group API"],"summary":"feature 15 -> display posts in a group","operationId":"getPosts","description":"get all posts in given group","produces":["application/json"],"parameters":[{"in":"path","name":"groupId","required":true,"type":"integer"},{"in":"path","name":"userId","required":true,"type":"integer"}],"responses":{"200":{"description":"Success","schema":{"type":"array","items":{"$ref":"#/definitions/Post"}}},"404":{"description":"group not found"}}}},"/group/{groupId}/post/{postId}/{userId}":{"get":{"tags":["specific post API"],"summary":"get specific post","operationId":"getPost","description":"get sepcific post info with postId and userId","produces":["application/json"],"parameters":[{"in":"path","name":"groupId","required":true,"type":"integer"},{"in":"path","name":"postId","required":true,"type":"integer"},{"in":"path","name":"userId","required":true,"type":"integer"}],"responses":{"200":{"description":"Successfully get a post","schema":{"$ref":"#/definitions/Post"}},"400":{"description":"post not found"}}},"delete":{"tags":["specific post API"],"summary":"feature 13 -> delete a post","operationId":"deletePost","description":"delete a post and send notifications according to situations\n","parameters":[{"in":"path","name":"groupId","required":true,"type":"integer"},{"in":"path","name":"postId","required":true,"type":"integer"},{"in":"path","name":"userId","required":true,"type":"integer"}],"responses":{"204":{"description":"post deleted successfully"},"404":{"description":"post not found"}}}},"/group/{groupId}/post/{postId}":{"put":{"tags":["specific post API"],"summary":"feature 12, 18 -> flag or hide a post","operationId":"flagHidePost","description":"receive flag or hide for the post from querys\n","parameters":[{"in":"path","name":"groupId","required":true,"type":"integer"},{"in":"path","name":"postId","required":true,"type":"integer"},{"in":"body","name":"change","schema":{"type":"object","properties":{"flag":{"type":"boolean"},"hide":{"type":"boolean"},"userId":{"type":"integer"}}}}],"responses":{"200":{"description":"Successfully hide or delete a post"},"400":{"description":"post not found"}}},"post":{"tags":["specific post API"],"summary":"feature 16 -> comment on a post","operationId":"commentPost","description":"make a comment to current post\n","parameters":[{"in":"path","name":"groupId","required":true,"type":"integer"},{"in":"path","name":"postId","required":true,"type":"integer"},{"in":"body","name":"comment","schema":{"type":"object","properties":{"userId":{"type":"integer"},"content":{"type":"string"}}}}],"responses":{"201":{"description":"comment created successfully","schema":{"$ref":"#/definitions/Comment"}},"404":{"description":"post not found"}}}},"/group/{groupId}/post/{postId}/comments/{userId}":{"get":{"tags":["specific post API"],"summary":"feature 16 -> get all comments of a post","operationId":"getComments","description":"make a comment to current post\n","parameters":[{"in":"path","name":"groupId","required":true,"type":"integer"},{"in":"path","name":"postId","required":true,"type":"integer"},{"in":"path","name":"userId","required":true,"type":"integer"}],"responses":{"200":{"description":"get all comments successfully","schema":{"type":"array","items":{"$ref":"#/definitions/Post"}}},"404":{"description":"post not found"}}}},"/group/{groupId}/post/{postId}/comment/{commentId}":{"delete":{"tags":["specific post API"],"summary":"feature 19 -> delete a comment","operationId":"deleteComment","description":"delete a comment in current post\n","parameters":[{"in":"path","name":"groupId","required":true,"type":"integer"},{"in":"path","name":"postId","required":true,"type":"integer"},{"in":"path","name":"commentId","required":true,"type":"integer"}],"responses":{"200":{"description":"delete comment successfully"},"404":{"description":"comment not found"}}}},"/solveFlagRequest/{adminNotificationId}":{"post":{"tags":["solve flag notification"],"summary":"feature 12 -> admin click approve or decline on flag request","operationId":"sloveFlagReq","description":"admin click approve or decline to respond to the request\n","parameters":[{"in":"path","name":"adminNotificationId","required":true,"type":"integer"},{"in":"body","name":"reqInfo","schema":{"type":"object","properties":{"userIdWhoFlag":{"type":"integer"},"postId":{"type":"integer"},"approve":{"type":"boolean"},"adminId":{"type":"integer"}}}}],"responses":{"200":{"description":"admin approve / decline the request"},"404":{"description":"notification not found"}}}},"/chats/{userId}":{"get":{"tags":["chat API"],"summary":"feature 20 -> get all chats of current user, return array of {chatsGroupId, user you are talk to}","operationId":"getChats","description":"get all chats of current user\n","parameters":[{"in":"path","name":"userId","required":true,"type":"integer"}],"responses":{"200":{"description":"Success","schema":{"type":"array","items":{"type":"integer"}}},"400":{"description":"request error"}}}},"/chat/{chatsGroupId}":{"get":{"tags":["chat API"],"summary":"feature 20 -> get all chat messages in this group, also check group share/deleted account here","operationId":"getMessage","description":"get all messages in this chatsGroup\n","parameters":[{"in":"path","name":"chatsGroupId","required":true,"type":"integer"}],"responses":{"200":{"description":"Success","schema":{"type":"array","items":{"type":"object"}}},"400":{"description":"request error"}}},"post":{"tags":["chat API"],"summary":"feature 20 -> send a message in this chatsGroup","operationId":"sendMessage","description":"send a message in this chatsGroup\n","parameters":[{"in":"path","name":"chatsGroupId","required":true,"type":"integer"},{"in":"body","name":"chatsMessage","schema":{"type":"object","properties":{"userId":{"type":"integer"},"message":{"type":"string"},"attachment":{"type":"string"}}}}],"responses":{"201":{"description":"send message successfully"},"400":{"description":"post not valid"},"404":{"description":"chatsGroup not found"}}}}},"definitions":{"Topic":{"required":["topic"],"properties":{"topicId":{"type":"integer","example":1},"topic":{"type":"string","example":"stock"}}},"Group":{"required":["groupName","private","groupInfo","profilePhoto","createDate"],"properties":{"groupId":{"type":"integer","example":1},"groupName":{"type":"string","example":"investing"},"private":{"type":"integer","example":1},"groupInfo":{"type":"string","example":"all about investing"},"profilePhoto":{"type":"string","example":"/tmp/your_image.png"},"createDate":{"type":"string","example":"11/21/2021 23:24:50"}}},"Post":{"required":["userId","title","content","attachment","groupId","timestamp","flagged"],"properties":{"postId":{"type":"integer","example":1},"userId":{"type":"integer","example":1},"title":{"type":"string","example":"Simple post"},"content":{"type":"string","example":"This is a sample post"},"attachment":{"format":"TEXT"},"groupId":{"type":"integer","example":1},"timestamp":{"type":"string","example":"11/21/2021 23:24:50"},"flagged":{"type":"boolean"}}},"Comment":{"required":["userId","content","postId","timestamp"],"properties":{"commentId":{"type":"integer","example":1},"userId":{"type":"integer","example":1},"content":{"type":"string"},"postId":{"type":"integer","example":1},"timestamp":{"type":"string","example":"11/21/2021 23:24:50"}}}},"host":"virtserver.swaggerhub.com","basePath":"/HavenXia/557Features/1.0.0","schemes":["https"]}