Documentation
¶
Overview ¶
Package webui provides the Web-UI implementation of the communication interface.
Index ¶
- Constants
- type Assistant
- func (a *Assistant) AddChannel(channelID string, dbLabInstance *dblab.Instance)
- func (a *Assistant) CheckIdleSessions(ctx context.Context)
- func (a *Assistant) Deregister(ctx context.Context) error
- func (a *Assistant) DumpSessions()
- func (a *Assistant) Init() error
- func (a *Assistant) Register(ctx context.Context) error
- func (a *Assistant) RestoreSessions(ctx context.Context) error
- type Message
- type MessageValidator
- type Messenger
- func (m Messenger) AddArtifact(title, content, _, messageID string) (artifactLink string, err error)
- func (m Messenger) DownloadArtifact(_ string) (response []byte, err error)
- func (m Messenger) Fail(message *models.Message, text string) error
- func (m Messenger) OK(message *models.Message) error
- func (m Messenger) Publish(message *models.Message) error
- func (m Messenger) UpdateStatus(message *models.Message, status models.MessageStatus) error
- func (m Messenger) UpdateText(message *models.Message) error
- type UserInformer
- type Verifier
Constants ¶
const CommunicationType = "webui"
CommunicationType defines a workspace type.
const (
VerificationSignatureKey = "Verification-Signature"
)
Verification constants.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assistant ¶
type Assistant struct {
// contains filtered or unexported fields
}
Assistant provides a service for interaction with a communication channel.
func NewAssistant ¶
func NewAssistant(cfg *config.Credentials, appCfg *config.Config, handlerPrefix string, pack *features.Pack, platformClient *platform.Client, sessionStorage storage.SessionStorage) *Assistant
NewAssistant returns a new assistant service.
func (*Assistant) AddChannel ¶
AddChannel sets a message processor for a specific channel.
func (*Assistant) CheckIdleSessions ¶
CheckIdleSessions check the running user sessions for idleness.
func (*Assistant) Deregister ¶
Deregister deregisters the assistant from the Platform.
func (*Assistant) DumpSessions ¶
func (a *Assistant) DumpSessions()
DumpSessions collects user's data from every message processor to sessionStorage.
type Message ¶
type Message struct { SessionID string `json:"session_id"` CommandID string `json:"command_id"` Text string `json:"text"` ChannelID string `json:"channel_id"` UserID string `json:"user_id"` Timestamp string `json:"timestamp"` }
Message represents commands coming from Platform.
func (*Message) ToIncomingMessage ¶
func (m *Message) ToIncomingMessage() models.IncomingMessage
ToIncomingMessage converts a WebUI message event to the standard incoming message.
type MessageValidator ¶
type MessageValidator struct { }
MessageValidator validates incoming messages.
func (MessageValidator) Validate ¶
func (m MessageValidator) Validate(incomingMessage *models.IncomingMessage) error
Validate validates an incoming message.
type Messenger ¶
type Messenger struct {
// contains filtered or unexported fields
}
Messenger provides a communication via Platform API.
func NewMessenger ¶
NewMessenger creates a new Platform messenger service.
func (Messenger) AddArtifact ¶
func (m Messenger) AddArtifact(title, content, _, messageID string) (artifactLink string, err error)
AddArtifact uploads artifacts to a channel.
func (Messenger) DownloadArtifact ¶
DownloadArtifact downloads snippets from a communication channel.
func (Messenger) UpdateStatus ¶
UpdateStatus updates message status.
type UserInformer ¶
type UserInformer struct { }
UserInformer provides a service for getting user info.
func NewUserInformer ¶
func NewUserInformer() UserInformer
NewUserInformer creates a new UserInformer service.
func (UserInformer) GetUserInfo ¶
func (m UserInformer) GetUserInfo(userID string) (models.UserInfo, error)
GetUserInfo returns user info by ID.
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
Verifier provides a Platform requests verifier.
func (*Verifier) Handler ¶
func (a *Verifier) Handler(h http.HandlerFunc) http.HandlerFunc
Handler provides a middleware to verify incoming requests.