Add session, frontend and command services.

Этот коммит содержится в:
Giorgi Bochorishvili
2022-12-26 15:59:49 +04:00
родитель 110a31afd6
Коммит 9a4963ecb0
4 изменённых файлов: 29 добавлений и 0 удалений

Просмотреть файл

@@ -239,6 +239,8 @@ func NewChannels(services map[product.ServiceKey]any) (*Channels, error) {
app: &App{ch: ch},
}
services[product.CommandKey] = &App{ch: ch}
return ch, nil
}

Просмотреть файл

@@ -253,6 +253,8 @@ func NewServer(options ...Option) (*Server, error) {
product.KVStoreKey: s.platform,
product.StoreKey: store.NewStoreServiceAdapter(s.Store()),
product.SystemKey: &systemServiceAdapter{server: s},
product.SessionKey: app,
product.FrontendKey: app,
}
// Step 4: Initialize products.

Просмотреть файл

@@ -231,3 +231,25 @@ type BoardsService interface {
DeleteCard(cardID string, userID string) error
HasPermissionToBoard(userID, boardID string, permission *model.Permission) bool
}
// SessionService is the API for accessing the session.
//
// The service shall be registered via app.SessionKey service key.
type SessionService interface {
GetSessionById(sessionID string) (*model.Session, *model.AppError)
}
// FrontendService is the API for interacting with front end.
//
// The service shall be registered via app.FrontendKey service key.
type FrontendService interface {
OpenInteractiveDialog(dialog model.OpenDialogRequest) *model.AppError
}
// CommandService is the API for interacting with front end.
//
// The service shall be registered via app.CommandKey service key.
type CommandService interface {
ExecuteCommand(c request.CTX, args *model.CommandArgs) (*model.CommandResponse, *model.AppError)
RegisterPluginCommand(pluginID string, command *model.Command) error
}

Просмотреть файл

@@ -26,4 +26,7 @@ const (
SystemKey ServiceKey = "systemkey"
PreferencesKey ServiceKey = "preferenceskey"
BoardsKey ServiceKey = "boards"
SessionKey ServiceKey = "sessionkey"
FrontendKey ServiceKey = "frontendkey"
CommandKey ServiceKey = "commandkey"
)