244 lines
8.0 KiB
YAML
244 lines
8.0 KiB
YAML
![]() |
openapi: 3.0.0
|
|||
|
info:
|
|||
|
description: "Шаблонизатор документов PenaHub для AMO CRM"
|
|||
|
version: 1.0.2
|
|||
|
title: "PenaHub Template generator"
|
|||
|
|
|||
|
servers:
|
|||
|
- url: https://tempgen.pena.digital
|
|||
|
|
|||
|
tags:
|
|||
|
- name: amo
|
|||
|
description: "Все что связано с amo"
|
|||
|
|
|||
|
paths:
|
|||
|
/amo:
|
|||
|
get:
|
|||
|
tags:
|
|||
|
- amo
|
|||
|
summary: "Сохранение amo токена аккаунта"
|
|||
|
description: "Вебхук предназначен для получения токена, после перехода по ссылке и подтверждения прав пользователем.
|
|||
|
После успешного выполнения перенаправляет на страницу настроек плагина в AMO CRM"
|
|||
|
operationId: AmoSaveToken
|
|||
|
parameters:
|
|||
|
- $ref: "#/components/parameters/access_token"
|
|||
|
- $ref: "#/components/parameters/code"
|
|||
|
- $ref: "#/components/parameters/client_id"
|
|||
|
- $ref: "#/components/parameters/expires_in"
|
|||
|
- $ref: "#/components/parameters/token_type"
|
|||
|
- $ref: "#/components/parameters/refresh_token"
|
|||
|
- $ref: "#/components/parameters/state"
|
|||
|
- $ref: "#/components/parameters/from_widget"
|
|||
|
- $ref: "#/components/parameters/referer"
|
|||
|
responses:
|
|||
|
308:
|
|||
|
description: "Permanent Redirect. Успешно"
|
|||
|
400:
|
|||
|
description: "Bad Request. Ошибка в запросе"
|
|||
|
401:
|
|||
|
description: "Unauthorized. State-токен не совпадает с ожидаемым"
|
|||
|
403:
|
|||
|
description: "Forbidden. Amo клиент выдал ошибку"
|
|||
|
500:
|
|||
|
$ref: "#/components/responses/InternalServerError"
|
|||
|
/amo/state:
|
|||
|
get:
|
|||
|
tags:
|
|||
|
- amo
|
|||
|
summary: "Получить состояние аккаунта пользователя в Amo"
|
|||
|
description: "Возвращает актуальное состояние аккаунта пользователя в AMO CRM. Авторизация происходит либо по jwt
|
|||
|
«AMO CRM» или «PenaHub»"
|
|||
|
responses:
|
|||
|
200:
|
|||
|
description: "Успешно"
|
|||
|
content:
|
|||
|
application/json:
|
|||
|
schema:
|
|||
|
$ref: "#/components/schemas/AmoState"
|
|||
|
|
|||
|
|
|||
|
components:
|
|||
|
parameters:
|
|||
|
access_token:
|
|||
|
name: access_token
|
|||
|
in: query
|
|||
|
required: true
|
|||
|
schema:
|
|||
|
type: string
|
|||
|
code:
|
|||
|
name: code
|
|||
|
in: query
|
|||
|
schema:
|
|||
|
type: string
|
|||
|
client_id:
|
|||
|
name: client_id
|
|||
|
in: query
|
|||
|
schema:
|
|||
|
type: string
|
|||
|
expires_in:
|
|||
|
name: expires_in
|
|||
|
in: query
|
|||
|
schema:
|
|||
|
type: integer
|
|||
|
format: timestamp
|
|||
|
token_type:
|
|||
|
name: token_type
|
|||
|
in: query
|
|||
|
schema:
|
|||
|
type: string
|
|||
|
refresh_token:
|
|||
|
name: refresh_token
|
|||
|
in: query
|
|||
|
schema:
|
|||
|
type: string
|
|||
|
state:
|
|||
|
name: state
|
|||
|
in: query
|
|||
|
required: true
|
|||
|
schema:
|
|||
|
type: string
|
|||
|
from_widget:
|
|||
|
name: from_widget
|
|||
|
in: query
|
|||
|
schema:
|
|||
|
type: string
|
|||
|
referer:
|
|||
|
name: referer
|
|||
|
in: query
|
|||
|
schema:
|
|||
|
type: string
|
|||
|
schemas:
|
|||
|
InternalServerError:
|
|||
|
type: string
|
|||
|
title: Internal server
|
|||
|
example: "Something wrong! Ow ow ow!"
|
|||
|
AmoState:
|
|||
|
type: object
|
|||
|
properties:
|
|||
|
gen_count:
|
|||
|
description: "Количество оставшихся генераций на аккаунте"
|
|||
|
type: integer
|
|||
|
example: 97
|
|||
|
auth_yandex_url:
|
|||
|
type: string
|
|||
|
description: "Ссылка для авторизации приложения в Yandex Disk"
|
|||
|
example: "https://oauth.yandex.ru/authorize?..."
|
|||
|
auth_google_url:
|
|||
|
type: string
|
|||
|
description: "Ссылка для авторизации приложения в Google Disk"
|
|||
|
example: "https://accounts.google.com/o/oauth2/auth?..."
|
|||
|
storages:
|
|||
|
type: object
|
|||
|
description: "Данные по хранилищам"
|
|||
|
properties:
|
|||
|
gdisk:
|
|||
|
type: array
|
|||
|
description: "Авторизованные Google Disk хранилища"
|
|||
|
items:
|
|||
|
$ref: "#/components/schemas/GDisk"
|
|||
|
yadisk:
|
|||
|
type: array
|
|||
|
description: "Авторизованные Yandex Disk хранилища"
|
|||
|
items:
|
|||
|
$ref: "#/components/schemas/YaDisk"
|
|||
|
|
|||
|
GDisk:
|
|||
|
type: object
|
|||
|
description: "Google Disk"
|
|||
|
properties:
|
|||
|
id:
|
|||
|
$ref: "#/components/schemas/id"
|
|||
|
user_id:
|
|||
|
$ref: "#/components/schemas/user_id"
|
|||
|
email:
|
|||
|
type: string
|
|||
|
description: "E-mail профиля Google"
|
|||
|
example: "johndoe@gmail.com"
|
|||
|
display_name:
|
|||
|
type: string
|
|||
|
description: "Отображаемое имя профиля Google"
|
|||
|
example: "John Doe"
|
|||
|
photo_link:
|
|||
|
type: string
|
|||
|
description: "Аватарка профиля Google"
|
|||
|
example: "https://lh3.googleusercontent.com/a/default-user=s64"
|
|||
|
name:
|
|||
|
type: string
|
|||
|
description: "Пользовательское название хранилища"
|
|||
|
example: "Google Disk (johndoe@gmail.com)"
|
|||
|
default_folder:
|
|||
|
type: string
|
|||
|
description: "Название стандартной папки приложения"
|
|||
|
example: "Template Generator"
|
|||
|
default_folder_id:
|
|||
|
type: string
|
|||
|
description: "Идентификатор папки в Google Disk"
|
|||
|
example: "1Qi0a0gEiuyZfgNm_DMg2-YAS9wtkZ3oQ"
|
|||
|
template_folder:
|
|||
|
type: string
|
|||
|
description: "Название папки с шаблонами"
|
|||
|
example: "templates"
|
|||
|
template_folder_id:
|
|||
|
type: string
|
|||
|
description: "Идентификатор папки с шаблонами в Google Disk"
|
|||
|
example: "Q230gEiuyASasdgNm_DMg2-YAS9wtkZadf"
|
|||
|
save_folder:
|
|||
|
type: string
|
|||
|
description: "Название папки с сгенерированными файлами"
|
|||
|
example: "saved"
|
|||
|
save_folder_id:
|
|||
|
type: string
|
|||
|
description: "Идентификатор папки с сгенерированными файлами в Google Disk"
|
|||
|
example: "a230gEiuyAaser1Nm_DMg2-YAS9wtfadtr"
|
|||
|
is_deleted:
|
|||
|
type: boolean
|
|||
|
description: "Флаг удалено хранилище пользователем"
|
|||
|
example: false
|
|||
|
created_at:
|
|||
|
$ref: "#/components/schemas/created_at"
|
|||
|
updated_at:
|
|||
|
$ref: "#/components/schemas/updated_at"
|
|||
|
|
|||
|
|
|||
|
YaDisk:
|
|||
|
type: object
|
|||
|
description: "Yandex Disk"
|
|||
|
properties:
|
|||
|
id:
|
|||
|
type: string
|
|||
|
description: "Уникальный идентификатор"
|
|||
|
example: "635520d143ebb05286f4fba6"
|
|||
|
user_id:
|
|||
|
type: string
|
|||
|
description: "Уникальный идентификатор пользователя"
|
|||
|
example: "62ac67a1471fd0f7892353bf"
|
|||
|
|
|||
|
|
|||
|
|
|||
|
id:
|
|||
|
type: string
|
|||
|
description: "Уникальный идентификатор"
|
|||
|
example: "635520d143ebb05286f4fba6"
|
|||
|
user_id:
|
|||
|
type: string
|
|||
|
description: "Уникальный идентификатор пользователя"
|
|||
|
example: "62ac67a1471fd0f7892353bf"
|
|||
|
created_at:
|
|||
|
type: string
|
|||
|
format: date-time
|
|||
|
description: "Время создания записи"
|
|||
|
example: "2022-10-23T11:09:05.35Z"
|
|||
|
updated_at:
|
|||
|
type: string
|
|||
|
format: date-time
|
|||
|
description: "Время последнего обновления записи"
|
|||
|
example: "2022-10-23T11:09:05.35Z"
|
|||
|
|
|||
|
|
|||
|
responses:
|
|||
|
InternalServerError:
|
|||
|
description: "Internal Server Error. Непредвиденная ошибка."
|
|||
|
content:
|
|||
|
application/json:
|
|||
|
schema:
|
|||
|
$ref: "#/components/schemas/InternalServerError"
|