Skip to content

Instantly share code, notes, and snippets.

@AdamGold
Created April 15, 2020 18:14
Show Gist options
  • Save AdamGold/7350d668f6197e2adc812fcae4f9a994 to your computer and use it in GitHub Desktop.
Save AdamGold/7350d668f6197e2adc812fcae4f9a994 to your computer and use it in GitHub Desktop.
flasgger
{
"definitions": {
"Device": {
"type": "object"
},
"Feedback": {
"properties": {
"feedback": {
"type": "integer"
}
},
"type": "object"
}
},
"info": {
"description": "powered by Flasgger",
"termsOfService": "/tos",
"title": "A swagger API",
"version": "0.0.1"
},
"paths": {
"/api/delete_firebase_token": {
"get": {
"parameters": [
{
"in": "path",
"name": "firebase_token",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "success message"
},
"400": {
"description": "invalid parameters"
}
},
"summary": "empty firebase token for the current user",
"tags": [
"user"
]
}
},
"/api/delete_network": {
"post": {
"parameters": [
{
"in": "post",
"name": "account_id",
"required": true,
"type": "string"
},
{
"in": "post",
"name": "network",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "Disassociation of user from network."
},
"400": {
"description": "Failed request, account already deleted/never existed."
}
},
"summary": "Given an external ID as a URL-paramter, disassociates the logged in user with that external account",
"tags": [
"network"
]
}
},
"/api/register_token": {
"post": {
"parameters": [
{
"in": "path",
"name": "firebase_token",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "success message"
},
"400": {
"description": "invalid parameters"
}
},
"summary": "register firebase token for the current user",
"tags": [
"user"
]
},
"put": {
"parameters": [
{
"in": "path",
"name": "firebase_token",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "success message"
},
"400": {
"description": "invalid parameters"
}
},
"summary": "register firebase token for the current user",
"tags": [
"user"
]
}
},
"/api/users": {
"get": {
"parameters": [
{
"in": "path",
"name": "q",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "A list of users (may be filtered by columns)"
},
"400": {
"description": "Failed request, either because of no query provided or invalid filter arguments."
}
},
"summary": "Search for a specific user.",
"tags": [
"user"
]
}
},
"/auth/confirm_email": {
"get": {
"responses": {
"200": {
"description": "success message"
},
"400": {
"description": "user already verified, email does not exist"
}
},
"summary": "confirm email route",
"tags": [
"auth"
]
}
},
"/auth/delete": {
"post": {
"responses": {
"200": {
"description": "success message"
}
},
"summary": "Delete currently logged in user",
"tags": [
"auth"
]
}
},
"/auth/exchange_token": {
"post": {
"parameters": [
{
"in": "post",
"name": "token",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "user dictionary with tokens"
},
"400": {
"description": "invalid parameters"
}
},
"summary": "exchange an exchange token for an auth token and a refresh token",
"tags": [
"auth"
]
}
},
"/auth/login": {
"post": {
"parameters": [
{
"in": "post",
"name": "username",
"required": false,
"type": "string"
},
{
"in": "post",
"name": "email",
"required": false,
"type": "string"
},
{
"in": "post",
"name": "password",
"required": true
}
],
"responses": {
"200": {
"description": "user dictionary with tokens"
}
},
"summary": "login route",
"tags": [
"auth"
]
},
"put": {
"parameters": [
{
"in": "post",
"name": "username",
"required": false,
"type": "string"
},
{
"in": "post",
"name": "email",
"required": false,
"type": "string"
},
{
"in": "post",
"name": "password",
"required": true
}
],
"responses": {
"200": {
"description": "user dictionary with tokens"
}
},
"summary": "login route",
"tags": [
"auth"
]
}
},
"/auth/logout": {
"post": {
"responses": {
"200": {
"description": "success message"
}
},
"summary": "Log out the currently logged in user",
"tags": [
"auth"
]
}
},
"/auth/refresh_token": {
"post": {
"parameters": [
{
"in": "post",
"name": "refresh_token",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "return new auth_token"
},
"400": {
"description": "invalid parameters (invalid token)"
}
},
"summary": "use a refresh token to create a new auth token",
"tags": [
"auth"
]
}
},
"/auth/register": {
"post": {
"parameters": [
{
"in": "post",
"name": "username",
"required": true,
"type": "string"
},
{
"in": "post",
"name": "email",
"required": true,
"type": "string"
},
{
"in": "post",
"name": "password",
"required": true
},
{
"in": "post",
"name": "birthday",
"required": true
},
{
"in": "post",
"name": "name",
"required": true
}
],
"responses": {
"200": {
"description": "user dictionary with tokens"
}
},
"summary": "login route",
"tags": [
"auth"
]
},
"put": {
"parameters": [
{
"in": "post",
"name": "username",
"required": true,
"type": "string"
},
{
"in": "post",
"name": "email",
"required": true,
"type": "string"
},
{
"in": "post",
"name": "password",
"required": true
},
{
"in": "post",
"name": "birthday",
"required": true
},
{
"in": "post",
"name": "name",
"required": true
}
],
"responses": {
"200": {
"description": "user dictionary with tokens"
}
},
"summary": "login route",
"tags": [
"auth"
]
}
},
"/auth/send_reset_password_email": {
"post": {
"parameters": [
{
"in": "post",
"name": "email",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "user dictionary with tokens"
},
"400": {
"description": "invalid parameters"
}
},
"summary": "check if email verified, then send reset password url (with token)",
"tags": [
"auth"
]
}
},
"/bond/end": {
"get": {
"responses": {
"200": {
"description": "success message"
},
"400": {
"description": "invalid parameters"
}
},
"summary": "ends current user's active bonding",
"tags": [
"bond"
]
}
},
"/bond/history": {
"get": {
"responses": {
"200": {
"description": "list of bondings"
},
"400": {
"description": "invalid parameters"
}
},
"summary": "returns bond history of current user",
"tags": [
"bond"
]
}
},
"/bond/leave": {
"get": {
"responses": {
"200": {
"description": "success message"
},
"400": {
"description": "invalid parameters"
}
},
"summary": "leaves current user's active bonding",
"tags": [
"bond"
]
}
},
"/bond/{user_id}": {
"get": {
"description": "Also sends notifications to both users about the bond.<br/>",
"parameters": [
{
"in": "path",
"name": "user_id",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "bonding dictionary"
},
"400": {
"description": "invalid parameters"
}
},
"summary": "add current user to a bond with the given user (user_id). if a bond is already in place (for current user or the other user), both users are added to it.",
"tags": [
"bond"
]
}
},
"/conversations/": {
"get": {
"responses": {
"200": {
"description": "filtered list of conversations"
},
"400": {
"description": "invalid parameters"
}
},
"summary": "return current user's conversations list",
"tags": [
"conversation"
]
},
"post": {
"description": "If only 2 participants given and a private chat already exist between the two - return it<br/>",
"parameters": [
{
"description": "list of recipients (users) ids",
"in": "path",
"name": "recipients",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "conversation dictionary"
},
"400": {
"description": "invalid parameters"
}
},
"summary": "create a new conversation with given participants (from a list of participants IDs).",
"tags": [
"conversation"
]
}
},
"/conversations/add/{conv_id}": {
"post": {
"parameters": [
{
"in": "path",
"name": "conv_id",
"required": true,
"type": "string"
},
{
"in": "post",
"name": "user_id",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "conversation dictionary"
},
"400": {
"description": "invalid parameters"
}
},
"summary": "allow creator of the conversation to add other users",
"tags": [
"conversation"
]
}
},
"/conversations/categories": {
"get": {
"responses": {
"200": {
"description": "list of categories"
},
"400": {
"description": "invalid parameters"
}
},
"summary": "get list of message categories from the database",
"tags": [
"conversation"
]
}
},
"/conversations/pop/{conv_id}": {
"post": {
"parameters": [
{
"in": "path",
"name": "conv_id",
"required": true,
"type": "string"
},
{
"in": "post",
"name": "user_id",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "conversation dictionary"
},
"400": {
"description": "invalid parameters"
}
},
"summary": "allow creator of the conversation to pop users from conversation",
"tags": [
"conversation"
]
}
},
"/conversations/preset": {
"get": {
"responses": {
"200": {
"description": "list of preset messages"
},
"400": {
"description": "invalid parameters"
}
},
"summary": "get list of preset messages from the database by category",
"tags": [
"conversation"
]
}
},
"/conversations/send/{conv_id}": {
"post": {
"description": "check if the conversation contains the requesting user:<br/> a. if not - raise error<br/> b. if yes - add a message to that conversation<br/>Moreover, add an indication for a new message for all users except the sender<br/>",
"parameters": [
{
"in": "path",
"name": "conv_id",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "conversation dictionary"
},
"400": {
"description": "invalid parameters"
}
},
"summary": "send a message to that conversation:",
"tags": [
"conversation"
]
}
},
"/conversations/{conv_id}": {
"get": {
"responses": {
"200": {
"description": "single conversation dictionary with paginated messages list"
},
"400": {
"description": "invalid parameters"
}
},
"summary": "return conversation info with paginated messages",
"tags": [
"conversation"
]
}
},
"/post/": {
"post": {
"parameters": [
{
"caption": "string",
"external_id": "string",
"images": "list"
}
],
"responses": {
"200": {
"description": "new post json"
},
"400": {
"description": "Failed request, either because of no query provided or invalid filter arguments."
}
},
"summary": "Add a post",
"tags": [
"post"
]
}
},
"/post/{id_}/reaction": {
"delete": {
"parameters": [
{
"post_id": "int"
},
{
"activity_id": "string"
}
],
"responses": {
"200": {
"description": "success message"
},
"400": {
"description": "Failed request, either because of no query provided or invalid filter arguments."
}
},
"summary": "Remove a reaction from a post",
"tags": [
"post"
]
},
"post": {
"parameters": [
{
"post_id": "int"
},
{
"text": "string"
}
],
"responses": {
"200": {
"description": "activity json"
},
"400": {
"description": "Failed request, either because of no query provided or invalid filter arguments."
}
},
"summary": "Add a reaction to a post",
"tags": [
"post"
]
}
},
"/user/approved_friend_requests": {
"get": {
"responses": {
"200": {
"description": "list of approved_friend_requests"
}
},
"summary": "friend requests that the current user sent out and got approved",
"tags": [
"user"
]
}
},
"/user/by_device": {
"post": {
"parameters": [
{
"in": "post",
"name": "device_id",
"required": true
}
],
"responses": {
"200": {
"description": "user information"
}
},
"summary": "get user by device ID",
"tags": [
"user"
]
}
},
"/user/change_setting": {
"post": {
"parameters": [
{
"description": "attribute of enum SettingType (e.g radar_visibility)",
"in": "post",
"name": "type",
"required": true,
"type": "string"
},
{
"default": 0,
"in": "post",
"name": "value",
"required": false,
"type": "integer"
}
],
"responses": {
"200": {
"description": "new setting information"
},
"400": {
"description": "Invalid parameters"
}
},
"summary": "change a user setting",
"tags": [
"user"
]
}
},
"/user/check_email": {
"post": {
"parameters": [
{
"in": "post",
"name": "email",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "success messsage (email not taken)"
},
"400": {
"description": "Failed request, email taken."
}
},
"summary": "Check if email is taken.",
"tags": [
"auth"
]
}
},
"/user/devices": {
"get": {
"responses": {
"200": {
"description": "A devices array"
}
},
"summary": "return a list of known devices of user",
"tags": [
"user"
]
}
},
"/user/feedback": {
"get": {
"responses": {
"200": {
"description": "A feedback dictionary",
"schema": {
"$ref": "#/definitions/Feedback"
}
}
},
"summary": "Returns the users most recent feedback,used for polling and debugging",
"tags": [
"user"
]
}
},
"/user/friend_requests": {
"get": {
"responses": {
"200": {
"description": "list of received_friend_requests"
}
},
"summary": "returns a list of all received friend requests.",
"tags": [
"user"
]
}
},
"/user/friends_distances": {
"get": {
"responses": {
"200": {
"description": "list of redis's friends_distances record + each user dictionary"
}
},
"summary": "returns a list of redis's friends_distances record",
"tags": [
"user"
]
}
},
"/user/get_setting": {
"get": {
"responses": {
"200": {
"description": "setting dictionary"
}
},
"summary": "get a specific setting of a user from user_settings",
"tags": [
"user"
]
}
},
"/user/indications": {
"get": {
"responses": {
"200": {
"description": "list of indications"
},
"400": {
"description": "invalid filter parameters"
}
},
"summary": "return user indications",
"tags": [
"user"
]
}
},
"/user/location": {
"post": {
"responses": {
"200": {
"description": "location saved"
}
},
"summary": "update redis database when a user changes location",
"tags": [
"user"
]
}
},
"/user/me": {
"get": {
"responses": {
"200": {
"description": "A device dictionary"
}
},
"summary": "return user's info dictionary",
"tags": [
"user"
]
}
},
"/user/pair": {
"post": {
"parameters": [
{
"in": "post",
"name": "device_id",
"required": true,
"type": "string"
},
{
"in": "post",
"name": "mac_address",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "A device dictionary",
"schema": {
"$ref": "#/definitions/Device"
}
},
"400": {
"description": "Invalid parameters"
}
},
"summary": "pair device ID with a user",
"tags": [
"user"
]
}
},
"/user/radar/add_friends": {
"post": {
"parameters": [
{
"description": "list of user ids to add as radar friends",
"in": "post",
"name": "friends_ids",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "success message"
}
},
"summary": "add a list of radar friends",
"tags": [
"user"
]
}
},
"/user/radar/friends": {
"get": {
"responses": {
"200": {
"description": "friends list"
},
"400": {
"description": "invalid filter parameters"
}
},
"summary": "get a a list of radar friends for a user based on radar_visibility setting",
"tags": [
"user"
]
}
},
"/user/radar/remove_friends": {
"post": {
"parameters": [
{
"description": "list of user ids to remove from radar friends",
"in": "post",
"name": "friends_ids",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "success message"
}
},
"summary": "remove a list of radar friends",
"tags": [
"user"
]
}
},
"/user/recent_posts": {
"get": {
"responses": {
"200": {
"description": "list of posts"
},
"400": {
"description": "Failed request, possibly because of invalid filters."
}
},
"summary": "Return list of recent posts with pagination",
"tags": [
"user"
]
}
},
"/user/sent_friend_requests": {
"get": {
"responses": {
"200": {
"description": "list of sent_friend_requests"
}
},
"summary": "returns a list of all sent friend requests.",
"tags": [
"user"
]
}
},
"/user/{user_id}/befriend": {
"get": {
"parameters": [
{
"in": "path",
"name": "user_id",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "success message"
},
"400": {
"description": "Invalid parameters"
}
},
"summary": "befriend with another user - if a friend request is pending, approve it. Otherwise, send friend request.",
"tags": [
"user"
]
}
},
"/user/{user_id}/friends": {
"get": {
"responses": {
"200": {
"description": "list of all friends"
},
"400": {
"description": "invalid filter params"
}
},
"summary": "returns list of friends",
"tags": [
"user"
]
}
},
"/user/{user_id}/unfriend": {
"get": {
"parameters": [
{
"in": "path",
"name": "user_id",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "success message"
},
"400": {
"description": "Invalid parameters"
}
},
"summary": "unfriend another user",
"tags": [
"user"
]
}
}
},
"swagger": "2.0"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment