389 lines
12 KiB
JSON
389 lines
12 KiB
JSON
{
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"description": "Auth server for EasyStartup.",
|
|
"title": "EasyStartup Auth",
|
|
"contact": {
|
|
"name": "API Support",
|
|
"email": "red.tea.dev@gmail.com"
|
|
},
|
|
"version": "1.0"
|
|
},
|
|
"host": "auth.easystartup.su",
|
|
"basePath": "/api",
|
|
"paths": {
|
|
"/api/user": {
|
|
"put": {
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"user"
|
|
],
|
|
"summary": "Create new user",
|
|
"parameters": [
|
|
{
|
|
"description": "User data in JSON",
|
|
"name": "user",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/esauth.User"
|
|
}
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "JWT Bearer token (authorization)",
|
|
"name": "Authorization",
|
|
"in": "header",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/esauth.User"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/user/all": {
|
|
"get": {
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"user"
|
|
],
|
|
"summary": "Get ids of users",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "limit of users size",
|
|
"name": "limit",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "select offset",
|
|
"name": "start",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "JWT Bearer token (authorization)",
|
|
"name": "Authorization",
|
|
"in": "header",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/user/count": {
|
|
"get": {
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"user"
|
|
],
|
|
"summary": "Get count of users",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "JWT Bearer token (authorization)",
|
|
"name": "Authorization",
|
|
"in": "header",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/handler.countResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/user/infinity-token": {
|
|
"get": {
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"user"
|
|
],
|
|
"summary": "Create infinity token (only for admin)",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "JWT Bearer token (authorization)",
|
|
"name": "Authorization",
|
|
"in": "header",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/handler.infinityTokenResponce"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/user/self": {
|
|
"get": {
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"user"
|
|
],
|
|
"summary": "Get current user",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "JWT Bearer token (authorization)",
|
|
"name": "Authorization",
|
|
"in": "header",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/esauth.User"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"user"
|
|
],
|
|
"summary": "Edit user",
|
|
"parameters": [
|
|
{
|
|
"description": "User description JSON",
|
|
"name": "user",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/handler.editInput"
|
|
}
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "JWT Bearer token (authorization)",
|
|
"name": "Authorization",
|
|
"in": "header",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/esauth.User"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/user/{user}": {
|
|
"get": {
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"user"
|
|
],
|
|
"summary": "Get user by id",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "search user by id",
|
|
"name": "user",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "JWT Bearer token (authorization)",
|
|
"name": "Authorization",
|
|
"in": "header",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/esauth.User"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"user"
|
|
],
|
|
"summary": "Edit user by id",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "edit user by id",
|
|
"name": "user",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"description": "User data in JSON",
|
|
"name": "user",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/esauth.User"
|
|
}
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "JWT Bearer token (authorization)",
|
|
"name": "Authorization",
|
|
"in": "header",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/esauth.User"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"user"
|
|
],
|
|
"summary": "Delete user by id",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "id of user",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "JWT Bearer token (authorization)",
|
|
"name": "Authorization",
|
|
"in": "header",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"esauth.User": {
|
|
"type": "object",
|
|
"properties": {
|
|
"access": {
|
|
"type": "string"
|
|
},
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"first_name": {
|
|
"type": "string"
|
|
},
|
|
"google_id": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "integer"
|
|
},
|
|
"last_name": {
|
|
"type": "string"
|
|
},
|
|
"picture_url": {
|
|
"type": "string"
|
|
},
|
|
"telegram_id": {
|
|
"type": "string"
|
|
},
|
|
"username": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"handler.countResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"count": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"handler.editInput": {
|
|
"type": "object",
|
|
"properties": {
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"first_name": {
|
|
"type": "string"
|
|
},
|
|
"last_name": {
|
|
"type": "string"
|
|
},
|
|
"picture_url": {
|
|
"type": "string"
|
|
},
|
|
"username": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"handler.infinityTokenResponce": {
|
|
"type": "object"
|
|
}
|
|
}
|
|
} |