Shared channels plugin APIs for MS Teams plugin (#25805)

New plugin APIs and hooks for accessing Shared Channels service via plugin. 

- RegisterPluginForSharedChannels(opts model.RegisterPluginOpts) (remoteID string, err error)
- UnregisterPluginForSharedChannels(pluginID string) error
- ShareChannel(sc *model.SharedChannel) (*model.SharedChannel, error)
- UpdateSharedChannel(sc *model.SharedChannel) (*model.SharedChannel, error)
- UnshareChannel(channelID string) (unshared bool, err error)
- UpdateSharedChannelCursor(channelID, remoteID string, cusror model.GetPostsSinceForSyncCursor) error
- SyncSharedChannel(channelID string) error
- InviteRemoteToChannel(channelID string, remoteID string, userID string) error
- UninviteRemoteFromChannel(channelID string, remoteID string) error

Hooks
- OnSharedChannelsSyncMsg(msg *model.SyncMsg, rc *model.RemoteCluster) (model.SyncResponse, error)
- OnSharedChannelsPing(rc *model.RemoteCluster) bool
Этот коммит содержится в:
Doug Lauder
2023-12-22 17:00:27 -05:00
коммит произвёл GitHub
родитель 0f3553c8ab
Коммит 2d1135ca46
40 изменённых файлов: 1725 добавлений и 168 удалений

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

@@ -55,6 +55,8 @@ const (
MessageHasBeenDeletedID = 37
MessagesWillBeConsumedID = 38
ServeMetricsID = 39
OnSharedChannelsSyncMsgID = 40
OnSharedChannelsPingID = 41
TotalHooksID = iota
)
@@ -330,4 +332,26 @@ type Hooks interface {
//
// Minimum server version: 9.2
ServeMetrics(c *Context, w http.ResponseWriter, r *http.Request)
// OnSharedChannelsSyncMsg is invoked for plugins that wish to receive synchronization messages from the
// Shared Channels service for which they have been invited via InviteRemote. Each SyncMsg may contain
// multiple updates (posts, reactions, attachments, users) for a single channel.
//
// The cursor will be advanced based on the SyncResponse returned.
//
// Minimum server version: 9.5
OnSharedChannelsSyncMsg(msg *model.SyncMsg, rc *model.RemoteCluster) (model.SyncResponse, error)
// OnSharedChannelsPing is invoked for plugins to indicate the health of the plugin and the connection
// to the upstream service (e.g. MS Graph APIs).
//
// Return true to indicate all is well.
//
// Return false to indicate there is a problem with the plugin or connection to upstream service.
// Some number of failed pings will result in the plugin being marked offline and it will stop receiving
// OnSharedChannelsSyncMsg calls until it comes back online. The plugin will also appear offline in the status
// report via the `secure-connection status` slash command.
//
// Minimum server version: 9.5
OnSharedChannelsPing(rc *model.RemoteCluster) bool
}