From b95b68d037e022318b419fa63f5f09351e1b0afc Mon Sep 17 00:00:00 2001 From: igo95862 Date: Thu, 13 Jan 2022 13:57:57 +0300 Subject: [PATCH] Align Go structs TDPROTO: auth.go:3:11: struct with 544 pointer bytes could be 520 billing_change_tariff.go:6:26: struct with 88 pointer bytes could be 80 billing_change_tariff.go:19:49: struct with 40 pointer bytes could be 32 billing_personal_account.go:6:29: struct of size 184 could be 176 billing_tariff.go:6:20: struct with 144 pointer bytes could be 104 billing_tariff.go:69:26: struct of size 128 could be 120 billing_tariff.go:126:26: struct with 40 pointer bytes could be 32 billing_team.go:6:18: struct with 40 pointer bytes could be 32 billing_workplace.go:15:15: struct with 72 pointer bytes could be 64 billing_workplace.go:112:61: struct with 32 pointer bytes could be 24 call_event.go:4:16: struct of size 136 could be 128 call_event.go:37:18: struct with 80 pointer bytes could be 72 call_event.go:61:17: struct with 16 pointer bytes could be 8 chat.go:34:11: struct of size 904 could be 856 chat.go:247:14: struct with 88 pointer bytes could be 72 chat.go:271:15: struct with 64 pointer bytes could be 32 client_call_offer.go:12:28: struct of size 64 could be 56 client_call_screenshare.go:12:34: struct with 16 pointer bytes could be 8 client_chat_composing.go:12:26: struct with 64 pointer bytes could be 56 client_chat_composing.go:20:32: struct with 32 pointer bytes could be 16 client_chat_lastread.go:12:25: struct with 56 pointer bytes could be 48 client_chat_lastread.go:20:31: struct with 24 pointer bytes could be 16 client_message_updated.go:19:33: struct of size 504 could be 496 color_rule.go:4:16: struct with 152 pointer bytes could be 120 contact.go:4:14: struct of size 688 could be 656 counters.go:4:19: struct with 72 pointer bytes could be 48 counters.go:29:18: struct with 24 pointer bytes could be 16 dlp.go:6:19: struct with 48 pointer bytes could be 40 dlp.go:41:15: struct with 600 pointer bytes could be 592 event.go:10:15: struct with 40 pointer bytes could be 32 features.go:9:15: struct of size 1544 could be 1472 icon_data.go:16:15: struct with 120 pointer bytes could be 104 integrations.go:4:23: struct with 32 pointer bytes could be 24 integrations.go:28:18: struct with 136 pointer bytes could be 128 markup_entity.go:8:19: struct with 104 pointer bytes could be 72 message.go:25:21: struct of size 376 could be 368 message.go:109:14: struct of size 768 could be 736 message.go:214:18: struct with 96 pointer bytes could be 80 message.go:240:22: struct with 32 pointer bytes could be 24 section.go:4:14: struct with 56 pointer bytes could be 40 server_call_answer.go:22:29: struct with 104 pointer bytes could be 96 server_call_buzz.go:31:27: struct with 728 pointer bytes could be 712 server_call_screenshare.go:20:34: struct with 32 pointer bytes could be 24 server_chat_composing.go:21:32: struct with 48 pointer bytes could be 40 server_chat_deleted.go:23:30: struct with 32 pointer bytes could be 16 server_chat_lastread.go:20:31: struct with 32 pointer bytes could be 16 server_chat_updated.go:24:30: struct with 32 pointer bytes could be 16 server_message_received.go:4:22: struct with 56 pointer bytes could be 40 server_message_updated.go:26:27: struct with 104 pointer bytes could be 96 server_message_updated.go:34:33: struct with 72 pointer bytes could be 48 server_online.go:43:17: struct with 64 pointer bytes could be 56 server_uisettings.go:13:23: struct with 56 pointer bytes could be 48 server_uisettings.go:18:29: struct with 24 pointer bytes could be 16 server_warning.go:11:20: struct with 64 pointer bytes could be 56 server_warning.go:19:26: struct with 32 pointer bytes could be 24 session.go:4:14: struct with 96 pointer bytes could be 88 short_message.go:4:19: struct with 96 pointer bytes could be 88 stats.go:8:26: struct with 88 pointer bytes could be 80 stickerpack.go:14:14: struct with 456 pointer bytes could be 448 task_preview.go:8:18: struct with 112 pointer bytes could be 104 task_status.go:4:17: struct with 48 pointer bytes could be 40 task_tabs.go:44:14: struct with 96 pointer bytes could be 88 team.go:4:11: struct of size 1152 could be 1120 upload.go:4:13: struct of size 160 could be 152 user.go:4:11: struct with 256 pointer bytes could be 248 user_auth.go:13:15: struct with 160 pointer bytes could be 144 TDAPI: atlinks.go:15:13: struct with 64 pointer bytes could be 56 auth.go:13:11: struct with 536 pointer bytes could be 504 auth.go:21:30: struct with 16 pointer bytes could be 8 auth.go:26:26: struct with 48 pointer bytes could be 40 auth.go:33:36: struct with 48 pointer bytes could be 40 chats.go:3:17: struct with 224 pointer bytes could be 200 color_rule.go:4:16: struct of size 104 could be 80 contact.go:11:14: struct of size 304 could be 280 draft.go:6:12: struct with 56 pointer bytes could be 48 group.go:12:12: struct with 96 pointer bytes could be 80 hotmessages.go:6:18: struct with 888 pointer bytes could be 784 integration.go:5:18: struct with 80 pointer bytes could be 64 message.go:5:20: struct with 328 pointer bytes could be 312 message.go:64:20: struct with 16 pointer bytes could be 8 message.go:75:14: struct with 96 pointer bytes could be 80 resp.go:6:11: struct with 88 pointer bytes could be 80 sharplinks.go:30:20: struct of size 72 could be 64 task.go:6:11: struct with 248 pointer bytes could be 240 task.go:60:17: struct with 344 pointer bytes could be 328 team.go:5:11: struct with 72 pointer bytes could be 56 upload.go:5:19: struct with 88 pointer bytes could be 72 --- auth.go | 2 +- billing_change_tariff.go | 4 +- billing_personal_account.go | 11 +- billing_tariff.go | 116 ++++++++-------- billing_team.go | 2 +- billing_workplace.go | 4 +- call_event.go | 24 ++-- chat.go | 258 +++++++++++++++++------------------ client_call_offer.go | 12 +- client_call_screenshare.go | 6 +- client_chat_composing.go | 6 +- client_chat_lastread.go | 8 +- client_message_updated.go | 18 +-- color_rule.go | 46 +++---- contact.go | 200 +++++++++++++-------------- counters.go | 10 +- dlp.go | 14 +- event.go | 2 +- features.go | 264 ++++++++++++++++++------------------ icon_data.go | 12 +- integrations.go | 24 ++-- invitable_user.go | 6 +- markup_entity.go | 32 ++--- message.go | 192 +++++++++++++------------- section.go | 12 +- server_call_answer.go | 12 +- server_call_buzz.go | 28 ++-- server_call_screenshare.go | 10 +- server_chat_composing.go | 6 +- server_chat_deleted.go | 6 +- server_chat_lastread.go | 6 +- server_chat_updated.go | 6 +- server_message_received.go | 8 +- server_message_updated.go | 16 +-- server_online.go | 6 +- server_uisettings.go | 8 +- server_warning.go | 8 +- session.go | 12 +- short_message.go | 14 +- stats.go | 4 +- task_preview.go | 4 +- task_status.go | 6 +- task_tabs.go | 18 +-- tdapi/atlinks.go | 12 +- tdapi/auth.go | 8 +- tdapi/chats.go | 19 +-- tdapi/color_rule.go | 30 ++-- tdapi/contact.go | 36 ++--- tdapi/draft.go | 6 +- tdapi/group.go | 26 ++-- tdapi/hotmessages.go | 6 +- tdapi/integration.go | 8 +- tdapi/message.go | 21 ++- tdapi/resp.go | 18 +-- tdapi/sharplinks.go | 6 +- tdapi/task.go | 59 ++++---- tdapi/team.go | 18 +-- tdapi/upload.go | 3 +- team.go | 106 +++++++-------- upload.go | 38 +++--- user.go | 44 +++--- user_auth.go | 20 ++- 62 files changed, 974 insertions(+), 973 deletions(-) diff --git a/auth.go b/auth.go index 173f269..c023d92 100644 --- a/auth.go +++ b/auth.go @@ -2,8 +2,8 @@ package tdproto type Auth struct { Token string `json:"token,omitempty"` + Method2fa string `json:"method2fa"` Me UserWithMe `json:"me"` Required2fa bool `json:"required2fa"` Recovery2fa bool `json:"recovery2fa"` - Method2fa string `json:"method2fa"` } diff --git a/billing_change_tariff.go b/billing_change_tariff.go index 8524f31..42b8429 100644 --- a/billing_change_tariff.go +++ b/billing_change_tariff.go @@ -4,10 +4,10 @@ import "time" // ChangeTariffBilling struct of changes tariffs by personal account type ChangeTariffBilling struct { - TariffId string `json:"tariff_id"` // TODO: must be int64 OpenDate time.Time `json:"open_date,omitempty"` CloseDate time.Time `json:"close_date,omitempty"` CreateDate time.Time `json:"create_date,omitempty"` + TariffId string `json:"tariff_id"` // TODO: must be int64 } // GetChangesTariffsByPersonalAccountResponse response on get changes tariffs by personal account @@ -17,8 +17,8 @@ type GetChangesTariffsByPersonalAccountResponse struct { // CreateChangeTariffOnPersonalAccountRequest request on create change tariff on personal account type CreateChangeTariffOnPersonalAccountRequest struct { - TariffId string `json:"tariff_id"` // TODO: must be int64 OpenDate time.Time `json:"open_date,omitempty"` + TariffId string `json:"tariff_id"` // TODO: must be int64 } // CreateChangeTariffOnPersonalAccountResponse response on create change tariff on personal account diff --git a/billing_personal_account.go b/billing_personal_account.go index f0f41b9..5e97222 100644 --- a/billing_personal_account.go +++ b/billing_personal_account.go @@ -4,6 +4,11 @@ import "time" // PersonalAccountBilling struct of billing api type PersonalAccountBilling struct { + // Status of personal account + Status PersonalAccountStatus `json:"status"` + + // Date of next debiting funds + NextBillingDate time.Time `json:"next_billing_date"` // PersonalAccountBilling ID PersonalAccountId string `json:"personal_account_id"` // TODO: must be int64 @@ -29,12 +34,6 @@ type PersonalAccountBilling struct { // Amount of Discount on personal account DiscountAmount int32 `json:"discount_amount"` - // Status of personal account - Status PersonalAccountStatus `json:"status"` - - // Date of next debiting funds - NextBillingDate time.Time `json:"next_billing_date"` - // Count of teams on personal account TeamCount int32 `json:"team_count"` diff --git a/billing_tariff.go b/billing_tariff.go index 6713591..71f7260 100644 --- a/billing_tariff.go +++ b/billing_tariff.go @@ -7,35 +7,35 @@ type TariffBilling struct { // Date of closing tariff CloseDate *time.Time `json:"close_date,omitempty"` + // Date of opening tariff + OpenDate *time.Time `json:"open_date"` + // Cost of one workplace CostWorkplace string `json:"cost_workplace"` // Currency of tariff Currency Currency `json:"currency"` - // Count of minimum workspaces on tariff - MinTariffWorkplaces int32 `json:"min_tariff_workplaces"` + // Tariff id + TariffId string `json:"tariff_id"` - // Minimum step of change count workspaces on tariff - MinStepWorkplaces int32 `json:"min_step_workplaces"` + // Status of tariff + Status TariffStatus `json:"status"` // Disk space limit per user DiskSpaceQuotaMb string `json:"disk_space_quota_mb"` - // Count of free workspaces - FreeWorkplaces int32 `json:"free_workplaces"` - - // Flag of availability of free seats when exceeding FreeWorkplace - IsBillingFree bool `json:"is_billing_free"` + // Name of tariff + TariffName string `json:"tariff_name"` - // Flag of accounting without looking at the number of days before the billing period - IsBillingFullTime bool `json:"is_billing_full_time"` + // Bitrate of video in video sharing + VideoSharingBitrate int32 `json:"video_sharing_bitrate"` - // Default tariff flag that is set when registering an account - IsDefaultTariff bool `json:"is_default_tariff"` + // Count of free workspaces + FreeWorkplaces int32 `json:"free_workplaces"` - // Flag for accounting for unspent days when switching to a new tariff - IsRecalcChangeTariff bool `json:"is_recalc_change_tariff"` + // Number of paid days + PeriodDays int32 `json:"period_days"` // Maximum count of users in voice conference MaxVoiceUser int32 `json:"max_voice_user"` @@ -43,59 +43,56 @@ type TariffBilling struct { // Maximum count of users in video conference MaxVideoUser int32 `json:"max_video_user"` - // Bitrate of video in video co + // Bitrate of video in video sharing VideoCallBitrate int32 `json:"video_call_bitrate"` - // Bitrate of video in video sharing - VideoSharingBitrate int32 `json:"video_sharing_bitrate"` + // Minimum step of change count workspaces on tariff + MinStepWorkplaces int32 `json:"min_step_workplaces"` - // Date of opening tariff - OpenDate *time.Time `json:"open_date"` + // Count of minimum workspaces on tariff + MinTariffWorkplaces int32 `json:"min_tariff_workplaces"` - // Number of paid days - PeriodDays int32 `json:"period_days"` + // Flag of accounting without looking at the number of days before the billing period + IsBillingFullTime bool `json:"is_billing_full_time"` - // Status of tariff - Status TariffStatus `json:"status"` + // Default tariff flag that is set when registering an account + IsDefaultTariff bool `json:"is_default_tariff"` - // Tariff id - TariffId string `json:"tariff_id"` // TODO: must be int64 + // Flag of availability of free seats when exceeding FreeWorkplace + IsBillingFree bool `json:"is_billing_free"` - // Name of tariff - TariffName string `json:"tariff_name"` + // Flag for accounting for unspent days when switching to a new tariff + IsRecalcChangeTariff bool `json:"is_recalc_change_tariff"` } // Request to create the tariff type CreateTariffRequest struct { + // Date of opening tariff + OpenDate *time.Time `json:"open_date,omitempty"` + // Date of closing tariff CloseDate *time.Time `json:"close_date,omitempty"` + // Disk space limit per user + DiskSpaceQuotaMb string `json:"disk_space_quota_mb,omitempty"` + // Cost of one workplace CostWorkplace string `json:"cost_workplace,omitempty"` // Currency of tariff Currency Currency `json:"currency"` - // Count of minimum workspaces on tariff - MinTariffWorkplaces int32 `json:"min_tariff_workplaces"` - - // Minimum step of change count workspaces on tariff - MinStepWorkplaces int32 `json:"min_step_workplaces"` - - // Disk space limit per user - DiskSpaceQuotaMb string `json:"disk_space_quota_mb,omitempty"` + // Name of tariff + TariffName string `json:"tariff_name"` // Count of free workspaces FreeWorkplaces int32 `json:"free_workplaces,omitempty"` - // Flag of availability of free seats when exceeding FreeWorkplace - IsBillingFree bool `json:"is_billing_free,omitempty"` - - // Flag of accounting without looking at the number of days before the billing period - IsBillingFullTime bool `json:"is_billing_full_time,omitempty"` + // Bitrate of video in video sharing + VideoSharingBitrate int32 `json:"video_sharing_bitrate"` - // Flag for accounting for unspent days when switching to a new tariff - IsRecalcChangeTariff bool `json:"is_recalc_change_tariff,omitempty"` + // Minimum step of change count workspaces on tariff + MinStepWorkplaces int32 `json:"min_step_workplaces"` // Maximum count of users in voice conference MaxVoiceUser int32 `json:"max_voice_user,omitempty"` @@ -106,35 +103,38 @@ type CreateTariffRequest struct { // Bitrate of video in video co VideoCallBitrate int32 `json:"video_call_bitrate"` - // Bitrate of video in video sharing - VideoSharingBitrate int32 `json:"video_sharing_bitrate"` - - // Default tariff flag that is set when registering an account - IsDefaultTariff bool `json:"is_default_tariff,omitempty"` - - // Date of opening tariff - OpenDate *time.Time `json:"open_date,omitempty"` + // Count of minimum workspaces on tariff + MinTariffWorkplaces int32 `json:"min_tariff_workplaces"` // Number of paid days PeriodDays int32 `json:"period_days"` - // Name of tariff - TariffName string `json:"tariff_name"` + // Flag of accounting without looking at the number of days before the billing period + IsBillingFullTime bool `json:"is_billing_full_time,omitempty"` + + // Flag of availability of free seats when exceeding FreeWorkplace + IsBillingFree bool `json:"is_billing_free,omitempty"` + + // Default tariff flag that is set when registering an account + IsDefaultTariff bool `json:"is_default_tariff,omitempty"` + + // Flag for accounting for unspent days when switching to a new tariff + IsRecalcChangeTariff bool `json:"is_recalc_change_tariff,omitempty"` } // Request to update the tariff type UpdateTariffRequest struct { - // Tariff id - TariffId string `json:"tariff_id"` - // Date of closing tariff CloseDate *time.Time `json:"close_date,omitempty"` - // Default tariff flag that is set when registering an account - IsDefaultTariff bool `json:"is_default_tariff,omitempty"` + // Tariff id + TariffId string `json:"tariff_id"` // Status of tariff Status TariffStatus `json:"status,omitempty"` + + // Default tariff flag that is set when registering an account + IsDefaultTariff bool `json:"is_default_tariff,omitempty"` } // Response from getting a list of tariffs diff --git a/billing_team.go b/billing_team.go index c11089c..1abf0c1 100644 --- a/billing_team.go +++ b/billing_team.go @@ -4,8 +4,8 @@ import "time" // TeamBilling struct of billing api type TeamBilling struct { - TeamUuid string `json:"team_uuid,omitempty"` DeleteDate time.Time `json:"delete_date,omitempty"` + TeamUuid string `json:"team_uuid,omitempty"` } // AddTeamOnPersonalAccountRequest request on add team on personal account diff --git a/billing_workplace.go b/billing_workplace.go index 446bd01..ea9d22d 100644 --- a/billing_workplace.go +++ b/billing_workplace.go @@ -13,11 +13,11 @@ type WorkplaceBilling struct { // UserInfo user information type UserInfo struct { + LastActivity *time.Time `json:"last_activity,omitempty"` Uuid string `json:"uuid"` FullName string `json:"full_name,omitempty"` Phone string `json:"phone,omitempty"` Email string `json:"email,omitempty"` - LastActivity *time.Time `json:"last_activity,omitempty"` } // WorkplaceOptions struct for pagination @@ -110,8 +110,8 @@ type GetUsersInfoByUserUUIDArrayResponse struct { // GetUsersInfoByUserUUIDArrayExcludingTeamMembersRequest request on get user information by array of UUID's users excluding team members in uuid team type GetUsersInfoByUserUUIDArrayExcludingTeamMembersRequest struct { - UserUuid []string `json:"user_uuid"` TeamUuid string `json:"team_uuid"` + UserUuid []string `json:"user_uuid"` Limit int32 `json:"limit,omitempty"` Offset int32 `json:"offset,omitempty"` } diff --git a/call_event.go b/call_event.go index f7242e1..4cb6e7b 100644 --- a/call_event.go +++ b/call_event.go @@ -8,9 +8,6 @@ type CallEvent struct { // Call id Uid string `json:"uid"` - // Call buzzing - Buzz bool `json:"buzz,omitempty"` - // Creation date, iso datetime Created ISODateTimeString `json:"created"` @@ -20,9 +17,6 @@ type CallEvent struct { // Call finish Finish ISODateTimeString `json:"finish,omitempty"` - // Call record enabled - Audiorecord bool `json:"audiorecord"` - // Call participants Onliners []CallOnliner `json:"onliners,omitempty"` @@ -31,6 +25,12 @@ type CallEvent struct { // Deprecated: use gentime or created Timestamp int64 `json:"timestamp"` + + // Call record enabled + Audiorecord bool `json:"audiorecord"` + + // Call buzzing + Buzz bool `json:"buzz,omitempty"` } // Call participant @@ -47,21 +47,21 @@ type CallOnliner struct { // Contact icon Icon string `json:"icon"` + // Member devices, strictly one for now + Devices []CallDevice `json:"devices"` + // Microphone muted. Computed from devices muted states Muted bool `json:"muted"` // Video state EnabledVideo bool `json:"enabled_video"` - - // Member devices, strictly one for now - Devices []CallDevice `json:"devices"` } // Call participant device type CallDevice struct { - // Device muted - Muted bool `json:"muted"` - // Device description Useragent string `json:"useragent"` + + // Device muted + Muted bool `json:"muted"` } diff --git a/chat.go b/chat.go index 8a37e4c..4c88573 100644 --- a/chat.go +++ b/chat.go @@ -32,65 +32,65 @@ type DeletedChat struct { // Chat (direct, group, task) representation type Chat struct { - // Group/Task/Contact id - Jid JID `json:"jid"` + // Task urgency, if available in team + Urgency *int `chattype:"task" json:"urgency,omitempty"` - // Chat type - ChatType ChatType `json:"chat_type"` + // Checked items in checklist. Tasks only + NumCheckedItems *uint `chattype:"task" json:"num_checked_items,omitempty"` - // Base fields (not related to concrete participant) version - BaseGentime int64 `json:"base_gentime,omitempty"` + // Task importance, if available in team + Importance *int `chattype:"task" json:"importance,omitempty"` - // Chat fields related to concrete participant) version - Gentime int64 `json:"gentime"` + // Task complexity, number + Complexity *int `chattype:"task" json:"complexity,omitempty"` - // Creation date, iso datetime - Created ISODateTimeString `json:"created"` + // Non-archive participants number + NumMembers *uint `json:"num_members,omitempty"` - // Title - DisplayName string `json:"display_name"` + // Last message object + LastMessage *Message `json:"last_message,omitempty"` - // Icons info - Icons IconData `json:"icons"` + // Task spent time, number + SpentTime *int `chattype:"task" json:"spent_time,omitempty"` - // Include unread messages to counters - CountersEnabled bool `json:"counters_enabled,omitempty"` + // Pinned message for this chat + PinnedMessage *Message `json:"pinned_message,omitempty"` - // Can I call to this chat - CanCall bool `json:"can_call,omitempty"` + // My status in group chat + Status *GroupStatus `chattype:"group" json:"status,omitempty"` - // Can I send message to this chat - CanSendMessage bool `json:"can_send_message,omitempty"` + // Delete messages in this chat in seconds. Experimental function + AutocleanupAge *int `chattype:"group" json:"autocleanup_age,omitempty"` - // Why I can't send message to this chat (if can't) - CantSendMessageReason string `json:"cant_send_message_reason,omitempty"` + // Custom color index from table of colors. Tasks only + ColorIndex *uint16 `chattype:"task" json:"color_index,omitempty"` - // Description collapsed. Used for tasks only - Collapsed bool `json:"collapsed,omitempty"` + // Items in checklist. Tasks only + NumItems *uint `chattype:"task" json:"num_items,omitempty"` + + // Task done reason, if any + DoneReason string `chattype:"task" json:"done_reason,omitempty"` // Last message draft, if any Draft string `json:"draft,omitempty"` - // Last message draft version, if any - DraftGentime int64 `json:"draft_gentime,omitempty"` - - // Hidden chat - Hidden bool `json:"hidden,omitempty"` + // Why I can't send message to this chat (if can't) + CantSendMessageReason string `json:"cant_send_message_reason,omitempty"` - // Push notifications enabled - NotificationsEnabled bool `json:"notifications_enabled,omitempty"` + // Group/Task/Contact id + Jid JID `json:"jid"` - // Number of important messages - NumImportants int `json:"num_importants,omitempty"` + // Task title. Generated from number and description + Title string `chattype:"task" json:"title,omitempty"` - // Unread counter - NumUnread uint `json:"num_unread,omitempty"` + // Task status. May be custom + TaskStatus string `chattype:"task" json:"task_status,omitempty"` - // Mentions (@) counter - NumUnreadNotices uint `json:"num_unread_notices,omitempty"` + // Date of the last message sent even if it was deleted + LastActivity ISODateTimeString `json:"last_activity,omitempty"` - // Last message object - LastMessage *Message `json:"last_message,omitempty"` + // Title + DisplayName string `json:"display_name"` // Last read message id, if any LastReadMessageId string `json:"last_read_message_id,omitempty"` @@ -98,110 +98,110 @@ type Chat struct { // Project / section id, if any Section string `json:"section,omitempty"` - // List of editable fields - ChangeableFields []string `json:"changeable_fields,omitempty"` + // Task creator + Owner JID `chattype:"task" json:"owner,omitempty"` - // Is chat pinned on top - Pinned bool `json:"pinned,omitempty"` + // Assignee contact id. Tasks only + Assignee JID `chattype:"task" json:"assignee,omitempty"` - // Sort ordering for pinned chat - PinnedSortOrdering int `json:"pinned_sort_ordering,omitempty"` + // Task deadline in iso format, if any + Deadline ISODateTimeString `chattype:"task" json:"deadline,omitempty"` - // Non-archive participants number - NumMembers *uint `json:"num_members,omitempty"` + // Creation date, iso datetime + Created ISODateTimeString `json:"created"` - // Can I delete this chat - CanDelete bool `json:"can_delete,omitempty"` + // Chat type + ChatType ChatType `json:"chat_type"` // Group or task description Description string `json:"description,omitempty"` - // Markup entities for description field. Experimental - Markup []MarkupEntity `json:"markup,omitempty" tdproto:"readonly"` + // Task done date in iso format, if any + Done ISODateTimeString `chattype:"task" json:"done,omitempty"` - // Present in feed (main screen) - Feed bool `json:"feed,omitempty"` + // Tab names + Tabs []TaskTabKey `chattype:"task" json:"tabs,omitempty"` - // Pinned message for this chat - PinnedMessage *Message `json:"pinned_message,omitempty"` + // Parent tasks + Parents []Subtask `chattype:"task" json:"parents,omitempty"` - // Custom color index from table of colors. Tasks only - ColorIndex *uint16 `chattype:"task" json:"color_index,omitempty"` + // Used for "Create task from messages..." + LinkedMessages []interface{} `chattype:"task" json:"linked_messages,omitempty"` - // Items in checklist. Tasks only - NumItems *uint `chattype:"task" json:"num_items,omitempty"` + // Markup entities for description field. Experimental + Markup []MarkupEntity `json:"markup,omitempty" tdproto:"readonly"` - // Checked items in checklist. Tasks only - NumCheckedItems *uint `chattype:"task" json:"num_checked_items,omitempty"` + // Upload uids for request, upload objects for response + Uploads []Upload `chattype:"task" json:"uploads,omitempty"` - // Assignee contact id. Tasks only - Assignee JID `chattype:"task" json:"assignee,omitempty"` + // Checklist items. Task only + Items []TaskItem `chattype:"task" json:"items,omitempty"` - // Task number in this team - Num uint `chattype:"task" json:"num,omitempty"` + // Group chat members + Members []GroupMembership `chattype:"group" json:"members,omitempty"` // Task followers id's. TODO: rename to "followers" Observers []JID `chattype:"task" json:"observers,omitempty"` - // Task creator - Owner JID `chattype:"task" json:"owner,omitempty"` + // List of editable fields + ChangeableFields []string `json:"changeable_fields,omitempty"` - // Task status. May be custom - TaskStatus string `chattype:"task" json:"task_status,omitempty"` + // Links in description + Links MessageLinks `chattype:"task" json:"links,omitempty"` - // Task title. Generated from number and description - Title string `chattype:"task" json:"title,omitempty"` + // Task tags list, if any + Tags []string `chattype:"task" json:"tags,omitempty"` - // Task done date in iso format, if any - Done ISODateTimeString `chattype:"task" json:"done,omitempty"` + // Icons info + Icons IconData `json:"icons"` - // Task done reason, if any - DoneReason string `chattype:"task" json:"done_reason,omitempty"` + // Sort ordering for pinned chat + PinnedSortOrdering int `json:"pinned_sort_ordering,omitempty"` - // Task deadline in iso format, if any - Deadline ISODateTimeString `chattype:"task" json:"deadline,omitempty"` + // Last message draft version, if any + DraftGentime int64 `json:"draft_gentime,omitempty"` - // Is task deadline expired - DeadlineExpired bool `chattype:"task" json:"deadline_expired,omitempty"` + // Chat fields related to concrete participant) version + Gentime int64 `json:"gentime"` - // Links in description - Links MessageLinks `chattype:"task" json:"links,omitempty"` + // Unread counter + NumUnread uint `json:"num_unread,omitempty"` - // Task tags list, if any - Tags []string `chattype:"task" json:"tags,omitempty"` + // Task number in this team + Num uint `chattype:"task" json:"num,omitempty"` - // Task importance, if available in team - Importance *int `chattype:"task" json:"importance,omitempty"` + // Base fields (not related to concrete participant) version + BaseGentime int64 `json:"base_gentime,omitempty"` - // Task urgency, if available in team - Urgency *int `chattype:"task" json:"urgency,omitempty"` + // Mentions (@) counter + NumUnreadNotices uint `json:"num_unread_notices,omitempty"` - // Task spent time, number - SpentTime *int `chattype:"task" json:"spent_time,omitempty"` + // Number of important messages + NumImportants int `json:"num_importants,omitempty"` - // Task complexity, number - Complexity *int `chattype:"task" json:"complexity,omitempty"` + // Deprecated + DraftNum int64 `json:"draft_num,omitempty"` - // Used for "Create task from messages..." - LinkedMessages []interface{} `chattype:"task" json:"linked_messages,omitempty"` + // Push notifications enabled + NotificationsEnabled bool `json:"notifications_enabled,omitempty"` - // Upload uids for request, upload objects for response - Uploads []Upload `chattype:"task" json:"uploads,omitempty"` + // Can I delete this chat + CanDelete bool `json:"can_delete,omitempty"` - // Checklist items. Task only - Items []TaskItem `chattype:"task" json:"items,omitempty"` + // Is chat pinned on top + Pinned bool `json:"pinned,omitempty"` - // Parent tasks - Parents []Subtask `chattype:"task" json:"parents,omitempty"` + // Any new team member will be added to this group chat + DefaultForAll bool `chattype:"group" json:"default_for_all,omitempty"` - // Tab names - Tabs []TaskTabKey `chattype:"task" json:"tabs,omitempty"` + // Can I call to this chat + CanCall bool `json:"can_call,omitempty"` - // My status in group chat - Status *GroupStatus `chattype:"group" json:"status,omitempty"` + // Can I change member status in this group chat + CanChangeMemberStatus bool `chattype:"group" json:"can_change_member_status,omitempty"` - // Group chat members - Members []GroupMembership `chattype:"group" json:"members,omitempty"` + // Hidden chat + Hidden bool `json:"hidden,omitempty"` // Can I add member to this group chat CanAddMember bool `chattype:"group" json:"can_add_member,omitempty"` @@ -209,20 +209,20 @@ type Chat struct { // Can I remove member from this group chat CanRemoveMember bool `chattype:"group" json:"can_remove_member,omitempty"` - // Can I change member status in this group chat - CanChangeMemberStatus bool `chattype:"group" json:"can_change_member_status,omitempty"` + // Present in feed (main screen) + Feed bool `json:"feed,omitempty"` // deprecated: use changeable fields CanChangeSettings bool `chattype:"group" json:"can_change_settings,omitempty"` - // Any new team member will be added to this group chat - DefaultForAll bool `chattype:"group" json:"default_for_all,omitempty"` + // Description collapsed. Used for tasks only + Collapsed bool `json:"collapsed,omitempty"` // Readonly for non-admins group chat (Like Channels in Telegram but switchable) ReadonlyForMembers bool `chattype:"group" json:"readonly_for_members,omitempty"` - // Delete messages in this chat in seconds. Experimental function - AutocleanupAge *int `chattype:"group" json:"autocleanup_age,omitempty"` + // Can I send message to this chat + CanSendMessage bool `json:"can_send_message,omitempty"` // Can other team member see this task/group chat Public bool `chattype:"group,task" json:"public,omitempty"` @@ -236,11 +236,11 @@ type Chat struct { // Can I change Important flag in any message in this chat CanSetImportantAnyMessage bool `json:"can_set_important_any_message,omitempty"` - // Date of the last message sent even if it was deleted - LastActivity ISODateTimeString `json:"last_activity,omitempty"` + // Include unread messages to counters + CountersEnabled bool `json:"counters_enabled,omitempty"` - // Deprecated - DraftNum int64 `json:"draft_num,omitempty"` + // Is task deadline expired + DeadlineExpired bool `chattype:"task" json:"deadline_expired,omitempty"` } // Link to sub/sup task @@ -254,32 +254,35 @@ type Subtask struct { // Task title. Generated from number and description Title string `json:"title"` - // Task number in this team - Num uint `json:"num"` - // Title DisplayName string `json:"display_name"` - // Is task or group public for non-guests - Public bool `json:"public,omitempty"` - // Subtask task status TaskStatus string `json:"task_status,omitempty"` + + // Task number in this team + Num uint `json:"num"` + + // Is task or group public for non-guests + Public bool `json:"public,omitempty"` } // Task checklist item type TaskItem struct { - // Id + // Link to subtask. Optional + Subtask *Subtask `json:"subtask,omitempty"` + + // Is task or group public for non-guests Uid string `json:"uid,omitempty"` - // Object version - Gentime int64 `json:"gentime" tdproto:"readonly"` + // Text or "#{OtherTaskNumber}" + Text string `json:"text"` // Sort ordering SortOrdering uint `json:"sort_ordering,omitempty"` - // Text or "#{OtherTaskNumber}" - Text string `json:"text"` + // Object version + Gentime int64 `json:"gentime" tdproto:"readonly"` // Item checked Checked bool `json:"checked,omitempty"` @@ -289,9 +292,6 @@ type TaskItem struct { // Can I change this item CanChange bool `json:"can_change,omitempty"` - - // Link to subtask. Optional - Subtask *Subtask `json:"subtask,omitempty"` } // Group chat membership status diff --git a/client_call_offer.go b/client_call_offer.go index db2544c..899e7f5 100644 --- a/client_call_offer.go +++ b/client_call_offer.go @@ -13,6 +13,12 @@ type clientCallOfferParams struct { // Chat or contact id Jid JID `json:"jid"` + // SDP (session description protocol) data + Sdp string `json:"sdp"` + + // CallType is a type of call("audio" - audio room, "video" - video room). default = "audio" + CallType CallType `json:"call_type,omitempty"` + // Mute state // Deprecated: use EnabledAudio Muted bool `json:"muted"` @@ -20,12 +26,6 @@ type clientCallOfferParams struct { // Is trickle mode enabled Trickle bool `json:"trickle"` - // SDP (session description protocol) data - Sdp string `json:"sdp"` - - // CallType is a type of call("audio" - audio room, "video" - video room). default = "audio" - CallType CallType `json:"call_type,omitempty"` - // Audio state EnabledAudio bool `json:"enabled_audio,omitempty"` diff --git a/client_call_screenshare.go b/client_call_screenshare.go index 055e2ab..b633711 100644 --- a/client_call_screenshare.go +++ b/client_call_screenshare.go @@ -10,9 +10,9 @@ func (p ClientCallScreenShare) GetName() string { return "client.call.screenshar // Params of the client.call.screenshare event type clientCallScreenShareParams struct { - // ScreenShareEnabled enabled or disabled screen share - ScreenShareEnabled bool `json:"screenshare_enabled"` - // CallJid Chat or contact id CallJid JID `json:"call_jid"` + + // ScreenShareEnabled enabled or disabled screen share + ScreenShareEnabled bool `json:"screenshare_enabled"` } diff --git a/client_chat_composing.go b/client_chat_composing.go index cf1e0a3..f918393 100644 --- a/client_chat_composing.go +++ b/client_chat_composing.go @@ -18,6 +18,9 @@ func (p ClientChatComposing) GetName() string { return "client.chat.composing" } // Params of the client.chat.composing event type clientChatComposingParams struct { + // Message draft data + Draft *string `json:"draft,omitempty"` + // Chat or contact id Jid JID `json:"jid"` @@ -26,7 +29,4 @@ type clientChatComposingParams struct { // 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 6807076..502a397 100644 --- a/client_chat_lastread.go +++ b/client_chat_lastread.go @@ -10,17 +10,17 @@ func NewClientChatLastread(jid JID, messageId *string) (r ClientChatLastread) { // Last read message in chat changed type ClientChatLastread struct { - BaseEvent Params clientChatLastreadParams `json:"params"` + BaseEvent } func (p ClientChatLastread) GetName() string { return "client.chat.lastread" } // Params of the client.chat.lastread event type clientChatLastreadParams struct { - // 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"` + + // Chat or contact id + Jid JID `json:"jid"` } diff --git a/client_message_updated.go b/client_message_updated.go index e995b18..273281d 100644 --- a/client_message_updated.go +++ b/client_message_updated.go @@ -20,30 +20,30 @@ type ClientMessageUpdatedParams struct { // Chat, task or contact jid. Required. To JID `json:"to"` - // Message content. Required. - Content MessageContent `json:"content"` - // Uid created by client. Recommended. MessageId string `json:"message_id,omitempty"` // Replied to message id. Not required. ReplyTo string `json:"reply_to,omitempty"` + // Deprecated + Comment string `json:"comment,omitempty"` + + // Message attachments + Uploads []string `json:"uploads,omitempty"` + // Forwarded messages (previously was for reply too). Not required. LinkedMessages []string `json:"linked_messages,omitempty"` + // Message content. Required. + Content MessageContent `json:"content"` + // Important flag. Not required. Default: false Important bool `json:"important,omitempty"` // Disable links preview generation. Not required. Default: false Nopreview bool `json:"nopreview,omitempty"` - // Message attachments - Uploads []string `json:"uploads,omitempty"` - // Backward compatibility mode OldStyleAttachment bool `json:"old_style_attachment,omitempty"` - - // Deprecated - Comment string `json:"comment,omitempty"` } diff --git a/color_rule.go b/color_rule.go index 257ba9e..602366b 100644 --- a/color_rule.go +++ b/color_rule.go @@ -2,42 +2,42 @@ package tdproto // Set of rules to apply to tasks for coloring. type ColorRule struct { - // Rule id - Uid string `json:"uid"` + // Tags filter enabled + TagsEnabled *bool `json:"tags_enabled,omitempty"` - // Rule priority - Priority int `json:"priority"` + // Task urgency filter enabled + TaskUrgencyEnabled *bool `json:"task_urgency_enabled,omitempty"` - // Rule description - Description string `json:"description,omitempty"` + // Task importance if task importance filter enabled + TaskImportance *int `json:"task_importance,omitempty"` - // Color index - ColorIndex uint16 `json:"color_index"` + // Task importance filter enabled + TaskImportanceEnabled *bool `json:"task_importance_enabled,omitempty"` // Project filter enabled - ProjectEnabled *bool `json:"section_enabled,omitempty"` // TODO: rename to "project_enabled + ProjectEnabled *bool `json:"section_enabled,omitempty"` // TODO: rename to "project_enabled" + + // Task urgency if task urgency filter enabled + TaskUrgency *int `json:"task_urgency,omitempty"` // Project id if project filter enabled Project string `json:"section,omitempty"` // TODO: rename to "project" - // Tags filter enabled - TagsEnabled *bool `json:"tags_enabled,omitempty"` - - // Tag ids if tags filter enabled - Tags []string `json:"tags,omitempty"` - // Task status TaskStatus string `json:"task_status,omitempty"` - // Task importance filter enabled - TaskImportanceEnabled *bool `json:"task_importance_enabled,omitempty"` + // Rule priority + Description string `json:"description,omitempty"` - // Task importance if task importance filter enabled - TaskImportance *int `json:"task_importance,omitempty"` + // Rule id + Uid string `json:"uid"` - // Task urgency filter enabled - TaskUrgencyEnabled *bool `json:"task_urgency_enabled,omitempty"` + // Tag ids if tags filter enabled + Tags []string `json:"tags,omitempty"` - // Task urgency if task urgency filter enabled - TaskUrgency *int `json:"task_urgency,omitempty"` + // Rule priority + Priority int `json:"priority"` + + // Color index + ColorIndex uint16 `json:"color_index"` } diff --git a/contact.go b/contact.go index a2bab19..04d203d 100644 --- a/contact.go +++ b/contact.go @@ -2,77 +2,77 @@ package tdproto // Contact type Contact struct { - // Contact Id - Jid JID `json:"jid"` + // Short view in contact list in mobile app + ContactMshortView *bool `json:"contact_mshort_view,omitempty"` - // Node uid for external users - Node string `json:"node,omitempty"` + // Short view in contact list + ContactShortView *bool `json:"contact_short_view,omitempty"` - // Full name in chats - DisplayName string `json:"display_name"` + // Push notifications for task chats + TaskNotificationsEnabled *bool `json:"task_notifications_enabled,omitempty"` - // Short name in chats - ShortName string `json:"short_name"` + // Quiet time finish + QuietTimeFinish *string `json:"quiet_time_finish,omitempty"` - // Contact email in this team - ContactEmail string `json:"contact_email"` + // Quiet time start + QuietTimeStart *string `json:"quiet_time_start,omitempty"` - // Contact phone in this team - ContactPhone string `json:"contact_phone"` + // Short view in task list + TaskShortView *bool `json:"task_short_view,omitempty"` - // Icons data - Icons IconData `json:"icons"` + // Timezone, if any + Timezone *string `json:"timezone,omitempty"` - // Object version - Gentime int64 `json:"gentime"` + // Hide pushes body + HidePushesContent *bool `json:"hide_pushes_content,omitempty"` - // Role in this team - Role string `json:"role"` + // Send push notifications even contact is online + AlwaysSendPushes *bool `json:"always_send_pushes,omitempty"` - // Mood in this team - Mood string `json:"mood,omitempty"` + // Push notifications for group chats + GroupNotificationsEnabled *bool `json:"group_notifications_enabled,omitempty"` - // Status in this team - TeamStatus TeamStatus `json:"status"` + // Use Ctrl/Cmd + Enter instead Enter + AltSend *bool `json:"alt_send,omitempty"` - // Last activity in this team (iso datetime) - LastActivity ISODateTimeString `json:"last_activity,omitempty"` + // Enable remove all messages experimental features + DropallEnabled *bool `json:"dropall_enabled,omitempty"` - // Contact deleted - IsArchive bool `json:"is_archive,omitempty"` + // Extra contact fields + CustomFields *ContactCustomFields `json:"custom_fields,omitempty"` - // Bot name. Empty for users - Botname string `json:"botname,omitempty"` + // Enable debug messages in UI + DebugShowActivity *bool `json:"debug_show_activity,omitempty"` - // Section ids - Sections []string `json:"sections"` + // Short view in task list in mobile app + TaskMshortView *bool `json:"task_mshort_view,omitempty"` - // Can I send message to this contact - CanSendMessage bool `json:"can_send_message,omitempty"` + // Show unread chats first in feed in mobile app + MUnreadFirst *bool `json:"munread_first,omitempty"` - // Why I can't send message to this chat (if can't) - CantSendMessageReason string `json:"cant_send_message_reason,omitempty"` + // Default language code + DefaultLang *string `json:"default_lang,omitempty"` - // Can I call to this contact - CanCall bool `json:"can_call,omitempty"` + // Show unread chats first in feed + UnreadFirst *bool `json:"unread_first,omitempty"` - // Can I create task for this contact - CanCreateTask bool `json:"can_create_task,omitempty"` + // Show archived contacts in contact list + ContactShowArchived *bool `json:"contact_show_archived,omitempty"` - // Can I import tasks in this team - CanImportTasks bool `json:"can_import_tasks,omitempty"` + // Use * as @ for mentions + AsteriskMention *bool `json:"asterisk_mention,omitempty"` - // Can I add this contact to group chats - CanAddToGroup bool `json:"can_add_to_group,omitempty"` + // Short view in group list in mobile app + GroupMshortView *bool `json:"group_mshort_view,omitempty"` - // Can I remove this contact from team - CanDelete bool `json:"can_delete,omitempty"` + // Short view in group list + GroupShortView *bool `json:"group_short_view,omitempty"` - // Changeable fields - ChangeableFields []string `json:"changeable_fields,omitempty"` + // Full name in chats + DisplayName string `json:"display_name"` - // Family name - FamilyName string `json:"family_name,omitempty"` + // Contact phone in this team + ContactPhone string `json:"contact_phone"` // Given name GivenName string `json:"given_name,omitempty"` @@ -80,80 +80,80 @@ type Contact struct { // Patronymic, if any Patronymic string `json:"patronymic,omitempty"` - // Default language code - DefaultLang *string `json:"default_lang,omitempty"` + // Why I can't send message to this chat (if can't) + CantSendMessageReason string `json:"cant_send_message_reason,omitempty"` - // Enable debug messages in UI - DebugShowActivity *bool `json:"debug_show_activity,omitempty"` + // Bot name. Empty for users + Botname string `json:"botname,omitempty"` - // Enable remove all messages experimental features - DropallEnabled *bool `json:"dropall_enabled,omitempty"` + // Last activity in this team (iso datetime) + LastActivity ISODateTimeString `json:"last_activity,omitempty"` - // Use Ctrl/Cmd + Enter instead Enter - AltSend *bool `json:"alt_send,omitempty"` + // Status in this team + TeamStatus TeamStatus `json:"status"` - // Use * as @ for mentions - AsteriskMention *bool `json:"asterisk_mention,omitempty"` + // Node uid for external users + Node string `json:"node,omitempty"` - // Send push notifications even contact is online - AlwaysSendPushes *bool `json:"always_send_pushes,omitempty"` + // Role in this team + Role string `json:"role"` - // Hide pushes body - HidePushesContent *bool `json:"hide_pushes_content,omitempty"` + // Contact Id + Jid JID `json:"jid"` - // Timezone, if any - Timezone *string `json:"timezone,omitempty"` + // Two-factor authentication status + Auth2faStatus string `json:"auth_2fa_status,omitempty"` - // Quiet time start - QuietTimeStart *string `json:"quiet_time_start,omitempty"` + // Contact email in this team + ContactEmail string `json:"contact_email"` - // Quiet time finish - QuietTimeFinish *string `json:"quiet_time_finish,omitempty"` + // Short name in chats + ShortName string `json:"short_name"` // Focus mode enabled until FocusUntil ISODateTimeString `json:"focus_until,omitempty"` - // Push notifications for group chats - GroupNotificationsEnabled *bool `json:"group_notifications_enabled,omitempty"` + // Family name + FamilyName string `json:"family_name,omitempty"` - // Push notifications for task chats - TaskNotificationsEnabled *bool `json:"task_notifications_enabled,omitempty"` + // Mood in this team + Mood string `json:"mood,omitempty"` - // Short view in contact list - ContactShortView *bool `json:"contact_short_view,omitempty"` + // Changeable fields + ChangeableFields []string `json:"changeable_fields,omitempty"` - // Short view in group list - GroupShortView *bool `json:"group_short_view,omitempty"` + // Section ids + Sections []string `json:"sections"` - // Short view in task list - TaskShortView *bool `json:"task_short_view,omitempty"` + // Icons data + Icons IconData `json:"icons"` - // Short view in contact list in mobile app - ContactMshortView *bool `json:"contact_mshort_view,omitempty"` + // Object version + Gentime int64 `json:"gentime"` - // Short view in group list in mobile app - GroupMshortView *bool `json:"group_mshort_view,omitempty"` + // Can I add new members to this team + CanAddToTeam bool `json:"can_add_to_team,omitempty"` // Two-factor authentication is configured and confirmed Auth2faEnabled bool `json:"auth_2fa_enabled,omitempty"` - // Two-factor authentication status - Auth2faStatus string `json:"auth_2fa_status,omitempty"` + // Can I import tasks in this team + CanImportTasks bool `json:"can_import_tasks,omitempty"` - // Short view in task list in mobile app - TaskMshortView *bool `json:"task_mshort_view,omitempty"` + // Deprecated + CanDeleteAnyMessage bool `json:"can_delete_any_message,omitempty"` - // Show archived contacts in contact list - ContactShowArchived *bool `json:"contact_show_archived,omitempty"` + // Can I create task for this contact + CanCreateTask bool `json:"can_create_task,omitempty"` - // Show unread chats first in feed - UnreadFirst *bool `json:"unread_first,omitempty"` + // Can I call to this contact + CanCall bool `json:"can_call,omitempty"` - // Show unread chats first in feed in mobile app - MUnreadFirst *bool `json:"munread_first,omitempty"` + // Can I send message to this contact + CanSendMessage bool `json:"can_send_message,omitempty"` - // Can I add new members to this team - CanAddToTeam bool `json:"can_add_to_team,omitempty"` + // Can I remove this contact from team + CanDelete bool `json:"can_delete,omitempty"` // Can I manage contact sections in this team CanManageSections bool `json:"can_manage_sections,omitempty"` @@ -161,8 +161,8 @@ type Contact struct { // Can I manage task projects in this team CanManageProjects bool `json:"can_manage_projects,omitempty"` - // Can I manage tags in this team - CanManageTags bool `json:"can_manage_tags,omitempty"` + // Can I add this contact to group chats + CanAddToGroup bool `json:"can_add_to_group,omitempty"` // Can I manage integrations in this team CanManageIntegrations bool `json:"can_manage_integrations,omitempty"` @@ -179,11 +179,11 @@ type Contact struct { // Can I view/join public tasks in this team CanJoinPublicTasks bool `json:"can_join_public_tasks,omitempty"` - // Extra contact fields - CustomFields *ContactCustomFields `json:"custom_fields,omitempty"` + // Contact deleted + IsArchive bool `json:"is_archive,omitempty"` - // Deprecated - CanDeleteAnyMessage bool `json:"can_delete_any_message,omitempty"` + // Can I manage tags in this team + CanManageTags bool `json:"can_manage_tags,omitempty"` } // Extra contact fields diff --git a/counters.go b/counters.go index ff65bc6..96aa494 100644 --- a/counters.go +++ b/counters.go @@ -2,13 +2,13 @@ package tdproto // Unread messages counter type ChatCounters struct { + LastReadMessageUid *string `json:"last_read_message_id"` Jid JID `json:"jid"` ChatType ChatType `json:"chat_type"` + LastActivity ISODateTimeString `json:"last_activity,omitempty"` Gentime int64 `json:"gentime"` NumUnread uint `json:"num_unread"` NumUnreadNotices uint `json:"num_unread_notices"` - LastReadMessageUid *string `json:"last_read_message_id"` - LastActivity ISODateTimeString `json:"last_activity,omitempty"` } // Unread message counters @@ -27,11 +27,11 @@ type TeamUnread map[ChatType]*Unread // Unread message counters type TeamCounter struct { - // Team id - Uid string `json:"uid"` - // Unread message counters Unreads TeamUnread `json:"unread"` + + // Team id + Uid string `json:"uid"` } func EmptyTeamUnread() TeamUnread { diff --git a/dlp.go b/dlp.go index dfa5970..bb5b716 100644 --- a/dlp.go +++ b/dlp.go @@ -5,9 +5,9 @@ import "time" // DLPBasicData structure for basic data (used for team, group, task, etc.) type DLPBasicData struct { UUID string `json:"uuid"` - Number uint `json:"number"` Name string `json:"name"` Description string `json:"description"` + Number uint `json:"number"` } // DLPUserData structure to store sender/receiver user information @@ -39,15 +39,15 @@ type DLPFileData struct { // DLPEvent structure to store all information about event type DLPEvent struct { - UUID string `json:"uuid"` - EventChannel ChatType `json:"event_channel"` EventTime time.Time `json:"event_time"` - MediaType Mediatype `json:"media_type"` - TeamData DLPBasicData `json:"team_data"` - SenderData DLPUserData `json:"sender_data"` - DirectData DLPUserData `json:"direct_data"` GroupData DLPBasicData `json:"group_data"` + TeamData DLPBasicData `json:"team_data"` TaskData DLPBasicData `json:"task_data"` FileData DLPFileData `json:"file_data"` MessageData DLPMessageData `json:"message_data"` + UUID string `json:"uuid"` + EventChannel ChatType `json:"event_channel"` + MediaType Mediatype `json:"media_type"` + SenderData DLPUserData `json:"sender_data"` + DirectData DLPUserData `json:"direct_data"` } diff --git a/event.go b/event.go index 32425d0..7090ffc 100644 --- a/event.go +++ b/event.go @@ -8,8 +8,8 @@ type BaseEvent struct { // Generic event representation type AnyEvent struct { - BaseEvent Params *map[string]interface{} `json:"params"` + BaseEvent } func (ev BaseEvent) GetName() string { return ev.Name } diff --git a/features.go b/features.go index af53365..36e51d3 100644 --- a/features.go +++ b/features.go @@ -7,14 +7,14 @@ const ( // Server information. Readonly. type Features struct { - // Current host - Host string `json:"host"` + // Default wallpaper url for mobile apps, if any + DefaultWallpaper *Wallpaper `json:"default_wallpaper,omitempty"` - // Build/revision of server side - Build string `json:"build"` + // Team entity naming. Experimental. + Terms Terms `json:"terms"` - // Desktop application version - DesktopVersion string `json:"desktop_version"` + // ReCaptcha Web Key V3 + ReCaptchaWebKeyV3 string `json:"recaptcha_web_key_v3,omitempty"` // Webclient version FrontVersion string `json:"front_version"` @@ -25,8 +25,8 @@ type Features struct { // Landing page address, if any LandingUrl string `json:"landing_url,omitempty"` - // Local applications urls - AppSchemes []string `json:"app_schemes"` + // Current host + Host string `json:"host"` // Static files server address Userver string `json:"userver"` @@ -37,7 +37,7 @@ type Features struct { // Link to Google Play AndroidApp string `json:"android_app"` - // Link to AppStore for corporate app + // Link to AppStore for corporate appz IOSCorpApp string `json:"ios_corp_app"` // Link to Google Play for corporate app @@ -55,134 +55,135 @@ type Features struct { // Minimal iOS corp application version required for this server. Used for breaking changes MinCorpIOSVersion string `json:"min_corp_ios_version"` - // Minimal android corp application version required for this server. Used for breaking changes - MinCorpAndroidVersion string `json:"min_corp_android_version"` + // Desktop application version + DesktopVersion string `json:"desktop_version"` - // Free registration allowed - FreeRegistration bool `json:"free_registration"` + // Name of installation + InstallationType string `json:"installation_type"` - // Maximum size of user's upload - MaxUploadMb int `json:"max_upload_mb"` + // Frontend sentry.io settings + SentryDsnJS string `json:"sentry_dsn_js"` - // Maximum number of forwarded messages - MaxLinkedMessages int `json:"max_linked_messages"` + // Deprecated + MinAppVersion string `json:"min_app_version"` - // Maximum number of message uploads - MaxMessageUploads int `json:"max_message_uploads"` + // Support email + SupportEmail string `json:"support_email"` - // Maximum chars for: family_name, given_name, patronymic if any - MaxUsernamePartLength int `json:"max_username_part_length"` + // Custom application icon name, if any + CustomAppIconName string `json:"custom_app_icon_name,omitempty"` - // Maximum chars for group chat name - MaxGroupTitleLength int `json:"max_group_title_length"` + // Build/revision of server side + Build string `json:"build"` - // Maximum chars for team name - MaxTeamTitleLength int `json:"max_team_title_length"` + // Safari push id for web-push notifications + SafariPushId string `json:"safari_push_id"` - // Maximum chars for role in team - MaxRoleLength int `json:"max_role_length"` + // Firebase settings for web-push notifications + FirebaseStorageBucket string `json:"firebase_storage_bucket"` - // Maximum chars for mood in team - MaxMoodLength int `json:"max_mood_length"` + // Firebase settings for web-push notifications + FirebaseProjectId string `json:"firebase_project_id"` - // Maximum chars for text message - MaxMessageLength int `json:"max_message_length"` + // Firebase settings for web-push notifications + FirebaseDatabaseUrl string `json:"firebase_database_url"` - // Maximum length for contact's sections names - MaxSectionLength int `json:"max_section_length"` + // Firebase settings for web-push notifications + FirebaseAuthDomain string `json:"firebase_auth_domain"` - // Maximum length for project - MaxProjectLength int `json:"max_project_length"` + // Firebase settings for web-push notifications + FirebaseApiKey string `json:"firebase_api_key"` - // Maximum length for tags - MaxTagLength int `json:"max_tag_length"` + // Firebase settings for web-push notifications + FirebaseSenderId string `json:"firebase_sender_id"` - // Maximum length for task title - MaxTaskTitleLength int `json:"max_task_title_length"` + // Firebase settings for web-push notifications + FirebaseAppId string `json:"firebase_app_id"` - // Maximum length for ColorRule description - MaxColorRuleDescriptionLength int `json:"max_color_rule_description_length"` + // Amplitude api key + AmplitudeApiKey string `json:"amplitude_api_key,omitempty"` - // Maximum length for urls - MaxUrlLength int `json:"max_url_length"` + // Yandex metrika counter id + Metrika string `json:"metrika"` - // Maximum length for Integration comment - MaxIntegrationCommentLength int `json:"max_integration_comment_length"` + // WebBackground image url, if any + WebLoginBackground string `json:"web_login_background,omitempty"` - // Maximum teams for one account - MaxTeams int `json:"max_teams"` + // AppBackground image url, if any + AppLoginBackground string `json:"app_login_background,omitempty"` - // Maximum search result - MaxMessageSearchLimit int `json:"max_message_search_limit"` + // Minimal android corp application version required for this server. Used for breaking changes + MinCorpAndroidVersion string `json:"min_corp_android_version"` - // Multi nodes mode (federation) enabled - MultiNodes bool `json:"multi_nodes,omitempty"` + // Installation title, used on login screen + InstallationTitle string `json:"installation_title,omitempty"` - // Max inactivity seconds - AfkAge int `json:"afk_age"` + // ReCaptcha Web Key V2 + ReCaptchaWebKeyV2 string `json:"recaptcha_web_key_v2,omitempty"` - // Password authentication enabled - AuthByPassword bool `json:"auth_by_password,omitempty"` + // File Extension Blacklist + FileExtensionBlacklist []string `json:"file_extension_blacklist,omitempty"` - // QR-code / link authentication enabled - AuthByQrCode bool `json:"auth_by_qr_code,omitempty"` + // Local applications urls + AppSchemes []string `json:"app_schemes"` - // SMS authentication enabled - AuthBySms bool `json:"auth_by_sms,omitempty"` + // External services + OAuthServices []OAuthService `json:"oauth_services,omitempty"` - // Two-factor authentication (2FA) enabled - Auth2fa bool `json:"auth_2fa,omitempty"` + // File Extension Whitelist + FileExtensionWhitelist []string `json:"file_extension_whitelist,omitempty"` - // Kerberos authentication enabled - AuthByKerberos bool `json:"auth_by_kerberos,omitempty"` + // ICE servers for WebRTC + ICEServers []ICEServer `json:"ice_servers"` - // Captcha enabled - ReCaptchaEnabled bool `json:"is_recaptcha_enabled,omitempty"` + // Maximum chars for text message + MaxMessageLength int `json:"max_message_length"` - // ReCaptcha Web Key V3 - ReCaptchaWebKeyV3 string `json:"recaptcha_web_key_v3,omitempty"` + // Maximum size of user's upload + MaxUploadMb int `json:"max_upload_mb"` - // ReCaptcha Web Key V2 - ReCaptchaWebKeyV2 string `json:"recaptcha_web_key_v2,omitempty"` + // Maximum number of forwarded messages + MaxLinkedMessages int `json:"max_linked_messages"` - // Mandatory setting of the pin code in the application - IsPinCodeRequired bool `json:"is_pin_code_required"` + // Maximum number of message uploads + MaxMessageUploads int `json:"max_message_uploads"` // Max number of attempts to enter an invalid PIN code PinCodeWrongLimit int `json:"pin_code_wrong_limit"` - // External services - OAuthServices []OAuthService `json:"oauth_services,omitempty"` + // Maximum chars for: family_name, given_name, patronymic if any + MaxUsernamePartLength int `json:"max_username_part_length"` - // ICE servers for WebRTC - ICEServers []ICEServer `json:"ice_servers"` + // Maximum length for Integration comment + MaxIntegrationCommentLength int `json:"max_integration_comment_length"` - // True for premise installation - CustomServer bool `json:"custom_server"` + // Maximum chars for group chat name + MaxGroupTitleLength int `json:"max_group_title_length"` - // Name of installation - InstallationType string `json:"installation_type"` + // Maximum chars for team name + MaxTeamTitleLength int `json:"max_team_title_length"` - // Installation title, used on login screen - InstallationTitle string `json:"installation_title,omitempty"` + // Maximum number of participants per call + MaxParticipantsPerCall int `json:"max_participants_per_call,omitempty"` - // Custom application icon name, if any - CustomAppIconName string `json:"custom_app_icon_name,omitempty"` + // Maximum search result + MaxMessageSearchLimit int `json:"max_message_search_limit"` - // AppBackground image url, if any - AppLoginBackground string `json:"app_login_background,omitempty"` + // Maximum teams for one account + MaxTeams int `json:"max_teams"` - // WebBackground image url, if any - WebLoginBackground string `json:"web_login_background,omitempty"` + // Calls version. 0 = disabled, 1 = audio only, 2 = audio+video + // Deprecated: use CallsAudioEnabled and CallsVideoEnabled + CallsVersion int `json:"calls_version"` - // Testing installation - IsTesting bool `json:"is_testing"` + // Maximum chars for role in team + MaxRoleLength int `json:"max_role_length"` - // Yandex metrika counter id - Metrika string `json:"metrika"` + // Maximum length for urls + MaxUrlLength int `json:"max_url_length"` - // Amplitude api key - AmplitudeApiKey string `json:"amplitude_api_key,omitempty"` + // Maximum length for ColorRule description + MaxColorRuleDescriptionLength int `json:"max_color_rule_description_length"` // Minimal chars number for starting global search MinSearchLength int `json:"min_search_length"` @@ -190,41 +191,40 @@ type Features struct { // Resend message in n seconds if no confirmation from server given ResendTimeout int `json:"resend_timeout"` - // Frontend sentry.io settings - SentryDsnJS string `json:"sentry_dsn_js"` + // Max inactivity seconds + AfkAge int `json:"afk_age"` - // Message drafts saved on server - ServerDrafts bool `json:"server_drafts"` + // Maximum chars for mood in team + MaxMoodLength int `json:"max_mood_length"` - // Firebase settings for web-push notifications - FirebaseAppId string `json:"firebase_app_id"` + // Maximum length for task title + MaxTaskTitleLength int `json:"max_task_title_length"` - // Firebase settings for web-push notifications - FirebaseSenderId string `json:"firebase_sender_id"` + // Maximum length for tags + MaxTagLength int `json:"max_tag_length"` - // Firebase settings for web-push notifications - FirebaseApiKey string `json:"firebase_api_key"` + // Maximum length for project + MaxProjectLength int `json:"max_project_length"` - // Firebase settings for web-push notifications - FirebaseAuthDomain string `json:"firebase_auth_domain"` + // Maximum length for contact's sections names + MaxSectionLength int `json:"max_section_length"` - // Firebase settings for web-push notifications - FirebaseDatabaseUrl string `json:"firebase_database_url"` + // QR-code / link authentication enabled + AuthByQrCode bool `json:"auth_by_qr_code,omitempty"` - // Firebase settings for web-push notifications - FirebaseProjectId string `json:"firebase_project_id"` + // Message drafts saved on server + ServerDrafts bool `json:"server_drafts"` - // Firebase settings for web-push notifications - FirebaseStorageBucket string `json:"firebase_storage_bucket"` + // Testing installation + IsTesting bool `json:"is_testing"` - // Calls version. 0 = disabled, 1 = audio only, 2 = audio+video - // Deprecated: use CallsAudioEnabled and CallsVideoEnabled - CallsVersion int `json:"calls_version"` + // Captcha enabled + ReCaptchaEnabled bool `json:"is_recaptcha_enabled,omitempty"` - // CallsAudioEnabled enabled or disabled audio calls + // Enabled or disabled audio calls CallsAudioEnabled bool `json:"calls_audio_enabled"` - // CallsVideoEnabled enabled or disabled video calls + // Enabled or disabled video calls CallsVideoEnabled bool `json:"calls_video_enabled"` // Calls functions enabled for mobile applications @@ -236,17 +236,17 @@ type Features struct { // Disallow call from multiple devices. Experimental OnlyOneDevicePerCall bool `json:"only_one_device_per_call,omitempty"` - // Maximum number of participants per call - MaxParticipantsPerCall int `json:"max_participants_per_call,omitempty"` + // Multi nodes mode (federation) enabled + MultiNodes bool `json:"multi_nodes,omitempty"` - // Safari push id for web-push notifications - SafariPushId string `json:"safari_push_id"` + // Password authentication enabled + AuthByPassword bool `json:"auth_by_password,omitempty"` // Multiple message uploads MessageUploads bool `json:"message_uploads"` - // Team entity naming. Experimental. - Terms Terms `json:"terms"` + // True for premise installation + CustomServer bool `json:"custom_server"` // Cross team communication. Experimental. SingleGroupTeams bool `json:"single_group_teams"` @@ -257,11 +257,11 @@ type Features struct { // Wiki pages in chats. Experimental AllowAdminMute bool `json:"allow_admin_mute,omitempty"` - // Default wallpaper url for mobile apps, if any - DefaultWallpaper *Wallpaper `json:"default_wallpaper,omitempty"` + // SMS authentication enabled + AuthBySms bool `json:"auth_by_sms,omitempty"` - // Support email - SupportEmail string `json:"support_email"` + // Mandatory setting of the pin code in the application + IsPinCodeRequired bool `json:"is_pin_code_required"` // True if server has custom theme CustomTheme bool `json:"custom_theme"` @@ -290,14 +290,14 @@ type Features struct { // Billing services integrations Billing bool `json:"billing,omitempty"` - // Deprecated - MinAppVersion string `json:"min_app_version"` + // Two-factor authentication (2FA) enabled + Auth2fa bool `json:"auth_2fa,omitempty"` - // File Extension Whitelist - FileExtensionWhitelist []string `json:"file_extension_whitelist,omitempty"` + // Kerberos authentication enabled + AuthByKerberos bool `json:"auth_by_kerberos,omitempty"` - // File Extension Blacklist - FileExtensionBlacklist []string `json:"file_extension_blacklist,omitempty"` + // Free registration allowed + FreeRegistration bool `json:"free_registration"` // File Extension Whitelist Priority FileExtensionWhitelistPriority bool `json:"file_extension_whitelist_priority,omitempty"` diff --git a/icon_data.go b/icon_data.go index 7c8c532..cc0d9da 100644 --- a/icon_data.go +++ b/icon_data.go @@ -14,12 +14,6 @@ type SingleIcon struct { // Icon data. For icon generated from display name contains Letters + Color fields. type IconData struct { - // Small icon - Sm SingleIcon `json:"sm"` - - // Large image - Lg SingleIcon `json:"lg"` - // Letters (only for stub icon) Letters string `json:"letters,omitempty"` @@ -31,4 +25,10 @@ type IconData struct { // Deprecated Stub string `json:"stub,omitempty"` + + // Small icon + Sm SingleIcon `json:"sm"` + + // Large image + Lg SingleIcon `json:"lg"` } diff --git a/integrations.go b/integrations.go index 4eb7b8e..5458be5 100644 --- a/integrations.go +++ b/integrations.go @@ -5,11 +5,11 @@ type IntegrationField struct { // Label Label string `json:"label"` - // Is field readonly - Readonly bool `json:"readonly"` - // Current value Value string `json:"value"` + + // Is field readonly + Readonly bool `json:"readonly"` } // Integration form @@ -26,6 +26,9 @@ type IntegrationForm struct { // Integration for concrete chat type Integration struct { + // Creation datetime, iso + Form IntegrationForm `json:"form"` + // Id Uid string `json:"uid,omitempty"` @@ -35,12 +38,6 @@ type Integration struct { // Creation datetime, iso Created ISODateTimeString `json:"created,omitempty"` - // Integration enabled - Enabled bool `json:"enabled"` - - // Integration form - Form IntegrationForm `json:"form"` - // Chat id Group JID `json:"group"` @@ -51,6 +48,9 @@ type Integration struct { Kind string `json:"kind"` Title string `json:"-"` + + // Integration enabled + Enabled bool `json:"enabled"` } // Integration kind @@ -61,14 +61,14 @@ type IntegrationKind struct { // Plugin title Title string `json:"title"` - // Integration template - Template Integration `json:"template"` - // Path to icon Icon string `json:"icon"` // Plugin description Description string `json:"description"` + + // Integration template + Template Integration `json:"template"` } // Complete integrations data, as received from server diff --git a/invitable_user.go b/invitable_user.go index 375f2b6..b199338 100644 --- a/invitable_user.go +++ b/invitable_user.go @@ -11,9 +11,9 @@ type InvitableUser struct { // Full name DisplayName string `json:"display_name"` - // Icons - Icons IconData `json:"icons"` - // Common team uids, if any Teams []string `json:"teams,omitempty"` + + // Icons + Icons IconData `json:"icons"` } diff --git a/markup_entity.go b/markup_entity.go index f3dd4cc..c1adf3a 100644 --- a/markup_entity.go +++ b/markup_entity.go @@ -6,17 +6,11 @@ import ( // Markup entity. Experimental type MarkupEntity struct { - // Open marker offset - Open int `json:"op"` - - // Open marker length - OpenLength int `json:"oplen,omitempty"` - - // Close marker offset - Close int `json:"cl"` + // Text replacement. + Repl string `json:"repl,omitempty"` - // Close marker length - CloseLength int `json:"cllen,omitempty"` + // Time, for Time type + Time string `json:"time,omitempty"` // Marker type Type MarkupType `json:"typ"` @@ -24,14 +18,20 @@ type MarkupEntity struct { // Url, for Link type Url string `json:"url,omitempty"` - // Text replacement. - Repl string `json:"repl,omitempty"` - - // Time, for Time type - Time string `json:"time,omitempty"` - // List of internal markup entities Childs []MarkupEntity `json:"childs,omitempty"` + + // Close marker length + CloseLength int `json:"cllen,omitempty"` + + // Open marker offset + Open int `json:"op"` + + // Open marker length + OpenLength int `json:"oplen,omitempty"` + + // Close marker offset + Close int `json:"cl"` } func (e MarkupEntity) String() string { diff --git a/message.go b/message.go index a907111..4f3af6b 100644 --- a/message.go +++ b/message.go @@ -23,38 +23,38 @@ const ( // Chat message content type MessageContent struct { - // Text representation of message - Text string `json:"text"` + // Upload duration, if any. Deprecated: use Uploads instead + Duration *uint `mediatype:"audiomsg,video" json:"duration,omitempty"` - // Message type - Type Mediatype `json:"type"` + // Change old value (for "change" mediatype) + Old *string `mediatype:"change" json:"old,omitempty"` - // Message subtype, if any - Subtype Mediasubtype `json:"subtype,omitempty"` + // Pdf version, if any + PdfVersion *PdfVersion `json:"pdf_version,omitempty"` - // Upload id, if any. Deprecated: use Uploads instead - Upload string `mediatype:"audiomsg,image,video,file" json:"upload,omitempty"` + // Change new value (for "change" mediatype) + New *string `mediatype:"change" json:"new,omitempty"` - // Upload url, if any. Deprecated: use Uploads instead - MediaUrl string `mediatype:"audiomsg,image,video,file" json:"mediaURL,omitempty"` + // Family name (for "contact" mediatype) + FamilyName string `mediatype:"contact" json:"family_name,omitempty"` - // Upload size, if any. Deprecated: use Uploads instead - Size int `mediatype:"audiomsg,image,video,file" json:"size,omitempty"` + // Stickerpack name (for "sticker" subtype) + Stickerpack string `mediasubtype:"sticker" json:"stickerpack,omitempty"` - // Upload duration, if any. Deprecated: use Uploads instead - Duration *uint `mediatype:"audiomsg,video" json:"duration,omitempty"` + // Upload url, if any. Deprecated: use Uploads instead + MediaUrl string `mediatype:"audiomsg,image,video,file" json:"mediaURL,omitempty"` - // Upload still processing, if any. Deprecated: use Uploads instead - Processing bool `mediatype:"video" json:"processing,omitempty"` + // Patronymic name (for "contact" mediatype) + Patronymic string `mediatype:"contact" json:"patronymic,omitempty"` // Compact representation of a placeholder for an image. Deprecated: use Uploads instead Blurhash string `mediatype:"image" json:"blurhash,omitempty"` - // Upload preview height, in pixels, if any. Deprecated: use Uploads instead - PreviewHeight int `mediatype:"image,video" json:"previewHeight,omitempty"` + // Upload id, if any. Deprecated: use Uploads instead + Upload string `mediatype:"audiomsg,image,video,file" json:"upload,omitempty"` - // Upload width, in pixels, if any. Deprecated: use Uploads instead - PreviewWidth int `mediatype:"image,video" json:"previewWidth,omitempty"` + // Given name (for "contact" mediatype) + GivenName string `mediatype:"contact" json:"given_name,omitempty"` // Upload preview absolute url, if any. Deprecated: use Uploads instead PreviewUrl string `mediatype:"image,video" json:"previewURL,omitempty"` @@ -62,35 +62,26 @@ type MessageContent struct { // Upload high resolution preview absolute url, if any. Deprecated: use Uploads instead Preview2xUrl string `mediatype:"image,video" json:"preview2xURL,omitempty"` - // Upload name, if any. Deprecated: use Uploads instead - Name string `mediatype:"image,video,file" json:"name,omitempty"` + // Message subtype, if any + Subtype Mediasubtype `json:"subtype,omitempty"` - // Upload is animated image, if any. Deprecated: use Uploads instead - Animated bool `mediatype:"image" json:"animated,omitempty"` + // Comment (for "audiomsg" mediatype) + Comment string `mediatype:"audiomsg" json:"comment,omitempty"` // Change title (for "change" mediatype) Title string `mediatype:"change" json:"title,omitempty"` - // Change old value (for "change" mediatype) - Old *string `mediatype:"change" json:"old,omitempty"` - - // Change new value (for "change" mediatype) - New *string `mediatype:"change" json:"new,omitempty"` + // Message type + Type Mediatype `json:"type"` // Change actor contact id (for "change" mediatype) Actor JID `mediatype:"change" json:"actor,omitempty"` - // Comment (for "audiomsg" mediatype) - Comment string `mediatype:"audiomsg" json:"comment,omitempty"` - - // Given name (for "contact" mediatype) - GivenName string `mediatype:"contact" json:"given_name,omitempty"` - - // Family name (for "contact" mediatype) - FamilyName string `mediatype:"contact" json:"family_name,omitempty"` + // Upload name, if any. Deprecated: use Uploads instead + Name string `mediatype:"image,video,file" json:"name,omitempty"` - // Patronymic name (for "contact" mediatype) - Patronymic string `mediatype:"contact" json:"patronymic,omitempty"` + // Text representation of message + Text string `json:"text"` // Contact phones list (for "contact" mediatype) Phones []string `mediatype:"contact" json:"phones,omitempty"` @@ -98,23 +89,32 @@ type MessageContent struct { // Emails list (for "contact" mediatype) Emails []string `mediatype:"contact" json:"emails,omitempty"` - // Stickerpack name (for "sticker" subtype) - Stickerpack string `mediasubtype:"sticker" json:"stickerpack,omitempty"` + // Upload size, if any. Deprecated: use Uploads instead + Size int `mediatype:"audiomsg,image,video,file" json:"size,omitempty"` - // Pdf version, if any - PdfVersion *PdfVersion `json:"pdf_version,omitempty"` + // Upload preview height, in pixels, if any. Deprecated: use Uploads instead + PreviewHeight int `mediatype:"image,video" json:"previewHeight,omitempty"` + + // Upload width, in pixels, if any. Deprecated: use Uploads instead + PreviewWidth int `mediatype:"image,video" json:"previewWidth,omitempty"` + + // Upload still processing, if any. Deprecated: use Uploads instead + Processing bool `mediatype:"video" json:"processing,omitempty"` + + // Upload is animated image, if any. Deprecated: use Uploads instead + Animated bool `mediatype:"image" json:"animated,omitempty"` } // Chat message type Message struct { - // Message content struct - Content MessageContent `json:"content"` + // Index number of this message. Starts from 0. Null for deleted messages. Changes when any previous message wad deleted. + Num *int `json:"num,omitempty" tdproto:"readonly"` - // Simple plaintext message representation - PushText string `json:"push_text,omitempty" tdproto:"readonly"` + // Message that was replied to, if any + ReplyTo *Message `json:"reply_to,omitempty"` - // Sender contact id - From JID `json:"from" tdproto:"readonly"` + // Debug information, if any + Debug string `json:"_debug,omitempty" tdproto:"readonly"` // Recipient id (group, task or contact) To JID `json:"to"` @@ -128,8 +128,8 @@ type Message struct { // Creation datetime for draft messages Drafted ISODateTimeString `json:"drafted,omitempty" tdproto:"readonly"` - // Object version - Gentime int64 `json:"gentime" tdproto:"readonly"` + // Sender contact id + From JID `json:"from" tdproto:"readonly"` // Chat type ChatType ChatType `json:"chat_type" tdproto:"readonly"` @@ -137,68 +137,68 @@ type Message struct { // Chat id Chat JID `json:"chat" tdproto:"readonly"` - // External/internals links - Links MessageLinks `json:"links,omitempty" tdproto:"readonly"` + // Author can change this message until date + EditableUntil ISODateTimeString `json:"editable_until,omitempty" tdproto:"readonly"` - // Markup entities. Experimental - Markup []MarkupEntity `json:"markup,omitempty" tdproto:"readonly"` + // Simple plaintext message representation + PushText string `json:"push_text,omitempty" tdproto:"readonly"` - // Importance flag - Important bool `json:"important,omitempty"` + // Previous message id in this chat + Prev string `json:"prev,omitempty" tdproto:"readonly"` // ISODateTimeString of message modification or deletion Edited ISODateTimeString `json:"edited,omitempty" tdproto:"readonly"` - // Message was seen by anybody in chat. True or null - Received bool `json:"received,omitempty" tdproto:"readonly"` + // Message reactions struct + Reactions []MessageReaction `json:"reactions,omitempty" tdproto:"readonly"` - // Unused yet - NumReceived int `json:"num_received,omitempty" tdproto:"readonly"` + // Message uploads + Uploads []Upload `json:"uploads,omitempty"` - // Disable link previews. True or null - Nopreview bool `json:"nopreview,omitempty"` + // External/internals links + Links MessageLinks `json:"links,omitempty" tdproto:"readonly"` - // Has link previews. True or null - HasPreviews bool `json:"has_previews,omitempty" tdproto:"readonly"` + // Forwarded messages. Also contains double of ReplyTo for backward compatibility + LinkedMessages []Message `json:"linked_messages,omitempty"` - // Previous message id in this chat. Uid or null - Prev string `json:"prev,omitempty" tdproto:"readonly"` + // Markup entities. Experimental + Markup []MarkupEntity `json:"markup,omitempty" tdproto:"readonly"` - // This message is first in this chat. True or null - IsFirst bool `json:"is_first,omitempty" tdproto:"readonly"` + // Message content struct + Content MessageContent `json:"content"` - // This message is last in this chat. True or null - IsLast bool `json:"is_last,omitempty" tdproto:"readonly"` + // Object version + Gentime int64 `json:"gentime" tdproto:"readonly"` - // Message uploads - Uploads []Upload `json:"uploads,omitempty"` + // Unused yet + NumReceived int `json:"num_received,omitempty" tdproto:"readonly"` - // Message reactions struct. Can be null - Reactions []MessageReaction `json:"reactions,omitempty" tdproto:"readonly"` + // This message is last in this chat + IsLast bool `json:"is_last,omitempty" tdproto:"readonly"` - // Message that was replied to, if any - ReplyTo *Message `json:"reply_to,omitempty"` + // This message is first in this chat + IsFirst bool `json:"is_first,omitempty" tdproto:"readonly"` - // Forwarded messages. Can be null. Also contains double of ReplyTo for backward compatibility - LinkedMessages []Message `json:"linked_messages,omitempty"` + // Importance flag + Important bool `json:"important,omitempty"` - // Has mention (@). True or null + // Has mention (@) Notice bool `json:"notice,omitempty" tdproto:"readonly"` // Message has no pushes and did not affect any counters Silently bool `json:"silently,omitempty" tdproto:"readonly"` - // Author can change this message until date. Can be null - EditableUntil ISODateTimeString `json:"editable_until,omitempty" tdproto:"readonly"` + // Has link previews + HasPreviews bool `json:"has_previews,omitempty" tdproto:"readonly"` - // Index number of this message. Starts from 0. Null for deleted messages. Changes when any previous message wad deleted. - Num *int `json:"num,omitempty" tdproto:"readonly"` + // Disable link previews + Nopreview bool `json:"nopreview,omitempty"` - // This message is archive. True or null + // This message is archive IsArchive bool `json:"is_archive,omitempty" tdproto:"readonly"` - // Debug information, if any - Debug string `json:"_debug,omitempty" tdproto:"readonly"` + // Message was seen by anybody in chat + Received bool `json:"received,omitempty" tdproto:"readonly"` } // Website title and description @@ -212,26 +212,26 @@ type MessageLinkPreview struct { // Checked message links. In short: "Click here: {link.Pattern}" => "Click here: {link.Text}" type MessageLink struct { + // Optional preview info, for websites + Preview *MessageLinkPreview `json:"preview,omitempty"` + // Text fragment that should be replaced by link Pattern string `json:"pattern"` // Internal or external link Url string `json:"url"` - // Text replacement. + // Text replacement Text string `json:"text"` - // Optional preview info, for websites - Preview *MessageLinkPreview `json:"preview,omitempty"` + // Optional youtube movie id + YoutubeId string `json:"youtube_id,omitempty"` // Optional upload info Uploads []Upload `json:"uploads,omitempty"` // Website previews disabled NoPreview bool `json:"nopreview,omitempty"` - - // Optional youtube movie id - YoutubeId string `json:"youtube_id,omitempty"` } type MessageLinks []MessageLink @@ -241,11 +241,11 @@ type MessageReaction struct { // Emoji Name string `json:"name"` - // Number of reactions - Counter int `json:"counter"` - // Details Details []MessageReactionDetail `json:"details"` + + // Number of reactions + Counter int `json:"counter"` } // Message reaction detail diff --git a/section.go b/section.go index b8cf302..8dee562 100644 --- a/section.go +++ b/section.go @@ -5,18 +5,18 @@ type Section struct { // 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"` + // Sort ordering + SortOrdering uint `json:"sort_ordering"` + + // Object version + Gentime int64 `json:"gentime"` + // Is deleted IsArchive bool `json:"is_archive,omitempty"` } diff --git a/server_call_answer.go b/server_call_answer.go index 19adf03..955160c 100644 --- a/server_call_answer.go +++ b/server_call_answer.go @@ -20,20 +20,20 @@ func (p ServerCallAnswer) GetName() string { return "server.call.answer" } // Params of the server.call.answer event type serverCallAnswerParams struct { + // SDP data + JSEP JSEP `json:"jsep"` + // Chat or contact id Jid JID `json:"jid"` + // Call id + Uid string `json:"uid"` + // List of ICE candidates (when trickle = false) Candidates []serverCallAnswerCandidate `json:"candidates,omitempty"` // Current call participants Onliners []CallOnliner `json:"onliners,omitempty"` - - // SDP data - JSEP JSEP `json:"jsep"` - - // Call id - Uid string `json:"uid"` } // ICE candidate for call answer diff --git a/server_call_buzz.go b/server_call_buzz.go index af7ce67..e8c882e 100644 --- a/server_call_buzz.go +++ b/server_call_buzz.go @@ -29,33 +29,33 @@ func (p ServerCallBuzz) GetName() string { return "server.call.buzz" } // Params of the server.call.buzz event type serverCallBuzzParams struct { - // Chat or contact id - Jid JID `json:"jid"` + // Short chat information + ChatShort ChatShort `json:"chat"` + + // Short team information + TeamShort TeamShort `json:"teaminfo"` // Chat icons Icons IconData `json:"icons"` + // Chat or contact id + Jid JID `json:"jid"` + // 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"` // CallType is a type of call("audio" - audio room, "video" - video room) CallType CallType `json:"call_type"` + + // Short call creator information + ActorShort ContactShort `json:"actor"` + + // Number of seconds for stop buzzing + BuzzTimeout int `json:"buzz_timeout"` } diff --git a/server_call_screenshare.go b/server_call_screenshare.go index dcc35fe..ceb969c 100644 --- a/server_call_screenshare.go +++ b/server_call_screenshare.go @@ -18,12 +18,12 @@ func (p ServerCallScreenShare) GetName() string { return "server.call.screenshar // Params of the server.call.screenshare event type serverCallScreenShareParams struct { - // ScreenShareEnabled enabled or disabled screen share - ScreenShareEnabled bool `json:"screenshare_enabled"` - - // CallJid - Chat or contact id + // Chat or contact id CallJid JID `json:"call_jid"` - // ActorJid - contact id which enable/disable screen sharing + // Contact id which enable/disable screen sharing ActorJid JID `json:"actor_jid"` + + // Enabled or disabled screen share + ScreenShareEnabled bool `json:"screenshare_enabled"` } diff --git a/server_chat_composing.go b/server_chat_composing.go index 545220c..8920b40 100644 --- a/server_chat_composing.go +++ b/server_chat_composing.go @@ -25,12 +25,12 @@ type serverChatComposingParams struct { // Actor id Actor JID `json:"actor"` + // Composing event max lifetime + ValidUntil ISODateTimeString `json:"valid_until,omitempty"` + // 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 2cd540d..35a593e 100644 --- a/server_chat_deleted.go +++ b/server_chat_deleted.go @@ -21,12 +21,12 @@ func (p ServerChatDeleted) GetName() string { return "server.chat.deleted" } // Params of the server.chat.deleted event type serverChatDeletedParams struct { - // List of deleted chats - Chats []DeletedChat `json:"chats"` - // Current team counters TeamUnread *TeamUnread `json:"team_unread"` + // List of deleted chats + Chats []DeletedChat `json:"chats"` + // Total number of unreads Badge uint `json:"badge"` } diff --git a/server_chat_lastread.go b/server_chat_lastread.go index aefb2b2..ba6dcbe 100644 --- a/server_chat_lastread.go +++ b/server_chat_lastread.go @@ -18,12 +18,12 @@ func (p ServerChatLastread) GetName() string { return "server.chat.lastread" } // Params of the server.chat.lastread event type serverChatLastreadParams struct { - // Chat counters - Chats []ChatCounters `json:"chats"` - // Current team counters TeamUnread *TeamUnread `json:"team_unread"` + // Chat counters + Chats []ChatCounters `json:"chats"` + // Total number of unreads Badge uint `json:"badge"` } diff --git a/server_chat_updated.go b/server_chat_updated.go index dce883d..68eb2d7 100644 --- a/server_chat_updated.go +++ b/server_chat_updated.go @@ -22,12 +22,12 @@ func (p ServerChatUpdated) GetName() string { return "server.chat.updated" } // Params of the server.chat.updated event type serverChatUpdatedParams struct { - // Chat counters - Chats []Chat `json:"chats"` - // Current team counters TeamUnread *TeamUnread `json:"team_unread"` + // Chat counters + Chats []Chat `json:"chats"` + // Total number of unreads Badge uint `json:"badge"` } diff --git a/server_message_received.go b/server_message_received.go index febd958..5fa6546 100644 --- a/server_message_received.go +++ b/server_message_received.go @@ -8,14 +8,14 @@ type ReceivedMessage struct { // Message id MessageId string `json:"message_id"` - // Is received - Received bool `json:"received"` + // Debug message, if any + Debug string `json:"_debug,omitempty"` // Number of contacts received this message. Experimental. NumReceived int `json:"num_received,omitempty"` - // Debug message, if any - Debug string `json:"_debug,omitempty"` + // Is received + Received bool `json:"received"` } func NewServerMessageReceived(messages []ReceivedMessage) (r ServerMessageReceived) { diff --git a/server_message_updated.go b/server_message_updated.go index 5a7ee42..11377a3 100644 --- a/server_message_updated.go +++ b/server_message_updated.go @@ -32,18 +32,18 @@ func (p ServerMessageUpdated) GetName() string { return "server.message.updated" // Params of the server.message.updated event type serverMessageUpdatedParams struct { + // Current team counters + TeamUnread *TeamUnread `json:"team_unread"` + + // Total number of unreads, if changed + Badge *uint `json:"badge"` + // 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"` + // true = silently message update, false = new message + Delayed bool `json:"delayed"` } diff --git a/server_online.go b/server_online.go index 7ffcfe9..38729e7 100644 --- a/server_online.go +++ b/server_online.go @@ -50,9 +50,9 @@ type OnlineCall struct { // Call start Start ISODateTimeString `json:"start,omitempty"` - // Number participants in call - OnlineCount int `json:"online_count,omitempty"` - // CallType is a type of call("audio" - audio room, "video" - video room) CallType CallType `json:"call_type"` + + // Number participants in call + OnlineCount int `json:"online_count,omitempty"` } diff --git a/server_uisettings.go b/server_uisettings.go index 3b6e72b..b4dee66 100644 --- a/server_uisettings.go +++ b/server_uisettings.go @@ -11,16 +11,16 @@ func NewServerUiSettings(namespace string, data UiSettingsData) (r ServerUiSetti // Part of UI settings changed type ServerUiSettings struct { - BaseEvent Params ServerUiSettingsParams `json:"params"` + BaseEvent } type ServerUiSettingsParams struct { - // Namespace. For example: web, app - Namespace string `json:"namespace"` - // UiSettingsData Data UiSettingsData `json:"data"` + + // Namespace. For example: web, app + Namespace string `json:"namespace"` } func (p ServerUiSettings) GetName() string { return "server.uisettings" } diff --git a/server_warning.go b/server_warning.go index 08fd949..59fe731 100644 --- a/server_warning.go +++ b/server_warning.go @@ -9,17 +9,17 @@ func NewServerWarning(message, orig string) (r ServerWarning) { // Something went wrong with client message type ServerWarning struct { - BaseEvent Params serverWarningParams `json:"params"` + BaseEvent } func (p ServerWarning) GetName() string { return "server.warning" } // Params of the server.warning event type serverWarningParams struct { - // Message - Message string `json:"message"` - // Debug information Orig interface{} `json:"orig"` + + // Message + Message string `json:"message"` } diff --git a/session.go b/session.go index 3a6940a..7550496 100644 --- a/session.go +++ b/session.go @@ -14,15 +14,15 @@ type Session struct { // Team id Team string `json:"team,omitempty"` - // Mobile - IsMobile bool `json:"is_mobile,omitempty"` - - // Away from keyboard - Afk bool `json:"afk,omitempty"` - // User agent Useragent string `json:"useragent,omitempty"` // IP address Addr string `json:"addr,omitempty"` + + // Mobile + IsMobile bool `json:"is_mobile,omitempty"` + + // Away from keyboard + Afk bool `json:"afk,omitempty"` } diff --git a/short_message.go b/short_message.go index 6f90d52..6f446b0 100644 --- a/short_message.go +++ b/short_message.go @@ -14,24 +14,24 @@ type ShortMessage struct { // Message creation datetime (set by server side) or sending datetime in future for draft messages Created ISODateTimeString `json:"created" tdproto:"readonly"` - // Object version - Gentime int64 `json:"gentime" tdproto:"readonly"` - // Chat type ChatType ChatType `json:"chat_type" tdproto:"readonly"` // Chat id Chat JID `json:"chat" tdproto:"readonly"` - // This message is archive. True or null + // Object version + Gentime int64 `json:"gentime" tdproto:"readonly"` + + // This message is archive IsArchive bool `json:"is_archive,omitempty" tdproto:"readonly"` } // Upload + ShortMessage type UploadShortMessage struct { - // Upload information - Upload Upload `json:"upload"` - // Short message information Message ShortMessage `json:"message"` + + // Upload information + Upload Upload `json:"upload"` } diff --git a/stats.go b/stats.go index 03ba026..fcf4d13 100644 --- a/stats.go +++ b/stats.go @@ -7,14 +7,14 @@ type SimpleDailyIntStats map[time.Time]int // Active daily users statistics type ActiveUserDailyStat struct { Day time.Time `json:"day"` - UserId int `json:"user_id"` + CallsCount *int `json:"calls_count,omitempty"` FamilyName *string `json:"family_name,omitempty"` GivenName *string `json:"given_name,omitempty"` Patronymic *string `json:"patronymic,omitempty"` Phone *string `json:"phone,omitempty"` MessagesCount *int `json:"messages_count,omitempty"` - CallsCount *int `json:"calls_count,omitempty"` CallSecondsTotal *int `json:"call_seconds_total,omitempty"` + UserId int `json:"user_id"` } type ActiveUserDailyStatList []ActiveUserDailyStat diff --git a/task_preview.go b/task_preview.go index 7ad4cae..6495011 100644 --- a/task_preview.go +++ b/task_preview.go @@ -6,14 +6,14 @@ import ( // Task Preview type TaskPreview struct { + Deadline *time.Time `json:"deadline"` Error string `json:"_error,omitempty"` Assignee JID `json:"assignee"` - Deadline *time.Time `json:"deadline"` Description string `json:"description"` Section string `json:"section"` - Public bool `json:"public"` Tags []string `json:"tags"` Items []TaskItems `json:"items"` + Public bool `json:"public"` } // Task item diff --git a/task_status.go b/task_status.go index 4256e05..4baff2e 100644 --- a/task_status.go +++ b/task_status.go @@ -5,15 +5,15 @@ type TaskStatus struct { // Status id Uid string `json:"uid,omitempty"` - // Status sort ordering - SortOrdering uint `json:"sort_ordering"` - // Status internal name Name string `json:"name"` // Status localized name Title string `json:"title"` + // Status sort ordering + SortOrdering uint `json:"sort_ordering"` + // Status not used anymore IsArchive bool `json:"is_archive,omitempty"` } diff --git a/task_tabs.go b/task_tabs.go index 54d585c..f580729 100644 --- a/task_tabs.go +++ b/task_tabs.go @@ -48,15 +48,6 @@ type TaskTab struct { // Tab title Title string `json:"title"` - // Disable this tab when it has no contents - HideEmpty bool `json:"hide_empty"` - - // Show unread badge - ShowCounter bool `json:"show_counter"` - - // Enable pagination - Pagination bool `json:"pagination"` - // Filters inside tab Filters []TaskFilter `json:"filters"` @@ -65,4 +56,13 @@ type TaskTab struct { // Unread tasks with jid and counters UnreadTasks []TaskCounters `json:"unread_tasks"` + + // Disable this tab when it has no contents + HideEmpty bool `json:"hide_empty"` + + // Show unread badge + ShowCounter bool `json:"show_counter"` + + // Enable pagination + Pagination bool `json:"pagination"` } diff --git a/tdapi/atlinks.go b/tdapi/atlinks.go index 731dd70..36aae20 100644 --- a/tdapi/atlinks.go +++ b/tdapi/atlinks.go @@ -13,6 +13,12 @@ type AtLinks []AtLink // @-link autocomplete information type AtLink struct { + // Icon data, if any + Icons *tdproto.IconData `json:"icons,omitempty"` + + // Internal details, if any + Meta *AtLinkMeta `json:"meta,omitempty"` + // What should be inserted to the chat Key string `json:"key"` @@ -21,12 +27,6 @@ type AtLink struct { // Hint for user, if any Help string `json:"help,omitempty"` - - // Icon data, if any - Icons *tdproto.IconData `json:"icons,omitempty"` - - // Internal details, if any - Meta *AtLinkMeta `json:"meta,omitempty"` } // @-link autocomplete details diff --git a/tdapi/auth.go b/tdapi/auth.go index dfe59f0..894d127 100644 --- a/tdapi/auth.go +++ b/tdapi/auth.go @@ -12,30 +12,30 @@ const ( type Auth struct { Token string `json:"token,omitempty"` + Method2fa string `json:"method2fa"` Me tdproto.UserWithMe `json:"me"` Required2fa bool `json:"required2fa"` Recovery2fa bool `json:"recovery2fa"` - Method2fa string `json:"method2fa"` } type Auth2faSettingsResponse struct { - Enabled bool `json:"enabled"` RecoveryStatus string `json:"recovery_status"` + Enabled bool `json:"enabled"` } type Auth2faMailRecovery struct { CodeValidUntil tdproto.ISODateTimeString `json:"code_valid_until"` NextCodeAt tdproto.ISODateTimeString `json:"next_code_at"` - CodeLength int `json:"code_length"` Email string `json:"email"` + CodeLength int `json:"code_length"` } type Auth2faSettingsMailValidation struct { - Enabled bool `json:"enabled"` RecoveryStatus string `json:"recovery_status"` CodeValidUntil tdproto.ISODateTimeString `json:"code_valid_until"` NextCodeAt string `json:"next_code_at"` CodeLength int `json:"code_length"` + Enabled bool `json:"enabled"` } type basicPasswordUpdate struct { diff --git a/tdapi/chats.go b/tdapi/chats.go index afb6c92..0fa9ac0 100644 --- a/tdapi/chats.go +++ b/tdapi/chats.go @@ -2,7 +2,9 @@ package tdapi type ChatFilter struct { UserParams - Paginator + + // ?chat_type=task,group,direct|any (default: any) + ChatType string `schema:"chat_type"` // ?unread_first=true|false (default: false) UnreadFirst string `schema:"unread_first"` @@ -19,8 +21,8 @@ type ChatFilter struct { // ?has_activity=true|false|any (default: any) HasActivity string `schema:"has_activity"` - // ?chat_type=task,group,direct|any (default: any) - ChatType string `schema:"chat_type"` + // deprecated + HiddenOnly string `schema:"hidden_only"` // ?mix_contacts=true|false (default: false) MixContacts string `schema:"mix_contacts"` @@ -31,12 +33,11 @@ type ChatFilter struct { // ?q=search-text Q string `schema:"q"` - // gentime great than - GentimeGT int64 `schema:"gentime_gt"` - - // deprecated - HiddenOnly string `schema:"hidden_only"` - // deprecated: use ?has_activity= HasMessages string `schema:"has_messages"` + + Paginator + + // gentime great than + GentimeGT int64 `schema:"gentime_gt"` } diff --git a/tdapi/color_rule.go b/tdapi/color_rule.go index 39b2406..ec13ac8 100644 --- a/tdapi/color_rule.go +++ b/tdapi/color_rule.go @@ -8,33 +8,33 @@ type ColorRule struct { // Color index ColorIndex *uint16 `json:"color_index,omitempty"` - // Rule description - Description string `json:"description"` - // Task status TaskStatus *string `json:"task_status,omitempty"` - // Project filter enabled - ProjectEnabled bool `json:"section_enabled,omitempty"` // TODO: rename to "project_enabled" - // Project id if project filter enabled Project *string `json:"section,omitempty"` // TODO: rename to "project" - // Task importance filter enabled - TaskImportanceEnabled bool `json:"task_importance_enabled,omitempty"` - // Task importance if task importance filter enabled TaskImportance *int `json:"task_importance,omitempty"` - // Task urgency filter enabled - TaskUrgencyEnabled bool `json:"task_urgency_enabled,omitempty"` - // Task urgency if task urgency filter enabled TaskUrgency *int `json:"task_urgency,omitempty"` - // Tags filter enabled - TagsEnabled bool `json:"tags_enabled,omitempty"` - // Tag ids if tags filter enabled Tags *[]string `json:"tags,omitempty"` + + // Rule description + Description string `json:"description"` + + // Project filter enabled + ProjectEnabled bool `json:"section_enabled,omitempty"` // TODO: rename to "project_enabled" + + // Task importance filter enabled + TaskImportanceEnabled bool `json:"task_importance_enabled,omitempty"` + + // Task urgency filter enabled + TaskUrgencyEnabled bool `json:"task_urgency_enabled,omitempty"` + + // Tags filter enabled + TagsEnabled bool `json:"tags_enabled,omitempty"` } diff --git a/tdapi/contact.go b/tdapi/contact.go index d13d22a..e822bb9 100644 --- a/tdapi/contact.go +++ b/tdapi/contact.go @@ -36,26 +36,26 @@ type Contact struct { // Mood in team Mood string `json:"mood"` - // Enable debug messages in UI - DebugShowActivity bool `json:"debug_show_activity"` + // Quiet time finish + QuietTimeFinish string `json:"quiet_time_finish"` // Status in team Status tdproto.TeamStatus `json:"status"` - // ContactSection uids, if any - Sections []string `json:"sections"` + // Timezone, if any + Timezone string `json:"timezone"` - // Use Ctrl/Cmd + Enter instead Enter - AltSend bool `json:"alt_send"` + // Start silently time (no pushes, no sounds) + QuietTimeStart string `json:"quiet_time_start"` // Focus mode enabled until FocusUntil tdproto.ISODateTimeString `json:"focus_until"` - // Use * as @ for mentions - AsteriskMention bool `json:"asterisk_mention"` + // Default language code + DefaultLang string `json:"default_lang"` - // Send push notifications even contact is online - AlwaysSendPushes bool `json:"always_send_pushes"` + // ContactSection uids, if any + Sections []string `json:"sections"` // Hide pushes body HidePushesContent bool `json:"hide_pushes_content"` @@ -66,17 +66,17 @@ type Contact struct { // Show unread chats first (mobile app) MunreadFirst bool `json:"munread_first"` - // Default language code - DefaultLang string `json:"default_lang"` + // Send push notifications even contact is online + AlwaysSendPushes bool `json:"always_send_pushes"` - // Timezone, if any - Timezone string `json:"timezone"` + // Use * as @ for mentions + AsteriskMention bool `json:"asterisk_mention"` - // Start silently time (no pushes, no sounds) - QuietTimeStart string `json:"quiet_time_start"` + // Use Ctrl/Cmd + Enter instead Enter + AltSend bool `json:"alt_send"` - // Quiet time finish - QuietTimeFinish string `json:"quiet_time_finish"` + // Enable debug messages in UI + DebugShowActivity bool `json:"debug_show_activity"` // Push notifications for group chats GroupNotificationsEnabled bool `json:"group_notifications_enabled"` diff --git a/tdapi/draft.go b/tdapi/draft.go index dbc78e0..f899b54 100644 --- a/tdapi/draft.go +++ b/tdapi/draft.go @@ -7,12 +7,12 @@ type Draft struct { // Draft content Draft string `json:"draft"` - // Draft version - DraftGentime int64 `json:"draft_gentime,omitempty" tdproto:"readonly"` - // TdMarkup found in content (links included) Markup []tdproto.MarkupEntity `json:"markup,omitempty" tdproto:"readonly"` // Deprecated: use Markup instead Links tdproto.MessageLinks `json:"links,omitempty" tdproto:"readonly"` + + // Draft version + DraftGentime int64 `json:"draft_gentime,omitempty" tdproto:"readonly"` } diff --git a/tdapi/group.go b/tdapi/group.go index 1a12404..a863d1f 100644 --- a/tdapi/group.go +++ b/tdapi/group.go @@ -10,23 +10,17 @@ type GroupMembers struct { // Group form type Group struct { + // Delete messages in this chat in seconds. Experimental function + AutocleanupAge *int `json:"autocleanup_age"` + // Group title DisplayName string `json:"display_name"` // Group description, optional Description string `json:"description"` - // Readonly for non-admins group chat (Like Channels in Telegram bug switchable) - ReadonlyForMembers bool `json:"readonly_for_members"` - - // Is task or group public for non-guests - Public bool `json:"public"` - - // Any new team member will be added to this group chat - DefaultForAll bool `json:"default_for_all"` - - // Delete messages in this chat in seconds. Experimental function - AutocleanupAge *int `json:"autocleanup_age"` + // Deprecated + Section string `json:"section"` // Pinned message for this group PinnedMessage string `json:"pinned_message"` @@ -34,6 +28,12 @@ type Group struct { // Group members list Members []tdproto.GroupMembership `json:"members"` - // Deprecated - Section string `json:"section"` + // Is task or group public for non-guests + Public bool `json:"public"` + + // Any new team member will be added to this group chat + DefaultForAll bool `json:"default_for_all"` + + // Readonly for non-admins group chat (Like Channels in Telegram bug switchable) + ReadonlyForMembers bool `json:"readonly_for_members"` } diff --git a/tdapi/hotmessages.go b/tdapi/hotmessages.go index 82eeebe..98ebaee 100644 --- a/tdapi/hotmessages.go +++ b/tdapi/hotmessages.go @@ -4,12 +4,12 @@ import "github.com/tada-team/tdproto" // All-in-one response with all messages info for fast chat rendering type Hotmessages struct { - // chat information - Chat tdproto.Chat `json:"chat"` - // Messages list Messages []tdproto.Message `json:"messages"` // Contacts list Contacts []tdproto.Contact `json:"contacts"` + + // chat information + Chat tdproto.Chat `json:"chat"` } diff --git a/tdapi/integration.go b/tdapi/integration.go index a7ff85d..31c6570 100644 --- a/tdapi/integration.go +++ b/tdapi/integration.go @@ -3,8 +3,8 @@ package tdapi import "github.com/tada-team/tdproto" type Integration struct { - // Enabled - Enabled bool `json:"enabled"` + // Integration form + IntegrationForm *tdproto.IntegrationForm `json:"form"` // Optional commend Comment string `json:"comment"` @@ -18,6 +18,6 @@ type Integration struct { // WebhookUrl, if any WebhookUrl string `json:"webhook_url"` - // Integration form - IntegrationForm *tdproto.IntegrationForm `json:"form"` + // Enabled + Enabled bool `json:"enabled"` } diff --git a/tdapi/message.go b/tdapi/message.go index b1a1edf..fed6007 100644 --- a/tdapi/message.go +++ b/tdapi/message.go @@ -4,7 +4,7 @@ import "github.com/tada-team/tdproto" type MessageFilter struct { UserParams - Paginator + DateTo string `schema:"date_to"` // ?chat=jid,jid Chat string `schema:"chat"` @@ -30,8 +30,8 @@ type MessageFilter struct { // ?date_from=dt (include) DateFrom string `schema:"date_from"` - // ?date_to=dt - DateTo string `schema:"date_to"` + // ?new_from_inc=msgId (include msgId) + NewFromInc string `schema:"new_from_inc"` // ?include_deleted=true|false (default: false) IncludeDeleted string `schema:"include_deleted"` @@ -54,25 +54,26 @@ type MessageFilter struct { // ?old_from_inc=msgId (include msgId) OldFromInc string `schema:"old_from_inc"` - // ?new_from_inc=msgId (include msgId) - NewFromInc string `schema:"new_from_inc"` - // ?around=msgId (include msgId) Around string `schema:"around"` + + Paginator } type MessageUpdate struct { + // Draft message, send later + SendAt string `json:"send_at,omitempty"` + // Important flag. Not required. Default: false Important bool `json:"important,omitempty"` // Disable links preview generation. Not required. Default: false Nopreview bool `json:"nopreview,omitempty"` - - // Draft message, send later - SendAt string `json:"send_at,omitempty"` } type Message struct { + MessageUpdate + // Message type Type tdproto.Mediatype `json:"type"` @@ -87,8 +88,6 @@ type Message struct { // Backward compatibility mode OldStyleAttachment bool `json:"old_style_attachment,omitempty"` - - MessageUpdate } // Message markup with checked links diff --git a/tdapi/resp.go b/tdapi/resp.go index 67bede6..ad49f32 100644 --- a/tdapi/resp.go +++ b/tdapi/resp.go @@ -4,24 +4,24 @@ import "github.com/tada-team/tdproto" // Server response type Resp struct { - // Server side work time - DebugTime string `json:"_time,omitempty"` - - // Request status - Ok bool `json:"ok"` - // Result only if ok is true) Result interface{} `json:"result,omitempty"` - // Error (only if ok is false) - Error Err `json:"error,omitempty"` - // Error (only if ok is false and Error is 'InvalidData') Details map[string]string `json:"details,omitempty"` + // Server side work time + DebugTime string `json:"_time,omitempty"` + + // Error (only if ok is false) + Error Err `json:"error,omitempty"` + // Reason (only if ok is false and Error is `AccessDenied`) Reason string `json:"reason,omitempty"` // Reason markup (only if ok is false and Error is `AccessDenied`) Markup []tdproto.MarkupEntity `json:"markup,omitempty"` + + // Request status + Ok bool `json:"ok"` } diff --git a/tdapi/sharplinks.go b/tdapi/sharplinks.go index 18c43fc..869f420 100644 --- a/tdapi/sharplinks.go +++ b/tdapi/sharplinks.go @@ -34,15 +34,15 @@ type SharpLinkMeta struct { // Chat type ChatType tdproto.ChatType `json:"chat_type"` - // Is task or group public for non-guests - Public bool `json:"public,omitempty"` - // Task status (for tasks) TaskStatus string `json:"task_status,omitempty"` // Task number (for tasks) Num uint `json:"num,omitempty"` + // Is task or group public for non-guests + Public bool `json:"public,omitempty"` + // Deprecated: use `TaskStatus == "done"` comparsion Done bool `json:"done,omitempty"` } diff --git a/tdapi/task.go b/tdapi/task.go index 5f1e75c..5402d83 100644 --- a/tdapi/task.go +++ b/tdapi/task.go @@ -4,62 +4,63 @@ import "github.com/tada-team/tdproto" // Task type Task struct { + // Task importance + Importance *int `json:"importance,omitempty"` + + // Time spent + SpentTime *int `json:"spent_time,omitempty"` + + // Task complexity + Complexity *int `json:"complexity,omitempty"` + + // Task urgency + Urgency *int `json:"urgency,omitempty"` + // Custom task color CustomColorIndex *uint16 `json:"custom_color_index,omitempty"` // Task description Description string `json:"description,omitempty"` - // Task tags - Tags []string `json:"tags,omitempty"` - // Task section UID SectionUid string `json:"section,omitempty"` - // User who follow the task - Observers []tdproto.JID `json:"observers,omitempty"` // TODO: rename to "followers" - - // Items of the task - Items []string `json:"items,omitempty"` - // User who was assigned the task Assignee tdproto.JID `json:"assignee,omitempty"` // Deadline time, if any Deadline tdproto.ISODateTimeString `json:"deadline,omitempty"` - // Is task or group public for non-guests - Public bool `json:"public,omitempty"` - // Fire a reminder at this time RemindAt tdproto.ISODateTimeString `json:"remind_at,omitempty"` // Task status TaskStatus string `json:"task_status,omitempty"` - // Task importance - Importance *int `json:"importance,omitempty"` + // Task uploads + Uploads []string `json:"uploads,omitempty"` - // Task urgency - Urgency *int `json:"urgency,omitempty"` + // Items of the task + Items []string `json:"items,omitempty"` - // Task complexity - Complexity *int `json:"complexity,omitempty"` + // User who follow the task + Observers []tdproto.JID `json:"observers,omitempty"` - // Time spent - SpentTime *int `json:"spent_time,omitempty"` + // Task tags + Tags []string `json:"tags,omitempty"` // Linked messages - LinkedMessages []string `json:"linked_messages,omitempty"` // TODO: Message object + LinkedMessages []string `json:"linked_messages,omitempty"` - // Task uploads - Uploads []string `json:"uploads,omitempty"` + // Is task or group public for non-guests + Public bool `json:"public,omitempty"` } // Query parameters for listing messages type TaskFilter struct { UserParams - Paginator + + Tag string `schema:"tag"` //* ?sort = [ "created" | "-created" | "last_message" | "-last_message" | "deadline" | "-deadline" ] Sort string `schema:"sort"` @@ -86,10 +87,10 @@ type TaskFilter struct { Owner string `schema:"owner"` //* ?section=[ uid,uid... | "-" ] - Section string `schema:"section"` // TODO: rename to ?project= + Section string `schema:"section"` - //* ?tag=[ tag,tag,tag... | "-" ] - Tag string `schema:"tag"` + //* ?short=true|false + Short string `schema:"short"` //* ?q= Q string `schema:"q"` @@ -115,8 +116,7 @@ type TaskFilter struct { //* ?created_lte= CreatedLTE string `schema:"created_lte"` - //* ?short=true|false - Short string `schema:"short"` + Paginator // gentime great than group/chat GentimeGT int64 `schema:"gentime_gt"` @@ -127,4 +127,3 @@ type TaskColors struct { // Color list Colors []tdproto.TaskColor `json:"colors"` } - diff --git a/tdapi/team.go b/tdapi/team.go index 67bfc78..32d5d2d 100644 --- a/tdapi/team.go +++ b/tdapi/team.go @@ -3,17 +3,17 @@ package tdapi import "github.com/tada-team/tdproto" type Team struct { + // Max message update/deletion age, in seconds + MaxMessageUpdateAge interface{} `json:"max_message_update_age"` + // Team name Name string `json:"name"` // Default task deadline DefaultTaskDeadline string `json:"default_task_deadline"` - // Max message update/deletion age, in seconds - MaxMessageUpdateAge interface{} `json:"max_message_update_age"` - - // Patronymic in usernames for this team - UsePatronymic bool `json:"use_patronymic"` + // Contacts (for creation only) + Contacts []Contact `json:"contacts"` // Family name should be first in display name DisplayFamilyNameFirst bool `json:"display_family_name_first"` @@ -21,8 +21,8 @@ type Team struct { // Use importance field in task UseTaskImportance bool `json:"use_task_importance"` - // Reverse importance - TaskImportanceRev bool `json:"task_importance_rev"` + // Patronymic in usernames for this team + UsePatronymic bool `json:"use_patronymic"` // Use urgency field in task UseTaskUrgency bool `json:"use_task_urgency"` @@ -39,8 +39,8 @@ type Team struct { // Team pinned Pinned bool `json:"pinned,omitempty"` - // Contacts (for creation only) - Contacts []Contact `json:"contacts"` + // Reverse importance + TaskImportanceRev bool `json:"task_importance_rev"` } // Invitation information diff --git a/tdapi/upload.go b/tdapi/upload.go index b9df4f1..844957f 100644 --- a/tdapi/upload.go +++ b/tdapi/upload.go @@ -3,8 +3,6 @@ package tdapi import "github.com/tada-team/tdproto" type UploadFilter struct { - Paginator - // ?chat=jid,jid Chat string `schema:"chat"` @@ -19,4 +17,5 @@ type UploadFilter struct { // ?text=substr Text string `schema:"text"` + Paginator } diff --git a/team.go b/team.go index 4683ed9..86077a8 100644 --- a/team.go +++ b/team.go @@ -2,89 +2,87 @@ package tdproto // Team type Team struct { + // Color theme, if any + Theme *Theme `json:"theme,omitempty" tdproto:"readonly"` + + // Unread message counters + Unreads *TeamUnread `json:"unread"` + + // Сurrent team subscription + Subscription Subscription `json:"subscription,omitempty"` + // Team id Uid string `json:"uid" tdproto:"readonly"` - // Team deleted - IsArchive bool `json:"is_archive,omitempty" tdproto:"readonly"` + // Default task deadline + DefaultTaskDeadline string `json:"default_task_deadline,omitempty"` - // Object version - Gentime int64 `json:"gentime" tdproto:"readonly"` + // For single group teams, jid of chat + SingleGroup JID `json:"single_group,omitempty" tdproto:"readonly"` // Team name Name string `json:"name"` - // Default task deadline - DefaultTaskDeadline string `json:"default_task_deadline,omitempty"` - - // Max message update/deletion age, in seconds - MaxMessageUpdateAge int `json:"max_message_update_age"` + // Team's available tariff by includig archive ones + AvailableTariffs []string `json:"available_tariffs,omitempty"` - // Team icons - Icons IconData `json:"icons" tdproto:"readonly"` + // Username fields ordering. Possible values: "family_name", "given_name", "patronymic" + UserFields []string `json:"user_fields" tdproto:"readonly"` - // User last activity was in this team - LastActive bool `json:"last_active" tdproto:"readonly"` + // Team contacts. Used only for team creation + Contacts []Contact `json:"contacts,omitempty" tdproto:"readonly"` // What status I can set to other team members ChangeableStatuses []TeamStatus `json:"changeable_statuses,omitempty" tdproto:"readonly"` - // My profile in this team isn't full - BadProfile bool `json:"bad_profile,omitempty" tdproto:"readonly"` - - // Need confirmation after invite to this team - NeedConfirmation bool `json:"need_confirmation" tdproto:"readonly"` - - // Patronymic in usernames for this team - UsePatronymic bool `json:"use_patronymic,omitempty"` + // Team icons + Icons IconData `json:"icons" tdproto:"readonly"` - // Username fields ordering. Possible values: "family_name", "given_name", "patronymic" - UserFields []string `json:"user_fields" tdproto:"readonly"` + // My profile in this team + Me Contact `json:"me"` - // Family name should be first in display name - DisplayFamilyNameFirst bool `json:"display_family_name_first,omitempty"` + // Total uploads size, bytes + UploadsSize int64 `json:"uploads_size,omitempty" tdproto:"readonly"` - // Use importance field in task - UseTaskImportance bool `json:"use_task_importance,omitempty"` + // Object version + Gentime int64 `json:"gentime" tdproto:"readonly"` - // Minimal value of task importance. Default is 1 - TaskImportanceMin int `json:"task_importance_min,omitempty"` + // Max message update/deletion age, in seconds + MaxMessageUpdateAge int `json:"max_message_update_age"` // Maximum value of task importance. Default is 5 TaskImportanceMax int `json:"task_importance_max,omitempty"` - // Bigger number = bigger importance. Default: lower number = bigger importance - TaskImportanceRev bool `json:"task_importance_rev,omitempty"` - - // Use urgency field in task - UseTaskUrgency bool `json:"use_task_urgency,omitempty"` + // Maximum uploads size, bytes, if any + UploadsSizeLimit int64 `json:"uploads_size_limit,omitempty" tdproto:"readonly"` - // Use complexity field in task - UseTaskComplexity bool `json:"use_task_complexity,omitempty"` + // Minimal value of task importance. Default is 1 + TaskImportanceMin int `json:"task_importance_min,omitempty"` // Use spent time field in task UseTaskSpentTime bool `json:"use_task_spent_time,omitempty"` - // Total uploads size, bytes - UploadsSize int64 `json:"uploads_size,omitempty" tdproto:"readonly"` + // Use complexity field in task + UseTaskComplexity bool `json:"use_task_complexity,omitempty"` - // Maximum uploads size, bytes, if any - UploadsSizeLimit int64 `json:"uploads_size_limit,omitempty" tdproto:"readonly"` + // Use urgency field in task + UseTaskUrgency bool `json:"use_task_urgency,omitempty"` - // Unread message counters - Unreads *TeamUnread `json:"unread"` + // Bigger number = bigger importance. Default: lower number = bigger importance + TaskImportanceRev bool `json:"task_importance_rev,omitempty"` - // My profile in this team - Me Contact `json:"me"` + // User last activity was in this team + LastActive bool `json:"last_active" tdproto:"readonly"` - // Team contacts. Used only for team creation - Contacts []Contact `json:"contacts,omitempty" tdproto:"readonly"` + // Use importance field in task + UseTaskImportance bool `json:"use_task_importance,omitempty"` - // For single group teams, jid of chat - SingleGroup JID `json:"single_group,omitempty" tdproto:"readonly"` + // Family name should be first in display name + DisplayFamilyNameFirst bool `json:"display_family_name_first,omitempty"` + UsePatronymic bool `json:"use_patronymic,omitempty"` - // Color theme, if any - Theme *Theme `json:"theme,omitempty" tdproto:"readonly"` + // Team deleted + IsArchive bool `json:"is_archive,omitempty" tdproto:"readonly"` // Don't show archived users by default HideArchivedUsers bool `json:"hide_archived_users,omitempty"` @@ -92,11 +90,11 @@ type Team struct { // Team pinned Pinned bool `json:"pinned,omitempty"` - // Team's available tariff by includig archive ones - AvailableTariffs []string `json:"available_tariffs,omitempty"` + // Need confirmation after invite to this team + NeedConfirmation bool `json:"need_confirmation" tdproto:"readonly"` - // Сurrent team subscription - Subscription Subscription `json:"subscription,omitempty"` + // My profile in this team isn't full + BadProfile bool `json:"bad_profile,omitempty" tdproto:"readonly"` } // Short team representation. For invites, push notifications, etc. Readonly. diff --git a/upload.go b/upload.go index a48d2aa..28aaaaa 100644 --- a/upload.go +++ b/upload.go @@ -2,17 +2,17 @@ package tdproto // Uploaded media type Upload struct { - // Upload id - Uid string `json:"uid"` + // Preview details + Preview *UploadPreview `json:"preview,omitempty"` + + // PDF version of file. Experimental + PdfVersion *PdfVersion `json:"pdf_version,omitempty"` // Uploaded at Created ISODateTimeString `json:"created"` - // Upload size in bytes - Size int `json:"size"` - - // Mediafile duration (for audio/video only) - Duration uint `json:"duration,omitempty"` + // Compact representation of a placeholder for an image (images only) + Blurhash string `json:"blurhash,omitempty"` // Filename Name string `json:"name"` @@ -20,26 +20,26 @@ type Upload struct { // Absolute url Url string `json:"url"` - // Preview details - Preview *UploadPreview `json:"preview,omitempty"` - // Content type ContentType string `json:"content_type"` + // Upload id + Uid string `json:"uid"` + + // ?type=file,image,audio,video + MediaType UploadMediaType `json:"type"` + + // Mediafile duration (for audio/video only) + Duration uint `json:"duration,omitempty"` + + // Upload size in bytes + Size int `json:"size"` + // Is animated (images only) Animated bool `json:"animated,omitempty"` - // Compact representation of a placeholder for an image (images only) - Blurhash string `json:"blurhash,omitempty"` - // File still processing (video only) Processing bool `json:"processing,omitempty"` - - // PDF version of file. Experimental - PdfVersion *PdfVersion `json:"pdf_version,omitempty"` - - // ?type=file,image,audio,video - MediaType UploadMediaType `json:"type"` } // Upload preview diff --git a/user.go b/user.go index 999b294..674c90e 100644 --- a/user.go +++ b/user.go @@ -2,14 +2,14 @@ package tdproto // Account data type User struct { - // Phone for login - Phone string `json:"phone,omitempty"` + // Finish silently time (no pushes, no sounds) + QuietTimeFinish *string `json:"quiet_time_finish"` - // Email for login - Email string `json:"email,omitempty"` + // Start silently time (no pushes, no sounds) + QuietTimeStart *string `json:"quiet_time_start"` - // Family name - FamilyName string `json:"family_name,omitempty"` + // Phone for login + Phone string `json:"phone,omitempty"` // Given name GivenName string `json:"given_name,omitempty"` @@ -20,17 +20,17 @@ type User struct { // Default language code DefaultLang string `json:"default_lang,omitempty"` - // Use Ctrl/Cmd + Enter instead Enter - AltSend bool `json:"alt_send"` + // Timezone + Timezone string `json:"timezone"` - // Use * as @ for mentions - AsteriskMention bool `json:"asterisk_mention"` + // Email for login + Email string `json:"email,omitempty"` - // Send pushes even user is online - AlwaysSendPushes bool `json:"always_send_pushes"` + // Family name + FamilyName string `json:"family_name,omitempty"` - // Hide pushes body - HidePushesContent bool `json:"hide_pushes_content"` + // Icon data + Icons IconData `json:"icons"` // Show unread chats in chat list first UnreadFirst bool `json:"unread_first"` @@ -38,17 +38,17 @@ type User struct { // Show unread chats in chat list first on mobiles MUnreadFirst bool `json:"munread_first"` - // Timezone - Timezone string `json:"timezone"` + // Hide pushes body + HidePushesContent bool `json:"hide_pushes_content"` - // Start silently time (no pushes, no sounds) - QuietTimeStart *string `json:"quiet_time_start"` + // Use * as @ for mentions + AsteriskMention bool `json:"asterisk_mention"` - // Finish silently time (no pushes, no sounds) - QuietTimeFinish *string `json:"quiet_time_finish"` + // Use Ctrl/Cmd + Enter instead Enter + AltSend bool `json:"alt_send"` - // Icon data - Icons IconData `json:"icons"` + // Send pushes even user is online + AlwaysSendPushes bool `json:"always_send_pushes"` } // Account data with extra information diff --git a/user_auth.go b/user_auth.go index a076870..2eab7c4 100644 --- a/user_auth.go +++ b/user_auth.go @@ -13,18 +13,24 @@ const ( type UserAuth struct { Created time.Time `json:"created"` LastAccess time.Time `json:"last_access,omitempty"` - DebugAge int `json:"_age,omitempty"` - Uid string `json:"uid"` + + // info about device (struct) + Device *PushDevice `json:"device,omitempty"` + + // name of region + Region string `json:"region,omitempty"` + //type of auth Kind string `json:"kind"` + // ip address Addr string `json:"addr,omitempty"` + // info about useragent Useragent string `json:"user_agent,omitempty"` + // name of country - Country string `json:"country,omitempty"` - // name of region - Region string `json:"region,omitempty"` - // info about device (struct) - Device *PushDevice `json:"device,omitempty"` + Country string `json:"country,omitempty"` + Uid string `json:"uid"` + DebugAge int `json:"_age,omitempty"` }