From 8bbc8531fa239c896b56c5565581fb8a31955591 Mon Sep 17 00:00:00 2001 From: Maxim Oransky Date: Sun, 21 Mar 2021 04:50:04 +0300 Subject: [PATCH] event params description --- call_event.go | 2 +- client_activity.go | 3 ++- client_call_buzz.go | 5 ++++- client_call_buzzcancel.go | 1 + client_call_leave.go | 5 ++++- client_call_muteall.go | 1 + client_call_offer.go | 15 ++++++++++---- client_call_reject.go | 5 ++++- client_call_sound.go | 5 ++++- client_call_trickle.go | 15 ++++++++++---- client_chat_composing.go | 15 ++++++++++---- client_chat_lastread.go | 5 ++++- client_confirm.go | 1 + client_message_deleted.go | 1 + section.go | 27 +++++++++++++++++++------ server_call_answer.go | 17 ++++++++++++---- server_call_buzz.go | 40 +++++++++++++++++++++++++------------- server_call_buzzcancel.go | 5 +++++ server_call_leave.go | 5 ++++- server_call_muteall.go | 5 ++++- server_call_reject.go | 9 +++++++-- server_call_restart.go | 9 +++++++-- server_call_sound.go | 5 ++++- server_call_state.go | 31 +++++++++++++++++++++-------- server_call_talking.go | 9 +++++++-- server_chat_composing.go | 17 ++++++++++++---- server_chat_deleted.go | 11 ++++++++--- server_chat_draft.go | 11 ++++++++--- server_chat_lastread.go | 11 ++++++++--- server_chat_updated.go | 9 +++++++-- server_confirm.go | 1 + server_contact_updated.go | 1 + server_debug.go | 1 + server_login.go | 1 + server_message_received.go | 20 ++++++++++++++----- server_message_updated.go | 19 +++++++++++++----- server_online.go | 29 ++++++++++++++++++++------- server_panic.go | 5 ++++- server_processing.go | 19 +++++++++++++----- server_remind_deleted.go | 1 + server_remind_fired.go | 1 + server_remind_updated.go | 1 + server_section_deleted.go | 13 ++++++++++--- server_section_updated.go | 7 ++++++- server_tag_deleted.go | 1 + server_tag_updated.go | 1 + server_team_counters.go | 5 ++++- server_team_deleted.go | 1 + server_time.go | 3 ++- server_upload_updated.go | 1 + server_warning.go | 7 +++++-- ui_settings.go | 1 + 52 files changed, 334 insertions(+), 105 deletions(-) diff --git a/call_event.go b/call_event.go index 4e04345..b4f0eaa 100644 --- a/call_event.go +++ b/call_event.go @@ -11,7 +11,7 @@ type CallEvent struct { // Call record enabled Audiorecord bool `json:"audiorecord"` - // Call members + // Call participants Onliners []CallOnliner `json:"onliners"` } diff --git a/client_activity.go b/client_activity.go index 317ab53..13677a3 100644 --- a/client_activity.go +++ b/client_activity.go @@ -6,7 +6,7 @@ func NewClientActivity(afk bool) (r ClientActivity) { return r } -// Change AFG (away from keyboard) status +// Change AFK (away from keyboard) status type ClientActivity struct { BaseEvent Params clientActivityParams `json:"params"` @@ -15,5 +15,6 @@ type ClientActivity struct { func (p ClientActivity) GetName() string { return "client.activity" } type clientActivityParams struct { + // Is away from keyboard Afk bool `json:"afk"` } diff --git a/client_call_buzz.go b/client_call_buzz.go index 0066858..9fb4426 100644 --- a/client_call_buzz.go +++ b/client_call_buzz.go @@ -10,6 +10,9 @@ func (p ClientCallBuzz) GetName() string { return "client.call.buzz" } // Call buzzing type clientCallBuzzParams struct { - Jid JID `json:"jid"` + // Chat or contact id + Jid JID `json:"jid"` + + // List of call participants Members []JID `json:"members"` } diff --git a/client_call_buzzcancel.go b/client_call_buzzcancel.go index 0820225..c0462a2 100644 --- a/client_call_buzzcancel.go +++ b/client_call_buzzcancel.go @@ -9,5 +9,6 @@ type ClientCallBuzzCancel struct { func (p ClientCallBuzzCancel) GetName() string { return "client.call.buzzcancel" } type clientCallBuzzCancelParams struct { + // Chat or contact id Jid JID `json:"jid"` } diff --git a/client_call_leave.go b/client_call_leave.go index 7531176..ac501a5 100644 --- a/client_call_leave.go +++ b/client_call_leave.go @@ -9,6 +9,9 @@ type ClientCallLeave struct { func (p ClientCallLeave) GetName() string { return "client.call.leave" } type clientCallLeaveParams struct { - Jid JID `json:"jid"` + // Chat or contact id + Jid JID `json:"jid"` + + // Reason, if any Reason string `json:"reason"` } diff --git a/client_call_muteall.go b/client_call_muteall.go index 9db4dfb..2d0e4c1 100644 --- a/client_call_muteall.go +++ b/client_call_muteall.go @@ -9,5 +9,6 @@ type ClientCallMuteAll struct { func (p ClientCallMuteAll) GetName() string { return "client.call.muteall" } type clientCallMuteAllParams struct { + // Chat or contact id Jid JID `json:"jid"` } diff --git a/client_call_offer.go b/client_call_offer.go index cdfb420..48417ba 100644 --- a/client_call_offer.go +++ b/client_call_offer.go @@ -9,8 +9,15 @@ type ClientCallOffer struct { func (p ClientCallOffer) GetName() string { return "client.call.offer" } type clientCallOfferParams struct { - Jid JID `json:"jid"` - Muted bool `json:"muted"` - Trickle bool `json:"trickle"` - Sdp string `json:"sdp"` + // Chat or contact id + Jid JID `json:"jid"` + + // Mute state + Muted bool `json:"muted"` + + // Is trickle mode enabled + Trickle bool `json:"trickle"` + + // SDP (session description protocol) data + Sdp string `json:"sdp"` } diff --git a/client_call_reject.go b/client_call_reject.go index 577ff9e..4381042 100644 --- a/client_call_reject.go +++ b/client_call_reject.go @@ -9,6 +9,9 @@ type ClientCallReject struct { func (p ClientCallReject) GetName() string { return "client.call.reject" } type clientCallRejectParams struct { - Jid JID `json:"jid"` + // Chat or contact id + Jid JID `json:"jid"` + + // Reason, if any Reason string `json:"reason"` } diff --git a/client_call_sound.go b/client_call_sound.go index 9673689..bc80b1f 100644 --- a/client_call_sound.go +++ b/client_call_sound.go @@ -9,6 +9,9 @@ type ClientCallSound struct { func (p ClientCallSound) GetName() string { return "client.call.sound" } type clientCallSoundParams struct { - Jid JID `json:"jid"` + // Chat or contact id + Jid JID `json:"jid"` + + // Mute state Muted bool `json:"muted"` } diff --git a/client_call_trickle.go b/client_call_trickle.go index 1d9d685..20a6402 100644 --- a/client_call_trickle.go +++ b/client_call_trickle.go @@ -9,8 +9,15 @@ type ClientCallTrickle struct { func (p ClientCallTrickle) GetName() string { return "client.call.trickle" } type clientCallTrickleParams struct { - Jid JID `json:"jid"` - Candidate string `json:"candidate"` - SdpMid string `json:"sdp_mid"` - SdpMlineIndex int `json:"sdp_mline_index"` + // Chat or contact id + Jid JID `json:"jid"` + + // Trickle candidate + Candidate string `json:"candidate"` + + // SDP mid + SdpMid string `json:"sdp_mid"` + + // SDP index + SdpMlineIndex int `json:"sdp_mline_index"` } diff --git a/client_chat_composing.go b/client_chat_composing.go index d678aa7..5c6ff0b 100644 --- a/client_chat_composing.go +++ b/client_chat_composing.go @@ -17,8 +17,15 @@ type ClientChatComposing struct { func (p ClientChatComposing) GetName() string { return "client.chat.composing" } type clientChatComposingParams struct { - Jid JID `json:"jid"` - IsAudio bool `json:"is_audio,omitempty"` - Composing bool `json:"composing,omitempty"` - Draft *string `json:"draft,omitempty"` + // Chat or contact id + Jid JID `json:"jid"` + + // true = audiomessage, false = text typing + IsAudio bool `json:"is_audio,omitempty"` + + // true = start typing / audio recording, false = stop + Composing bool `json:"composing,omitempty"` + + // Message draft data + Draft *string `json:"draft,omitempty"` } diff --git a/client_chat_lastread.go b/client_chat_lastread.go index fa4f999..2ca5a29 100644 --- a/client_chat_lastread.go +++ b/client_chat_lastread.go @@ -17,6 +17,9 @@ type ClientChatLastread struct { func (p ClientChatLastread) GetName() string { return "client.chat.lastread" } type clientChatLastreadParams struct { - Jid JID `json:"jid"` + // Chat or contact id + Jid JID `json:"jid"` + + // Last read message id. Omitted = last message in chat LastReadMessageId *string `json:"last_read_message_id,omitempty"` } diff --git a/client_confirm.go b/client_confirm.go index d940ea6..8a5b6b6 100644 --- a/client_confirm.go +++ b/client_confirm.go @@ -15,5 +15,6 @@ type ClientConfirm struct { func (p ClientConfirm) GetName() string { return "client.confirm" } type clientConfirmParams struct { + // Unique identifier generated by client ConfirmId string `json:"confirm_id"` } diff --git a/client_message_deleted.go b/client_message_deleted.go index 6dc4f63..4c37e8c 100644 --- a/client_message_deleted.go +++ b/client_message_deleted.go @@ -16,5 +16,6 @@ type ClientMessageDeleted struct { func (p ClientMessageDeleted) GetName() string { return "client.message.deleted" } type clientMessageDeletedParams struct { + // Message id MessageId string `json:"message_id,omitempty"` } diff --git a/section.go b/section.go index 6da25d2..f015306 100644 --- a/section.go +++ b/section.go @@ -1,14 +1,29 @@ package tdproto type Section struct { - Uid string `json:"uid"` - SortOrdering uint `json:"sort_ordering"` - Name string `json:"name"` - Gentime int64 `json:"gentime"` - Description string `json:"description,omitempty"` - IsArchive bool `json:"is_archive,omitempty"` + // Section uid + Uid string `json:"uid"` + + // Sort ordering + SortOrdering uint `json:"sort_ordering"` + + // Name + Name string `json:"name"` + + // Object version + Gentime int64 `json:"gentime"` + + // Description, if any + Description string `json:"description,omitempty"` + + // Is deleted + IsArchive bool `json:"is_archive,omitempty"` } type DeletedSection struct { + // Section uid Uid string `json:"uid"` + + // Object version + Gentime int64 `json:"gentime"` } diff --git a/server_call_answer.go b/server_call_answer.go index 36edac4..f42f716 100644 --- a/server_call_answer.go +++ b/server_call_answer.go @@ -19,11 +19,20 @@ type ServerCallAnswer struct { func (p ServerCallAnswer) GetName() string { return "server.call.answer" } type serverCallAnswerParams struct { - Jid JID `json:"jid"` + // Chat or contact id + Jid JID `json:"jid"` + + // List of ICE candidates (when trickle = false) Candidates []serverCallAnswerCandidate `json:"candidates"` - Onliners []CallOnliner `json:"onliners"` - JSEP JSEP `json:"jsep"` - Uid string `json:"uid"` + + // Current call participants + Onliners []CallOnliner `json:"onliners"` + + // SDP data + JSEP JSEP `json:"jsep"` + + // Call id + Uid string `json:"uid"` } type JSEP struct { diff --git a/server_call_buzz.go b/server_call_buzz.go index 6858998..109046e 100644 --- a/server_call_buzz.go +++ b/server_call_buzz.go @@ -12,12 +12,9 @@ func NewServerCallBuzz(teamShort TeamShort, chatShort ChatShort, actorShort Cont r.Params.Uid = uid r.Params.Jid = chatShort.Jid r.Params.BuzzTimeout = int(timeout.Seconds()) - r.Params.Icons = chatShort.Icons - - // Set as Deprecated or just leave for backward compatibility? - r.Params.Team = teamShort.Uid r.Params.DisplayName = chatShort.DisplayName + r.Params.Team = teamShort.Uid return r } @@ -30,13 +27,30 @@ type ServerCallBuzz struct { func (p ServerCallBuzz) GetName() string { return "server.call.buzz" } type serverCallBuzzParams struct { - TeamShort TeamShort `json:"teaminfo"` - ChatShort ChatShort `json:"chat"` - ActorShort ContactShort `json:"actor"` - Uid string `json:"uid"` - Jid JID `json:"jid"` - BuzzTimeout int `json:"buzz_timeout"` - Icons *IconData `json:"icons"` - Team string `json:"team"` - DisplayName string `json:"display_name"` + // Chat or contact id + Jid JID `json:"jid"` + + // Chat icons + Icons *IconData `json:"icons"` + + // Chat title + DisplayName string `json:"display_name"` + + // Short team information + TeamShort TeamShort `json:"teaminfo"` + + // Short chat information + ChatShort ChatShort `json:"chat"` + + // Short call creator information + ActorShort ContactShort `json:"actor"` + + // Call id + Uid string `json:"uid"` + + // Number of seconds for stop buzzing + BuzzTimeout int `json:"buzz_timeout"` + + // Deprecated + Team string `json:"team"` } diff --git a/server_call_buzzcancel.go b/server_call_buzzcancel.go index dc3795e..355ac63 100644 --- a/server_call_buzzcancel.go +++ b/server_call_buzzcancel.go @@ -17,7 +17,12 @@ type ServerCallBuzzcancel struct { func (p ServerCallBuzzcancel) GetName() string { return "server.call.buzzcancel" } type serverCallBuzzcancelParams struct { + // Chat or contact id Jid JID `json:"jid"` + + // Team id Team string `json:"team"` + + // Call id Uid string `json:"uid"` } diff --git a/server_call_leave.go b/server_call_leave.go index bb7770b..7494a5b 100644 --- a/server_call_leave.go +++ b/server_call_leave.go @@ -16,6 +16,9 @@ type ServerCallLeave struct { func (p ServerCallLeave) GetName() string { return "server.call.leave" } type serverCallLeaveParams struct { - Jid JID `json:"jid"` + // Chat or contact id + Jid JID `json:"jid"` + + // Call uid Uid string `json:"uid"` } diff --git a/server_call_muteall.go b/server_call_muteall.go index c58dd32..b4b4992 100644 --- a/server_call_muteall.go +++ b/server_call_muteall.go @@ -16,6 +16,9 @@ type ServerCallMuteall struct { func (p ServerCallMuteall) GetName() string { return "server.call.muteall" } type serverCallMuteallParams struct { - Jid JID `json:"jid"` + // Chat or contact id + Jid JID `json:"jid"` + + // Mute state Muted bool `json:"muted"` } diff --git a/server_call_reject.go b/server_call_reject.go index 8815fa1..88d1ac0 100644 --- a/server_call_reject.go +++ b/server_call_reject.go @@ -17,7 +17,12 @@ type ServerCallReject struct { func (p ServerCallReject) GetName() string { return "server.call.reject" } type serverCallRejectParams struct { - Jid JID `json:"jid"` + // Chat or contact id + Jid JID `json:"jid"` + + // Call id + Uid string `json:"uid"` + + // Reason, if any Reason string `json:"reason"` - Uid string `json:"uid"` } diff --git a/server_call_restart.go b/server_call_restart.go index 58a4a8a..56ada00 100644 --- a/server_call_restart.go +++ b/server_call_restart.go @@ -17,7 +17,12 @@ type ServerCallRestart struct { func (p ServerCallRestart) GetName() string { return "server.call.restart" } type serverCallRestartParams struct { - Jid JID `json:"jid"` + // Chat or contact id + Jid JID `json:"jid"` + + // Call id + Uid string `json:"uid"` + + // Team id Team string `json:"team"` - Uid string `json:"uid"` } diff --git a/server_call_sound.go b/server_call_sound.go index 363d4a0..9808071 100644 --- a/server_call_sound.go +++ b/server_call_sound.go @@ -16,6 +16,9 @@ type ServerCallSound struct { func (p ServerCallSound) GetName() string { return "server.call.sound" } type serverCallSoundParams struct { - Jid JID `json:"jid"` + // Chat or contact id + Jid JID `json:"jid"` + + // Mute state Muted bool `json:"muted"` } diff --git a/server_call_state.go b/server_call_state.go index b669078..b0a6bc8 100644 --- a/server_call_state.go +++ b/server_call_state.go @@ -33,12 +33,27 @@ type ServerCallState struct { func (p ServerCallState) GetName() string { return "server.call.state" } type serverCallStateParams struct { - Jid JID `json:"jid"` - Onliners []CallOnliner `json:"onliners"` - Start *string `json:"start"` - Finish *string `json:"finish"` - Audiorecord bool `json:"audiorecord"` - Buzz bool `json:"buzz,omitempty"` - Uid string `json:"uid"` - Timestamp int64 `json:"timestamp"` + // Chat or contact id + Jid JID `json:"jid"` + + // Call id + Uid string `json:"uid"` + + // Call participants + Onliners []CallOnliner `json:"onliners"` + + // Call start, if any + Start *ISODateTimeString `json:"start"` + + // Call finish, if any + Finish *ISODateTimeString `json:"finish"` + + // Call record enabled + Audiorecord bool `json:"audiorecord"` + + // Call buzzing + Buzz bool `json:"buzz,omitempty"` + + // Event start. FIXME: why not gentime? + Timestamp int64 `json:"timestamp"` } diff --git a/server_call_talking.go b/server_call_talking.go index 5ae8ad4..1e36078 100644 --- a/server_call_talking.go +++ b/server_call_talking.go @@ -17,7 +17,12 @@ type ServerCallTalking struct { func (p ServerCallTalking) GetName() string { return "server.call.talking" } type serverCallTalkingParams struct { - Jid JID `json:"jid"` - Actor JID `json:"actor"` + // Chat or contact id + Jid JID `json:"jid"` + + // Actor id + Actor JID `json:"actor"` + + // Is talking Talking bool `json:"talking"` } diff --git a/server_chat_composing.go b/server_chat_composing.go index a0cfa8c..b46c851 100644 --- a/server_chat_composing.go +++ b/server_chat_composing.go @@ -18,9 +18,18 @@ type ServerChatComposing struct { func (p ServerChatComposing) GetName() string { return "server.chat.composing" } type serverChatComposingParams struct { - Jid JID `json:"jid"` - Actor JID `json:"actor"` - Composing bool `json:"composing"` - IsAudio bool `json:"is_audio,omitempty"` + // Chat or contact id + Jid JID `json:"jid"` + + // Actor id + Actor JID `json:"actor"` + + // true = start typing / audio recording, false = stop + Composing bool `json:"composing"` + + // true = audiomessage, false = text typing + IsAudio bool `json:"is_audio,omitempty"` + + // Composing event max lifetime ValidUntil ISODateTimeString `json:"valid_until,omitempty"` } diff --git a/server_chat_deleted.go b/server_chat_deleted.go index a49d046..7fdf929 100644 --- a/server_chat_deleted.go +++ b/server_chat_deleted.go @@ -20,7 +20,12 @@ type ServerChatDeleted struct { func (p ServerChatDeleted) GetName() string { return "server.chat.deleted" } type serverChatDeletedParams struct { - Chats []DeletedChat `json:"chats"` - TeamUnread *TeamUnread `json:"team_unread"` - Badge uint `json:"badge"` + // List of deleted chats + Chats []DeletedChat `json:"chats"` + + // Current team counters + TeamUnread *TeamUnread `json:"team_unread"` + + // Total number of unreads + Badge uint `json:"badge"` } diff --git a/server_chat_draft.go b/server_chat_draft.go index 6718fec..33af0c9 100644 --- a/server_chat_draft.go +++ b/server_chat_draft.go @@ -17,7 +17,12 @@ type ServerChatDraft struct { func (p ServerChatDraft) GetName() string { return "server.chat.draft" } type serverChatDraftParams struct { - Jid *JID `json:"jid"` - Draft string `json:"draft"` - DraftNum int64 `json:"draft_num"` + // Chat or contact id + Jid *JID `json:"jid"` + + // Draft text + Draft string `json:"draft"` + + // Draft version + DraftNum int64 `json:"draft_num"` } diff --git a/server_chat_lastread.go b/server_chat_lastread.go index e390305..ee952ac 100644 --- a/server_chat_lastread.go +++ b/server_chat_lastread.go @@ -17,7 +17,12 @@ type ServerChatLastread struct { func (p ServerChatLastread) GetName() string { return "server.chat.lastread" } type serverChatLastreadParams struct { - Chats []ChatCounters `json:"chats"` - TeamUnread *TeamUnread `json:"team_unread"` - Badge uint `json:"badge"` + // Chat counters + Chats []ChatCounters `json:"chats"` + + // Current team counters + TeamUnread *TeamUnread `json:"team_unread"` + + // Total number of unreads + Badge uint `json:"badge"` } diff --git a/server_chat_updated.go b/server_chat_updated.go index d1db2aa..8817030 100644 --- a/server_chat_updated.go +++ b/server_chat_updated.go @@ -17,7 +17,12 @@ type ServerChatUpdated struct { func (p ServerChatUpdated) GetName() string { return "server.chat.updated" } type serverChatUpdatedParams struct { - Chats []Chat `json:"chats"` + // Chat counters + Chats []Chat `json:"chats"` + + // Current team counters TeamUnread *TeamUnread `json:"team_unread"` - Badge uint `json:"badge"` + + // Total number of unreads + Badge uint `json:"badge"` } diff --git a/server_confirm.go b/server_confirm.go index 38620ea..b29830c 100644 --- a/server_confirm.go +++ b/server_confirm.go @@ -15,5 +15,6 @@ type ServerConfirm struct { func (p ServerConfirm) GetName() string { return "server.confirm" } type serverConfirmParams struct { + // Unique id generated by server ConfirmId string `json:"confirm_id"` } diff --git a/server_contact_updated.go b/server_contact_updated.go index 0f6de73..1152ac5 100644 --- a/server_contact_updated.go +++ b/server_contact_updated.go @@ -15,5 +15,6 @@ type ServerContactUpdated struct { func (p ServerContactUpdated) GetName() string { return "server.contact.updated" } type serverContactUpdatedParams struct { + // Contact info Contacts []Contact `json:"contacts"` } diff --git a/server_debug.go b/server_debug.go index 9ccc5bc..f3ba058 100644 --- a/server_debug.go +++ b/server_debug.go @@ -15,5 +15,6 @@ type ServerDebug struct { func (p ServerDebug) GetName() string { return "server.debug" } type serverDebugParams struct { + // Debug message Text string `json:"text"` } diff --git a/server_login.go b/server_login.go index 8498bca..e3db3aa 100644 --- a/server_login.go +++ b/server_login.go @@ -15,5 +15,6 @@ type ServerLogin struct { func (p ServerLogin) GetName() string { return "server.login" } type serverLoginParams struct { + // Device name DeviceName string `json:"device_name"` } diff --git a/server_message_received.go b/server_message_received.go index a964a03..357486f 100644 --- a/server_message_received.go +++ b/server_message_received.go @@ -1,11 +1,20 @@ package tdproto type ReceivedMessage struct { - Chat JID `json:"chat"` - MessageId string `json:"message_id"` - Received bool `json:"received"` - NumReceived int `json:"num_received,omitempty"` - Debug string `json:"_debug,omitempty"` + // Chat or contact id + Chat JID `json:"chat"` + + // Message id + MessageId string `json:"message_id"` + + // Is received + Received bool `json:"received"` + + // Number of contacts received this message. Experimental. + NumReceived int `json:"num_received,omitempty"` + + // Debug message, if any + Debug string `json:"_debug,omitempty"` } func NewServerMessageReceived(messages []ReceivedMessage) (r ServerMessageReceived) { @@ -24,5 +33,6 @@ type ServerMessageReceived struct { func (p ServerMessageReceived) GetName() string { return "server.message.received" } type serverMessageReceivedParams struct { + // received message data Messages []ReceivedMessage `json:"messages"` } diff --git a/server_message_updated.go b/server_message_updated.go index d1f42b1..62500dd 100644 --- a/server_message_updated.go +++ b/server_message_updated.go @@ -31,9 +31,18 @@ type ServerMessageUpdated struct { func (p ServerMessageUpdated) GetName() string { return "server.message.updated" } type serverMessageUpdatedParams struct { - Messages []Message `json:"messages"` - Delayed bool `json:"delayed"` - ChatCounters []ChatCounters `json:"chat_counters"` // TODO: omitempty - TeamUnread *TeamUnread `json:"team_unread"` // TODO: omitempty - Badge *uint `json:"badge"` // TODO: omitempty + // Messages data + Messages []Message `json:"messages"` + + // true = silently message update, false = new message + Delayed bool `json:"delayed"` + + // Chat counters + ChatCounters []ChatCounters `json:"chat_counters"` + + // Current team counters + TeamUnread *TeamUnread `json:"team_unread"` + + // Total number of unreads, if changed + Badge *uint `json:"badge"` } diff --git a/server_online.go b/server_online.go index 69d3ce9..8b2dd61 100644 --- a/server_online.go +++ b/server_online.go @@ -16,19 +16,34 @@ type ServerOnline struct { func (p ServerOnline) GetName() string { return "server.online" } type serverOnlineParams struct { + // Online team members Contacts *[]OnlineContact `json:"contacts"` - Calls *[]OnlineCall `json:"calls"` + + // Active calls + Calls *[]OnlineCall `json:"calls"` } type OnlineContact struct { - Jid JID `json:"jid"` - Afk bool `json:"afk,omitempty"` + // Contact id + Jid JID `json:"jid"` + + // Is away from keyboard + Afk bool `json:"afk,omitempty"` + + // Is mobile client Mobile bool `json:"mobile"` // TODO: omitempty. 17feb2020 } type OnlineCall struct { - Jid JID `json:"jid"` - Uid string `json:"uid"` - Start *string `json:"start,omitempty"` - OnlineCount int `json:"online_count,omitempty"` + // Chat or contact id + Jid JID `json:"jid"` + + // Call id + Uid string `json:"uid"` + + // Call start + Start *ISODateTimeString `json:"start,omitempty"` + + // Number participants in call + OnlineCount int `json:"online_count,omitempty"` } diff --git a/server_panic.go b/server_panic.go index 74a9a10..dc20b0b 100644 --- a/server_panic.go +++ b/server_panic.go @@ -15,6 +15,9 @@ type ServerPanic struct { func (p ServerPanic) GetName() string { return "server.panic" } type serverPanicParams struct { - Code string `json:"code"` + // Error code + Code string `json:"code"` + + // Debug message Debug string `json:"debug,omitempty"` } diff --git a/server_processing.go b/server_processing.go index 1af13d7..73cf5ba 100644 --- a/server_processing.go +++ b/server_processing.go @@ -19,9 +19,18 @@ type ServerProcessing struct { func (p ServerProcessing) GetName() string { return "server.processing" } type serverProcessingParams struct { - Action string `json:"action"` - Message string `json:"message"` - HasError bool `json:"has_error"` - Num int `json:"num"` - Total int `json:"total"` + // Action name + Action string `json:"action"` + + // Message + Message string `json:"message"` + + // Has error + HasError bool `json:"has_error"` + + // Current processing item + Num int `json:"num"` + + // Total processing items + Total int `json:"total"` } diff --git a/server_remind_deleted.go b/server_remind_deleted.go index cf774d2..d1d1080 100644 --- a/server_remind_deleted.go +++ b/server_remind_deleted.go @@ -17,5 +17,6 @@ type ServerRemindDeleted struct { func (p ServerRemindDeleted) GetName() string { return "server.remind.deleted" } type serverRemindDeletedParams struct { + // Remind information Remind []DeletedRemind `json:"reminds"` } diff --git a/server_remind_fired.go b/server_remind_fired.go index 2e272d8..ad92bd8 100644 --- a/server_remind_fired.go +++ b/server_remind_fired.go @@ -15,5 +15,6 @@ type ServerRemindFired struct { func (p ServerRemindFired) GetName() string { return "server.remind.fired" } type serverRemindFiredParams struct { + // Remind information Reminds []Remind `json:"reminds"` } diff --git a/server_remind_updated.go b/server_remind_updated.go index 810c4ce..32aa4c1 100644 --- a/server_remind_updated.go +++ b/server_remind_updated.go @@ -15,5 +15,6 @@ type ServerRemindUpdated struct { func (p ServerRemindUpdated) GetName() string { return "server.remind.updated" } type serverRemindUpdatedParams struct { + // Remind information Reminds []Remind `json:"reminds"` } diff --git a/server_section_deleted.go b/server_section_deleted.go index fbb809d..a81e0b8 100644 --- a/server_section_deleted.go +++ b/server_section_deleted.go @@ -1,9 +1,11 @@ package tdproto func NewServerSectionDeleted(ct ChatType, section DeletedSection) (r ServerSectionDeleted) { + section.Gentime = Gentime() // XXX + r.Name = r.GetName() r.Params.ChatType = ct - r.Params.Gentime = Gentime() // XXX + r.Params.Gentime = section.Gentime r.Params.Sections = []DeletedSection{section} return r } @@ -17,7 +19,12 @@ type ServerSectionDeleted struct { func (p ServerSectionDeleted) GetName() string { return "server.section.deleted" } type serverSectionDeletedParams struct { - ChatType ChatType `json:"chat_type"` - Gentime int64 `json:"gentime"` + // Chat type + ChatType ChatType `json:"chat_type"` + + // Section/project info Sections []DeletedSection `json:"sections"` + + // Deprecated + Gentime int64 `json:"gentime"` } diff --git a/server_section_updated.go b/server_section_updated.go index ffb73a2..e852cd9 100644 --- a/server_section_updated.go +++ b/server_section_updated.go @@ -17,7 +17,12 @@ type ServerSectionUpdated struct { func (p ServerSectionUpdated) GetName() string { return "server.section.updated" } type serverSectionUpdatedParams struct { + // Chat type ChatType ChatType `json:"chat_type"` - Gentime int64 `json:"gentime"` + + // Section/project info Sections []Section `json:"sections"` + + // deprecated + Gentime int64 `json:"gentime"` } diff --git a/server_tag_deleted.go b/server_tag_deleted.go index 35fad75..287966c 100644 --- a/server_tag_deleted.go +++ b/server_tag_deleted.go @@ -15,5 +15,6 @@ type ServerTagDeleted struct { func (p ServerTagDeleted) GetName() string { return "server.tag.deleted" } type serverTagDeletedParams struct { + // Tags info Tags []DeletedTag `json:"tags"` } diff --git a/server_tag_updated.go b/server_tag_updated.go index b40ab16..f380651 100644 --- a/server_tag_updated.go +++ b/server_tag_updated.go @@ -15,5 +15,6 @@ type ServerTagUpdated struct { func (p ServerTagUpdated) GetName() string { return "server.tag.updated" } type serverTagUpdatedParams struct { + // Tags info Tags []Tag `json:"tags"` } diff --git a/server_team_counters.go b/server_team_counters.go index 560f176..7fa905f 100644 --- a/server_team_counters.go +++ b/server_team_counters.go @@ -18,6 +18,9 @@ type ServerTeamCounters struct { func (p ServerTeamCounters) GetName() string { return "server.team.counters" } type serverTeamCountersParams struct { + // Counters Teams []TeamCounter `json:"teams"` - Badge uint `json:"badge"` + + // Total number of unreads + Badge uint `json:"badge"` } diff --git a/server_team_deleted.go b/server_team_deleted.go index 93c1396..33bce53 100644 --- a/server_team_deleted.go +++ b/server_team_deleted.go @@ -19,5 +19,6 @@ type ServerTeamDeleted struct { func (p ServerTeamDeleted) GetName() string { return "server.team.deleted" } type serverTeamDeletedParams struct { + // Teams info Teams []DeletedTeam `json:"teams"` } diff --git a/server_time.go b/server_time.go index 90a0a65..c79c365 100644 --- a/server_time.go +++ b/server_time.go @@ -17,5 +17,6 @@ type ServerTime struct { func (p ServerTime) GetName() string { return "server.time" } type serverTimeParams struct { - Time string `json:"time"` + // Current time + Time ISODateTimeString `json:"time"` } diff --git a/server_upload_updated.go b/server_upload_updated.go index 4c90c8a..2e4fafc 100644 --- a/server_upload_updated.go +++ b/server_upload_updated.go @@ -15,5 +15,6 @@ type ServerUploadUpdated struct { func (p ServerUploadUpdated) GetName() string { return "server.upload.updated" } type serverUploadUpdatedParams struct { + // Uploads data Uploads []Upload `json:"uploads"` } diff --git a/server_warning.go b/server_warning.go index 6aab5c9..c2cc16c 100644 --- a/server_warning.go +++ b/server_warning.go @@ -16,6 +16,9 @@ type ServerWarning struct { func (p ServerWarning) GetName() string { return "server.warning" } type serverWarningParams struct { - Message string `json:"message"` - Orig interface{} `json:"orig"` + // Message + Message string `json:"message"` + + // Debug information + Orig interface{} `json:"orig"` } diff --git a/ui_settings.go b/ui_settings.go index fb59c98..fe7322e 100644 --- a/ui_settings.go +++ b/ui_settings.go @@ -1,3 +1,4 @@ package tdproto +// Any user data type UiSettings map[string]interface{}