[MM-34076] Add Plugin API User custom status (#17435)
* add missing client for custom user status * add custom user status plugin api * update based on feedback review * add GetCustomStatus * update interfaces
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
0a3e7f4d55
Коммит
bb5a74a42b
@@ -1755,6 +1755,63 @@ func (s *apiRPCServer) UpdateUserActive(args *Z_UpdateUserActiveArgs, returns *Z
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_UpdateUserCustomStatusArgs struct {
|
||||
A string
|
||||
B *model.CustomStatus
|
||||
}
|
||||
|
||||
type Z_UpdateUserCustomStatusReturns struct {
|
||||
A *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) UpdateUserCustomStatus(userID string, customStatus *model.CustomStatus) *model.AppError {
|
||||
_args := &Z_UpdateUserCustomStatusArgs{userID, customStatus}
|
||||
_returns := &Z_UpdateUserCustomStatusReturns{}
|
||||
if err := g.client.Call("Plugin.UpdateUserCustomStatus", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to UpdateUserCustomStatus API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) UpdateUserCustomStatus(args *Z_UpdateUserCustomStatusArgs, returns *Z_UpdateUserCustomStatusReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
UpdateUserCustomStatus(userID string, customStatus *model.CustomStatus) *model.AppError
|
||||
}); ok {
|
||||
returns.A = hook.UpdateUserCustomStatus(args.A, args.B)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API UpdateUserCustomStatus called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_RemoveUserCustomStatusArgs struct {
|
||||
A string
|
||||
}
|
||||
|
||||
type Z_RemoveUserCustomStatusReturns struct {
|
||||
A *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) RemoveUserCustomStatus(userID string) *model.AppError {
|
||||
_args := &Z_RemoveUserCustomStatusArgs{userID}
|
||||
_returns := &Z_RemoveUserCustomStatusReturns{}
|
||||
if err := g.client.Call("Plugin.RemoveUserCustomStatus", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to RemoveUserCustomStatus API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) RemoveUserCustomStatus(args *Z_RemoveUserCustomStatusArgs, returns *Z_RemoveUserCustomStatusReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
RemoveUserCustomStatus(userID string) *model.AppError
|
||||
}); ok {
|
||||
returns.A = hook.RemoveUserCustomStatus(args.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API RemoveUserCustomStatus called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_GetUsersInChannelArgs struct {
|
||||
A string
|
||||
B string
|
||||
|
||||
Ссылка в новой задаче
Block a user