From 9b5d493820df61ebb619a2fadbb5ef6a1d577751 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Fri, 1 Mar 2019 15:11:41 +0300 Subject: [PATCH 1/2] new websocket events --- v1/types.go | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/v1/types.go b/v1/types.go index 2b5ffd7..def29e1 100644 --- a/v1/types.go +++ b/v1/types.go @@ -24,19 +24,23 @@ const ( MessageScopePublic string = "public" MessageScopePrivate string = "private" - WsEventMessageNew string = "message_new" - WsEventMessageUpdated string = "message_updated" - WsEventMessageDeleted string = "message_deleted" - WsEventDialogOpened string = "dialog_opened" - WsEventDialogClosed string = "dialog_closed" - WsEventDialogAssign string = "dialog_assign" - WsEventChatCreated string = "chat_created" - WsEventChatUpdated string = "chat_updated" - WsEventUserJoined string = "user_joined_chat" - WsEventUserLeave string = "user_left_chat" - WsEventUserUpdated string = "user_updated" - WsCustomerUpdated string = "customer_updated" - WsBotUpdated string = "bot_updated" + WsEventMessageNew string = "message_new" + WsEventMessageUpdated string = "message_updated" + WsEventMessageDeleted string = "message_deleted" + WsEventDialogOpened string = "dialog_opened" + WsEventDialogClosed string = "dialog_closed" + WsEventDialogAssign string = "dialog_assign" + WsEventChatCreated string = "chat_created" + WsEventChatUpdated string = "chat_updated" + WsEventChatUnreadUpdated string = "chat_unread_updated" + WsEventUserOnlineUpdated string = "user_online_updated" + WsEventUserJoined string = "user_joined_chat" + WsEventUserLeave string = "user_left_chat" + WsEventUserUpdated string = "user_updated" + WsCustomerUpdated string = "customer_updated" + WsBotUpdated string = "bot_updated" + WsEventChannelUpdated string = "channel_updated" + WsEventSettingsUpdated string = "settings_updated" ChannelFeatureNone string = "none" ChannelFeatureReceive string = "receive" @@ -146,7 +150,7 @@ type ( } MessagesRequest struct { - ID []int `url:"id,omitempty"` + ID []int `url:"id,omitempty"` ChatID uint64 `url:"chat_id,omitempty" json:"chat_id"` DialogID uint64 `url:"dialog_id,omitempty" json:"dialog_id"` UserID uint64 `url:"user_id,omitempty" json:"user_id"` @@ -468,6 +472,8 @@ type ( LastName string `json:"last_name,omitempty"` Phone string `json:"phone,omitempty"` Email string `json:"email,omitempty"` + IsAdmin bool `json:"is_admin"` + Available bool `json:"available"` } Channel struct { @@ -619,4 +625,9 @@ type ( Chat *Chat `json:"chat"` User *UserRef `json:"user"` } + + WsEventUserOnlineUpdatedData struct { + User *UserRef + Online bool + } ) From 202db8370fc4a055379c19080b78d070b33d6947 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Fri, 1 Mar 2019 15:18:43 +0300 Subject: [PATCH 2/2] fix WsEventUserOnlineUpdatedData struct --- v1/types.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v1/types.go b/v1/types.go index def29e1..fb2ef8e 100644 --- a/v1/types.go +++ b/v1/types.go @@ -627,7 +627,7 @@ type ( } WsEventUserOnlineUpdatedData struct { - User *UserRef - Online bool + User *UserRef `json:"user"` + Online bool `json:"online"` } )