Files
isp-admin-service/docs/swagger.yaml
T

512 lines
13 KiB
YAML

basePath: /api/admin
definitions:
conf.UIDesign:
properties:
name:
type: string
primaryColor:
type: string
type: object
domain.AdminUserShort:
properties:
email:
type: string
firstName:
type: string
lastName:
type: string
role:
type: string
required:
- email
type: object
domain.CreateUserRequest:
properties:
email:
type: string
firstName:
type: string
lastName:
type: string
password:
type: string
roleId:
type: integer
required:
- email
- password
type: object
domain.DeleteResponse:
properties:
deleted:
type: integer
type: object
domain.GrpcError:
properties:
details:
items:
type: object
type: array
errorCode:
type: string
errorMessage:
type: string
type: object
domain.IdentitiesRequest:
properties:
ids:
items:
type: integer
type: array
required:
- ids
type: object
domain.LoginRequest:
properties:
email:
type: string
password:
type: string
required:
- email
- password
type: object
domain.LoginResponse:
properties:
expired:
type: string
headerName:
type: string
token:
type: string
type: object
domain.LoginSudirRequest:
properties:
authCode:
type: string
required:
- authCode
type: object
domain.SecureAuthRequest:
properties:
token:
type: string
type: object
domain.SecureAuthResponse:
properties:
adminId:
type: integer
authenticated:
type: boolean
errorReason:
type: string
type: object
domain.UpdateUserRequest:
properties:
email:
type: string
firstName:
type: string
id:
type: integer
lastName:
type: string
password:
type: string
roleId:
type: integer
required:
- id
type: object
domain.User:
properties:
createdAt:
type: string
email:
type: string
firstName:
type: string
id:
type: integer
lastName:
type: string
password:
type: string
roleId:
type: integer
sudirUserId:
type: string
updatedAt:
type: string
type: object
domain.UsersRequest:
properties:
email:
type: string
ids:
items:
type: integer
type: array
limit:
type: integer
offset:
type: integer
type: object
domain.UsersResponse:
properties:
items:
items:
$ref: '#/definitions/domain.User'
type: array
type: object
host: localhost:9000
info:
contact: {}
description: сервис администрирования
license:
name: GNU GPL v3.0
title: msp-admin-service
version: 1.0.0
paths:
/auth/login:
post:
consumes:
- application/json
description: Авторизация с получением токена администратора
parameters:
- description: Тело запроса
in: body
name: body
required: true
schema:
$ref: '#/definitions/domain.LoginRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/domain.LoginResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/domain.GrpcError'
"401":
description: Данные для авторизации не верны
schema:
$ref: '#/definitions/domain.GrpcError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/domain.GrpcError'
summary: Авторизация по логину и паролю
tags:
- auth
/auth/login_with_sudir:
post:
consumes:
- application/json
description: Авторизация с получением токена администратора
parameters:
- description: Тело запроса
in: body
name: body
required: true
schema:
$ref: '#/definitions/domain.LoginSudirRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/domain.LoginResponse'
"401":
description: Некорректный код для авторизации
schema:
$ref: '#/definitions/domain.GrpcError'
"412":
description: Авторизация СУДИР не настроена на сервере
schema:
$ref: '#/definitions/domain.GrpcError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/domain.GrpcError'
summary: Авторизация по авторизационному коду от СУДИР
tags:
- auth
/auth/logout:
post:
consumes:
- application/json
description: Выход из авторизованной сессии администрирования
parameters:
- description: Токен администратора
in: header
name: X-AUTH-ADMIN
required: true
type: string
produces:
- application/json
responses:
"200":
description: ""
"400":
description: Невалидный токен
schema:
$ref: '#/definitions/domain.GrpcError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/domain.GrpcError'
summary: Выход из авторизованной сессии
tags:
- auth
/secure/authenticate:
post:
consumes:
- application/json
description: Проверяет токен и возвращает идентификатор администратора
parameters:
- description: Токен администратора
in: header
name: X-AUTH-ADMIN
required: true
type: string
- description: Тело запроса
in: body
name: body
required: true
schema:
$ref: '#/definitions/domain.SecureAuthRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/domain.SecureAuthResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/domain.GrpcError'
summary: Метод аутентификации токена
tags:
- secure
/user/create_user:
post:
consumes:
- application/json
description: Создать пользователя
parameters:
- description: Токен администратора
in: header
name: X-AUTH-ADMIN
required: true
type: string
- description: Тело запроса
in: body
name: body
required: true
schema:
$ref: '#/definitions/domain.CreateUserRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/domain.User'
"400":
description: Невалидное тело запроса
schema:
$ref: '#/definitions/domain.GrpcError'
"409":
description: Пользователь с указанным email уже существует
schema:
$ref: '#/definitions/domain.GrpcError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/domain.GrpcError'
summary: Создать пользователя
tags:
- user
/user/delete_user:
post:
consumes:
- application/json
description: Удалить существующего пользователя
parameters:
- description: Токен администратора
in: header
name: X-AUTH-ADMIN
required: true
type: string
- description: Тело запроса
in: body
name: body
required: true
schema:
$ref: '#/definitions/domain.IdentitiesRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/domain.DeleteResponse'
"400":
description: Невалидное тело запроса
schema:
$ref: '#/definitions/domain.GrpcError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/domain.GrpcError'
summary: Удалить пользователя
tags:
- user
/user/get_design:
post:
consumes:
- application/json
description: Получение внешнего вида (палитра и наименование) админ-интерфейса
parameters:
- description: Токен администратора
in: header
name: X-AUTH-ADMIN
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/conf.UIDesign'
"400":
description: Невалидный токен
schema:
$ref: '#/definitions/domain.GrpcError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/domain.GrpcError'
summary: Получение внешнего вида
tags:
- user
/user/get_profile:
post:
consumes:
- application/json
description: Получить данные профиля
parameters:
- description: Токен администратора
in: header
name: X-AUTH-ADMIN
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/domain.AdminUserShort'
"400":
description: Невалидный токен
schema:
$ref: '#/definitions/domain.GrpcError'
"401":
description: Токен не соответствует ни одному пользователю
schema:
$ref: '#/definitions/domain.GrpcError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/domain.GrpcError'
summary: Получить профиль
tags:
- user
/user/get_users:
post:
consumes:
- application/json
description: Получить список пользователей
parameters:
- description: Токен администратора
in: header
name: X-AUTH-ADMIN
required: true
type: string
- description: Тело запроса
in: body
name: body
required: true
schema:
$ref: '#/definitions/domain.UsersRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/domain.UsersResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/domain.GrpcError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/domain.GrpcError'
summary: Список пользователей
tags:
- user
/user/update_user:
post:
consumes:
- application/json
description: Обновить данные существующего пользователя
parameters:
- description: Токен администратора
in: header
name: X-AUTH-ADMIN
required: true
type: string
- description: Тело запроса
in: body
name: body
required: true
schema:
$ref: '#/definitions/domain.UpdateUserRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/domain.User'
"400":
description: Невалидное тело запроса
schema:
$ref: '#/definitions/domain.GrpcError'
"404":
description: Пользователь с указанным id не существует
schema:
$ref: '#/definitions/domain.GrpcError'
"409":
description: Пользователь с указанным email уже существует
schema:
$ref: '#/definitions/domain.GrpcError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/domain.GrpcError'
summary: Обновить пользователя
tags:
- user
swagger: "2.0"