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

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

@@ -297,3 +297,21 @@ type SyncResponse struct {
ReactionsLastUpdateAt int64 `json:"reactions_last_update_at"`
ReactionErrors []string `json:"reaction_errors"`
}
// RegisterPluginOpts is passed by plugins to the `RegisterPluginForSharedChannels` plugin API
// to provide options for registering as a shared channels remote.
type RegisterPluginOpts struct {
Displayname string // a displayname used in status reports
PluginID string // id of this plugin registering
CreatorID string // id of the user/bot registering
AutoShareDMs bool // when true, all DMs are automatically shared to this remote
}
// GetOptionFlags returns a Bitmask of option flags as specified by the boolean options.
func (po RegisterPluginOpts) GetOptionFlags() Bitmask {
var flags Bitmask
if po.AutoShareDMs {
flags |= BitflagOptionAutoShareDMs
}
return flags
}