Expand Plugin and REST APIs to trigger user typing event (#14331)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
8c1164d86b
Коммит
66597d0fcb
@@ -953,6 +953,13 @@ type API interface {
|
||||
//
|
||||
// Minimum server version: 5.18
|
||||
PluginHTTP(request *http.Request) *http.Response
|
||||
|
||||
// PublishUserTyping publishes a user is typing WebSocket event.
|
||||
// The parentId parameter may be an empty string, the other parameters are required.
|
||||
//
|
||||
// @tag User
|
||||
// Minimum server version: 5.26
|
||||
PublishUserTyping(userId, channelId, parentId string) *model.AppError
|
||||
}
|
||||
|
||||
var handshake = plugin.HandshakeConfig{
|
||||
|
||||
@@ -1015,3 +1015,10 @@ func (api *apiTimerLayer) PluginHTTP(request *http.Request) *http.Response {
|
||||
api.recordTime(startTime, "PluginHTTP", true)
|
||||
return _returnsA
|
||||
}
|
||||
|
||||
func (api *apiTimerLayer) PublishUserTyping(userId, channelId, parentId string) *model.AppError {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA := api.apiImpl.PublishUserTyping(userId, channelId, parentId)
|
||||
api.recordTime(startTime, "PublishUserTyping", true)
|
||||
return _returnsA
|
||||
}
|
||||
|
||||
@@ -4422,3 +4422,33 @@ func (s *apiRPCServer) DeleteBotIconImage(args *Z_DeleteBotIconImageArgs, return
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_PublishUserTypingArgs struct {
|
||||
A string
|
||||
B string
|
||||
C string
|
||||
}
|
||||
|
||||
type Z_PublishUserTypingReturns struct {
|
||||
A *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) PublishUserTyping(userId, channelId, parentId string) *model.AppError {
|
||||
_args := &Z_PublishUserTypingArgs{userId, channelId, parentId}
|
||||
_returns := &Z_PublishUserTypingReturns{}
|
||||
if err := g.client.Call("Plugin.PublishUserTyping", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to PublishUserTyping API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) PublishUserTyping(args *Z_PublishUserTypingArgs, returns *Z_PublishUserTypingReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
PublishUserTyping(userId, channelId, parentId string) *model.AppError
|
||||
}); ok {
|
||||
returns.A = hook.PublishUserTyping(args.A, args.B, args.C)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API PublishUserTyping called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -2443,6 +2443,22 @@ func (_m *API) PluginHTTP(request *http.Request) *http.Response {
|
||||
return r0
|
||||
}
|
||||
|
||||
// PublishUserTyping provides a mock function with given fields: userId, channelId, parentId
|
||||
func (_m *API) PublishUserTyping(userId string, channelId string, parentId string) *model.AppError {
|
||||
ret := _m.Called(userId, channelId, parentId)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string, string, string) *model.AppError); ok {
|
||||
r0 = rf(userId, channelId, parentId)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// PublishWebSocketEvent provides a mock function with given fields: event, payload, broadcast
|
||||
func (_m *API) PublishWebSocketEvent(event string, payload map[string]interface{}, broadcast *model.WebsocketBroadcast) {
|
||||
_m.Called(event, payload, broadcast)
|
||||
|
||||
Ссылка в новой задаче
Block a user