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
Этот коммит содержится в:
@@ -947,6 +947,77 @@ func (s *hooksRPCServer) UserHasBeenDeactivated(args *Z_UserHasBeenDeactivatedAr
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
hookNameToId["OnSharedChannelsSyncMsg"] = OnSharedChannelsSyncMsgID
|
||||
}
|
||||
|
||||
type Z_OnSharedChannelsSyncMsgArgs struct {
|
||||
A *model.SyncMsg
|
||||
B *model.RemoteCluster
|
||||
}
|
||||
|
||||
type Z_OnSharedChannelsSyncMsgReturns struct {
|
||||
A model.SyncResponse
|
||||
B error
|
||||
}
|
||||
|
||||
func (g *hooksRPCClient) OnSharedChannelsSyncMsg(msg *model.SyncMsg, rc *model.RemoteCluster) (model.SyncResponse, error) {
|
||||
_args := &Z_OnSharedChannelsSyncMsgArgs{msg, rc}
|
||||
_returns := &Z_OnSharedChannelsSyncMsgReturns{}
|
||||
if g.implemented[OnSharedChannelsSyncMsgID] {
|
||||
if err := g.client.Call("Plugin.OnSharedChannelsSyncMsg", _args, _returns); err != nil {
|
||||
g.log.Error("RPC call OnSharedChannelsSyncMsg to plugin failed.", mlog.Err(err))
|
||||
}
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *hooksRPCServer) OnSharedChannelsSyncMsg(args *Z_OnSharedChannelsSyncMsgArgs, returns *Z_OnSharedChannelsSyncMsgReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
OnSharedChannelsSyncMsg(msg *model.SyncMsg, rc *model.RemoteCluster) (model.SyncResponse, error)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.OnSharedChannelsSyncMsg(args.A, args.B)
|
||||
returns.B = encodableError(returns.B)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("Hook OnSharedChannelsSyncMsg called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
hookNameToId["OnSharedChannelsPing"] = OnSharedChannelsPingID
|
||||
}
|
||||
|
||||
type Z_OnSharedChannelsPingArgs struct {
|
||||
A *model.RemoteCluster
|
||||
}
|
||||
|
||||
type Z_OnSharedChannelsPingReturns struct {
|
||||
A bool
|
||||
}
|
||||
|
||||
func (g *hooksRPCClient) OnSharedChannelsPing(rc *model.RemoteCluster) bool {
|
||||
_args := &Z_OnSharedChannelsPingArgs{rc}
|
||||
_returns := &Z_OnSharedChannelsPingReturns{}
|
||||
if g.implemented[OnSharedChannelsPingID] {
|
||||
if err := g.client.Call("Plugin.OnSharedChannelsPing", _args, _returns); err != nil {
|
||||
g.log.Error("RPC call OnSharedChannelsPing to plugin failed.", mlog.Err(err))
|
||||
}
|
||||
}
|
||||
return _returns.A
|
||||
}
|
||||
|
||||
func (s *hooksRPCServer) OnSharedChannelsPing(args *Z_OnSharedChannelsPingArgs, returns *Z_OnSharedChannelsPingReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
OnSharedChannelsPing(rc *model.RemoteCluster) bool
|
||||
}); ok {
|
||||
returns.A = hook.OnSharedChannelsPing(args.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("Hook OnSharedChannelsPing called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_RegisterCommandArgs struct {
|
||||
A *model.Command
|
||||
}
|
||||
@@ -6026,3 +6097,273 @@ func (s *apiRPCServer) UpdateUserAuth(args *Z_UpdateUserAuthArgs, returns *Z_Upd
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_RegisterPluginForSharedChannelsArgs struct {
|
||||
A model.RegisterPluginOpts
|
||||
}
|
||||
|
||||
type Z_RegisterPluginForSharedChannelsReturns struct {
|
||||
A string
|
||||
B error
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) RegisterPluginForSharedChannels(opts model.RegisterPluginOpts) (remoteID string, err error) {
|
||||
_args := &Z_RegisterPluginForSharedChannelsArgs{opts}
|
||||
_returns := &Z_RegisterPluginForSharedChannelsReturns{}
|
||||
if err := g.client.Call("Plugin.RegisterPluginForSharedChannels", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to RegisterPluginForSharedChannels API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) RegisterPluginForSharedChannels(args *Z_RegisterPluginForSharedChannelsArgs, returns *Z_RegisterPluginForSharedChannelsReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
RegisterPluginForSharedChannels(opts model.RegisterPluginOpts) (remoteID string, err error)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.RegisterPluginForSharedChannels(args.A)
|
||||
returns.B = encodableError(returns.B)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API RegisterPluginForSharedChannels called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_UnregisterPluginForSharedChannelsArgs struct {
|
||||
A string
|
||||
}
|
||||
|
||||
type Z_UnregisterPluginForSharedChannelsReturns struct {
|
||||
A error
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) UnregisterPluginForSharedChannels(pluginID string) error {
|
||||
_args := &Z_UnregisterPluginForSharedChannelsArgs{pluginID}
|
||||
_returns := &Z_UnregisterPluginForSharedChannelsReturns{}
|
||||
if err := g.client.Call("Plugin.UnregisterPluginForSharedChannels", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to UnregisterPluginForSharedChannels API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) UnregisterPluginForSharedChannels(args *Z_UnregisterPluginForSharedChannelsArgs, returns *Z_UnregisterPluginForSharedChannelsReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
UnregisterPluginForSharedChannels(pluginID string) error
|
||||
}); ok {
|
||||
returns.A = hook.UnregisterPluginForSharedChannels(args.A)
|
||||
returns.A = encodableError(returns.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API UnregisterPluginForSharedChannels called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_ShareChannelArgs struct {
|
||||
A *model.SharedChannel
|
||||
}
|
||||
|
||||
type Z_ShareChannelReturns struct {
|
||||
A *model.SharedChannel
|
||||
B error
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) ShareChannel(sc *model.SharedChannel) (*model.SharedChannel, error) {
|
||||
_args := &Z_ShareChannelArgs{sc}
|
||||
_returns := &Z_ShareChannelReturns{}
|
||||
if err := g.client.Call("Plugin.ShareChannel", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to ShareChannel API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) ShareChannel(args *Z_ShareChannelArgs, returns *Z_ShareChannelReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
ShareChannel(sc *model.SharedChannel) (*model.SharedChannel, error)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.ShareChannel(args.A)
|
||||
returns.B = encodableError(returns.B)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API ShareChannel called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_UpdateSharedChannelArgs struct {
|
||||
A *model.SharedChannel
|
||||
}
|
||||
|
||||
type Z_UpdateSharedChannelReturns struct {
|
||||
A *model.SharedChannel
|
||||
B error
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) UpdateSharedChannel(sc *model.SharedChannel) (*model.SharedChannel, error) {
|
||||
_args := &Z_UpdateSharedChannelArgs{sc}
|
||||
_returns := &Z_UpdateSharedChannelReturns{}
|
||||
if err := g.client.Call("Plugin.UpdateSharedChannel", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to UpdateSharedChannel API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) UpdateSharedChannel(args *Z_UpdateSharedChannelArgs, returns *Z_UpdateSharedChannelReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
UpdateSharedChannel(sc *model.SharedChannel) (*model.SharedChannel, error)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.UpdateSharedChannel(args.A)
|
||||
returns.B = encodableError(returns.B)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API UpdateSharedChannel called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_UnshareChannelArgs struct {
|
||||
A string
|
||||
}
|
||||
|
||||
type Z_UnshareChannelReturns struct {
|
||||
A bool
|
||||
B error
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) UnshareChannel(channelID string) (unshared bool, err error) {
|
||||
_args := &Z_UnshareChannelArgs{channelID}
|
||||
_returns := &Z_UnshareChannelReturns{}
|
||||
if err := g.client.Call("Plugin.UnshareChannel", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to UnshareChannel API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) UnshareChannel(args *Z_UnshareChannelArgs, returns *Z_UnshareChannelReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
UnshareChannel(channelID string) (unshared bool, err error)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.UnshareChannel(args.A)
|
||||
returns.B = encodableError(returns.B)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API UnshareChannel called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_UpdateSharedChannelCursorArgs struct {
|
||||
A string
|
||||
B string
|
||||
C model.GetPostsSinceForSyncCursor
|
||||
}
|
||||
|
||||
type Z_UpdateSharedChannelCursorReturns struct {
|
||||
A error
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) UpdateSharedChannelCursor(channelID, remoteID string, cusror model.GetPostsSinceForSyncCursor) error {
|
||||
_args := &Z_UpdateSharedChannelCursorArgs{channelID, remoteID, cusror}
|
||||
_returns := &Z_UpdateSharedChannelCursorReturns{}
|
||||
if err := g.client.Call("Plugin.UpdateSharedChannelCursor", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to UpdateSharedChannelCursor API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) UpdateSharedChannelCursor(args *Z_UpdateSharedChannelCursorArgs, returns *Z_UpdateSharedChannelCursorReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
UpdateSharedChannelCursor(channelID, remoteID string, cusror model.GetPostsSinceForSyncCursor) error
|
||||
}); ok {
|
||||
returns.A = hook.UpdateSharedChannelCursor(args.A, args.B, args.C)
|
||||
returns.A = encodableError(returns.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API UpdateSharedChannelCursor called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_SyncSharedChannelArgs struct {
|
||||
A string
|
||||
}
|
||||
|
||||
type Z_SyncSharedChannelReturns struct {
|
||||
A error
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) SyncSharedChannel(channelID string) error {
|
||||
_args := &Z_SyncSharedChannelArgs{channelID}
|
||||
_returns := &Z_SyncSharedChannelReturns{}
|
||||
if err := g.client.Call("Plugin.SyncSharedChannel", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to SyncSharedChannel API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) SyncSharedChannel(args *Z_SyncSharedChannelArgs, returns *Z_SyncSharedChannelReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
SyncSharedChannel(channelID string) error
|
||||
}); ok {
|
||||
returns.A = hook.SyncSharedChannel(args.A)
|
||||
returns.A = encodableError(returns.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API SyncSharedChannel called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_InviteRemoteToChannelArgs struct {
|
||||
A string
|
||||
B string
|
||||
C string
|
||||
}
|
||||
|
||||
type Z_InviteRemoteToChannelReturns struct {
|
||||
A error
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) InviteRemoteToChannel(channelID string, remoteID string, userID string) error {
|
||||
_args := &Z_InviteRemoteToChannelArgs{channelID, remoteID, userID}
|
||||
_returns := &Z_InviteRemoteToChannelReturns{}
|
||||
if err := g.client.Call("Plugin.InviteRemoteToChannel", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to InviteRemoteToChannel API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) InviteRemoteToChannel(args *Z_InviteRemoteToChannelArgs, returns *Z_InviteRemoteToChannelReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
InviteRemoteToChannel(channelID string, remoteID string, userID string) error
|
||||
}); ok {
|
||||
returns.A = hook.InviteRemoteToChannel(args.A, args.B, args.C)
|
||||
returns.A = encodableError(returns.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API InviteRemoteToChannel called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_UninviteRemoteFromChannelArgs struct {
|
||||
A string
|
||||
B string
|
||||
}
|
||||
|
||||
type Z_UninviteRemoteFromChannelReturns struct {
|
||||
A error
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) UninviteRemoteFromChannel(channelID string, remoteID string) error {
|
||||
_args := &Z_UninviteRemoteFromChannelArgs{channelID, remoteID}
|
||||
_returns := &Z_UninviteRemoteFromChannelReturns{}
|
||||
if err := g.client.Call("Plugin.UninviteRemoteFromChannel", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to UninviteRemoteFromChannel API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) UninviteRemoteFromChannel(args *Z_UninviteRemoteFromChannelArgs, returns *Z_UninviteRemoteFromChannelReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
UninviteRemoteFromChannel(channelID string, remoteID string) error
|
||||
}); ok {
|
||||
returns.A = hook.UninviteRemoteFromChannel(args.A, args.B)
|
||||
returns.A = encodableError(returns.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API UninviteRemoteFromChannel called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user