heruvym/openapi.yaml
Danil Solovyov ed40a66349 Added:
openapi.yaml
Changes:
    go.mod:
        - tidy
    service.go:
        - Create ticket поправлены статусы ответов
2023-04-24 19:50:13 +05:00

462 lines
13 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

openapi: 3.0.0
servers:
- url: http://localhost:8000/support
info:
description: ''
version: 1.0.0
title: Heruvym
paths:
/create:
post:
summary: Метод для создания тикета
security:
- bearer_in_cookie: []
responses:
'200':
description: Default response
content:
application/json:
schema:
type: object
properties:
Ticket:
type: string
example: c2fekjcobibtq7akknog
Sess:
type: string
example: fasdjklj2lz
'400':
$ref: "#/components/responses/BadRequest"
'401':
$ref: "#/components/responses/Unauthorized"
'500':
$ref: "#/components/responses/ErrorOccurred"
requestBody:
content:
application/json:
schema:
type: object
required:
- Title
- Message
properties:
Title:
type: string
example: test ticket title
Message:
type: string
example: test ticket message
/subscribe:
get:
summary: SSE метод для подписывания на изменения по всем тикетам доступным пользователю
security:
- bearer_in_query: []
responses:
'200':
description: Default response
headers:
Content-Type:
schema:
type: string
example: "text/event-stream"
enum:
- "text/event-stream"
Cache-Control:
schema:
type: string
example: "no-cache"
enum:
- "no-cache"
Connection:
schema:
type: string
example: "keep-alive"
enum:
- "keep-alive"
content:
application/json:
schema:
$ref: "#/components/schemas/Ticket"
'400':
$ref: "#/components/responses/BadRequest"
'401':
$ref: "#/components/responses/Unauthorized"
'424':
$ref: "#/components/responses/FailedDependency"
/ticket:
get:
summary: SSE метод для подписки на сообщения из одного тикета
security:
- bearer_in_query: []
responses:
'200':
description: Default response
headers:
Content-Type:
schema:
type: string
example: "text/event-stream"
enum:
- "text/event-stream"
Cache-Control:
schema:
type: string
example: "no-cache"
enum:
- "no-cache"
Connection:
schema:
type: string
example: "keep-alive"
enum:
- "keep-alive"
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
'400':
$ref: "#/components/responses/BadRequest"
'401':
$ref: "#/components/responses/Unauthorized"
'424':
$ref: "#/components/responses/FailedDependency"
/send:
post:
summary: Метод для отправки сообщения в тикет
security:
- bearer_in_cookie: []
requestBody:
content:
application/json:
schema:
type: object
required:
- message
- TicketID
- lang
properties:
message:
type: string
example: "test ticket message"
TicketID:
type: string
example: "c2fekjcobibtq7akknog"
lang:
type: string
example: "ru"
files:
type: array
items:
type: string
example: "idoffile"
responses:
'200':
description: Default response
'400':
$ref: "#/components/responses/BadRequest"
'401':
$ref: "#/components/responses/Unauthorized"
'500':
$ref: "#/components/responses/ErrorOccurred"
/getTickets:
post:
summary: Метод для получения тикетов с пагинацией
security:
- bearer_in_cookie: []
requestBody:
content:
application/json:
schema:
type: object
properties:
amt:
type: integer
example: 10
description: Количество тикетов на странице
page:
type: integer
example: 1
description: Страница
srch:
type: string
example: "test"
description: Поисковый запрос
status:
type: string
example: "open"
description: Статус тикета
responses:
'200':
description: Default response
content:
application/json:
schema:
type: object
properties:
Data:
type: array
items:
$ref: "#/components/schemas/Ticket"
Count:
type: integer
example: 10
description: Количество найденных тикетов по поисковому запросу
'204':
description: No content
'400':
$ref: "#/components/responses/BadRequest"
'401':
$ref: "#/components/responses/Unauthorized"
'500':
$ref: "#/components/responses/ErrorOccurred"
/getMessages:
post:
summary: Метод для получения сообщений тикета с пагинацией
security:
- bearer_in_cookie: [ ]
requestBody:
content:
application/json:
schema:
type: object
properties:
amt:
type: integer
example: 10
page:
type: integer
example: 1
srch:
type: string
example: "test"
ticket:
type: string
example: "c2fekjcobibtq7akknog"
responses:
'200':
description: Default response
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Message"
'204':
description: No content
'400':
$ref: "#/components/responses/BadRequest"
'401':
$ref: "#/components/responses/Unauthorized"
/pick:
post:
summary: Подхватывание сотрудником диалога
security:
- bearer_in_cookie: []
requestBody:
content:
application/json:
schema:
type: object
properties:
ticket:
type: string
example: "c2fekjcobibtq7akknog"
responses:
'200':
description: Default response
'400':
$ref: "#/components/responses/BadRequest"
'401':
$ref: "#/components/responses/Unauthorized"
/delegate:
post:
summary: Передача тикета другому сотруднику
security:
- bearer_in_cookie: []
requestBody:
content:
application/json:
schema:
type: object
properties:
ticket:
type: string
example: "c2fekjcobibtq7akknog"
answerer:
type: string
example: "c2fekjcobibtq7akknog"
responses:
'200':
description: Default response
'400':
$ref: "#/components/responses/BadRequest"
'401':
$ref: "#/components/responses/Unauthorized"
/vote:
post:
summary: Метод для оценки полезности ответа
security:
- bearer_in_cookie: []
requestBody:
content:
application/json:
schema:
type: object
properties:
ticket:
type: string
example: "c2fekjcobibtq7akknog"
rate:
type: string
example: "5"
responses:
'200':
description: Default response
'400':
$ref: "#/components/responses/BadRequest"
'401':
$ref: "#/components/responses/Unauthorized"
/close:
post:
summary: Метод для закрытия тикета
security:
- bearer_in_cookie: [ ]
requestBody:
content:
application/json:
schema:
type: object
properties:
ticket:
type: string
example: "c2fekjcobibtq7akknog"
responses:
'200':
description: Default response
content:
application/json:
schema:
type: object
properties:
Ticket:
type: string
example: c2fekjcobibtq7akknog
'400':
$ref: "#/components/responses/BadRequest"
'401':
$ref: "#/components/responses/Unauthorized"
components:
securitySchemes:
bearer_in_cookie:
type: apiKey
name: Authorization
in: cookie
description: "Cookie Bearer JWT авторизация. Пример: 'Bearer gvrektljh23nklje'"
bearer_in_query:
type: apiKey
name: Authorization
in: query
description: "Query Bearer JWT авторизация. Пример: 'gvrektljh23nklje'"
responses:
ErrorOccurred:
description: Error occurred
content:
text/plain:
schema:
type: string
example: "SomeErrorOccurred"
BadRequest:
description: Bad request
content:
text/plain:
schema:
type: string
example: "No title"
MethodNotAllowed:
description: Method not allowed
content:
text/plain:
schema:
type: string
example: "No session"
Unauthorized:
description: Unauthorized
FailedDependency:
description: "Failed dependency"
content:
text/plain:
schema:
type: string
example: "flushing is not allowed"
schemas:
Ticket:
type: object
properties:
ID:
type: string
example: "f34512sdaf234"
UserID:
type: string
example: "fw4ej5oi12mlfasd"
SessionID:
type: string
example: "fajsdlkgj34589w0"
AnswererID:
type: string
example: "ajrtopjnmklzweptik2"
State:
type: string
example: "open"
enum:
- "open"
- "closed"
- "answer"
- "wait"
TopMessage:
$ref: "#/components/schemas/Message"
Title:
type: string
example: "Test title"
CreatedAt:
type: string
format: date-time
example: "2017-07-21T17:32:28Z"
UpdatedAt:
type: string
format: date-time
example: "2017-07-21T17:32:28Z"
Rate:
type: integer
example: 1
Message:
type: object
properties:
ID:
type: string
example: "ZXC43n5klnzxlkcnfv34"
TicketID:
type: string
example: "jSDwerkljm23mios9"
UserID:
type: string
example: "flZmvlertjk6o453mlyhrty"
SessionID:
type: string
example: "ASpZp3245dllASgmkldrjJI"
Files:
type: array
items:
type: string
example: "iddoffile"
Shown:
type: object
additionalProperties:
type: integer
CreatedAt:
type: string
format: date-time
example: "2017-07-21T17:32:28Z"
security:
- bearer_in_cookie: []
- bearer_in_query: []