Add method for sending typing notification
This commit is contained in:
parent
5de0cf774b
commit
b8d4b49de3
5 changed files with 915 additions and 741 deletions
File diff suppressed because it is too large
Load diff
|
@ -17,6 +17,15 @@ message ConversationTypePayload {
|
|||
string conversationID = 2;
|
||||
}
|
||||
|
||||
message TypingUpdatePayload {
|
||||
SetTypingIn data = 2;
|
||||
}
|
||||
|
||||
message SetTypingIn {
|
||||
string conversationID = 1;
|
||||
bool typing = 3;
|
||||
}
|
||||
|
||||
message UpdateConversationPayload {
|
||||
UpdateConversationData data = 1;
|
||||
ConversationActionStatus action = 2;
|
||||
|
|
|
@ -166,3 +166,19 @@ func (c *Conversations) Update(convBuilder *ConversationBuilder) (*binary.Update
|
|||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (c *Conversations) SetTyping(convID string) error {
|
||||
payload := &binary.TypingUpdatePayload{Data: &binary.SetTypingIn{ConversationID: convID, Typing: true}}
|
||||
actionType := binary.ActionType_TYPING_UPDATES
|
||||
|
||||
sentRequestId, sendErr := c.client.sessionHandler.completeSendMessage(actionType, true, payload)
|
||||
if sendErr != nil {
|
||||
return sendErr
|
||||
}
|
||||
|
||||
_, err := c.client.sessionHandler.WaitForResponse(sentRequestId, actionType)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -46,3 +46,12 @@ var UPDATE_CONVERSATION = Route{
|
|||
UseSessionID: false,
|
||||
UseTTL: true,
|
||||
}
|
||||
|
||||
var TYPING_UPDATES = Route{
|
||||
Action: binary.ActionType_TYPING_UPDATES,
|
||||
MessageType: binary.MessageType_BUGLE_MESSAGE,
|
||||
BugleRoute: binary.BugleRoute_DataEvent,
|
||||
ResponseStruct: nil,
|
||||
UseSessionID: false,
|
||||
UseTTL: true,
|
||||
}
|
||||
|
|
|
@ -27,5 +27,6 @@ var Routes = map[binary.ActionType]Route{
|
|||
binary.ActionType_SEND_MESSAGE: SEND_MESSAGE,
|
||||
binary.ActionType_SEND_REACTION: SEND_REACTION,
|
||||
binary.ActionType_DELETE_MESSAGE: DELETE_MESSAGE,
|
||||
binary.ActionType_TYPING_UPDATES: TYPING_UPDATES,
|
||||
binary.ActionType_GET_PARTICIPANTS_THUMBNAIL: GET_PARTICIPANT_THUMBNAIL,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue