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 удалений

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

@@ -32,7 +32,7 @@ type API interface {
// Minimum server version: 5.2
RegisterCommand(command *model.Command) error
// UnregisterCommand unregisters a command previously registered via RegisterCommand.
// UnregisterCommand unregisters a command previously register via RegisterCommand.
//
// @tag Command
// Minimum server version: 5.2
@@ -1207,6 +1207,73 @@ type API interface {
// @tag User
// Minimum server version: 9.3
UpdateUserAuth(userID string, userAuth *model.UserAuth) (*model.UserAuth, *model.AppError)
// RegisterPluginForSharedChannels registers the plugin as a `Remote` for SharedChannels.
// The plugin will receive synchronization messages via the `OnSharedChannelsSyncMsg` hook.
// This API is idempotent - when called repeatedly with the same `RegisterPluginOpts.PluginID`
// it will return the same remoteID.
//
// @tag SharedChannels
// Minimum server version: 9.5
RegisterPluginForSharedChannels(opts model.RegisterPluginOpts) (remoteID string, err error)
// UnregisterPluginForSharedChannels unregisters the plugin as a `Remote` for SharedChannels.
// The plugin will no longer receive synchronization messages via the `OnSharedChannelsSyncMsg` hook.
//
// @tag SharedChannels
// Minimum server version: 9.5
UnregisterPluginForSharedChannels(pluginID string) error
// ShareChannel marks a channel for sharing via shared channels. Note, this does not automatically
// invite any remote clusters to the channel - use `InviteRemote` to invite a remote , or this plugin,
// to the shared channel and start synchronization.
//
// @tag SharedChannels
// Minimum server version: 9.5
ShareChannel(sc *model.SharedChannel) (*model.SharedChannel, error)
// UpdateSharedChannel updates a shared channel. This can be used to change the share name,
// display name, purpose, header, etc.
//
// @tag SharedChannels
// Minimum server version: 9.5
UpdateSharedChannel(sc *model.SharedChannel) (*model.SharedChannel, error)
// UnshareChannel unmarks a channel for sharing. The channel will no longer be shared and
// all remotes will be uninvited to the channel.
//
// @tag SharedChannels
// Minimum server version: 9.5
UnshareChannel(channelID string) (unshared bool, err error)
// UpdateSharedChannelCursor updates the cursor for the specified channel and RemoteID (passed by
// the plugin when registering). This can be used to manually set the point of last sync, either
// forward to skip older posts, or backward to re-sync history. This call by itself does not force
// a re-sync - a change to channel contents or a call to SyncSharedChannel are needed to force a sync.
//
// @tag SharedChannels
// Minimum server version: 9.5
UpdateSharedChannelCursor(channelID, remoteID string, cusror model.GetPostsSinceForSyncCursor) error
// SyncSharedChannel forces a shared channel to send any changed content to all remotes.
//
// @tag SharedChannels
// Minimum server version: 9.5
SyncSharedChannel(channelID string) error
// InviteRemoteToChannel invites a remote, or this plugin, as a target for synchronizing. Once invited, the
// remote will start to receive synchronization messages for any changed content in the specified channel.
//
// @tag SharedChannels
// Minimum server version: 9.5
InviteRemoteToChannel(channelID string, remoteID string, userID string) error
// UninviteRemoteFromChannel uninvites a remote, or this plugin, such that it will stop receiving sychronization
// messages for the channel.
//
// @tag SharedChannels
// Minimum server version: 9.5
UninviteRemoteFromChannel(channelID string, remoteID string) error
}
var handshake = plugin.HandshakeConfig{