mirror of
https://github.com/hanzoai/team.git
synced 2026-09-30 01:57:35 +00:00
The server module named github.com/hanzoai/team/server/v8 — a path that resolves to the retired workspace's repository, not this one — while server/public still published github.com/mattermost/mattermost/server/public. Both are github.com/hanzoteam/server/... now, which is where this code actually lives. That second half is what made the binary unbootable. Upstream's public path stayed claimed by upstream, mattermost-plugin-ai imported it, and the build linked public/model twice; public/plugin's gob.Register then ran twice under one name and panicked at init, before main. Reverting the rename traded the brand for a working binary. Rebranding the plugin alongside it needs no such trade: the agents fork is github.com/hanzoteam/agents/v2 against our public module, so no module named mattermost/mattermost is in the graph at all. Measured: `go list -deps ./cmd/mattermost` names exactly one public/model, and it is ours.
40 lines
1.6 KiB
Go
40 lines
1.6 KiB
Go
package pluginapi
|
|
|
|
import (
|
|
"github.com/hanzoteam/server/server/public/model"
|
|
"github.com/hanzoteam/server/server/public/plugin"
|
|
)
|
|
|
|
// FrontendService exposes methods to interact with the frontend.
|
|
type FrontendService struct {
|
|
api plugin.API
|
|
}
|
|
|
|
// OpenInteractiveDialog will open an interactive dialog on a user's client that
|
|
// generated the trigger ID. Used with interactive message buttons, menus
|
|
// and slash commands.
|
|
//
|
|
// Minimum server version: 5.6
|
|
func (f *FrontendService) OpenInteractiveDialog(dialog model.OpenDialogRequest) error {
|
|
return normalizeAppErr(f.api.OpenInteractiveDialog(dialog))
|
|
}
|
|
|
|
// PublishWebSocketEvent sends an event to WebSocket connections.
|
|
// event is the type and will be prepended with "custom_<pluginid>_".
|
|
// payload is the data sent with the event. Interface values must be primitive Go types or mattermost-server/model types.
|
|
// broadcast determines to which users to send the event.
|
|
//
|
|
// Minimum server version: 5.2
|
|
func (f *FrontendService) PublishWebSocketEvent(event string, payload map[string]any, broadcast *model.WebsocketBroadcast) {
|
|
f.api.PublishWebSocketEvent(event, payload, broadcast)
|
|
}
|
|
|
|
// SendToastMessage sends a toast notification to a specific user or user session.
|
|
// The userID parameter specifies the user to send the toast to.
|
|
// If connectionID is set, the toast will only be sent to that specific connection.
|
|
//
|
|
// Minimum server version: 11.5
|
|
func (f *FrontendService) SendToastMessage(userID, connectionID, message string, options model.SendToastMessageOptions) error {
|
|
return normalizeAppErr(f.api.SendToastMessage(userID, connectionID, message, options))
|
|
}
|