From de7c229ecb34b981b4922a76895f5a6e8e67eb71 Mon Sep 17 00:00:00 2001 From: GitHub Date: Wed, 7 Dec 2022 07:45:07 +0000 Subject: [PATCH] feat(schema): update Telegram to the latest layer --- _schema/tdesktop.tl | 46 +++- _schema/tdlib.tl | 54 ++++- _schema/telegram.tl | 46 +++- tg/tl_auth_code_type_gen.go | 109 +++++++++ ...auth_import_web_token_authorization_gen.go | 227 ++++++++++++++++++ ...port_web_token_authorization_slices_gen.go | 35 +++ tg/tl_auth_sent_code_type_gen.go | 169 +++++++++++++ tg/tl_auth_sent_code_type_slices_gen.go | 95 ++++++++ tg/tl_channel_admin_log_event_action_gen.go | 144 +++++++++++ ...annel_admin_log_event_action_slices_gen.go | 95 ++++++++ tg/tl_channels_create_channel_gen.go | 80 ++++-- tg/tl_channels_edit_forum_topic_gen.go | 82 +++++-- ...els_report_anti_spam_false_positive_gen.go | 211 ++++++++++++++++ ...ort_anti_spam_false_positive_slices_gen.go | 35 +++ tg/tl_channels_toggle_anti_spam_gen.go | 210 ++++++++++++++++ tg/tl_channels_toggle_anti_spam_slices_gen.go | 35 +++ tg/tl_chat_full_gen.go | 35 +++ tg/tl_contacts_export_contact_token_gen.go | 141 +++++++++++ ...ontacts_export_contact_token_slices_gen.go | 35 +++ tg/tl_contacts_import_contact_token_gen.go | 176 ++++++++++++++ ...ontacts_import_contact_token_slices_gen.go | 35 +++ tg/tl_default_history_ttl_gen.go | 161 +++++++++++++ tg/tl_default_history_ttl_slices_gen.go | 35 +++ tg/tl_dialog_gen.go | 102 +++++--- tg/tl_exported_contact_token_gen.go | 188 +++++++++++++++ tg/tl_exported_contact_token_slices_gen.go | 35 +++ tg/tl_forum_topic_gen.go | 35 +++ tg/tl_message_action_gen.go | 162 +++++++++++-- tg/tl_messages_create_chat_gen.go | 92 ++++++- tg/tl_messages_get_default_history_ttl_gen.go | 141 +++++++++++ ...ages_get_default_history_ttl_slices_gen.go | 35 +++ tg/tl_messages_set_default_history_ttl_gen.go | 177 ++++++++++++++ ...ages_set_default_history_ttl_slices_gen.go | 35 +++ tg/tl_registry_gen.go | 53 +++- tg/tl_server_gen.go | 127 ++++++++++ 35 files changed, 3334 insertions(+), 139 deletions(-) create mode 100644 tg/tl_auth_import_web_token_authorization_gen.go create mode 100644 tg/tl_auth_import_web_token_authorization_slices_gen.go create mode 100644 tg/tl_channels_report_anti_spam_false_positive_gen.go create mode 100644 tg/tl_channels_report_anti_spam_false_positive_slices_gen.go create mode 100644 tg/tl_channels_toggle_anti_spam_gen.go create mode 100644 tg/tl_channels_toggle_anti_spam_slices_gen.go create mode 100644 tg/tl_contacts_export_contact_token_gen.go create mode 100644 tg/tl_contacts_export_contact_token_slices_gen.go create mode 100644 tg/tl_contacts_import_contact_token_gen.go create mode 100644 tg/tl_contacts_import_contact_token_slices_gen.go create mode 100644 tg/tl_default_history_ttl_gen.go create mode 100644 tg/tl_default_history_ttl_slices_gen.go create mode 100644 tg/tl_exported_contact_token_gen.go create mode 100644 tg/tl_exported_contact_token_slices_gen.go create mode 100644 tg/tl_messages_get_default_history_ttl_gen.go create mode 100644 tg/tl_messages_get_default_history_ttl_slices_gen.go create mode 100644 tg/tl_messages_set_default_history_ttl_gen.go create mode 100644 tg/tl_messages_set_default_history_ttl_slices_gen.go diff --git a/_schema/tdesktop.tl b/_schema/tdesktop.tl index 3939fa0e26..42749af056 100644 --- a/_schema/tdesktop.tl +++ b/_schema/tdesktop.tl @@ -1,8 +1,8 @@ // Code generated by ./cmd/dltl, DO NOT EDIT. // // Source: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/Resources/tl/api.tl -// Layer: 149 -// SHA256: ad5229b179d1350bca43eee099a5c538613f9d4148b7933cd87a4fca02e2cc8f +// Layer: 150 +// SHA256: 16379ae5b0f59f8a9aa17d9f8289db7a61869ad5acddf74cd07fcac7e5f91d5e boolFalse#bc799737 = Bool; @@ -164,7 +164,7 @@ channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true chatFull#c9d31138 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector available_reactions:flags.18?ChatReactions = ChatFull; -channelFull#f2355507 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions = ChatFull; +channelFull#f2355507 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions = ChatFull; chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant; @@ -264,7 +264,7 @@ messageActionGroupCall#7a0d7f42 flags:# call:InputGroupCall duration:flags.0?int messageActionInviteToGroupCall#502f92f7 call:InputGroupCall users:Vector = MessageAction; -messageActionSetMessagesTTL#aa1afbfd period:int = MessageAction; +messageActionSetMessagesTTL#3c134d7b flags:# period:int auto_setting_from:flags.0?long = MessageAction; messageActionGroupCallScheduled#b3a07661 call:InputGroupCall schedule_date:int = MessageAction; @@ -280,9 +280,9 @@ messageActionGiftPremium#aba0f5c6 currency:string amount:long months:int = Messa messageActionTopicCreate#d999256 flags:# title:string icon_color:int icon_emoji_id:flags.0?long = MessageAction; -messageActionTopicEdit#b18a431c flags:# title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool = MessageAction; +messageActionTopicEdit#c0944820 flags:# title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = MessageAction; -dialog#a8edd0f5 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int = Dialog; +dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog; dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog; @@ -1142,6 +1142,8 @@ auth.codeTypeFlashCall#226ccefb = auth.CodeType; auth.codeTypeMissedCall#d61ad6ee = auth.CodeType; +auth.codeTypeFragmentSms#6ed998c = auth.CodeType; + auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; @@ -1156,6 +1158,8 @@ auth.sentCodeTypeEmailCode#5a159841 flags:# apple_signin_allowed:flags.0?true go auth.sentCodeTypeSetUpEmailRequired#a5491dea flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true = auth.SentCodeType; +auth.sentCodeTypeFragmentSms#d9565c39 url:string length:int = auth.SentCodeType; + messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; @@ -1510,6 +1514,8 @@ channelAdminLogEventActionDeleteTopic#ae168909 topic:ForumTopic = ChannelAdminLo channelAdminLogEventActionPinTopic#5d8d353b flags:# prev_topic:flags.0?ForumTopic new_topic:flags.1?ForumTopic = ChannelAdminLogEventAction; +channelAdminLogEventActionToggleAntiSpam#64f36dfc new_value:Bool = ChannelAdminLogEventAction; + channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; @@ -2130,10 +2136,14 @@ username#b4073647 flags:# editable:flags.0?true active:flags.1?true username:str forumTopicDeleted#23f109b id:int = ForumTopic; -forumTopic#71701da9 flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true short:flags.5?true id:int date:int title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic; +forumTopic#71701da9 flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true short:flags.5?true hidden:flags.6?true id:int date:int title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic; messages.forumTopics#367617d3 flags:# order_by_create_date:flags.0?true count:int topics:Vector messages:Vector chats:Vector users:Vector pts:int = messages.ForumTopics; +defaultHistoryTTL#43b46b20 period:int = DefaultHistoryTTL; + +exportedContactToken#41bf109b url:string expires:int = ExportedContactToken; + ---functions--- @@ -2189,6 +2199,8 @@ auth.acceptLoginToken#e894ad4d token:bytes = Authorization; auth.checkRecoveryPassword#d36bf79 code:string = Bool; +auth.importWebTokenAuthorization#2db873a9 api_id:int api_hash:string web_auth_token:string = auth.Authorization; + account.registerDevice#ec86017a flags:# no_muted:flags.0?true token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector = Bool; account.unregisterDevice#6a0d3206 token_type:int token:string other_uids:Vector = Bool; @@ -2401,6 +2413,10 @@ contacts.blockFromReplies#29a8962c flags:# delete_message:flags.0?true delete_hi contacts.resolvePhone#8af94344 phone:string = contacts.ResolvedPeer; +contacts.exportContactToken#f8654027 = ExportedContactToken; + +contacts.importContactToken#13005788 token:string = User; + messages.getMessages#63c66506 id:Vector = messages.Messages; messages.getDialogs#a0f4cb4f flags:# exclude_pinned:flags.0?true folder_id:flags.1?int offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:long = messages.Dialogs; @@ -2443,7 +2459,7 @@ messages.addChatUser#f24753e3 chat_id:long user_id:InputUser fwd_limit:int = Upd messages.deleteChatUser#a2185cab flags:# revoke_history:flags.0?true chat_id:long user_id:InputUser = Updates; -messages.createChat#9cb126e users:Vector title:string = Updates; +messages.createChat#34a818 flags:# users:Vector title:string ttl_period:flags.0?int = Updates; messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; @@ -2755,6 +2771,10 @@ messages.clearRecentReactions#9dfeefb4 = Bool; messages.getExtendedMedia#84f80814 peer:InputPeer id:Vector = Updates; +messages.setDefaultHistoryTTL#9eb51445 period:int = Bool; + +messages.getDefaultHistoryTTL#658b7188 = DefaultHistoryTTL; + updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; @@ -2847,7 +2867,7 @@ channels.getChannels#a7f6bbb id:Vector = messages.Chats; channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; -channels.createChannel#3d5fb10f flags:# broadcast:flags.0?true megagroup:flags.1?true for_import:flags.3?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string = Updates; +channels.createChannel#91006707 flags:# broadcast:flags.0?true megagroup:flags.1?true for_import:flags.3?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string ttl_period:flags.4?int = Updates; channels.editAdmin#d33c8902 channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights rank:string = Updates; @@ -2927,7 +2947,7 @@ channels.getForumTopics#de560d1 flags:# channel:InputChannel q:flags.0?string of channels.getForumTopicsByID#b0831eb9 channel:InputChannel topics:Vector = messages.ForumTopics; -channels.editForumTopic#6c883e2d flags:# channel:InputChannel topic_id:int title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool = Updates; +channels.editForumTopic#f4dfa185 flags:# channel:InputChannel topic_id:int title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = Updates; channels.updatePinnedForumTopic#6c2d9026 channel:InputChannel topic_id:int pinned:Bool = Updates; @@ -2935,6 +2955,10 @@ channels.deleteTopicHistory#34435f2d channel:InputChannel top_msg_id:int = messa channels.reorderPinnedForumTopics#2950a18f flags:# force:flags.0?true channel:InputChannel order:Vector = Updates; +channels.toggleAntiSpam#68f3e4eb channel:InputChannel enabled:Bool = Updates; + +channels.reportAntiSpamFalsePositive#a850a693 channel:InputChannel msg_id:int = Bool; + bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; @@ -3075,4 +3099,4 @@ stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_r stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats; -// LAYER 149 +// LAYER 150 diff --git a/_schema/tdlib.tl b/_schema/tdlib.tl index 546460804d..6f43ff51d2 100644 --- a/_schema/tdlib.tl +++ b/_schema/tdlib.tl @@ -1,8 +1,8 @@ // Code generated by ./cmd/dltl, DO NOT EDIT. // // Source: https://raw.githubusercontent.com/tdlib/td/master/td/generate/scheme/telegram_api.tl -// Layer: 148 -// SHA256: 189651fc43126dcc1d5da94a10f4582a6f01cec9f64adb186be77c2798dfe5f5 +// Layer: 150 +// SHA256: 964d20cbc415b078e9704d833acbe537e4d8e625671aeefdcf9b1dc14276c94f int#a8509bda ? = Int; @@ -196,7 +196,7 @@ channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true chatFull#c9d31138 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector available_reactions:flags.18?ChatReactions = ChatFull; -channelFull#f2355507 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions = ChatFull; +channelFull#f2355507 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions = ChatFull; chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant; @@ -296,7 +296,7 @@ messageActionGroupCall#7a0d7f42 flags:# call:InputGroupCall duration:flags.0?int messageActionInviteToGroupCall#502f92f7 call:InputGroupCall users:Vector = MessageAction; -messageActionSetMessagesTTL#aa1afbfd period:int = MessageAction; +messageActionSetMessagesTTL#3c134d7b flags:# period:int auto_setting_from:flags.0?long = MessageAction; messageActionGroupCallScheduled#b3a07661 call:InputGroupCall schedule_date:int = MessageAction; @@ -312,9 +312,9 @@ messageActionGiftPremium#aba0f5c6 currency:string amount:long months:int = Messa messageActionTopicCreate#d999256 flags:# title:string icon_color:int icon_emoji_id:flags.0?long = MessageAction; -messageActionTopicEdit#b18a431c flags:# title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool = MessageAction; +messageActionTopicEdit#c0944820 flags:# title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = MessageAction; -dialog#a8edd0f5 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int = Dialog; +dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog; dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog; @@ -414,7 +414,7 @@ messages.messages#8c718e87 messages:Vector chats:Vector users:Vec messages.messagesSlice#3a54685e flags:# inexact:flags.1?true count:int next_rate:flags.0?int offset_id_offset:flags.2?int messages:Vector chats:Vector users:Vector = messages.Messages; -messages.channelMessages#64479808 flags:# inexact:flags.1?true pts:int count:int offset_id_offset:flags.2?int messages:Vector chats:Vector users:Vector = messages.Messages; +messages.channelMessages#c776ba4e flags:# inexact:flags.1?true pts:int count:int offset_id_offset:flags.2?int messages:Vector topics:Vector chats:Vector users:Vector = messages.Messages; messages.messagesNotModified#74535f21 count:int = messages.Messages; @@ -674,7 +674,9 @@ updateMoveStickerSetToTop#86fccf85 flags:# masks:flags.0?true emojis:flags.1?tru updateMessageExtendedMedia#5a73a98c peer:Peer msg_id:int extended_media:MessageExtendedMedia = Update; -updateChannelPinnedTopic#f694b0ae flags:# channel_id:long topic_id:flags.0?int = Update; +updateChannelPinnedTopic#192efbe3 flags:# pinned:flags.0?true channel_id:long topic_id:int = Update; + +updateChannelPinnedTopics#fe198602 flags:# channel_id:long order:flags.0?Vector = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; @@ -1172,6 +1174,8 @@ auth.codeTypeFlashCall#226ccefb = auth.CodeType; auth.codeTypeMissedCall#d61ad6ee = auth.CodeType; +auth.codeTypeFragmentSms#6ed998c = auth.CodeType; + auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; @@ -1186,6 +1190,8 @@ auth.sentCodeTypeEmailCode#5a159841 flags:# apple_signin_allowed:flags.0?true go auth.sentCodeTypeSetUpEmailRequired#a5491dea flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true = auth.SentCodeType; +auth.sentCodeTypeFragmentSms#d9565c39 url:string length:int = auth.SentCodeType; + messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; @@ -1540,6 +1546,8 @@ channelAdminLogEventActionDeleteTopic#ae168909 topic:ForumTopic = ChannelAdminLo channelAdminLogEventActionPinTopic#5d8d353b flags:# prev_topic:flags.0?ForumTopic new_topic:flags.1?ForumTopic = ChannelAdminLogEventAction; +channelAdminLogEventActionToggleAntiSpam#64f36dfc new_value:Bool = ChannelAdminLogEventAction; + channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; @@ -2160,10 +2168,14 @@ username#b4073647 flags:# editable:flags.0?true active:flags.1?true username:str forumTopicDeleted#23f109b id:int = ForumTopic; -forumTopic#71701da9 flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true id:int date:int title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic; +forumTopic#71701da9 flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true short:flags.5?true hidden:flags.6?true id:int date:int title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic; messages.forumTopics#367617d3 flags:# order_by_create_date:flags.0?true count:int topics:Vector messages:Vector chats:Vector users:Vector pts:int = messages.ForumTopics; +defaultHistoryTTL#43b46b20 period:int = DefaultHistoryTTL; + +exportedContactToken#41bf109b url:string expires:int = ExportedContactToken; + ---functions--- @@ -2219,6 +2231,8 @@ auth.acceptLoginToken#e894ad4d token:bytes = Authorization; auth.checkRecoveryPassword#d36bf79 code:string = Bool; +auth.importWebTokenAuthorization#2db873a9 api_id:int api_hash:string web_auth_token:string = auth.Authorization; + account.registerDevice#ec86017a flags:# no_muted:flags.0?true token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector = Bool; account.unregisterDevice#6a0d3206 token_type:int token:string other_uids:Vector = Bool; @@ -2431,6 +2445,10 @@ contacts.blockFromReplies#29a8962c flags:# delete_message:flags.0?true delete_hi contacts.resolvePhone#8af94344 phone:string = contacts.ResolvedPeer; +contacts.exportContactToken#f8654027 = ExportedContactToken; + +contacts.importContactToken#13005788 token:string = User; + messages.getMessages#63c66506 id:Vector = messages.Messages; messages.getDialogs#a0f4cb4f flags:# exclude_pinned:flags.0?true folder_id:flags.1?int offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:long = messages.Dialogs; @@ -2473,7 +2491,7 @@ messages.addChatUser#f24753e3 chat_id:long user_id:InputUser fwd_limit:int = Upd messages.deleteChatUser#a2185cab flags:# revoke_history:flags.0?true chat_id:long user_id:InputUser = Updates; -messages.createChat#9cb126e users:Vector title:string = Updates; +messages.createChat#34a818 flags:# users:Vector title:string ttl_period:flags.0?int = Updates; messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; @@ -2785,6 +2803,10 @@ messages.clearRecentReactions#9dfeefb4 = Bool; messages.getExtendedMedia#84f80814 peer:InputPeer id:Vector = Updates; +messages.setDefaultHistoryTTL#9eb51445 period:int = Bool; + +messages.getDefaultHistoryTTL#658b7188 = DefaultHistoryTTL; + updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; @@ -2877,7 +2899,7 @@ channels.getChannels#a7f6bbb id:Vector = messages.Chats; channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; -channels.createChannel#3d5fb10f flags:# broadcast:flags.0?true megagroup:flags.1?true for_import:flags.3?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string = Updates; +channels.createChannel#91006707 flags:# broadcast:flags.0?true megagroup:flags.1?true for_import:flags.3?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string ttl_period:flags.4?int = Updates; channels.editAdmin#d33c8902 channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights rank:string = Updates; @@ -2957,12 +2979,18 @@ channels.getForumTopics#de560d1 flags:# channel:InputChannel q:flags.0?string of channels.getForumTopicsByID#b0831eb9 channel:InputChannel topics:Vector = messages.ForumTopics; -channels.editForumTopic#6c883e2d flags:# channel:InputChannel topic_id:int title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool = Updates; +channels.editForumTopic#f4dfa185 flags:# channel:InputChannel topic_id:int title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = Updates; channels.updatePinnedForumTopic#6c2d9026 channel:InputChannel topic_id:int pinned:Bool = Updates; channels.deleteTopicHistory#34435f2d channel:InputChannel top_msg_id:int = messages.AffectedHistory; +channels.reorderPinnedForumTopics#2950a18f flags:# force:flags.0?true channel:InputChannel order:Vector = Updates; + +channels.toggleAntiSpam#68f3e4eb channel:InputChannel enabled:Bool = Updates; + +channels.reportAntiSpamFalsePositive#a850a693 channel:InputChannel msg_id:int = Bool; + bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; @@ -3103,4 +3131,4 @@ stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_r stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats; -// LAYER 148 +// LAYER 150 diff --git a/_schema/telegram.tl b/_schema/telegram.tl index b56010a853..efce0d734c 100644 --- a/_schema/telegram.tl +++ b/_schema/telegram.tl @@ -2,8 +2,8 @@ // // Source: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/Resources/tl/api.tl // Merge: _schema/legacy.tl -// Layer: 149 -// SHA256: ad5229b179d1350bca43eee099a5c538613f9d4148b7933cd87a4fca02e2cc8f +// Layer: 150 +// SHA256: 16379ae5b0f59f8a9aa17d9f8289db7a61869ad5acddf74cd07fcac7e5f91d5e boolFalse#bc799737 = Bool; @@ -165,7 +165,7 @@ channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true chatFull#c9d31138 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector available_reactions:flags.18?ChatReactions = ChatFull; -channelFull#f2355507 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions = ChatFull; +channelFull#f2355507 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions = ChatFull; chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant; @@ -265,7 +265,7 @@ messageActionGroupCall#7a0d7f42 flags:# call:InputGroupCall duration:flags.0?int messageActionInviteToGroupCall#502f92f7 call:InputGroupCall users:Vector = MessageAction; -messageActionSetMessagesTTL#aa1afbfd period:int = MessageAction; +messageActionSetMessagesTTL#3c134d7b flags:# period:int auto_setting_from:flags.0?long = MessageAction; messageActionGroupCallScheduled#b3a07661 call:InputGroupCall schedule_date:int = MessageAction; @@ -281,9 +281,9 @@ messageActionGiftPremium#aba0f5c6 currency:string amount:long months:int = Messa messageActionTopicCreate#d999256 flags:# title:string icon_color:int icon_emoji_id:flags.0?long = MessageAction; -messageActionTopicEdit#b18a431c flags:# title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool = MessageAction; +messageActionTopicEdit#c0944820 flags:# title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = MessageAction; -dialog#a8edd0f5 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int = Dialog; +dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog; dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog; @@ -1143,6 +1143,8 @@ auth.codeTypeFlashCall#226ccefb = auth.CodeType; auth.codeTypeMissedCall#d61ad6ee = auth.CodeType; +auth.codeTypeFragmentSms#6ed998c = auth.CodeType; + auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; @@ -1157,6 +1159,8 @@ auth.sentCodeTypeEmailCode#5a159841 flags:# apple_signin_allowed:flags.0?true go auth.sentCodeTypeSetUpEmailRequired#a5491dea flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true = auth.SentCodeType; +auth.sentCodeTypeFragmentSms#d9565c39 url:string length:int = auth.SentCodeType; + messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; @@ -1511,6 +1515,8 @@ channelAdminLogEventActionDeleteTopic#ae168909 topic:ForumTopic = ChannelAdminLo channelAdminLogEventActionPinTopic#5d8d353b flags:# prev_topic:flags.0?ForumTopic new_topic:flags.1?ForumTopic = ChannelAdminLogEventAction; +channelAdminLogEventActionToggleAntiSpam#64f36dfc new_value:Bool = ChannelAdminLogEventAction; + channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; @@ -2131,10 +2137,14 @@ username#b4073647 flags:# editable:flags.0?true active:flags.1?true username:str forumTopicDeleted#23f109b id:int = ForumTopic; -forumTopic#71701da9 flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true short:flags.5?true id:int date:int title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic; +forumTopic#71701da9 flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true short:flags.5?true hidden:flags.6?true id:int date:int title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic; messages.forumTopics#367617d3 flags:# order_by_create_date:flags.0?true count:int topics:Vector messages:Vector chats:Vector users:Vector pts:int = messages.ForumTopics; +defaultHistoryTTL#43b46b20 period:int = DefaultHistoryTTL; + +exportedContactToken#41bf109b url:string expires:int = ExportedContactToken; + ---functions--- @@ -2190,6 +2200,8 @@ auth.acceptLoginToken#e894ad4d token:bytes = Authorization; auth.checkRecoveryPassword#d36bf79 code:string = Bool; +auth.importWebTokenAuthorization#2db873a9 api_id:int api_hash:string web_auth_token:string = auth.Authorization; + account.registerDevice#ec86017a flags:# no_muted:flags.0?true token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector = Bool; account.unregisterDevice#6a0d3206 token_type:int token:string other_uids:Vector = Bool; @@ -2402,6 +2414,10 @@ contacts.blockFromReplies#29a8962c flags:# delete_message:flags.0?true delete_hi contacts.resolvePhone#8af94344 phone:string = contacts.ResolvedPeer; +contacts.exportContactToken#f8654027 = ExportedContactToken; + +contacts.importContactToken#13005788 token:string = User; + messages.getMessages#63c66506 id:Vector = messages.Messages; messages.getDialogs#a0f4cb4f flags:# exclude_pinned:flags.0?true folder_id:flags.1?int offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:long = messages.Dialogs; @@ -2444,7 +2460,7 @@ messages.addChatUser#f24753e3 chat_id:long user_id:InputUser fwd_limit:int = Upd messages.deleteChatUser#a2185cab flags:# revoke_history:flags.0?true chat_id:long user_id:InputUser = Updates; -messages.createChat#9cb126e users:Vector title:string = Updates; +messages.createChat#34a818 flags:# users:Vector title:string ttl_period:flags.0?int = Updates; messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; @@ -2756,6 +2772,10 @@ messages.clearRecentReactions#9dfeefb4 = Bool; messages.getExtendedMedia#84f80814 peer:InputPeer id:Vector = Updates; +messages.setDefaultHistoryTTL#9eb51445 period:int = Bool; + +messages.getDefaultHistoryTTL#658b7188 = DefaultHistoryTTL; + updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; @@ -2848,7 +2868,7 @@ channels.getChannels#a7f6bbb id:Vector = messages.Chats; channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; -channels.createChannel#3d5fb10f flags:# broadcast:flags.0?true megagroup:flags.1?true for_import:flags.3?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string = Updates; +channels.createChannel#91006707 flags:# broadcast:flags.0?true megagroup:flags.1?true for_import:flags.3?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string ttl_period:flags.4?int = Updates; channels.editAdmin#d33c8902 channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights rank:string = Updates; @@ -2928,7 +2948,7 @@ channels.getForumTopics#de560d1 flags:# channel:InputChannel q:flags.0?string of channels.getForumTopicsByID#b0831eb9 channel:InputChannel topics:Vector = messages.ForumTopics; -channels.editForumTopic#6c883e2d flags:# channel:InputChannel topic_id:int title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool = Updates; +channels.editForumTopic#f4dfa185 flags:# channel:InputChannel topic_id:int title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = Updates; channels.updatePinnedForumTopic#6c2d9026 channel:InputChannel topic_id:int pinned:Bool = Updates; @@ -2936,6 +2956,10 @@ channels.deleteTopicHistory#34435f2d channel:InputChannel top_msg_id:int = messa channels.reorderPinnedForumTopics#2950a18f flags:# force:flags.0?true channel:InputChannel order:Vector = Updates; +channels.toggleAntiSpam#68f3e4eb channel:InputChannel enabled:Bool = Updates; + +channels.reportAntiSpamFalsePositive#a850a693 channel:InputChannel msg_id:int = Bool; + bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; @@ -3108,4 +3132,4 @@ test.useError#ee75af01 = Error; test.useConfigSimple#f9b7b23d = help.ConfigSimple; -// LAYER 149 +// LAYER 150 diff --git a/tg/tl_auth_code_type_gen.go b/tg/tl_auth_code_type_gen.go index dea27a0199..e2dab024c0 100644 --- a/tg/tl_auth_code_type_gen.go +++ b/tg/tl_auth_code_type_gen.go @@ -442,6 +442,107 @@ func (c *AuthCodeTypeMissedCall) DecodeBare(b *bin.Buffer) error { return nil } +// AuthCodeTypeFragmentSMS represents TL type `auth.codeTypeFragmentSms#6ed998c`. +// +// See https://core.telegram.org/constructor/auth.codeTypeFragmentSms for reference. +type AuthCodeTypeFragmentSMS struct { +} + +// AuthCodeTypeFragmentSMSTypeID is TL type id of AuthCodeTypeFragmentSMS. +const AuthCodeTypeFragmentSMSTypeID = 0x6ed998c + +// construct implements constructor of AuthCodeTypeClass. +func (c AuthCodeTypeFragmentSMS) construct() AuthCodeTypeClass { return &c } + +// Ensuring interfaces in compile-time for AuthCodeTypeFragmentSMS. +var ( + _ bin.Encoder = &AuthCodeTypeFragmentSMS{} + _ bin.Decoder = &AuthCodeTypeFragmentSMS{} + _ bin.BareEncoder = &AuthCodeTypeFragmentSMS{} + _ bin.BareDecoder = &AuthCodeTypeFragmentSMS{} + + _ AuthCodeTypeClass = &AuthCodeTypeFragmentSMS{} +) + +func (c *AuthCodeTypeFragmentSMS) Zero() bool { + if c == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (c *AuthCodeTypeFragmentSMS) String() string { + if c == nil { + return "AuthCodeTypeFragmentSMS(nil)" + } + type Alias AuthCodeTypeFragmentSMS + return fmt.Sprintf("AuthCodeTypeFragmentSMS%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AuthCodeTypeFragmentSMS) TypeID() uint32 { + return AuthCodeTypeFragmentSMSTypeID +} + +// TypeName returns name of type in TL schema. +func (*AuthCodeTypeFragmentSMS) TypeName() string { + return "auth.codeTypeFragmentSms" +} + +// TypeInfo returns info about TL type. +func (c *AuthCodeTypeFragmentSMS) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "auth.codeTypeFragmentSms", + ID: AuthCodeTypeFragmentSMSTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (c *AuthCodeTypeFragmentSMS) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode auth.codeTypeFragmentSms#6ed998c as nil") + } + b.PutID(AuthCodeTypeFragmentSMSTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *AuthCodeTypeFragmentSMS) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode auth.codeTypeFragmentSms#6ed998c as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (c *AuthCodeTypeFragmentSMS) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode auth.codeTypeFragmentSms#6ed998c to nil") + } + if err := b.ConsumeID(AuthCodeTypeFragmentSMSTypeID); err != nil { + return fmt.Errorf("unable to decode auth.codeTypeFragmentSms#6ed998c: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *AuthCodeTypeFragmentSMS) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode auth.codeTypeFragmentSms#6ed998c to nil") + } + return nil +} + // AuthCodeTypeClassName is schema name of AuthCodeTypeClass. const AuthCodeTypeClassName = "auth.CodeType" @@ -460,6 +561,7 @@ const AuthCodeTypeClassName = "auth.CodeType" // case *tg.AuthCodeTypeCall: // auth.codeTypeCall#741cd3e3 // case *tg.AuthCodeTypeFlashCall: // auth.codeTypeFlashCall#226ccefb // case *tg.AuthCodeTypeMissedCall: // auth.codeTypeMissedCall#d61ad6ee +// case *tg.AuthCodeTypeFragmentSMS: // auth.codeTypeFragmentSms#6ed998c // default: panic(v) // } type AuthCodeTypeClass interface { @@ -516,6 +618,13 @@ func DecodeAuthCodeType(buf *bin.Buffer) (AuthCodeTypeClass, error) { return nil, fmt.Errorf("unable to decode AuthCodeTypeClass: %w", err) } return &v, nil + case AuthCodeTypeFragmentSMSTypeID: + // Decoding auth.codeTypeFragmentSms#6ed998c. + v := AuthCodeTypeFragmentSMS{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode AuthCodeTypeClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode AuthCodeTypeClass: %w", bin.NewUnexpectedID(id)) } diff --git a/tg/tl_auth_import_web_token_authorization_gen.go b/tg/tl_auth_import_web_token_authorization_gen.go new file mode 100644 index 0000000000..7db4963c23 --- /dev/null +++ b/tg/tl_auth_import_web_token_authorization_gen.go @@ -0,0 +1,227 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// AuthImportWebTokenAuthorizationRequest represents TL type `auth.importWebTokenAuthorization#2db873a9`. +// +// See https://core.telegram.org/method/auth.importWebTokenAuthorization for reference. +type AuthImportWebTokenAuthorizationRequest struct { + // APIID field of AuthImportWebTokenAuthorizationRequest. + APIID int + // APIHash field of AuthImportWebTokenAuthorizationRequest. + APIHash string + // WebAuthToken field of AuthImportWebTokenAuthorizationRequest. + WebAuthToken string +} + +// AuthImportWebTokenAuthorizationRequestTypeID is TL type id of AuthImportWebTokenAuthorizationRequest. +const AuthImportWebTokenAuthorizationRequestTypeID = 0x2db873a9 + +// Ensuring interfaces in compile-time for AuthImportWebTokenAuthorizationRequest. +var ( + _ bin.Encoder = &AuthImportWebTokenAuthorizationRequest{} + _ bin.Decoder = &AuthImportWebTokenAuthorizationRequest{} + _ bin.BareEncoder = &AuthImportWebTokenAuthorizationRequest{} + _ bin.BareDecoder = &AuthImportWebTokenAuthorizationRequest{} +) + +func (i *AuthImportWebTokenAuthorizationRequest) Zero() bool { + if i == nil { + return true + } + if !(i.APIID == 0) { + return false + } + if !(i.APIHash == "") { + return false + } + if !(i.WebAuthToken == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *AuthImportWebTokenAuthorizationRequest) String() string { + if i == nil { + return "AuthImportWebTokenAuthorizationRequest(nil)" + } + type Alias AuthImportWebTokenAuthorizationRequest + return fmt.Sprintf("AuthImportWebTokenAuthorizationRequest%+v", Alias(*i)) +} + +// FillFrom fills AuthImportWebTokenAuthorizationRequest from given interface. +func (i *AuthImportWebTokenAuthorizationRequest) FillFrom(from interface { + GetAPIID() (value int) + GetAPIHash() (value string) + GetWebAuthToken() (value string) +}) { + i.APIID = from.GetAPIID() + i.APIHash = from.GetAPIHash() + i.WebAuthToken = from.GetWebAuthToken() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AuthImportWebTokenAuthorizationRequest) TypeID() uint32 { + return AuthImportWebTokenAuthorizationRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*AuthImportWebTokenAuthorizationRequest) TypeName() string { + return "auth.importWebTokenAuthorization" +} + +// TypeInfo returns info about TL type. +func (i *AuthImportWebTokenAuthorizationRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "auth.importWebTokenAuthorization", + ID: AuthImportWebTokenAuthorizationRequestTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "APIID", + SchemaName: "api_id", + }, + { + Name: "APIHash", + SchemaName: "api_hash", + }, + { + Name: "WebAuthToken", + SchemaName: "web_auth_token", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *AuthImportWebTokenAuthorizationRequest) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode auth.importWebTokenAuthorization#2db873a9 as nil") + } + b.PutID(AuthImportWebTokenAuthorizationRequestTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *AuthImportWebTokenAuthorizationRequest) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode auth.importWebTokenAuthorization#2db873a9 as nil") + } + b.PutInt(i.APIID) + b.PutString(i.APIHash) + b.PutString(i.WebAuthToken) + return nil +} + +// Decode implements bin.Decoder. +func (i *AuthImportWebTokenAuthorizationRequest) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode auth.importWebTokenAuthorization#2db873a9 to nil") + } + if err := b.ConsumeID(AuthImportWebTokenAuthorizationRequestTypeID); err != nil { + return fmt.Errorf("unable to decode auth.importWebTokenAuthorization#2db873a9: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *AuthImportWebTokenAuthorizationRequest) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode auth.importWebTokenAuthorization#2db873a9 to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode auth.importWebTokenAuthorization#2db873a9: field api_id: %w", err) + } + i.APIID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode auth.importWebTokenAuthorization#2db873a9: field api_hash: %w", err) + } + i.APIHash = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode auth.importWebTokenAuthorization#2db873a9: field web_auth_token: %w", err) + } + i.WebAuthToken = value + } + return nil +} + +// GetAPIID returns value of APIID field. +func (i *AuthImportWebTokenAuthorizationRequest) GetAPIID() (value int) { + if i == nil { + return + } + return i.APIID +} + +// GetAPIHash returns value of APIHash field. +func (i *AuthImportWebTokenAuthorizationRequest) GetAPIHash() (value string) { + if i == nil { + return + } + return i.APIHash +} + +// GetWebAuthToken returns value of WebAuthToken field. +func (i *AuthImportWebTokenAuthorizationRequest) GetWebAuthToken() (value string) { + if i == nil { + return + } + return i.WebAuthToken +} + +// AuthImportWebTokenAuthorization invokes method auth.importWebTokenAuthorization#2db873a9 returning error if any. +// +// See https://core.telegram.org/method/auth.importWebTokenAuthorization for reference. +func (c *Client) AuthImportWebTokenAuthorization(ctx context.Context, request *AuthImportWebTokenAuthorizationRequest) (AuthAuthorizationClass, error) { + var result AuthAuthorizationBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.Authorization, nil +} diff --git a/tg/tl_auth_import_web_token_authorization_slices_gen.go b/tg/tl_auth_import_web_token_authorization_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_auth_import_web_token_authorization_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_auth_sent_code_type_gen.go b/tg/tl_auth_sent_code_type_gen.go index e9c9ae6cb5..a26ee34b47 100644 --- a/tg/tl_auth_sent_code_type_gen.go +++ b/tg/tl_auth_sent_code_type_gen.go @@ -1233,6 +1233,167 @@ func (s *AuthSentCodeTypeSetUpEmailRequired) GetGoogleSigninAllowed() (value boo return s.Flags.Has(1) } +// AuthSentCodeTypeFragmentSMS represents TL type `auth.sentCodeTypeFragmentSms#d9565c39`. +// +// See https://core.telegram.org/constructor/auth.sentCodeTypeFragmentSms for reference. +type AuthSentCodeTypeFragmentSMS struct { + // URL field of AuthSentCodeTypeFragmentSMS. + URL string + // Length field of AuthSentCodeTypeFragmentSMS. + Length int +} + +// AuthSentCodeTypeFragmentSMSTypeID is TL type id of AuthSentCodeTypeFragmentSMS. +const AuthSentCodeTypeFragmentSMSTypeID = 0xd9565c39 + +// construct implements constructor of AuthSentCodeTypeClass. +func (s AuthSentCodeTypeFragmentSMS) construct() AuthSentCodeTypeClass { return &s } + +// Ensuring interfaces in compile-time for AuthSentCodeTypeFragmentSMS. +var ( + _ bin.Encoder = &AuthSentCodeTypeFragmentSMS{} + _ bin.Decoder = &AuthSentCodeTypeFragmentSMS{} + _ bin.BareEncoder = &AuthSentCodeTypeFragmentSMS{} + _ bin.BareDecoder = &AuthSentCodeTypeFragmentSMS{} + + _ AuthSentCodeTypeClass = &AuthSentCodeTypeFragmentSMS{} +) + +func (s *AuthSentCodeTypeFragmentSMS) Zero() bool { + if s == nil { + return true + } + if !(s.URL == "") { + return false + } + if !(s.Length == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *AuthSentCodeTypeFragmentSMS) String() string { + if s == nil { + return "AuthSentCodeTypeFragmentSMS(nil)" + } + type Alias AuthSentCodeTypeFragmentSMS + return fmt.Sprintf("AuthSentCodeTypeFragmentSMS%+v", Alias(*s)) +} + +// FillFrom fills AuthSentCodeTypeFragmentSMS from given interface. +func (s *AuthSentCodeTypeFragmentSMS) FillFrom(from interface { + GetURL() (value string) + GetLength() (value int) +}) { + s.URL = from.GetURL() + s.Length = from.GetLength() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AuthSentCodeTypeFragmentSMS) TypeID() uint32 { + return AuthSentCodeTypeFragmentSMSTypeID +} + +// TypeName returns name of type in TL schema. +func (*AuthSentCodeTypeFragmentSMS) TypeName() string { + return "auth.sentCodeTypeFragmentSms" +} + +// TypeInfo returns info about TL type. +func (s *AuthSentCodeTypeFragmentSMS) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "auth.sentCodeTypeFragmentSms", + ID: AuthSentCodeTypeFragmentSMSTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "URL", + SchemaName: "url", + }, + { + Name: "Length", + SchemaName: "length", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *AuthSentCodeTypeFragmentSMS) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode auth.sentCodeTypeFragmentSms#d9565c39 as nil") + } + b.PutID(AuthSentCodeTypeFragmentSMSTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *AuthSentCodeTypeFragmentSMS) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode auth.sentCodeTypeFragmentSms#d9565c39 as nil") + } + b.PutString(s.URL) + b.PutInt(s.Length) + return nil +} + +// Decode implements bin.Decoder. +func (s *AuthSentCodeTypeFragmentSMS) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode auth.sentCodeTypeFragmentSms#d9565c39 to nil") + } + if err := b.ConsumeID(AuthSentCodeTypeFragmentSMSTypeID); err != nil { + return fmt.Errorf("unable to decode auth.sentCodeTypeFragmentSms#d9565c39: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *AuthSentCodeTypeFragmentSMS) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode auth.sentCodeTypeFragmentSms#d9565c39 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode auth.sentCodeTypeFragmentSms#d9565c39: field url: %w", err) + } + s.URL = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode auth.sentCodeTypeFragmentSms#d9565c39: field length: %w", err) + } + s.Length = value + } + return nil +} + +// GetURL returns value of URL field. +func (s *AuthSentCodeTypeFragmentSMS) GetURL() (value string) { + if s == nil { + return + } + return s.URL +} + +// GetLength returns value of Length field. +func (s *AuthSentCodeTypeFragmentSMS) GetLength() (value int) { + if s == nil { + return + } + return s.Length +} + // AuthSentCodeTypeClassName is schema name of AuthSentCodeTypeClass. const AuthSentCodeTypeClassName = "auth.SentCodeType" @@ -1254,6 +1415,7 @@ const AuthSentCodeTypeClassName = "auth.SentCodeType" // case *tg.AuthSentCodeTypeMissedCall: // auth.sentCodeTypeMissedCall#82006484 // case *tg.AuthSentCodeTypeEmailCode: // auth.sentCodeTypeEmailCode#5a159841 // case *tg.AuthSentCodeTypeSetUpEmailRequired: // auth.sentCodeTypeSetUpEmailRequired#a5491dea +// case *tg.AuthSentCodeTypeFragmentSMS: // auth.sentCodeTypeFragmentSms#d9565c39 // default: panic(v) // } type AuthSentCodeTypeClass interface { @@ -1331,6 +1493,13 @@ func DecodeAuthSentCodeType(buf *bin.Buffer) (AuthSentCodeTypeClass, error) { return nil, fmt.Errorf("unable to decode AuthSentCodeTypeClass: %w", err) } return &v, nil + case AuthSentCodeTypeFragmentSMSTypeID: + // Decoding auth.sentCodeTypeFragmentSms#d9565c39. + v := AuthSentCodeTypeFragmentSMS{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode AuthSentCodeTypeClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode AuthSentCodeTypeClass: %w", bin.NewUnexpectedID(id)) } diff --git a/tg/tl_auth_sent_code_type_slices_gen.go b/tg/tl_auth_sent_code_type_slices_gen.go index 5868bdb1f7..a4d40f5855 100644 --- a/tg/tl_auth_sent_code_type_slices_gen.go +++ b/tg/tl_auth_sent_code_type_slices_gen.go @@ -207,6 +207,19 @@ func (s AuthSentCodeTypeClassArray) AsAuthSentCodeTypeSetUpEmailRequired() (to A return to } +// AsAuthSentCodeTypeFragmentSMS returns copy with only AuthSentCodeTypeFragmentSMS constructors. +func (s AuthSentCodeTypeClassArray) AsAuthSentCodeTypeFragmentSMS() (to AuthSentCodeTypeFragmentSMSArray) { + for _, elem := range s { + value, ok := elem.(*AuthSentCodeTypeFragmentSMS) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // AuthSentCodeTypeAppArray is adapter for slice of AuthSentCodeTypeApp. type AuthSentCodeTypeAppArray []AuthSentCodeTypeApp @@ -780,3 +793,85 @@ func (s *AuthSentCodeTypeSetUpEmailRequiredArray) Pop() (v AuthSentCodeTypeSetUp return v, true } + +// AuthSentCodeTypeFragmentSMSArray is adapter for slice of AuthSentCodeTypeFragmentSMS. +type AuthSentCodeTypeFragmentSMSArray []AuthSentCodeTypeFragmentSMS + +// Sort sorts slice of AuthSentCodeTypeFragmentSMS. +func (s AuthSentCodeTypeFragmentSMSArray) Sort(less func(a, b AuthSentCodeTypeFragmentSMS) bool) AuthSentCodeTypeFragmentSMSArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of AuthSentCodeTypeFragmentSMS. +func (s AuthSentCodeTypeFragmentSMSArray) SortStable(less func(a, b AuthSentCodeTypeFragmentSMS) bool) AuthSentCodeTypeFragmentSMSArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of AuthSentCodeTypeFragmentSMS. +func (s AuthSentCodeTypeFragmentSMSArray) Retain(keep func(x AuthSentCodeTypeFragmentSMS) bool) AuthSentCodeTypeFragmentSMSArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s AuthSentCodeTypeFragmentSMSArray) First() (v AuthSentCodeTypeFragmentSMS, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s AuthSentCodeTypeFragmentSMSArray) Last() (v AuthSentCodeTypeFragmentSMS, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *AuthSentCodeTypeFragmentSMSArray) PopFirst() (v AuthSentCodeTypeFragmentSMS, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero AuthSentCodeTypeFragmentSMS + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *AuthSentCodeTypeFragmentSMSArray) Pop() (v AuthSentCodeTypeFragmentSMS, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/tg/tl_channel_admin_log_event_action_gen.go b/tg/tl_channel_admin_log_event_action_gen.go index 72bd17d97d..7a7c978598 100644 --- a/tg/tl_channel_admin_log_event_action_gen.go +++ b/tg/tl_channel_admin_log_event_action_gen.go @@ -6475,6 +6475,142 @@ func (c *ChannelAdminLogEventActionPinTopic) GetNewTopic() (value ForumTopicClas return c.NewTopic, true } +// ChannelAdminLogEventActionToggleAntiSpam represents TL type `channelAdminLogEventActionToggleAntiSpam#64f36dfc`. +// +// See https://core.telegram.org/constructor/channelAdminLogEventActionToggleAntiSpam for reference. +type ChannelAdminLogEventActionToggleAntiSpam struct { + // NewValue field of ChannelAdminLogEventActionToggleAntiSpam. + NewValue bool +} + +// ChannelAdminLogEventActionToggleAntiSpamTypeID is TL type id of ChannelAdminLogEventActionToggleAntiSpam. +const ChannelAdminLogEventActionToggleAntiSpamTypeID = 0x64f36dfc + +// construct implements constructor of ChannelAdminLogEventActionClass. +func (c ChannelAdminLogEventActionToggleAntiSpam) construct() ChannelAdminLogEventActionClass { + return &c +} + +// Ensuring interfaces in compile-time for ChannelAdminLogEventActionToggleAntiSpam. +var ( + _ bin.Encoder = &ChannelAdminLogEventActionToggleAntiSpam{} + _ bin.Decoder = &ChannelAdminLogEventActionToggleAntiSpam{} + _ bin.BareEncoder = &ChannelAdminLogEventActionToggleAntiSpam{} + _ bin.BareDecoder = &ChannelAdminLogEventActionToggleAntiSpam{} + + _ ChannelAdminLogEventActionClass = &ChannelAdminLogEventActionToggleAntiSpam{} +) + +func (c *ChannelAdminLogEventActionToggleAntiSpam) Zero() bool { + if c == nil { + return true + } + if !(c.NewValue == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChannelAdminLogEventActionToggleAntiSpam) String() string { + if c == nil { + return "ChannelAdminLogEventActionToggleAntiSpam(nil)" + } + type Alias ChannelAdminLogEventActionToggleAntiSpam + return fmt.Sprintf("ChannelAdminLogEventActionToggleAntiSpam%+v", Alias(*c)) +} + +// FillFrom fills ChannelAdminLogEventActionToggleAntiSpam from given interface. +func (c *ChannelAdminLogEventActionToggleAntiSpam) FillFrom(from interface { + GetNewValue() (value bool) +}) { + c.NewValue = from.GetNewValue() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChannelAdminLogEventActionToggleAntiSpam) TypeID() uint32 { + return ChannelAdminLogEventActionToggleAntiSpamTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChannelAdminLogEventActionToggleAntiSpam) TypeName() string { + return "channelAdminLogEventActionToggleAntiSpam" +} + +// TypeInfo returns info about TL type. +func (c *ChannelAdminLogEventActionToggleAntiSpam) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "channelAdminLogEventActionToggleAntiSpam", + ID: ChannelAdminLogEventActionToggleAntiSpamTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "NewValue", + SchemaName: "new_value", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChannelAdminLogEventActionToggleAntiSpam) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode channelAdminLogEventActionToggleAntiSpam#64f36dfc as nil") + } + b.PutID(ChannelAdminLogEventActionToggleAntiSpamTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChannelAdminLogEventActionToggleAntiSpam) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode channelAdminLogEventActionToggleAntiSpam#64f36dfc as nil") + } + b.PutBool(c.NewValue) + return nil +} + +// Decode implements bin.Decoder. +func (c *ChannelAdminLogEventActionToggleAntiSpam) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode channelAdminLogEventActionToggleAntiSpam#64f36dfc to nil") + } + if err := b.ConsumeID(ChannelAdminLogEventActionToggleAntiSpamTypeID); err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionToggleAntiSpam#64f36dfc: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChannelAdminLogEventActionToggleAntiSpam) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode channelAdminLogEventActionToggleAntiSpam#64f36dfc to nil") + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionToggleAntiSpam#64f36dfc: field new_value: %w", err) + } + c.NewValue = value + } + return nil +} + +// GetNewValue returns value of NewValue field. +func (c *ChannelAdminLogEventActionToggleAntiSpam) GetNewValue() (value bool) { + if c == nil { + return + } + return c.NewValue +} + // ChannelAdminLogEventActionClassName is schema name of ChannelAdminLogEventActionClass. const ChannelAdminLogEventActionClassName = "ChannelAdminLogEventAction" @@ -6531,6 +6667,7 @@ const ChannelAdminLogEventActionClassName = "ChannelAdminLogEventAction" // case *tg.ChannelAdminLogEventActionEditTopic: // channelAdminLogEventActionEditTopic#f06fe208 // case *tg.ChannelAdminLogEventActionDeleteTopic: // channelAdminLogEventActionDeleteTopic#ae168909 // case *tg.ChannelAdminLogEventActionPinTopic: // channelAdminLogEventActionPinTopic#5d8d353b +// case *tg.ChannelAdminLogEventActionToggleAntiSpam: // channelAdminLogEventActionToggleAntiSpam#64f36dfc // default: panic(v) // } type ChannelAdminLogEventActionClass interface { @@ -6853,6 +6990,13 @@ func DecodeChannelAdminLogEventAction(buf *bin.Buffer) (ChannelAdminLogEventActi return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", err) } return &v, nil + case ChannelAdminLogEventActionToggleAntiSpamTypeID: + // Decoding channelAdminLogEventActionToggleAntiSpam#64f36dfc. + v := ChannelAdminLogEventActionToggleAntiSpam{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", bin.NewUnexpectedID(id)) } diff --git a/tg/tl_channel_admin_log_event_action_slices_gen.go b/tg/tl_channel_admin_log_event_action_slices_gen.go index 1f598a3efe..7e2fee5fbb 100644 --- a/tg/tl_channel_admin_log_event_action_slices_gen.go +++ b/tg/tl_channel_admin_log_event_action_slices_gen.go @@ -636,6 +636,19 @@ func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionPinTop return to } +// AsChannelAdminLogEventActionToggleAntiSpam returns copy with only ChannelAdminLogEventActionToggleAntiSpam constructors. +func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionToggleAntiSpam() (to ChannelAdminLogEventActionToggleAntiSpamArray) { + for _, elem := range s { + value, ok := elem.(*ChannelAdminLogEventActionToggleAntiSpam) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // ChannelAdminLogEventActionChangeTitleArray is adapter for slice of ChannelAdminLogEventActionChangeTitle. type ChannelAdminLogEventActionChangeTitleArray []ChannelAdminLogEventActionChangeTitle @@ -3915,3 +3928,85 @@ func (s *ChannelAdminLogEventActionPinTopicArray) Pop() (v ChannelAdminLogEventA return v, true } + +// ChannelAdminLogEventActionToggleAntiSpamArray is adapter for slice of ChannelAdminLogEventActionToggleAntiSpam. +type ChannelAdminLogEventActionToggleAntiSpamArray []ChannelAdminLogEventActionToggleAntiSpam + +// Sort sorts slice of ChannelAdminLogEventActionToggleAntiSpam. +func (s ChannelAdminLogEventActionToggleAntiSpamArray) Sort(less func(a, b ChannelAdminLogEventActionToggleAntiSpam) bool) ChannelAdminLogEventActionToggleAntiSpamArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of ChannelAdminLogEventActionToggleAntiSpam. +func (s ChannelAdminLogEventActionToggleAntiSpamArray) SortStable(less func(a, b ChannelAdminLogEventActionToggleAntiSpam) bool) ChannelAdminLogEventActionToggleAntiSpamArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of ChannelAdminLogEventActionToggleAntiSpam. +func (s ChannelAdminLogEventActionToggleAntiSpamArray) Retain(keep func(x ChannelAdminLogEventActionToggleAntiSpam) bool) ChannelAdminLogEventActionToggleAntiSpamArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s ChannelAdminLogEventActionToggleAntiSpamArray) First() (v ChannelAdminLogEventActionToggleAntiSpam, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s ChannelAdminLogEventActionToggleAntiSpamArray) Last() (v ChannelAdminLogEventActionToggleAntiSpam, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *ChannelAdminLogEventActionToggleAntiSpamArray) PopFirst() (v ChannelAdminLogEventActionToggleAntiSpam, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero ChannelAdminLogEventActionToggleAntiSpam + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *ChannelAdminLogEventActionToggleAntiSpamArray) Pop() (v ChannelAdminLogEventActionToggleAntiSpam, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/tg/tl_channels_create_channel_gen.go b/tg/tl_channels_create_channel_gen.go index 6b7419d521..019f38e1c3 100644 --- a/tg/tl_channels_create_channel_gen.go +++ b/tg/tl_channels_create_channel_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// ChannelsCreateChannelRequest represents TL type `channels.createChannel#3d5fb10f`. +// ChannelsCreateChannelRequest represents TL type `channels.createChannel#91006707`. // Create a supergroup/channel¹. // // Links: @@ -72,10 +72,14 @@ type ChannelsCreateChannelRequest struct { // // Use SetAddress and GetAddress helpers. Address string + // TTLPeriod field of ChannelsCreateChannelRequest. + // + // Use SetTTLPeriod and GetTTLPeriod helpers. + TTLPeriod int } // ChannelsCreateChannelRequestTypeID is TL type id of ChannelsCreateChannelRequest. -const ChannelsCreateChannelRequestTypeID = 0x3d5fb10f +const ChannelsCreateChannelRequestTypeID = 0x91006707 // Ensuring interfaces in compile-time for ChannelsCreateChannelRequest. var ( @@ -113,6 +117,9 @@ func (c *ChannelsCreateChannelRequest) Zero() bool { if !(c.Address == "") { return false } + if !(c.TTLPeriod == 0) { + return false + } return true } @@ -135,6 +142,7 @@ func (c *ChannelsCreateChannelRequest) FillFrom(from interface { GetAbout() (value string) GetGeoPoint() (value InputGeoPointClass, ok bool) GetAddress() (value string, ok bool) + GetTTLPeriod() (value int, ok bool) }) { c.Broadcast = from.GetBroadcast() c.Megagroup = from.GetMegagroup() @@ -149,6 +157,10 @@ func (c *ChannelsCreateChannelRequest) FillFrom(from interface { c.Address = val } + if val, ok := from.GetTTLPeriod(); ok { + c.TTLPeriod = val + } + } // TypeID returns type id in TL schema. @@ -207,6 +219,11 @@ func (c *ChannelsCreateChannelRequest) TypeInfo() tdp.Type { SchemaName: "address", Null: !c.Flags.Has(2), }, + { + Name: "TTLPeriod", + SchemaName: "ttl_period", + Null: !c.Flags.Has(4), + }, } return typ } @@ -228,12 +245,15 @@ func (c *ChannelsCreateChannelRequest) SetFlags() { if !(c.Address == "") { c.Flags.Set(2) } + if !(c.TTLPeriod == 0) { + c.Flags.Set(4) + } } // Encode implements bin.Encoder. func (c *ChannelsCreateChannelRequest) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channels.createChannel#3d5fb10f as nil") + return fmt.Errorf("can't encode channels.createChannel#91006707 as nil") } b.PutID(ChannelsCreateChannelRequestTypeID) return c.EncodeBare(b) @@ -242,35 +262,38 @@ func (c *ChannelsCreateChannelRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChannelsCreateChannelRequest) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channels.createChannel#3d5fb10f as nil") + return fmt.Errorf("can't encode channels.createChannel#91006707 as nil") } c.SetFlags() if err := c.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode channels.createChannel#3d5fb10f: field flags: %w", err) + return fmt.Errorf("unable to encode channels.createChannel#91006707: field flags: %w", err) } b.PutString(c.Title) b.PutString(c.About) if c.Flags.Has(2) { if c.GeoPoint == nil { - return fmt.Errorf("unable to encode channels.createChannel#3d5fb10f: field geo_point is nil") + return fmt.Errorf("unable to encode channels.createChannel#91006707: field geo_point is nil") } if err := c.GeoPoint.Encode(b); err != nil { - return fmt.Errorf("unable to encode channels.createChannel#3d5fb10f: field geo_point: %w", err) + return fmt.Errorf("unable to encode channels.createChannel#91006707: field geo_point: %w", err) } } if c.Flags.Has(2) { b.PutString(c.Address) } + if c.Flags.Has(4) { + b.PutInt(c.TTLPeriod) + } return nil } // Decode implements bin.Decoder. func (c *ChannelsCreateChannelRequest) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channels.createChannel#3d5fb10f to nil") + return fmt.Errorf("can't decode channels.createChannel#91006707 to nil") } if err := b.ConsumeID(ChannelsCreateChannelRequestTypeID); err != nil { - return fmt.Errorf("unable to decode channels.createChannel#3d5fb10f: %w", err) + return fmt.Errorf("unable to decode channels.createChannel#91006707: %w", err) } return c.DecodeBare(b) } @@ -278,11 +301,11 @@ func (c *ChannelsCreateChannelRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChannelsCreateChannelRequest) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channels.createChannel#3d5fb10f to nil") + return fmt.Errorf("can't decode channels.createChannel#91006707 to nil") } { if err := c.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode channels.createChannel#3d5fb10f: field flags: %w", err) + return fmt.Errorf("unable to decode channels.createChannel#91006707: field flags: %w", err) } } c.Broadcast = c.Flags.Has(0) @@ -291,31 +314,38 @@ func (c *ChannelsCreateChannelRequest) DecodeBare(b *bin.Buffer) error { { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode channels.createChannel#3d5fb10f: field title: %w", err) + return fmt.Errorf("unable to decode channels.createChannel#91006707: field title: %w", err) } c.Title = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode channels.createChannel#3d5fb10f: field about: %w", err) + return fmt.Errorf("unable to decode channels.createChannel#91006707: field about: %w", err) } c.About = value } if c.Flags.Has(2) { value, err := DecodeInputGeoPoint(b) if err != nil { - return fmt.Errorf("unable to decode channels.createChannel#3d5fb10f: field geo_point: %w", err) + return fmt.Errorf("unable to decode channels.createChannel#91006707: field geo_point: %w", err) } c.GeoPoint = value } if c.Flags.Has(2) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode channels.createChannel#3d5fb10f: field address: %w", err) + return fmt.Errorf("unable to decode channels.createChannel#91006707: field address: %w", err) } c.Address = value } + if c.Flags.Has(4) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode channels.createChannel#91006707: field ttl_period: %w", err) + } + c.TTLPeriod = value + } return nil } @@ -428,6 +458,24 @@ func (c *ChannelsCreateChannelRequest) GetAddress() (value string, ok bool) { return c.Address, true } +// SetTTLPeriod sets value of TTLPeriod conditional field. +func (c *ChannelsCreateChannelRequest) SetTTLPeriod(value int) { + c.Flags.Set(4) + c.TTLPeriod = value +} + +// GetTTLPeriod returns value of TTLPeriod conditional field and +// boolean which is true if field was set. +func (c *ChannelsCreateChannelRequest) GetTTLPeriod() (value int, ok bool) { + if c == nil { + return + } + if !c.Flags.Has(4) { + return value, false + } + return c.TTLPeriod, true +} + // GetGeoPointAsNotEmpty returns mapped value of GeoPoint conditional field and // boolean which is true if field was set. func (c *ChannelsCreateChannelRequest) GetGeoPointAsNotEmpty() (*InputGeoPoint, bool) { @@ -437,7 +485,7 @@ func (c *ChannelsCreateChannelRequest) GetGeoPointAsNotEmpty() (*InputGeoPoint, return nil, false } -// ChannelsCreateChannel invokes method channels.createChannel#3d5fb10f returning error if any. +// ChannelsCreateChannel invokes method channels.createChannel#91006707 returning error if any. // Create a supergroup/channel¹. // // Links: diff --git a/tg/tl_channels_edit_forum_topic_gen.go b/tg/tl_channels_edit_forum_topic_gen.go index 5ebed9d228..4b20f41edc 100644 --- a/tg/tl_channels_edit_forum_topic_gen.go +++ b/tg/tl_channels_edit_forum_topic_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// ChannelsEditForumTopicRequest represents TL type `channels.editForumTopic#6c883e2d`. +// ChannelsEditForumTopicRequest represents TL type `channels.editForumTopic#f4dfa185`. // // See https://core.telegram.org/method/channels.editForumTopic for reference. type ChannelsEditForumTopicRequest struct { @@ -53,10 +53,14 @@ type ChannelsEditForumTopicRequest struct { // // Use SetClosed and GetClosed helpers. Closed bool + // Hidden field of ChannelsEditForumTopicRequest. + // + // Use SetHidden and GetHidden helpers. + Hidden bool } // ChannelsEditForumTopicRequestTypeID is TL type id of ChannelsEditForumTopicRequest. -const ChannelsEditForumTopicRequestTypeID = 0x6c883e2d +const ChannelsEditForumTopicRequestTypeID = 0xf4dfa185 // Ensuring interfaces in compile-time for ChannelsEditForumTopicRequest. var ( @@ -88,6 +92,9 @@ func (e *ChannelsEditForumTopicRequest) Zero() bool { if !(e.Closed == false) { return false } + if !(e.Hidden == false) { + return false + } return true } @@ -108,6 +115,7 @@ func (e *ChannelsEditForumTopicRequest) FillFrom(from interface { GetTitle() (value string, ok bool) GetIconEmojiID() (value int64, ok bool) GetClosed() (value bool, ok bool) + GetHidden() (value bool, ok bool) }) { e.Channel = from.GetChannel() e.TopicID = from.GetTopicID() @@ -123,6 +131,10 @@ func (e *ChannelsEditForumTopicRequest) FillFrom(from interface { e.Closed = val } + if val, ok := from.GetHidden(); ok { + e.Hidden = val + } + } // TypeID returns type id in TL schema. @@ -171,6 +183,11 @@ func (e *ChannelsEditForumTopicRequest) TypeInfo() tdp.Type { SchemaName: "closed", Null: !e.Flags.Has(2), }, + { + Name: "Hidden", + SchemaName: "hidden", + Null: !e.Flags.Has(3), + }, } return typ } @@ -186,12 +203,15 @@ func (e *ChannelsEditForumTopicRequest) SetFlags() { if !(e.Closed == false) { e.Flags.Set(2) } + if !(e.Hidden == false) { + e.Flags.Set(3) + } } // Encode implements bin.Encoder. func (e *ChannelsEditForumTopicRequest) Encode(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't encode channels.editForumTopic#6c883e2d as nil") + return fmt.Errorf("can't encode channels.editForumTopic#f4dfa185 as nil") } b.PutID(ChannelsEditForumTopicRequestTypeID) return e.EncodeBare(b) @@ -200,17 +220,17 @@ func (e *ChannelsEditForumTopicRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (e *ChannelsEditForumTopicRequest) EncodeBare(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't encode channels.editForumTopic#6c883e2d as nil") + return fmt.Errorf("can't encode channels.editForumTopic#f4dfa185 as nil") } e.SetFlags() if err := e.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode channels.editForumTopic#6c883e2d: field flags: %w", err) + return fmt.Errorf("unable to encode channels.editForumTopic#f4dfa185: field flags: %w", err) } if e.Channel == nil { - return fmt.Errorf("unable to encode channels.editForumTopic#6c883e2d: field channel is nil") + return fmt.Errorf("unable to encode channels.editForumTopic#f4dfa185: field channel is nil") } if err := e.Channel.Encode(b); err != nil { - return fmt.Errorf("unable to encode channels.editForumTopic#6c883e2d: field channel: %w", err) + return fmt.Errorf("unable to encode channels.editForumTopic#f4dfa185: field channel: %w", err) } b.PutInt(e.TopicID) if e.Flags.Has(0) { @@ -222,16 +242,19 @@ func (e *ChannelsEditForumTopicRequest) EncodeBare(b *bin.Buffer) error { if e.Flags.Has(2) { b.PutBool(e.Closed) } + if e.Flags.Has(3) { + b.PutBool(e.Hidden) + } return nil } // Decode implements bin.Decoder. func (e *ChannelsEditForumTopicRequest) Decode(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't decode channels.editForumTopic#6c883e2d to nil") + return fmt.Errorf("can't decode channels.editForumTopic#f4dfa185 to nil") } if err := b.ConsumeID(ChannelsEditForumTopicRequestTypeID); err != nil { - return fmt.Errorf("unable to decode channels.editForumTopic#6c883e2d: %w", err) + return fmt.Errorf("unable to decode channels.editForumTopic#f4dfa185: %w", err) } return e.DecodeBare(b) } @@ -239,48 +262,55 @@ func (e *ChannelsEditForumTopicRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (e *ChannelsEditForumTopicRequest) DecodeBare(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't decode channels.editForumTopic#6c883e2d to nil") + return fmt.Errorf("can't decode channels.editForumTopic#f4dfa185 to nil") } { if err := e.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode channels.editForumTopic#6c883e2d: field flags: %w", err) + return fmt.Errorf("unable to decode channels.editForumTopic#f4dfa185: field flags: %w", err) } } { value, err := DecodeInputChannel(b) if err != nil { - return fmt.Errorf("unable to decode channels.editForumTopic#6c883e2d: field channel: %w", err) + return fmt.Errorf("unable to decode channels.editForumTopic#f4dfa185: field channel: %w", err) } e.Channel = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channels.editForumTopic#6c883e2d: field topic_id: %w", err) + return fmt.Errorf("unable to decode channels.editForumTopic#f4dfa185: field topic_id: %w", err) } e.TopicID = value } if e.Flags.Has(0) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode channels.editForumTopic#6c883e2d: field title: %w", err) + return fmt.Errorf("unable to decode channels.editForumTopic#f4dfa185: field title: %w", err) } e.Title = value } if e.Flags.Has(1) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode channels.editForumTopic#6c883e2d: field icon_emoji_id: %w", err) + return fmt.Errorf("unable to decode channels.editForumTopic#f4dfa185: field icon_emoji_id: %w", err) } e.IconEmojiID = value } if e.Flags.Has(2) { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode channels.editForumTopic#6c883e2d: field closed: %w", err) + return fmt.Errorf("unable to decode channels.editForumTopic#f4dfa185: field closed: %w", err) } e.Closed = value } + if e.Flags.Has(3) { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode channels.editForumTopic#f4dfa185: field hidden: %w", err) + } + e.Hidden = value + } return nil } @@ -354,12 +384,30 @@ func (e *ChannelsEditForumTopicRequest) GetClosed() (value bool, ok bool) { return e.Closed, true } +// SetHidden sets value of Hidden conditional field. +func (e *ChannelsEditForumTopicRequest) SetHidden(value bool) { + e.Flags.Set(3) + e.Hidden = value +} + +// GetHidden returns value of Hidden conditional field and +// boolean which is true if field was set. +func (e *ChannelsEditForumTopicRequest) GetHidden() (value bool, ok bool) { + if e == nil { + return + } + if !e.Flags.Has(3) { + return value, false + } + return e.Hidden, true +} + // GetChannelAsNotEmpty returns mapped value of Channel field. func (e *ChannelsEditForumTopicRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, bool) { return e.Channel.AsNotEmpty() } -// ChannelsEditForumTopic invokes method channels.editForumTopic#6c883e2d returning error if any. +// ChannelsEditForumTopic invokes method channels.editForumTopic#f4dfa185 returning error if any. // // See https://core.telegram.org/method/channels.editForumTopic for reference. func (c *Client) ChannelsEditForumTopic(ctx context.Context, request *ChannelsEditForumTopicRequest) (UpdatesClass, error) { diff --git a/tg/tl_channels_report_anti_spam_false_positive_gen.go b/tg/tl_channels_report_anti_spam_false_positive_gen.go new file mode 100644 index 0000000000..e422b86d2f --- /dev/null +++ b/tg/tl_channels_report_anti_spam_false_positive_gen.go @@ -0,0 +1,211 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// ChannelsReportAntiSpamFalsePositiveRequest represents TL type `channels.reportAntiSpamFalsePositive#a850a693`. +// +// See https://core.telegram.org/method/channels.reportAntiSpamFalsePositive for reference. +type ChannelsReportAntiSpamFalsePositiveRequest struct { + // Channel field of ChannelsReportAntiSpamFalsePositiveRequest. + Channel InputChannelClass + // MsgID field of ChannelsReportAntiSpamFalsePositiveRequest. + MsgID int +} + +// ChannelsReportAntiSpamFalsePositiveRequestTypeID is TL type id of ChannelsReportAntiSpamFalsePositiveRequest. +const ChannelsReportAntiSpamFalsePositiveRequestTypeID = 0xa850a693 + +// Ensuring interfaces in compile-time for ChannelsReportAntiSpamFalsePositiveRequest. +var ( + _ bin.Encoder = &ChannelsReportAntiSpamFalsePositiveRequest{} + _ bin.Decoder = &ChannelsReportAntiSpamFalsePositiveRequest{} + _ bin.BareEncoder = &ChannelsReportAntiSpamFalsePositiveRequest{} + _ bin.BareDecoder = &ChannelsReportAntiSpamFalsePositiveRequest{} +) + +func (r *ChannelsReportAntiSpamFalsePositiveRequest) Zero() bool { + if r == nil { + return true + } + if !(r.Channel == nil) { + return false + } + if !(r.MsgID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (r *ChannelsReportAntiSpamFalsePositiveRequest) String() string { + if r == nil { + return "ChannelsReportAntiSpamFalsePositiveRequest(nil)" + } + type Alias ChannelsReportAntiSpamFalsePositiveRequest + return fmt.Sprintf("ChannelsReportAntiSpamFalsePositiveRequest%+v", Alias(*r)) +} + +// FillFrom fills ChannelsReportAntiSpamFalsePositiveRequest from given interface. +func (r *ChannelsReportAntiSpamFalsePositiveRequest) FillFrom(from interface { + GetChannel() (value InputChannelClass) + GetMsgID() (value int) +}) { + r.Channel = from.GetChannel() + r.MsgID = from.GetMsgID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChannelsReportAntiSpamFalsePositiveRequest) TypeID() uint32 { + return ChannelsReportAntiSpamFalsePositiveRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChannelsReportAntiSpamFalsePositiveRequest) TypeName() string { + return "channels.reportAntiSpamFalsePositive" +} + +// TypeInfo returns info about TL type. +func (r *ChannelsReportAntiSpamFalsePositiveRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "channels.reportAntiSpamFalsePositive", + ID: ChannelsReportAntiSpamFalsePositiveRequestTypeID, + } + if r == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Channel", + SchemaName: "channel", + }, + { + Name: "MsgID", + SchemaName: "msg_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (r *ChannelsReportAntiSpamFalsePositiveRequest) Encode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode channels.reportAntiSpamFalsePositive#a850a693 as nil") + } + b.PutID(ChannelsReportAntiSpamFalsePositiveRequestTypeID) + return r.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (r *ChannelsReportAntiSpamFalsePositiveRequest) EncodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode channels.reportAntiSpamFalsePositive#a850a693 as nil") + } + if r.Channel == nil { + return fmt.Errorf("unable to encode channels.reportAntiSpamFalsePositive#a850a693: field channel is nil") + } + if err := r.Channel.Encode(b); err != nil { + return fmt.Errorf("unable to encode channels.reportAntiSpamFalsePositive#a850a693: field channel: %w", err) + } + b.PutInt(r.MsgID) + return nil +} + +// Decode implements bin.Decoder. +func (r *ChannelsReportAntiSpamFalsePositiveRequest) Decode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode channels.reportAntiSpamFalsePositive#a850a693 to nil") + } + if err := b.ConsumeID(ChannelsReportAntiSpamFalsePositiveRequestTypeID); err != nil { + return fmt.Errorf("unable to decode channels.reportAntiSpamFalsePositive#a850a693: %w", err) + } + return r.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (r *ChannelsReportAntiSpamFalsePositiveRequest) DecodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode channels.reportAntiSpamFalsePositive#a850a693 to nil") + } + { + value, err := DecodeInputChannel(b) + if err != nil { + return fmt.Errorf("unable to decode channels.reportAntiSpamFalsePositive#a850a693: field channel: %w", err) + } + r.Channel = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode channels.reportAntiSpamFalsePositive#a850a693: field msg_id: %w", err) + } + r.MsgID = value + } + return nil +} + +// GetChannel returns value of Channel field. +func (r *ChannelsReportAntiSpamFalsePositiveRequest) GetChannel() (value InputChannelClass) { + if r == nil { + return + } + return r.Channel +} + +// GetMsgID returns value of MsgID field. +func (r *ChannelsReportAntiSpamFalsePositiveRequest) GetMsgID() (value int) { + if r == nil { + return + } + return r.MsgID +} + +// GetChannelAsNotEmpty returns mapped value of Channel field. +func (r *ChannelsReportAntiSpamFalsePositiveRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, bool) { + return r.Channel.AsNotEmpty() +} + +// ChannelsReportAntiSpamFalsePositive invokes method channels.reportAntiSpamFalsePositive#a850a693 returning error if any. +// +// See https://core.telegram.org/method/channels.reportAntiSpamFalsePositive for reference. +func (c *Client) ChannelsReportAntiSpamFalsePositive(ctx context.Context, request *ChannelsReportAntiSpamFalsePositiveRequest) (bool, error) { + var result BoolBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_channels_report_anti_spam_false_positive_slices_gen.go b/tg/tl_channels_report_anti_spam_false_positive_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_channels_report_anti_spam_false_positive_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_channels_toggle_anti_spam_gen.go b/tg/tl_channels_toggle_anti_spam_gen.go new file mode 100644 index 0000000000..16d30e9505 --- /dev/null +++ b/tg/tl_channels_toggle_anti_spam_gen.go @@ -0,0 +1,210 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// ChannelsToggleAntiSpamRequest represents TL type `channels.toggleAntiSpam#68f3e4eb`. +// +// See https://core.telegram.org/method/channels.toggleAntiSpam for reference. +type ChannelsToggleAntiSpamRequest struct { + // Channel field of ChannelsToggleAntiSpamRequest. + Channel InputChannelClass + // Enabled field of ChannelsToggleAntiSpamRequest. + Enabled bool +} + +// ChannelsToggleAntiSpamRequestTypeID is TL type id of ChannelsToggleAntiSpamRequest. +const ChannelsToggleAntiSpamRequestTypeID = 0x68f3e4eb + +// Ensuring interfaces in compile-time for ChannelsToggleAntiSpamRequest. +var ( + _ bin.Encoder = &ChannelsToggleAntiSpamRequest{} + _ bin.Decoder = &ChannelsToggleAntiSpamRequest{} + _ bin.BareEncoder = &ChannelsToggleAntiSpamRequest{} + _ bin.BareDecoder = &ChannelsToggleAntiSpamRequest{} +) + +func (t *ChannelsToggleAntiSpamRequest) Zero() bool { + if t == nil { + return true + } + if !(t.Channel == nil) { + return false + } + if !(t.Enabled == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *ChannelsToggleAntiSpamRequest) String() string { + if t == nil { + return "ChannelsToggleAntiSpamRequest(nil)" + } + type Alias ChannelsToggleAntiSpamRequest + return fmt.Sprintf("ChannelsToggleAntiSpamRequest%+v", Alias(*t)) +} + +// FillFrom fills ChannelsToggleAntiSpamRequest from given interface. +func (t *ChannelsToggleAntiSpamRequest) FillFrom(from interface { + GetChannel() (value InputChannelClass) + GetEnabled() (value bool) +}) { + t.Channel = from.GetChannel() + t.Enabled = from.GetEnabled() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChannelsToggleAntiSpamRequest) TypeID() uint32 { + return ChannelsToggleAntiSpamRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChannelsToggleAntiSpamRequest) TypeName() string { + return "channels.toggleAntiSpam" +} + +// TypeInfo returns info about TL type. +func (t *ChannelsToggleAntiSpamRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "channels.toggleAntiSpam", + ID: ChannelsToggleAntiSpamRequestTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Channel", + SchemaName: "channel", + }, + { + Name: "Enabled", + SchemaName: "enabled", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *ChannelsToggleAntiSpamRequest) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode channels.toggleAntiSpam#68f3e4eb as nil") + } + b.PutID(ChannelsToggleAntiSpamRequestTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *ChannelsToggleAntiSpamRequest) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode channels.toggleAntiSpam#68f3e4eb as nil") + } + if t.Channel == nil { + return fmt.Errorf("unable to encode channels.toggleAntiSpam#68f3e4eb: field channel is nil") + } + if err := t.Channel.Encode(b); err != nil { + return fmt.Errorf("unable to encode channels.toggleAntiSpam#68f3e4eb: field channel: %w", err) + } + b.PutBool(t.Enabled) + return nil +} + +// Decode implements bin.Decoder. +func (t *ChannelsToggleAntiSpamRequest) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode channels.toggleAntiSpam#68f3e4eb to nil") + } + if err := b.ConsumeID(ChannelsToggleAntiSpamRequestTypeID); err != nil { + return fmt.Errorf("unable to decode channels.toggleAntiSpam#68f3e4eb: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *ChannelsToggleAntiSpamRequest) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode channels.toggleAntiSpam#68f3e4eb to nil") + } + { + value, err := DecodeInputChannel(b) + if err != nil { + return fmt.Errorf("unable to decode channels.toggleAntiSpam#68f3e4eb: field channel: %w", err) + } + t.Channel = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode channels.toggleAntiSpam#68f3e4eb: field enabled: %w", err) + } + t.Enabled = value + } + return nil +} + +// GetChannel returns value of Channel field. +func (t *ChannelsToggleAntiSpamRequest) GetChannel() (value InputChannelClass) { + if t == nil { + return + } + return t.Channel +} + +// GetEnabled returns value of Enabled field. +func (t *ChannelsToggleAntiSpamRequest) GetEnabled() (value bool) { + if t == nil { + return + } + return t.Enabled +} + +// GetChannelAsNotEmpty returns mapped value of Channel field. +func (t *ChannelsToggleAntiSpamRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, bool) { + return t.Channel.AsNotEmpty() +} + +// ChannelsToggleAntiSpam invokes method channels.toggleAntiSpam#68f3e4eb returning error if any. +// +// See https://core.telegram.org/method/channels.toggleAntiSpam for reference. +func (c *Client) ChannelsToggleAntiSpam(ctx context.Context, request *ChannelsToggleAntiSpamRequest) (UpdatesClass, error) { + var result UpdatesBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.Updates, nil +} diff --git a/tg/tl_channels_toggle_anti_spam_slices_gen.go b/tg/tl_channels_toggle_anti_spam_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_channels_toggle_anti_spam_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_chat_full_gen.go b/tg/tl_chat_full_gen.go index de04a70c7e..e3b87b9994 100644 --- a/tg/tl_chat_full_gen.go +++ b/tg/tl_chat_full_gen.go @@ -1037,6 +1037,8 @@ type ChannelFull struct { Flags2 bin.Fields // Can we delete this channel? CanDeleteChannel bool + // Antispam field of ChannelFull. + Antispam bool // ID of the channel ID int64 // Info about the channel @@ -1254,6 +1256,9 @@ func (c *ChannelFull) Zero() bool { if !(c.CanDeleteChannel == false) { return false } + if !(c.Antispam == false) { + return false + } if !(c.ID == 0) { return false } @@ -1383,6 +1388,7 @@ func (c *ChannelFull) FillFrom(from interface { GetCanViewStats() (value bool) GetBlocked() (value bool) GetCanDeleteChannel() (value bool) + GetAntispam() (value bool) GetID() (value int64) GetAbout() (value string) GetParticipantsCount() (value int, ok bool) @@ -1428,6 +1434,7 @@ func (c *ChannelFull) FillFrom(from interface { c.CanViewStats = from.GetCanViewStats() c.Blocked = from.GetBlocked() c.CanDeleteChannel = from.GetCanDeleteChannel() + c.Antispam = from.GetAntispam() c.ID = from.GetID() c.About = from.GetAbout() if val, ok := from.GetParticipantsCount(); ok { @@ -1611,6 +1618,11 @@ func (c *ChannelFull) TypeInfo() tdp.Type { SchemaName: "can_delete_channel", Null: !c.Flags2.Has(0), }, + { + Name: "Antispam", + SchemaName: "antispam", + Null: !c.Flags2.Has(1), + }, { Name: "ID", SchemaName: "id", @@ -1810,6 +1822,9 @@ func (c *ChannelFull) SetFlags() { if !(c.CanDeleteChannel == false) { c.Flags2.Set(0) } + if !(c.Antispam == false) { + c.Flags2.Set(1) + } if !(c.ParticipantsCount == 0) { c.Flags.Set(0) } @@ -2083,6 +2098,7 @@ func (c *ChannelFull) DecodeBare(b *bin.Buffer) error { } } c.CanDeleteChannel = c.Flags2.Has(0) + c.Antispam = c.Flags2.Has(1) { value, err := b.Long() if err != nil { @@ -2526,6 +2542,25 @@ func (c *ChannelFull) GetCanDeleteChannel() (value bool) { return c.Flags2.Has(0) } +// SetAntispam sets value of Antispam conditional field. +func (c *ChannelFull) SetAntispam(value bool) { + if value { + c.Flags2.Set(1) + c.Antispam = true + } else { + c.Flags2.Unset(1) + c.Antispam = false + } +} + +// GetAntispam returns value of Antispam conditional field. +func (c *ChannelFull) GetAntispam() (value bool) { + if c == nil { + return + } + return c.Flags2.Has(1) +} + // GetID returns value of ID field. func (c *ChannelFull) GetID() (value int64) { if c == nil { diff --git a/tg/tl_contacts_export_contact_token_gen.go b/tg/tl_contacts_export_contact_token_gen.go new file mode 100644 index 0000000000..b07006a6f7 --- /dev/null +++ b/tg/tl_contacts_export_contact_token_gen.go @@ -0,0 +1,141 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// ContactsExportContactTokenRequest represents TL type `contacts.exportContactToken#f8654027`. +// +// See https://core.telegram.org/method/contacts.exportContactToken for reference. +type ContactsExportContactTokenRequest struct { +} + +// ContactsExportContactTokenRequestTypeID is TL type id of ContactsExportContactTokenRequest. +const ContactsExportContactTokenRequestTypeID = 0xf8654027 + +// Ensuring interfaces in compile-time for ContactsExportContactTokenRequest. +var ( + _ bin.Encoder = &ContactsExportContactTokenRequest{} + _ bin.Decoder = &ContactsExportContactTokenRequest{} + _ bin.BareEncoder = &ContactsExportContactTokenRequest{} + _ bin.BareDecoder = &ContactsExportContactTokenRequest{} +) + +func (e *ContactsExportContactTokenRequest) Zero() bool { + if e == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (e *ContactsExportContactTokenRequest) String() string { + if e == nil { + return "ContactsExportContactTokenRequest(nil)" + } + type Alias ContactsExportContactTokenRequest + return fmt.Sprintf("ContactsExportContactTokenRequest%+v", Alias(*e)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ContactsExportContactTokenRequest) TypeID() uint32 { + return ContactsExportContactTokenRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ContactsExportContactTokenRequest) TypeName() string { + return "contacts.exportContactToken" +} + +// TypeInfo returns info about TL type. +func (e *ContactsExportContactTokenRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "contacts.exportContactToken", + ID: ContactsExportContactTokenRequestTypeID, + } + if e == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (e *ContactsExportContactTokenRequest) Encode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode contacts.exportContactToken#f8654027 as nil") + } + b.PutID(ContactsExportContactTokenRequestTypeID) + return e.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (e *ContactsExportContactTokenRequest) EncodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode contacts.exportContactToken#f8654027 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (e *ContactsExportContactTokenRequest) Decode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode contacts.exportContactToken#f8654027 to nil") + } + if err := b.ConsumeID(ContactsExportContactTokenRequestTypeID); err != nil { + return fmt.Errorf("unable to decode contacts.exportContactToken#f8654027: %w", err) + } + return e.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (e *ContactsExportContactTokenRequest) DecodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode contacts.exportContactToken#f8654027 to nil") + } + return nil +} + +// ContactsExportContactToken invokes method contacts.exportContactToken#f8654027 returning error if any. +// +// See https://core.telegram.org/method/contacts.exportContactToken for reference. +func (c *Client) ContactsExportContactToken(ctx context.Context) (*ExportedContactToken, error) { + var result ExportedContactToken + + request := &ContactsExportContactTokenRequest{} + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tg/tl_contacts_export_contact_token_slices_gen.go b/tg/tl_contacts_export_contact_token_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_contacts_export_contact_token_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_contacts_import_contact_token_gen.go b/tg/tl_contacts_import_contact_token_gen.go new file mode 100644 index 0000000000..46fdc317da --- /dev/null +++ b/tg/tl_contacts_import_contact_token_gen.go @@ -0,0 +1,176 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// ContactsImportContactTokenRequest represents TL type `contacts.importContactToken#13005788`. +// +// See https://core.telegram.org/method/contacts.importContactToken for reference. +type ContactsImportContactTokenRequest struct { + // Token field of ContactsImportContactTokenRequest. + Token string +} + +// ContactsImportContactTokenRequestTypeID is TL type id of ContactsImportContactTokenRequest. +const ContactsImportContactTokenRequestTypeID = 0x13005788 + +// Ensuring interfaces in compile-time for ContactsImportContactTokenRequest. +var ( + _ bin.Encoder = &ContactsImportContactTokenRequest{} + _ bin.Decoder = &ContactsImportContactTokenRequest{} + _ bin.BareEncoder = &ContactsImportContactTokenRequest{} + _ bin.BareDecoder = &ContactsImportContactTokenRequest{} +) + +func (i *ContactsImportContactTokenRequest) Zero() bool { + if i == nil { + return true + } + if !(i.Token == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *ContactsImportContactTokenRequest) String() string { + if i == nil { + return "ContactsImportContactTokenRequest(nil)" + } + type Alias ContactsImportContactTokenRequest + return fmt.Sprintf("ContactsImportContactTokenRequest%+v", Alias(*i)) +} + +// FillFrom fills ContactsImportContactTokenRequest from given interface. +func (i *ContactsImportContactTokenRequest) FillFrom(from interface { + GetToken() (value string) +}) { + i.Token = from.GetToken() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ContactsImportContactTokenRequest) TypeID() uint32 { + return ContactsImportContactTokenRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ContactsImportContactTokenRequest) TypeName() string { + return "contacts.importContactToken" +} + +// TypeInfo returns info about TL type. +func (i *ContactsImportContactTokenRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "contacts.importContactToken", + ID: ContactsImportContactTokenRequestTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Token", + SchemaName: "token", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *ContactsImportContactTokenRequest) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode contacts.importContactToken#13005788 as nil") + } + b.PutID(ContactsImportContactTokenRequestTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *ContactsImportContactTokenRequest) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode contacts.importContactToken#13005788 as nil") + } + b.PutString(i.Token) + return nil +} + +// Decode implements bin.Decoder. +func (i *ContactsImportContactTokenRequest) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode contacts.importContactToken#13005788 to nil") + } + if err := b.ConsumeID(ContactsImportContactTokenRequestTypeID); err != nil { + return fmt.Errorf("unable to decode contacts.importContactToken#13005788: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *ContactsImportContactTokenRequest) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode contacts.importContactToken#13005788 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode contacts.importContactToken#13005788: field token: %w", err) + } + i.Token = value + } + return nil +} + +// GetToken returns value of Token field. +func (i *ContactsImportContactTokenRequest) GetToken() (value string) { + if i == nil { + return + } + return i.Token +} + +// ContactsImportContactToken invokes method contacts.importContactToken#13005788 returning error if any. +// +// See https://core.telegram.org/method/contacts.importContactToken for reference. +func (c *Client) ContactsImportContactToken(ctx context.Context, token string) (UserClass, error) { + var result UserBox + + request := &ContactsImportContactTokenRequest{ + Token: token, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.User, nil +} diff --git a/tg/tl_contacts_import_contact_token_slices_gen.go b/tg/tl_contacts_import_contact_token_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_contacts_import_contact_token_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_default_history_ttl_gen.go b/tg/tl_default_history_ttl_gen.go new file mode 100644 index 0000000000..05cddba1bb --- /dev/null +++ b/tg/tl_default_history_ttl_gen.go @@ -0,0 +1,161 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// DefaultHistoryTTL represents TL type `defaultHistoryTTL#43b46b20`. +// +// See https://core.telegram.org/constructor/defaultHistoryTTL for reference. +type DefaultHistoryTTL struct { + // Period field of DefaultHistoryTTL. + Period int +} + +// DefaultHistoryTTLTypeID is TL type id of DefaultHistoryTTL. +const DefaultHistoryTTLTypeID = 0x43b46b20 + +// Ensuring interfaces in compile-time for DefaultHistoryTTL. +var ( + _ bin.Encoder = &DefaultHistoryTTL{} + _ bin.Decoder = &DefaultHistoryTTL{} + _ bin.BareEncoder = &DefaultHistoryTTL{} + _ bin.BareDecoder = &DefaultHistoryTTL{} +) + +func (d *DefaultHistoryTTL) Zero() bool { + if d == nil { + return true + } + if !(d.Period == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (d *DefaultHistoryTTL) String() string { + if d == nil { + return "DefaultHistoryTTL(nil)" + } + type Alias DefaultHistoryTTL + return fmt.Sprintf("DefaultHistoryTTL%+v", Alias(*d)) +} + +// FillFrom fills DefaultHistoryTTL from given interface. +func (d *DefaultHistoryTTL) FillFrom(from interface { + GetPeriod() (value int) +}) { + d.Period = from.GetPeriod() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*DefaultHistoryTTL) TypeID() uint32 { + return DefaultHistoryTTLTypeID +} + +// TypeName returns name of type in TL schema. +func (*DefaultHistoryTTL) TypeName() string { + return "defaultHistoryTTL" +} + +// TypeInfo returns info about TL type. +func (d *DefaultHistoryTTL) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "defaultHistoryTTL", + ID: DefaultHistoryTTLTypeID, + } + if d == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Period", + SchemaName: "period", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (d *DefaultHistoryTTL) Encode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode defaultHistoryTTL#43b46b20 as nil") + } + b.PutID(DefaultHistoryTTLTypeID) + return d.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (d *DefaultHistoryTTL) EncodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode defaultHistoryTTL#43b46b20 as nil") + } + b.PutInt(d.Period) + return nil +} + +// Decode implements bin.Decoder. +func (d *DefaultHistoryTTL) Decode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode defaultHistoryTTL#43b46b20 to nil") + } + if err := b.ConsumeID(DefaultHistoryTTLTypeID); err != nil { + return fmt.Errorf("unable to decode defaultHistoryTTL#43b46b20: %w", err) + } + return d.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (d *DefaultHistoryTTL) DecodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode defaultHistoryTTL#43b46b20 to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode defaultHistoryTTL#43b46b20: field period: %w", err) + } + d.Period = value + } + return nil +} + +// GetPeriod returns value of Period field. +func (d *DefaultHistoryTTL) GetPeriod() (value int) { + if d == nil { + return + } + return d.Period +} diff --git a/tg/tl_default_history_ttl_slices_gen.go b/tg/tl_default_history_ttl_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_default_history_ttl_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_dialog_gen.go b/tg/tl_dialog_gen.go index af1c98f26a..4b78208986 100644 --- a/tg/tl_dialog_gen.go +++ b/tg/tl_dialog_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// Dialog represents TL type `dialog#a8edd0f5`. +// Dialog represents TL type `dialog#d58a08c6`. // Chat // // See https://core.telegram.org/constructor/dialog for reference. @@ -82,10 +82,14 @@ type Dialog struct { // // Use SetFolderID and GetFolderID helpers. FolderID int + // TTLPeriod field of Dialog. + // + // Use SetTTLPeriod and GetTTLPeriod helpers. + TTLPeriod int } // DialogTypeID is TL type id of Dialog. -const DialogTypeID = 0xa8edd0f5 +const DialogTypeID = 0xd58a08c6 // construct implements constructor of DialogClass. func (d Dialog) construct() DialogClass { return &d } @@ -146,6 +150,9 @@ func (d *Dialog) Zero() bool { if !(d.FolderID == 0) { return false } + if !(d.TTLPeriod == 0) { + return false + } return true } @@ -174,6 +181,7 @@ func (d *Dialog) FillFrom(from interface { GetPts() (value int, ok bool) GetDraft() (value DraftMessageClass, ok bool) GetFolderID() (value int, ok bool) + GetTTLPeriod() (value int, ok bool) }) { d.Pinned = from.GetPinned() d.UnreadMark = from.GetUnreadMark() @@ -197,6 +205,10 @@ func (d *Dialog) FillFrom(from interface { d.FolderID = val } + if val, ok := from.GetTTLPeriod(); ok { + d.TTLPeriod = val + } + } // TypeID returns type id in TL schema. @@ -279,6 +291,11 @@ func (d *Dialog) TypeInfo() tdp.Type { SchemaName: "folder_id", Null: !d.Flags.Has(4), }, + { + Name: "TTLPeriod", + SchemaName: "ttl_period", + Null: !d.Flags.Has(5), + }, } return typ } @@ -300,12 +317,15 @@ func (d *Dialog) SetFlags() { if !(d.FolderID == 0) { d.Flags.Set(4) } + if !(d.TTLPeriod == 0) { + d.Flags.Set(5) + } } // Encode implements bin.Encoder. func (d *Dialog) Encode(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't encode dialog#a8edd0f5 as nil") + return fmt.Errorf("can't encode dialog#d58a08c6 as nil") } b.PutID(DialogTypeID) return d.EncodeBare(b) @@ -314,17 +334,17 @@ func (d *Dialog) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (d *Dialog) EncodeBare(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't encode dialog#a8edd0f5 as nil") + return fmt.Errorf("can't encode dialog#d58a08c6 as nil") } d.SetFlags() if err := d.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode dialog#a8edd0f5: field flags: %w", err) + return fmt.Errorf("unable to encode dialog#d58a08c6: field flags: %w", err) } if d.Peer == nil { - return fmt.Errorf("unable to encode dialog#a8edd0f5: field peer is nil") + return fmt.Errorf("unable to encode dialog#d58a08c6: field peer is nil") } if err := d.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode dialog#a8edd0f5: field peer: %w", err) + return fmt.Errorf("unable to encode dialog#d58a08c6: field peer: %w", err) } b.PutInt(d.TopMessage) b.PutInt(d.ReadInboxMaxID) @@ -333,32 +353,35 @@ func (d *Dialog) EncodeBare(b *bin.Buffer) error { b.PutInt(d.UnreadMentionsCount) b.PutInt(d.UnreadReactionsCount) if err := d.NotifySettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode dialog#a8edd0f5: field notify_settings: %w", err) + return fmt.Errorf("unable to encode dialog#d58a08c6: field notify_settings: %w", err) } if d.Flags.Has(0) { b.PutInt(d.Pts) } if d.Flags.Has(1) { if d.Draft == nil { - return fmt.Errorf("unable to encode dialog#a8edd0f5: field draft is nil") + return fmt.Errorf("unable to encode dialog#d58a08c6: field draft is nil") } if err := d.Draft.Encode(b); err != nil { - return fmt.Errorf("unable to encode dialog#a8edd0f5: field draft: %w", err) + return fmt.Errorf("unable to encode dialog#d58a08c6: field draft: %w", err) } } if d.Flags.Has(4) { b.PutInt(d.FolderID) } + if d.Flags.Has(5) { + b.PutInt(d.TTLPeriod) + } return nil } // Decode implements bin.Decoder. func (d *Dialog) Decode(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't decode dialog#a8edd0f5 to nil") + return fmt.Errorf("can't decode dialog#d58a08c6 to nil") } if err := b.ConsumeID(DialogTypeID); err != nil { - return fmt.Errorf("unable to decode dialog#a8edd0f5: %w", err) + return fmt.Errorf("unable to decode dialog#d58a08c6: %w", err) } return d.DecodeBare(b) } @@ -366,11 +389,11 @@ func (d *Dialog) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (d *Dialog) DecodeBare(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't decode dialog#a8edd0f5 to nil") + return fmt.Errorf("can't decode dialog#d58a08c6 to nil") } { if err := d.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode dialog#a8edd0f5: field flags: %w", err) + return fmt.Errorf("unable to decode dialog#d58a08c6: field flags: %w", err) } } d.Pinned = d.Flags.Has(2) @@ -378,78 +401,85 @@ func (d *Dialog) DecodeBare(b *bin.Buffer) error { { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode dialog#a8edd0f5: field peer: %w", err) + return fmt.Errorf("unable to decode dialog#d58a08c6: field peer: %w", err) } d.Peer = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode dialog#a8edd0f5: field top_message: %w", err) + return fmt.Errorf("unable to decode dialog#d58a08c6: field top_message: %w", err) } d.TopMessage = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode dialog#a8edd0f5: field read_inbox_max_id: %w", err) + return fmt.Errorf("unable to decode dialog#d58a08c6: field read_inbox_max_id: %w", err) } d.ReadInboxMaxID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode dialog#a8edd0f5: field read_outbox_max_id: %w", err) + return fmt.Errorf("unable to decode dialog#d58a08c6: field read_outbox_max_id: %w", err) } d.ReadOutboxMaxID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode dialog#a8edd0f5: field unread_count: %w", err) + return fmt.Errorf("unable to decode dialog#d58a08c6: field unread_count: %w", err) } d.UnreadCount = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode dialog#a8edd0f5: field unread_mentions_count: %w", err) + return fmt.Errorf("unable to decode dialog#d58a08c6: field unread_mentions_count: %w", err) } d.UnreadMentionsCount = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode dialog#a8edd0f5: field unread_reactions_count: %w", err) + return fmt.Errorf("unable to decode dialog#d58a08c6: field unread_reactions_count: %w", err) } d.UnreadReactionsCount = value } { if err := d.NotifySettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode dialog#a8edd0f5: field notify_settings: %w", err) + return fmt.Errorf("unable to decode dialog#d58a08c6: field notify_settings: %w", err) } } if d.Flags.Has(0) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode dialog#a8edd0f5: field pts: %w", err) + return fmt.Errorf("unable to decode dialog#d58a08c6: field pts: %w", err) } d.Pts = value } if d.Flags.Has(1) { value, err := DecodeDraftMessage(b) if err != nil { - return fmt.Errorf("unable to decode dialog#a8edd0f5: field draft: %w", err) + return fmt.Errorf("unable to decode dialog#d58a08c6: field draft: %w", err) } d.Draft = value } if d.Flags.Has(4) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode dialog#a8edd0f5: field folder_id: %w", err) + return fmt.Errorf("unable to decode dialog#d58a08c6: field folder_id: %w", err) } d.FolderID = value } + if d.Flags.Has(5) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode dialog#d58a08c6: field ttl_period: %w", err) + } + d.TTLPeriod = value + } return nil } @@ -609,6 +639,24 @@ func (d *Dialog) GetFolderID() (value int, ok bool) { return d.FolderID, true } +// SetTTLPeriod sets value of TTLPeriod conditional field. +func (d *Dialog) SetTTLPeriod(value int) { + d.Flags.Set(5) + d.TTLPeriod = value +} + +// GetTTLPeriod returns value of TTLPeriod conditional field and +// boolean which is true if field was set. +func (d *Dialog) GetTTLPeriod() (value int, ok bool) { + if d == nil { + return + } + if !d.Flags.Has(5) { + return value, false + } + return d.TTLPeriod, true +} + // DialogFolder represents TL type `dialogFolder#71bd134c`. // Dialog in folder // @@ -981,7 +1029,7 @@ const DialogClassName = "Dialog" // panic(err) // } // switch v := g.(type) { -// case *tg.Dialog: // dialog#a8edd0f5 +// case *tg.Dialog: // dialog#d58a08c6 // case *tg.DialogFolder: // dialogFolder#71bd134c // default: panic(v) // } @@ -1031,7 +1079,7 @@ func DecodeDialog(buf *bin.Buffer) (DialogClass, error) { } switch id { case DialogTypeID: - // Decoding dialog#a8edd0f5. + // Decoding dialog#d58a08c6. v := Dialog{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode DialogClass: %w", err) diff --git a/tg/tl_exported_contact_token_gen.go b/tg/tl_exported_contact_token_gen.go new file mode 100644 index 0000000000..e17f6f465b --- /dev/null +++ b/tg/tl_exported_contact_token_gen.go @@ -0,0 +1,188 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// ExportedContactToken represents TL type `exportedContactToken#41bf109b`. +// +// See https://core.telegram.org/constructor/exportedContactToken for reference. +type ExportedContactToken struct { + // URL field of ExportedContactToken. + URL string + // Expires field of ExportedContactToken. + Expires int +} + +// ExportedContactTokenTypeID is TL type id of ExportedContactToken. +const ExportedContactTokenTypeID = 0x41bf109b + +// Ensuring interfaces in compile-time for ExportedContactToken. +var ( + _ bin.Encoder = &ExportedContactToken{} + _ bin.Decoder = &ExportedContactToken{} + _ bin.BareEncoder = &ExportedContactToken{} + _ bin.BareDecoder = &ExportedContactToken{} +) + +func (e *ExportedContactToken) Zero() bool { + if e == nil { + return true + } + if !(e.URL == "") { + return false + } + if !(e.Expires == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (e *ExportedContactToken) String() string { + if e == nil { + return "ExportedContactToken(nil)" + } + type Alias ExportedContactToken + return fmt.Sprintf("ExportedContactToken%+v", Alias(*e)) +} + +// FillFrom fills ExportedContactToken from given interface. +func (e *ExportedContactToken) FillFrom(from interface { + GetURL() (value string) + GetExpires() (value int) +}) { + e.URL = from.GetURL() + e.Expires = from.GetExpires() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ExportedContactToken) TypeID() uint32 { + return ExportedContactTokenTypeID +} + +// TypeName returns name of type in TL schema. +func (*ExportedContactToken) TypeName() string { + return "exportedContactToken" +} + +// TypeInfo returns info about TL type. +func (e *ExportedContactToken) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "exportedContactToken", + ID: ExportedContactTokenTypeID, + } + if e == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "URL", + SchemaName: "url", + }, + { + Name: "Expires", + SchemaName: "expires", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (e *ExportedContactToken) Encode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode exportedContactToken#41bf109b as nil") + } + b.PutID(ExportedContactTokenTypeID) + return e.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (e *ExportedContactToken) EncodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode exportedContactToken#41bf109b as nil") + } + b.PutString(e.URL) + b.PutInt(e.Expires) + return nil +} + +// Decode implements bin.Decoder. +func (e *ExportedContactToken) Decode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode exportedContactToken#41bf109b to nil") + } + if err := b.ConsumeID(ExportedContactTokenTypeID); err != nil { + return fmt.Errorf("unable to decode exportedContactToken#41bf109b: %w", err) + } + return e.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (e *ExportedContactToken) DecodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode exportedContactToken#41bf109b to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode exportedContactToken#41bf109b: field url: %w", err) + } + e.URL = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode exportedContactToken#41bf109b: field expires: %w", err) + } + e.Expires = value + } + return nil +} + +// GetURL returns value of URL field. +func (e *ExportedContactToken) GetURL() (value string) { + if e == nil { + return + } + return e.URL +} + +// GetExpires returns value of Expires field. +func (e *ExportedContactToken) GetExpires() (value int) { + if e == nil { + return + } + return e.Expires +} diff --git a/tg/tl_exported_contact_token_slices_gen.go b/tg/tl_exported_contact_token_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_exported_contact_token_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_forum_topic_gen.go b/tg/tl_forum_topic_gen.go index de9482b270..c734fac269 100644 --- a/tg/tl_forum_topic_gen.go +++ b/tg/tl_forum_topic_gen.go @@ -179,6 +179,8 @@ type ForumTopic struct { Pinned bool // Short field of ForumTopic. Short bool + // Hidden field of ForumTopic. + Hidden bool // ID field of ForumTopic. ID int // Date field of ForumTopic. @@ -248,6 +250,9 @@ func (f *ForumTopic) Zero() bool { if !(f.Short == false) { return false } + if !(f.Hidden == false) { + return false + } if !(f.ID == 0) { return false } @@ -309,6 +314,7 @@ func (f *ForumTopic) FillFrom(from interface { GetClosed() (value bool) GetPinned() (value bool) GetShort() (value bool) + GetHidden() (value bool) GetID() (value int) GetDate() (value int) GetTitle() (value string) @@ -328,6 +334,7 @@ func (f *ForumTopic) FillFrom(from interface { f.Closed = from.GetClosed() f.Pinned = from.GetPinned() f.Short = from.GetShort() + f.Hidden = from.GetHidden() f.ID = from.GetID() f.Date = from.GetDate() f.Title = from.GetTitle() @@ -393,6 +400,11 @@ func (f *ForumTopic) TypeInfo() tdp.Type { SchemaName: "short", Null: !f.Flags.Has(5), }, + { + Name: "Hidden", + SchemaName: "hidden", + Null: !f.Flags.Has(6), + }, { Name: "ID", SchemaName: "id", @@ -469,6 +481,9 @@ func (f *ForumTopic) SetFlags() { if !(f.Short == false) { f.Flags.Set(5) } + if !(f.Hidden == false) { + f.Flags.Set(6) + } if !(f.IconEmojiID == 0) { f.Flags.Set(0) } @@ -553,6 +568,7 @@ func (f *ForumTopic) DecodeBare(b *bin.Buffer) error { f.Closed = f.Flags.Has(2) f.Pinned = f.Flags.Has(3) f.Short = f.Flags.Has(5) + f.Hidden = f.Flags.Has(6) { value, err := b.Int() if err != nil { @@ -728,6 +744,25 @@ func (f *ForumTopic) GetShort() (value bool) { return f.Flags.Has(5) } +// SetHidden sets value of Hidden conditional field. +func (f *ForumTopic) SetHidden(value bool) { + if value { + f.Flags.Set(6) + f.Hidden = true + } else { + f.Flags.Unset(6) + f.Hidden = false + } +} + +// GetHidden returns value of Hidden conditional field. +func (f *ForumTopic) GetHidden() (value bool) { + if f == nil { + return + } + return f.Flags.Has(6) +} + // GetID returns value of ID field. func (f *ForumTopic) GetID() (value int) { if f == nil { diff --git a/tg/tl_message_action_gen.go b/tg/tl_message_action_gen.go index 061bb36aa8..b42b100840 100644 --- a/tg/tl_message_action_gen.go +++ b/tg/tl_message_action_gen.go @@ -4328,17 +4328,23 @@ func (m *MessageActionInviteToGroupCall) GetUsers() (value []int64) { return m.Users } -// MessageActionSetMessagesTTL represents TL type `messageActionSetMessagesTTL#aa1afbfd`. +// MessageActionSetMessagesTTL represents TL type `messageActionSetMessagesTTL#3c134d7b`. // The Time-To-Live of messages in this chat was changed. // // See https://core.telegram.org/constructor/messageActionSetMessagesTTL for reference. type MessageActionSetMessagesTTL struct { + // Flags field of MessageActionSetMessagesTTL. + Flags bin.Fields // New Time-To-Live Period int + // AutoSettingFrom field of MessageActionSetMessagesTTL. + // + // Use SetAutoSettingFrom and GetAutoSettingFrom helpers. + AutoSettingFrom int64 } // MessageActionSetMessagesTTLTypeID is TL type id of MessageActionSetMessagesTTL. -const MessageActionSetMessagesTTLTypeID = 0xaa1afbfd +const MessageActionSetMessagesTTLTypeID = 0x3c134d7b // construct implements constructor of MessageActionClass. func (m MessageActionSetMessagesTTL) construct() MessageActionClass { return &m } @@ -4357,9 +4363,15 @@ func (m *MessageActionSetMessagesTTL) Zero() bool { if m == nil { return true } + if !(m.Flags.Zero()) { + return false + } if !(m.Period == 0) { return false } + if !(m.AutoSettingFrom == 0) { + return false + } return true } @@ -4376,8 +4388,13 @@ func (m *MessageActionSetMessagesTTL) String() string { // FillFrom fills MessageActionSetMessagesTTL from given interface. func (m *MessageActionSetMessagesTTL) FillFrom(from interface { GetPeriod() (value int) + GetAutoSettingFrom() (value int64, ok bool) }) { m.Period = from.GetPeriod() + if val, ok := from.GetAutoSettingFrom(); ok { + m.AutoSettingFrom = val + } + } // TypeID returns type id in TL schema. @@ -4407,14 +4424,26 @@ func (m *MessageActionSetMessagesTTL) TypeInfo() tdp.Type { Name: "Period", SchemaName: "period", }, + { + Name: "AutoSettingFrom", + SchemaName: "auto_setting_from", + Null: !m.Flags.Has(0), + }, } return typ } +// SetFlags sets flags for non-zero fields. +func (m *MessageActionSetMessagesTTL) SetFlags() { + if !(m.AutoSettingFrom == 0) { + m.Flags.Set(0) + } +} + // Encode implements bin.Encoder. func (m *MessageActionSetMessagesTTL) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionSetMessagesTTL#aa1afbfd as nil") + return fmt.Errorf("can't encode messageActionSetMessagesTTL#3c134d7b as nil") } b.PutID(MessageActionSetMessagesTTLTypeID) return m.EncodeBare(b) @@ -4423,19 +4452,26 @@ func (m *MessageActionSetMessagesTTL) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageActionSetMessagesTTL) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionSetMessagesTTL#aa1afbfd as nil") + return fmt.Errorf("can't encode messageActionSetMessagesTTL#3c134d7b as nil") + } + m.SetFlags() + if err := m.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionSetMessagesTTL#3c134d7b: field flags: %w", err) } b.PutInt(m.Period) + if m.Flags.Has(0) { + b.PutLong(m.AutoSettingFrom) + } return nil } // Decode implements bin.Decoder. func (m *MessageActionSetMessagesTTL) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionSetMessagesTTL#aa1afbfd to nil") + return fmt.Errorf("can't decode messageActionSetMessagesTTL#3c134d7b to nil") } if err := b.ConsumeID(MessageActionSetMessagesTTLTypeID); err != nil { - return fmt.Errorf("unable to decode messageActionSetMessagesTTL#aa1afbfd: %w", err) + return fmt.Errorf("unable to decode messageActionSetMessagesTTL#3c134d7b: %w", err) } return m.DecodeBare(b) } @@ -4443,15 +4479,27 @@ func (m *MessageActionSetMessagesTTL) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageActionSetMessagesTTL) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionSetMessagesTTL#aa1afbfd to nil") + return fmt.Errorf("can't decode messageActionSetMessagesTTL#3c134d7b to nil") + } + { + if err := m.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageActionSetMessagesTTL#3c134d7b: field flags: %w", err) + } } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageActionSetMessagesTTL#aa1afbfd: field period: %w", err) + return fmt.Errorf("unable to decode messageActionSetMessagesTTL#3c134d7b: field period: %w", err) } m.Period = value } + if m.Flags.Has(0) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messageActionSetMessagesTTL#3c134d7b: field auto_setting_from: %w", err) + } + m.AutoSettingFrom = value + } return nil } @@ -4463,6 +4511,24 @@ func (m *MessageActionSetMessagesTTL) GetPeriod() (value int) { return m.Period } +// SetAutoSettingFrom sets value of AutoSettingFrom conditional field. +func (m *MessageActionSetMessagesTTL) SetAutoSettingFrom(value int64) { + m.Flags.Set(0) + m.AutoSettingFrom = value +} + +// GetAutoSettingFrom returns value of AutoSettingFrom conditional field and +// boolean which is true if field was set. +func (m *MessageActionSetMessagesTTL) GetAutoSettingFrom() (value int64, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(0) { + return value, false + } + return m.AutoSettingFrom, true +} + // MessageActionGroupCallScheduled represents TL type `messageActionGroupCallScheduled#b3a07661`. // A group call was scheduled // @@ -5598,7 +5664,7 @@ func (m *MessageActionTopicCreate) GetIconEmojiID() (value int64, ok bool) { return m.IconEmojiID, true } -// MessageActionTopicEdit represents TL type `messageActionTopicEdit#b18a431c`. +// MessageActionTopicEdit represents TL type `messageActionTopicEdit#c0944820`. // // See https://core.telegram.org/constructor/messageActionTopicEdit for reference. type MessageActionTopicEdit struct { @@ -5616,10 +5682,14 @@ type MessageActionTopicEdit struct { // // Use SetClosed and GetClosed helpers. Closed bool + // Hidden field of MessageActionTopicEdit. + // + // Use SetHidden and GetHidden helpers. + Hidden bool } // MessageActionTopicEditTypeID is TL type id of MessageActionTopicEdit. -const MessageActionTopicEditTypeID = 0xb18a431c +const MessageActionTopicEditTypeID = 0xc0944820 // construct implements constructor of MessageActionClass. func (m MessageActionTopicEdit) construct() MessageActionClass { return &m } @@ -5650,6 +5720,9 @@ func (m *MessageActionTopicEdit) Zero() bool { if !(m.Closed == false) { return false } + if !(m.Hidden == false) { + return false + } return true } @@ -5668,6 +5741,7 @@ func (m *MessageActionTopicEdit) FillFrom(from interface { GetTitle() (value string, ok bool) GetIconEmojiID() (value int64, ok bool) GetClosed() (value bool, ok bool) + GetHidden() (value bool, ok bool) }) { if val, ok := from.GetTitle(); ok { m.Title = val @@ -5681,6 +5755,10 @@ func (m *MessageActionTopicEdit) FillFrom(from interface { m.Closed = val } + if val, ok := from.GetHidden(); ok { + m.Hidden = val + } + } // TypeID returns type id in TL schema. @@ -5721,6 +5799,11 @@ func (m *MessageActionTopicEdit) TypeInfo() tdp.Type { SchemaName: "closed", Null: !m.Flags.Has(2), }, + { + Name: "Hidden", + SchemaName: "hidden", + Null: !m.Flags.Has(3), + }, } return typ } @@ -5736,12 +5819,15 @@ func (m *MessageActionTopicEdit) SetFlags() { if !(m.Closed == false) { m.Flags.Set(2) } + if !(m.Hidden == false) { + m.Flags.Set(3) + } } // Encode implements bin.Encoder. func (m *MessageActionTopicEdit) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionTopicEdit#b18a431c as nil") + return fmt.Errorf("can't encode messageActionTopicEdit#c0944820 as nil") } b.PutID(MessageActionTopicEditTypeID) return m.EncodeBare(b) @@ -5750,11 +5836,11 @@ func (m *MessageActionTopicEdit) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageActionTopicEdit) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionTopicEdit#b18a431c as nil") + return fmt.Errorf("can't encode messageActionTopicEdit#c0944820 as nil") } m.SetFlags() if err := m.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionTopicEdit#b18a431c: field flags: %w", err) + return fmt.Errorf("unable to encode messageActionTopicEdit#c0944820: field flags: %w", err) } if m.Flags.Has(0) { b.PutString(m.Title) @@ -5765,16 +5851,19 @@ func (m *MessageActionTopicEdit) EncodeBare(b *bin.Buffer) error { if m.Flags.Has(2) { b.PutBool(m.Closed) } + if m.Flags.Has(3) { + b.PutBool(m.Hidden) + } return nil } // Decode implements bin.Decoder. func (m *MessageActionTopicEdit) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionTopicEdit#b18a431c to nil") + return fmt.Errorf("can't decode messageActionTopicEdit#c0944820 to nil") } if err := b.ConsumeID(MessageActionTopicEditTypeID); err != nil { - return fmt.Errorf("unable to decode messageActionTopicEdit#b18a431c: %w", err) + return fmt.Errorf("unable to decode messageActionTopicEdit#c0944820: %w", err) } return m.DecodeBare(b) } @@ -5782,34 +5871,41 @@ func (m *MessageActionTopicEdit) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageActionTopicEdit) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionTopicEdit#b18a431c to nil") + return fmt.Errorf("can't decode messageActionTopicEdit#c0944820 to nil") } { if err := m.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageActionTopicEdit#b18a431c: field flags: %w", err) + return fmt.Errorf("unable to decode messageActionTopicEdit#c0944820: field flags: %w", err) } } if m.Flags.Has(0) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageActionTopicEdit#b18a431c: field title: %w", err) + return fmt.Errorf("unable to decode messageActionTopicEdit#c0944820: field title: %w", err) } m.Title = value } if m.Flags.Has(1) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageActionTopicEdit#b18a431c: field icon_emoji_id: %w", err) + return fmt.Errorf("unable to decode messageActionTopicEdit#c0944820: field icon_emoji_id: %w", err) } m.IconEmojiID = value } if m.Flags.Has(2) { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageActionTopicEdit#b18a431c: field closed: %w", err) + return fmt.Errorf("unable to decode messageActionTopicEdit#c0944820: field closed: %w", err) } m.Closed = value } + if m.Flags.Has(3) { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageActionTopicEdit#c0944820: field hidden: %w", err) + } + m.Hidden = value + } return nil } @@ -5867,6 +5963,24 @@ func (m *MessageActionTopicEdit) GetClosed() (value bool, ok bool) { return m.Closed, true } +// SetHidden sets value of Hidden conditional field. +func (m *MessageActionTopicEdit) SetHidden(value bool) { + m.Flags.Set(3) + m.Hidden = value +} + +// GetHidden returns value of Hidden conditional field and +// boolean which is true if field was set. +func (m *MessageActionTopicEdit) GetHidden() (value bool, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(3) { + return value, false + } + return m.Hidden, true +} + // MessageActionClassName is schema name of MessageActionClass. const MessageActionClassName = "MessageAction" @@ -5907,7 +6021,7 @@ const MessageActionClassName = "MessageAction" // case *tg.MessageActionGeoProximityReached: // messageActionGeoProximityReached#98e0d697 // case *tg.MessageActionGroupCall: // messageActionGroupCall#7a0d7f42 // case *tg.MessageActionInviteToGroupCall: // messageActionInviteToGroupCall#502f92f7 -// case *tg.MessageActionSetMessagesTTL: // messageActionSetMessagesTTL#aa1afbfd +// case *tg.MessageActionSetMessagesTTL: // messageActionSetMessagesTTL#3c134d7b // case *tg.MessageActionGroupCallScheduled: // messageActionGroupCallScheduled#b3a07661 // case *tg.MessageActionSetChatTheme: // messageActionSetChatTheme#aa786345 // case *tg.MessageActionChatJoinedByRequest: // messageActionChatJoinedByRequest#ebbca3cb @@ -5915,7 +6029,7 @@ const MessageActionClassName = "MessageAction" // case *tg.MessageActionWebViewDataSent: // messageActionWebViewDataSent#b4c38cb5 // case *tg.MessageActionGiftPremium: // messageActionGiftPremium#aba0f5c6 // case *tg.MessageActionTopicCreate: // messageActionTopicCreate#d999256 -// case *tg.MessageActionTopicEdit: // messageActionTopicEdit#b18a431c +// case *tg.MessageActionTopicEdit: // messageActionTopicEdit#c0944820 // default: panic(v) // } type MessageActionClass interface { @@ -6127,7 +6241,7 @@ func DecodeMessageAction(buf *bin.Buffer) (MessageActionClass, error) { } return &v, nil case MessageActionSetMessagesTTLTypeID: - // Decoding messageActionSetMessagesTTL#aa1afbfd. + // Decoding messageActionSetMessagesTTL#3c134d7b. v := MessageActionSetMessagesTTL{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) @@ -6183,7 +6297,7 @@ func DecodeMessageAction(buf *bin.Buffer) (MessageActionClass, error) { } return &v, nil case MessageActionTopicEditTypeID: - // Decoding messageActionTopicEdit#b18a431c. + // Decoding messageActionTopicEdit#c0944820. v := MessageActionTopicEdit{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) diff --git a/tg/tl_messages_create_chat_gen.go b/tg/tl_messages_create_chat_gen.go index 168f1763c9..015ccf2fce 100644 --- a/tg/tl_messages_create_chat_gen.go +++ b/tg/tl_messages_create_chat_gen.go @@ -31,19 +31,25 @@ var ( _ = tdjson.Encoder{} ) -// MessagesCreateChatRequest represents TL type `messages.createChat#9cb126e`. +// MessagesCreateChatRequest represents TL type `messages.createChat#34a818`. // Creates a new chat. // // See https://core.telegram.org/method/messages.createChat for reference. type MessagesCreateChatRequest struct { + // Flags field of MessagesCreateChatRequest. + Flags bin.Fields // List of user IDs to be invited Users []InputUserClass // Chat name Title string + // TTLPeriod field of MessagesCreateChatRequest. + // + // Use SetTTLPeriod and GetTTLPeriod helpers. + TTLPeriod int } // MessagesCreateChatRequestTypeID is TL type id of MessagesCreateChatRequest. -const MessagesCreateChatRequestTypeID = 0x9cb126e +const MessagesCreateChatRequestTypeID = 0x34a818 // Ensuring interfaces in compile-time for MessagesCreateChatRequest. var ( @@ -57,12 +63,18 @@ func (c *MessagesCreateChatRequest) Zero() bool { if c == nil { return true } + if !(c.Flags.Zero()) { + return false + } if !(c.Users == nil) { return false } if !(c.Title == "") { return false } + if !(c.TTLPeriod == 0) { + return false + } return true } @@ -80,9 +92,14 @@ func (c *MessagesCreateChatRequest) String() string { func (c *MessagesCreateChatRequest) FillFrom(from interface { GetUsers() (value []InputUserClass) GetTitle() (value string) + GetTTLPeriod() (value int, ok bool) }) { c.Users = from.GetUsers() c.Title = from.GetTitle() + if val, ok := from.GetTTLPeriod(); ok { + c.TTLPeriod = val + } + } // TypeID returns type id in TL schema. @@ -116,14 +133,26 @@ func (c *MessagesCreateChatRequest) TypeInfo() tdp.Type { Name: "Title", SchemaName: "title", }, + { + Name: "TTLPeriod", + SchemaName: "ttl_period", + Null: !c.Flags.Has(0), + }, } return typ } +// SetFlags sets flags for non-zero fields. +func (c *MessagesCreateChatRequest) SetFlags() { + if !(c.TTLPeriod == 0) { + c.Flags.Set(0) + } +} + // Encode implements bin.Encoder. func (c *MessagesCreateChatRequest) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode messages.createChat#9cb126e as nil") + return fmt.Errorf("can't encode messages.createChat#34a818 as nil") } b.PutID(MessagesCreateChatRequestTypeID) return c.EncodeBare(b) @@ -132,28 +161,35 @@ func (c *MessagesCreateChatRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *MessagesCreateChatRequest) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode messages.createChat#9cb126e as nil") + return fmt.Errorf("can't encode messages.createChat#34a818 as nil") + } + c.SetFlags() + if err := c.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.createChat#34a818: field flags: %w", err) } b.PutVectorHeader(len(c.Users)) for idx, v := range c.Users { if v == nil { - return fmt.Errorf("unable to encode messages.createChat#9cb126e: field users element with index %d is nil", idx) + return fmt.Errorf("unable to encode messages.createChat#34a818: field users element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.createChat#9cb126e: field users element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode messages.createChat#34a818: field users element with index %d: %w", idx, err) } } b.PutString(c.Title) + if c.Flags.Has(0) { + b.PutInt(c.TTLPeriod) + } return nil } // Decode implements bin.Decoder. func (c *MessagesCreateChatRequest) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode messages.createChat#9cb126e to nil") + return fmt.Errorf("can't decode messages.createChat#34a818 to nil") } if err := b.ConsumeID(MessagesCreateChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.createChat#9cb126e: %w", err) + return fmt.Errorf("unable to decode messages.createChat#34a818: %w", err) } return c.DecodeBare(b) } @@ -161,12 +197,17 @@ func (c *MessagesCreateChatRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *MessagesCreateChatRequest) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode messages.createChat#9cb126e to nil") + return fmt.Errorf("can't decode messages.createChat#34a818 to nil") + } + { + if err := c.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messages.createChat#34a818: field flags: %w", err) + } } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode messages.createChat#9cb126e: field users: %w", err) + return fmt.Errorf("unable to decode messages.createChat#34a818: field users: %w", err) } if headerLen > 0 { @@ -175,7 +216,7 @@ func (c *MessagesCreateChatRequest) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeInputUser(b) if err != nil { - return fmt.Errorf("unable to decode messages.createChat#9cb126e: field users: %w", err) + return fmt.Errorf("unable to decode messages.createChat#34a818: field users: %w", err) } c.Users = append(c.Users, value) } @@ -183,10 +224,17 @@ func (c *MessagesCreateChatRequest) DecodeBare(b *bin.Buffer) error { { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messages.createChat#9cb126e: field title: %w", err) + return fmt.Errorf("unable to decode messages.createChat#34a818: field title: %w", err) } c.Title = value } + if c.Flags.Has(0) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.createChat#34a818: field ttl_period: %w", err) + } + c.TTLPeriod = value + } return nil } @@ -206,12 +254,30 @@ func (c *MessagesCreateChatRequest) GetTitle() (value string) { return c.Title } +// SetTTLPeriod sets value of TTLPeriod conditional field. +func (c *MessagesCreateChatRequest) SetTTLPeriod(value int) { + c.Flags.Set(0) + c.TTLPeriod = value +} + +// GetTTLPeriod returns value of TTLPeriod conditional field and +// boolean which is true if field was set. +func (c *MessagesCreateChatRequest) GetTTLPeriod() (value int, ok bool) { + if c == nil { + return + } + if !c.Flags.Has(0) { + return value, false + } + return c.TTLPeriod, true +} + // MapUsers returns field Users wrapped in InputUserClassArray helper. func (c *MessagesCreateChatRequest) MapUsers() (value InputUserClassArray) { return InputUserClassArray(c.Users) } -// MessagesCreateChat invokes method messages.createChat#9cb126e returning error if any. +// MessagesCreateChat invokes method messages.createChat#34a818 returning error if any. // Creates a new chat. // // Possible errors: diff --git a/tg/tl_messages_get_default_history_ttl_gen.go b/tg/tl_messages_get_default_history_ttl_gen.go new file mode 100644 index 0000000000..5cc3deb38b --- /dev/null +++ b/tg/tl_messages_get_default_history_ttl_gen.go @@ -0,0 +1,141 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessagesGetDefaultHistoryTTLRequest represents TL type `messages.getDefaultHistoryTTL#658b7188`. +// +// See https://core.telegram.org/method/messages.getDefaultHistoryTTL for reference. +type MessagesGetDefaultHistoryTTLRequest struct { +} + +// MessagesGetDefaultHistoryTTLRequestTypeID is TL type id of MessagesGetDefaultHistoryTTLRequest. +const MessagesGetDefaultHistoryTTLRequestTypeID = 0x658b7188 + +// Ensuring interfaces in compile-time for MessagesGetDefaultHistoryTTLRequest. +var ( + _ bin.Encoder = &MessagesGetDefaultHistoryTTLRequest{} + _ bin.Decoder = &MessagesGetDefaultHistoryTTLRequest{} + _ bin.BareEncoder = &MessagesGetDefaultHistoryTTLRequest{} + _ bin.BareDecoder = &MessagesGetDefaultHistoryTTLRequest{} +) + +func (g *MessagesGetDefaultHistoryTTLRequest) Zero() bool { + if g == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (g *MessagesGetDefaultHistoryTTLRequest) String() string { + if g == nil { + return "MessagesGetDefaultHistoryTTLRequest(nil)" + } + type Alias MessagesGetDefaultHistoryTTLRequest + return fmt.Sprintf("MessagesGetDefaultHistoryTTLRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesGetDefaultHistoryTTLRequest) TypeID() uint32 { + return MessagesGetDefaultHistoryTTLRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesGetDefaultHistoryTTLRequest) TypeName() string { + return "messages.getDefaultHistoryTTL" +} + +// TypeInfo returns info about TL type. +func (g *MessagesGetDefaultHistoryTTLRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.getDefaultHistoryTTL", + ID: MessagesGetDefaultHistoryTTLRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (g *MessagesGetDefaultHistoryTTLRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode messages.getDefaultHistoryTTL#658b7188 as nil") + } + b.PutID(MessagesGetDefaultHistoryTTLRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *MessagesGetDefaultHistoryTTLRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode messages.getDefaultHistoryTTL#658b7188 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (g *MessagesGetDefaultHistoryTTLRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode messages.getDefaultHistoryTTL#658b7188 to nil") + } + if err := b.ConsumeID(MessagesGetDefaultHistoryTTLRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.getDefaultHistoryTTL#658b7188: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *MessagesGetDefaultHistoryTTLRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode messages.getDefaultHistoryTTL#658b7188 to nil") + } + return nil +} + +// MessagesGetDefaultHistoryTTL invokes method messages.getDefaultHistoryTTL#658b7188 returning error if any. +// +// See https://core.telegram.org/method/messages.getDefaultHistoryTTL for reference. +func (c *Client) MessagesGetDefaultHistoryTTL(ctx context.Context) (*DefaultHistoryTTL, error) { + var result DefaultHistoryTTL + + request := &MessagesGetDefaultHistoryTTLRequest{} + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tg/tl_messages_get_default_history_ttl_slices_gen.go b/tg/tl_messages_get_default_history_ttl_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_messages_get_default_history_ttl_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_messages_set_default_history_ttl_gen.go b/tg/tl_messages_set_default_history_ttl_gen.go new file mode 100644 index 0000000000..383fa62a65 --- /dev/null +++ b/tg/tl_messages_set_default_history_ttl_gen.go @@ -0,0 +1,177 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessagesSetDefaultHistoryTTLRequest represents TL type `messages.setDefaultHistoryTTL#9eb51445`. +// +// See https://core.telegram.org/method/messages.setDefaultHistoryTTL for reference. +type MessagesSetDefaultHistoryTTLRequest struct { + // Period field of MessagesSetDefaultHistoryTTLRequest. + Period int +} + +// MessagesSetDefaultHistoryTTLRequestTypeID is TL type id of MessagesSetDefaultHistoryTTLRequest. +const MessagesSetDefaultHistoryTTLRequestTypeID = 0x9eb51445 + +// Ensuring interfaces in compile-time for MessagesSetDefaultHistoryTTLRequest. +var ( + _ bin.Encoder = &MessagesSetDefaultHistoryTTLRequest{} + _ bin.Decoder = &MessagesSetDefaultHistoryTTLRequest{} + _ bin.BareEncoder = &MessagesSetDefaultHistoryTTLRequest{} + _ bin.BareDecoder = &MessagesSetDefaultHistoryTTLRequest{} +) + +func (s *MessagesSetDefaultHistoryTTLRequest) Zero() bool { + if s == nil { + return true + } + if !(s.Period == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *MessagesSetDefaultHistoryTTLRequest) String() string { + if s == nil { + return "MessagesSetDefaultHistoryTTLRequest(nil)" + } + type Alias MessagesSetDefaultHistoryTTLRequest + return fmt.Sprintf("MessagesSetDefaultHistoryTTLRequest%+v", Alias(*s)) +} + +// FillFrom fills MessagesSetDefaultHistoryTTLRequest from given interface. +func (s *MessagesSetDefaultHistoryTTLRequest) FillFrom(from interface { + GetPeriod() (value int) +}) { + s.Period = from.GetPeriod() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesSetDefaultHistoryTTLRequest) TypeID() uint32 { + return MessagesSetDefaultHistoryTTLRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesSetDefaultHistoryTTLRequest) TypeName() string { + return "messages.setDefaultHistoryTTL" +} + +// TypeInfo returns info about TL type. +func (s *MessagesSetDefaultHistoryTTLRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.setDefaultHistoryTTL", + ID: MessagesSetDefaultHistoryTTLRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Period", + SchemaName: "period", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *MessagesSetDefaultHistoryTTLRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode messages.setDefaultHistoryTTL#9eb51445 as nil") + } + b.PutID(MessagesSetDefaultHistoryTTLRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *MessagesSetDefaultHistoryTTLRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode messages.setDefaultHistoryTTL#9eb51445 as nil") + } + b.PutInt(s.Period) + return nil +} + +// Decode implements bin.Decoder. +func (s *MessagesSetDefaultHistoryTTLRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode messages.setDefaultHistoryTTL#9eb51445 to nil") + } + if err := b.ConsumeID(MessagesSetDefaultHistoryTTLRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.setDefaultHistoryTTL#9eb51445: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *MessagesSetDefaultHistoryTTLRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode messages.setDefaultHistoryTTL#9eb51445 to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.setDefaultHistoryTTL#9eb51445: field period: %w", err) + } + s.Period = value + } + return nil +} + +// GetPeriod returns value of Period field. +func (s *MessagesSetDefaultHistoryTTLRequest) GetPeriod() (value int) { + if s == nil { + return + } + return s.Period +} + +// MessagesSetDefaultHistoryTTL invokes method messages.setDefaultHistoryTTL#9eb51445 returning error if any. +// +// See https://core.telegram.org/method/messages.setDefaultHistoryTTL for reference. +func (c *Client) MessagesSetDefaultHistoryTTL(ctx context.Context, period int) (bool, error) { + var result BoolBox + + request := &MessagesSetDefaultHistoryTTLRequest{ + Period: period, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_messages_set_default_history_ttl_slices_gen.go b/tg/tl_messages_set_default_history_ttl_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_messages_set_default_history_ttl_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_registry_gen.go b/tg/tl_registry_gen.go index 0dd019b08a..abb04396b5 100644 --- a/tg/tl_registry_gen.go +++ b/tg/tl_registry_gen.go @@ -32,7 +32,7 @@ var ( ) // Layer version of schema. -const Layer = 149 +const Layer = 150 // TypesMap returns mapping from type ids to TL type names. func TypesMap() map[uint32]string { @@ -167,7 +167,7 @@ func TypesMap() map[uint32]string { MessageActionGeoProximityReachedTypeID: "messageActionGeoProximityReached#98e0d697", MessageActionGroupCallTypeID: "messageActionGroupCall#7a0d7f42", MessageActionInviteToGroupCallTypeID: "messageActionInviteToGroupCall#502f92f7", - MessageActionSetMessagesTTLTypeID: "messageActionSetMessagesTTL#aa1afbfd", + MessageActionSetMessagesTTLTypeID: "messageActionSetMessagesTTL#3c134d7b", MessageActionGroupCallScheduledTypeID: "messageActionGroupCallScheduled#b3a07661", MessageActionSetChatThemeTypeID: "messageActionSetChatTheme#aa786345", MessageActionChatJoinedByRequestTypeID: "messageActionChatJoinedByRequest#ebbca3cb", @@ -175,8 +175,8 @@ func TypesMap() map[uint32]string { MessageActionWebViewDataSentTypeID: "messageActionWebViewDataSent#b4c38cb5", MessageActionGiftPremiumTypeID: "messageActionGiftPremium#aba0f5c6", MessageActionTopicCreateTypeID: "messageActionTopicCreate#d999256", - MessageActionTopicEditTypeID: "messageActionTopicEdit#b18a431c", - DialogTypeID: "dialog#a8edd0f5", + MessageActionTopicEditTypeID: "messageActionTopicEdit#c0944820", + DialogTypeID: "dialog#d58a08c6", DialogFolderTypeID: "dialogFolder#71bd134c", PhotoEmptyTypeID: "photoEmpty#2331b22d", PhotoTypeID: "photo#fb197a65", @@ -606,6 +606,7 @@ func TypesMap() map[uint32]string { AuthCodeTypeCallTypeID: "auth.codeTypeCall#741cd3e3", AuthCodeTypeFlashCallTypeID: "auth.codeTypeFlashCall#226ccefb", AuthCodeTypeMissedCallTypeID: "auth.codeTypeMissedCall#d61ad6ee", + AuthCodeTypeFragmentSMSTypeID: "auth.codeTypeFragmentSms#6ed998c", AuthSentCodeTypeAppTypeID: "auth.sentCodeTypeApp#3dbb5986", AuthSentCodeTypeSMSTypeID: "auth.sentCodeTypeSms#c000bba2", AuthSentCodeTypeCallTypeID: "auth.sentCodeTypeCall#5353e5a7", @@ -613,6 +614,7 @@ func TypesMap() map[uint32]string { AuthSentCodeTypeMissedCallTypeID: "auth.sentCodeTypeMissedCall#82006484", AuthSentCodeTypeEmailCodeTypeID: "auth.sentCodeTypeEmailCode#5a159841", AuthSentCodeTypeSetUpEmailRequiredTypeID: "auth.sentCodeTypeSetUpEmailRequired#a5491dea", + AuthSentCodeTypeFragmentSMSTypeID: "auth.sentCodeTypeFragmentSms#d9565c39", MessagesBotCallbackAnswerTypeID: "messages.botCallbackAnswer#36585ea4", MessagesMessageEditDataTypeID: "messages.messageEditData#26b5dde6", InputBotInlineMessageIDTypeID: "inputBotInlineMessageID#890c3d89", @@ -790,6 +792,7 @@ func TypesMap() map[uint32]string { ChannelAdminLogEventActionEditTopicTypeID: "channelAdminLogEventActionEditTopic#f06fe208", ChannelAdminLogEventActionDeleteTopicTypeID: "channelAdminLogEventActionDeleteTopic#ae168909", ChannelAdminLogEventActionPinTopicTypeID: "channelAdminLogEventActionPinTopic#5d8d353b", + ChannelAdminLogEventActionToggleAntiSpamTypeID: "channelAdminLogEventActionToggleAntiSpam#64f36dfc", ChannelAdminLogEventTypeID: "channelAdminLogEvent#1fad68cd", ChannelsAdminLogResultsTypeID: "channels.adminLogResults#ed8af74d", ChannelAdminLogEventsFilterTypeID: "channelAdminLogEventsFilter#ea107ae4", @@ -1102,6 +1105,8 @@ func TypesMap() map[uint32]string { ForumTopicDeletedTypeID: "forumTopicDeleted#23f109b", ForumTopicTypeID: "forumTopic#71701da9", MessagesForumTopicsTypeID: "messages.forumTopics#367617d3", + DefaultHistoryTTLTypeID: "defaultHistoryTTL#43b46b20", + ExportedContactTokenTypeID: "exportedContactToken#41bf109b", InvokeAfterMsgRequestTypeID: "invokeAfterMsg#cb9f372d", InvokeAfterMsgsRequestTypeID: "invokeAfterMsgs#3dc4b4f0", InitConnectionRequestTypeID: "initConnection#c1cd5ea9", @@ -1128,6 +1133,7 @@ func TypesMap() map[uint32]string { AuthImportLoginTokenRequestTypeID: "auth.importLoginToken#95ac5ce4", AuthAcceptLoginTokenRequestTypeID: "auth.acceptLoginToken#e894ad4d", AuthCheckRecoveryPasswordRequestTypeID: "auth.checkRecoveryPassword#d36bf79", + AuthImportWebTokenAuthorizationRequestTypeID: "auth.importWebTokenAuthorization#2db873a9", AccountRegisterDeviceRequestTypeID: "account.registerDevice#ec86017a", AccountUnregisterDeviceRequestTypeID: "account.unregisterDevice#6a0d3206", AccountUpdateNotifySettingsRequestTypeID: "account.updateNotifySettings#84be5b93", @@ -1234,6 +1240,8 @@ func TypesMap() map[uint32]string { ContactsGetLocatedRequestTypeID: "contacts.getLocated#d348bc44", ContactsBlockFromRepliesRequestTypeID: "contacts.blockFromReplies#29a8962c", ContactsResolvePhoneRequestTypeID: "contacts.resolvePhone#8af94344", + ContactsExportContactTokenRequestTypeID: "contacts.exportContactToken#f8654027", + ContactsImportContactTokenRequestTypeID: "contacts.importContactToken#13005788", MessagesGetMessagesRequestTypeID: "messages.getMessages#63c66506", MessagesGetDialogsRequestTypeID: "messages.getDialogs#a0f4cb4f", MessagesGetHistoryRequestTypeID: "messages.getHistory#4423e6c5", @@ -1255,7 +1263,7 @@ func TypesMap() map[uint32]string { MessagesEditChatPhotoRequestTypeID: "messages.editChatPhoto#35ddd674", MessagesAddChatUserRequestTypeID: "messages.addChatUser#f24753e3", MessagesDeleteChatUserRequestTypeID: "messages.deleteChatUser#a2185cab", - MessagesCreateChatRequestTypeID: "messages.createChat#9cb126e", + MessagesCreateChatRequestTypeID: "messages.createChat#34a818", MessagesGetDhConfigRequestTypeID: "messages.getDhConfig#26cf8950", MessagesRequestEncryptionRequestTypeID: "messages.requestEncryption#f64daf43", MessagesAcceptEncryptionRequestTypeID: "messages.acceptEncryption#3dbc0415", @@ -1411,6 +1419,8 @@ func TypesMap() map[uint32]string { MessagesGetRecentReactionsRequestTypeID: "messages.getRecentReactions#39461db2", MessagesClearRecentReactionsRequestTypeID: "messages.clearRecentReactions#9dfeefb4", MessagesGetExtendedMediaRequestTypeID: "messages.getExtendedMedia#84f80814", + MessagesSetDefaultHistoryTTLRequestTypeID: "messages.setDefaultHistoryTTL#9eb51445", + MessagesGetDefaultHistoryTTLRequestTypeID: "messages.getDefaultHistoryTTL#658b7188", UpdatesGetStateRequestTypeID: "updates.getState#edd4882a", UpdatesGetDifferenceRequestTypeID: "updates.getDifference#25939651", UpdatesGetChannelDifferenceRequestTypeID: "updates.getChannelDifference#3173d78", @@ -1457,7 +1467,7 @@ func TypesMap() map[uint32]string { ChannelsGetParticipantRequestTypeID: "channels.getParticipant#a0ab6cc6", ChannelsGetChannelsRequestTypeID: "channels.getChannels#a7f6bbb", ChannelsGetFullChannelRequestTypeID: "channels.getFullChannel#8736a09", - ChannelsCreateChannelRequestTypeID: "channels.createChannel#3d5fb10f", + ChannelsCreateChannelRequestTypeID: "channels.createChannel#91006707", ChannelsEditAdminRequestTypeID: "channels.editAdmin#d33c8902", ChannelsEditTitleRequestTypeID: "channels.editTitle#566decd0", ChannelsEditPhotoRequestTypeID: "channels.editPhoto#f12e57c9", @@ -1497,10 +1507,12 @@ func TypesMap() map[uint32]string { ChannelsCreateForumTopicRequestTypeID: "channels.createForumTopic#f40c0224", ChannelsGetForumTopicsRequestTypeID: "channels.getForumTopics#de560d1", ChannelsGetForumTopicsByIDRequestTypeID: "channels.getForumTopicsByID#b0831eb9", - ChannelsEditForumTopicRequestTypeID: "channels.editForumTopic#6c883e2d", + ChannelsEditForumTopicRequestTypeID: "channels.editForumTopic#f4dfa185", ChannelsUpdatePinnedForumTopicRequestTypeID: "channels.updatePinnedForumTopic#6c2d9026", ChannelsDeleteTopicHistoryRequestTypeID: "channels.deleteTopicHistory#34435f2d", ChannelsReorderPinnedForumTopicsRequestTypeID: "channels.reorderPinnedForumTopics#2950a18f", + ChannelsToggleAntiSpamRequestTypeID: "channels.toggleAntiSpam#68f3e4eb", + ChannelsReportAntiSpamFalsePositiveRequestTypeID: "channels.reportAntiSpamFalsePositive#a850a693", BotsSendCustomRequestRequestTypeID: "bots.sendCustomRequest#aa2769ed", BotsAnswerWebhookJSONQueryRequestTypeID: "bots.answerWebhookJSONQuery#e6213f4d", BotsSetBotCommandsRequestTypeID: "bots.setBotCommands#517165a", @@ -2159,6 +2171,7 @@ func NamesMap() map[string]uint32 { "auth.codeTypeCall": AuthCodeTypeCallTypeID, "auth.codeTypeFlashCall": AuthCodeTypeFlashCallTypeID, "auth.codeTypeMissedCall": AuthCodeTypeMissedCallTypeID, + "auth.codeTypeFragmentSms": AuthCodeTypeFragmentSMSTypeID, "auth.sentCodeTypeApp": AuthSentCodeTypeAppTypeID, "auth.sentCodeTypeSms": AuthSentCodeTypeSMSTypeID, "auth.sentCodeTypeCall": AuthSentCodeTypeCallTypeID, @@ -2166,6 +2179,7 @@ func NamesMap() map[string]uint32 { "auth.sentCodeTypeMissedCall": AuthSentCodeTypeMissedCallTypeID, "auth.sentCodeTypeEmailCode": AuthSentCodeTypeEmailCodeTypeID, "auth.sentCodeTypeSetUpEmailRequired": AuthSentCodeTypeSetUpEmailRequiredTypeID, + "auth.sentCodeTypeFragmentSms": AuthSentCodeTypeFragmentSMSTypeID, "messages.botCallbackAnswer": MessagesBotCallbackAnswerTypeID, "messages.messageEditData": MessagesMessageEditDataTypeID, "inputBotInlineMessageID": InputBotInlineMessageIDTypeID, @@ -2343,6 +2357,7 @@ func NamesMap() map[string]uint32 { "channelAdminLogEventActionEditTopic": ChannelAdminLogEventActionEditTopicTypeID, "channelAdminLogEventActionDeleteTopic": ChannelAdminLogEventActionDeleteTopicTypeID, "channelAdminLogEventActionPinTopic": ChannelAdminLogEventActionPinTopicTypeID, + "channelAdminLogEventActionToggleAntiSpam": ChannelAdminLogEventActionToggleAntiSpamTypeID, "channelAdminLogEvent": ChannelAdminLogEventTypeID, "channels.adminLogResults": ChannelsAdminLogResultsTypeID, "channelAdminLogEventsFilter": ChannelAdminLogEventsFilterTypeID, @@ -2655,6 +2670,8 @@ func NamesMap() map[string]uint32 { "forumTopicDeleted": ForumTopicDeletedTypeID, "forumTopic": ForumTopicTypeID, "messages.forumTopics": MessagesForumTopicsTypeID, + "defaultHistoryTTL": DefaultHistoryTTLTypeID, + "exportedContactToken": ExportedContactTokenTypeID, "invokeAfterMsg": InvokeAfterMsgRequestTypeID, "invokeAfterMsgs": InvokeAfterMsgsRequestTypeID, "initConnection": InitConnectionRequestTypeID, @@ -2681,6 +2698,7 @@ func NamesMap() map[string]uint32 { "auth.importLoginToken": AuthImportLoginTokenRequestTypeID, "auth.acceptLoginToken": AuthAcceptLoginTokenRequestTypeID, "auth.checkRecoveryPassword": AuthCheckRecoveryPasswordRequestTypeID, + "auth.importWebTokenAuthorization": AuthImportWebTokenAuthorizationRequestTypeID, "account.registerDevice": AccountRegisterDeviceRequestTypeID, "account.unregisterDevice": AccountUnregisterDeviceRequestTypeID, "account.updateNotifySettings": AccountUpdateNotifySettingsRequestTypeID, @@ -2787,6 +2805,8 @@ func NamesMap() map[string]uint32 { "contacts.getLocated": ContactsGetLocatedRequestTypeID, "contacts.blockFromReplies": ContactsBlockFromRepliesRequestTypeID, "contacts.resolvePhone": ContactsResolvePhoneRequestTypeID, + "contacts.exportContactToken": ContactsExportContactTokenRequestTypeID, + "contacts.importContactToken": ContactsImportContactTokenRequestTypeID, "messages.getMessages": MessagesGetMessagesRequestTypeID, "messages.getDialogs": MessagesGetDialogsRequestTypeID, "messages.getHistory": MessagesGetHistoryRequestTypeID, @@ -2964,6 +2984,8 @@ func NamesMap() map[string]uint32 { "messages.getRecentReactions": MessagesGetRecentReactionsRequestTypeID, "messages.clearRecentReactions": MessagesClearRecentReactionsRequestTypeID, "messages.getExtendedMedia": MessagesGetExtendedMediaRequestTypeID, + "messages.setDefaultHistoryTTL": MessagesSetDefaultHistoryTTLRequestTypeID, + "messages.getDefaultHistoryTTL": MessagesGetDefaultHistoryTTLRequestTypeID, "updates.getState": UpdatesGetStateRequestTypeID, "updates.getDifference": UpdatesGetDifferenceRequestTypeID, "updates.getChannelDifference": UpdatesGetChannelDifferenceRequestTypeID, @@ -3054,6 +3076,8 @@ func NamesMap() map[string]uint32 { "channels.updatePinnedForumTopic": ChannelsUpdatePinnedForumTopicRequestTypeID, "channels.deleteTopicHistory": ChannelsDeleteTopicHistoryRequestTypeID, "channels.reorderPinnedForumTopics": ChannelsReorderPinnedForumTopicsRequestTypeID, + "channels.toggleAntiSpam": ChannelsToggleAntiSpamRequestTypeID, + "channels.reportAntiSpamFalsePositive": ChannelsReportAntiSpamFalsePositiveRequestTypeID, "bots.sendCustomRequest": BotsSendCustomRequestRequestTypeID, "bots.answerWebhookJSONQuery": BotsAnswerWebhookJSONQueryRequestTypeID, "bots.setBotCommands": BotsSetBotCommandsRequestTypeID, @@ -3712,6 +3736,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { AuthCodeTypeCallTypeID: func() bin.Object { return &AuthCodeTypeCall{} }, AuthCodeTypeFlashCallTypeID: func() bin.Object { return &AuthCodeTypeFlashCall{} }, AuthCodeTypeMissedCallTypeID: func() bin.Object { return &AuthCodeTypeMissedCall{} }, + AuthCodeTypeFragmentSMSTypeID: func() bin.Object { return &AuthCodeTypeFragmentSMS{} }, AuthSentCodeTypeAppTypeID: func() bin.Object { return &AuthSentCodeTypeApp{} }, AuthSentCodeTypeSMSTypeID: func() bin.Object { return &AuthSentCodeTypeSMS{} }, AuthSentCodeTypeCallTypeID: func() bin.Object { return &AuthSentCodeTypeCall{} }, @@ -3719,6 +3744,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { AuthSentCodeTypeMissedCallTypeID: func() bin.Object { return &AuthSentCodeTypeMissedCall{} }, AuthSentCodeTypeEmailCodeTypeID: func() bin.Object { return &AuthSentCodeTypeEmailCode{} }, AuthSentCodeTypeSetUpEmailRequiredTypeID: func() bin.Object { return &AuthSentCodeTypeSetUpEmailRequired{} }, + AuthSentCodeTypeFragmentSMSTypeID: func() bin.Object { return &AuthSentCodeTypeFragmentSMS{} }, MessagesBotCallbackAnswerTypeID: func() bin.Object { return &MessagesBotCallbackAnswer{} }, MessagesMessageEditDataTypeID: func() bin.Object { return &MessagesMessageEditData{} }, InputBotInlineMessageIDTypeID: func() bin.Object { return &InputBotInlineMessageID{} }, @@ -3896,6 +3922,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ChannelAdminLogEventActionEditTopicTypeID: func() bin.Object { return &ChannelAdminLogEventActionEditTopic{} }, ChannelAdminLogEventActionDeleteTopicTypeID: func() bin.Object { return &ChannelAdminLogEventActionDeleteTopic{} }, ChannelAdminLogEventActionPinTopicTypeID: func() bin.Object { return &ChannelAdminLogEventActionPinTopic{} }, + ChannelAdminLogEventActionToggleAntiSpamTypeID: func() bin.Object { return &ChannelAdminLogEventActionToggleAntiSpam{} }, ChannelAdminLogEventTypeID: func() bin.Object { return &ChannelAdminLogEvent{} }, ChannelsAdminLogResultsTypeID: func() bin.Object { return &ChannelsAdminLogResults{} }, ChannelAdminLogEventsFilterTypeID: func() bin.Object { return &ChannelAdminLogEventsFilter{} }, @@ -4208,6 +4235,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ForumTopicDeletedTypeID: func() bin.Object { return &ForumTopicDeleted{} }, ForumTopicTypeID: func() bin.Object { return &ForumTopic{} }, MessagesForumTopicsTypeID: func() bin.Object { return &MessagesForumTopics{} }, + DefaultHistoryTTLTypeID: func() bin.Object { return &DefaultHistoryTTL{} }, + ExportedContactTokenTypeID: func() bin.Object { return &ExportedContactToken{} }, InvokeAfterMsgRequestTypeID: func() bin.Object { return &InvokeAfterMsgRequest{} }, InvokeAfterMsgsRequestTypeID: func() bin.Object { return &InvokeAfterMsgsRequest{} }, InitConnectionRequestTypeID: func() bin.Object { return &InitConnectionRequest{} }, @@ -4234,6 +4263,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { AuthImportLoginTokenRequestTypeID: func() bin.Object { return &AuthImportLoginTokenRequest{} }, AuthAcceptLoginTokenRequestTypeID: func() bin.Object { return &AuthAcceptLoginTokenRequest{} }, AuthCheckRecoveryPasswordRequestTypeID: func() bin.Object { return &AuthCheckRecoveryPasswordRequest{} }, + AuthImportWebTokenAuthorizationRequestTypeID: func() bin.Object { return &AuthImportWebTokenAuthorizationRequest{} }, AccountRegisterDeviceRequestTypeID: func() bin.Object { return &AccountRegisterDeviceRequest{} }, AccountUnregisterDeviceRequestTypeID: func() bin.Object { return &AccountUnregisterDeviceRequest{} }, AccountUpdateNotifySettingsRequestTypeID: func() bin.Object { return &AccountUpdateNotifySettingsRequest{} }, @@ -4340,6 +4370,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ContactsGetLocatedRequestTypeID: func() bin.Object { return &ContactsGetLocatedRequest{} }, ContactsBlockFromRepliesRequestTypeID: func() bin.Object { return &ContactsBlockFromRepliesRequest{} }, ContactsResolvePhoneRequestTypeID: func() bin.Object { return &ContactsResolvePhoneRequest{} }, + ContactsExportContactTokenRequestTypeID: func() bin.Object { return &ContactsExportContactTokenRequest{} }, + ContactsImportContactTokenRequestTypeID: func() bin.Object { return &ContactsImportContactTokenRequest{} }, MessagesGetMessagesRequestTypeID: func() bin.Object { return &MessagesGetMessagesRequest{} }, MessagesGetDialogsRequestTypeID: func() bin.Object { return &MessagesGetDialogsRequest{} }, MessagesGetHistoryRequestTypeID: func() bin.Object { return &MessagesGetHistoryRequest{} }, @@ -4517,6 +4549,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessagesGetRecentReactionsRequestTypeID: func() bin.Object { return &MessagesGetRecentReactionsRequest{} }, MessagesClearRecentReactionsRequestTypeID: func() bin.Object { return &MessagesClearRecentReactionsRequest{} }, MessagesGetExtendedMediaRequestTypeID: func() bin.Object { return &MessagesGetExtendedMediaRequest{} }, + MessagesSetDefaultHistoryTTLRequestTypeID: func() bin.Object { return &MessagesSetDefaultHistoryTTLRequest{} }, + MessagesGetDefaultHistoryTTLRequestTypeID: func() bin.Object { return &MessagesGetDefaultHistoryTTLRequest{} }, UpdatesGetStateRequestTypeID: func() bin.Object { return &UpdatesGetStateRequest{} }, UpdatesGetDifferenceRequestTypeID: func() bin.Object { return &UpdatesGetDifferenceRequest{} }, UpdatesGetChannelDifferenceRequestTypeID: func() bin.Object { return &UpdatesGetChannelDifferenceRequest{} }, @@ -4607,6 +4641,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ChannelsUpdatePinnedForumTopicRequestTypeID: func() bin.Object { return &ChannelsUpdatePinnedForumTopicRequest{} }, ChannelsDeleteTopicHistoryRequestTypeID: func() bin.Object { return &ChannelsDeleteTopicHistoryRequest{} }, ChannelsReorderPinnedForumTopicsRequestTypeID: func() bin.Object { return &ChannelsReorderPinnedForumTopicsRequest{} }, + ChannelsToggleAntiSpamRequestTypeID: func() bin.Object { return &ChannelsToggleAntiSpamRequest{} }, + ChannelsReportAntiSpamFalsePositiveRequestTypeID: func() bin.Object { return &ChannelsReportAntiSpamFalsePositiveRequest{} }, BotsSendCustomRequestRequestTypeID: func() bin.Object { return &BotsSendCustomRequestRequest{} }, BotsAnswerWebhookJSONQueryRequestTypeID: func() bin.Object { return &BotsAnswerWebhookJSONQueryRequest{} }, BotsSetBotCommandsRequestTypeID: func() bin.Object { return &BotsSetBotCommandsRequest{} }, @@ -4745,6 +4781,7 @@ func ClassConstructorsMap() map[string][]uint32 { AuthCodeTypeCallTypeID, AuthCodeTypeFlashCallTypeID, AuthCodeTypeMissedCallTypeID, + AuthCodeTypeFragmentSMSTypeID, }, AuthLoginTokenClassName: { AuthLoginTokenTypeID, @@ -4759,6 +4796,7 @@ func ClassConstructorsMap() map[string][]uint32 { AuthSentCodeTypeMissedCallTypeID, AuthSentCodeTypeEmailCodeTypeID, AuthSentCodeTypeSetUpEmailRequiredTypeID, + AuthSentCodeTypeFragmentSMSTypeID, }, BaseThemeClassName: { BaseThemeClassicTypeID, @@ -4840,6 +4878,7 @@ func ClassConstructorsMap() map[string][]uint32 { ChannelAdminLogEventActionEditTopicTypeID, ChannelAdminLogEventActionDeleteTopicTypeID, ChannelAdminLogEventActionPinTopicTypeID, + ChannelAdminLogEventActionToggleAntiSpamTypeID, }, ChannelLocationClassName: { ChannelLocationEmptyTypeID, diff --git a/tg/tl_server_gen.go b/tg/tl_server_gen.go index 837205982a..816ab3eceb 100644 --- a/tg/tl_server_gen.go +++ b/tg/tl_server_gen.go @@ -400,6 +400,23 @@ func (s *ServerDispatcher) OnAuthCheckRecoveryPassword(f func(ctx context.Contex s.handlers[AuthCheckRecoveryPasswordRequestTypeID] = handler } +func (s *ServerDispatcher) OnAuthImportWebTokenAuthorization(f func(ctx context.Context, request *AuthImportWebTokenAuthorizationRequest) (AuthAuthorizationClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request AuthImportWebTokenAuthorizationRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return &AuthAuthorizationBox{Authorization: response}, nil + } + + s.handlers[AuthImportWebTokenAuthorizationRequestTypeID] = handler +} + func (s *ServerDispatcher) OnAccountRegisterDevice(f func(ctx context.Context, request *AccountRegisterDeviceRequest) (bool, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request AccountRegisterDeviceRequest @@ -2386,6 +2403,40 @@ func (s *ServerDispatcher) OnContactsResolvePhone(f func(ctx context.Context, ph s.handlers[ContactsResolvePhoneRequestTypeID] = handler } +func (s *ServerDispatcher) OnContactsExportContactToken(f func(ctx context.Context) (*ExportedContactToken, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request ContactsExportContactTokenRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[ContactsExportContactTokenRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnContactsImportContactToken(f func(ctx context.Context, token string) (UserClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request ContactsImportContactTokenRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.Token) + if err != nil { + return nil, err + } + return &UserBox{User: response}, nil + } + + s.handlers[ContactsImportContactTokenRequestTypeID] = handler +} + func (s *ServerDispatcher) OnMessagesGetMessages(f func(ctx context.Context, id []InputMessageClass) (MessagesMessagesClass, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request MessagesGetMessagesRequest @@ -5567,6 +5618,44 @@ func (s *ServerDispatcher) OnMessagesGetExtendedMedia(f func(ctx context.Context s.handlers[MessagesGetExtendedMediaRequestTypeID] = handler } +func (s *ServerDispatcher) OnMessagesSetDefaultHistoryTTL(f func(ctx context.Context, period int) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesSetDefaultHistoryTTLRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.Period) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[MessagesSetDefaultHistoryTTLRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesGetDefaultHistoryTTL(f func(ctx context.Context) (*DefaultHistoryTTL, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesGetDefaultHistoryTTLRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[MessagesGetDefaultHistoryTTLRequestTypeID] = handler +} + func (s *ServerDispatcher) OnUpdatesGetState(f func(ctx context.Context) (*UpdatesState, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request UpdatesGetStateRequest @@ -7173,6 +7262,44 @@ func (s *ServerDispatcher) OnChannelsReorderPinnedForumTopics(f func(ctx context s.handlers[ChannelsReorderPinnedForumTopicsRequestTypeID] = handler } +func (s *ServerDispatcher) OnChannelsToggleAntiSpam(f func(ctx context.Context, request *ChannelsToggleAntiSpamRequest) (UpdatesClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request ChannelsToggleAntiSpamRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return &UpdatesBox{Updates: response}, nil + } + + s.handlers[ChannelsToggleAntiSpamRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnChannelsReportAntiSpamFalsePositive(f func(ctx context.Context, request *ChannelsReportAntiSpamFalsePositiveRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request ChannelsReportAntiSpamFalsePositiveRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[ChannelsReportAntiSpamFalsePositiveRequestTypeID] = handler +} + func (s *ServerDispatcher) OnBotsSendCustomRequest(f func(ctx context.Context, request *BotsSendCustomRequestRequest) (*DataJSON, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request BotsSendCustomRequestRequest