490 lines
15 KiB
JSON
490 lines
15 KiB
JSON
{
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"title": "System Trace API",
|
|
"contact": {
|
|
"name": "https://peresvet.it"
|
|
},
|
|
"version": "1.0"
|
|
},
|
|
"basePath": "/v1",
|
|
"paths": {
|
|
"/auth/login": {
|
|
"post": {
|
|
"description": "Returns pair of access and refresh tokens",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "Request pair of tokens",
|
|
"parameters": [
|
|
{
|
|
"description": "Request body",
|
|
"name": "request",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/types.AuthBody"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/groups": {
|
|
"get": {
|
|
"description": "Returns array of groups and count",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"groups"
|
|
],
|
|
"summary": "Get groups (with pagination)",
|
|
"parameters": [
|
|
{
|
|
"maximum": 100,
|
|
"minimum": 10,
|
|
"type": "integer",
|
|
"description": "Count of rows",
|
|
"name": "count",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Rows to skip",
|
|
"name": "offset",
|
|
"in": "query",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/types.JSONPagination"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"description": "Create group with specified data",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"groups"
|
|
],
|
|
"summary": "Create group",
|
|
"parameters": [
|
|
{
|
|
"description": "Request body",
|
|
"name": "request",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/database.Group"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK"
|
|
}
|
|
}
|
|
},
|
|
"patch": {
|
|
"description": "Update group with specified data",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"groups"
|
|
],
|
|
"summary": "Update group",
|
|
"parameters": [
|
|
{
|
|
"description": "Request body",
|
|
"name": "request",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/database.Group"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/groups/:id": {
|
|
"get": {
|
|
"description": "Returns group instance",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"groups"
|
|
],
|
|
"summary": "Get group by ID",
|
|
"parameters": [
|
|
{
|
|
"minimum": 1,
|
|
"type": "integer",
|
|
"description": "Group ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/database.Group"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"description": "Delete group by ID",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"groups"
|
|
],
|
|
"summary": "Delete group",
|
|
"parameters": [
|
|
{
|
|
"minimum": 1,
|
|
"type": "integer",
|
|
"description": "Group ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/permissions": {
|
|
"get": {
|
|
"description": "Returns key-value map with permissions",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"summary": "Get list of permissions",
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/users": {
|
|
"get": {
|
|
"description": "Returns array of users and count",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"users"
|
|
],
|
|
"summary": "Get users (with pagination)",
|
|
"parameters": [
|
|
{
|
|
"maximum": 100,
|
|
"minimum": 10,
|
|
"type": "integer",
|
|
"description": "Count of rows",
|
|
"name": "count",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Rows to skip",
|
|
"name": "offset",
|
|
"in": "query",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/types.JSONPagination"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"description": "Create user with specified data",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"users"
|
|
],
|
|
"summary": "Create user",
|
|
"parameters": [
|
|
{
|
|
"description": "Request body",
|
|
"name": "request",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/database.User"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK"
|
|
}
|
|
}
|
|
},
|
|
"patch": {
|
|
"description": "Update user with specified data",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"users"
|
|
],
|
|
"summary": "Update user",
|
|
"parameters": [
|
|
{
|
|
"description": "Request body",
|
|
"name": "request",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/database.User"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/users/:id": {
|
|
"get": {
|
|
"description": "Returns user instance",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"users"
|
|
],
|
|
"summary": "Get user by ID",
|
|
"parameters": [
|
|
{
|
|
"minimum": 1,
|
|
"type": "integer",
|
|
"description": "User ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/database.User"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"description": "Delete user by ID",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"users"
|
|
],
|
|
"summary": "Delete user",
|
|
"parameters": [
|
|
{
|
|
"minimum": 1,
|
|
"type": "integer",
|
|
"description": "User ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"database.Group": {
|
|
"type": "object",
|
|
"properties": {
|
|
"createdAt": {
|
|
"type": "string"
|
|
},
|
|
"deletedAt": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "integer"
|
|
},
|
|
"issuer": {
|
|
"$ref": "#/definitions/database.User"
|
|
},
|
|
"issuerID": {
|
|
"type": "integer"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"permissions": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/database.GroupPermission"
|
|
}
|
|
},
|
|
"updatedAt": {
|
|
"type": "string"
|
|
},
|
|
"users": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/database.User"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"database.GroupPermission": {
|
|
"type": "object",
|
|
"properties": {
|
|
"value": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"database.User": {
|
|
"type": "object",
|
|
"properties": {
|
|
"createdAt": {
|
|
"type": "string"
|
|
},
|
|
"deletedAt": {
|
|
"type": "string"
|
|
},
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"group": {
|
|
"$ref": "#/definitions/database.Group"
|
|
},
|
|
"groupID": {
|
|
"type": "integer"
|
|
},
|
|
"id": {
|
|
"type": "integer"
|
|
},
|
|
"isActive": {
|
|
"type": "boolean"
|
|
},
|
|
"isRequiredToSetPassword": {
|
|
"type": "boolean"
|
|
},
|
|
"lastLogin": {
|
|
"type": "string"
|
|
},
|
|
"passwordHash": {
|
|
"type": "string"
|
|
},
|
|
"passwordLength": {
|
|
"type": "integer"
|
|
},
|
|
"realName": {
|
|
"type": "string"
|
|
},
|
|
"updatedAt": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"types.AuthBody": {
|
|
"type": "object",
|
|
"required": [
|
|
"email",
|
|
"password"
|
|
],
|
|
"properties": {
|
|
"email": {
|
|
"type": "string",
|
|
"example": "john@proton.mail"
|
|
},
|
|
"password": {
|
|
"type": "string",
|
|
"example": "Aasdfg1!"
|
|
}
|
|
}
|
|
},
|
|
"types.Cursor": {
|
|
"type": "object",
|
|
"properties": {
|
|
"count": {
|
|
"type": "integer"
|
|
},
|
|
"currentPage": {
|
|
"type": "integer"
|
|
},
|
|
"totalPages": {
|
|
"type": "number"
|
|
}
|
|
}
|
|
},
|
|
"types.JSONPagination": {
|
|
"type": "object",
|
|
"properties": {
|
|
"cursor": {
|
|
"$ref": "#/definitions/types.Cursor"
|
|
},
|
|
"data": {}
|
|
}
|
|
}
|
|
},
|
|
"securityDefinitions": {
|
|
"accessToken=...;refreshToken=...": {
|
|
"type": "apiKey",
|
|
"name": "Cookie",
|
|
"in": "header"
|
|
}
|
|
}
|
|
} |