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

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

@@ -2780,6 +2780,20 @@ func (_m *API) InstallPlugin(file io.Reader, replace bool) (*model.Manifest, *mo
return r0, r1
}
// InviteRemoteToChannel provides a mock function with given fields: channelID, remoteID, userID
func (_m *API) InviteRemoteToChannel(channelID string, remoteID string, userID string) error {
ret := _m.Called(channelID, remoteID, userID)
var r0 error
if rf, ok := ret.Get(0).(func(string, string, string) error); ok {
r0 = rf(channelID, remoteID, userID)
} else {
r0 = ret.Error(0)
}
return r0
}
// IsEnterpriseReady provides a mock function with given fields:
func (_m *API) IsEnterpriseReady() bool {
ret := _m.Called()
@@ -3309,6 +3323,30 @@ func (_m *API) RegisterCommand(command *model.Command) error {
return r0
}
// RegisterPluginForSharedChannels provides a mock function with given fields: opts
func (_m *API) RegisterPluginForSharedChannels(opts model.RegisterPluginOpts) (string, error) {
ret := _m.Called(opts)
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(model.RegisterPluginOpts) (string, error)); ok {
return rf(opts)
}
if rf, ok := ret.Get(0).(func(model.RegisterPluginOpts) string); ok {
r0 = rf(opts)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(model.RegisterPluginOpts) error); ok {
r1 = rf(opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// RemovePlugin provides a mock function with given fields: id
func (_m *API) RemovePlugin(id string) *model.AppError {
ret := _m.Called(id)
@@ -3731,6 +3769,60 @@ func (_m *API) SetUserStatusTimedDND(userId string, endtime int64) (*model.Statu
return r0, r1
}
// ShareChannel provides a mock function with given fields: sc
func (_m *API) ShareChannel(sc *model.SharedChannel) (*model.SharedChannel, error) {
ret := _m.Called(sc)
var r0 *model.SharedChannel
var r1 error
if rf, ok := ret.Get(0).(func(*model.SharedChannel) (*model.SharedChannel, error)); ok {
return rf(sc)
}
if rf, ok := ret.Get(0).(func(*model.SharedChannel) *model.SharedChannel); ok {
r0 = rf(sc)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.SharedChannel)
}
}
if rf, ok := ret.Get(1).(func(*model.SharedChannel) error); ok {
r1 = rf(sc)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SyncSharedChannel provides a mock function with given fields: channelID
func (_m *API) SyncSharedChannel(channelID string) error {
ret := _m.Called(channelID)
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(channelID)
} else {
r0 = ret.Error(0)
}
return r0
}
// UninviteRemoteFromChannel provides a mock function with given fields: channelID, remoteID
func (_m *API) UninviteRemoteFromChannel(channelID string, remoteID string) error {
ret := _m.Called(channelID, remoteID)
var r0 error
if rf, ok := ret.Get(0).(func(string, string) error); ok {
r0 = rf(channelID, remoteID)
} else {
r0 = ret.Error(0)
}
return r0
}
// UnregisterCommand provides a mock function with given fields: teamID, trigger
func (_m *API) UnregisterCommand(teamID string, trigger string) error {
ret := _m.Called(teamID, trigger)
@@ -3745,6 +3837,44 @@ func (_m *API) UnregisterCommand(teamID string, trigger string) error {
return r0
}
// UnregisterPluginForSharedChannels provides a mock function with given fields: pluginID
func (_m *API) UnregisterPluginForSharedChannels(pluginID string) error {
ret := _m.Called(pluginID)
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(pluginID)
} else {
r0 = ret.Error(0)
}
return r0
}
// UnshareChannel provides a mock function with given fields: channelID
func (_m *API) UnshareChannel(channelID string) (bool, error) {
ret := _m.Called(channelID)
var r0 bool
var r1 error
if rf, ok := ret.Get(0).(func(string) (bool, error)); ok {
return rf(channelID)
}
if rf, ok := ret.Get(0).(func(string) bool); ok {
r0 = rf(channelID)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(channelID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UpdateBotActive provides a mock function with given fields: botUserId, active
func (_m *API) UpdateBotActive(botUserId string, active bool) (*model.Bot, *model.AppError) {
ret := _m.Called(botUserId, active)
@@ -3999,6 +4129,46 @@ func (_m *API) UpdatePreferencesForUser(userID string, preferences []model.Prefe
return r0
}
// UpdateSharedChannel provides a mock function with given fields: sc
func (_m *API) UpdateSharedChannel(sc *model.SharedChannel) (*model.SharedChannel, error) {
ret := _m.Called(sc)
var r0 *model.SharedChannel
var r1 error
if rf, ok := ret.Get(0).(func(*model.SharedChannel) (*model.SharedChannel, error)); ok {
return rf(sc)
}
if rf, ok := ret.Get(0).(func(*model.SharedChannel) *model.SharedChannel); ok {
r0 = rf(sc)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.SharedChannel)
}
}
if rf, ok := ret.Get(1).(func(*model.SharedChannel) error); ok {
r1 = rf(sc)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UpdateSharedChannelCursor provides a mock function with given fields: channelID, remoteID, cusror
func (_m *API) UpdateSharedChannelCursor(channelID string, remoteID string, cusror model.GetPostsSinceForSyncCursor) error {
ret := _m.Called(channelID, remoteID, cusror)
var r0 error
if rf, ok := ret.Get(0).(func(string, string, model.GetPostsSinceForSyncCursor) error); ok {
r0 = rf(channelID, remoteID, cusror)
} else {
r0 = ret.Error(0)
}
return r0
}
// UpdateTeam provides a mock function with given fields: team
func (_m *API) UpdateTeam(team *model.Team) (*model.Team, *model.AppError) {
ret := _m.Called(team)

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

@@ -311,6 +311,44 @@ func (_m *Hooks) OnSendDailyTelemetry() {
_m.Called()
}
// OnSharedChannelsPing provides a mock function with given fields: rc
func (_m *Hooks) OnSharedChannelsPing(rc *model.RemoteCluster) bool {
ret := _m.Called(rc)
var r0 bool
if rf, ok := ret.Get(0).(func(*model.RemoteCluster) bool); ok {
r0 = rf(rc)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// OnSharedChannelsSyncMsg provides a mock function with given fields: msg, rc
func (_m *Hooks) OnSharedChannelsSyncMsg(msg *model.SyncMsg, rc *model.RemoteCluster) (model.SyncResponse, error) {
ret := _m.Called(msg, rc)
var r0 model.SyncResponse
var r1 error
if rf, ok := ret.Get(0).(func(*model.SyncMsg, *model.RemoteCluster) (model.SyncResponse, error)); ok {
return rf(msg, rc)
}
if rf, ok := ret.Get(0).(func(*model.SyncMsg, *model.RemoteCluster) model.SyncResponse); ok {
r0 = rf(msg, rc)
} else {
r0 = ret.Get(0).(model.SyncResponse)
}
if rf, ok := ret.Get(1).(func(*model.SyncMsg, *model.RemoteCluster) error); ok {
r1 = rf(msg, rc)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// OnWebSocketConnect provides a mock function with given fields: webConnID, userID
func (_m *Hooks) OnWebSocketConnect(webConnID string, userID string) {
_m.Called(webConnID, userID)