mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Add SetProfileImage for plugin API (#9831)
This commit is contained in:
committed by
Hanzei
parent
f0351f23f1
commit
b29f1cb844
@@ -264,6 +264,11 @@ type API interface {
|
||||
// Minimum server version: 5.6
|
||||
GetProfileImage(userId string) ([]byte, *model.AppError)
|
||||
|
||||
// SetProfileImage sets a user's profile image.
|
||||
//
|
||||
// Minimum server version: 5.6
|
||||
SetProfileImage(userId string, data []byte) *model.AppError
|
||||
|
||||
// GetEmojiList returns a page of custom emoji on the system.
|
||||
//
|
||||
// The sortBy parameter can be: "name".
|
||||
|
||||
@@ -2461,6 +2461,35 @@ func (s *apiRPCServer) GetProfileImage(args *Z_GetProfileImageArgs, returns *Z_G
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_SetProfileImageArgs struct {
|
||||
A string
|
||||
B []byte
|
||||
}
|
||||
|
||||
type Z_SetProfileImageReturns struct {
|
||||
A *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) SetProfileImage(userId string, data []byte) *model.AppError {
|
||||
_args := &Z_SetProfileImageArgs{userId, data}
|
||||
_returns := &Z_SetProfileImageReturns{}
|
||||
if err := g.client.Call("Plugin.SetProfileImage", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to SetProfileImage API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) SetProfileImage(args *Z_SetProfileImageArgs, returns *Z_SetProfileImageReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
SetProfileImage(userId string, data []byte) *model.AppError
|
||||
}); ok {
|
||||
returns.A = hook.SetProfileImage(args.A, args.B)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API SetProfileImage called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_GetEmojiListArgs struct {
|
||||
A string
|
||||
B int
|
||||
@@ -2756,35 +2785,6 @@ func (s *apiRPCServer) GetPlugins(args *Z_GetPluginsArgs, returns *Z_GetPluginsR
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_GetPluginStatusArgs struct {
|
||||
A string
|
||||
}
|
||||
|
||||
type Z_GetPluginStatusReturns struct {
|
||||
A *model.PluginStatus
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) GetPluginStatus(id string) (*model.PluginStatus, *model.AppError) {
|
||||
_args := &Z_GetPluginStatusArgs{id}
|
||||
_returns := &Z_GetPluginStatusReturns{}
|
||||
if err := g.client.Call("Plugin.GetPluginStatus", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to GetPluginStatus API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) GetPluginStatus(args *Z_GetPluginStatusArgs, returns *Z_GetPluginStatusReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
GetPluginStatus(id string) (*model.PluginStatus, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.GetPluginStatus(args.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API GetPluginStatus called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_EnablePluginArgs struct {
|
||||
A string
|
||||
}
|
||||
@@ -2869,6 +2869,35 @@ func (s *apiRPCServer) RemovePlugin(args *Z_RemovePluginArgs, returns *Z_RemoveP
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_GetPluginStatusArgs struct {
|
||||
A string
|
||||
}
|
||||
|
||||
type Z_GetPluginStatusReturns struct {
|
||||
A *model.PluginStatus
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) GetPluginStatus(id string) (*model.PluginStatus, *model.AppError) {
|
||||
_args := &Z_GetPluginStatusArgs{id}
|
||||
_returns := &Z_GetPluginStatusReturns{}
|
||||
if err := g.client.Call("Plugin.GetPluginStatus", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to GetPluginStatus API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) GetPluginStatus(args *Z_GetPluginStatusArgs, returns *Z_GetPluginStatusReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
GetPluginStatus(id string) (*model.PluginStatus, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.GetPluginStatus(args.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API GetPluginStatus called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_KVSetArgs struct {
|
||||
A string
|
||||
B []byte
|
||||
|
||||
@@ -1835,6 +1835,22 @@ func (_m *API) SendEphemeralPost(userId string, post *model.Post) *model.Post {
|
||||
return r0
|
||||
}
|
||||
|
||||
// SetProfileImage provides a mock function with given fields: userId, data
|
||||
func (_m *API) SetProfileImage(userId string, data []byte) *model.AppError {
|
||||
ret := _m.Called(userId, data)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string, []byte) *model.AppError); ok {
|
||||
r0 = rf(userId, data)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user