87 lines
2.5 KiB
Go
87 lines
2.5 KiB
Go
// Code generated by ogen, DO NOT EDIT.
|
|
|
|
package oas
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
// Handler handles operations described by OpenAPI v3 specification.
|
|
type Handler interface {
|
|
// CreateChat implements createChat operation.
|
|
//
|
|
// Создать чат; вызывающий должен входить в member_ids.
|
|
//
|
|
// POST /api/v1/chats
|
|
CreateChat(ctx context.Context, req *CreateChat) (CreateChatRes, error)
|
|
// CreateMessage implements createMessage operation.
|
|
//
|
|
// Отправить сообщение.
|
|
//
|
|
// POST /api/v1/chats/{chat_id}/messages
|
|
CreateMessage(ctx context.Context, req *CreateMessage, params CreateMessageParams) (CreateMessageRes, error)
|
|
// CurrentUser implements currentUser operation.
|
|
//
|
|
// Текущий пользователь.
|
|
//
|
|
// GET /api/v1/users/me
|
|
CurrentUser(ctx context.Context) (CurrentUserRes, error)
|
|
// GetChat implements getChat operation.
|
|
//
|
|
// Получить доступный чат.
|
|
//
|
|
// GET /api/v1/chats/{chat_id}
|
|
GetChat(ctx context.Context, params GetChatParams) (GetChatRes, error)
|
|
// ListChats implements listChats operation.
|
|
//
|
|
// Чаты текущего пользователя.
|
|
//
|
|
// GET /api/v1/chats
|
|
ListChats(ctx context.Context, params ListChatsParams) (ListChatsRes, error)
|
|
// ListMessages implements listMessages operation.
|
|
//
|
|
// Сообщения по (created_at, id) по возрастанию.
|
|
//
|
|
// GET /api/v1/chats/{chat_id}/messages
|
|
ListMessages(ctx context.Context, params ListMessagesParams) (ListMessagesRes, error)
|
|
// Liveness implements liveness operation.
|
|
//
|
|
// Процесс жив.
|
|
//
|
|
// GET /health/live
|
|
Liveness(ctx context.Context) (LivenessRes, error)
|
|
// Readiness implements readiness operation.
|
|
//
|
|
// Готов принимать трафик.
|
|
//
|
|
// GET /health/ready
|
|
Readiness(ctx context.Context) (ReadinessRes, error)
|
|
// RegisterUser implements registerUser operation.
|
|
//
|
|
// Создать пользователя.
|
|
//
|
|
// POST /api/v1/users
|
|
RegisterUser(ctx context.Context, req *CreateUser) (RegisterUserRes, error)
|
|
}
|
|
|
|
// Server implements http server based on OpenAPI v3 specification and
|
|
// calls Handler to handle requests.
|
|
type Server struct {
|
|
h Handler
|
|
sec SecurityHandler
|
|
baseServer
|
|
}
|
|
|
|
// NewServer creates new Server.
|
|
func NewServer(h Handler, sec SecurityHandler, opts ...ServerOption) (*Server, error) {
|
|
s, err := newServerConfig(opts...).baseServer()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &Server{
|
|
h: h,
|
|
sec: sec,
|
|
baseServer: s,
|
|
}, nil
|
|
}
|