Untitled
unknown
json
3 years ago
108 kB
8
Indexable
{
"swagger": "2.0",
"info": {
"description": "",
"version": "1.0.0",
"title": "Swagger GTMS"
},
"host": "master.geotags.pl",
"basePath": "/api/v1",
"tags": [
{
"name": "Auth",
"description": "User login and registration service"
},
{
"name": "Groups",
"description": "Groups service"
},
{
"name": "Notifications",
"description": "Email and web push notifications service"
},
{
"name": "Tags",
"description": "Tags service"
},
{
"name": "Files",
"description": "Files service"
},
{
"name": "Posts",
"description": "Posts service"
},
{
"name": "Comments",
"description": "Comments service"
}
],
"schemes": ["https"],
"paths": {
"/auth/users/count": {
"get": {
"tags": ["Auth"],
"summary": "Returns the current number of registered users",
"description": "",
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"counter": {
"type": "number"
}
},
"example": {
"counter": 510
}
}
}
}
}
},
"/auth/users/username": {
"post": {
"tags": ["Auth"],
"summary": "Checks if username exists in database",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"username": {
"type": "string"
}
}
}
}
],
"responses": {
"200": {
"description": "Username exists"
},
"400": {
"description": "Invalid payload"
},
"404": {
"description": "Username does not exist"
}
}
}
},
"/auth/username/find": {
"get": {
"tags": ["Auth"],
"summary": "Finds users by username",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "query",
"name": "query",
"required": true,
"type": "string"
},
{
"in": "query",
"name": "limit",
"type": "number"
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/User"
}
}
},
"400": {
"description": "Invalid params"
}
}
}
},
"/auth/users": {
"post": {
"tags": ["Auth"],
"summary": "Register a new user",
"description": "",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"surname": {
"type": "string"
},
"email": {
"type": "string",
"format": "email"
},
"phone": {
"type": "string"
},
"password": {
"type": "string"
},
"countryCode": {
"type": "string"
},
"languageCode": {
"type": "string"
}
}
}
}
],
"responses": {
"201": {
"description": "Successful operation",
"schema": {
"$ref": "#/definitions/User"
}
},
"400": {
"description": "Validation errors",
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/ValidationError"
}
}
}
}
},
"get": {
"tags": ["Auth"],
"summary": "Returns list of users",
"description": "",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "limit",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records limit (no more than 50)"
},
{
"name": "offset",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records offset"
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"total": {
"type": "number"
},
"limit": {
"type": "number"
},
"offset": {
"type": "number"
},
"docs": {
"type": "array",
"items": {
"$ref": "#/definitions/User"
}
}
}
}
}
}
}
},
"/auth/users/tag": {
"get": {
"tags": ["Auth"],
"summary": "Find users by tag(-s)",
"description": "",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "q",
"in": "query",
"required": true,
"type": "string",
"description": "Coma separated list of tags to find (max 10 tags)"
},
{
"name": "limit",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records limit (no more than 50)"
},
{
"name": "offset",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records offset"
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"total": {
"type": "number"
},
"limit": {
"type": "number"
},
"offset": {
"type": "number"
},
"docs": {
"type": "array",
"items": {
"$ref": "#/definitions/User"
}
}
}
}
},
"400": {
"description": "Tags are invalid"
}
}
}
},
"/auth/users/{id}": {
"get": {
"tags": ["Auth"],
"summary": "Returns details about user",
"description": "",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "basic",
"in": "query",
"required": false,
"type": "boolean",
"description": "If true returns only basic user info"
},
{
"name": "id",
"in": "path",
"required": true,
"type": "string",
"description": "User's id"
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"allOf": [
{
"$ref": "#/definitions/User"
},
{
"type": "object",
"properties": {
"groupsMember": {
"type": "array",
"items": {
"$ref": "#/definitions/Group"
}
},
"groupsAdmin": {
"type": "array",
"items": {
"$ref": "#/definitions/Group"
}
},
"groupsOwner": {
"type": "array",
"items": {
"$ref": "#/definitions/Group"
}
}
}
}
]
}
},
"404": {
"description": "User not found"
}
}
}
},
"/auth/authenticate": {
"post": {
"tags": ["Auth"],
"summary": "Login into an account",
"description": "",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"email": {
"type": "string",
"format": "email"
},
"password": {
"type": "string"
}
}
}
}
],
"responses": {
"201": {
"description": "Successful operation",
"schema": {
"$ref": "#/definitions/JWT"
}
},
"401": {
"description": "Invalid email/password"
},
"403": {
"description": "Account is not active"
}
}
}
},
"/auth/refresh-token": {
"post": {
"tags": ["Auth"],
"summary": "Refreshes access token",
"description": "",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"token": {
"type": "string"
}
}
}
}
],
"responses": {
"201": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"accessToken": {
"type": "string"
}
}
}
},
"401": {
"description": "Token is invalid"
}
}
}
},
"/auth/activate-account/{code}": {
"get": {
"tags": ["Auth"],
"summary": "Actives user account",
"description": "",
"parameters": [
{
"name": "code",
"in": "path",
"required": true,
"type": "string",
"description": "Activation code"
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Successful operation"
},
"404": {
"description": "Activation code not found"
}
}
}
},
"/auth/remind-password": {
"post": {
"tags": ["Auth"],
"summary": "Generates remind password email",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"email": {
"type": "string",
"format": "email"
}
}
}
}
],
"responses": {
"200": {
"description": "Email has been sent"
},
"400": {
"description": "Address email is invalid"
},
"404": {
"description": "Email not found in DB"
}
}
}
},
"/auth/reset-passord": {
"post": {
"tags": ["Auth"],
"summary": "Resets user's password",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"password": {
"type": "string"
}
}
}
}
],
"responses": {
"200": {
"description": "Successful operation"
},
"400": {
"description": "Payload is invalid"
},
"404": {
"description": "Code not found"
}
}
}
},
"/auth/delete-account": {
"delete": {
"security": [
{
"user_auth": []
}
],
"tags": ["Auth"],
"summary": "Sends delete user account email",
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Successful operation"
}
}
}
},
"/auth/delete-account-confirm": {
"post": {
"security": [
{
"user_auth": []
}
],
"tags": ["Auth"],
"summary": "Sends delete user account email",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"code": {
"type": "string"
}
}
}
}
],
"responses": {
"200": {
"description": "Account has been deleted"
},
"400": {
"description": "Code is invalid"
},
"401": {
"description": "Code does not belong to the current user"
},
"404": {
"description": "Code or account does not exist"
}
}
}
},
"/auth/me/groups": {
"get": {
"security": [
{
"user_auth": []
}
],
"tags": ["Auth"],
"summary": "Returns groups that somehow belongs to the user",
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"admin": {
"type": "array",
"items": {
"$ref": "#/definitions/Group"
}
},
"member": {
"type": "array",
"items": {
"$ref": "#/definitions/Group"
}
},
"owner": {
"type": "array",
"items": {
"$ref": "#/definitions/Group"
}
},
"favs": {
"type": "object",
"properties": {
"total": {
"type": "number"
},
"limit": {
"type": "number"
},
"offset": {
"type": "number"
},
"docs": {
"type": "array",
"items": {
"$ref": "#/definitions/Group"
}
}
}
}
}
}
},
"404": {
"description": "User does not exist"
}
}
}
},
"/auth/me": {
"get": {
"security": [
{
"user_auth": []
}
],
"tags": ["Auth"],
"summary": "Returns info about current user",
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"schema": {
"$ref": "#/definitions/User"
},
"description": "Successful operation"
},
"404": {
"description": "User does not exist"
}
}
},
"post": {
"security": [
{
"user_auth": []
}
],
"tags": ["Auth"],
"summary": "Returns info about current user",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"surname": {
"type": "string"
},
"email": {
"type": "string"
},
"phone": {
"type": "string"
},
"countryCode": {
"type": "string"
},
"languageCode": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
],
"responses": {
"200": {
"description": "Account has been updated"
},
"400": {
"description": "Payload has errors"
},
"401": {
"description": "JWT token in header is invalid"
},
"404": {
"description": "JTW user does not exist in DB"
}
}
}
},
"/auth/me/favs/groups": {
"get": {
"security": [
{
"user_auth": []
}
],
"tags": ["Auth"],
"summary": "Returns info about current user fav groups",
"parameters": [
{
"name": "limit",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records limit (no more than 50)"
},
{
"name": "offset",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records offset"
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"total": {
"type": "number"
},
"limit": {
"type": "number"
},
"offset": {
"type": "number"
},
"docs": {
"type": "array",
"items": {
"$ref": "#/definitions/Group"
}
}
}
}
}
}
},
"put": {
"security": [
{
"user_auth": []
}
],
"tags": ["Auth"],
"summary": "Updates order of favs group",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
],
"responses": {
"200": {
"description": "Successful operation"
},
"400": {
"description": "Invalid payload"
}
}
}
},
"/auth/me/favs/groups/status": {
"get": {
"security": [
{
"user_auth": []
}
],
"tags": ["Auth"],
"summary": "Checks if groups are in user favs",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "query",
"description": "User's id",
"name": "id[]",
"type": "array",
"items": {
"type": "string"
},
"required": true
}
],
"responses": {
"200": {
"description": "Successful operation"
}
}
}
},
"/auth/me/favs/users": {
"post": {
"security": [
{
"user_auth": []
}
],
"tags": ["Auth"],
"summary": "Creates a new fav user",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"user": {
"type": "string"
},
"order": {
"type": "number"
}
}
}
}
],
"responses": {
"201": {
"description": "Successful operation"
},
"400": {
"description": "Validation errors",
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/ValidationError"
}
}
}
}
},
"get": {
"security": [
{
"user_auth": []
}
],
"tags": ["Auth"],
"summary": "Returns info about current user fav users",
"parameters": [
{
"name": "limit",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records limit (no more than 50)"
},
{
"name": "offset",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records offset"
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"total": {
"type": "number"
},
"limit": {
"type": "number"
},
"offset": {
"type": "number"
},
"docs": {
"type": "array",
"items": {
"$ref": "#/definitions/User"
}
}
}
}
}
}
}
},
"/auth/favs/groups/user/{id}": {
"get": {
"tags": ["Auth"],
"summary": "Returns info about user's fav groups",
"parameters": [
{
"name": "id",
"required": true,
"type": "string",
"in": "path",
"description": "User's id"
},
{
"name": "limit",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records limit (no more than 50)"
},
{
"name": "offset",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records offset"
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"total": {
"type": "number"
},
"limit": {
"type": "number"
},
"offset": {
"type": "number"
},
"docs": {
"type": "array",
"items": {
"$ref": "#/definitions/Group"
}
}
}
}
}
}
}
},
"/auth/favs/users/user/{id}": {
"get": {
"tags": ["Auth"],
"summary": "Returns info about user's fav users",
"parameters": [
{
"name": "id",
"required": true,
"type": "string",
"in": "path",
"description": "User's id"
},
{
"name": "limit",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records limit (no more than 50)"
},
{
"name": "offset",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records offset"
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"total": {
"type": "number"
},
"limit": {
"type": "number"
},
"offset": {
"type": "number"
},
"docs": {
"type": "array",
"items": {
"$ref": "#/definitions/User"
}
}
}
}
}
}
}
},
"/auth/favs/groups": {
"post": {
"security": [
{
"user_auth": []
}
],
"tags": ["Auth"],
"summary": "Creates a new fav group",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"group": {
"type": "string"
},
"order": {
"type": "number"
}
}
}
}
],
"responses": {
"201": {
"description": "Successful operation"
},
"400": {
"description": "Validation errors",
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/ValidationError"
}
}
}
}
}
},
"/auth/me/favs/groups/{id}": {
"delete": {
"security": [
{
"user_auth": []
}
],
"tags": ["Auth"],
"summary": "Removes group from favs",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "id",
"required": true,
"type": "string",
"in": "path",
"description": "Group's id"
}
],
"responses": {
"200": {
"description": "Successful operation"
},
"404": {
"description": "Group is not in favs"
}
}
}
},
"/auth/me/favs/users/{id}": {
"delete": {
"security": [
{
"user_auth": []
}
],
"tags": ["Auth"],
"summary": "Removes user from favs",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "id",
"required": true,
"type": "string",
"in": "path",
"description": "User's id"
}
],
"responses": {
"200": {
"description": "Successful operation"
},
"404": {
"description": "Post is not in favs"
}
}
}
},
"/auth/login-history": {
"get": {
"security": [
{
"user_auth": []
}
],
"tags": ["Auth"],
"summary": "Returns user's login history",
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/LoginHistory"
}
}
},
"404": {
"description": "User not found"
}
}
}
},
"/auth/sessions": {
"get": {
"security": [
{
"user_auth": []
}
],
"tags": ["Auth"],
"summary": "Returns user's active sessions",
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/ActiveSession"
}
}
}
}
}
},
"/auth/sessions/{id}": {
"delete": {
"security": [
{
"user_auth": []
}
],
"tags": ["Auth"],
"summary": "Deletes user's active session",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "id",
"required": true,
"type": "string",
"in": "path",
"description": "Session's id"
}
],
"responses": {
"200": {
"description": "Successful operation"
},
"404": {
"description": "Session's id not found"
}
}
}
},
"/groups": {
"post": {
"security": [
{
"user_auth": []
}
],
"tags": ["Groups"],
"summary": "Creates a new group",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"type": {
"type": "string"
},
"visibility": {
"type": "string"
},
"avatar": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"members": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
],
"responses": {
"201": {
"description": "Successful operation",
"schema": {
"$ref": "#/definitions/Group"
}
},
"400": {
"description": "Validation errors",
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/ValidationError"
}
}
}
}
},
"get": {
"tags": ["Groups"],
"summary": "Returns public groups list, sorted by creation date",
"parameters": [
{
"name": "limit",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records limit (no more than 50)"
},
{
"name": "offset",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records offset"
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"total": {
"type": "number"
},
"limit": {
"type": "number"
},
"offset": {
"type": "number"
},
"docs": {
"type": "array",
"items": {
"$ref": "#/definitions/Group"
}
}
}
}
}
}
}
},
"/groups/tag": {
"get": {
"tags": ["Groups"],
"summary": "Find groups by tag(-s)",
"description": "",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "q",
"in": "query",
"required": true,
"type": "string",
"description": "Coma separated list of tags to find (max 10)"
},
{
"name": "limit",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records limit (no more than 50)"
},
{
"name": "offset",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records offset"
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"total": {
"type": "number"
},
"limit": {
"type": "number"
},
"offset": {
"type": "number"
},
"docs": {
"type": "array",
"items": {
"$ref": "#/definitions/Group"
}
}
}
}
},
"400": {
"description": "Tags are invalid"
}
}
}
},
"/groups/{slug}/join": {
"get": {
"security": [
{
"user_auth": []
}
],
"tags": ["Groups"],
"summary": "Allow user to join a group",
"parameters": [
{
"name": "slug",
"in": "path",
"required": true,
"type": "string",
"description": "Unique group's slug"
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"201": {
"description": "Successful operation"
},
"400": {
"description": "User is already a group member"
},
"403": {
"description": "User has no rights to join the group"
},
"404": {
"description": "Group does not exist in db"
}
}
}
},
"/groups/{slug}/leave": {
"get": {
"security": [
{
"user_auth": []
}
],
"tags": ["Groups"],
"summary": "Allow user to leave a group",
"parameters": [
{
"name": "slug",
"in": "path",
"required": true,
"type": "string",
"description": "Unique group's slug"
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Successful operation"
},
"400": {
"description": "User is not group's member, can not leave"
},
"404": {
"description": "Group does not exist in db"
}
}
}
},
"/groups/{slug}": {
"get": {
"tags": ["Groups"],
"summary": "Returns group data",
"description": "",
"parameters": [
{
"name": "slug",
"in": "path",
"required": true,
"type": "string",
"description": "Unique group's slug or group id"
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"$ref": "#/definitions/Group"
}
},
"404": {
"description": "Group does not exist in db"
}
}
},
"post": {
"security": [
{
"user_auth": []
}
],
"tags": ["Groups"],
"summary": "Updates group data",
"parameters": [
{
"name": "slug",
"in": "path",
"required": true,
"type": "string",
"description": "Unique group's slug"
},
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"type": {
"type": "string"
},
"visibility": {
"type": "string"
},
"avatar": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"members": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
],
"description": "",
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"$ref": "#/definitions/Group"
}
},
"400": {
"description": "Validation errors",
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/ValidationError"
}
}
},
"404": {
"description": "Group does not exist or user has no permission to change it"
}
}
}
},
"/groups/{slug}/members": {
"get": {
"tags": ["Groups"],
"summary": "Returns paginated list of group's members",
"parameters": [
{
"name": "slug",
"in": "path",
"required": true,
"type": "string",
"description": "Unique group's slug"
},
{
"name": "limit",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records limit (no more than 50)"
},
{
"name": "offset",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records offset"
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"total": {
"type": "number"
},
"limit": {
"type": "number"
},
"offset": {
"type": "number"
},
"docs": {
"type": "array",
"items": {
"$ref": "#/definitions/User"
}
}
}
}
},
"404": {
"description": "Group not found"
}
}
}
},
"/groups/{slug}/members/{user}": {
"delete": {
"tags": ["Groups"],
"security": [
{
"user_auth": []
}
],
"summary": "Deletes group's member",
"parameters": [
{
"name": "slug",
"in": "path",
"required": true,
"type": "string",
"description": "Unique group's slug"
},
{
"name": "user",
"in": "path",
"required": true,
"type": "string",
"description": "User's id"
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Successful operation"
},
"400": {
"description": "Validation error"
},
"403": {
"description": "Current user is not group's owner or admin"
},
"404": {
"description": "Group not found"
}
}
}
},
"/groups/{slug}/admins": {
"get": {
"tags": ["Groups"],
"summary": "Returns list of group's admins",
"parameters": [
{
"name": "slug",
"in": "path",
"required": true,
"type": "string",
"description": "Unique group's slug"
},
{
"name": "onlyIds",
"in": "query",
"description": "Defines if endpoint should return only ids of admins or entire user's objects",
"required": false,
"type": "boolean"
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/User"
}
}
},
"404": {
"description": "Group not found"
}
}
},
"post": {
"tags": ["Groups"],
"security": [
{
"user_auth": []
}
],
"summary": "Adds a new group's admin",
"parameters": [
{
"name": "slug",
"in": "path",
"required": true,
"type": "string",
"description": "Unique group's slug"
},
{
"name": "payload",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
"user": {
"type": "string"
}
}
}
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"201": {
"description": "Successful operation"
},
"400": {
"description": "Validation error"
},
"403": {
"description": "Current user is not group's owner"
},
"404": {
"description": "Group not found"
}
}
}
},
"/groups/{slug}/admins/{user}": {
"delete": {
"tags": ["Groups"],
"security": [
{
"user_auth": []
}
],
"summary": "Deletes group's admin",
"parameters": [
{
"name": "slug",
"in": "path",
"required": true,
"type": "string",
"description": "Unique group's slug"
},
{
"name": "user",
"in": "path",
"required": true,
"type": "string",
"description": "User's id"
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Successful operation"
},
"400": {
"description": "Validation error"
},
"403": {
"description": "Current user is not group's owner"
},
"404": {
"description": "Group not found"
}
}
}
},
"/groups/check-admin-rights": {
"get": {
"tags": ["Groups"],
"summary": "Checks if user has right to modify group",
"parameters": [
{
"name": "user",
"in": "query",
"required": true,
"type": "string",
"description": "User's id"
},
{
"name": "group",
"in": "query",
"required": true,
"type": "string",
"description": "Group's id"
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "User has admin rights"
},
"401": {
"description": "User does not have admin rights"
},
"404": {
"description": "Group does not exist in db"
}
}
}
},
"/groups/find-by-ids": {
"post": {
"tags": ["Groups"],
"summary": "Returns groups by ids",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"ids": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Group"
}
}
}
}
}
},
"/groups/{slug}/invitations": {
"post": {
"tags": ["Groups"],
"summary": "Creates a new inviatation to the group",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "slug",
"in": "path",
"required": true,
"type": "string",
"description": "Unique group's slug"
},
{
"name": "payload",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
"user": {
"type": "string"
}
}
}
}
],
"security": [
{
"user_auth": []
}
],
"responses": {
"201": {
"description": "Successful operation"
},
"400": {
"description": "Validation errors"
},
"404": {
"description": "Group not found"
}
}
},
"get": {
"tags": ["Groups"],
"summary": "Returns list of invitations to the group",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "slug",
"in": "path",
"required": true,
"type": "string",
"description": "Unique group's slug"
}
],
"security": [
{
"user_auth": []
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"total": {
"type": "number"
},
"limit": {
"type": "number"
},
"offset": {
"type": "number"
},
"docs": {
"type": "array",
"items": {
"$ref": "#/definitions/Invitation"
}
}
}
}
},
"403": {
"description": "User is not group's owner or group's admin"
},
"404": {
"description": "Group does not exist"
}
}
}
},
"/groups/{slug}/requests": {
"post": {
"tags": ["Groups"],
"summary": "Creates a new request to the group",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "slug",
"in": "path",
"required": true,
"type": "string",
"description": "Unique group's slug"
}
],
"security": [
{
"user_auth": []
}
],
"responses": {
"201": {
"description": "Successful operation"
},
"400": {
"description": "Validation errors"
},
"404": {
"description": "Group not found"
}
}
},
"get": {
"tags": ["Groups"],
"summary": "Returns list of requests to the group",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "slug",
"in": "path",
"required": true,
"type": "string",
"description": "Unique group's slug"
}
],
"security": [
{
"user_auth": []
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"total": {
"type": "number"
},
"limit": {
"type": "number"
},
"offset": {
"type": "number"
},
"docs": {
"type": "array",
"items": {
"$ref": "#/definitions/Invitation"
}
}
}
}
},
"403": {
"description": "User is not group's owner or group's admin"
},
"404": {
"description": "Group does not exist"
}
}
}
},
"/groups/invitations/my": {
"get": {
"tags": ["Groups"],
"summary": "Returns list of requests and invitations to groups for current user",
"consumes": ["application/json"],
"produces": ["application/json"],
"security": [
{
"user_auth": []
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Invitation"
}
}
}
}
}
},
"/groups/invitations/{id}": {
"delete": {
"tags": ["Groups"],
"summary": "Deletes group's inviatation/request by id",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string",
"description": "Invitation's id"
}
],
"security": [
{
"user_auth": []
}
],
"responses": {
"200": {
"description": "Successful operation"
},
"403": {
"description": "User is not group's owner, group's admin and invitation owner"
},
"404": {
"description": "Group does not exist"
}
}
}
},
"/groups/can-add-post": {
"get": {
"tags": ["Groups"],
"summary": "Checks if user is allowed to add a post to the group",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "user",
"in": "query",
"required": true,
"type": "string",
"description": "User's id"
},
{
"name": "group",
"in": "query",
"required": true,
"type": "string",
"description": "Group's id"
}
],
"responses": {
"200": {
"description": "User can add a post"
},
"400": {
"description": "Query params are invalid"
},
"401": {
"description": "User can not add any posts to the group"
},
"404": {
"description": "Group does not exist"
}
}
}
},
"/notifications": {
"get": {
"security": [
{
"user_auth": []
}
],
"tags": ["Notifications"],
"summary": "Returns unread notifications",
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Successful operation"
}
}
}
},
"/notifications/recent": {
"get": {
"security": [
{
"user_auth": []
}
],
"tags": ["Notifications"],
"summary": "Returns recent notifications",
"parameters": [
{
"name": "limit",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records limit (no more than 50)"
},
{
"name": "offset",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records offset"
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Successful operation"
}
}
}
},
"/notifications/web-push": {
"post": {
"security": [
{
"user_auth": []
}
],
"tags": ["Notifications"],
"summary": "Creates a new web push subscription",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"subscription": {
"type": "string",
"description": "Base64 encoded subscription object"
},
"userAgent": {
"type": "string"
}
}
}
}
],
"responses": {
"201": {
"description": "Successful operation"
},
"400": {
"description": "Validation errors",
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/ValidationError"
}
}
}
}
}
},
"/notifications/web-push/{subscription}": {
"delete": {
"security": [
{
"user_auth": []
}
],
"tags": ["Notifications"],
"summary": "Deletes subscription",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "subscription",
"in": "path",
"required": true,
"type": "string",
"description": "Base64 encoded subscription object"
}
],
"responses": {
"200": {
"description": "Successful operation"
},
"404": {
"description": "Subscription does not exist"
}
}
}
},
"/notifications/web-push/check": {
"post": {
"security": [
{
"user_auth": []
}
],
"tags": ["Notifications"],
"summary": "Checks if subscription exists",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"subscription": {
"type": "string"
},
"userAgent": {
"type": "string"
}
}
}
}
],
"responses": {
"200": {
"description": "Subscription exists"
},
"404": {
"description": "Subscription does not exist"
}
}
}
},
"/notifications/settings": {
"post": {
"security": [
{
"user_auth": []
}
],
"tags": ["Notifications"],
"summary": "Updates user's notification settings",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"invitation": {
"type": "boolean"
},
"newPostInOwnedGroup": {
"type": "boolean"
},
"newMembershipRequestInOwnedGroup": {
"type": "boolean"
},
"newMemberInOwnedGroup": {
"type": "boolean"
},
"newPostInAdminnedGroup": {
"type": "boolean"
},
"newMembershipRequestInAdminnedGroup": {
"type": "boolean"
},
"newMemberInAdminnedGroup": {
"type": "boolean"
}
}
}
}
],
"responses": {
"200": {
"description": "Successful operation"
},
"400": {
"description": "Validation errors",
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/ValidationError"
}
}
}
}
},
"get": {
"security": [
{
"user_auth": []
}
],
"tags": ["Notifications"],
"summary": "Returns user's notification settings",
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"invitation": {
"type": "boolean"
},
"newPostInOwnedGroup": {
"type": "boolean"
},
"newMembershipRequestInOwnedGroup": {
"type": "boolean"
},
"newMemberInOwnedGroup": {
"type": "boolean"
},
"newPostInAdminnedGroup": {
"type": "boolean"
},
"newMembershipRequestInAdminnedGroup": {
"type": "boolean"
},
"newMemberInAdminnedGroup": {
"type": "boolean"
}
}
}
}
}
}
},
"/notifications/follow": {
"get": {
"security": [
{
"user_auth": []
}
],
"tags": ["Notifications"],
"summary": "Checks if current user follows group or user",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "user",
"in": "query",
"required": false,
"type": "string",
"description": "User's id to check"
},
{
"name": "group",
"in": "query",
"required": false,
"type": "string",
"description": "Group's id to check"
}
],
"responses": {
"200": {
"description": "User follows"
},
"400": {
"description": "Query param is missing, or both are present"
},
"404": {
"description": "User does not follow"
}
}
},
"post": {
"security": [
{
"user_auth": []
}
],
"tags": ["Notifications"],
"summary": "Subscribes for group or user notifications",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"user": {
"type": "string"
},
"group": {
"type": "string"
}
}
}
}
],
"responses": {
"201": {
"description": "Successful operation"
},
"400": {
"description": "Invalid payload"
}
}
},
"delete": {
"security": [
{
"user_auth": []
}
],
"tags": ["Notifications"],
"summary": "Unsubscribes from group or user notifications",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "query",
"description": "User's id",
"name": "user",
"type": "string",
"required": true
},
{
"in": "query",
"description": "Group's id",
"name": "group",
"type": "string",
"required": true
}
],
"responses": {
"200": {
"description": "Successful operation"
},
"400": {
"description": "Invalid payload"
}
}
}
},
"/tags/find": {
"get": {
"tags": ["Tags"],
"summary": "Allow to find tags by name",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "query",
"in": "query",
"required": true,
"type": "string",
"description": "Term to search"
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
},
"400": {
"description": "Query param is missing"
}
}
}
},
"/tags/suggested": {
"post": {
"tags": ["Tags"],
"summary": "Return suggested tags",
"security": [
{
"user_auth": []
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "payload",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
},
"400": {
"description": "Query param is missing"
}
}
}
},
"/tags/promoted": {
"post": {
"security": [
{
"user_auth": []
}
],
"tags": ["Tags"],
"summary": "Creates a new promoted tag for a group",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"tag": {
"type": "string"
},
"group": {
"type": "string"
},
"order": {
"type": "number"
}
}
}
}
],
"responses": {
"201": {
"description": "Successful operation",
"schema": {
"$ref": "#/definitions/PromotedTag"
}
},
"400": {
"description": "Validation errors",
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/ValidationError"
}
}
},
"403": {
"description": "User does not have group's admin rights"
}
}
}
},
"/tags/promoted/group/{id}": {
"put": {
"security": [
{
"user_auth": []
}
],
"tags": ["Tags"],
"summary": "Bulk update group's promoted tags",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string",
"description": "Group's id"
},
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"op": {
"type": "string"
},
"path": {
"type": "string"
},
"value": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"tag": {
"type": "string"
},
"group": {
"type": "string"
},
"order": {
"type": "number"
}
}
}
}
}
}
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"status": {
"type": "string"
},
"path": {
"type": "string"
},
"value": {
"$ref": "#/definitions/PromotedTag"
}
}
}
}
}
}
},
"get": {
"tags": ["Tags"],
"summary": "Returns promoted tags for a group",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string",
"description": "Group's id"
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/PromotedTag"
}
}
}
}
}
},
"/tags/promoted/{id}": {
"post": {
"security": [
{
"user_auth": []
}
],
"tags": ["Tags"],
"summary": "Updates promoted tag",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"type": "string",
"description": "Tag's id"
},
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"descripiotn": {
"type": "string"
},
"order": {
"type": "integer"
}
}
}
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"$ref": "#/definitions/PromotedTag"
}
},
"400": {
"description": "Validation errors",
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/ValidationError"
}
}
},
"403": {
"description": "User does not have rights to update record"
}
}
},
"delete": {
"security": [
{
"user_auth": []
}
],
"tags": ["Tags"],
"summary": "Deletes promoted tag",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"type": "string",
"description": "Tag's id"
}
],
"responses": {
"200": {
"description": "Successful operation"
},
"403": {
"description": "User does not have rights to delete record"
},
"404": {
"description": "Group tag does not exist"
}
}
}
},
"/files/groups/logo": {
"post": {
"security": [
{
"user_auth": []
}
],
"tags": ["Files"],
"summary": "Uploads group's logo",
"consumes": ["multipart/form-data"],
"produces": ["application/json"],
"parameters": [
{
"in": "formData",
"name": "file",
"required": true,
"type": "file"
},
{
"in": "formData",
"name": "relatedRecord",
"type": "string",
"required": true
}
],
"responses": {
"201": {
"description": "Successful operation"
},
"400": {
"description": "Invalid payload"
}
}
}
},
"/files/groups/bg": {
"post": {
"security": [
{
"user_auth": []
}
],
"tags": ["Files"],
"summary": "Uploads group's background",
"consumes": ["multipart/form-data"],
"produces": ["application/json"],
"parameters": [
{
"in": "formData",
"name": "file",
"required": true,
"type": "file"
},
{
"in": "formData",
"name": "relatedRecord",
"type": "string",
"required": true
}
],
"responses": {
"201": {
"description": "Successful operation"
},
"400": {
"description": "Invalid payload"
}
}
}
},
"/files/avatar": {
"post": {
"security": [
{
"user_auth": []
}
],
"tags": ["Files"],
"summary": "Uploads user's avatar",
"consumes": ["multipart/form-data"],
"produces": ["application/json"],
"parameters": [
{
"in": "formData",
"name": "file",
"required": true,
"type": "file"
},
{
"in": "formData",
"name": "relatedRecord",
"type": "string",
"required": true
}
],
"responses": {
"201": {
"description": "Successful operation"
},
"400": {
"description": "Invalid payload"
}
}
}
},
"/files/gallery": {
"post": {
"security": [
{
"user_auth": []
}
],
"tags": ["Files"],
"summary": "Uploads user's gallery image",
"consumes": ["multipart/form-data"],
"produces": ["application/json"],
"parameters": [
{
"in": "formData",
"name": "file",
"required": true,
"type": "file"
},
{
"in": "formData",
"name": "relatedRecord",
"type": "string",
"required": true
}
],
"responses": {
"201": {
"description": "Successful operation"
},
"400": {
"description": "Invalid payload"
}
}
}
},
"/files/tags/promoted": {
"post": {
"security": [
{
"user_auth": []
}
],
"tags": ["Files"],
"summary": "Uploads promoted tag's logo",
"consumes": ["multipart/form-data"],
"produces": ["application/json"],
"parameters": [
{
"in": "formData",
"name": "file",
"required": true,
"type": "file"
},
{
"in": "formData",
"name": "relatedRecord",
"type": "string",
"required": true
}
],
"responses": {
"201": {
"description": "Successful operation"
},
"400": {
"description": "Invalid payload"
}
}
}
},
"/posts": {
"post": {
"security": [
{
"user_auth": []
}
],
"tags": ["Posts"],
"summary": "Creates a new post",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"group": {
"type": "string"
},
"text": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
],
"responses": {
"201": {
"description": "Successful operation",
"schema": {
"$ref": "#/definitions/Post"
}
},
"400": {
"description": "Validation errors",
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/ValidationError"
}
}
},
"403": {
"description": "User has no rights to create a post in provided group"
}
}
}
},
"/posts/{id}": {
"get": {
"tags": ["Posts"],
"summary": "Returns a post",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"type": "string",
"description": "Post's id"
},
{
"in": "query",
"name": "group",
"required": false,
"type": "boolean",
"description": "Defines if together with post info about group should be returned"
},
{
"in": "query",
"name": "owner",
"required": false,
"type": "boolean",
"description": "Defines if together with post info about owner should be returned"
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"allOf": [
{
"$ref": "#/definitions/Post"
},
{
"type": "object",
"properties": {
"group": {
"$ref": "#/definitions/Group"
},
"owner": {
"$ref": "#/definitions/User"
}
}
}
]
}
},
"404": {
"description": "Post does not exist"
}
}
},
"post": {
"tags": ["Posts"],
"security": [
{
"user_auth": []
}
],
"summary": "Updates a post",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"type": "string",
"description": "Post's id"
},
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"text": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"$ref": "#/definitions/Post"
}
},
"400": {
"description": "Validation errors",
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/ValidationError"
}
}
},
"403": {
"description": "Edition timeout passed"
},
"404": {
"description": "Post does not exist"
}
}
}
},
"/posts/group/{id}": {
"get": {
"tags": ["Posts"],
"summary": "Returns group's posts",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"type": "string",
"description": "Group's id"
},
{
"name": "limit",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records limit (no more than 50)"
},
{
"name": "offset",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records offset"
},
{
"name": "sort",
"in": "query",
"required": false,
"type": "string",
"description": "popular | latest | active"
},
{
"name": "tags",
"in": "query",
"required": false,
"type": "array",
"items": {
"type": "string"
}
},
{
"name": "users",
"in": "query",
"required": false,
"type": "array",
"items": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"total": {
"type": "number"
},
"limit": {
"type": "number"
},
"offset": {
"type": "number"
},
"docs": {
"type": "array",
"items": {
"$ref": "#/definitions/Post"
}
}
}
}
}
}
}
},
"/posts/find": {
"get": {
"tags": ["Posts"],
"summary": "Allows to search in posts",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "limit",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records limit (no more than 50)"
},
{
"name": "offset",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records offset"
},
{
"name": "tags",
"in": "query",
"required": false,
"type": "array",
"items": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"total": {
"type": "number"
},
"limit": {
"type": "number"
},
"offset": {
"type": "number"
},
"docs": {
"type": "array",
"items": {
"$ref": "#/definitions/Post"
}
}
}
}
}
}
}
},
"/posts/user/{id}": {
"get": {
"tags": ["Posts"],
"summary": "Returns users's posts",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"type": "string",
"description": "User's id"
},
{
"name": "limit",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records limit (no more than 50)"
},
{
"name": "offset",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records offset"
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"total": {
"type": "number"
},
"limit": {
"type": "number"
},
"offset": {
"type": "number"
},
"docs": {
"type": "array",
"items": {
"$ref": "#/definitions/Post"
}
}
}
}
}
}
}
},
"/posts/my": {
"get": {
"tags": ["Posts"],
"security": [
{
"user_auth": []
}
],
"summary": "Returns current user's posts",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "limit",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records limit (no more than 50)"
},
{
"name": "offset",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records offset"
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"total": {
"type": "number"
},
"limit": {
"type": "number"
},
"offset": {
"type": "number"
},
"docs": {
"type": "array",
"items": {
"$ref": "#/definitions/Post"
}
}
}
}
}
}
}
},
"/posts/find-by-ids": {
"post": {
"tags": ["Posts"],
"summary": "Returns posts by ids",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"ids": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
{
"in": "query",
"description": "Defines if together with post group info should be returned",
"name": "groups",
"type": "boolean",
"required": false
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Post"
}
}
}
}
}
},
"/posts/{id}/favs": {
"get": {
"tags": ["Posts"],
"summary": "Returns list of users which added post to favs",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"type": "string",
"description": "Posts's id"
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/User"
}
}
}
}
},
"post": {
"tags": ["Posts"],
"security": [
{
"user_auth": []
}
],
"summary": "Adds a post to user's favs",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"type": "string",
"description": "Posts's id"
}
],
"responses": {
"201": {
"description": "Successful operation"
}
}
},
"delete": {
"tags": ["Posts"],
"security": [
{
"user_auth": []
}
],
"summary": "Removes a post from user's favs",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"type": "string",
"description": "Post's id"
}
],
"responses": {
"200": {
"description": "Successful operation"
}
}
}
},
"/posts/my/favs": {
"get": {
"tags": ["Posts"],
"security": [
{
"user_auth": []
}
],
"summary": "Return user's favs posts",
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/User"
}
}
}
}
}
},
"/comments": {
"post": {
"security": [
{
"user_auth": []
}
],
"tags": ["Comments"],
"summary": "Creates a comment to a post",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"post": {
"type": "string"
},
"parent": {
"type": "string"
},
"text": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
],
"responses": {
"201": {
"description": "Successful operation",
"schema": {
"$ref": "#/definitions/Comment"
}
},
"400": {
"description": "Validation errors",
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/ValidationError"
}
}
}
}
}
},
"/comments/{id}": {
"post": {
"security": [
{
"user_auth": []
}
],
"tags": ["Comments"],
"summary": "Updates a comment",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"type": "string",
"description": "Comment's id"
},
{
"in": "body",
"name": "payload",
"required": true,
"schema": {
"type": "object",
"properties": {
"text": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"$ref": "#/definitions/Comment"
}
},
"400": {
"description": "Validation errors",
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/ValidationError"
}
}
},
"403": {
"description": "Edition timeout passed"
}
}
}
},
"/comments/{id}/nested": {
"get": {
"tags": ["Comments"],
"summary": "Returns subComments related to comment",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"type": "string",
"description": "Comment's id"
},
{
"name": "limit",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records limit (no more than 50)"
},
{
"name": "offset",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records offset"
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"total": {
"type": "number"
},
"limit": {
"type": "number"
},
"offset": {
"type": "number"
},
"docs": {
"type": "array",
"items": {
"$ref": "#/definitions/Comment"
}
}
}
}
}
}
}
},
"/comments/my": {
"get": {
"security": [
{
"user_auth": []
}
],
"tags": ["Comments"],
"summary": "Returns subComments related to comment",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "limit",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records limit (no more than 50)"
},
{
"name": "offset",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records offset"
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"total": {
"type": "number"
},
"limit": {
"type": "number"
},
"offset": {
"type": "number"
},
"docs": {
"type": "array",
"items": {
"$ref": "#/definitions/Comment"
}
}
}
}
}
}
}
},
"/comments/post/{id}": {
"get": {
"tags": ["Comments"],
"summary": "Returns comments related to post",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"type": "string",
"description": "Post's id"
},
{
"name": "limit",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records limit (no more than 50)"
},
{
"name": "offset",
"in": "query",
"required": false,
"type": "number",
"description": "Returned records offset"
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"type": "object",
"properties": {
"total": {
"type": "number"
},
"limit": {
"type": "number"
},
"offset": {
"type": "number"
},
"docs": {
"type": "array",
"items": {
"$ref": "#/definitions/Comment"
}
}
}
}
}
}
}
}
},
"definitions": {
"User": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"surname": {
"type": "string"
},
"email": {
"type": "string",
"format": "email"
},
"phone": {
"type": "string",
"format": "phone-number"
},
"countryCode": {
"type": "string"
},
"languageCode": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"roles": {
"type": "array",
"items": {
"type": "string"
}
},
"avatar": {
"type": "object",
"properties": {
"status": {
"type": "string"
},
"files": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"postsCounter": {
"type": "number"
}
}
},
"Group": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"slug": {
"type": "string"
},
"description": {
"type": "string"
},
"type": {
"type": "string"
},
"visibility": {
"type": "string"
},
"avatar": {
"type": "object",
"properties": {
"status": {
"type": "string"
},
"files": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"owner": {
"type": "string"
},
"postsCounter": {
"type": "number"
},
"membersCounter": {
"type": "number"
}
}
},
"PromotedTag": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"tag": {
"type": "string"
},
"description": {
"type": "string"
},
"order": {
"type": "number"
},
"logo": {
"type": "object",
"properties": {
"status": {
"type": "string"
},
"files": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
},
"Post": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"text": {
"type": "string"
},
"firstComments": {
"type": "array",
"items": {
"$ref": "#/definitions/Comment"
}
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"lastTags": {
"type": "array",
"items": {
"type": "string"
}
},
"owner": {
"type": "string"
},
"commentsCounter": {
"type": "number"
},
"createdAt": {
"type": "string"
},
"updatedAt": {
"type": "string"
}
}
},
"Comment": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"text": {
"type": "string"
},
"lastSubComments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"owner": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"updatedAt": {
"type": "string"
},
"text": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"lastTags": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"lastTags": {
"type": "array",
"items": {
"type": "string"
}
},
"owner": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"updatedAt": {
"type": "string"
}
}
},
"Invitation": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"from": {
"$ref": "#/definitions/User"
},
"user": {
"$ref": "#/definitions/User"
},
"code": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"updatedAt": {
"type": "string"
}
}
},
"LoginHistory": {
"type": "object",
"properties": {
"ipAddress": {
"type": "string"
},
"date": {
"type": "string"
},
"userAgent": {
"type": "string"
}
}
},
"ActiveSession": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"ipAddress": {
"type": "string"
},
"userAgent": {
"type": "string"
},
"createdAt": {
"type": "string"
}
}
},
"JWT": {
"type": "object",
"properties": {
"accessToken": {
"type": "string"
},
"refreshToken": {
"type": "string"
}
}
},
"ValidationErrorProperty": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"type": {
"type": "string"
},
"path": {
"type": "string"
}
}
},
"ValidationError": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"name": {
"type": "string"
},
"properties": {
"$ref": "#/definitions/ValidationErrorProperty"
},
"kind": {
"type": "string"
},
"path": {
"type": "string"
}
}
}
},
"securityDefinitions": {
"user_auth": {
"type": "apiKey",
"in": "header",
"name": "x-access-token"
}
}
}
Editor is loading...