From ba921d41b63b4ce38edb31dab1d68cd914d9057d Mon Sep 17 00:00:00 2001 From: GitHub Date: Wed, 7 Dec 2022 07:44:31 +0000 Subject: [PATCH] feat(schema): update TDLib to the latest layer --- _schema/tdapi.tl | 214 ++++++--- tdapi/tl_authentication_code_type_gen.go | 215 +++++++++ tdapi/tl_chat_event_action_gen.go | 431 +++++++++++++++++- tdapi/tl_chat_filter_gen.go | 6 +- tdapi/tl_chat_member_gen.go | 3 +- tdapi/tl_chat_notification_settings_gen.go | 15 +- tdapi/tl_check_chat_username_result_gen.go | 244 ++++++++-- tdapi/tl_create_new_basic_group_chat_gen.go | 69 ++- tdapi/tl_create_new_supergroup_chat_gen.go | 81 +++- tdapi/tl_edit_forum_topic_gen.go | 80 +++- tdapi/tl_edit_inline_message_caption_gen.go | 2 +- tdapi/tl_edit_message_caption_gen.go | 2 +- tdapi/tl_emoji_status_gen.go | 2 +- tdapi/tl_forum_topic_gen.go | 2 +- tdapi/tl_forum_topic_info_gen.go | 128 ++++-- tdapi/tl_forum_topics_gen.go | 357 +++++++++++++++ tdapi/tl_get_default_message_ttl_gen.go | 169 +++++++ tdapi/tl_get_forum_topic_gen.go | 237 ++++++++++ tdapi/tl_get_forum_topic_link_gen.go | 237 ++++++++++ tdapi/tl_get_forum_topics_gen.go | 377 +++++++++++++++ tdapi/tl_get_payment_receipt_gen.go | 2 +- tdapi/tl_get_user_link_gen.go | 169 +++++++ ...l_group_call_participant_video_info_gen.go | 2 +- tdapi/tl_input_message_content_gen.go | 14 +- tdapi/tl_internal_link_type_gen.go | 181 ++++++++ tdapi/tl_message_content_gen.go | 247 +++++++++- tdapi/tl_message_link_info_gen.go | 4 +- tdapi/tl_message_ttl_gen.go | 193 ++++++++ tdapi/tl_registry_gen.go | 90 +++- ...supergroup_anti_spam_false_positive_gen.go | 237 ++++++++++ tdapi/tl_search_user_by_token_gen.go | 206 +++++++++ ...tl_send_inline_query_result_message_gen.go | 4 +- tdapi/tl_set_bio_gen.go | 2 +- tdapi/tl_set_chat_message_ttl_gen.go | 2 +- tdapi/tl_set_default_message_ttl_gen.go | 207 +++++++++ ...t_forum_topic_notification_settings_gen.go | 272 +++++++++++ tdapi/tl_supergroup_full_info_gen.go | 159 ++++--- ...oggle_general_forum_topic_is_hidden_gen.go | 237 ++++++++++ ...group_call_screen_sharing_is_paused_gen.go | 2 +- ...oup_is_aggressive_anti_spam_enabled_gen.go | 237 ++++++++++ tdapi/tl_toggle_supergroup_is_forum_gen.go | 2 +- tdapi/tl_user_gen.go | 164 ++++--- tdapi/tl_user_link_gen.go | 228 +++++++++ 43 files changed, 5332 insertions(+), 400 deletions(-) create mode 100644 tdapi/tl_forum_topics_gen.go create mode 100644 tdapi/tl_get_default_message_ttl_gen.go create mode 100644 tdapi/tl_get_forum_topic_gen.go create mode 100644 tdapi/tl_get_forum_topic_link_gen.go create mode 100644 tdapi/tl_get_forum_topics_gen.go create mode 100644 tdapi/tl_get_user_link_gen.go create mode 100644 tdapi/tl_message_ttl_gen.go create mode 100644 tdapi/tl_report_supergroup_anti_spam_false_positive_gen.go create mode 100644 tdapi/tl_search_user_by_token_gen.go create mode 100644 tdapi/tl_set_default_message_ttl_gen.go create mode 100644 tdapi/tl_set_forum_topic_notification_settings_gen.go create mode 100644 tdapi/tl_toggle_general_forum_topic_is_hidden_gen.go create mode 100644 tdapi/tl_toggle_supergroup_is_aggressive_anti_spam_enabled_gen.go create mode 100644 tdapi/tl_user_link_gen.go diff --git a/_schema/tdapi.tl b/_schema/tdapi.tl index 47c6d97f13..f4b79877c5 100644 --- a/_schema/tdapi.tl +++ b/_schema/tdapi.tl @@ -1,7 +1,7 @@ // Code generated by ./cmd/dltl, DO NOT EDIT. // // Source: https://raw.githubusercontent.com/tdlib/td/master/td/generate/scheme/td_api.tl -// SHA256: 6e40c1bc5c5e99972909b79fec95d562a7cb2c82959586f6474360d316551017 +// SHA256: bb25dc60dfac402f426abbd3202ff633465a797e9d37f5c64305896ce266b778 double#2210c154 ? = Double; @@ -50,6 +50,11 @@ authenticationCodeTypeFlashCall#533379a2 pattern:string = AuthenticationCodeType //@length Number of digits in the code, excluding the prefix authenticationCodeTypeMissedCall#29bb0a87 phone_number_prefix:string length:int32 = AuthenticationCodeType; +//@description An authentication code is delivered to https://fragment.com. The user must be logged in there via a wallet owning the phone number's NFT +//@url URL to open to receive the code +//@length Length of the code +authenticationCodeTypeFragment#810f74cd url:string length:int32 = AuthenticationCodeType; + //@description Information about the authentication code that was sent //@phone_number A phone number that is being authenticated //@type The way the code was sent to the user @@ -589,7 +594,7 @@ chatAdministratorRights#ad77eac7 can_manage_chat:Bool can_change_info:Bool can_p premiumPaymentOption#8c0c5fb2 currency:string amount:int53 discount_percentage:int32 month_count:int32 store_product_id:string payment_link:InternalLinkType = PremiumPaymentOption; //@description Describes a custom emoji to be shown instead of the Telegram Premium badge -//@custom_emoji_id Identifier of the custom emoji in stickerFormatTgs format. If the custom emoji belongs to the sticker set GetOption("themed_emoji_statuses_sticker_set_id"), then it's color must be changed to the color of the Telegram Premium badge +//@custom_emoji_id Identifier of the custom emoji in stickerFormatTgs format. If the custom emoji belongs to the sticker set getOption("themed_emoji_statuses_sticker_set_id"), then it's color must be changed to the color of the Telegram Premium badge emojiStatus#4118a266 custom_emoji_id:int64 = EmojiStatus; //@description Contains a list of emoji statuses @@ -616,14 +621,15 @@ usernames#bf343063 active_usernames:vector disabled_usernames:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo#3a2d070d photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool can_set_username:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool is_all_history_available:Bool is_aggressive_anti_spam_enabled:Bool sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -1143,16 +1150,16 @@ notificationSettingsScopeGroupChats#483fd1f3 = NotificationSettingsScope; //@description Notification settings applied to all channel chats when the corresponding chat setting has a default value notificationSettingsScopeChannelChats#20aa0588 = NotificationSettingsScope; -//@description Contains information about notification settings for a chat -//@use_default_mute_for If true, mute_for is ignored and the value for the relevant type of chat is used instead +//@description Contains information about notification settings for a chat or a froum topic +//@use_default_mute_for If true, mute_for is ignored and the value for the relevant type of chat or the forum chat is used instead //@mute_for Time left before notifications will be unmuted, in seconds -//@use_default_sound If true, the value for the relevant type of chat is used instead of sound_id +//@use_default_sound If true, the value for the relevant type of chat or the forum chat is used instead of sound_id //@sound_id Identifier of the notification sound to be played; 0 if sound is disabled -//@use_default_show_preview If true, show_preview is ignored and the value for the relevant type of chat is used instead +//@use_default_show_preview If true, show_preview is ignored and the value for the relevant type of chat or the forum chat is used instead //@show_preview True, if message content must be displayed in notifications -//@use_default_disable_pinned_message_notifications If true, disable_pinned_message_notifications is ignored and the value for the relevant type of chat is used instead +//@use_default_disable_pinned_message_notifications If true, disable_pinned_message_notifications is ignored and the value for the relevant type of chat or the forum chat is used instead //@disable_pinned_message_notifications If true, notifications for incoming pinned messages will be created as for an ordinary unread message -//@use_default_disable_mention_notifications If true, disable_mention_notifications is ignored and the value for the relevant type of chat is used instead +//@use_default_disable_mention_notifications If true, disable_mention_notifications is ignored and the value for the relevant type of chat or the forum chat is used instead //@disable_mention_notifications If true, notifications for messages with mentions will be created as for an ordinary unread message chatNotificationSettings#38493760 use_default_mute_for:Bool mute_for:int32 use_default_sound:Bool sound_id:int64 use_default_show_preview:Bool show_preview:Bool use_default_disable_pinned_message_notifications:Bool disable_pinned_message_notifications:Bool use_default_disable_mention_notifications:Bool disable_mention_notifications:Bool = ChatNotificationSettings; @@ -1193,9 +1200,9 @@ chatTypeSecret#3366ab31 secret_chat_id:int32 user_id:int53 = ChatType; //@description Represents a filter of user chats //@title The title of the filter; 1-12 characters without line feeds //@icon_name The chosen icon name for short filter representation. If non-empty, must be one of "All", "Unread", "Unmuted", "Bots", "Channels", "Groups", "Private", "Custom", "Setup", "Cat", "Crown", "Favorite", "Flower", "Game", "Home", "Love", "Mask", "Party", "Sport", "Study", "Trade", "Travel", "Work", "Airplane", "Book", "Light", "Like", "Money", "Note", "Palette". -//@pinned_chat_ids The chat identifiers of pinned chats in the filtered chat list. There can be up to GetOption("chat_filter_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium -//@included_chat_ids The chat identifiers of always included chats in the filtered chat list. There can be up to GetOption("chat_filter_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium -//@excluded_chat_ids The chat identifiers of always excluded chats in the filtered chat list. There can be up to GetOption("chat_filter_chosen_chat_count_max") always excluded non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium +//@pinned_chat_ids The chat identifiers of pinned chats in the filtered chat list. There can be up to getOption("chat_filter_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium +//@included_chat_ids The chat identifiers of always included chats in the filtered chat list. There can be up to getOption("chat_filter_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium +//@excluded_chat_ids The chat identifiers of always excluded chats in the filtered chat list. There can be up to getOption("chat_filter_chosen_chat_count_max") always excluded non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium //@exclude_muted True, if muted chats need to be excluded //@exclude_read True, if read chats need to be excluded //@exclude_archived True, if archived chats need to be excluded @@ -1426,7 +1433,7 @@ inlineKeyboardButton#e9d21e18 text:string type:InlineKeyboardButtonType = Inline //@class ReplyMarkup @description Contains a description of a custom keyboard and actions that can be done with it to quickly reply to bots -//@description Instructs application to remove the keyboard once this message has been received. This kind of keyboard can't be received in an incoming message; instead, UpdateChatReplyMarkup with message_id == 0 will be sent +//@description Instructs application to remove the keyboard once this message has been received. This kind of keyboard can't be received in an incoming message; instead, updateChatReplyMarkup with message_id == 0 will be sent //@is_personal True, if the keyboard is removed only for the mentioned users or the target user of a reply replyMarkupRemoveKeyboard#d6cc5171 is_personal:Bool = ReplyMarkup; @@ -1486,13 +1493,15 @@ forumTopicIcon#cf32a193 color:int32 custom_emoji_id:int64 = ForumTopicIcon; //@icon Icon of the topic //@creation_date Date the topic was created //@creator_id Identifier of the creator of the topic +//@is_general True, if the topic is the General topic list //@is_outgoing True, if the topic was created by the current user //@is_closed True, if the topic is closed -forumTopicInfo#d38f7a5a message_thread_id:int53 name:string icon:forumTopicIcon creation_date:int32 creator_id:MessageSender is_outgoing:Bool is_closed:Bool = ForumTopicInfo; +//@is_hidden True, if the topic is hidden above the topic list and closed; for General topic only +forumTopicInfo#8ff3df9e message_thread_id:int53 name:string icon:forumTopicIcon creation_date:int32 creator_id:MessageSender is_general:Bool is_outgoing:Bool is_closed:Bool is_hidden:Bool = ForumTopicInfo; //@description Describes a forum topic //@info Basic information about the topic -//@last_message Last message in the topic; may be null +//@last_message Last message in the topic; may be null if unknown //@is_pinned True, if the topic is pinned in the topic list //@unread_count Number of unread messages in the topic //@last_read_inbox_message_id Identifier of the last read incoming message @@ -1503,6 +1512,14 @@ forumTopicInfo#d38f7a5a message_thread_id:int53 name:string icon:forumTopicIcon //@draft_message A draft of a message in the topic; may be null forumTopic#1213ace6 info:forumTopicInfo last_message:message is_pinned:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings draft_message:draftMessage = ForumTopic; +//@description Describes a list of forum topics +//@total_count Approximate total number of forum topics found +//@topics List of forum topics +//@next_offset_date Offset date for the next getForumTopics request +//@next_offset_message_id Offset message identifier for the next getForumTopics request +//@next_offset_message_thread_id Offset message thread identifier for the next getForumTopics request +forumTopics#2d99b4ae total_count:int32 topics:vector next_offset_date:int32 next_offset_message_id:int53 next_offset_message_thread_id:int53 = ForumTopics; + //@class RichText @description Describes a text object inside an instant-view web page //@description A plain text @@ -2540,7 +2557,8 @@ messageChatSetTheme#99ae9408 theme_name:string = MessageContent; //@description The TTL (Time To Live) setting for messages in the chat has been changed //@ttl New message TTL -messageChatSetTtl#6be353b1 ttl:int32 = MessageContent; +//@from_user_id If not 0, a user identifier, which default setting was automatically applied +messageChatSetTtl#49e6b31b ttl:int32 from_user_id:int53 = MessageContent; //@description A forum topic has been created //@name Name of the topic @@ -2554,9 +2572,13 @@ messageForumTopicCreated#b8ce47d1 name:string icon:forumTopicIcon = MessageConte messageForumTopicEdited#c0b780 name:string edit_icon_custom_emoji_id:Bool icon_custom_emoji_id:int64 = MessageContent; //@description A forum topic has been closed or opened -//@is_closed True if the topic was closed or reopened +//@is_closed True, if the topic was closed, otherwise the topic was reopened messageForumTopicIsClosedToggled#4b578fe0 is_closed:Bool = MessageContent; +//@description A General forum topic has been hidden or unhidden +//@is_hidden True, if the topic was hidden, otherwise the topic was unhidden +messageForumTopicIsHiddenToggled#979393fe is_hidden:Bool = MessageContent; + //@description A non-standard action has happened in the chat //@text Message text to be shown in the chat messageCustomServiceAction#5595c772 text:string = MessageContent; @@ -2729,7 +2751,7 @@ messageCopyOptions#48076039 send_copy:Bool replace_caption:Bool new_caption:form //@class InputMessageContent @description The content of a message to send //@description A text message -//@text Formatted text to be sent; 1-GetOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually +//@text Formatted text to be sent; 1-getOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually //@disable_web_page_preview True, if rich web page previews for URLs in the message text must be disabled //@clear_draft True, if a chat message draft must be deleted inputMessageText#eb9b098 text:formattedText disable_web_page_preview:Bool clear_draft:Bool = InputMessageContent; @@ -2741,7 +2763,7 @@ inputMessageText#eb9b098 text:formattedText disable_web_page_preview:Bool clear_ //@duration Duration of the animation, in seconds //@width Width of the animation; may be replaced by the server //@height Height of the animation; may be replaced by the server -//@caption Animation caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters +//@caption Animation caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters inputMessageAnimation#11579cfa animation:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 caption:formattedText = InputMessageContent; //@description An audio message @@ -2750,14 +2772,14 @@ inputMessageAnimation#11579cfa animation:InputFile thumbnail:inputThumbnail adde //@duration Duration of the audio, in seconds; may be replaced by the server //@title Title of the audio; 0-64 characters; may be replaced by the server //@performer Performer of the audio; 0-64 characters, may be replaced by the server -//@caption Audio caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters +//@caption Audio caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters inputMessageAudio#daa400b2 audio:InputFile album_cover_thumbnail:inputThumbnail duration:int32 title:string performer:string caption:formattedText = InputMessageContent; //@description A document message (general file) //@document Document to be sent //@thumbnail Document thumbnail; pass null to skip thumbnail uploading //@disable_content_type_detection If true, automatic file type detection will be disabled and the document will always be sent as file. Always true for files sent to secret chats -//@caption Document caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters +//@caption Document caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters inputMessageDocument#615b72b9 document:InputFile thumbnail:inputThumbnail disable_content_type_detection:Bool caption:formattedText = InputMessageContent; //@description A photo message @@ -2766,7 +2788,7 @@ inputMessageDocument#615b72b9 document:InputFile thumbnail:inputThumbnail disabl //@added_sticker_file_ids File identifiers of the stickers added to the photo, if applicable //@width Photo width //@height Photo height -//@caption Photo caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters +//@caption Photo caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters //@ttl Photo TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats inputMessagePhoto#72d8e2dd photo:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector width:int32 height:int32 caption:formattedText ttl:int32 = InputMessageContent; @@ -2786,7 +2808,7 @@ inputMessageSticker#3ff1b6f9 sticker:InputFile thumbnail:inputThumbnail width:in //@width Video width //@height Video height //@supports_streaming True, if the video is supposed to be streamed -//@caption Video caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters +//@caption Video caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters //@ttl Video TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats inputMessageVideo#791281b1 video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText ttl:int32 = InputMessageContent; @@ -2801,7 +2823,7 @@ inputMessageVideoNote#10a2dcfb video_note:InputFile thumbnail:inputThumbnail dur //@voice_note Voice note to be sent //@duration Duration of the voice note, in seconds //@waveform Waveform representation of the voice note in 5-bit format -//@caption Voice note caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters +//@caption Voice note caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters inputMessageVoiceNote#7f58b3e9 voice_note:InputFile duration:int32 waveform:bytes caption:formattedText = InputMessageContent; //@description A message with a location @@ -3191,7 +3213,7 @@ groupCallVideoSourceGroup#4ef8a4af semantics:string source_ids:vector = G //@description Contains information about a group call participant's video channel //@source_groups List of synchronization source groups of the video //@endpoint_id Video channel endpoint identifier -//@is_paused True if the video is paused. This flag needs to be ignored, if new video frames are received +//@is_paused True, if the video is paused. This flag needs to be ignored, if new video frames are received groupCallParticipantVideoInfo#70f7eff6 source_groups:vector endpoint_id:string is_paused:Bool = GroupCallParticipantVideoInfo; //@description Represents a group call participant @@ -3314,7 +3336,7 @@ diceStickersRegular#d3dfecce sticker:sticker = DiceStickers; //@right_reel The animated sticker with the right reel diceStickersSlotMachine#e9a28cac background:sticker lever:sticker left_reel:sticker center_reel:sticker right_reel:sticker = DiceStickers; -//@description Represents the result of an ImportContacts request +//@description Represents the result of an importContacts request //@user_ids User identifiers of the imported contacts in the same order as they were specified in the request; 0 if the contact is not yet a registered user //@importer_count The number of users that imported the corresponding contact; 0 for already registered users or if unavailable importedContacts#1119a03e user_ids:vector importer_count:vector = ImportedContacts; @@ -3365,6 +3387,11 @@ sentWebAppMessage#4a24eec0 inline_message_id:string = SentWebAppMessage; //@url The URL httpUrl#87b775a6 url:string = HttpUrl; +//@description Contains an HTTPS URL, which can be used to get information about a user +//@url The URL +//@expires_in Left time for which the link is valid, in seconds; 0 if the link is a public username link +userLink#1db0fef8 url:string expires_in:int32 = UserLink; + //@class InputInlineQueryResult @description Represents a single result of an inline query; for bots only //@description Represents a link to an animated GIF or an animated (i.e., without sound) H.264/MPEG-4 AVC video @@ -3630,7 +3657,8 @@ chatEventMessageEdited#e64ff5f8 old_message:message new_message:message = ChatEv //@description A message was deleted //@message Deleted message -chatEventMessageDeleted#cac649f7 message:message = ChatEventAction; +//@can_report_anti_spam_false_positive True, if the message deletion can be reported via reportSupergroupAntiSpamFalsePositive +chatEventMessageDeleted#37bfcd73 message:message can_report_anti_spam_false_positive:Bool = ChatEventAction; //@description A message was pinned //@message Pinned message @@ -3748,6 +3776,10 @@ chatEventInvitesToggled#fc45966b can_invite_users:Bool = ChatEventAction; //@is_all_history_available New value of is_all_history_available chatEventIsAllHistoryAvailableToggled#a0b03c15 is_all_history_available:Bool = ChatEventAction; +//@description The is_aggressive_anti_spam_enabled setting of a supergroup was toggled +//@is_aggressive_anti_spam_enabled New value of is_aggressive_anti_spam_enabled +chatEventIsAggressiveAntiSpamEnabledToggled#54a3f196 is_aggressive_anti_spam_enabled:Bool = ChatEventAction; + //@description The sign_messages setting of a channel was toggled //@sign_messages New value of sign_messages chatEventSignMessagesToggled#b1b9281e sign_messages:Bool = ChatEventAction; @@ -3804,6 +3836,10 @@ chatEventForumTopicEdited#60da2c0c old_topic_info:forumTopicInfo new_topic_info: //@topic_info New information about the topic chatEventForumTopicToggleIsClosed#c69e4d3a topic_info:forumTopicInfo = ChatEventAction; +//@description The General forum topic was hidden or unhidden +//@topic_info New information about the topic +chatEventForumTopicToggleIsHidden#a015ef2e topic_info:forumTopicInfo = ChatEventAction; + //@description A forum topic was deleted //@topic_info Information about the topic chatEventForumTopicDeleted#b08f290d topic_info:forumTopicInfo = ChatEventAction; @@ -4173,8 +4209,11 @@ checkChatUsernameResultUsernameInvalid#da087756 = CheckChatUsernameResult; //@description The username is occupied checkChatUsernameResultUsernameOccupied#4ebb3729 = CheckChatUsernameResult; +//@description The username can be purchased at fragment.com +checkChatUsernameResultUsernamePurchasable#59ce59 = CheckChatUsernameResult; + //@description The user has too many chats with username, one of them must be made private first -checkChatUsernameResultPublicChatsTooMuch#3327d23d = CheckChatUsernameResult; +checkChatUsernameResultPublicChatsTooMany#d8b46c7c = CheckChatUsernameResult; //@description The user can't be a member of a public supergroup checkChatUsernameResultPublicGroupsUnavailable#fce914d7 = CheckChatUsernameResult; @@ -4537,6 +4576,10 @@ userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c = UserPrivacySe //@days Number of days of inactivity before the account will be flagged for deletion; 30-366 days accountTtl#4ef23284 days:int32 = AccountTtl; +//@description Contains default message Time To Live setting (self-destruct timer) for new chats +//@ttl Message TTL setting, in seconds. If 0, then messages aren't deleted automatically +messageTtl#80950a73 ttl:int32 = MessageTtl; + //@class SessionType @description Represents the type of a session //@description The session is running on an Android device @@ -4747,7 +4790,7 @@ internalLinkTypeLanguagePack#a9870d6c language_pack_id:string = InternalLinkType //@description The link is a link to the language settings section of the app internalLinkTypeLanguageSettings#b019e6e6 = InternalLinkType; -//@description The link is a link to a Telegram message. Call getMessageLinkInfo with the given URL to process the link +//@description The link is a link to a Telegram message or a forum topic. Call getMessageLinkInfo with the given URL to process the link //@url URL to be passed to getMessageLinkInfo internalLinkTypeMessage#3a535c52 url:string = InternalLinkType; @@ -4817,6 +4860,10 @@ internalLinkTypeUnsupportedProxy#de399f09 = InternalLinkType; //@phone_number Phone number of the user internalLinkTypeUserPhoneNumber#8b6d9a69 phone_number:string = InternalLinkType; +//@description The link is a link to a user by a temporary token. Call searchUserByToken with the given token to process the link +//@token The token +internalLinkTypeUserToken#a8d7db59 token:string = InternalLinkType; + //@description The link is a link to a video chat. Call searchPublicChat with the given chat username, and then joinGroupCall with the given invite hash to process the link //@chat_username Username of the chat with the video chat //@invite_hash If non-empty, invite hash to be used to join the video chat without being muted by administrators @@ -4828,10 +4875,10 @@ internalLinkTypeVideoChat#8796f8b4 chat_username:string invite_hash:string is_li //@is_public True, if the link will work for non-members of the chat messageLink#af4a3aa6 link:string is_public:Bool = MessageLink; -//@description Contains information about a link to a message in a chat +//@description Contains information about a link to a message or a forum topic in a chat //@is_public True, if the link is a public link for a message in a chat //@chat_id If found, identifier of the chat to which the message belongs, 0 otherwise -//@message_thread_id If found, identifier of the message thread in which to open the message, or which to open in case of a missing message +//@message_thread_id If found, identifier of the message thread in which to open the message, or a forum topic to open if the message is missing //@message If found, the linked message; may be null //@media_timestamp Timestamp from which the video/audio/video note/voice note playing must start, in seconds; 0 if not specified. The media can be in the message content or in its web page preview //@for_album True, if the whole media album to which the message belongs is linked @@ -5090,7 +5137,7 @@ fileDownloadedPrefixSize#87e267fb size:int53 = FileDownloadedPrefixSize; //@need_update_application True, if the user must be asked to update the application deepLinkInfo#6f1ba0fe text:formattedText need_update_application:Bool = DeepLinkInfo; -//@class TextParseMode @description Describes the way the text needs to be parsed for TextEntities +//@class TextParseMode @description Describes the way the text needs to be parsed for text entities //@description The text uses Markdown-style formatting //@version Version of the parser: 0 or 1 - Telegram Bot API "Markdown" parse mode, 2 - Telegram Bot API "MarkdownV2" parse mode @@ -5741,7 +5788,7 @@ updateDiceEmojis#9d0f91df emojis:vector = Update; //@sticker The animated sticker to be played updateAnimatedEmojiMessageClicked#a3167405 chat_id:int53 message_id:int53 sticker:sticker = Update; -//@description The parameters of animation search through GetOption("animation_search_bot_username") bot has changed +//@description The parameters of animation search through getOption("animation_search_bot_username") bot has changed //@provider Name of the animation search provider //@emojis The new list of emojis suggested for searching updateAnimationSearchParameters#6016ef01 provider:string emojis:vector = Update; @@ -5985,7 +6032,7 @@ destroy#28d9534a = Ok; //@link A link from a QR code. The link must be scanned by the in-app camera confirmQrCodeAuthentication#e993a72d link:string = Session; -//@description Returns all updates needed to restore current TDLib state, i.e. all actual UpdateAuthorizationState/UpdateUser/UpdateNewChat and others. This is especially useful if TDLib is run in a separate process. Can be called before initialization +//@description Returns all updates needed to restore current TDLib state, i.e. all actual updateAuthorizationState/updateUser/updateNewChat and others. This is especially useful if TDLib is run in a separate process. Can be called before initialization getCurrentState#b8fc6889 = Updates; //@description Changes the database encryption key. Usually the encryption key is never changed and is stored in some OS keychain @@ -6431,7 +6478,7 @@ sendBotStartMessage#aa6a3eee bot_user_id:int53 chat_id:int53 parameter:string = //@options Options to be used to send the message; pass null to use default options //@query_id Identifier of the inline query //@result_id Identifier of the inline result -//@hide_via_bot Pass true to hide the bot, via which the message is sent. Can be used only for bots GetOption("animation_search_bot_username"), GetOption("photo_search_bot_username"), and GetOption("venue_search_bot_username") +//@hide_via_bot Pass true to hide the bot, via which the message is sent. Can be used only for bots getOption("animation_search_bot_username"), getOption("photo_search_bot_username"), and getOption("venue_search_bot_username") sendInlineQueryResultMessage#c774e89c chat_id:int53 message_thread_id:int53 reply_to_message_id:int53 options:messageSendOptions query_id:int64 result_id:string hide_via_bot:Bool = Message; //@description Forwards previously sent messages. Returns the forwarded messages in the same order as the message identifiers passed in message_ids. If a message can't be forwarded, null will be returned instead of the message @@ -6507,7 +6554,7 @@ editMessageMedia#bb4b8713 chat_id:int53 message_id:int53 reply_markup:ReplyMarku //@chat_id The chat the message belongs to //@message_id Identifier of the message //@reply_markup The new message reply markup; pass null if none; for bots only -//@caption New message content caption; 0-GetOption("message_caption_length_max") characters; pass null to remove caption +//@caption New message content caption; 0-getOption("message_caption_length_max") characters; pass null to remove caption editMessageCaption#44d2f92e chat_id:int53 message_id:int53 reply_markup:ReplyMarkup caption:formattedText = Message; //@description Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side @@ -6539,7 +6586,7 @@ editInlineMessageMedia#1676781 inline_message_id:string reply_markup:ReplyMarkup //@description Edits the caption of an inline message sent via a bot; for bots only //@inline_message_id Inline message identifier //@reply_markup The new message reply markup; pass null if none -//@caption New message content caption; pass null to remove caption; 0-GetOption("message_caption_length_max") characters +//@caption New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters editInlineMessageCaption#d2a446b7 inline_message_id:string reply_markup:ReplyMarkup caption:formattedText = Ok; //@description Edits the reply markup of an inline message sent via a bot; for bots only @@ -6565,9 +6612,35 @@ createForumTopic#c1fa28e4 chat_id:int53 name:string icon:forumTopicIcon = ForumT //@description Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics administrator rights in the supergroup unless the user is creator of the topic //@chat_id Identifier of the chat //@message_thread_id Message thread identifier of the forum topic -//@name New name of the topic; 1-128 characters -//@icon_custom_emoji_id Identifier of the new custom emoji for topic icon. Telegram Premium users can use any custom emoji, other users can use only a custom emoji returned by getForumTopicDefaultIcons -editForumTopic#f2c261b0 chat_id:int53 message_thread_id:int53 name:string icon_custom_emoji_id:int64 = Ok; +//@name New name of the topic; 0-128 characters. If empty, the previous topic name is kept +//@edit_icon_custom_emoji Pass true to edit the icon of the topic. Icon of the General topic can't be edited +//@icon_custom_emoji_id Identifier of the new custom emoji for topic icon; pass 0 to remove the custom emoji. Ignored if edit_icon_custom_emoji is false. Telegram Premium users can use any custom emoji, other users can use only a custom emoji returned by getForumTopicDefaultIcons +editForumTopic#a7769060 chat_id:int53 message_thread_id:int53 name:string edit_icon_custom_emoji:Bool icon_custom_emoji_id:int64 = Ok; + +//@description Returns information about a forum topic +//@chat_id Identifier of the chat +//@message_thread_id Message thread identifier of the forum topic +getForumTopic#e59bfe41 chat_id:int53 message_thread_id:int53 = ForumTopic; + +//@description Returns an HTTPS link to a topic in a forum chat. This is an offline request +//@chat_id Identifier of the chat +//@message_thread_id Message thread identifier of the forum topic +getForumTopicLink#a8e6c24b chat_id:int53 message_thread_id:int53 = HttpUrl; + +//@description Returns found forum topics in a forum chat. This is a temporary method for getting information about topic list from the server +//@chat_id Identifier of the forum chat +//@query Query to search for in the forum topic's name +//@offset_date The date starting from which the results need to be fetched. Use 0 or any date in the future to get results from the last topic +//@offset_message_id The message identifier of the last message in the last found topic, or 0 for the first request +//@offset_message_thread_id The message thread identifier of the last found topic, or 0 for the first request +//@limit The maximum number of forum topics to be returned; up to 100. For optimal performance, the number of returned forum topics is chosen by TDLib and can be smaller than the specified limit +getForumTopics#fbab7d5a chat_id:int53 query:string offset_date:int32 offset_message_id:int53 offset_message_thread_id:int53 limit:int32 = ForumTopics; + +//@description Changes the notification settings of a forum topic +//@chat_id Chat identifier +//@message_thread_id Message thread identifier of the forum topic +//@notification_settings New notification settings for the forum topic. If the topic is muted for more than 366 days, it is considered to be muted forever +setForumTopicNotificationSettings#1f433467 chat_id:int53 message_thread_id:int53 notification_settings:chatNotificationSettings = Ok; //@description Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics administrator rights in the supergroup unless the user is creator of the topic //@chat_id Identifier of the chat @@ -6575,6 +6648,11 @@ editForumTopic#f2c261b0 chat_id:int53 message_thread_id:int53 name:string icon_c //@is_closed Pass true to close the topic; pass false to reopen it toggleForumTopicIsClosed#c7648af3 chat_id:int53 message_thread_id:int53 is_closed:Bool = Ok; +//@description Toggles whether a General topic is hidden in a forum supergroup chat; requires can_manage_topics administrator rights in the supergroup +//@chat_id Identifier of the chat +//@is_hidden Pass true to hide and close the General topic; pass false to unhide it +toggleGeneralForumTopicIsHidden#5f1d1448 chat_id:int53 is_hidden:Bool = Ok; + //@description Deletes all messages in a forum topic; requires can_delete_messages administrator rights in the supergroup unless the user is creator of the topic, the topic has no messages from other users and has at most 11 messages //@chat_id Identifier of the chat //@message_thread_id Message thread identifier of the forum topic @@ -6810,7 +6888,7 @@ getGameHighScores#f0459b chat_id:int53 message_id:int53 user_id:int53 = GameHigh //@user_id User identifier getInlineGameHighScores#e0396baa inline_message_id:string user_id:int53 = GameHighScores; -//@description Deletes the default reply markup from a chat. Must be called after a one-time keyboard or a ForceReply reply markup has been used. UpdateChatReplyMarkup will be sent if the reply markup is changed +//@description Deletes the default reply markup from a chat. Must be called after a one-time keyboard or a replyMarkupForceReply reply markup has been used. An updateChatReplyMarkup update will be sent if the reply markup is changed //@chat_id Chat identifier //@message_id The message identifier of the used keyboard deleteChatReplyMarkup#5ff9b5b chat_id:int53 message_id:int53 = Ok; @@ -6899,15 +6977,17 @@ createSecretChat#730dd22f secret_chat_id:int32 = Chat; //@description Creates a new basic group and sends a corresponding messageBasicGroupChatCreate. Returns the newly created chat //@user_ids Identifiers of users to be added to the basic group //@title Title of the new basic group; 1-128 characters -createNewBasicGroupChat#eb575429 user_ids:vector title:string = Chat; +//@message_ttl Message TTL value, in seconds; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically +createNewBasicGroupChat#68be940 user_ids:vector title:string message_ttl:int32 = Chat; //@description Creates a new supergroup or channel and sends a corresponding messageSupergroupChatCreate. Returns the newly created chat //@title Title of the new chat; 1-128 characters //@is_channel Pass true to create a channel chat //@param_description Chat description; 0-255 characters //@location Chat location if a location-based supergroup is being created; pass null to create an ordinary supergroup chat +//@message_ttl Message TTL value, in seconds; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically //@for_import Pass true to create a supergroup for importing messages using importMessage -createNewSupergroupChat#ce83a6c1 title:string is_channel:Bool description:string location:chatLocation for_import:Bool = Chat; +createNewSupergroupChat#d32c5491 title:string is_channel:Bool description:string location:chatLocation message_ttl:int32 for_import:Bool = Chat; //@description Creates a new secret chat. Returns the newly created chat //@user_id Identifier of the target user @@ -6930,7 +7010,7 @@ addChatToList#fb334eb5 chat_id:int53 chat_list:ChatList = Ok; //@chat_filter_id Chat filter identifier getChatFilter#6cdb65eb chat_filter_id:int32 = ChatFilter; -//@description Creates new chat filter. Returns information about the created chat filter. There can be up to GetOption("chat_filter_count_max") chat filters, but the limit can be increased with Telegram Premium +//@description Creates new chat filter. Returns information about the created chat filter. There can be up to getOption("chat_filter_count_max") chat filters, but the limit can be increased with Telegram Premium //@filter Chat filter createChatFilter#2ecaca6 filter:chatFilter = ChatFilterInfo; @@ -6965,9 +7045,9 @@ setChatTitle#9cabebf chat_id:int53 title:string = Ok; //@photo New chat photo; pass null to delete the chat photo setChatPhoto#e97b8d03 chat_id:int53 photo:InputChatPhoto = Ok; -//@description Changes the message TTL in a chat. Requires can_delete_messages administrator right in basic groups, supergroups and channels +//@description Changes the message TTL in a chat. Requires change_info administrator right in basic groups, supergroups and channels //@chat_id Chat identifier -//@ttl New TTL value, in seconds; unless the chat is secret, it must be from 0 up to 365 * 86400 and be divisible by 86400 +//@ttl New TTL value, in seconds; unless the chat is secret, it must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically setChatMessageTtl#a1eb6e79 chat_id:int53 ttl:int32 = Ok; //@description Changes the chat members permissions. Supported only for basic groups and supergroups. Requires can_restrict_members administrator right @@ -7150,7 +7230,7 @@ setScopeNotificationSettings#85cfb63a scope:NotificationSettingsScope notificati //@description Resets all notification settings to their default values. By default, all chats are unmuted and message previews are shown resetAllNotificationSettings#f5a0a8f9 = Ok; -//@description Changes the pinned state of a chat. There can be up to GetOption("pinned_chat_count_max")/GetOption("pinned_archived_chat_count_max") pinned non-secret chats and the same number of secret chats in the main/archive chat list. The limit can be increased with Telegram Premium +//@description Changes the pinned state of a chat. There can be up to getOption("pinned_chat_count_max")/getOption("pinned_archived_chat_count_max") pinned non-secret chats and the same number of secret chats in the main/archive chat list. The limit can be increased with Telegram Premium //@chat_list Chat list in which to change the pinned state of the chat //@chat_id Chat identifier //@is_pinned Pass true to pin the chat; pass false to unpin it @@ -7476,7 +7556,7 @@ startGroupCallScreenSharing#cb4e312d group_call_id:int32 audio_source_id:int32 p //@description Pauses or unpauses screen sharing in a joined group call //@group_call_id Group call identifier -//@is_paused True if screen sharing is paused +//@is_paused True, if screen sharing is paused toggleGroupCallScreenSharingIsPaused#a07b5360 group_call_id:int32 is_paused:Bool = Ok; //@description Ends screen sharing in a joined group call @@ -7804,7 +7884,7 @@ deleteProfilePhoto#4eaa77c1 profile_photo_id:int64 = Ok; setName#66065f10 first_name:string last_name:string = Ok; //@description Changes the bio of the current user -//@bio The new value of the user bio; 0-GetOption("bio_length_max") characters without line feeds +//@bio The new value of the user bio; 0-getOption("bio_length_max") characters without line feeds setBio#9f772354 bio:string = Ok; //@description Changes the editable username of the current user @@ -7825,7 +7905,7 @@ reorderActiveUsernames#c659414f usernames:vector = Ok; //@duration Duration of the status, in seconds; pass 0 to keep the status active until it will be changed manually setEmojiStatus#b1e09a07 emoji_status:emojiStatus duration:int32 = Ok; -//@description Changes the location of the current user. Needs to be called if GetOption("is_location_visible") is true and location changes for more than 1 kilometer +//@description Changes the location of the current user. Needs to be called if getOption("is_location_visible") is true and location changes for more than 1 kilometer //@location The new location of the user setLocation#5993371 location:location = Ok; @@ -7841,6 +7921,13 @@ resendChangePhoneNumberCode#d11acfa4 = AuthenticationCodeInfo; //@code Authentication code to check checkChangePhoneNumberCode#9976a263 code:string = Ok; +//@description Returns an HTTPS link, which can be used to get information about the current user +getUserLink#492014e6 = UserLink; + +//@description Searches a user by a token from the user's link +//@token Token to search for +searchUserByToken#d841f436 token:string = User; + //@description Sets the list of commands supported by the bot for the given user scope and language; for bots only //@scope The scope to which the commands are relevant; pass null to change commands in the default bot command scope //@language_code A two-letter ISO 639-1 language code. If empty, the commands will be applied to all users from the given scope, for which language there are no dedicated commands @@ -7953,9 +8040,14 @@ toggleSupergroupJoinByRequest#7ddf9fde supergroup_id:int53 join_by_request:Bool //@is_all_history_available The new value of is_all_history_available toggleSupergroupIsAllHistoryAvailable#44d9964e supergroup_id:int53 is_all_history_available:Bool = Ok; +//@description Toggles whether aggressive anti-spam checks are enabled in the supergroup; requires can_delete_messages administrator right. Can be called only if the supergroup has at least getOption("aggressive_anti_spam_supergroup_member_count_min") members +//@supergroup_id The identifier of the supergroup, which isn't a broadcast group +//@is_aggressive_anti_spam_enabled The new value of is_aggressive_anti_spam_enabled +toggleSupergroupIsAggressiveAntiSpamEnabled#a87019f8 supergroup_id:int53 is_aggressive_anti_spam_enabled:Bool = Ok; + //@description Toggles whether the supergroup is a forum; requires owner privileges in the supergroup //@supergroup_id Identifier of the supergroup -//@is_forum New value of is_forum. A supergroup can be converted to a forum, only if it has at least GetOption("forum_member_count_min") members +//@is_forum New value of is_forum. A supergroup can be converted to a forum, only if it has at least getOption("forum_member_count_min") members toggleSupergroupIsForum#966f960a supergroup_id:int53 is_forum:Bool = Ok; //@description Upgrades supergroup to a broadcast group; requires owner privileges in the supergroup @@ -7967,6 +8059,11 @@ toggleSupergroupIsBroadcastGroup#34b22215 supergroup_id:int53 = Ok; //@message_ids Identifiers of messages to report reportSupergroupSpam#383e26f2 supergroup_id:int53 message_ids:vector = Ok; +//@description Reports a false deletion of a message by aggressive anti-spam checks; requires administrator rights in the supergroup. Can be called only for messages from chatEventMessageDeleted with can_report_anti_spam_false_positive == true +//@supergroup_id Supergroup identifier +//@message_id Identifier of the erroneously deleted message +reportSupergroupAntiSpamFalsePositive#e13db048 supergroup_id:int53 message_id:int53 = Ok; + //@description Returns information about members or banned users in a supergroup or channel. Can be used only if supergroupFullInfo.can_get_members == true; additionally, administrator privileges may be required for some filters //@supergroup_id Identifier of the supergroup or channel //@filter The type of users to return; pass null to use supergroupMembersFilterRecent @@ -8008,7 +8105,7 @@ validateOrderInfo#b5985fcf input_invoice:InputInvoice order_info:orderInfo allow sendPaymentForm#c66e388a input_invoice:InputInvoice payment_form_id:int64 order_info_id:string shipping_option_id:string credentials:InputCredentials tip_amount:int53 = PaymentResult; //@description Returns information about a successful payment -//@chat_id Chat identifier of the PaymentSuccessful message +//@chat_id Chat identifier of the messagePaymentSuccessful message //@message_id Message identifier getPaymentReceipt#3c6cb956 chat_id:int53 message_id:int53 = PaymentReceipt; @@ -8140,6 +8237,13 @@ getAccountTtl#e58a8b77 = AccountTtl; //@password The 2-step verification password of the current user. If not specified, account deletion can be canceled within one week deleteAccount#533276c6 reason:string password:string = Ok; +//@description Changes the default message Time To Live setting (self-destruct timer) for new chats +//@ttl New message TTL; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically +setDefaultMessageTtl#90bd2287 ttl:messageTtl = Ok; + +//@description Returns default message Time To Live setting (self-destruct timer) for new chats +getDefaultMessageTtl#2e8b7d3e = MessageTtl; + //@description Removes a chat action bar without any other action //@chat_id Chat identifier removeChatActionBar#9d9839fa chat_id:int53 = Ok; diff --git a/tdapi/tl_authentication_code_type_gen.go b/tdapi/tl_authentication_code_type_gen.go index e4930a38a8..74abd872c2 100644 --- a/tdapi/tl_authentication_code_type_gen.go +++ b/tdapi/tl_authentication_code_type_gen.go @@ -895,6 +895,206 @@ func (a *AuthenticationCodeTypeMissedCall) GetLength() (value int32) { return a.Length } +// AuthenticationCodeTypeFragment represents TL type `authenticationCodeTypeFragment#810f74cd`. +type AuthenticationCodeTypeFragment struct { + // URL to open to receive the code + URL string + // Length of the code + Length int32 +} + +// AuthenticationCodeTypeFragmentTypeID is TL type id of AuthenticationCodeTypeFragment. +const AuthenticationCodeTypeFragmentTypeID = 0x810f74cd + +// construct implements constructor of AuthenticationCodeTypeClass. +func (a AuthenticationCodeTypeFragment) construct() AuthenticationCodeTypeClass { return &a } + +// Ensuring interfaces in compile-time for AuthenticationCodeTypeFragment. +var ( + _ bin.Encoder = &AuthenticationCodeTypeFragment{} + _ bin.Decoder = &AuthenticationCodeTypeFragment{} + _ bin.BareEncoder = &AuthenticationCodeTypeFragment{} + _ bin.BareDecoder = &AuthenticationCodeTypeFragment{} + + _ AuthenticationCodeTypeClass = &AuthenticationCodeTypeFragment{} +) + +func (a *AuthenticationCodeTypeFragment) Zero() bool { + if a == nil { + return true + } + if !(a.URL == "") { + return false + } + if !(a.Length == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (a *AuthenticationCodeTypeFragment) String() string { + if a == nil { + return "AuthenticationCodeTypeFragment(nil)" + } + type Alias AuthenticationCodeTypeFragment + return fmt.Sprintf("AuthenticationCodeTypeFragment%+v", Alias(*a)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AuthenticationCodeTypeFragment) TypeID() uint32 { + return AuthenticationCodeTypeFragmentTypeID +} + +// TypeName returns name of type in TL schema. +func (*AuthenticationCodeTypeFragment) TypeName() string { + return "authenticationCodeTypeFragment" +} + +// TypeInfo returns info about TL type. +func (a *AuthenticationCodeTypeFragment) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "authenticationCodeTypeFragment", + ID: AuthenticationCodeTypeFragmentTypeID, + } + if a == 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 (a *AuthenticationCodeTypeFragment) Encode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode authenticationCodeTypeFragment#810f74cd as nil") + } + b.PutID(AuthenticationCodeTypeFragmentTypeID) + return a.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (a *AuthenticationCodeTypeFragment) EncodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode authenticationCodeTypeFragment#810f74cd as nil") + } + b.PutString(a.URL) + b.PutInt32(a.Length) + return nil +} + +// Decode implements bin.Decoder. +func (a *AuthenticationCodeTypeFragment) Decode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode authenticationCodeTypeFragment#810f74cd to nil") + } + if err := b.ConsumeID(AuthenticationCodeTypeFragmentTypeID); err != nil { + return fmt.Errorf("unable to decode authenticationCodeTypeFragment#810f74cd: %w", err) + } + return a.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (a *AuthenticationCodeTypeFragment) DecodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode authenticationCodeTypeFragment#810f74cd to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode authenticationCodeTypeFragment#810f74cd: field url: %w", err) + } + a.URL = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode authenticationCodeTypeFragment#810f74cd: field length: %w", err) + } + a.Length = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (a *AuthenticationCodeTypeFragment) EncodeTDLibJSON(b tdjson.Encoder) error { + if a == nil { + return fmt.Errorf("can't encode authenticationCodeTypeFragment#810f74cd as nil") + } + b.ObjStart() + b.PutID("authenticationCodeTypeFragment") + b.Comma() + b.FieldStart("url") + b.PutString(a.URL) + b.Comma() + b.FieldStart("length") + b.PutInt32(a.Length) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (a *AuthenticationCodeTypeFragment) DecodeTDLibJSON(b tdjson.Decoder) error { + if a == nil { + return fmt.Errorf("can't decode authenticationCodeTypeFragment#810f74cd to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("authenticationCodeTypeFragment"); err != nil { + return fmt.Errorf("unable to decode authenticationCodeTypeFragment#810f74cd: %w", err) + } + case "url": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode authenticationCodeTypeFragment#810f74cd: field url: %w", err) + } + a.URL = value + case "length": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode authenticationCodeTypeFragment#810f74cd: field length: %w", err) + } + a.Length = value + default: + return b.Skip() + } + return nil + }) +} + +// GetURL returns value of URL field. +func (a *AuthenticationCodeTypeFragment) GetURL() (value string) { + if a == nil { + return + } + return a.URL +} + +// GetLength returns value of Length field. +func (a *AuthenticationCodeTypeFragment) GetLength() (value int32) { + if a == nil { + return + } + return a.Length +} + // AuthenticationCodeTypeClassName is schema name of AuthenticationCodeTypeClass. const AuthenticationCodeTypeClassName = "AuthenticationCodeType" @@ -912,6 +1112,7 @@ const AuthenticationCodeTypeClassName = "AuthenticationCodeType" // case *tdapi.AuthenticationCodeTypeCall: // authenticationCodeTypeCall#61876c67 // case *tdapi.AuthenticationCodeTypeFlashCall: // authenticationCodeTypeFlashCall#533379a2 // case *tdapi.AuthenticationCodeTypeMissedCall: // authenticationCodeTypeMissedCall#29bb0a87 +// case *tdapi.AuthenticationCodeTypeFragment: // authenticationCodeTypeFragment#810f74cd // default: panic(v) // } type AuthenticationCodeTypeClass interface { @@ -978,6 +1179,13 @@ func DecodeAuthenticationCodeType(buf *bin.Buffer) (AuthenticationCodeTypeClass, return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) } return &v, nil + case AuthenticationCodeTypeFragmentTypeID: + // Decoding authenticationCodeTypeFragment#810f74cd. + v := AuthenticationCodeTypeFragment{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", bin.NewUnexpectedID(id)) } @@ -1025,6 +1233,13 @@ func DecodeTDLibJSONAuthenticationCodeType(buf tdjson.Decoder) (AuthenticationCo return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) } return &v, nil + case "authenticationCodeTypeFragment": + // Decoding authenticationCodeTypeFragment#810f74cd. + v := AuthenticationCodeTypeFragment{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", tdjson.NewUnexpectedID(id)) } diff --git a/tdapi/tl_chat_event_action_gen.go b/tdapi/tl_chat_event_action_gen.go index f32c8223cb..ae915f6ad3 100644 --- a/tdapi/tl_chat_event_action_gen.go +++ b/tdapi/tl_chat_event_action_gen.go @@ -231,14 +231,17 @@ func (c *ChatEventMessageEdited) GetNewMessage() (value Message) { return c.NewMessage } -// ChatEventMessageDeleted represents TL type `chatEventMessageDeleted#cac649f7`. +// ChatEventMessageDeleted represents TL type `chatEventMessageDeleted#37bfcd73`. type ChatEventMessageDeleted struct { // Deleted message Message Message + // True, if the message deletion can be reported via + // reportSupergroupAntiSpamFalsePositive + CanReportAntiSpamFalsePositive bool } // ChatEventMessageDeletedTypeID is TL type id of ChatEventMessageDeleted. -const ChatEventMessageDeletedTypeID = 0xcac649f7 +const ChatEventMessageDeletedTypeID = 0x37bfcd73 // construct implements constructor of ChatEventActionClass. func (c ChatEventMessageDeleted) construct() ChatEventActionClass { return &c } @@ -260,6 +263,9 @@ func (c *ChatEventMessageDeleted) Zero() bool { if !(c.Message.Zero()) { return false } + if !(c.CanReportAntiSpamFalsePositive == false) { + return false + } return true } @@ -300,6 +306,10 @@ func (c *ChatEventMessageDeleted) TypeInfo() tdp.Type { Name: "Message", SchemaName: "message", }, + { + Name: "CanReportAntiSpamFalsePositive", + SchemaName: "can_report_anti_spam_false_positive", + }, } return typ } @@ -307,7 +317,7 @@ func (c *ChatEventMessageDeleted) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *ChatEventMessageDeleted) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventMessageDeleted#cac649f7 as nil") + return fmt.Errorf("can't encode chatEventMessageDeleted#37bfcd73 as nil") } b.PutID(ChatEventMessageDeletedTypeID) return c.EncodeBare(b) @@ -316,21 +326,22 @@ func (c *ChatEventMessageDeleted) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatEventMessageDeleted) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventMessageDeleted#cac649f7 as nil") + return fmt.Errorf("can't encode chatEventMessageDeleted#37bfcd73 as nil") } if err := c.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventMessageDeleted#cac649f7: field message: %w", err) + return fmt.Errorf("unable to encode chatEventMessageDeleted#37bfcd73: field message: %w", err) } + b.PutBool(c.CanReportAntiSpamFalsePositive) return nil } // Decode implements bin.Decoder. func (c *ChatEventMessageDeleted) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventMessageDeleted#cac649f7 to nil") + return fmt.Errorf("can't decode chatEventMessageDeleted#37bfcd73 to nil") } if err := b.ConsumeID(ChatEventMessageDeletedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventMessageDeleted#cac649f7: %w", err) + return fmt.Errorf("unable to decode chatEventMessageDeleted#37bfcd73: %w", err) } return c.DecodeBare(b) } @@ -338,12 +349,19 @@ func (c *ChatEventMessageDeleted) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatEventMessageDeleted) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventMessageDeleted#cac649f7 to nil") + return fmt.Errorf("can't decode chatEventMessageDeleted#37bfcd73 to nil") } { if err := c.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventMessageDeleted#cac649f7: field message: %w", err) + return fmt.Errorf("unable to decode chatEventMessageDeleted#37bfcd73: field message: %w", err) + } + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatEventMessageDeleted#37bfcd73: field can_report_anti_spam_false_positive: %w", err) } + c.CanReportAntiSpamFalsePositive = value } return nil } @@ -351,16 +369,19 @@ func (c *ChatEventMessageDeleted) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *ChatEventMessageDeleted) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatEventMessageDeleted#cac649f7 as nil") + return fmt.Errorf("can't encode chatEventMessageDeleted#37bfcd73 as nil") } b.ObjStart() b.PutID("chatEventMessageDeleted") b.Comma() b.FieldStart("message") if err := c.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventMessageDeleted#cac649f7: field message: %w", err) + return fmt.Errorf("unable to encode chatEventMessageDeleted#37bfcd73: field message: %w", err) } b.Comma() + b.FieldStart("can_report_anti_spam_false_positive") + b.PutBool(c.CanReportAntiSpamFalsePositive) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -369,19 +390,25 @@ func (c *ChatEventMessageDeleted) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *ChatEventMessageDeleted) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatEventMessageDeleted#cac649f7 to nil") + return fmt.Errorf("can't decode chatEventMessageDeleted#37bfcd73 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("chatEventMessageDeleted"); err != nil { - return fmt.Errorf("unable to decode chatEventMessageDeleted#cac649f7: %w", err) + return fmt.Errorf("unable to decode chatEventMessageDeleted#37bfcd73: %w", err) } case "message": if err := c.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventMessageDeleted#cac649f7: field message: %w", err) + return fmt.Errorf("unable to decode chatEventMessageDeleted#37bfcd73: field message: %w", err) + } + case "can_report_anti_spam_false_positive": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatEventMessageDeleted#37bfcd73: field can_report_anti_spam_false_positive: %w", err) } + c.CanReportAntiSpamFalsePositive = value default: return b.Skip() } @@ -397,6 +424,14 @@ func (c *ChatEventMessageDeleted) GetMessage() (value Message) { return c.Message } +// GetCanReportAntiSpamFalsePositive returns value of CanReportAntiSpamFalsePositive field. +func (c *ChatEventMessageDeleted) GetCanReportAntiSpamFalsePositive() (value bool) { + if c == nil { + return + } + return c.CanReportAntiSpamFalsePositive +} + // ChatEventMessagePinned represents TL type `chatEventMessagePinned#1a26ad1a`. type ChatEventMessagePinned struct { // Pinned message @@ -5217,6 +5252,172 @@ func (c *ChatEventIsAllHistoryAvailableToggled) GetIsAllHistoryAvailable() (valu return c.IsAllHistoryAvailable } +// ChatEventIsAggressiveAntiSpamEnabledToggled represents TL type `chatEventIsAggressiveAntiSpamEnabledToggled#54a3f196`. +type ChatEventIsAggressiveAntiSpamEnabledToggled struct { + // New value of is_aggressive_anti_spam_enabled + IsAggressiveAntiSpamEnabled bool +} + +// ChatEventIsAggressiveAntiSpamEnabledToggledTypeID is TL type id of ChatEventIsAggressiveAntiSpamEnabledToggled. +const ChatEventIsAggressiveAntiSpamEnabledToggledTypeID = 0x54a3f196 + +// construct implements constructor of ChatEventActionClass. +func (c ChatEventIsAggressiveAntiSpamEnabledToggled) construct() ChatEventActionClass { return &c } + +// Ensuring interfaces in compile-time for ChatEventIsAggressiveAntiSpamEnabledToggled. +var ( + _ bin.Encoder = &ChatEventIsAggressiveAntiSpamEnabledToggled{} + _ bin.Decoder = &ChatEventIsAggressiveAntiSpamEnabledToggled{} + _ bin.BareEncoder = &ChatEventIsAggressiveAntiSpamEnabledToggled{} + _ bin.BareDecoder = &ChatEventIsAggressiveAntiSpamEnabledToggled{} + + _ ChatEventActionClass = &ChatEventIsAggressiveAntiSpamEnabledToggled{} +) + +func (c *ChatEventIsAggressiveAntiSpamEnabledToggled) Zero() bool { + if c == nil { + return true + } + if !(c.IsAggressiveAntiSpamEnabled == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChatEventIsAggressiveAntiSpamEnabledToggled) String() string { + if c == nil { + return "ChatEventIsAggressiveAntiSpamEnabledToggled(nil)" + } + type Alias ChatEventIsAggressiveAntiSpamEnabledToggled + return fmt.Sprintf("ChatEventIsAggressiveAntiSpamEnabledToggled%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChatEventIsAggressiveAntiSpamEnabledToggled) TypeID() uint32 { + return ChatEventIsAggressiveAntiSpamEnabledToggledTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChatEventIsAggressiveAntiSpamEnabledToggled) TypeName() string { + return "chatEventIsAggressiveAntiSpamEnabledToggled" +} + +// TypeInfo returns info about TL type. +func (c *ChatEventIsAggressiveAntiSpamEnabledToggled) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "chatEventIsAggressiveAntiSpamEnabledToggled", + ID: ChatEventIsAggressiveAntiSpamEnabledToggledTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "IsAggressiveAntiSpamEnabled", + SchemaName: "is_aggressive_anti_spam_enabled", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChatEventIsAggressiveAntiSpamEnabledToggled) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatEventIsAggressiveAntiSpamEnabledToggled#54a3f196 as nil") + } + b.PutID(ChatEventIsAggressiveAntiSpamEnabledToggledTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChatEventIsAggressiveAntiSpamEnabledToggled) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatEventIsAggressiveAntiSpamEnabledToggled#54a3f196 as nil") + } + b.PutBool(c.IsAggressiveAntiSpamEnabled) + return nil +} + +// Decode implements bin.Decoder. +func (c *ChatEventIsAggressiveAntiSpamEnabledToggled) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatEventIsAggressiveAntiSpamEnabledToggled#54a3f196 to nil") + } + if err := b.ConsumeID(ChatEventIsAggressiveAntiSpamEnabledToggledTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventIsAggressiveAntiSpamEnabledToggled#54a3f196: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChatEventIsAggressiveAntiSpamEnabledToggled) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatEventIsAggressiveAntiSpamEnabledToggled#54a3f196 to nil") + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatEventIsAggressiveAntiSpamEnabledToggled#54a3f196: field is_aggressive_anti_spam_enabled: %w", err) + } + c.IsAggressiveAntiSpamEnabled = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatEventIsAggressiveAntiSpamEnabledToggled) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatEventIsAggressiveAntiSpamEnabledToggled#54a3f196 as nil") + } + b.ObjStart() + b.PutID("chatEventIsAggressiveAntiSpamEnabledToggled") + b.Comma() + b.FieldStart("is_aggressive_anti_spam_enabled") + b.PutBool(c.IsAggressiveAntiSpamEnabled) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ChatEventIsAggressiveAntiSpamEnabledToggled) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode chatEventIsAggressiveAntiSpamEnabledToggled#54a3f196 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("chatEventIsAggressiveAntiSpamEnabledToggled"); err != nil { + return fmt.Errorf("unable to decode chatEventIsAggressiveAntiSpamEnabledToggled#54a3f196: %w", err) + } + case "is_aggressive_anti_spam_enabled": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatEventIsAggressiveAntiSpamEnabledToggled#54a3f196: field is_aggressive_anti_spam_enabled: %w", err) + } + c.IsAggressiveAntiSpamEnabled = value + default: + return b.Skip() + } + return nil + }) +} + +// GetIsAggressiveAntiSpamEnabled returns value of IsAggressiveAntiSpamEnabled field. +func (c *ChatEventIsAggressiveAntiSpamEnabledToggled) GetIsAggressiveAntiSpamEnabled() (value bool) { + if c == nil { + return + } + return c.IsAggressiveAntiSpamEnabled +} + // ChatEventSignMessagesToggled represents TL type `chatEventSignMessagesToggled#b1b9281e`. type ChatEventSignMessagesToggled struct { // New value of sign_messages @@ -7533,6 +7734,172 @@ func (c *ChatEventForumTopicToggleIsClosed) GetTopicInfo() (value ForumTopicInfo return c.TopicInfo } +// ChatEventForumTopicToggleIsHidden represents TL type `chatEventForumTopicToggleIsHidden#a015ef2e`. +type ChatEventForumTopicToggleIsHidden struct { + // New information about the topic + TopicInfo ForumTopicInfo +} + +// ChatEventForumTopicToggleIsHiddenTypeID is TL type id of ChatEventForumTopicToggleIsHidden. +const ChatEventForumTopicToggleIsHiddenTypeID = 0xa015ef2e + +// construct implements constructor of ChatEventActionClass. +func (c ChatEventForumTopicToggleIsHidden) construct() ChatEventActionClass { return &c } + +// Ensuring interfaces in compile-time for ChatEventForumTopicToggleIsHidden. +var ( + _ bin.Encoder = &ChatEventForumTopicToggleIsHidden{} + _ bin.Decoder = &ChatEventForumTopicToggleIsHidden{} + _ bin.BareEncoder = &ChatEventForumTopicToggleIsHidden{} + _ bin.BareDecoder = &ChatEventForumTopicToggleIsHidden{} + + _ ChatEventActionClass = &ChatEventForumTopicToggleIsHidden{} +) + +func (c *ChatEventForumTopicToggleIsHidden) Zero() bool { + if c == nil { + return true + } + if !(c.TopicInfo.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChatEventForumTopicToggleIsHidden) String() string { + if c == nil { + return "ChatEventForumTopicToggleIsHidden(nil)" + } + type Alias ChatEventForumTopicToggleIsHidden + return fmt.Sprintf("ChatEventForumTopicToggleIsHidden%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChatEventForumTopicToggleIsHidden) TypeID() uint32 { + return ChatEventForumTopicToggleIsHiddenTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChatEventForumTopicToggleIsHidden) TypeName() string { + return "chatEventForumTopicToggleIsHidden" +} + +// TypeInfo returns info about TL type. +func (c *ChatEventForumTopicToggleIsHidden) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "chatEventForumTopicToggleIsHidden", + ID: ChatEventForumTopicToggleIsHiddenTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "TopicInfo", + SchemaName: "topic_info", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChatEventForumTopicToggleIsHidden) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatEventForumTopicToggleIsHidden#a015ef2e as nil") + } + b.PutID(ChatEventForumTopicToggleIsHiddenTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChatEventForumTopicToggleIsHidden) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatEventForumTopicToggleIsHidden#a015ef2e as nil") + } + if err := c.TopicInfo.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatEventForumTopicToggleIsHidden#a015ef2e: field topic_info: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (c *ChatEventForumTopicToggleIsHidden) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatEventForumTopicToggleIsHidden#a015ef2e to nil") + } + if err := b.ConsumeID(ChatEventForumTopicToggleIsHiddenTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventForumTopicToggleIsHidden#a015ef2e: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChatEventForumTopicToggleIsHidden) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatEventForumTopicToggleIsHidden#a015ef2e to nil") + } + { + if err := c.TopicInfo.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatEventForumTopicToggleIsHidden#a015ef2e: field topic_info: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatEventForumTopicToggleIsHidden) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatEventForumTopicToggleIsHidden#a015ef2e as nil") + } + b.ObjStart() + b.PutID("chatEventForumTopicToggleIsHidden") + b.Comma() + b.FieldStart("topic_info") + if err := c.TopicInfo.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatEventForumTopicToggleIsHidden#a015ef2e: field topic_info: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ChatEventForumTopicToggleIsHidden) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode chatEventForumTopicToggleIsHidden#a015ef2e to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("chatEventForumTopicToggleIsHidden"); err != nil { + return fmt.Errorf("unable to decode chatEventForumTopicToggleIsHidden#a015ef2e: %w", err) + } + case "topic_info": + if err := c.TopicInfo.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode chatEventForumTopicToggleIsHidden#a015ef2e: field topic_info: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetTopicInfo returns value of TopicInfo field. +func (c *ChatEventForumTopicToggleIsHidden) GetTopicInfo() (value ForumTopicInfo) { + if c == nil { + return + } + return c.TopicInfo +} + // ChatEventForumTopicDeleted represents TL type `chatEventForumTopicDeleted#b08f290d`. type ChatEventForumTopicDeleted struct { // Information about the topic @@ -7912,7 +8279,7 @@ const ChatEventActionClassName = "ChatEventAction" // } // switch v := g.(type) { // case *tdapi.ChatEventMessageEdited: // chatEventMessageEdited#e64ff5f8 -// case *tdapi.ChatEventMessageDeleted: // chatEventMessageDeleted#cac649f7 +// case *tdapi.ChatEventMessageDeleted: // chatEventMessageDeleted#37bfcd73 // case *tdapi.ChatEventMessagePinned: // chatEventMessagePinned#1a26ad1a // case *tdapi.ChatEventMessageUnpinned: // chatEventMessageUnpinned#e9943b17 // case *tdapi.ChatEventPollStopped: // chatEventPollStopped#77cc8be5 @@ -7938,6 +8305,7 @@ const ChatEventActionClassName = "ChatEventAction" // case *tdapi.ChatEventHasProtectedContentToggled: // chatEventHasProtectedContentToggled#f5044201 // case *tdapi.ChatEventInvitesToggled: // chatEventInvitesToggled#fc45966b // case *tdapi.ChatEventIsAllHistoryAvailableToggled: // chatEventIsAllHistoryAvailableToggled#a0b03c15 +// case *tdapi.ChatEventIsAggressiveAntiSpamEnabledToggled: // chatEventIsAggressiveAntiSpamEnabledToggled#54a3f196 // case *tdapi.ChatEventSignMessagesToggled: // chatEventSignMessagesToggled#b1b9281e // case *tdapi.ChatEventInviteLinkEdited: // chatEventInviteLinkEdited#e4920d62 // case *tdapi.ChatEventInviteLinkRevoked: // chatEventInviteLinkRevoked#a1dbffe3 @@ -7951,6 +8319,7 @@ const ChatEventActionClassName = "ChatEventAction" // case *tdapi.ChatEventForumTopicCreated: // chatEventForumTopicCreated#7785fb42 // case *tdapi.ChatEventForumTopicEdited: // chatEventForumTopicEdited#60da2c0c // case *tdapi.ChatEventForumTopicToggleIsClosed: // chatEventForumTopicToggleIsClosed#c69e4d3a +// case *tdapi.ChatEventForumTopicToggleIsHidden: // chatEventForumTopicToggleIsHidden#a015ef2e // case *tdapi.ChatEventForumTopicDeleted: // chatEventForumTopicDeleted#b08f290d // case *tdapi.ChatEventForumTopicPinned: // chatEventForumTopicPinned#7fc523ee // default: panic(v) @@ -7992,7 +8361,7 @@ func DecodeChatEventAction(buf *bin.Buffer) (ChatEventActionClass, error) { } return &v, nil case ChatEventMessageDeletedTypeID: - // Decoding chatEventMessageDeleted#cac649f7. + // Decoding chatEventMessageDeleted#37bfcd73. v := ChatEventMessageDeleted{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) @@ -8173,6 +8542,13 @@ func DecodeChatEventAction(buf *bin.Buffer) (ChatEventActionClass, error) { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil + case ChatEventIsAggressiveAntiSpamEnabledToggledTypeID: + // Decoding chatEventIsAggressiveAntiSpamEnabledToggled#54a3f196. + v := ChatEventIsAggressiveAntiSpamEnabledToggled{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) + } + return &v, nil case ChatEventSignMessagesToggledTypeID: // Decoding chatEventSignMessagesToggled#b1b9281e. v := ChatEventSignMessagesToggled{} @@ -8264,6 +8640,13 @@ func DecodeChatEventAction(buf *bin.Buffer) (ChatEventActionClass, error) { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil + case ChatEventForumTopicToggleIsHiddenTypeID: + // Decoding chatEventForumTopicToggleIsHidden#a015ef2e. + v := ChatEventForumTopicToggleIsHidden{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) + } + return &v, nil case ChatEventForumTopicDeletedTypeID: // Decoding chatEventForumTopicDeleted#b08f290d. v := ChatEventForumTopicDeleted{} @@ -8298,7 +8681,7 @@ func DecodeTDLibJSONChatEventAction(buf tdjson.Decoder) (ChatEventActionClass, e } return &v, nil case "chatEventMessageDeleted": - // Decoding chatEventMessageDeleted#cac649f7. + // Decoding chatEventMessageDeleted#37bfcd73. v := ChatEventMessageDeleted{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) @@ -8479,6 +8862,13 @@ func DecodeTDLibJSONChatEventAction(buf tdjson.Decoder) (ChatEventActionClass, e return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil + case "chatEventIsAggressiveAntiSpamEnabledToggled": + // Decoding chatEventIsAggressiveAntiSpamEnabledToggled#54a3f196. + v := ChatEventIsAggressiveAntiSpamEnabledToggled{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) + } + return &v, nil case "chatEventSignMessagesToggled": // Decoding chatEventSignMessagesToggled#b1b9281e. v := ChatEventSignMessagesToggled{} @@ -8570,6 +8960,13 @@ func DecodeTDLibJSONChatEventAction(buf tdjson.Decoder) (ChatEventActionClass, e return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil + case "chatEventForumTopicToggleIsHidden": + // Decoding chatEventForumTopicToggleIsHidden#a015ef2e. + v := ChatEventForumTopicToggleIsHidden{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) + } + return &v, nil case "chatEventForumTopicDeleted": // Decoding chatEventForumTopicDeleted#b08f290d. v := ChatEventForumTopicDeleted{} diff --git a/tdapi/tl_chat_filter_gen.go b/tdapi/tl_chat_filter_gen.go index 7b1e99688d..19cc928ef0 100644 --- a/tdapi/tl_chat_filter_gen.go +++ b/tdapi/tl_chat_filter_gen.go @@ -42,17 +42,17 @@ type ChatFilter struct { // "Money", "Note", "Palette". IconName string // The chat identifiers of pinned chats in the filtered chat list. There can be up to - // GetOption("chat_filter_chosen_chat_count_max") pinned and always included non-secret + // getOption("chat_filter_chosen_chat_count_max") pinned and always included non-secret // chats and the same number of secret chats, but the limit can be increased with // Telegram Premium PinnedChatIDs []int64 // The chat identifiers of always included chats in the filtered chat list. There can be - // up to GetOption("chat_filter_chosen_chat_count_max") pinned and always included + // up to getOption("chat_filter_chosen_chat_count_max") pinned and always included // non-secret chats and the same number of secret chats, but the limit can be increased // with Telegram Premium IncludedChatIDs []int64 // The chat identifiers of always excluded chats in the filtered chat list. There can be - // up to GetOption("chat_filter_chosen_chat_count_max") always excluded non-secret chats + // up to getOption("chat_filter_chosen_chat_count_max") always excluded non-secret chats // and the same number of secret chats, but the limit can be increased with Telegram // Premium ExcludedChatIDs []int64 diff --git a/tdapi/tl_chat_member_gen.go b/tdapi/tl_chat_member_gen.go index 90977b73fe..8aa27eee58 100644 --- a/tdapi/tl_chat_member_gen.go +++ b/tdapi/tl_chat_member_gen.go @@ -40,7 +40,8 @@ type ChatMember struct { // Identifier of a user that invited/promoted/banned this member in the chat; 0 if // unknown InviterUserID int64 - // Point in time (Unix timestamp) when the user joined the chat + // Point in time (Unix timestamp) when the user joined/was promoted/was banned in the + // chat JoinedChatDate int32 // Status of the member in the chat Status ChatMemberStatusClass diff --git a/tdapi/tl_chat_notification_settings_gen.go b/tdapi/tl_chat_notification_settings_gen.go index c4308a8fca..3d43b811a5 100644 --- a/tdapi/tl_chat_notification_settings_gen.go +++ b/tdapi/tl_chat_notification_settings_gen.go @@ -33,28 +33,29 @@ var ( // ChatNotificationSettings represents TL type `chatNotificationSettings#38493760`. type ChatNotificationSettings struct { - // If true, mute_for is ignored and the value for the relevant type of chat is used - // instead + // If true, mute_for is ignored and the value for the relevant type of chat or the forum + // chat is used instead UseDefaultMuteFor bool // Time left before notifications will be unmuted, in seconds MuteFor int32 - // If true, the value for the relevant type of chat is used instead of sound_id + // If true, the value for the relevant type of chat or the forum chat is used instead of + // sound_id UseDefaultSound bool // Identifier of the notification sound to be played; 0 if sound is disabled SoundID int64 - // If true, show_preview is ignored and the value for the relevant type of chat is used - // instead + // If true, show_preview is ignored and the value for the relevant type of chat or the + // forum chat is used instead UseDefaultShowPreview bool // True, if message content must be displayed in notifications ShowPreview bool // If true, disable_pinned_message_notifications is ignored and the value for the - // relevant type of chat is used instead + // relevant type of chat or the forum chat is used instead UseDefaultDisablePinnedMessageNotifications bool // If true, notifications for incoming pinned messages will be created as for an ordinary // unread message DisablePinnedMessageNotifications bool // If true, disable_mention_notifications is ignored and the value for the relevant type - // of chat is used instead + // of chat or the forum chat is used instead UseDefaultDisableMentionNotifications bool // If true, notifications for messages with mentions will be created as for an ordinary // unread message diff --git a/tdapi/tl_check_chat_username_result_gen.go b/tdapi/tl_check_chat_username_result_gen.go index 73db7ae571..c753dedf0b 100644 --- a/tdapi/tl_check_chat_username_result_gen.go +++ b/tdapi/tl_check_chat_username_result_gen.go @@ -424,29 +424,29 @@ func (c *CheckChatUsernameResultUsernameOccupied) DecodeTDLibJSON(b tdjson.Decod }) } -// CheckChatUsernameResultPublicChatsTooMuch represents TL type `checkChatUsernameResultPublicChatsTooMuch#3327d23d`. -type CheckChatUsernameResultPublicChatsTooMuch struct { +// CheckChatUsernameResultUsernamePurchasable represents TL type `checkChatUsernameResultUsernamePurchasable#59ce59`. +type CheckChatUsernameResultUsernamePurchasable struct { } -// CheckChatUsernameResultPublicChatsTooMuchTypeID is TL type id of CheckChatUsernameResultPublicChatsTooMuch. -const CheckChatUsernameResultPublicChatsTooMuchTypeID = 0x3327d23d +// CheckChatUsernameResultUsernamePurchasableTypeID is TL type id of CheckChatUsernameResultUsernamePurchasable. +const CheckChatUsernameResultUsernamePurchasableTypeID = 0x59ce59 // construct implements constructor of CheckChatUsernameResultClass. -func (c CheckChatUsernameResultPublicChatsTooMuch) construct() CheckChatUsernameResultClass { +func (c CheckChatUsernameResultUsernamePurchasable) construct() CheckChatUsernameResultClass { return &c } -// Ensuring interfaces in compile-time for CheckChatUsernameResultPublicChatsTooMuch. +// Ensuring interfaces in compile-time for CheckChatUsernameResultUsernamePurchasable. var ( - _ bin.Encoder = &CheckChatUsernameResultPublicChatsTooMuch{} - _ bin.Decoder = &CheckChatUsernameResultPublicChatsTooMuch{} - _ bin.BareEncoder = &CheckChatUsernameResultPublicChatsTooMuch{} - _ bin.BareDecoder = &CheckChatUsernameResultPublicChatsTooMuch{} + _ bin.Encoder = &CheckChatUsernameResultUsernamePurchasable{} + _ bin.Decoder = &CheckChatUsernameResultUsernamePurchasable{} + _ bin.BareEncoder = &CheckChatUsernameResultUsernamePurchasable{} + _ bin.BareDecoder = &CheckChatUsernameResultUsernamePurchasable{} - _ CheckChatUsernameResultClass = &CheckChatUsernameResultPublicChatsTooMuch{} + _ CheckChatUsernameResultClass = &CheckChatUsernameResultUsernamePurchasable{} ) -func (c *CheckChatUsernameResultPublicChatsTooMuch) Zero() bool { +func (c *CheckChatUsernameResultUsernamePurchasable) Zero() bool { if c == nil { return true } @@ -455,31 +455,31 @@ func (c *CheckChatUsernameResultPublicChatsTooMuch) Zero() bool { } // String implements fmt.Stringer. -func (c *CheckChatUsernameResultPublicChatsTooMuch) String() string { +func (c *CheckChatUsernameResultUsernamePurchasable) String() string { if c == nil { - return "CheckChatUsernameResultPublicChatsTooMuch(nil)" + return "CheckChatUsernameResultUsernamePurchasable(nil)" } - type Alias CheckChatUsernameResultPublicChatsTooMuch - return fmt.Sprintf("CheckChatUsernameResultPublicChatsTooMuch%+v", Alias(*c)) + type Alias CheckChatUsernameResultUsernamePurchasable + return fmt.Sprintf("CheckChatUsernameResultUsernamePurchasable%+v", Alias(*c)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckChatUsernameResultPublicChatsTooMuch) TypeID() uint32 { - return CheckChatUsernameResultPublicChatsTooMuchTypeID +func (*CheckChatUsernameResultUsernamePurchasable) TypeID() uint32 { + return CheckChatUsernameResultUsernamePurchasableTypeID } // TypeName returns name of type in TL schema. -func (*CheckChatUsernameResultPublicChatsTooMuch) TypeName() string { - return "checkChatUsernameResultPublicChatsTooMuch" +func (*CheckChatUsernameResultUsernamePurchasable) TypeName() string { + return "checkChatUsernameResultUsernamePurchasable" } // TypeInfo returns info about TL type. -func (c *CheckChatUsernameResultPublicChatsTooMuch) TypeInfo() tdp.Type { +func (c *CheckChatUsernameResultUsernamePurchasable) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "checkChatUsernameResultPublicChatsTooMuch", - ID: CheckChatUsernameResultPublicChatsTooMuchTypeID, + Name: "checkChatUsernameResultUsernamePurchasable", + ID: CheckChatUsernameResultUsernamePurchasableTypeID, } if c == nil { typ.Null = true @@ -490,48 +490,48 @@ func (c *CheckChatUsernameResultPublicChatsTooMuch) TypeInfo() tdp.Type { } // Encode implements bin.Encoder. -func (c *CheckChatUsernameResultPublicChatsTooMuch) Encode(b *bin.Buffer) error { +func (c *CheckChatUsernameResultUsernamePurchasable) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultPublicChatsTooMuch#3327d23d as nil") + return fmt.Errorf("can't encode checkChatUsernameResultUsernamePurchasable#59ce59 as nil") } - b.PutID(CheckChatUsernameResultPublicChatsTooMuchTypeID) + b.PutID(CheckChatUsernameResultUsernamePurchasableTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *CheckChatUsernameResultPublicChatsTooMuch) EncodeBare(b *bin.Buffer) error { +func (c *CheckChatUsernameResultUsernamePurchasable) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultPublicChatsTooMuch#3327d23d as nil") + return fmt.Errorf("can't encode checkChatUsernameResultUsernamePurchasable#59ce59 as nil") } return nil } // Decode implements bin.Decoder. -func (c *CheckChatUsernameResultPublicChatsTooMuch) Decode(b *bin.Buffer) error { +func (c *CheckChatUsernameResultUsernamePurchasable) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultPublicChatsTooMuch#3327d23d to nil") + return fmt.Errorf("can't decode checkChatUsernameResultUsernamePurchasable#59ce59 to nil") } - if err := b.ConsumeID(CheckChatUsernameResultPublicChatsTooMuchTypeID); err != nil { - return fmt.Errorf("unable to decode checkChatUsernameResultPublicChatsTooMuch#3327d23d: %w", err) + if err := b.ConsumeID(CheckChatUsernameResultUsernamePurchasableTypeID); err != nil { + return fmt.Errorf("unable to decode checkChatUsernameResultUsernamePurchasable#59ce59: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *CheckChatUsernameResultPublicChatsTooMuch) DecodeBare(b *bin.Buffer) error { +func (c *CheckChatUsernameResultUsernamePurchasable) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultPublicChatsTooMuch#3327d23d to nil") + return fmt.Errorf("can't decode checkChatUsernameResultUsernamePurchasable#59ce59 to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckChatUsernameResultPublicChatsTooMuch) EncodeTDLibJSON(b tdjson.Encoder) error { +func (c *CheckChatUsernameResultUsernamePurchasable) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultPublicChatsTooMuch#3327d23d as nil") + return fmt.Errorf("can't encode checkChatUsernameResultUsernamePurchasable#59ce59 as nil") } b.ObjStart() - b.PutID("checkChatUsernameResultPublicChatsTooMuch") + b.PutID("checkChatUsernameResultUsernamePurchasable") b.Comma() b.StripComma() b.ObjEnd() @@ -539,16 +539,149 @@ func (c *CheckChatUsernameResultPublicChatsTooMuch) EncodeTDLibJSON(b tdjson.Enc } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckChatUsernameResultPublicChatsTooMuch) DecodeTDLibJSON(b tdjson.Decoder) error { +func (c *CheckChatUsernameResultUsernamePurchasable) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultPublicChatsTooMuch#3327d23d to nil") + return fmt.Errorf("can't decode checkChatUsernameResultUsernamePurchasable#59ce59 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("checkChatUsernameResultPublicChatsTooMuch"); err != nil { - return fmt.Errorf("unable to decode checkChatUsernameResultPublicChatsTooMuch#3327d23d: %w", err) + if err := b.ConsumeID("checkChatUsernameResultUsernamePurchasable"); err != nil { + return fmt.Errorf("unable to decode checkChatUsernameResultUsernamePurchasable#59ce59: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// CheckChatUsernameResultPublicChatsTooMany represents TL type `checkChatUsernameResultPublicChatsTooMany#d8b46c7c`. +type CheckChatUsernameResultPublicChatsTooMany struct { +} + +// CheckChatUsernameResultPublicChatsTooManyTypeID is TL type id of CheckChatUsernameResultPublicChatsTooMany. +const CheckChatUsernameResultPublicChatsTooManyTypeID = 0xd8b46c7c + +// construct implements constructor of CheckChatUsernameResultClass. +func (c CheckChatUsernameResultPublicChatsTooMany) construct() CheckChatUsernameResultClass { + return &c +} + +// Ensuring interfaces in compile-time for CheckChatUsernameResultPublicChatsTooMany. +var ( + _ bin.Encoder = &CheckChatUsernameResultPublicChatsTooMany{} + _ bin.Decoder = &CheckChatUsernameResultPublicChatsTooMany{} + _ bin.BareEncoder = &CheckChatUsernameResultPublicChatsTooMany{} + _ bin.BareDecoder = &CheckChatUsernameResultPublicChatsTooMany{} + + _ CheckChatUsernameResultClass = &CheckChatUsernameResultPublicChatsTooMany{} +) + +func (c *CheckChatUsernameResultPublicChatsTooMany) Zero() bool { + if c == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (c *CheckChatUsernameResultPublicChatsTooMany) String() string { + if c == nil { + return "CheckChatUsernameResultPublicChatsTooMany(nil)" + } + type Alias CheckChatUsernameResultPublicChatsTooMany + return fmt.Sprintf("CheckChatUsernameResultPublicChatsTooMany%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*CheckChatUsernameResultPublicChatsTooMany) TypeID() uint32 { + return CheckChatUsernameResultPublicChatsTooManyTypeID +} + +// TypeName returns name of type in TL schema. +func (*CheckChatUsernameResultPublicChatsTooMany) TypeName() string { + return "checkChatUsernameResultPublicChatsTooMany" +} + +// TypeInfo returns info about TL type. +func (c *CheckChatUsernameResultPublicChatsTooMany) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "checkChatUsernameResultPublicChatsTooMany", + ID: CheckChatUsernameResultPublicChatsTooManyTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (c *CheckChatUsernameResultPublicChatsTooMany) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode checkChatUsernameResultPublicChatsTooMany#d8b46c7c as nil") + } + b.PutID(CheckChatUsernameResultPublicChatsTooManyTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *CheckChatUsernameResultPublicChatsTooMany) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode checkChatUsernameResultPublicChatsTooMany#d8b46c7c as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (c *CheckChatUsernameResultPublicChatsTooMany) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode checkChatUsernameResultPublicChatsTooMany#d8b46c7c to nil") + } + if err := b.ConsumeID(CheckChatUsernameResultPublicChatsTooManyTypeID); err != nil { + return fmt.Errorf("unable to decode checkChatUsernameResultPublicChatsTooMany#d8b46c7c: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *CheckChatUsernameResultPublicChatsTooMany) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode checkChatUsernameResultPublicChatsTooMany#d8b46c7c to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *CheckChatUsernameResultPublicChatsTooMany) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode checkChatUsernameResultPublicChatsTooMany#d8b46c7c as nil") + } + b.ObjStart() + b.PutID("checkChatUsernameResultPublicChatsTooMany") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *CheckChatUsernameResultPublicChatsTooMany) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode checkChatUsernameResultPublicChatsTooMany#d8b46c7c to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("checkChatUsernameResultPublicChatsTooMany"); err != nil { + return fmt.Errorf("unable to decode checkChatUsernameResultPublicChatsTooMany#d8b46c7c: %w", err) } default: return b.Skip() @@ -705,7 +838,8 @@ const CheckChatUsernameResultClassName = "CheckChatUsernameResult" // case *tdapi.CheckChatUsernameResultOk: // checkChatUsernameResultOk#a6a7bb5c // case *tdapi.CheckChatUsernameResultUsernameInvalid: // checkChatUsernameResultUsernameInvalid#da087756 // case *tdapi.CheckChatUsernameResultUsernameOccupied: // checkChatUsernameResultUsernameOccupied#4ebb3729 -// case *tdapi.CheckChatUsernameResultPublicChatsTooMuch: // checkChatUsernameResultPublicChatsTooMuch#3327d23d +// case *tdapi.CheckChatUsernameResultUsernamePurchasable: // checkChatUsernameResultUsernamePurchasable#59ce59 +// case *tdapi.CheckChatUsernameResultPublicChatsTooMany: // checkChatUsernameResultPublicChatsTooMany#d8b46c7c // case *tdapi.CheckChatUsernameResultPublicGroupsUnavailable: // checkChatUsernameResultPublicGroupsUnavailable#fce914d7 // default: panic(v) // } @@ -759,9 +893,16 @@ func DecodeCheckChatUsernameResult(buf *bin.Buffer) (CheckChatUsernameResultClas return nil, fmt.Errorf("unable to decode CheckChatUsernameResultClass: %w", err) } return &v, nil - case CheckChatUsernameResultPublicChatsTooMuchTypeID: - // Decoding checkChatUsernameResultPublicChatsTooMuch#3327d23d. - v := CheckChatUsernameResultPublicChatsTooMuch{} + case CheckChatUsernameResultUsernamePurchasableTypeID: + // Decoding checkChatUsernameResultUsernamePurchasable#59ce59. + v := CheckChatUsernameResultUsernamePurchasable{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode CheckChatUsernameResultClass: %w", err) + } + return &v, nil + case CheckChatUsernameResultPublicChatsTooManyTypeID: + // Decoding checkChatUsernameResultPublicChatsTooMany#d8b46c7c. + v := CheckChatUsernameResultPublicChatsTooMany{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode CheckChatUsernameResultClass: %w", err) } @@ -806,9 +947,16 @@ func DecodeTDLibJSONCheckChatUsernameResult(buf tdjson.Decoder) (CheckChatUserna return nil, fmt.Errorf("unable to decode CheckChatUsernameResultClass: %w", err) } return &v, nil - case "checkChatUsernameResultPublicChatsTooMuch": - // Decoding checkChatUsernameResultPublicChatsTooMuch#3327d23d. - v := CheckChatUsernameResultPublicChatsTooMuch{} + case "checkChatUsernameResultUsernamePurchasable": + // Decoding checkChatUsernameResultUsernamePurchasable#59ce59. + v := CheckChatUsernameResultUsernamePurchasable{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode CheckChatUsernameResultClass: %w", err) + } + return &v, nil + case "checkChatUsernameResultPublicChatsTooMany": + // Decoding checkChatUsernameResultPublicChatsTooMany#d8b46c7c. + v := CheckChatUsernameResultPublicChatsTooMany{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode CheckChatUsernameResultClass: %w", err) } diff --git a/tdapi/tl_create_new_basic_group_chat_gen.go b/tdapi/tl_create_new_basic_group_chat_gen.go index e427dbec09..53e74eac57 100644 --- a/tdapi/tl_create_new_basic_group_chat_gen.go +++ b/tdapi/tl_create_new_basic_group_chat_gen.go @@ -31,16 +31,19 @@ var ( _ = tdjson.Encoder{} ) -// CreateNewBasicGroupChatRequest represents TL type `createNewBasicGroupChat#eb575429`. +// CreateNewBasicGroupChatRequest represents TL type `createNewBasicGroupChat#68be940`. type CreateNewBasicGroupChatRequest struct { // Identifiers of users to be added to the basic group UserIDs []int64 // Title of the new basic group; 1-128 characters Title string + // Message TTL value, in seconds; must be from 0 up to 365 * 86400 and be divisible by + // 86400. If 0, then messages aren't deleted automatically + MessageTTL int32 } // CreateNewBasicGroupChatRequestTypeID is TL type id of CreateNewBasicGroupChatRequest. -const CreateNewBasicGroupChatRequestTypeID = 0xeb575429 +const CreateNewBasicGroupChatRequestTypeID = 0x68be940 // Ensuring interfaces in compile-time for CreateNewBasicGroupChatRequest. var ( @@ -60,6 +63,9 @@ func (c *CreateNewBasicGroupChatRequest) Zero() bool { if !(c.Title == "") { return false } + if !(c.MessageTTL == 0) { + return false + } return true } @@ -104,6 +110,10 @@ func (c *CreateNewBasicGroupChatRequest) TypeInfo() tdp.Type { Name: "Title", SchemaName: "title", }, + { + Name: "MessageTTL", + SchemaName: "message_ttl", + }, } return typ } @@ -111,7 +121,7 @@ func (c *CreateNewBasicGroupChatRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *CreateNewBasicGroupChatRequest) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode createNewBasicGroupChat#eb575429 as nil") + return fmt.Errorf("can't encode createNewBasicGroupChat#68be940 as nil") } b.PutID(CreateNewBasicGroupChatRequestTypeID) return c.EncodeBare(b) @@ -120,23 +130,24 @@ func (c *CreateNewBasicGroupChatRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *CreateNewBasicGroupChatRequest) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode createNewBasicGroupChat#eb575429 as nil") + return fmt.Errorf("can't encode createNewBasicGroupChat#68be940 as nil") } b.PutInt(len(c.UserIDs)) for _, v := range c.UserIDs { b.PutInt53(v) } b.PutString(c.Title) + b.PutInt32(c.MessageTTL) return nil } // Decode implements bin.Decoder. func (c *CreateNewBasicGroupChatRequest) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode createNewBasicGroupChat#eb575429 to nil") + return fmt.Errorf("can't decode createNewBasicGroupChat#68be940 to nil") } if err := b.ConsumeID(CreateNewBasicGroupChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createNewBasicGroupChat#eb575429: %w", err) + return fmt.Errorf("unable to decode createNewBasicGroupChat#68be940: %w", err) } return c.DecodeBare(b) } @@ -144,12 +155,12 @@ func (c *CreateNewBasicGroupChatRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *CreateNewBasicGroupChatRequest) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode createNewBasicGroupChat#eb575429 to nil") + return fmt.Errorf("can't decode createNewBasicGroupChat#68be940 to nil") } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode createNewBasicGroupChat#eb575429: field user_ids: %w", err) + return fmt.Errorf("unable to decode createNewBasicGroupChat#68be940: field user_ids: %w", err) } if headerLen > 0 { @@ -158,7 +169,7 @@ func (c *CreateNewBasicGroupChatRequest) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode createNewBasicGroupChat#eb575429: field user_ids: %w", err) + return fmt.Errorf("unable to decode createNewBasicGroupChat#68be940: field user_ids: %w", err) } c.UserIDs = append(c.UserIDs, value) } @@ -166,17 +177,24 @@ func (c *CreateNewBasicGroupChatRequest) DecodeBare(b *bin.Buffer) error { { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode createNewBasicGroupChat#eb575429: field title: %w", err) + return fmt.Errorf("unable to decode createNewBasicGroupChat#68be940: field title: %w", err) } c.Title = value } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode createNewBasicGroupChat#68be940: field message_ttl: %w", err) + } + c.MessageTTL = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *CreateNewBasicGroupChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode createNewBasicGroupChat#eb575429 as nil") + return fmt.Errorf("can't encode createNewBasicGroupChat#68be940 as nil") } b.ObjStart() b.PutID("createNewBasicGroupChat") @@ -193,6 +211,9 @@ func (c *CreateNewBasicGroupChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error b.FieldStart("title") b.PutString(c.Title) b.Comma() + b.FieldStart("message_ttl") + b.PutInt32(c.MessageTTL) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -201,32 +222,38 @@ func (c *CreateNewBasicGroupChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *CreateNewBasicGroupChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode createNewBasicGroupChat#eb575429 to nil") + return fmt.Errorf("can't decode createNewBasicGroupChat#68be940 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("createNewBasicGroupChat"); err != nil { - return fmt.Errorf("unable to decode createNewBasicGroupChat#eb575429: %w", err) + return fmt.Errorf("unable to decode createNewBasicGroupChat#68be940: %w", err) } case "user_ids": if err := b.Arr(func(b tdjson.Decoder) error { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode createNewBasicGroupChat#eb575429: field user_ids: %w", err) + return fmt.Errorf("unable to decode createNewBasicGroupChat#68be940: field user_ids: %w", err) } c.UserIDs = append(c.UserIDs, value) return nil }); err != nil { - return fmt.Errorf("unable to decode createNewBasicGroupChat#eb575429: field user_ids: %w", err) + return fmt.Errorf("unable to decode createNewBasicGroupChat#68be940: field user_ids: %w", err) } case "title": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode createNewBasicGroupChat#eb575429: field title: %w", err) + return fmt.Errorf("unable to decode createNewBasicGroupChat#68be940: field title: %w", err) } c.Title = value + case "message_ttl": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode createNewBasicGroupChat#68be940: field message_ttl: %w", err) + } + c.MessageTTL = value default: return b.Skip() } @@ -250,7 +277,15 @@ func (c *CreateNewBasicGroupChatRequest) GetTitle() (value string) { return c.Title } -// CreateNewBasicGroupChat invokes method createNewBasicGroupChat#eb575429 returning error if any. +// GetMessageTTL returns value of MessageTTL field. +func (c *CreateNewBasicGroupChatRequest) GetMessageTTL() (value int32) { + if c == nil { + return + } + return c.MessageTTL +} + +// CreateNewBasicGroupChat invokes method createNewBasicGroupChat#68be940 returning error if any. func (c *Client) CreateNewBasicGroupChat(ctx context.Context, request *CreateNewBasicGroupChatRequest) (*Chat, error) { var result Chat diff --git a/tdapi/tl_create_new_supergroup_chat_gen.go b/tdapi/tl_create_new_supergroup_chat_gen.go index ed1ba9f5a0..89f96cbcca 100644 --- a/tdapi/tl_create_new_supergroup_chat_gen.go +++ b/tdapi/tl_create_new_supergroup_chat_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// CreateNewSupergroupChatRequest represents TL type `createNewSupergroupChat#ce83a6c1`. +// CreateNewSupergroupChatRequest represents TL type `createNewSupergroupChat#d32c5491`. type CreateNewSupergroupChatRequest struct { // Title of the new chat; 1-128 characters Title string @@ -43,12 +43,15 @@ type CreateNewSupergroupChatRequest struct { // Chat location if a location-based supergroup is being created; pass null to create an // ordinary supergroup chat Location ChatLocation + // Message TTL value, in seconds; must be from 0 up to 365 * 86400 and be divisible by + // 86400. If 0, then messages aren't deleted automatically + MessageTTL int32 // Pass true to create a supergroup for importing messages using importMessage ForImport bool } // CreateNewSupergroupChatRequestTypeID is TL type id of CreateNewSupergroupChatRequest. -const CreateNewSupergroupChatRequestTypeID = 0xce83a6c1 +const CreateNewSupergroupChatRequestTypeID = 0xd32c5491 // Ensuring interfaces in compile-time for CreateNewSupergroupChatRequest. var ( @@ -74,6 +77,9 @@ func (c *CreateNewSupergroupChatRequest) Zero() bool { if !(c.Location.Zero()) { return false } + if !(c.MessageTTL == 0) { + return false + } if !(c.ForImport == false) { return false } @@ -129,6 +135,10 @@ func (c *CreateNewSupergroupChatRequest) TypeInfo() tdp.Type { Name: "Location", SchemaName: "location", }, + { + Name: "MessageTTL", + SchemaName: "message_ttl", + }, { Name: "ForImport", SchemaName: "for_import", @@ -140,7 +150,7 @@ func (c *CreateNewSupergroupChatRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *CreateNewSupergroupChatRequest) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode createNewSupergroupChat#ce83a6c1 as nil") + return fmt.Errorf("can't encode createNewSupergroupChat#d32c5491 as nil") } b.PutID(CreateNewSupergroupChatRequestTypeID) return c.EncodeBare(b) @@ -149,14 +159,15 @@ func (c *CreateNewSupergroupChatRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *CreateNewSupergroupChatRequest) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode createNewSupergroupChat#ce83a6c1 as nil") + return fmt.Errorf("can't encode createNewSupergroupChat#d32c5491 as nil") } b.PutString(c.Title) b.PutBool(c.IsChannel) b.PutString(c.Description) if err := c.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode createNewSupergroupChat#ce83a6c1: field location: %w", err) + return fmt.Errorf("unable to encode createNewSupergroupChat#d32c5491: field location: %w", err) } + b.PutInt32(c.MessageTTL) b.PutBool(c.ForImport) return nil } @@ -164,10 +175,10 @@ func (c *CreateNewSupergroupChatRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (c *CreateNewSupergroupChatRequest) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode createNewSupergroupChat#ce83a6c1 to nil") + return fmt.Errorf("can't decode createNewSupergroupChat#d32c5491 to nil") } if err := b.ConsumeID(CreateNewSupergroupChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#ce83a6c1: %w", err) + return fmt.Errorf("unable to decode createNewSupergroupChat#d32c5491: %w", err) } return c.DecodeBare(b) } @@ -175,38 +186,45 @@ func (c *CreateNewSupergroupChatRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *CreateNewSupergroupChatRequest) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode createNewSupergroupChat#ce83a6c1 to nil") + return fmt.Errorf("can't decode createNewSupergroupChat#d32c5491 to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#ce83a6c1: field title: %w", err) + return fmt.Errorf("unable to decode createNewSupergroupChat#d32c5491: field title: %w", err) } c.Title = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#ce83a6c1: field is_channel: %w", err) + return fmt.Errorf("unable to decode createNewSupergroupChat#d32c5491: field is_channel: %w", err) } c.IsChannel = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#ce83a6c1: field description: %w", err) + return fmt.Errorf("unable to decode createNewSupergroupChat#d32c5491: field description: %w", err) } c.Description = value } { if err := c.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#ce83a6c1: field location: %w", err) + return fmt.Errorf("unable to decode createNewSupergroupChat#d32c5491: field location: %w", err) + } + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode createNewSupergroupChat#d32c5491: field message_ttl: %w", err) } + c.MessageTTL = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#ce83a6c1: field for_import: %w", err) + return fmt.Errorf("unable to decode createNewSupergroupChat#d32c5491: field for_import: %w", err) } c.ForImport = value } @@ -216,7 +234,7 @@ func (c *CreateNewSupergroupChatRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *CreateNewSupergroupChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode createNewSupergroupChat#ce83a6c1 as nil") + return fmt.Errorf("can't encode createNewSupergroupChat#d32c5491 as nil") } b.ObjStart() b.PutID("createNewSupergroupChat") @@ -232,9 +250,12 @@ func (c *CreateNewSupergroupChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error b.Comma() b.FieldStart("location") if err := c.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode createNewSupergroupChat#ce83a6c1: field location: %w", err) + return fmt.Errorf("unable to encode createNewSupergroupChat#d32c5491: field location: %w", err) } b.Comma() + b.FieldStart("message_ttl") + b.PutInt32(c.MessageTTL) + b.Comma() b.FieldStart("for_import") b.PutBool(c.ForImport) b.Comma() @@ -246,41 +267,47 @@ func (c *CreateNewSupergroupChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *CreateNewSupergroupChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode createNewSupergroupChat#ce83a6c1 to nil") + return fmt.Errorf("can't decode createNewSupergroupChat#d32c5491 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("createNewSupergroupChat"); err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#ce83a6c1: %w", err) + return fmt.Errorf("unable to decode createNewSupergroupChat#d32c5491: %w", err) } case "title": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#ce83a6c1: field title: %w", err) + return fmt.Errorf("unable to decode createNewSupergroupChat#d32c5491: field title: %w", err) } c.Title = value case "is_channel": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#ce83a6c1: field is_channel: %w", err) + return fmt.Errorf("unable to decode createNewSupergroupChat#d32c5491: field is_channel: %w", err) } c.IsChannel = value case "description": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#ce83a6c1: field description: %w", err) + return fmt.Errorf("unable to decode createNewSupergroupChat#d32c5491: field description: %w", err) } c.Description = value case "location": if err := c.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#ce83a6c1: field location: %w", err) + return fmt.Errorf("unable to decode createNewSupergroupChat#d32c5491: field location: %w", err) + } + case "message_ttl": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode createNewSupergroupChat#d32c5491: field message_ttl: %w", err) } + c.MessageTTL = value case "for_import": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#ce83a6c1: field for_import: %w", err) + return fmt.Errorf("unable to decode createNewSupergroupChat#d32c5491: field for_import: %w", err) } c.ForImport = value default: @@ -322,6 +349,14 @@ func (c *CreateNewSupergroupChatRequest) GetLocation() (value ChatLocation) { return c.Location } +// GetMessageTTL returns value of MessageTTL field. +func (c *CreateNewSupergroupChatRequest) GetMessageTTL() (value int32) { + if c == nil { + return + } + return c.MessageTTL +} + // GetForImport returns value of ForImport field. func (c *CreateNewSupergroupChatRequest) GetForImport() (value bool) { if c == nil { @@ -330,7 +365,7 @@ func (c *CreateNewSupergroupChatRequest) GetForImport() (value bool) { return c.ForImport } -// CreateNewSupergroupChat invokes method createNewSupergroupChat#ce83a6c1 returning error if any. +// CreateNewSupergroupChat invokes method createNewSupergroupChat#d32c5491 returning error if any. func (c *Client) CreateNewSupergroupChat(ctx context.Context, request *CreateNewSupergroupChatRequest) (*Chat, error) { var result Chat diff --git a/tdapi/tl_edit_forum_topic_gen.go b/tdapi/tl_edit_forum_topic_gen.go index de8dbbceef..de3b9b1ad5 100644 --- a/tdapi/tl_edit_forum_topic_gen.go +++ b/tdapi/tl_edit_forum_topic_gen.go @@ -31,22 +31,24 @@ var ( _ = tdjson.Encoder{} ) -// EditForumTopicRequest represents TL type `editForumTopic#f2c261b0`. +// EditForumTopicRequest represents TL type `editForumTopic#a7769060`. type EditForumTopicRequest struct { // Identifier of the chat ChatID int64 // Message thread identifier of the forum topic MessageThreadID int64 - // New name of the topic; 1-128 characters + // New name of the topic; 0-128 characters. If empty, the previous topic name is kept Name string - // Identifier of the new custom emoji for topic icon. Telegram Premium users can use any - // custom emoji, other users can use only a custom emoji returned by - // getForumTopicDefaultIcons + // Pass true to edit the icon of the topic. Icon of the General topic can't be edited + EditIconCustomEmoji bool + // Identifier of the new custom emoji for topic icon; pass 0 to remove the custom emoji. + // Ignored if edit_icon_custom_emoji is false. Telegram Premium users can use any custom + // emoji, other users can use only a custom emoji returned by getForumTopicDefaultIcons IconCustomEmojiID int64 } // EditForumTopicRequestTypeID is TL type id of EditForumTopicRequest. -const EditForumTopicRequestTypeID = 0xf2c261b0 +const EditForumTopicRequestTypeID = 0xa7769060 // Ensuring interfaces in compile-time for EditForumTopicRequest. var ( @@ -69,6 +71,9 @@ func (e *EditForumTopicRequest) Zero() bool { if !(e.Name == "") { return false } + if !(e.EditIconCustomEmoji == false) { + return false + } if !(e.IconCustomEmojiID == 0) { return false } @@ -120,6 +125,10 @@ func (e *EditForumTopicRequest) TypeInfo() tdp.Type { Name: "Name", SchemaName: "name", }, + { + Name: "EditIconCustomEmoji", + SchemaName: "edit_icon_custom_emoji", + }, { Name: "IconCustomEmojiID", SchemaName: "icon_custom_emoji_id", @@ -131,7 +140,7 @@ func (e *EditForumTopicRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (e *EditForumTopicRequest) Encode(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't encode editForumTopic#f2c261b0 as nil") + return fmt.Errorf("can't encode editForumTopic#a7769060 as nil") } b.PutID(EditForumTopicRequestTypeID) return e.EncodeBare(b) @@ -140,11 +149,12 @@ func (e *EditForumTopicRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (e *EditForumTopicRequest) EncodeBare(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't encode editForumTopic#f2c261b0 as nil") + return fmt.Errorf("can't encode editForumTopic#a7769060 as nil") } b.PutInt53(e.ChatID) b.PutInt53(e.MessageThreadID) b.PutString(e.Name) + b.PutBool(e.EditIconCustomEmoji) b.PutLong(e.IconCustomEmojiID) return nil } @@ -152,10 +162,10 @@ func (e *EditForumTopicRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (e *EditForumTopicRequest) Decode(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't decode editForumTopic#f2c261b0 to nil") + return fmt.Errorf("can't decode editForumTopic#a7769060 to nil") } if err := b.ConsumeID(EditForumTopicRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editForumTopic#f2c261b0: %w", err) + return fmt.Errorf("unable to decode editForumTopic#a7769060: %w", err) } return e.DecodeBare(b) } @@ -163,33 +173,40 @@ func (e *EditForumTopicRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (e *EditForumTopicRequest) DecodeBare(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't decode editForumTopic#f2c261b0 to nil") + return fmt.Errorf("can't decode editForumTopic#a7769060 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode editForumTopic#f2c261b0: field chat_id: %w", err) + return fmt.Errorf("unable to decode editForumTopic#a7769060: field chat_id: %w", err) } e.ChatID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode editForumTopic#f2c261b0: field message_thread_id: %w", err) + return fmt.Errorf("unable to decode editForumTopic#a7769060: field message_thread_id: %w", err) } e.MessageThreadID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode editForumTopic#f2c261b0: field name: %w", err) + return fmt.Errorf("unable to decode editForumTopic#a7769060: field name: %w", err) } e.Name = value } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode editForumTopic#a7769060: field edit_icon_custom_emoji: %w", err) + } + e.EditIconCustomEmoji = value + } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode editForumTopic#f2c261b0: field icon_custom_emoji_id: %w", err) + return fmt.Errorf("unable to decode editForumTopic#a7769060: field icon_custom_emoji_id: %w", err) } e.IconCustomEmojiID = value } @@ -199,7 +216,7 @@ func (e *EditForumTopicRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (e *EditForumTopicRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if e == nil { - return fmt.Errorf("can't encode editForumTopic#f2c261b0 as nil") + return fmt.Errorf("can't encode editForumTopic#a7769060 as nil") } b.ObjStart() b.PutID("editForumTopic") @@ -213,6 +230,9 @@ func (e *EditForumTopicRequest) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("name") b.PutString(e.Name) b.Comma() + b.FieldStart("edit_icon_custom_emoji") + b.PutBool(e.EditIconCustomEmoji) + b.Comma() b.FieldStart("icon_custom_emoji_id") b.PutLong(e.IconCustomEmojiID) b.Comma() @@ -224,37 +244,43 @@ func (e *EditForumTopicRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (e *EditForumTopicRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if e == nil { - return fmt.Errorf("can't decode editForumTopic#f2c261b0 to nil") + return fmt.Errorf("can't decode editForumTopic#a7769060 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("editForumTopic"); err != nil { - return fmt.Errorf("unable to decode editForumTopic#f2c261b0: %w", err) + return fmt.Errorf("unable to decode editForumTopic#a7769060: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode editForumTopic#f2c261b0: field chat_id: %w", err) + return fmt.Errorf("unable to decode editForumTopic#a7769060: field chat_id: %w", err) } e.ChatID = value case "message_thread_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode editForumTopic#f2c261b0: field message_thread_id: %w", err) + return fmt.Errorf("unable to decode editForumTopic#a7769060: field message_thread_id: %w", err) } e.MessageThreadID = value case "name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode editForumTopic#f2c261b0: field name: %w", err) + return fmt.Errorf("unable to decode editForumTopic#a7769060: field name: %w", err) } e.Name = value + case "edit_icon_custom_emoji": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode editForumTopic#a7769060: field edit_icon_custom_emoji: %w", err) + } + e.EditIconCustomEmoji = value case "icon_custom_emoji_id": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode editForumTopic#f2c261b0: field icon_custom_emoji_id: %w", err) + return fmt.Errorf("unable to decode editForumTopic#a7769060: field icon_custom_emoji_id: %w", err) } e.IconCustomEmojiID = value default: @@ -288,6 +314,14 @@ func (e *EditForumTopicRequest) GetName() (value string) { return e.Name } +// GetEditIconCustomEmoji returns value of EditIconCustomEmoji field. +func (e *EditForumTopicRequest) GetEditIconCustomEmoji() (value bool) { + if e == nil { + return + } + return e.EditIconCustomEmoji +} + // GetIconCustomEmojiID returns value of IconCustomEmojiID field. func (e *EditForumTopicRequest) GetIconCustomEmojiID() (value int64) { if e == nil { @@ -296,7 +330,7 @@ func (e *EditForumTopicRequest) GetIconCustomEmojiID() (value int64) { return e.IconCustomEmojiID } -// EditForumTopic invokes method editForumTopic#f2c261b0 returning error if any. +// EditForumTopic invokes method editForumTopic#a7769060 returning error if any. func (c *Client) EditForumTopic(ctx context.Context, request *EditForumTopicRequest) error { var ok Ok diff --git a/tdapi/tl_edit_inline_message_caption_gen.go b/tdapi/tl_edit_inline_message_caption_gen.go index cabf39fd05..d0a9232ea9 100644 --- a/tdapi/tl_edit_inline_message_caption_gen.go +++ b/tdapi/tl_edit_inline_message_caption_gen.go @@ -38,7 +38,7 @@ type EditInlineMessageCaptionRequest struct { // The new message reply markup; pass null if none ReplyMarkup ReplyMarkupClass // New message content caption; pass null to remove caption; - // 0-GetOption("message_caption_length_max") characters + // 0-getOption("message_caption_length_max") characters Caption FormattedText } diff --git a/tdapi/tl_edit_message_caption_gen.go b/tdapi/tl_edit_message_caption_gen.go index 016f5db7b1..10f486db11 100644 --- a/tdapi/tl_edit_message_caption_gen.go +++ b/tdapi/tl_edit_message_caption_gen.go @@ -39,7 +39,7 @@ type EditMessageCaptionRequest struct { MessageID int64 // The new message reply markup; pass null if none; for bots only ReplyMarkup ReplyMarkupClass - // New message content caption; 0-GetOption("message_caption_length_max") characters; + // New message content caption; 0-getOption("message_caption_length_max") characters; // pass null to remove caption Caption FormattedText } diff --git a/tdapi/tl_emoji_status_gen.go b/tdapi/tl_emoji_status_gen.go index 546ece67be..4da6d8fccb 100644 --- a/tdapi/tl_emoji_status_gen.go +++ b/tdapi/tl_emoji_status_gen.go @@ -34,7 +34,7 @@ var ( // EmojiStatus represents TL type `emojiStatus#4118a266`. type EmojiStatus struct { // Identifier of the custom emoji in stickerFormatTgs format. If the custom emoji belongs - // to the sticker set GetOption("themed_emoji_statuses_sticker_set_id"), then it's color + // to the sticker set getOption("themed_emoji_statuses_sticker_set_id"), then it's color // must be changed to the color of the Telegram Premium badge CustomEmojiID int64 } diff --git a/tdapi/tl_forum_topic_gen.go b/tdapi/tl_forum_topic_gen.go index 85cf0ee2bc..705003dae8 100644 --- a/tdapi/tl_forum_topic_gen.go +++ b/tdapi/tl_forum_topic_gen.go @@ -35,7 +35,7 @@ var ( type ForumTopic struct { // Basic information about the topic Info ForumTopicInfo - // Last message in the topic; may be null + // Last message in the topic; may be null if unknown LastMessage Message // True, if the topic is pinned in the topic list IsPinned bool diff --git a/tdapi/tl_forum_topic_info_gen.go b/tdapi/tl_forum_topic_info_gen.go index e574bdd0f9..57acda8ee9 100644 --- a/tdapi/tl_forum_topic_info_gen.go +++ b/tdapi/tl_forum_topic_info_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// ForumTopicInfo represents TL type `forumTopicInfo#d38f7a5a`. +// ForumTopicInfo represents TL type `forumTopicInfo#8ff3df9e`. type ForumTopicInfo struct { // Message thread identifier of the topic MessageThreadID int64 @@ -43,14 +43,18 @@ type ForumTopicInfo struct { CreationDate int32 // Identifier of the creator of the topic CreatorID MessageSenderClass + // True, if the topic is the General topic list + IsGeneral bool // True, if the topic was created by the current user IsOutgoing bool // True, if the topic is closed IsClosed bool + // True, if the topic is hidden above the topic list and closed; for General topic only + IsHidden bool } // ForumTopicInfoTypeID is TL type id of ForumTopicInfo. -const ForumTopicInfoTypeID = 0xd38f7a5a +const ForumTopicInfoTypeID = 0x8ff3df9e // Ensuring interfaces in compile-time for ForumTopicInfo. var ( @@ -79,12 +83,18 @@ func (f *ForumTopicInfo) Zero() bool { if !(f.CreatorID == nil) { return false } + if !(f.IsGeneral == false) { + return false + } if !(f.IsOutgoing == false) { return false } if !(f.IsClosed == false) { return false } + if !(f.IsHidden == false) { + return false + } return true } @@ -141,6 +151,10 @@ func (f *ForumTopicInfo) TypeInfo() tdp.Type { Name: "CreatorID", SchemaName: "creator_id", }, + { + Name: "IsGeneral", + SchemaName: "is_general", + }, { Name: "IsOutgoing", SchemaName: "is_outgoing", @@ -149,6 +163,10 @@ func (f *ForumTopicInfo) TypeInfo() tdp.Type { Name: "IsClosed", SchemaName: "is_closed", }, + { + Name: "IsHidden", + SchemaName: "is_hidden", + }, } return typ } @@ -156,7 +174,7 @@ func (f *ForumTopicInfo) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (f *ForumTopicInfo) Encode(b *bin.Buffer) error { if f == nil { - return fmt.Errorf("can't encode forumTopicInfo#d38f7a5a as nil") + return fmt.Errorf("can't encode forumTopicInfo#8ff3df9e as nil") } b.PutID(ForumTopicInfoTypeID) return f.EncodeBare(b) @@ -165,32 +183,34 @@ func (f *ForumTopicInfo) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (f *ForumTopicInfo) EncodeBare(b *bin.Buffer) error { if f == nil { - return fmt.Errorf("can't encode forumTopicInfo#d38f7a5a as nil") + return fmt.Errorf("can't encode forumTopicInfo#8ff3df9e as nil") } b.PutInt53(f.MessageThreadID) b.PutString(f.Name) if err := f.Icon.Encode(b); err != nil { - return fmt.Errorf("unable to encode forumTopicInfo#d38f7a5a: field icon: %w", err) + return fmt.Errorf("unable to encode forumTopicInfo#8ff3df9e: field icon: %w", err) } b.PutInt32(f.CreationDate) if f.CreatorID == nil { - return fmt.Errorf("unable to encode forumTopicInfo#d38f7a5a: field creator_id is nil") + return fmt.Errorf("unable to encode forumTopicInfo#8ff3df9e: field creator_id is nil") } if err := f.CreatorID.Encode(b); err != nil { - return fmt.Errorf("unable to encode forumTopicInfo#d38f7a5a: field creator_id: %w", err) + return fmt.Errorf("unable to encode forumTopicInfo#8ff3df9e: field creator_id: %w", err) } + b.PutBool(f.IsGeneral) b.PutBool(f.IsOutgoing) b.PutBool(f.IsClosed) + b.PutBool(f.IsHidden) return nil } // Decode implements bin.Decoder. func (f *ForumTopicInfo) Decode(b *bin.Buffer) error { if f == nil { - return fmt.Errorf("can't decode forumTopicInfo#d38f7a5a to nil") + return fmt.Errorf("can't decode forumTopicInfo#8ff3df9e to nil") } if err := b.ConsumeID(ForumTopicInfoTypeID); err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#d38f7a5a: %w", err) + return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: %w", err) } return f.DecodeBare(b) } @@ -198,62 +218,76 @@ func (f *ForumTopicInfo) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (f *ForumTopicInfo) DecodeBare(b *bin.Buffer) error { if f == nil { - return fmt.Errorf("can't decode forumTopicInfo#d38f7a5a to nil") + return fmt.Errorf("can't decode forumTopicInfo#8ff3df9e to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#d38f7a5a: field message_thread_id: %w", err) + return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field message_thread_id: %w", err) } f.MessageThreadID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#d38f7a5a: field name: %w", err) + return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field name: %w", err) } f.Name = value } { if err := f.Icon.Decode(b); err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#d38f7a5a: field icon: %w", err) + return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field icon: %w", err) } } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#d38f7a5a: field creation_date: %w", err) + return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field creation_date: %w", err) } f.CreationDate = value } { value, err := DecodeMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#d38f7a5a: field creator_id: %w", err) + return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field creator_id: %w", err) } f.CreatorID = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#d38f7a5a: field is_outgoing: %w", err) + return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field is_general: %w", err) + } + f.IsGeneral = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field is_outgoing: %w", err) } f.IsOutgoing = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#d38f7a5a: field is_closed: %w", err) + return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field is_closed: %w", err) } f.IsClosed = value } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field is_hidden: %w", err) + } + f.IsHidden = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (f *ForumTopicInfo) EncodeTDLibJSON(b tdjson.Encoder) error { if f == nil { - return fmt.Errorf("can't encode forumTopicInfo#d38f7a5a as nil") + return fmt.Errorf("can't encode forumTopicInfo#8ff3df9e as nil") } b.ObjStart() b.PutID("forumTopicInfo") @@ -266,7 +300,7 @@ func (f *ForumTopicInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("icon") if err := f.Icon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode forumTopicInfo#d38f7a5a: field icon: %w", err) + return fmt.Errorf("unable to encode forumTopicInfo#8ff3df9e: field icon: %w", err) } b.Comma() b.FieldStart("creation_date") @@ -274,18 +308,24 @@ func (f *ForumTopicInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("creator_id") if f.CreatorID == nil { - return fmt.Errorf("unable to encode forumTopicInfo#d38f7a5a: field creator_id is nil") + return fmt.Errorf("unable to encode forumTopicInfo#8ff3df9e: field creator_id is nil") } if err := f.CreatorID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode forumTopicInfo#d38f7a5a: field creator_id: %w", err) + return fmt.Errorf("unable to encode forumTopicInfo#8ff3df9e: field creator_id: %w", err) } b.Comma() + b.FieldStart("is_general") + b.PutBool(f.IsGeneral) + b.Comma() b.FieldStart("is_outgoing") b.PutBool(f.IsOutgoing) b.Comma() b.FieldStart("is_closed") b.PutBool(f.IsClosed) b.Comma() + b.FieldStart("is_hidden") + b.PutBool(f.IsHidden) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -294,55 +334,67 @@ func (f *ForumTopicInfo) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (f *ForumTopicInfo) DecodeTDLibJSON(b tdjson.Decoder) error { if f == nil { - return fmt.Errorf("can't decode forumTopicInfo#d38f7a5a to nil") + return fmt.Errorf("can't decode forumTopicInfo#8ff3df9e to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("forumTopicInfo"); err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#d38f7a5a: %w", err) + return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: %w", err) } case "message_thread_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#d38f7a5a: field message_thread_id: %w", err) + return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field message_thread_id: %w", err) } f.MessageThreadID = value case "name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#d38f7a5a: field name: %w", err) + return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field name: %w", err) } f.Name = value case "icon": if err := f.Icon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#d38f7a5a: field icon: %w", err) + return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field icon: %w", err) } case "creation_date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#d38f7a5a: field creation_date: %w", err) + return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field creation_date: %w", err) } f.CreationDate = value case "creator_id": value, err := DecodeTDLibJSONMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#d38f7a5a: field creator_id: %w", err) + return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field creator_id: %w", err) } f.CreatorID = value + case "is_general": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field is_general: %w", err) + } + f.IsGeneral = value case "is_outgoing": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#d38f7a5a: field is_outgoing: %w", err) + return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field is_outgoing: %w", err) } f.IsOutgoing = value case "is_closed": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#d38f7a5a: field is_closed: %w", err) + return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field is_closed: %w", err) } f.IsClosed = value + case "is_hidden": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field is_hidden: %w", err) + } + f.IsHidden = value default: return b.Skip() } @@ -390,6 +442,14 @@ func (f *ForumTopicInfo) GetCreatorID() (value MessageSenderClass) { return f.CreatorID } +// GetIsGeneral returns value of IsGeneral field. +func (f *ForumTopicInfo) GetIsGeneral() (value bool) { + if f == nil { + return + } + return f.IsGeneral +} + // GetIsOutgoing returns value of IsOutgoing field. func (f *ForumTopicInfo) GetIsOutgoing() (value bool) { if f == nil { @@ -405,3 +465,11 @@ func (f *ForumTopicInfo) GetIsClosed() (value bool) { } return f.IsClosed } + +// GetIsHidden returns value of IsHidden field. +func (f *ForumTopicInfo) GetIsHidden() (value bool) { + if f == nil { + return + } + return f.IsHidden +} diff --git a/tdapi/tl_forum_topics_gen.go b/tdapi/tl_forum_topics_gen.go new file mode 100644 index 0000000000..31fe1075fd --- /dev/null +++ b/tdapi/tl_forum_topics_gen.go @@ -0,0 +1,357 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +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{} +) + +// ForumTopics represents TL type `forumTopics#2d99b4ae`. +type ForumTopics struct { + // Approximate total number of forum topics found + TotalCount int32 + // List of forum topics + Topics []ForumTopic + // Offset date for the next getForumTopics request + NextOffsetDate int32 + // Offset message identifier for the next getForumTopics request + NextOffsetMessageID int64 + // Offset message thread identifier for the next getForumTopics request + NextOffsetMessageThreadID int64 +} + +// ForumTopicsTypeID is TL type id of ForumTopics. +const ForumTopicsTypeID = 0x2d99b4ae + +// Ensuring interfaces in compile-time for ForumTopics. +var ( + _ bin.Encoder = &ForumTopics{} + _ bin.Decoder = &ForumTopics{} + _ bin.BareEncoder = &ForumTopics{} + _ bin.BareDecoder = &ForumTopics{} +) + +func (f *ForumTopics) Zero() bool { + if f == nil { + return true + } + if !(f.TotalCount == 0) { + return false + } + if !(f.Topics == nil) { + return false + } + if !(f.NextOffsetDate == 0) { + return false + } + if !(f.NextOffsetMessageID == 0) { + return false + } + if !(f.NextOffsetMessageThreadID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (f *ForumTopics) String() string { + if f == nil { + return "ForumTopics(nil)" + } + type Alias ForumTopics + return fmt.Sprintf("ForumTopics%+v", Alias(*f)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ForumTopics) TypeID() uint32 { + return ForumTopicsTypeID +} + +// TypeName returns name of type in TL schema. +func (*ForumTopics) TypeName() string { + return "forumTopics" +} + +// TypeInfo returns info about TL type. +func (f *ForumTopics) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "forumTopics", + ID: ForumTopicsTypeID, + } + if f == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "TotalCount", + SchemaName: "total_count", + }, + { + Name: "Topics", + SchemaName: "topics", + }, + { + Name: "NextOffsetDate", + SchemaName: "next_offset_date", + }, + { + Name: "NextOffsetMessageID", + SchemaName: "next_offset_message_id", + }, + { + Name: "NextOffsetMessageThreadID", + SchemaName: "next_offset_message_thread_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (f *ForumTopics) Encode(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't encode forumTopics#2d99b4ae as nil") + } + b.PutID(ForumTopicsTypeID) + return f.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (f *ForumTopics) EncodeBare(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't encode forumTopics#2d99b4ae as nil") + } + b.PutInt32(f.TotalCount) + b.PutInt(len(f.Topics)) + for idx, v := range f.Topics { + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare forumTopics#2d99b4ae: field topics element with index %d: %w", idx, err) + } + } + b.PutInt32(f.NextOffsetDate) + b.PutInt53(f.NextOffsetMessageID) + b.PutInt53(f.NextOffsetMessageThreadID) + return nil +} + +// Decode implements bin.Decoder. +func (f *ForumTopics) Decode(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't decode forumTopics#2d99b4ae to nil") + } + if err := b.ConsumeID(ForumTopicsTypeID); err != nil { + return fmt.Errorf("unable to decode forumTopics#2d99b4ae: %w", err) + } + return f.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (f *ForumTopics) DecodeBare(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't decode forumTopics#2d99b4ae to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field total_count: %w", err) + } + f.TotalCount = value + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field topics: %w", err) + } + + if headerLen > 0 { + f.Topics = make([]ForumTopic, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value ForumTopic + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare forumTopics#2d99b4ae: field topics: %w", err) + } + f.Topics = append(f.Topics, value) + } + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field next_offset_date: %w", err) + } + f.NextOffsetDate = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field next_offset_message_id: %w", err) + } + f.NextOffsetMessageID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field next_offset_message_thread_id: %w", err) + } + f.NextOffsetMessageThreadID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (f *ForumTopics) EncodeTDLibJSON(b tdjson.Encoder) error { + if f == nil { + return fmt.Errorf("can't encode forumTopics#2d99b4ae as nil") + } + b.ObjStart() + b.PutID("forumTopics") + b.Comma() + b.FieldStart("total_count") + b.PutInt32(f.TotalCount) + b.Comma() + b.FieldStart("topics") + b.ArrStart() + for idx, v := range f.Topics { + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode forumTopics#2d99b4ae: field topics element with index %d: %w", idx, err) + } + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.FieldStart("next_offset_date") + b.PutInt32(f.NextOffsetDate) + b.Comma() + b.FieldStart("next_offset_message_id") + b.PutInt53(f.NextOffsetMessageID) + b.Comma() + b.FieldStart("next_offset_message_thread_id") + b.PutInt53(f.NextOffsetMessageThreadID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (f *ForumTopics) DecodeTDLibJSON(b tdjson.Decoder) error { + if f == nil { + return fmt.Errorf("can't decode forumTopics#2d99b4ae to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("forumTopics"); err != nil { + return fmt.Errorf("unable to decode forumTopics#2d99b4ae: %w", err) + } + case "total_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field total_count: %w", err) + } + f.TotalCount = value + case "topics": + if err := b.Arr(func(b tdjson.Decoder) error { + var value ForumTopic + if err := value.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field topics: %w", err) + } + f.Topics = append(f.Topics, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field topics: %w", err) + } + case "next_offset_date": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field next_offset_date: %w", err) + } + f.NextOffsetDate = value + case "next_offset_message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field next_offset_message_id: %w", err) + } + f.NextOffsetMessageID = value + case "next_offset_message_thread_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field next_offset_message_thread_id: %w", err) + } + f.NextOffsetMessageThreadID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetTotalCount returns value of TotalCount field. +func (f *ForumTopics) GetTotalCount() (value int32) { + if f == nil { + return + } + return f.TotalCount +} + +// GetTopics returns value of Topics field. +func (f *ForumTopics) GetTopics() (value []ForumTopic) { + if f == nil { + return + } + return f.Topics +} + +// GetNextOffsetDate returns value of NextOffsetDate field. +func (f *ForumTopics) GetNextOffsetDate() (value int32) { + if f == nil { + return + } + return f.NextOffsetDate +} + +// GetNextOffsetMessageID returns value of NextOffsetMessageID field. +func (f *ForumTopics) GetNextOffsetMessageID() (value int64) { + if f == nil { + return + } + return f.NextOffsetMessageID +} + +// GetNextOffsetMessageThreadID returns value of NextOffsetMessageThreadID field. +func (f *ForumTopics) GetNextOffsetMessageThreadID() (value int64) { + if f == nil { + return + } + return f.NextOffsetMessageThreadID +} diff --git a/tdapi/tl_get_default_message_ttl_gen.go b/tdapi/tl_get_default_message_ttl_gen.go new file mode 100644 index 0000000000..3f721739b0 --- /dev/null +++ b/tdapi/tl_get_default_message_ttl_gen.go @@ -0,0 +1,169 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +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{} +) + +// GetDefaultMessageTTLRequest represents TL type `getDefaultMessageTtl#2e8b7d3e`. +type GetDefaultMessageTTLRequest struct { +} + +// GetDefaultMessageTTLRequestTypeID is TL type id of GetDefaultMessageTTLRequest. +const GetDefaultMessageTTLRequestTypeID = 0x2e8b7d3e + +// Ensuring interfaces in compile-time for GetDefaultMessageTTLRequest. +var ( + _ bin.Encoder = &GetDefaultMessageTTLRequest{} + _ bin.Decoder = &GetDefaultMessageTTLRequest{} + _ bin.BareEncoder = &GetDefaultMessageTTLRequest{} + _ bin.BareDecoder = &GetDefaultMessageTTLRequest{} +) + +func (g *GetDefaultMessageTTLRequest) Zero() bool { + if g == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetDefaultMessageTTLRequest) String() string { + if g == nil { + return "GetDefaultMessageTTLRequest(nil)" + } + type Alias GetDefaultMessageTTLRequest + return fmt.Sprintf("GetDefaultMessageTTLRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetDefaultMessageTTLRequest) TypeID() uint32 { + return GetDefaultMessageTTLRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetDefaultMessageTTLRequest) TypeName() string { + return "getDefaultMessageTtl" +} + +// TypeInfo returns info about TL type. +func (g *GetDefaultMessageTTLRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getDefaultMessageTtl", + ID: GetDefaultMessageTTLRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (g *GetDefaultMessageTTLRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getDefaultMessageTtl#2e8b7d3e as nil") + } + b.PutID(GetDefaultMessageTTLRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetDefaultMessageTTLRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getDefaultMessageTtl#2e8b7d3e as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (g *GetDefaultMessageTTLRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getDefaultMessageTtl#2e8b7d3e to nil") + } + if err := b.ConsumeID(GetDefaultMessageTTLRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getDefaultMessageTtl#2e8b7d3e: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetDefaultMessageTTLRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getDefaultMessageTtl#2e8b7d3e to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetDefaultMessageTTLRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getDefaultMessageTtl#2e8b7d3e as nil") + } + b.ObjStart() + b.PutID("getDefaultMessageTtl") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetDefaultMessageTTLRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getDefaultMessageTtl#2e8b7d3e to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getDefaultMessageTtl"); err != nil { + return fmt.Errorf("unable to decode getDefaultMessageTtl#2e8b7d3e: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetDefaultMessageTTL invokes method getDefaultMessageTtl#2e8b7d3e returning error if any. +func (c *Client) GetDefaultMessageTTL(ctx context.Context) (*MessageTTL, error) { + var result MessageTTL + + request := &GetDefaultMessageTTLRequest{} + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_forum_topic_gen.go b/tdapi/tl_get_forum_topic_gen.go new file mode 100644 index 0000000000..b2eabe669e --- /dev/null +++ b/tdapi/tl_get_forum_topic_gen.go @@ -0,0 +1,237 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +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{} +) + +// GetForumTopicRequest represents TL type `getForumTopic#e59bfe41`. +type GetForumTopicRequest struct { + // Identifier of the chat + ChatID int64 + // Message thread identifier of the forum topic + MessageThreadID int64 +} + +// GetForumTopicRequestTypeID is TL type id of GetForumTopicRequest. +const GetForumTopicRequestTypeID = 0xe59bfe41 + +// Ensuring interfaces in compile-time for GetForumTopicRequest. +var ( + _ bin.Encoder = &GetForumTopicRequest{} + _ bin.Decoder = &GetForumTopicRequest{} + _ bin.BareEncoder = &GetForumTopicRequest{} + _ bin.BareDecoder = &GetForumTopicRequest{} +) + +func (g *GetForumTopicRequest) Zero() bool { + if g == nil { + return true + } + if !(g.ChatID == 0) { + return false + } + if !(g.MessageThreadID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetForumTopicRequest) String() string { + if g == nil { + return "GetForumTopicRequest(nil)" + } + type Alias GetForumTopicRequest + return fmt.Sprintf("GetForumTopicRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetForumTopicRequest) TypeID() uint32 { + return GetForumTopicRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetForumTopicRequest) TypeName() string { + return "getForumTopic" +} + +// TypeInfo returns info about TL type. +func (g *GetForumTopicRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getForumTopic", + ID: GetForumTopicRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "MessageThreadID", + SchemaName: "message_thread_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetForumTopicRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getForumTopic#e59bfe41 as nil") + } + b.PutID(GetForumTopicRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetForumTopicRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getForumTopic#e59bfe41 as nil") + } + b.PutInt53(g.ChatID) + b.PutInt53(g.MessageThreadID) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetForumTopicRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getForumTopic#e59bfe41 to nil") + } + if err := b.ConsumeID(GetForumTopicRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getForumTopic#e59bfe41: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetForumTopicRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getForumTopic#e59bfe41 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getForumTopic#e59bfe41: field chat_id: %w", err) + } + g.ChatID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getForumTopic#e59bfe41: field message_thread_id: %w", err) + } + g.MessageThreadID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetForumTopicRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getForumTopic#e59bfe41 as nil") + } + b.ObjStart() + b.PutID("getForumTopic") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(g.ChatID) + b.Comma() + b.FieldStart("message_thread_id") + b.PutInt53(g.MessageThreadID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetForumTopicRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getForumTopic#e59bfe41 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getForumTopic"); err != nil { + return fmt.Errorf("unable to decode getForumTopic#e59bfe41: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getForumTopic#e59bfe41: field chat_id: %w", err) + } + g.ChatID = value + case "message_thread_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getForumTopic#e59bfe41: field message_thread_id: %w", err) + } + g.MessageThreadID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (g *GetForumTopicRequest) GetChatID() (value int64) { + if g == nil { + return + } + return g.ChatID +} + +// GetMessageThreadID returns value of MessageThreadID field. +func (g *GetForumTopicRequest) GetMessageThreadID() (value int64) { + if g == nil { + return + } + return g.MessageThreadID +} + +// GetForumTopic invokes method getForumTopic#e59bfe41 returning error if any. +func (c *Client) GetForumTopic(ctx context.Context, request *GetForumTopicRequest) (*ForumTopic, error) { + var result ForumTopic + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_forum_topic_link_gen.go b/tdapi/tl_get_forum_topic_link_gen.go new file mode 100644 index 0000000000..fa416adb9b --- /dev/null +++ b/tdapi/tl_get_forum_topic_link_gen.go @@ -0,0 +1,237 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +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{} +) + +// GetForumTopicLinkRequest represents TL type `getForumTopicLink#a8e6c24b`. +type GetForumTopicLinkRequest struct { + // Identifier of the chat + ChatID int64 + // Message thread identifier of the forum topic + MessageThreadID int64 +} + +// GetForumTopicLinkRequestTypeID is TL type id of GetForumTopicLinkRequest. +const GetForumTopicLinkRequestTypeID = 0xa8e6c24b + +// Ensuring interfaces in compile-time for GetForumTopicLinkRequest. +var ( + _ bin.Encoder = &GetForumTopicLinkRequest{} + _ bin.Decoder = &GetForumTopicLinkRequest{} + _ bin.BareEncoder = &GetForumTopicLinkRequest{} + _ bin.BareDecoder = &GetForumTopicLinkRequest{} +) + +func (g *GetForumTopicLinkRequest) Zero() bool { + if g == nil { + return true + } + if !(g.ChatID == 0) { + return false + } + if !(g.MessageThreadID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetForumTopicLinkRequest) String() string { + if g == nil { + return "GetForumTopicLinkRequest(nil)" + } + type Alias GetForumTopicLinkRequest + return fmt.Sprintf("GetForumTopicLinkRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetForumTopicLinkRequest) TypeID() uint32 { + return GetForumTopicLinkRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetForumTopicLinkRequest) TypeName() string { + return "getForumTopicLink" +} + +// TypeInfo returns info about TL type. +func (g *GetForumTopicLinkRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getForumTopicLink", + ID: GetForumTopicLinkRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "MessageThreadID", + SchemaName: "message_thread_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetForumTopicLinkRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getForumTopicLink#a8e6c24b as nil") + } + b.PutID(GetForumTopicLinkRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetForumTopicLinkRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getForumTopicLink#a8e6c24b as nil") + } + b.PutInt53(g.ChatID) + b.PutInt53(g.MessageThreadID) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetForumTopicLinkRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getForumTopicLink#a8e6c24b to nil") + } + if err := b.ConsumeID(GetForumTopicLinkRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getForumTopicLink#a8e6c24b: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetForumTopicLinkRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getForumTopicLink#a8e6c24b to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getForumTopicLink#a8e6c24b: field chat_id: %w", err) + } + g.ChatID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getForumTopicLink#a8e6c24b: field message_thread_id: %w", err) + } + g.MessageThreadID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetForumTopicLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getForumTopicLink#a8e6c24b as nil") + } + b.ObjStart() + b.PutID("getForumTopicLink") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(g.ChatID) + b.Comma() + b.FieldStart("message_thread_id") + b.PutInt53(g.MessageThreadID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetForumTopicLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getForumTopicLink#a8e6c24b to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getForumTopicLink"); err != nil { + return fmt.Errorf("unable to decode getForumTopicLink#a8e6c24b: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getForumTopicLink#a8e6c24b: field chat_id: %w", err) + } + g.ChatID = value + case "message_thread_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getForumTopicLink#a8e6c24b: field message_thread_id: %w", err) + } + g.MessageThreadID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (g *GetForumTopicLinkRequest) GetChatID() (value int64) { + if g == nil { + return + } + return g.ChatID +} + +// GetMessageThreadID returns value of MessageThreadID field. +func (g *GetForumTopicLinkRequest) GetMessageThreadID() (value int64) { + if g == nil { + return + } + return g.MessageThreadID +} + +// GetForumTopicLink invokes method getForumTopicLink#a8e6c24b returning error if any. +func (c *Client) GetForumTopicLink(ctx context.Context, request *GetForumTopicLinkRequest) (*HTTPURL, error) { + var result HTTPURL + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_forum_topics_gen.go b/tdapi/tl_get_forum_topics_gen.go new file mode 100644 index 0000000000..88fd5fcd48 --- /dev/null +++ b/tdapi/tl_get_forum_topics_gen.go @@ -0,0 +1,377 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +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{} +) + +// GetForumTopicsRequest represents TL type `getForumTopics#fbab7d5a`. +type GetForumTopicsRequest struct { + // Identifier of the forum chat + ChatID int64 + // Query to search for in the forum topic's name + Query string + // The date starting from which the results need to be fetched. Use 0 or any date in the + // future to get results from the last topic + OffsetDate int32 + // The message identifier of the last message in the last found topic, or 0 for the first + // request + OffsetMessageID int64 + // The message thread identifier of the last found topic, or 0 for the first request + OffsetMessageThreadID int64 + // The maximum number of forum topics to be returned; up to 100. For optimal performance, + // the number of returned forum topics is chosen by TDLib and can be smaller than the + // specified limit + Limit int32 +} + +// GetForumTopicsRequestTypeID is TL type id of GetForumTopicsRequest. +const GetForumTopicsRequestTypeID = 0xfbab7d5a + +// Ensuring interfaces in compile-time for GetForumTopicsRequest. +var ( + _ bin.Encoder = &GetForumTopicsRequest{} + _ bin.Decoder = &GetForumTopicsRequest{} + _ bin.BareEncoder = &GetForumTopicsRequest{} + _ bin.BareDecoder = &GetForumTopicsRequest{} +) + +func (g *GetForumTopicsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.ChatID == 0) { + return false + } + if !(g.Query == "") { + return false + } + if !(g.OffsetDate == 0) { + return false + } + if !(g.OffsetMessageID == 0) { + return false + } + if !(g.OffsetMessageThreadID == 0) { + return false + } + if !(g.Limit == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetForumTopicsRequest) String() string { + if g == nil { + return "GetForumTopicsRequest(nil)" + } + type Alias GetForumTopicsRequest + return fmt.Sprintf("GetForumTopicsRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetForumTopicsRequest) TypeID() uint32 { + return GetForumTopicsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetForumTopicsRequest) TypeName() string { + return "getForumTopics" +} + +// TypeInfo returns info about TL type. +func (g *GetForumTopicsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getForumTopics", + ID: GetForumTopicsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "Query", + SchemaName: "query", + }, + { + Name: "OffsetDate", + SchemaName: "offset_date", + }, + { + Name: "OffsetMessageID", + SchemaName: "offset_message_id", + }, + { + Name: "OffsetMessageThreadID", + SchemaName: "offset_message_thread_id", + }, + { + Name: "Limit", + SchemaName: "limit", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetForumTopicsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getForumTopics#fbab7d5a as nil") + } + b.PutID(GetForumTopicsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetForumTopicsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getForumTopics#fbab7d5a as nil") + } + b.PutInt53(g.ChatID) + b.PutString(g.Query) + b.PutInt32(g.OffsetDate) + b.PutInt53(g.OffsetMessageID) + b.PutInt53(g.OffsetMessageThreadID) + b.PutInt32(g.Limit) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetForumTopicsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getForumTopics#fbab7d5a to nil") + } + if err := b.ConsumeID(GetForumTopicsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetForumTopicsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getForumTopics#fbab7d5a to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field chat_id: %w", err) + } + g.ChatID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field query: %w", err) + } + g.Query = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field offset_date: %w", err) + } + g.OffsetDate = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field offset_message_id: %w", err) + } + g.OffsetMessageID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field offset_message_thread_id: %w", err) + } + g.OffsetMessageThreadID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field limit: %w", err) + } + g.Limit = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetForumTopicsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getForumTopics#fbab7d5a as nil") + } + b.ObjStart() + b.PutID("getForumTopics") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(g.ChatID) + b.Comma() + b.FieldStart("query") + b.PutString(g.Query) + b.Comma() + b.FieldStart("offset_date") + b.PutInt32(g.OffsetDate) + b.Comma() + b.FieldStart("offset_message_id") + b.PutInt53(g.OffsetMessageID) + b.Comma() + b.FieldStart("offset_message_thread_id") + b.PutInt53(g.OffsetMessageThreadID) + b.Comma() + b.FieldStart("limit") + b.PutInt32(g.Limit) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetForumTopicsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getForumTopics#fbab7d5a to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getForumTopics"); err != nil { + return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field chat_id: %w", err) + } + g.ChatID = value + case "query": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field query: %w", err) + } + g.Query = value + case "offset_date": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field offset_date: %w", err) + } + g.OffsetDate = value + case "offset_message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field offset_message_id: %w", err) + } + g.OffsetMessageID = value + case "offset_message_thread_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field offset_message_thread_id: %w", err) + } + g.OffsetMessageThreadID = value + case "limit": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field limit: %w", err) + } + g.Limit = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (g *GetForumTopicsRequest) GetChatID() (value int64) { + if g == nil { + return + } + return g.ChatID +} + +// GetQuery returns value of Query field. +func (g *GetForumTopicsRequest) GetQuery() (value string) { + if g == nil { + return + } + return g.Query +} + +// GetOffsetDate returns value of OffsetDate field. +func (g *GetForumTopicsRequest) GetOffsetDate() (value int32) { + if g == nil { + return + } + return g.OffsetDate +} + +// GetOffsetMessageID returns value of OffsetMessageID field. +func (g *GetForumTopicsRequest) GetOffsetMessageID() (value int64) { + if g == nil { + return + } + return g.OffsetMessageID +} + +// GetOffsetMessageThreadID returns value of OffsetMessageThreadID field. +func (g *GetForumTopicsRequest) GetOffsetMessageThreadID() (value int64) { + if g == nil { + return + } + return g.OffsetMessageThreadID +} + +// GetLimit returns value of Limit field. +func (g *GetForumTopicsRequest) GetLimit() (value int32) { + if g == nil { + return + } + return g.Limit +} + +// GetForumTopics invokes method getForumTopics#fbab7d5a returning error if any. +func (c *Client) GetForumTopics(ctx context.Context, request *GetForumTopicsRequest) (*ForumTopics, error) { + var result ForumTopics + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_payment_receipt_gen.go b/tdapi/tl_get_payment_receipt_gen.go index 78d7e4d3f4..6c8935901d 100644 --- a/tdapi/tl_get_payment_receipt_gen.go +++ b/tdapi/tl_get_payment_receipt_gen.go @@ -33,7 +33,7 @@ var ( // GetPaymentReceiptRequest represents TL type `getPaymentReceipt#3c6cb956`. type GetPaymentReceiptRequest struct { - // Chat identifier of the PaymentSuccessful message + // Chat identifier of the messagePaymentSuccessful message ChatID int64 // Message identifier MessageID int64 diff --git a/tdapi/tl_get_user_link_gen.go b/tdapi/tl_get_user_link_gen.go new file mode 100644 index 0000000000..9d29c4f419 --- /dev/null +++ b/tdapi/tl_get_user_link_gen.go @@ -0,0 +1,169 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +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{} +) + +// GetUserLinkRequest represents TL type `getUserLink#492014e6`. +type GetUserLinkRequest struct { +} + +// GetUserLinkRequestTypeID is TL type id of GetUserLinkRequest. +const GetUserLinkRequestTypeID = 0x492014e6 + +// Ensuring interfaces in compile-time for GetUserLinkRequest. +var ( + _ bin.Encoder = &GetUserLinkRequest{} + _ bin.Decoder = &GetUserLinkRequest{} + _ bin.BareEncoder = &GetUserLinkRequest{} + _ bin.BareDecoder = &GetUserLinkRequest{} +) + +func (g *GetUserLinkRequest) Zero() bool { + if g == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetUserLinkRequest) String() string { + if g == nil { + return "GetUserLinkRequest(nil)" + } + type Alias GetUserLinkRequest + return fmt.Sprintf("GetUserLinkRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetUserLinkRequest) TypeID() uint32 { + return GetUserLinkRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetUserLinkRequest) TypeName() string { + return "getUserLink" +} + +// TypeInfo returns info about TL type. +func (g *GetUserLinkRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getUserLink", + ID: GetUserLinkRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (g *GetUserLinkRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getUserLink#492014e6 as nil") + } + b.PutID(GetUserLinkRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetUserLinkRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getUserLink#492014e6 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (g *GetUserLinkRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getUserLink#492014e6 to nil") + } + if err := b.ConsumeID(GetUserLinkRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getUserLink#492014e6: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetUserLinkRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getUserLink#492014e6 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetUserLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getUserLink#492014e6 as nil") + } + b.ObjStart() + b.PutID("getUserLink") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetUserLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getUserLink#492014e6 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getUserLink"); err != nil { + return fmt.Errorf("unable to decode getUserLink#492014e6: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetUserLink invokes method getUserLink#492014e6 returning error if any. +func (c *Client) GetUserLink(ctx context.Context) (*UserLink, error) { + var result UserLink + + request := &GetUserLinkRequest{} + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_group_call_participant_video_info_gen.go b/tdapi/tl_group_call_participant_video_info_gen.go index 0540132753..9dc6857f73 100644 --- a/tdapi/tl_group_call_participant_video_info_gen.go +++ b/tdapi/tl_group_call_participant_video_info_gen.go @@ -37,7 +37,7 @@ type GroupCallParticipantVideoInfo struct { SourceGroups []GroupCallVideoSourceGroup // Video channel endpoint identifier EndpointID string - // True if the video is paused. This flag needs to be ignored, if new video frames are + // True, if the video is paused. This flag needs to be ignored, if new video frames are // received IsPaused bool } diff --git a/tdapi/tl_input_message_content_gen.go b/tdapi/tl_input_message_content_gen.go index aaf6490782..7628dd57cf 100644 --- a/tdapi/tl_input_message_content_gen.go +++ b/tdapi/tl_input_message_content_gen.go @@ -33,7 +33,7 @@ var ( // InputMessageText represents TL type `inputMessageText#eb9b098`. type InputMessageText struct { - // Formatted text to be sent; 1-GetOption("message_text_length_max") characters. Only + // Formatted text to be sent; 1-getOption("message_text_length_max") characters. Only // Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Code, Pre, PreCode, // TextUrl and MentionName entities are allowed to be specified manually Text FormattedText @@ -282,7 +282,7 @@ type InputMessageAnimation struct { // Height of the animation; may be replaced by the server Height int32 // Animation caption; pass null to use an empty caption; - // 0-GetOption("message_caption_length_max") characters + // 0-getOption("message_caption_length_max") characters Caption FormattedText } @@ -685,7 +685,7 @@ type InputMessageAudio struct { // Performer of the audio; 0-64 characters, may be replaced by the server Performer string // Audio caption; pass null to use an empty caption; - // 0-GetOption("message_caption_length_max") characters + // 0-getOption("message_caption_length_max") characters Caption FormattedText } @@ -1029,7 +1029,7 @@ type InputMessageDocument struct { // be sent as file. Always true for files sent to secret chats DisableContentTypeDetection bool // Document caption; pass null to use an empty caption; - // 0-GetOption("message_caption_length_max") characters + // 0-getOption("message_caption_length_max") characters Caption FormattedText } @@ -1314,7 +1314,7 @@ type InputMessagePhoto struct { // Photo height Height int32 // Photo caption; pass null to use an empty caption; - // 0-GetOption("message_caption_length_max") characters + // 0-getOption("message_caption_length_max") characters Caption FormattedText // Photo TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in // private chats @@ -2036,7 +2036,7 @@ type InputMessageVideo struct { // True, if the video is supposed to be streamed SupportsStreaming bool // Video caption; pass null to use an empty caption; - // 0-GetOption("message_caption_length_max") characters + // 0-getOption("message_caption_length_max") characters Caption FormattedText // Video TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in // private chats @@ -2780,7 +2780,7 @@ type InputMessageVoiceNote struct { // Waveform representation of the voice note in 5-bit format Waveform []byte // Voice note caption; pass null to use an empty caption; - // 0-GetOption("message_caption_length_max") characters + // 0-getOption("message_caption_length_max") characters Caption FormattedText } diff --git a/tdapi/tl_internal_link_type_gen.go b/tdapi/tl_internal_link_type_gen.go index b1173332e7..84dfc1b04c 100644 --- a/tdapi/tl_internal_link_type_gen.go +++ b/tdapi/tl_internal_link_type_gen.go @@ -5596,6 +5596,172 @@ func (i *InternalLinkTypeUserPhoneNumber) GetPhoneNumber() (value string) { return i.PhoneNumber } +// InternalLinkTypeUserToken represents TL type `internalLinkTypeUserToken#a8d7db59`. +type InternalLinkTypeUserToken struct { + // The token + Token string +} + +// InternalLinkTypeUserTokenTypeID is TL type id of InternalLinkTypeUserToken. +const InternalLinkTypeUserTokenTypeID = 0xa8d7db59 + +// construct implements constructor of InternalLinkTypeClass. +func (i InternalLinkTypeUserToken) construct() InternalLinkTypeClass { return &i } + +// Ensuring interfaces in compile-time for InternalLinkTypeUserToken. +var ( + _ bin.Encoder = &InternalLinkTypeUserToken{} + _ bin.Decoder = &InternalLinkTypeUserToken{} + _ bin.BareEncoder = &InternalLinkTypeUserToken{} + _ bin.BareDecoder = &InternalLinkTypeUserToken{} + + _ InternalLinkTypeClass = &InternalLinkTypeUserToken{} +) + +func (i *InternalLinkTypeUserToken) Zero() bool { + if i == nil { + return true + } + if !(i.Token == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InternalLinkTypeUserToken) String() string { + if i == nil { + return "InternalLinkTypeUserToken(nil)" + } + type Alias InternalLinkTypeUserToken + return fmt.Sprintf("InternalLinkTypeUserToken%+v", Alias(*i)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InternalLinkTypeUserToken) TypeID() uint32 { + return InternalLinkTypeUserTokenTypeID +} + +// TypeName returns name of type in TL schema. +func (*InternalLinkTypeUserToken) TypeName() string { + return "internalLinkTypeUserToken" +} + +// TypeInfo returns info about TL type. +func (i *InternalLinkTypeUserToken) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "internalLinkTypeUserToken", + ID: InternalLinkTypeUserTokenTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Token", + SchemaName: "token", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *InternalLinkTypeUserToken) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode internalLinkTypeUserToken#a8d7db59 as nil") + } + b.PutID(InternalLinkTypeUserTokenTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InternalLinkTypeUserToken) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode internalLinkTypeUserToken#a8d7db59 as nil") + } + b.PutString(i.Token) + return nil +} + +// Decode implements bin.Decoder. +func (i *InternalLinkTypeUserToken) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode internalLinkTypeUserToken#a8d7db59 to nil") + } + if err := b.ConsumeID(InternalLinkTypeUserTokenTypeID); err != nil { + return fmt.Errorf("unable to decode internalLinkTypeUserToken#a8d7db59: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InternalLinkTypeUserToken) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode internalLinkTypeUserToken#a8d7db59 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode internalLinkTypeUserToken#a8d7db59: field token: %w", err) + } + i.Token = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (i *InternalLinkTypeUserToken) EncodeTDLibJSON(b tdjson.Encoder) error { + if i == nil { + return fmt.Errorf("can't encode internalLinkTypeUserToken#a8d7db59 as nil") + } + b.ObjStart() + b.PutID("internalLinkTypeUserToken") + b.Comma() + b.FieldStart("token") + b.PutString(i.Token) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (i *InternalLinkTypeUserToken) DecodeTDLibJSON(b tdjson.Decoder) error { + if i == nil { + return fmt.Errorf("can't decode internalLinkTypeUserToken#a8d7db59 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("internalLinkTypeUserToken"); err != nil { + return fmt.Errorf("unable to decode internalLinkTypeUserToken#a8d7db59: %w", err) + } + case "token": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode internalLinkTypeUserToken#a8d7db59: field token: %w", err) + } + i.Token = value + default: + return b.Skip() + } + return nil + }) +} + +// GetToken returns value of Token field. +func (i *InternalLinkTypeUserToken) GetToken() (value string) { + if i == nil { + return + } + return i.Token +} + // InternalLinkTypeVideoChat represents TL type `internalLinkTypeVideoChat#8796f8b4`. type InternalLinkTypeVideoChat struct { // Username of the chat with the video chat @@ -5876,6 +6042,7 @@ const InternalLinkTypeClassName = "InternalLinkType" // case *tdapi.InternalLinkTypeUnknownDeepLink: // internalLinkTypeUnknownDeepLink#2549d7db // case *tdapi.InternalLinkTypeUnsupportedProxy: // internalLinkTypeUnsupportedProxy#de399f09 // case *tdapi.InternalLinkTypeUserPhoneNumber: // internalLinkTypeUserPhoneNumber#8b6d9a69 +// case *tdapi.InternalLinkTypeUserToken: // internalLinkTypeUserToken#a8d7db59 // case *tdapi.InternalLinkTypeVideoChat: // internalLinkTypeVideoChat#8796f8b4 // default: panic(v) // } @@ -6132,6 +6299,13 @@ func DecodeInternalLinkType(buf *bin.Buffer) (InternalLinkTypeClass, error) { return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) } return &v, nil + case InternalLinkTypeUserTokenTypeID: + // Decoding internalLinkTypeUserToken#a8d7db59. + v := InternalLinkTypeUserToken{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) + } + return &v, nil case InternalLinkTypeVideoChatTypeID: // Decoding internalLinkTypeVideoChat#8796f8b4. v := InternalLinkTypeVideoChat{} @@ -6375,6 +6549,13 @@ func DecodeTDLibJSONInternalLinkType(buf tdjson.Decoder) (InternalLinkTypeClass, return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) } return &v, nil + case "internalLinkTypeUserToken": + // Decoding internalLinkTypeUserToken#a8d7db59. + v := InternalLinkTypeUserToken{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) + } + return &v, nil case "internalLinkTypeVideoChat": // Decoding internalLinkTypeVideoChat#8796f8b4. v := InternalLinkTypeVideoChat{} diff --git a/tdapi/tl_message_content_gen.go b/tdapi/tl_message_content_gen.go index de7838c0f0..c93c567e2c 100644 --- a/tdapi/tl_message_content_gen.go +++ b/tdapi/tl_message_content_gen.go @@ -7550,14 +7550,16 @@ func (m *MessageChatSetTheme) GetThemeName() (value string) { return m.ThemeName } -// MessageChatSetTTL represents TL type `messageChatSetTtl#6be353b1`. +// MessageChatSetTTL represents TL type `messageChatSetTtl#49e6b31b`. type MessageChatSetTTL struct { // New message TTL TTL int32 + // If not 0, a user identifier, which default setting was automatically applied + FromUserID int64 } // MessageChatSetTTLTypeID is TL type id of MessageChatSetTTL. -const MessageChatSetTTLTypeID = 0x6be353b1 +const MessageChatSetTTLTypeID = 0x49e6b31b // construct implements constructor of MessageContentClass. func (m MessageChatSetTTL) construct() MessageContentClass { return &m } @@ -7579,6 +7581,9 @@ func (m *MessageChatSetTTL) Zero() bool { if !(m.TTL == 0) { return false } + if !(m.FromUserID == 0) { + return false + } return true } @@ -7619,6 +7624,10 @@ func (m *MessageChatSetTTL) TypeInfo() tdp.Type { Name: "TTL", SchemaName: "ttl", }, + { + Name: "FromUserID", + SchemaName: "from_user_id", + }, } return typ } @@ -7626,7 +7635,7 @@ func (m *MessageChatSetTTL) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (m *MessageChatSetTTL) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageChatSetTtl#6be353b1 as nil") + return fmt.Errorf("can't encode messageChatSetTtl#49e6b31b as nil") } b.PutID(MessageChatSetTTLTypeID) return m.EncodeBare(b) @@ -7635,19 +7644,20 @@ func (m *MessageChatSetTTL) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageChatSetTTL) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageChatSetTtl#6be353b1 as nil") + return fmt.Errorf("can't encode messageChatSetTtl#49e6b31b as nil") } b.PutInt32(m.TTL) + b.PutInt53(m.FromUserID) return nil } // Decode implements bin.Decoder. func (m *MessageChatSetTTL) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageChatSetTtl#6be353b1 to nil") + return fmt.Errorf("can't decode messageChatSetTtl#49e6b31b to nil") } if err := b.ConsumeID(MessageChatSetTTLTypeID); err != nil { - return fmt.Errorf("unable to decode messageChatSetTtl#6be353b1: %w", err) + return fmt.Errorf("unable to decode messageChatSetTtl#49e6b31b: %w", err) } return m.DecodeBare(b) } @@ -7655,22 +7665,29 @@ func (m *MessageChatSetTTL) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageChatSetTTL) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageChatSetTtl#6be353b1 to nil") + return fmt.Errorf("can't decode messageChatSetTtl#49e6b31b to nil") } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messageChatSetTtl#6be353b1: field ttl: %w", err) + return fmt.Errorf("unable to decode messageChatSetTtl#49e6b31b: field ttl: %w", err) } m.TTL = value } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageChatSetTtl#49e6b31b: field from_user_id: %w", err) + } + m.FromUserID = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (m *MessageChatSetTTL) EncodeTDLibJSON(b tdjson.Encoder) error { if m == nil { - return fmt.Errorf("can't encode messageChatSetTtl#6be353b1 as nil") + return fmt.Errorf("can't encode messageChatSetTtl#49e6b31b as nil") } b.ObjStart() b.PutID("messageChatSetTtl") @@ -7678,6 +7695,9 @@ func (m *MessageChatSetTTL) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("ttl") b.PutInt32(m.TTL) b.Comma() + b.FieldStart("from_user_id") + b.PutInt53(m.FromUserID) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -7686,21 +7706,27 @@ func (m *MessageChatSetTTL) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (m *MessageChatSetTTL) DecodeTDLibJSON(b tdjson.Decoder) error { if m == nil { - return fmt.Errorf("can't decode messageChatSetTtl#6be353b1 to nil") + return fmt.Errorf("can't decode messageChatSetTtl#49e6b31b to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("messageChatSetTtl"); err != nil { - return fmt.Errorf("unable to decode messageChatSetTtl#6be353b1: %w", err) + return fmt.Errorf("unable to decode messageChatSetTtl#49e6b31b: %w", err) } case "ttl": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messageChatSetTtl#6be353b1: field ttl: %w", err) + return fmt.Errorf("unable to decode messageChatSetTtl#49e6b31b: field ttl: %w", err) } m.TTL = value + case "from_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageChatSetTtl#49e6b31b: field from_user_id: %w", err) + } + m.FromUserID = value default: return b.Skip() } @@ -7716,6 +7742,14 @@ func (m *MessageChatSetTTL) GetTTL() (value int32) { return m.TTL } +// GetFromUserID returns value of FromUserID field. +func (m *MessageChatSetTTL) GetFromUserID() (value int64) { + if m == nil { + return + } + return m.FromUserID +} + // MessageForumTopicCreated represents TL type `messageForumTopicCreated#b8ce47d1`. type MessageForumTopicCreated struct { // Name of the topic @@ -8153,7 +8187,7 @@ func (m *MessageForumTopicEdited) GetIconCustomEmojiID() (value int64) { // MessageForumTopicIsClosedToggled represents TL type `messageForumTopicIsClosedToggled#4b578fe0`. type MessageForumTopicIsClosedToggled struct { - // True if the topic was closed or reopened + // True, if the topic was closed, otherwise the topic was reopened IsClosed bool } @@ -8317,6 +8351,172 @@ func (m *MessageForumTopicIsClosedToggled) GetIsClosed() (value bool) { return m.IsClosed } +// MessageForumTopicIsHiddenToggled represents TL type `messageForumTopicIsHiddenToggled#979393fe`. +type MessageForumTopicIsHiddenToggled struct { + // True, if the topic was hidden, otherwise the topic was unhidden + IsHidden bool +} + +// MessageForumTopicIsHiddenToggledTypeID is TL type id of MessageForumTopicIsHiddenToggled. +const MessageForumTopicIsHiddenToggledTypeID = 0x979393fe + +// construct implements constructor of MessageContentClass. +func (m MessageForumTopicIsHiddenToggled) construct() MessageContentClass { return &m } + +// Ensuring interfaces in compile-time for MessageForumTopicIsHiddenToggled. +var ( + _ bin.Encoder = &MessageForumTopicIsHiddenToggled{} + _ bin.Decoder = &MessageForumTopicIsHiddenToggled{} + _ bin.BareEncoder = &MessageForumTopicIsHiddenToggled{} + _ bin.BareDecoder = &MessageForumTopicIsHiddenToggled{} + + _ MessageContentClass = &MessageForumTopicIsHiddenToggled{} +) + +func (m *MessageForumTopicIsHiddenToggled) Zero() bool { + if m == nil { + return true + } + if !(m.IsHidden == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageForumTopicIsHiddenToggled) String() string { + if m == nil { + return "MessageForumTopicIsHiddenToggled(nil)" + } + type Alias MessageForumTopicIsHiddenToggled + return fmt.Sprintf("MessageForumTopicIsHiddenToggled%+v", Alias(*m)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageForumTopicIsHiddenToggled) TypeID() uint32 { + return MessageForumTopicIsHiddenToggledTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageForumTopicIsHiddenToggled) TypeName() string { + return "messageForumTopicIsHiddenToggled" +} + +// TypeInfo returns info about TL type. +func (m *MessageForumTopicIsHiddenToggled) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageForumTopicIsHiddenToggled", + ID: MessageForumTopicIsHiddenToggledTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "IsHidden", + SchemaName: "is_hidden", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MessageForumTopicIsHiddenToggled) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageForumTopicIsHiddenToggled#979393fe as nil") + } + b.PutID(MessageForumTopicIsHiddenToggledTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageForumTopicIsHiddenToggled) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageForumTopicIsHiddenToggled#979393fe as nil") + } + b.PutBool(m.IsHidden) + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageForumTopicIsHiddenToggled) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageForumTopicIsHiddenToggled#979393fe to nil") + } + if err := b.ConsumeID(MessageForumTopicIsHiddenToggledTypeID); err != nil { + return fmt.Errorf("unable to decode messageForumTopicIsHiddenToggled#979393fe: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageForumTopicIsHiddenToggled) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageForumTopicIsHiddenToggled#979393fe to nil") + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageForumTopicIsHiddenToggled#979393fe: field is_hidden: %w", err) + } + m.IsHidden = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (m *MessageForumTopicIsHiddenToggled) EncodeTDLibJSON(b tdjson.Encoder) error { + if m == nil { + return fmt.Errorf("can't encode messageForumTopicIsHiddenToggled#979393fe as nil") + } + b.ObjStart() + b.PutID("messageForumTopicIsHiddenToggled") + b.Comma() + b.FieldStart("is_hidden") + b.PutBool(m.IsHidden) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (m *MessageForumTopicIsHiddenToggled) DecodeTDLibJSON(b tdjson.Decoder) error { + if m == nil { + return fmt.Errorf("can't decode messageForumTopicIsHiddenToggled#979393fe to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("messageForumTopicIsHiddenToggled"); err != nil { + return fmt.Errorf("unable to decode messageForumTopicIsHiddenToggled#979393fe: %w", err) + } + case "is_hidden": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageForumTopicIsHiddenToggled#979393fe: field is_hidden: %w", err) + } + m.IsHidden = value + default: + return b.Skip() + } + return nil + }) +} + +// GetIsHidden returns value of IsHidden field. +func (m *MessageForumTopicIsHiddenToggled) GetIsHidden() (value bool) { + if m == nil { + return + } + return m.IsHidden +} + // MessageCustomServiceAction represents TL type `messageCustomServiceAction#5595c772`. type MessageCustomServiceAction struct { // Message text to be shown in the chat @@ -11321,10 +11521,11 @@ const MessageContentClassName = "MessageContent" // case *tdapi.MessagePinMessage: // messagePinMessage#38d55039 // case *tdapi.MessageScreenshotTaken: // messageScreenshotTaken#a2b86dab // case *tdapi.MessageChatSetTheme: // messageChatSetTheme#99ae9408 -// case *tdapi.MessageChatSetTTL: // messageChatSetTtl#6be353b1 +// case *tdapi.MessageChatSetTTL: // messageChatSetTtl#49e6b31b // case *tdapi.MessageForumTopicCreated: // messageForumTopicCreated#b8ce47d1 // case *tdapi.MessageForumTopicEdited: // messageForumTopicEdited#c0b780 // case *tdapi.MessageForumTopicIsClosedToggled: // messageForumTopicIsClosedToggled#4b578fe0 +// case *tdapi.MessageForumTopicIsHiddenToggled: // messageForumTopicIsHiddenToggled#979393fe // case *tdapi.MessageCustomServiceAction: // messageCustomServiceAction#5595c772 // case *tdapi.MessageGameScore: // messageGameScore#50299d7f // case *tdapi.MessagePaymentSuccessful: // messagePaymentSuccessful#53d93cdc @@ -11636,7 +11837,7 @@ func DecodeMessageContent(buf *bin.Buffer) (MessageContentClass, error) { } return &v, nil case MessageChatSetTTLTypeID: - // Decoding messageChatSetTtl#6be353b1. + // Decoding messageChatSetTtl#49e6b31b. v := MessageChatSetTTL{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) @@ -11663,6 +11864,13 @@ func DecodeMessageContent(buf *bin.Buffer) (MessageContentClass, error) { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil + case MessageForumTopicIsHiddenToggledTypeID: + // Decoding messageForumTopicIsHiddenToggled#979393fe. + v := MessageForumTopicIsHiddenToggled{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) + } + return &v, nil case MessageCustomServiceActionTypeID: // Decoding messageCustomServiceAction#5595c772. v := MessageCustomServiceAction{} @@ -12033,7 +12241,7 @@ func DecodeTDLibJSONMessageContent(buf tdjson.Decoder) (MessageContentClass, err } return &v, nil case "messageChatSetTtl": - // Decoding messageChatSetTtl#6be353b1. + // Decoding messageChatSetTtl#49e6b31b. v := MessageChatSetTTL{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) @@ -12060,6 +12268,13 @@ func DecodeTDLibJSONMessageContent(buf tdjson.Decoder) (MessageContentClass, err return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil + case "messageForumTopicIsHiddenToggled": + // Decoding messageForumTopicIsHiddenToggled#979393fe. + v := MessageForumTopicIsHiddenToggled{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) + } + return &v, nil case "messageCustomServiceAction": // Decoding messageCustomServiceAction#5595c772. v := MessageCustomServiceAction{} diff --git a/tdapi/tl_message_link_info_gen.go b/tdapi/tl_message_link_info_gen.go index 7eff141fbc..0576bf7be0 100644 --- a/tdapi/tl_message_link_info_gen.go +++ b/tdapi/tl_message_link_info_gen.go @@ -37,8 +37,8 @@ type MessageLinkInfo struct { IsPublic bool // If found, identifier of the chat to which the message belongs, 0 otherwise ChatID int64 - // If found, identifier of the message thread in which to open the message, or which to - // open in case of a missing message + // If found, identifier of the message thread in which to open the message, or a forum + // topic to open if the message is missing MessageThreadID int64 // If found, the linked message; may be null Message Message diff --git a/tdapi/tl_message_ttl_gen.go b/tdapi/tl_message_ttl_gen.go new file mode 100644 index 0000000000..2e94334da8 --- /dev/null +++ b/tdapi/tl_message_ttl_gen.go @@ -0,0 +1,193 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +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{} +) + +// MessageTTL represents TL type `messageTtl#80950a73`. +type MessageTTL struct { + // Message TTL setting, in seconds. If 0, then messages aren't deleted automatically + TTL int32 +} + +// MessageTTLTypeID is TL type id of MessageTTL. +const MessageTTLTypeID = 0x80950a73 + +// Ensuring interfaces in compile-time for MessageTTL. +var ( + _ bin.Encoder = &MessageTTL{} + _ bin.Decoder = &MessageTTL{} + _ bin.BareEncoder = &MessageTTL{} + _ bin.BareDecoder = &MessageTTL{} +) + +func (m *MessageTTL) Zero() bool { + if m == nil { + return true + } + if !(m.TTL == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageTTL) String() string { + if m == nil { + return "MessageTTL(nil)" + } + type Alias MessageTTL + return fmt.Sprintf("MessageTTL%+v", Alias(*m)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageTTL) TypeID() uint32 { + return MessageTTLTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageTTL) TypeName() string { + return "messageTtl" +} + +// TypeInfo returns info about TL type. +func (m *MessageTTL) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageTtl", + ID: MessageTTLTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "TTL", + SchemaName: "ttl", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MessageTTL) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageTtl#80950a73 as nil") + } + b.PutID(MessageTTLTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageTTL) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageTtl#80950a73 as nil") + } + b.PutInt32(m.TTL) + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageTTL) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageTtl#80950a73 to nil") + } + if err := b.ConsumeID(MessageTTLTypeID); err != nil { + return fmt.Errorf("unable to decode messageTtl#80950a73: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageTTL) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageTtl#80950a73 to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode messageTtl#80950a73: field ttl: %w", err) + } + m.TTL = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (m *MessageTTL) EncodeTDLibJSON(b tdjson.Encoder) error { + if m == nil { + return fmt.Errorf("can't encode messageTtl#80950a73 as nil") + } + b.ObjStart() + b.PutID("messageTtl") + b.Comma() + b.FieldStart("ttl") + b.PutInt32(m.TTL) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (m *MessageTTL) DecodeTDLibJSON(b tdjson.Decoder) error { + if m == nil { + return fmt.Errorf("can't decode messageTtl#80950a73 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("messageTtl"); err != nil { + return fmt.Errorf("unable to decode messageTtl#80950a73: %w", err) + } + case "ttl": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode messageTtl#80950a73: field ttl: %w", err) + } + m.TTL = value + default: + return b.Skip() + } + return nil + }) +} + +// GetTTL returns value of TTL field. +func (m *MessageTTL) GetTTL() (value int32) { + if m == nil { + return + } + return m.TTL +} diff --git a/tdapi/tl_registry_gen.go b/tdapi/tl_registry_gen.go index 7baf6f3ad9..ae19c7dd4c 100644 --- a/tdapi/tl_registry_gen.go +++ b/tdapi/tl_registry_gen.go @@ -49,6 +49,7 @@ func TypesMap() map[uint32]string { AuthenticationCodeTypeCallTypeID: "authenticationCodeTypeCall#61876c67", AuthenticationCodeTypeFlashCallTypeID: "authenticationCodeTypeFlashCall#533379a2", AuthenticationCodeTypeMissedCallTypeID: "authenticationCodeTypeMissedCall#29bb0a87", + AuthenticationCodeTypeFragmentTypeID: "authenticationCodeTypeFragment#810f74cd", AuthenticationCodeInfoTypeID: "authenticationCodeInfo#ccb82bb8", EmailAddressAuthenticationCodeInfoTypeID: "emailAddressAuthenticationCodeInfo#449be223", EmailAddressAuthenticationCodeTypeID: "emailAddressAuthenticationCode#c4cc19c2", @@ -141,7 +142,7 @@ func TypesMap() map[uint32]string { EmojiStatusTypeID: "emojiStatus#4118a266", EmojiStatusesTypeID: "emojiStatuses#45127a70", UsernamesTypeID: "usernames#bf343063", - UserTypeID: "user#d9250b34", + UserTypeID: "user#5cdc7c44", BotInfoTypeID: "botInfo#831a403e", UserFullInfoTypeID: "userFullInfo#2d163af6", UsersTypeID: "users#9d955a12", @@ -183,7 +184,7 @@ func TypesMap() map[uint32]string { BasicGroupTypeID: "basicGroup#f464168f", BasicGroupFullInfoTypeID: "basicGroupFullInfo#f191cfca", SupergroupTypeID: "supergroup#88a83c57", - SupergroupFullInfoTypeID: "supergroupFullInfo#9c9c1807", + SupergroupFullInfoTypeID: "supergroupFullInfo#3a2d070d", SecretChatStatePendingTypeID: "secretChatStatePending#9e6c967c", SecretChatStateReadyTypeID: "secretChatStateReady#9ff4b7e9", SecretChatStateClosedTypeID: "secretChatStateClosed#8c1006ed", @@ -281,8 +282,9 @@ func TypesMap() map[uint32]string { WebAppInfoTypeID: "webAppInfo#2efdb2e8", MessageThreadInfoTypeID: "messageThreadInfo#683fd5ad", ForumTopicIconTypeID: "forumTopicIcon#cf32a193", - ForumTopicInfoTypeID: "forumTopicInfo#d38f7a5a", + ForumTopicInfoTypeID: "forumTopicInfo#8ff3df9e", ForumTopicTypeID: "forumTopic#1213ace6", + ForumTopicsTypeID: "forumTopics#2d99b4ae", RichTextPlainTypeID: "richTextPlain#1cc42966", RichTextBoldTypeID: "richTextBold#63970f6c", RichTextItalicTypeID: "richTextItalic#6e77f03f", @@ -482,10 +484,11 @@ func TypesMap() map[uint32]string { MessagePinMessageTypeID: "messagePinMessage#38d55039", MessageScreenshotTakenTypeID: "messageScreenshotTaken#a2b86dab", MessageChatSetThemeTypeID: "messageChatSetTheme#99ae9408", - MessageChatSetTTLTypeID: "messageChatSetTtl#6be353b1", + MessageChatSetTTLTypeID: "messageChatSetTtl#49e6b31b", MessageForumTopicCreatedTypeID: "messageForumTopicCreated#b8ce47d1", MessageForumTopicEditedTypeID: "messageForumTopicEdited#c0b780", MessageForumTopicIsClosedToggledTypeID: "messageForumTopicIsClosedToggled#4b578fe0", + MessageForumTopicIsHiddenToggledTypeID: "messageForumTopicIsHiddenToggled#979393fe", MessageCustomServiceActionTypeID: "messageCustomServiceAction#5595c772", MessageGameScoreTypeID: "messageGameScore#50299d7f", MessagePaymentSuccessfulTypeID: "messagePaymentSuccessful#53d93cdc", @@ -640,6 +643,7 @@ func TypesMap() map[uint32]string { AttachmentMenuBotTypeID: "attachmentMenuBot#a2a7de38", SentWebAppMessageTypeID: "sentWebAppMessage#4a24eec0", HTTPURLTypeID: "httpUrl#87b775a6", + UserLinkTypeID: "userLink#1db0fef8", InputInlineQueryResultAnimationTypeID: "inputInlineQueryResultAnimation#a7335216", InputInlineQueryResultArticleTypeID: "inputInlineQueryResultArticle#75a3d10c", InputInlineQueryResultAudioTypeID: "inputInlineQueryResultAudio#4b1c35d4", @@ -673,7 +677,7 @@ func TypesMap() map[uint32]string { GameHighScoreTypeID: "gameHighScore#146fcf1e", GameHighScoresTypeID: "gameHighScores#6d4cd30d", ChatEventMessageEditedTypeID: "chatEventMessageEdited#e64ff5f8", - ChatEventMessageDeletedTypeID: "chatEventMessageDeleted#cac649f7", + ChatEventMessageDeletedTypeID: "chatEventMessageDeleted#37bfcd73", ChatEventMessagePinnedTypeID: "chatEventMessagePinned#1a26ad1a", ChatEventMessageUnpinnedTypeID: "chatEventMessageUnpinned#e9943b17", ChatEventPollStoppedTypeID: "chatEventPollStopped#77cc8be5", @@ -699,6 +703,7 @@ func TypesMap() map[uint32]string { ChatEventHasProtectedContentToggledTypeID: "chatEventHasProtectedContentToggled#f5044201", ChatEventInvitesToggledTypeID: "chatEventInvitesToggled#fc45966b", ChatEventIsAllHistoryAvailableToggledTypeID: "chatEventIsAllHistoryAvailableToggled#a0b03c15", + ChatEventIsAggressiveAntiSpamEnabledToggledTypeID: "chatEventIsAggressiveAntiSpamEnabledToggled#54a3f196", ChatEventSignMessagesToggledTypeID: "chatEventSignMessagesToggled#b1b9281e", ChatEventInviteLinkEditedTypeID: "chatEventInviteLinkEdited#e4920d62", ChatEventInviteLinkRevokedTypeID: "chatEventInviteLinkRevoked#a1dbffe3", @@ -712,6 +717,7 @@ func TypesMap() map[uint32]string { ChatEventForumTopicCreatedTypeID: "chatEventForumTopicCreated#7785fb42", ChatEventForumTopicEditedTypeID: "chatEventForumTopicEdited#60da2c0c", ChatEventForumTopicToggleIsClosedTypeID: "chatEventForumTopicToggleIsClosed#c69e4d3a", + ChatEventForumTopicToggleIsHiddenTypeID: "chatEventForumTopicToggleIsHidden#a015ef2e", ChatEventForumTopicDeletedTypeID: "chatEventForumTopicDeleted#b08f290d", ChatEventForumTopicPinnedTypeID: "chatEventForumTopicPinned#7fc523ee", ChatEventTypeID: "chatEvent#d921b3d0", @@ -790,7 +796,8 @@ func TypesMap() map[uint32]string { CheckChatUsernameResultOkTypeID: "checkChatUsernameResultOk#a6a7bb5c", CheckChatUsernameResultUsernameInvalidTypeID: "checkChatUsernameResultUsernameInvalid#da087756", CheckChatUsernameResultUsernameOccupiedTypeID: "checkChatUsernameResultUsernameOccupied#4ebb3729", - CheckChatUsernameResultPublicChatsTooMuchTypeID: "checkChatUsernameResultPublicChatsTooMuch#3327d23d", + CheckChatUsernameResultUsernamePurchasableTypeID: "checkChatUsernameResultUsernamePurchasable#59ce59", + CheckChatUsernameResultPublicChatsTooManyTypeID: "checkChatUsernameResultPublicChatsTooMany#d8b46c7c", CheckChatUsernameResultPublicGroupsUnavailableTypeID: "checkChatUsernameResultPublicGroupsUnavailable#fce914d7", CheckStickerSetNameResultOkTypeID: "checkStickerSetNameResultOk#ac4bf258", CheckStickerSetNameResultNameInvalidTypeID: "checkStickerSetNameResultNameInvalid#a9bf234", @@ -872,6 +879,7 @@ func TypesMap() map[uint32]string { UserPrivacySettingAllowFindingByPhoneNumberTypeID: "userPrivacySettingAllowFindingByPhoneNumber#91ee6d51", UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID: "userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c", AccountTTLTypeID: "accountTtl#4ef23284", + MessageTTLTypeID: "messageTtl#80950a73", SessionTypeAndroidTypeID: "sessionTypeAndroid#84836098", SessionTypeAppleTypeID: "sessionTypeApple#9399d24b", SessionTypeBraveTypeID: "sessionTypeBrave#b778e9ed", @@ -938,6 +946,7 @@ func TypesMap() map[uint32]string { InternalLinkTypeUnknownDeepLinkTypeID: "internalLinkTypeUnknownDeepLink#2549d7db", InternalLinkTypeUnsupportedProxyTypeID: "internalLinkTypeUnsupportedProxy#de399f09", InternalLinkTypeUserPhoneNumberTypeID: "internalLinkTypeUserPhoneNumber#8b6d9a69", + InternalLinkTypeUserTokenTypeID: "internalLinkTypeUserToken#a8d7db59", InternalLinkTypeVideoChatTypeID: "internalLinkTypeVideoChat#8796f8b4", MessageLinkTypeID: "messageLink#af4a3aa6", MessageLinkInfoTypeID: "messageLinkInfo#2b96fb50", @@ -1280,8 +1289,13 @@ func TypesMap() map[uint32]string { EditMessageSchedulingStateRequestTypeID: "editMessageSchedulingState#ae2a0bc0", GetForumTopicDefaultIconsRequestTypeID: "getForumTopicDefaultIcons#583574dc", CreateForumTopicRequestTypeID: "createForumTopic#c1fa28e4", - EditForumTopicRequestTypeID: "editForumTopic#f2c261b0", + EditForumTopicRequestTypeID: "editForumTopic#a7769060", + GetForumTopicRequestTypeID: "getForumTopic#e59bfe41", + GetForumTopicLinkRequestTypeID: "getForumTopicLink#a8e6c24b", + GetForumTopicsRequestTypeID: "getForumTopics#fbab7d5a", + SetForumTopicNotificationSettingsRequestTypeID: "setForumTopicNotificationSettings#1f433467", ToggleForumTopicIsClosedRequestTypeID: "toggleForumTopicIsClosed#c7648af3", + ToggleGeneralForumTopicIsHiddenRequestTypeID: "toggleGeneralForumTopicIsHidden#5f1d1448", DeleteForumTopicRequestTypeID: "deleteForumTopic#6f285cb8", GetEmojiReactionRequestTypeID: "getEmojiReaction#e53411dc", GetCustomEmojiReactionAnimationsRequestTypeID: "getCustomEmojiReactionAnimations#49748dd2", @@ -1341,8 +1355,8 @@ func TypesMap() map[uint32]string { CreateBasicGroupChatRequestTypeID: "createBasicGroupChat#758ab4e4", CreateSupergroupChatRequestTypeID: "createSupergroupChat#46c770eb", CreateSecretChatRequestTypeID: "createSecretChat#730dd22f", - CreateNewBasicGroupChatRequestTypeID: "createNewBasicGroupChat#eb575429", - CreateNewSupergroupChatRequestTypeID: "createNewSupergroupChat#ce83a6c1", + CreateNewBasicGroupChatRequestTypeID: "createNewBasicGroupChat#68be940", + CreateNewSupergroupChatRequestTypeID: "createNewSupergroupChat#d32c5491", CreateNewSecretChatRequestTypeID: "createNewSecretChat#db012265", UpgradeBasicGroupChatToSupergroupChatRequestTypeID: "upgradeBasicGroupChatToSupergroupChat#11e915ba", GetChatListsToAddChatRequestTypeID: "getChatListsToAddChat#2709d6a1", @@ -1534,6 +1548,8 @@ func TypesMap() map[uint32]string { ChangePhoneNumberRequestTypeID: "changePhoneNumber#f891bba3", ResendChangePhoneNumberCodeRequestTypeID: "resendChangePhoneNumberCode#d11acfa4", CheckChangePhoneNumberCodeRequestTypeID: "checkChangePhoneNumberCode#9976a263", + GetUserLinkRequestTypeID: "getUserLink#492014e6", + SearchUserByTokenRequestTypeID: "searchUserByToken#d841f436", SetCommandsRequestTypeID: "setCommands#b0e0217a", DeleteCommandsRequestTypeID: "deleteCommands#3bc47c2a", GetCommandsRequestTypeID: "getCommands#58ba8ff7", @@ -1559,9 +1575,11 @@ func TypesMap() map[uint32]string { ToggleSupergroupJoinToSendMessagesRequestTypeID: "toggleSupergroupJoinToSendMessages#f5268e0e", ToggleSupergroupJoinByRequestRequestTypeID: "toggleSupergroupJoinByRequest#7ddf9fde", ToggleSupergroupIsAllHistoryAvailableRequestTypeID: "toggleSupergroupIsAllHistoryAvailable#44d9964e", + ToggleSupergroupIsAggressiveAntiSpamEnabledRequestTypeID: "toggleSupergroupIsAggressiveAntiSpamEnabled#a87019f8", ToggleSupergroupIsForumRequestTypeID: "toggleSupergroupIsForum#966f960a", ToggleSupergroupIsBroadcastGroupRequestTypeID: "toggleSupergroupIsBroadcastGroup#34b22215", ReportSupergroupSpamRequestTypeID: "reportSupergroupSpam#383e26f2", + ReportSupergroupAntiSpamFalsePositiveRequestTypeID: "reportSupergroupAntiSpamFalsePositive#e13db048", GetSupergroupMembersRequestTypeID: "getSupergroupMembers#ddf821c8", CloseSecretChatRequestTypeID: "closeSecretChat#e3ed044b", GetChatEventLogRequestTypeID: "getChatEventLog#f47b0a9b", @@ -1600,6 +1618,8 @@ func TypesMap() map[uint32]string { SetAccountTTLRequestTypeID: "setAccountTtl#29ce58e8", GetAccountTTLRequestTypeID: "getAccountTtl#e58a8b77", DeleteAccountRequestTypeID: "deleteAccount#533276c6", + SetDefaultMessageTTLRequestTypeID: "setDefaultMessageTtl#90bd2287", + GetDefaultMessageTTLRequestTypeID: "getDefaultMessageTtl#2e8b7d3e", RemoveChatActionBarRequestTypeID: "removeChatActionBar#9d9839fa", ReportChatRequestTypeID: "reportChat#a19024af", ReportChatPhotoRequestTypeID: "reportChatPhoto#2bc9e924", @@ -1719,6 +1739,7 @@ func NamesMap() map[string]uint32 { "authenticationCodeTypeCall": AuthenticationCodeTypeCallTypeID, "authenticationCodeTypeFlashCall": AuthenticationCodeTypeFlashCallTypeID, "authenticationCodeTypeMissedCall": AuthenticationCodeTypeMissedCallTypeID, + "authenticationCodeTypeFragment": AuthenticationCodeTypeFragmentTypeID, "authenticationCodeInfo": AuthenticationCodeInfoTypeID, "emailAddressAuthenticationCodeInfo": EmailAddressAuthenticationCodeInfoTypeID, "emailAddressAuthenticationCode": EmailAddressAuthenticationCodeTypeID, @@ -1953,6 +1974,7 @@ func NamesMap() map[string]uint32 { "forumTopicIcon": ForumTopicIconTypeID, "forumTopicInfo": ForumTopicInfoTypeID, "forumTopic": ForumTopicTypeID, + "forumTopics": ForumTopicsTypeID, "richTextPlain": RichTextPlainTypeID, "richTextBold": RichTextBoldTypeID, "richTextItalic": RichTextItalicTypeID, @@ -2156,6 +2178,7 @@ func NamesMap() map[string]uint32 { "messageForumTopicCreated": MessageForumTopicCreatedTypeID, "messageForumTopicEdited": MessageForumTopicEditedTypeID, "messageForumTopicIsClosedToggled": MessageForumTopicIsClosedToggledTypeID, + "messageForumTopicIsHiddenToggled": MessageForumTopicIsHiddenToggledTypeID, "messageCustomServiceAction": MessageCustomServiceActionTypeID, "messageGameScore": MessageGameScoreTypeID, "messagePaymentSuccessful": MessagePaymentSuccessfulTypeID, @@ -2310,6 +2333,7 @@ func NamesMap() map[string]uint32 { "attachmentMenuBot": AttachmentMenuBotTypeID, "sentWebAppMessage": SentWebAppMessageTypeID, "httpUrl": HTTPURLTypeID, + "userLink": UserLinkTypeID, "inputInlineQueryResultAnimation": InputInlineQueryResultAnimationTypeID, "inputInlineQueryResultArticle": InputInlineQueryResultArticleTypeID, "inputInlineQueryResultAudio": InputInlineQueryResultAudioTypeID, @@ -2369,6 +2393,7 @@ func NamesMap() map[string]uint32 { "chatEventHasProtectedContentToggled": ChatEventHasProtectedContentToggledTypeID, "chatEventInvitesToggled": ChatEventInvitesToggledTypeID, "chatEventIsAllHistoryAvailableToggled": ChatEventIsAllHistoryAvailableToggledTypeID, + "chatEventIsAggressiveAntiSpamEnabledToggled": ChatEventIsAggressiveAntiSpamEnabledToggledTypeID, "chatEventSignMessagesToggled": ChatEventSignMessagesToggledTypeID, "chatEventInviteLinkEdited": ChatEventInviteLinkEditedTypeID, "chatEventInviteLinkRevoked": ChatEventInviteLinkRevokedTypeID, @@ -2382,6 +2407,7 @@ func NamesMap() map[string]uint32 { "chatEventForumTopicCreated": ChatEventForumTopicCreatedTypeID, "chatEventForumTopicEdited": ChatEventForumTopicEditedTypeID, "chatEventForumTopicToggleIsClosed": ChatEventForumTopicToggleIsClosedTypeID, + "chatEventForumTopicToggleIsHidden": ChatEventForumTopicToggleIsHiddenTypeID, "chatEventForumTopicDeleted": ChatEventForumTopicDeletedTypeID, "chatEventForumTopicPinned": ChatEventForumTopicPinnedTypeID, "chatEvent": ChatEventTypeID, @@ -2460,7 +2486,8 @@ func NamesMap() map[string]uint32 { "checkChatUsernameResultOk": CheckChatUsernameResultOkTypeID, "checkChatUsernameResultUsernameInvalid": CheckChatUsernameResultUsernameInvalidTypeID, "checkChatUsernameResultUsernameOccupied": CheckChatUsernameResultUsernameOccupiedTypeID, - "checkChatUsernameResultPublicChatsTooMuch": CheckChatUsernameResultPublicChatsTooMuchTypeID, + "checkChatUsernameResultUsernamePurchasable": CheckChatUsernameResultUsernamePurchasableTypeID, + "checkChatUsernameResultPublicChatsTooMany": CheckChatUsernameResultPublicChatsTooManyTypeID, "checkChatUsernameResultPublicGroupsUnavailable": CheckChatUsernameResultPublicGroupsUnavailableTypeID, "checkStickerSetNameResultOk": CheckStickerSetNameResultOkTypeID, "checkStickerSetNameResultNameInvalid": CheckStickerSetNameResultNameInvalidTypeID, @@ -2542,6 +2569,7 @@ func NamesMap() map[string]uint32 { "userPrivacySettingAllowFindingByPhoneNumber": UserPrivacySettingAllowFindingByPhoneNumberTypeID, "userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages": UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID, "accountTtl": AccountTTLTypeID, + "messageTtl": MessageTTLTypeID, "sessionTypeAndroid": SessionTypeAndroidTypeID, "sessionTypeApple": SessionTypeAppleTypeID, "sessionTypeBrave": SessionTypeBraveTypeID, @@ -2608,6 +2636,7 @@ func NamesMap() map[string]uint32 { "internalLinkTypeUnknownDeepLink": InternalLinkTypeUnknownDeepLinkTypeID, "internalLinkTypeUnsupportedProxy": InternalLinkTypeUnsupportedProxyTypeID, "internalLinkTypeUserPhoneNumber": InternalLinkTypeUserPhoneNumberTypeID, + "internalLinkTypeUserToken": InternalLinkTypeUserTokenTypeID, "internalLinkTypeVideoChat": InternalLinkTypeVideoChatTypeID, "messageLink": MessageLinkTypeID, "messageLinkInfo": MessageLinkInfoTypeID, @@ -2951,7 +2980,12 @@ func NamesMap() map[string]uint32 { "getForumTopicDefaultIcons": GetForumTopicDefaultIconsRequestTypeID, "createForumTopic": CreateForumTopicRequestTypeID, "editForumTopic": EditForumTopicRequestTypeID, + "getForumTopic": GetForumTopicRequestTypeID, + "getForumTopicLink": GetForumTopicLinkRequestTypeID, + "getForumTopics": GetForumTopicsRequestTypeID, + "setForumTopicNotificationSettings": SetForumTopicNotificationSettingsRequestTypeID, "toggleForumTopicIsClosed": ToggleForumTopicIsClosedRequestTypeID, + "toggleGeneralForumTopicIsHidden": ToggleGeneralForumTopicIsHiddenRequestTypeID, "deleteForumTopic": DeleteForumTopicRequestTypeID, "getEmojiReaction": GetEmojiReactionRequestTypeID, "getCustomEmojiReactionAnimations": GetCustomEmojiReactionAnimationsRequestTypeID, @@ -3204,6 +3238,8 @@ func NamesMap() map[string]uint32 { "changePhoneNumber": ChangePhoneNumberRequestTypeID, "resendChangePhoneNumberCode": ResendChangePhoneNumberCodeRequestTypeID, "checkChangePhoneNumberCode": CheckChangePhoneNumberCodeRequestTypeID, + "getUserLink": GetUserLinkRequestTypeID, + "searchUserByToken": SearchUserByTokenRequestTypeID, "setCommands": SetCommandsRequestTypeID, "deleteCommands": DeleteCommandsRequestTypeID, "getCommands": GetCommandsRequestTypeID, @@ -3229,9 +3265,11 @@ func NamesMap() map[string]uint32 { "toggleSupergroupJoinToSendMessages": ToggleSupergroupJoinToSendMessagesRequestTypeID, "toggleSupergroupJoinByRequest": ToggleSupergroupJoinByRequestRequestTypeID, "toggleSupergroupIsAllHistoryAvailable": ToggleSupergroupIsAllHistoryAvailableRequestTypeID, + "toggleSupergroupIsAggressiveAntiSpamEnabled": ToggleSupergroupIsAggressiveAntiSpamEnabledRequestTypeID, "toggleSupergroupIsForum": ToggleSupergroupIsForumRequestTypeID, "toggleSupergroupIsBroadcastGroup": ToggleSupergroupIsBroadcastGroupRequestTypeID, "reportSupergroupSpam": ReportSupergroupSpamRequestTypeID, + "reportSupergroupAntiSpamFalsePositive": ReportSupergroupAntiSpamFalsePositiveRequestTypeID, "getSupergroupMembers": GetSupergroupMembersRequestTypeID, "closeSecretChat": CloseSecretChatRequestTypeID, "getChatEventLog": GetChatEventLogRequestTypeID, @@ -3270,6 +3308,8 @@ func NamesMap() map[string]uint32 { "setAccountTtl": SetAccountTTLRequestTypeID, "getAccountTtl": GetAccountTTLRequestTypeID, "deleteAccount": DeleteAccountRequestTypeID, + "setDefaultMessageTtl": SetDefaultMessageTTLRequestTypeID, + "getDefaultMessageTtl": GetDefaultMessageTTLRequestTypeID, "removeChatActionBar": RemoveChatActionBarRequestTypeID, "reportChat": ReportChatRequestTypeID, "reportChatPhoto": ReportChatPhotoRequestTypeID, @@ -3389,6 +3429,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { AuthenticationCodeTypeCallTypeID: func() bin.Object { return &AuthenticationCodeTypeCall{} }, AuthenticationCodeTypeFlashCallTypeID: func() bin.Object { return &AuthenticationCodeTypeFlashCall{} }, AuthenticationCodeTypeMissedCallTypeID: func() bin.Object { return &AuthenticationCodeTypeMissedCall{} }, + AuthenticationCodeTypeFragmentTypeID: func() bin.Object { return &AuthenticationCodeTypeFragment{} }, AuthenticationCodeInfoTypeID: func() bin.Object { return &AuthenticationCodeInfo{} }, EmailAddressAuthenticationCodeInfoTypeID: func() bin.Object { return &EmailAddressAuthenticationCodeInfo{} }, EmailAddressAuthenticationCodeTypeID: func() bin.Object { return &EmailAddressAuthenticationCode{} }, @@ -3623,6 +3664,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ForumTopicIconTypeID: func() bin.Object { return &ForumTopicIcon{} }, ForumTopicInfoTypeID: func() bin.Object { return &ForumTopicInfo{} }, ForumTopicTypeID: func() bin.Object { return &ForumTopic{} }, + ForumTopicsTypeID: func() bin.Object { return &ForumTopics{} }, RichTextPlainTypeID: func() bin.Object { return &RichTextPlain{} }, RichTextBoldTypeID: func() bin.Object { return &RichTextBold{} }, RichTextItalicTypeID: func() bin.Object { return &RichTextItalic{} }, @@ -3826,6 +3868,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessageForumTopicCreatedTypeID: func() bin.Object { return &MessageForumTopicCreated{} }, MessageForumTopicEditedTypeID: func() bin.Object { return &MessageForumTopicEdited{} }, MessageForumTopicIsClosedToggledTypeID: func() bin.Object { return &MessageForumTopicIsClosedToggled{} }, + MessageForumTopicIsHiddenToggledTypeID: func() bin.Object { return &MessageForumTopicIsHiddenToggled{} }, MessageCustomServiceActionTypeID: func() bin.Object { return &MessageCustomServiceAction{} }, MessageGameScoreTypeID: func() bin.Object { return &MessageGameScore{} }, MessagePaymentSuccessfulTypeID: func() bin.Object { return &MessagePaymentSuccessful{} }, @@ -3980,6 +4023,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { AttachmentMenuBotTypeID: func() bin.Object { return &AttachmentMenuBot{} }, SentWebAppMessageTypeID: func() bin.Object { return &SentWebAppMessage{} }, HTTPURLTypeID: func() bin.Object { return &HTTPURL{} }, + UserLinkTypeID: func() bin.Object { return &UserLink{} }, InputInlineQueryResultAnimationTypeID: func() bin.Object { return &InputInlineQueryResultAnimation{} }, InputInlineQueryResultArticleTypeID: func() bin.Object { return &InputInlineQueryResultArticle{} }, InputInlineQueryResultAudioTypeID: func() bin.Object { return &InputInlineQueryResultAudio{} }, @@ -4039,6 +4083,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ChatEventHasProtectedContentToggledTypeID: func() bin.Object { return &ChatEventHasProtectedContentToggled{} }, ChatEventInvitesToggledTypeID: func() bin.Object { return &ChatEventInvitesToggled{} }, ChatEventIsAllHistoryAvailableToggledTypeID: func() bin.Object { return &ChatEventIsAllHistoryAvailableToggled{} }, + ChatEventIsAggressiveAntiSpamEnabledToggledTypeID: func() bin.Object { return &ChatEventIsAggressiveAntiSpamEnabledToggled{} }, ChatEventSignMessagesToggledTypeID: func() bin.Object { return &ChatEventSignMessagesToggled{} }, ChatEventInviteLinkEditedTypeID: func() bin.Object { return &ChatEventInviteLinkEdited{} }, ChatEventInviteLinkRevokedTypeID: func() bin.Object { return &ChatEventInviteLinkRevoked{} }, @@ -4052,6 +4097,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ChatEventForumTopicCreatedTypeID: func() bin.Object { return &ChatEventForumTopicCreated{} }, ChatEventForumTopicEditedTypeID: func() bin.Object { return &ChatEventForumTopicEdited{} }, ChatEventForumTopicToggleIsClosedTypeID: func() bin.Object { return &ChatEventForumTopicToggleIsClosed{} }, + ChatEventForumTopicToggleIsHiddenTypeID: func() bin.Object { return &ChatEventForumTopicToggleIsHidden{} }, ChatEventForumTopicDeletedTypeID: func() bin.Object { return &ChatEventForumTopicDeleted{} }, ChatEventForumTopicPinnedTypeID: func() bin.Object { return &ChatEventForumTopicPinned{} }, ChatEventTypeID: func() bin.Object { return &ChatEvent{} }, @@ -4130,7 +4176,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { CheckChatUsernameResultOkTypeID: func() bin.Object { return &CheckChatUsernameResultOk{} }, CheckChatUsernameResultUsernameInvalidTypeID: func() bin.Object { return &CheckChatUsernameResultUsernameInvalid{} }, CheckChatUsernameResultUsernameOccupiedTypeID: func() bin.Object { return &CheckChatUsernameResultUsernameOccupied{} }, - CheckChatUsernameResultPublicChatsTooMuchTypeID: func() bin.Object { return &CheckChatUsernameResultPublicChatsTooMuch{} }, + CheckChatUsernameResultUsernamePurchasableTypeID: func() bin.Object { return &CheckChatUsernameResultUsernamePurchasable{} }, + CheckChatUsernameResultPublicChatsTooManyTypeID: func() bin.Object { return &CheckChatUsernameResultPublicChatsTooMany{} }, CheckChatUsernameResultPublicGroupsUnavailableTypeID: func() bin.Object { return &CheckChatUsernameResultPublicGroupsUnavailable{} }, CheckStickerSetNameResultOkTypeID: func() bin.Object { return &CheckStickerSetNameResultOk{} }, CheckStickerSetNameResultNameInvalidTypeID: func() bin.Object { return &CheckStickerSetNameResultNameInvalid{} }, @@ -4212,6 +4259,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UserPrivacySettingAllowFindingByPhoneNumberTypeID: func() bin.Object { return &UserPrivacySettingAllowFindingByPhoneNumber{} }, UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID: func() bin.Object { return &UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages{} }, AccountTTLTypeID: func() bin.Object { return &AccountTTL{} }, + MessageTTLTypeID: func() bin.Object { return &MessageTTL{} }, SessionTypeAndroidTypeID: func() bin.Object { return &SessionTypeAndroid{} }, SessionTypeAppleTypeID: func() bin.Object { return &SessionTypeApple{} }, SessionTypeBraveTypeID: func() bin.Object { return &SessionTypeBrave{} }, @@ -4278,6 +4326,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { InternalLinkTypeUnknownDeepLinkTypeID: func() bin.Object { return &InternalLinkTypeUnknownDeepLink{} }, InternalLinkTypeUnsupportedProxyTypeID: func() bin.Object { return &InternalLinkTypeUnsupportedProxy{} }, InternalLinkTypeUserPhoneNumberTypeID: func() bin.Object { return &InternalLinkTypeUserPhoneNumber{} }, + InternalLinkTypeUserTokenTypeID: func() bin.Object { return &InternalLinkTypeUserToken{} }, InternalLinkTypeVideoChatTypeID: func() bin.Object { return &InternalLinkTypeVideoChat{} }, MessageLinkTypeID: func() bin.Object { return &MessageLink{} }, MessageLinkInfoTypeID: func() bin.Object { return &MessageLinkInfo{} }, @@ -4621,7 +4670,12 @@ func TypesConstructorMap() map[uint32]func() bin.Object { GetForumTopicDefaultIconsRequestTypeID: func() bin.Object { return &GetForumTopicDefaultIconsRequest{} }, CreateForumTopicRequestTypeID: func() bin.Object { return &CreateForumTopicRequest{} }, EditForumTopicRequestTypeID: func() bin.Object { return &EditForumTopicRequest{} }, + GetForumTopicRequestTypeID: func() bin.Object { return &GetForumTopicRequest{} }, + GetForumTopicLinkRequestTypeID: func() bin.Object { return &GetForumTopicLinkRequest{} }, + GetForumTopicsRequestTypeID: func() bin.Object { return &GetForumTopicsRequest{} }, + SetForumTopicNotificationSettingsRequestTypeID: func() bin.Object { return &SetForumTopicNotificationSettingsRequest{} }, ToggleForumTopicIsClosedRequestTypeID: func() bin.Object { return &ToggleForumTopicIsClosedRequest{} }, + ToggleGeneralForumTopicIsHiddenRequestTypeID: func() bin.Object { return &ToggleGeneralForumTopicIsHiddenRequest{} }, DeleteForumTopicRequestTypeID: func() bin.Object { return &DeleteForumTopicRequest{} }, GetEmojiReactionRequestTypeID: func() bin.Object { return &GetEmojiReactionRequest{} }, GetCustomEmojiReactionAnimationsRequestTypeID: func() bin.Object { return &GetCustomEmojiReactionAnimationsRequest{} }, @@ -4874,6 +4928,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ChangePhoneNumberRequestTypeID: func() bin.Object { return &ChangePhoneNumberRequest{} }, ResendChangePhoneNumberCodeRequestTypeID: func() bin.Object { return &ResendChangePhoneNumberCodeRequest{} }, CheckChangePhoneNumberCodeRequestTypeID: func() bin.Object { return &CheckChangePhoneNumberCodeRequest{} }, + GetUserLinkRequestTypeID: func() bin.Object { return &GetUserLinkRequest{} }, + SearchUserByTokenRequestTypeID: func() bin.Object { return &SearchUserByTokenRequest{} }, SetCommandsRequestTypeID: func() bin.Object { return &SetCommandsRequest{} }, DeleteCommandsRequestTypeID: func() bin.Object { return &DeleteCommandsRequest{} }, GetCommandsRequestTypeID: func() bin.Object { return &GetCommandsRequest{} }, @@ -4899,9 +4955,11 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ToggleSupergroupJoinToSendMessagesRequestTypeID: func() bin.Object { return &ToggleSupergroupJoinToSendMessagesRequest{} }, ToggleSupergroupJoinByRequestRequestTypeID: func() bin.Object { return &ToggleSupergroupJoinByRequestRequest{} }, ToggleSupergroupIsAllHistoryAvailableRequestTypeID: func() bin.Object { return &ToggleSupergroupIsAllHistoryAvailableRequest{} }, + ToggleSupergroupIsAggressiveAntiSpamEnabledRequestTypeID: func() bin.Object { return &ToggleSupergroupIsAggressiveAntiSpamEnabledRequest{} }, ToggleSupergroupIsForumRequestTypeID: func() bin.Object { return &ToggleSupergroupIsForumRequest{} }, ToggleSupergroupIsBroadcastGroupRequestTypeID: func() bin.Object { return &ToggleSupergroupIsBroadcastGroupRequest{} }, ReportSupergroupSpamRequestTypeID: func() bin.Object { return &ReportSupergroupSpamRequest{} }, + ReportSupergroupAntiSpamFalsePositiveRequestTypeID: func() bin.Object { return &ReportSupergroupAntiSpamFalsePositiveRequest{} }, GetSupergroupMembersRequestTypeID: func() bin.Object { return &GetSupergroupMembersRequest{} }, CloseSecretChatRequestTypeID: func() bin.Object { return &CloseSecretChatRequest{} }, GetChatEventLogRequestTypeID: func() bin.Object { return &GetChatEventLogRequest{} }, @@ -4940,6 +4998,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { SetAccountTTLRequestTypeID: func() bin.Object { return &SetAccountTTLRequest{} }, GetAccountTTLRequestTypeID: func() bin.Object { return &GetAccountTTLRequest{} }, DeleteAccountRequestTypeID: func() bin.Object { return &DeleteAccountRequest{} }, + SetDefaultMessageTTLRequestTypeID: func() bin.Object { return &SetDefaultMessageTTLRequest{} }, + GetDefaultMessageTTLRequestTypeID: func() bin.Object { return &GetDefaultMessageTTLRequest{} }, RemoveChatActionBarRequestTypeID: func() bin.Object { return &RemoveChatActionBarRequest{} }, ReportChatRequestTypeID: func() bin.Object { return &ReportChatRequest{} }, ReportChatPhotoRequestTypeID: func() bin.Object { return &ReportChatPhotoRequest{} }, @@ -5050,6 +5110,7 @@ func ClassConstructorsMap() map[string][]uint32 { AuthenticationCodeTypeCallTypeID, AuthenticationCodeTypeFlashCallTypeID, AuthenticationCodeTypeMissedCallTypeID, + AuthenticationCodeTypeFragmentTypeID, }, AuthorizationStateClassName: { AuthorizationStateWaitTdlibParametersTypeID, @@ -5187,6 +5248,7 @@ func ClassConstructorsMap() map[string][]uint32 { ChatEventHasProtectedContentToggledTypeID, ChatEventInvitesToggledTypeID, ChatEventIsAllHistoryAvailableToggledTypeID, + ChatEventIsAggressiveAntiSpamEnabledToggledTypeID, ChatEventSignMessagesToggledTypeID, ChatEventInviteLinkEditedTypeID, ChatEventInviteLinkRevokedTypeID, @@ -5200,6 +5262,7 @@ func ClassConstructorsMap() map[string][]uint32 { ChatEventForumTopicCreatedTypeID, ChatEventForumTopicEditedTypeID, ChatEventForumTopicToggleIsClosedTypeID, + ChatEventForumTopicToggleIsHiddenTypeID, ChatEventForumTopicDeletedTypeID, ChatEventForumTopicPinnedTypeID, }, @@ -5255,7 +5318,8 @@ func ClassConstructorsMap() map[string][]uint32 { CheckChatUsernameResultOkTypeID, CheckChatUsernameResultUsernameInvalidTypeID, CheckChatUsernameResultUsernameOccupiedTypeID, - CheckChatUsernameResultPublicChatsTooMuchTypeID, + CheckChatUsernameResultUsernamePurchasableTypeID, + CheckChatUsernameResultPublicChatsTooManyTypeID, CheckChatUsernameResultPublicGroupsUnavailableTypeID, }, CheckStickerSetNameResultClassName: { @@ -5458,6 +5522,7 @@ func ClassConstructorsMap() map[string][]uint32 { InternalLinkTypeUnknownDeepLinkTypeID, InternalLinkTypeUnsupportedProxyTypeID, InternalLinkTypeUserPhoneNumberTypeID, + InternalLinkTypeUserTokenTypeID, InternalLinkTypeVideoChatTypeID, }, JSONValueClassName: { @@ -5538,6 +5603,7 @@ func ClassConstructorsMap() map[string][]uint32 { MessageForumTopicCreatedTypeID, MessageForumTopicEditedTypeID, MessageForumTopicIsClosedToggledTypeID, + MessageForumTopicIsHiddenToggledTypeID, MessageCustomServiceActionTypeID, MessageGameScoreTypeID, MessagePaymentSuccessfulTypeID, diff --git a/tdapi/tl_report_supergroup_anti_spam_false_positive_gen.go b/tdapi/tl_report_supergroup_anti_spam_false_positive_gen.go new file mode 100644 index 0000000000..de73fdbfdd --- /dev/null +++ b/tdapi/tl_report_supergroup_anti_spam_false_positive_gen.go @@ -0,0 +1,237 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +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{} +) + +// ReportSupergroupAntiSpamFalsePositiveRequest represents TL type `reportSupergroupAntiSpamFalsePositive#e13db048`. +type ReportSupergroupAntiSpamFalsePositiveRequest struct { + // Supergroup identifier + SupergroupID int64 + // Identifier of the erroneously deleted message + MessageID int64 +} + +// ReportSupergroupAntiSpamFalsePositiveRequestTypeID is TL type id of ReportSupergroupAntiSpamFalsePositiveRequest. +const ReportSupergroupAntiSpamFalsePositiveRequestTypeID = 0xe13db048 + +// Ensuring interfaces in compile-time for ReportSupergroupAntiSpamFalsePositiveRequest. +var ( + _ bin.Encoder = &ReportSupergroupAntiSpamFalsePositiveRequest{} + _ bin.Decoder = &ReportSupergroupAntiSpamFalsePositiveRequest{} + _ bin.BareEncoder = &ReportSupergroupAntiSpamFalsePositiveRequest{} + _ bin.BareDecoder = &ReportSupergroupAntiSpamFalsePositiveRequest{} +) + +func (r *ReportSupergroupAntiSpamFalsePositiveRequest) Zero() bool { + if r == nil { + return true + } + if !(r.SupergroupID == 0) { + return false + } + if !(r.MessageID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (r *ReportSupergroupAntiSpamFalsePositiveRequest) String() string { + if r == nil { + return "ReportSupergroupAntiSpamFalsePositiveRequest(nil)" + } + type Alias ReportSupergroupAntiSpamFalsePositiveRequest + return fmt.Sprintf("ReportSupergroupAntiSpamFalsePositiveRequest%+v", Alias(*r)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ReportSupergroupAntiSpamFalsePositiveRequest) TypeID() uint32 { + return ReportSupergroupAntiSpamFalsePositiveRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ReportSupergroupAntiSpamFalsePositiveRequest) TypeName() string { + return "reportSupergroupAntiSpamFalsePositive" +} + +// TypeInfo returns info about TL type. +func (r *ReportSupergroupAntiSpamFalsePositiveRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "reportSupergroupAntiSpamFalsePositive", + ID: ReportSupergroupAntiSpamFalsePositiveRequestTypeID, + } + if r == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "SupergroupID", + SchemaName: "supergroup_id", + }, + { + Name: "MessageID", + SchemaName: "message_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (r *ReportSupergroupAntiSpamFalsePositiveRequest) Encode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reportSupergroupAntiSpamFalsePositive#e13db048 as nil") + } + b.PutID(ReportSupergroupAntiSpamFalsePositiveRequestTypeID) + return r.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (r *ReportSupergroupAntiSpamFalsePositiveRequest) EncodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reportSupergroupAntiSpamFalsePositive#e13db048 as nil") + } + b.PutInt53(r.SupergroupID) + b.PutInt53(r.MessageID) + return nil +} + +// Decode implements bin.Decoder. +func (r *ReportSupergroupAntiSpamFalsePositiveRequest) Decode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reportSupergroupAntiSpamFalsePositive#e13db048 to nil") + } + if err := b.ConsumeID(ReportSupergroupAntiSpamFalsePositiveRequestTypeID); err != nil { + return fmt.Errorf("unable to decode reportSupergroupAntiSpamFalsePositive#e13db048: %w", err) + } + return r.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (r *ReportSupergroupAntiSpamFalsePositiveRequest) DecodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reportSupergroupAntiSpamFalsePositive#e13db048 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode reportSupergroupAntiSpamFalsePositive#e13db048: field supergroup_id: %w", err) + } + r.SupergroupID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode reportSupergroupAntiSpamFalsePositive#e13db048: field message_id: %w", err) + } + r.MessageID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (r *ReportSupergroupAntiSpamFalsePositiveRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if r == nil { + return fmt.Errorf("can't encode reportSupergroupAntiSpamFalsePositive#e13db048 as nil") + } + b.ObjStart() + b.PutID("reportSupergroupAntiSpamFalsePositive") + b.Comma() + b.FieldStart("supergroup_id") + b.PutInt53(r.SupergroupID) + b.Comma() + b.FieldStart("message_id") + b.PutInt53(r.MessageID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (r *ReportSupergroupAntiSpamFalsePositiveRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if r == nil { + return fmt.Errorf("can't decode reportSupergroupAntiSpamFalsePositive#e13db048 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("reportSupergroupAntiSpamFalsePositive"); err != nil { + return fmt.Errorf("unable to decode reportSupergroupAntiSpamFalsePositive#e13db048: %w", err) + } + case "supergroup_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode reportSupergroupAntiSpamFalsePositive#e13db048: field supergroup_id: %w", err) + } + r.SupergroupID = value + case "message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode reportSupergroupAntiSpamFalsePositive#e13db048: field message_id: %w", err) + } + r.MessageID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetSupergroupID returns value of SupergroupID field. +func (r *ReportSupergroupAntiSpamFalsePositiveRequest) GetSupergroupID() (value int64) { + if r == nil { + return + } + return r.SupergroupID +} + +// GetMessageID returns value of MessageID field. +func (r *ReportSupergroupAntiSpamFalsePositiveRequest) GetMessageID() (value int64) { + if r == nil { + return + } + return r.MessageID +} + +// ReportSupergroupAntiSpamFalsePositive invokes method reportSupergroupAntiSpamFalsePositive#e13db048 returning error if any. +func (c *Client) ReportSupergroupAntiSpamFalsePositive(ctx context.Context, request *ReportSupergroupAntiSpamFalsePositiveRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_search_user_by_token_gen.go b/tdapi/tl_search_user_by_token_gen.go new file mode 100644 index 0000000000..931752b574 --- /dev/null +++ b/tdapi/tl_search_user_by_token_gen.go @@ -0,0 +1,206 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +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{} +) + +// SearchUserByTokenRequest represents TL type `searchUserByToken#d841f436`. +type SearchUserByTokenRequest struct { + // Token to search for + Token string +} + +// SearchUserByTokenRequestTypeID is TL type id of SearchUserByTokenRequest. +const SearchUserByTokenRequestTypeID = 0xd841f436 + +// Ensuring interfaces in compile-time for SearchUserByTokenRequest. +var ( + _ bin.Encoder = &SearchUserByTokenRequest{} + _ bin.Decoder = &SearchUserByTokenRequest{} + _ bin.BareEncoder = &SearchUserByTokenRequest{} + _ bin.BareDecoder = &SearchUserByTokenRequest{} +) + +func (s *SearchUserByTokenRequest) Zero() bool { + if s == nil { + return true + } + if !(s.Token == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SearchUserByTokenRequest) String() string { + if s == nil { + return "SearchUserByTokenRequest(nil)" + } + type Alias SearchUserByTokenRequest + return fmt.Sprintf("SearchUserByTokenRequest%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SearchUserByTokenRequest) TypeID() uint32 { + return SearchUserByTokenRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SearchUserByTokenRequest) TypeName() string { + return "searchUserByToken" +} + +// TypeInfo returns info about TL type. +func (s *SearchUserByTokenRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "searchUserByToken", + ID: SearchUserByTokenRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Token", + SchemaName: "token", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SearchUserByTokenRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode searchUserByToken#d841f436 as nil") + } + b.PutID(SearchUserByTokenRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SearchUserByTokenRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode searchUserByToken#d841f436 as nil") + } + b.PutString(s.Token) + return nil +} + +// Decode implements bin.Decoder. +func (s *SearchUserByTokenRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode searchUserByToken#d841f436 to nil") + } + if err := b.ConsumeID(SearchUserByTokenRequestTypeID); err != nil { + return fmt.Errorf("unable to decode searchUserByToken#d841f436: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SearchUserByTokenRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode searchUserByToken#d841f436 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode searchUserByToken#d841f436: field token: %w", err) + } + s.Token = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SearchUserByTokenRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode searchUserByToken#d841f436 as nil") + } + b.ObjStart() + b.PutID("searchUserByToken") + b.Comma() + b.FieldStart("token") + b.PutString(s.Token) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SearchUserByTokenRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode searchUserByToken#d841f436 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("searchUserByToken"); err != nil { + return fmt.Errorf("unable to decode searchUserByToken#d841f436: %w", err) + } + case "token": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode searchUserByToken#d841f436: field token: %w", err) + } + s.Token = value + default: + return b.Skip() + } + return nil + }) +} + +// GetToken returns value of Token field. +func (s *SearchUserByTokenRequest) GetToken() (value string) { + if s == nil { + return + } + return s.Token +} + +// SearchUserByToken invokes method searchUserByToken#d841f436 returning error if any. +func (c *Client) SearchUserByToken(ctx context.Context, token string) (*User, error) { + var result User + + request := &SearchUserByTokenRequest{ + Token: token, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_send_inline_query_result_message_gen.go b/tdapi/tl_send_inline_query_result_message_gen.go index 0ec27360d8..1769315273 100644 --- a/tdapi/tl_send_inline_query_result_message_gen.go +++ b/tdapi/tl_send_inline_query_result_message_gen.go @@ -46,8 +46,8 @@ type SendInlineQueryResultMessageRequest struct { // Identifier of the inline result ResultID string // Pass true to hide the bot, via which the message is sent. Can be used only for bots - // GetOption("animation_search_bot_username"), GetOption("photo_search_bot_username"), - // and GetOption("venue_search_bot_username") + // getOption("animation_search_bot_username"), getOption("photo_search_bot_username"), + // and getOption("venue_search_bot_username") HideViaBot bool } diff --git a/tdapi/tl_set_bio_gen.go b/tdapi/tl_set_bio_gen.go index 48ed1140ee..1c0ea761fb 100644 --- a/tdapi/tl_set_bio_gen.go +++ b/tdapi/tl_set_bio_gen.go @@ -33,7 +33,7 @@ var ( // SetBioRequest represents TL type `setBio#9f772354`. type SetBioRequest struct { - // The new value of the user bio; 0-GetOption("bio_length_max") characters without line + // The new value of the user bio; 0-getOption("bio_length_max") characters without line // feeds Bio string } diff --git a/tdapi/tl_set_chat_message_ttl_gen.go b/tdapi/tl_set_chat_message_ttl_gen.go index f18b2d4e90..5cdb8e1406 100644 --- a/tdapi/tl_set_chat_message_ttl_gen.go +++ b/tdapi/tl_set_chat_message_ttl_gen.go @@ -36,7 +36,7 @@ type SetChatMessageTTLRequest struct { // Chat identifier ChatID int64 // New TTL value, in seconds; unless the chat is secret, it must be from 0 up to 365 * - // 86400 and be divisible by 86400 + // 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically TTL int32 } diff --git a/tdapi/tl_set_default_message_ttl_gen.go b/tdapi/tl_set_default_message_ttl_gen.go new file mode 100644 index 0000000000..e66e6abbc7 --- /dev/null +++ b/tdapi/tl_set_default_message_ttl_gen.go @@ -0,0 +1,207 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +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{} +) + +// SetDefaultMessageTTLRequest represents TL type `setDefaultMessageTtl#90bd2287`. +type SetDefaultMessageTTLRequest struct { + // New message TTL; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, + // then messages aren't deleted automatically + TTL MessageTTL +} + +// SetDefaultMessageTTLRequestTypeID is TL type id of SetDefaultMessageTTLRequest. +const SetDefaultMessageTTLRequestTypeID = 0x90bd2287 + +// Ensuring interfaces in compile-time for SetDefaultMessageTTLRequest. +var ( + _ bin.Encoder = &SetDefaultMessageTTLRequest{} + _ bin.Decoder = &SetDefaultMessageTTLRequest{} + _ bin.BareEncoder = &SetDefaultMessageTTLRequest{} + _ bin.BareDecoder = &SetDefaultMessageTTLRequest{} +) + +func (s *SetDefaultMessageTTLRequest) Zero() bool { + if s == nil { + return true + } + if !(s.TTL.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SetDefaultMessageTTLRequest) String() string { + if s == nil { + return "SetDefaultMessageTTLRequest(nil)" + } + type Alias SetDefaultMessageTTLRequest + return fmt.Sprintf("SetDefaultMessageTTLRequest%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SetDefaultMessageTTLRequest) TypeID() uint32 { + return SetDefaultMessageTTLRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SetDefaultMessageTTLRequest) TypeName() string { + return "setDefaultMessageTtl" +} + +// TypeInfo returns info about TL type. +func (s *SetDefaultMessageTTLRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "setDefaultMessageTtl", + ID: SetDefaultMessageTTLRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "TTL", + SchemaName: "ttl", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SetDefaultMessageTTLRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setDefaultMessageTtl#90bd2287 as nil") + } + b.PutID(SetDefaultMessageTTLRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SetDefaultMessageTTLRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setDefaultMessageTtl#90bd2287 as nil") + } + if err := s.TTL.Encode(b); err != nil { + return fmt.Errorf("unable to encode setDefaultMessageTtl#90bd2287: field ttl: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *SetDefaultMessageTTLRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setDefaultMessageTtl#90bd2287 to nil") + } + if err := b.ConsumeID(SetDefaultMessageTTLRequestTypeID); err != nil { + return fmt.Errorf("unable to decode setDefaultMessageTtl#90bd2287: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SetDefaultMessageTTLRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setDefaultMessageTtl#90bd2287 to nil") + } + { + if err := s.TTL.Decode(b); err != nil { + return fmt.Errorf("unable to decode setDefaultMessageTtl#90bd2287: field ttl: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SetDefaultMessageTTLRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode setDefaultMessageTtl#90bd2287 as nil") + } + b.ObjStart() + b.PutID("setDefaultMessageTtl") + b.Comma() + b.FieldStart("ttl") + if err := s.TTL.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode setDefaultMessageTtl#90bd2287: field ttl: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SetDefaultMessageTTLRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode setDefaultMessageTtl#90bd2287 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("setDefaultMessageTtl"); err != nil { + return fmt.Errorf("unable to decode setDefaultMessageTtl#90bd2287: %w", err) + } + case "ttl": + if err := s.TTL.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode setDefaultMessageTtl#90bd2287: field ttl: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetTTL returns value of TTL field. +func (s *SetDefaultMessageTTLRequest) GetTTL() (value MessageTTL) { + if s == nil { + return + } + return s.TTL +} + +// SetDefaultMessageTTL invokes method setDefaultMessageTtl#90bd2287 returning error if any. +func (c *Client) SetDefaultMessageTTL(ctx context.Context, ttl MessageTTL) error { + var ok Ok + + request := &SetDefaultMessageTTLRequest{ + TTL: ttl, + } + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_set_forum_topic_notification_settings_gen.go b/tdapi/tl_set_forum_topic_notification_settings_gen.go new file mode 100644 index 0000000000..3859222748 --- /dev/null +++ b/tdapi/tl_set_forum_topic_notification_settings_gen.go @@ -0,0 +1,272 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +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{} +) + +// SetForumTopicNotificationSettingsRequest represents TL type `setForumTopicNotificationSettings#1f433467`. +type SetForumTopicNotificationSettingsRequest struct { + // Chat identifier + ChatID int64 + // Message thread identifier of the forum topic + MessageThreadID int64 + // New notification settings for the forum topic. If the topic is muted for more than 366 + // days, it is considered to be muted forever + NotificationSettings ChatNotificationSettings +} + +// SetForumTopicNotificationSettingsRequestTypeID is TL type id of SetForumTopicNotificationSettingsRequest. +const SetForumTopicNotificationSettingsRequestTypeID = 0x1f433467 + +// Ensuring interfaces in compile-time for SetForumTopicNotificationSettingsRequest. +var ( + _ bin.Encoder = &SetForumTopicNotificationSettingsRequest{} + _ bin.Decoder = &SetForumTopicNotificationSettingsRequest{} + _ bin.BareEncoder = &SetForumTopicNotificationSettingsRequest{} + _ bin.BareDecoder = &SetForumTopicNotificationSettingsRequest{} +) + +func (s *SetForumTopicNotificationSettingsRequest) Zero() bool { + if s == nil { + return true + } + if !(s.ChatID == 0) { + return false + } + if !(s.MessageThreadID == 0) { + return false + } + if !(s.NotificationSettings.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SetForumTopicNotificationSettingsRequest) String() string { + if s == nil { + return "SetForumTopicNotificationSettingsRequest(nil)" + } + type Alias SetForumTopicNotificationSettingsRequest + return fmt.Sprintf("SetForumTopicNotificationSettingsRequest%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SetForumTopicNotificationSettingsRequest) TypeID() uint32 { + return SetForumTopicNotificationSettingsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SetForumTopicNotificationSettingsRequest) TypeName() string { + return "setForumTopicNotificationSettings" +} + +// TypeInfo returns info about TL type. +func (s *SetForumTopicNotificationSettingsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "setForumTopicNotificationSettings", + ID: SetForumTopicNotificationSettingsRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "MessageThreadID", + SchemaName: "message_thread_id", + }, + { + Name: "NotificationSettings", + SchemaName: "notification_settings", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SetForumTopicNotificationSettingsRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setForumTopicNotificationSettings#1f433467 as nil") + } + b.PutID(SetForumTopicNotificationSettingsRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SetForumTopicNotificationSettingsRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setForumTopicNotificationSettings#1f433467 as nil") + } + b.PutInt53(s.ChatID) + b.PutInt53(s.MessageThreadID) + if err := s.NotificationSettings.Encode(b); err != nil { + return fmt.Errorf("unable to encode setForumTopicNotificationSettings#1f433467: field notification_settings: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *SetForumTopicNotificationSettingsRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setForumTopicNotificationSettings#1f433467 to nil") + } + if err := b.ConsumeID(SetForumTopicNotificationSettingsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode setForumTopicNotificationSettings#1f433467: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SetForumTopicNotificationSettingsRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setForumTopicNotificationSettings#1f433467 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setForumTopicNotificationSettings#1f433467: field chat_id: %w", err) + } + s.ChatID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setForumTopicNotificationSettings#1f433467: field message_thread_id: %w", err) + } + s.MessageThreadID = value + } + { + if err := s.NotificationSettings.Decode(b); err != nil { + return fmt.Errorf("unable to decode setForumTopicNotificationSettings#1f433467: field notification_settings: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SetForumTopicNotificationSettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode setForumTopicNotificationSettings#1f433467 as nil") + } + b.ObjStart() + b.PutID("setForumTopicNotificationSettings") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(s.ChatID) + b.Comma() + b.FieldStart("message_thread_id") + b.PutInt53(s.MessageThreadID) + b.Comma() + b.FieldStart("notification_settings") + if err := s.NotificationSettings.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode setForumTopicNotificationSettings#1f433467: field notification_settings: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SetForumTopicNotificationSettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode setForumTopicNotificationSettings#1f433467 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("setForumTopicNotificationSettings"); err != nil { + return fmt.Errorf("unable to decode setForumTopicNotificationSettings#1f433467: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setForumTopicNotificationSettings#1f433467: field chat_id: %w", err) + } + s.ChatID = value + case "message_thread_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setForumTopicNotificationSettings#1f433467: field message_thread_id: %w", err) + } + s.MessageThreadID = value + case "notification_settings": + if err := s.NotificationSettings.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode setForumTopicNotificationSettings#1f433467: field notification_settings: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (s *SetForumTopicNotificationSettingsRequest) GetChatID() (value int64) { + if s == nil { + return + } + return s.ChatID +} + +// GetMessageThreadID returns value of MessageThreadID field. +func (s *SetForumTopicNotificationSettingsRequest) GetMessageThreadID() (value int64) { + if s == nil { + return + } + return s.MessageThreadID +} + +// GetNotificationSettings returns value of NotificationSettings field. +func (s *SetForumTopicNotificationSettingsRequest) GetNotificationSettings() (value ChatNotificationSettings) { + if s == nil { + return + } + return s.NotificationSettings +} + +// SetForumTopicNotificationSettings invokes method setForumTopicNotificationSettings#1f433467 returning error if any. +func (c *Client) SetForumTopicNotificationSettings(ctx context.Context, request *SetForumTopicNotificationSettingsRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_supergroup_full_info_gen.go b/tdapi/tl_supergroup_full_info_gen.go index 0046456e95..92173f7297 100644 --- a/tdapi/tl_supergroup_full_info_gen.go +++ b/tdapi/tl_supergroup_full_info_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// SupergroupFullInfo represents TL type `supergroupFullInfo#9c9c1807`. +// SupergroupFullInfo represents TL type `supergroupFullInfo#3a2d070d`. type SupergroupFullInfo struct { // Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as // in chat.photo @@ -71,6 +71,9 @@ type SupergroupFullInfo struct { // affects only private non-forum supergroups without a linked chat. The value of this // field is only available for chat administrators IsAllHistoryAvailable bool + // True, if aggressive anti-spam checks are enabled in the supergroup. The value of this + // field is only available for chat administrators + IsAggressiveAntiSpamEnabled bool // Identifier of the supergroup sticker set; 0 if none StickerSetID int64 // Location to which the supergroup is connected; may be null @@ -88,7 +91,7 @@ type SupergroupFullInfo struct { } // SupergroupFullInfoTypeID is TL type id of SupergroupFullInfo. -const SupergroupFullInfoTypeID = 0x9c9c1807 +const SupergroupFullInfoTypeID = 0x3a2d070d // Ensuring interfaces in compile-time for SupergroupFullInfo. var ( @@ -147,6 +150,9 @@ func (s *SupergroupFullInfo) Zero() bool { if !(s.IsAllHistoryAvailable == false) { return false } + if !(s.IsAggressiveAntiSpamEnabled == false) { + return false + } if !(s.StickerSetID == 0) { return false } @@ -261,6 +267,10 @@ func (s *SupergroupFullInfo) TypeInfo() tdp.Type { Name: "IsAllHistoryAvailable", SchemaName: "is_all_history_available", }, + { + Name: "IsAggressiveAntiSpamEnabled", + SchemaName: "is_aggressive_anti_spam_enabled", + }, { Name: "StickerSetID", SchemaName: "sticker_set_id", @@ -292,7 +302,7 @@ func (s *SupergroupFullInfo) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *SupergroupFullInfo) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode supergroupFullInfo#9c9c1807 as nil") + return fmt.Errorf("can't encode supergroupFullInfo#3a2d070d as nil") } b.PutID(SupergroupFullInfoTypeID) return s.EncodeBare(b) @@ -301,10 +311,10 @@ func (s *SupergroupFullInfo) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *SupergroupFullInfo) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode supergroupFullInfo#9c9c1807 as nil") + return fmt.Errorf("can't encode supergroupFullInfo#3a2d070d as nil") } if err := s.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#9c9c1807: field photo: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#3a2d070d: field photo: %w", err) } b.PutString(s.Description) b.PutInt32(s.MemberCount) @@ -320,17 +330,18 @@ func (s *SupergroupFullInfo) EncodeBare(b *bin.Buffer) error { b.PutBool(s.CanSetLocation) b.PutBool(s.CanGetStatistics) b.PutBool(s.IsAllHistoryAvailable) + b.PutBool(s.IsAggressiveAntiSpamEnabled) b.PutLong(s.StickerSetID) if err := s.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#9c9c1807: field location: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#3a2d070d: field location: %w", err) } if err := s.InviteLink.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#9c9c1807: field invite_link: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#3a2d070d: field invite_link: %w", err) } b.PutInt(len(s.BotCommands)) for idx, v := range s.BotCommands { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare supergroupFullInfo#9c9c1807: field bot_commands element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare supergroupFullInfo#3a2d070d: field bot_commands element with index %d: %w", idx, err) } } b.PutInt53(s.UpgradedFromBasicGroupID) @@ -341,10 +352,10 @@ func (s *SupergroupFullInfo) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *SupergroupFullInfo) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode supergroupFullInfo#9c9c1807 to nil") + return fmt.Errorf("can't decode supergroupFullInfo#3a2d070d to nil") } if err := b.ConsumeID(SupergroupFullInfoTypeID); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: %w", err) } return s.DecodeBare(b) } @@ -352,132 +363,139 @@ func (s *SupergroupFullInfo) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *SupergroupFullInfo) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode supergroupFullInfo#9c9c1807 to nil") + return fmt.Errorf("can't decode supergroupFullInfo#3a2d070d to nil") } { if err := s.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field photo: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field photo: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field description: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field description: %w", err) } s.Description = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field member_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field member_count: %w", err) } s.MemberCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field administrator_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field administrator_count: %w", err) } s.AdministratorCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field restricted_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field restricted_count: %w", err) } s.RestrictedCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field banned_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field banned_count: %w", err) } s.BannedCount = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field linked_chat_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field linked_chat_id: %w", err) } s.LinkedChatID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field slow_mode_delay: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field slow_mode_delay: %w", err) } s.SlowModeDelay = value } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field slow_mode_delay_expires_in: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field slow_mode_delay_expires_in: %w", err) } s.SlowModeDelayExpiresIn = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field can_get_members: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field can_get_members: %w", err) } s.CanGetMembers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field can_set_username: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field can_set_username: %w", err) } s.CanSetUsername = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field can_set_sticker_set: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field can_set_sticker_set: %w", err) } s.CanSetStickerSet = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field can_set_location: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field can_set_location: %w", err) } s.CanSetLocation = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field can_get_statistics: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field can_get_statistics: %w", err) } s.CanGetStatistics = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field is_all_history_available: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field is_all_history_available: %w", err) } s.IsAllHistoryAvailable = value } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field is_aggressive_anti_spam_enabled: %w", err) + } + s.IsAggressiveAntiSpamEnabled = value + } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field sticker_set_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field sticker_set_id: %w", err) } s.StickerSetID = value } { if err := s.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field location: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field location: %w", err) } } { if err := s.InviteLink.Decode(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field invite_link: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field invite_link: %w", err) } } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field bot_commands: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field bot_commands: %w", err) } if headerLen > 0 { @@ -486,7 +504,7 @@ func (s *SupergroupFullInfo) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value BotCommands if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare supergroupFullInfo#9c9c1807: field bot_commands: %w", err) + return fmt.Errorf("unable to decode bare supergroupFullInfo#3a2d070d: field bot_commands: %w", err) } s.BotCommands = append(s.BotCommands, value) } @@ -494,14 +512,14 @@ func (s *SupergroupFullInfo) DecodeBare(b *bin.Buffer) error { { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field upgraded_from_basic_group_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field upgraded_from_basic_group_id: %w", err) } s.UpgradedFromBasicGroupID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field upgraded_from_max_message_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field upgraded_from_max_message_id: %w", err) } s.UpgradedFromMaxMessageID = value } @@ -511,14 +529,14 @@ func (s *SupergroupFullInfo) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *SupergroupFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode supergroupFullInfo#9c9c1807 as nil") + return fmt.Errorf("can't encode supergroupFullInfo#3a2d070d as nil") } b.ObjStart() b.PutID("supergroupFullInfo") b.Comma() b.FieldStart("photo") if err := s.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#9c9c1807: field photo: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#3a2d070d: field photo: %w", err) } b.Comma() b.FieldStart("description") @@ -563,24 +581,27 @@ func (s *SupergroupFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("is_all_history_available") b.PutBool(s.IsAllHistoryAvailable) b.Comma() + b.FieldStart("is_aggressive_anti_spam_enabled") + b.PutBool(s.IsAggressiveAntiSpamEnabled) + b.Comma() b.FieldStart("sticker_set_id") b.PutLong(s.StickerSetID) b.Comma() b.FieldStart("location") if err := s.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#9c9c1807: field location: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#3a2d070d: field location: %w", err) } b.Comma() b.FieldStart("invite_link") if err := s.InviteLink.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#9c9c1807: field invite_link: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#3a2d070d: field invite_link: %w", err) } b.Comma() b.FieldStart("bot_commands") b.ArrStart() for idx, v := range s.BotCommands { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#9c9c1807: field bot_commands element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode supergroupFullInfo#3a2d070d: field bot_commands element with index %d: %w", idx, err) } b.Comma() } @@ -601,138 +622,144 @@ func (s *SupergroupFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *SupergroupFullInfo) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode supergroupFullInfo#9c9c1807 to nil") + return fmt.Errorf("can't decode supergroupFullInfo#3a2d070d to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("supergroupFullInfo"); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: %w", err) } case "photo": if err := s.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field photo: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field photo: %w", err) } case "description": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field description: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field description: %w", err) } s.Description = value case "member_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field member_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field member_count: %w", err) } s.MemberCount = value case "administrator_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field administrator_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field administrator_count: %w", err) } s.AdministratorCount = value case "restricted_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field restricted_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field restricted_count: %w", err) } s.RestrictedCount = value case "banned_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field banned_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field banned_count: %w", err) } s.BannedCount = value case "linked_chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field linked_chat_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field linked_chat_id: %w", err) } s.LinkedChatID = value case "slow_mode_delay": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field slow_mode_delay: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field slow_mode_delay: %w", err) } s.SlowModeDelay = value case "slow_mode_delay_expires_in": value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field slow_mode_delay_expires_in: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field slow_mode_delay_expires_in: %w", err) } s.SlowModeDelayExpiresIn = value case "can_get_members": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field can_get_members: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field can_get_members: %w", err) } s.CanGetMembers = value case "can_set_username": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field can_set_username: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field can_set_username: %w", err) } s.CanSetUsername = value case "can_set_sticker_set": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field can_set_sticker_set: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field can_set_sticker_set: %w", err) } s.CanSetStickerSet = value case "can_set_location": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field can_set_location: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field can_set_location: %w", err) } s.CanSetLocation = value case "can_get_statistics": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field can_get_statistics: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field can_get_statistics: %w", err) } s.CanGetStatistics = value case "is_all_history_available": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field is_all_history_available: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field is_all_history_available: %w", err) } s.IsAllHistoryAvailable = value + case "is_aggressive_anti_spam_enabled": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field is_aggressive_anti_spam_enabled: %w", err) + } + s.IsAggressiveAntiSpamEnabled = value case "sticker_set_id": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field sticker_set_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field sticker_set_id: %w", err) } s.StickerSetID = value case "location": if err := s.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field location: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field location: %w", err) } case "invite_link": if err := s.InviteLink.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field invite_link: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field invite_link: %w", err) } case "bot_commands": if err := b.Arr(func(b tdjson.Decoder) error { var value BotCommands if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field bot_commands: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field bot_commands: %w", err) } s.BotCommands = append(s.BotCommands, value) return nil }); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field bot_commands: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field bot_commands: %w", err) } case "upgraded_from_basic_group_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field upgraded_from_basic_group_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field upgraded_from_basic_group_id: %w", err) } s.UpgradedFromBasicGroupID = value case "upgraded_from_max_message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#9c9c1807: field upgraded_from_max_message_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3a2d070d: field upgraded_from_max_message_id: %w", err) } s.UpgradedFromMaxMessageID = value default: @@ -862,6 +889,14 @@ func (s *SupergroupFullInfo) GetIsAllHistoryAvailable() (value bool) { return s.IsAllHistoryAvailable } +// GetIsAggressiveAntiSpamEnabled returns value of IsAggressiveAntiSpamEnabled field. +func (s *SupergroupFullInfo) GetIsAggressiveAntiSpamEnabled() (value bool) { + if s == nil { + return + } + return s.IsAggressiveAntiSpamEnabled +} + // GetStickerSetID returns value of StickerSetID field. func (s *SupergroupFullInfo) GetStickerSetID() (value int64) { if s == nil { diff --git a/tdapi/tl_toggle_general_forum_topic_is_hidden_gen.go b/tdapi/tl_toggle_general_forum_topic_is_hidden_gen.go new file mode 100644 index 0000000000..b33cfcea21 --- /dev/null +++ b/tdapi/tl_toggle_general_forum_topic_is_hidden_gen.go @@ -0,0 +1,237 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +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{} +) + +// ToggleGeneralForumTopicIsHiddenRequest represents TL type `toggleGeneralForumTopicIsHidden#5f1d1448`. +type ToggleGeneralForumTopicIsHiddenRequest struct { + // Identifier of the chat + ChatID int64 + // Pass true to hide and close the General topic; pass false to unhide it + IsHidden bool +} + +// ToggleGeneralForumTopicIsHiddenRequestTypeID is TL type id of ToggleGeneralForumTopicIsHiddenRequest. +const ToggleGeneralForumTopicIsHiddenRequestTypeID = 0x5f1d1448 + +// Ensuring interfaces in compile-time for ToggleGeneralForumTopicIsHiddenRequest. +var ( + _ bin.Encoder = &ToggleGeneralForumTopicIsHiddenRequest{} + _ bin.Decoder = &ToggleGeneralForumTopicIsHiddenRequest{} + _ bin.BareEncoder = &ToggleGeneralForumTopicIsHiddenRequest{} + _ bin.BareDecoder = &ToggleGeneralForumTopicIsHiddenRequest{} +) + +func (t *ToggleGeneralForumTopicIsHiddenRequest) Zero() bool { + if t == nil { + return true + } + if !(t.ChatID == 0) { + return false + } + if !(t.IsHidden == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *ToggleGeneralForumTopicIsHiddenRequest) String() string { + if t == nil { + return "ToggleGeneralForumTopicIsHiddenRequest(nil)" + } + type Alias ToggleGeneralForumTopicIsHiddenRequest + return fmt.Sprintf("ToggleGeneralForumTopicIsHiddenRequest%+v", Alias(*t)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ToggleGeneralForumTopicIsHiddenRequest) TypeID() uint32 { + return ToggleGeneralForumTopicIsHiddenRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ToggleGeneralForumTopicIsHiddenRequest) TypeName() string { + return "toggleGeneralForumTopicIsHidden" +} + +// TypeInfo returns info about TL type. +func (t *ToggleGeneralForumTopicIsHiddenRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "toggleGeneralForumTopicIsHidden", + ID: ToggleGeneralForumTopicIsHiddenRequestTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "IsHidden", + SchemaName: "is_hidden", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *ToggleGeneralForumTopicIsHiddenRequest) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode toggleGeneralForumTopicIsHidden#5f1d1448 as nil") + } + b.PutID(ToggleGeneralForumTopicIsHiddenRequestTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *ToggleGeneralForumTopicIsHiddenRequest) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode toggleGeneralForumTopicIsHidden#5f1d1448 as nil") + } + b.PutInt53(t.ChatID) + b.PutBool(t.IsHidden) + return nil +} + +// Decode implements bin.Decoder. +func (t *ToggleGeneralForumTopicIsHiddenRequest) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode toggleGeneralForumTopicIsHidden#5f1d1448 to nil") + } + if err := b.ConsumeID(ToggleGeneralForumTopicIsHiddenRequestTypeID); err != nil { + return fmt.Errorf("unable to decode toggleGeneralForumTopicIsHidden#5f1d1448: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *ToggleGeneralForumTopicIsHiddenRequest) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode toggleGeneralForumTopicIsHidden#5f1d1448 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode toggleGeneralForumTopicIsHidden#5f1d1448: field chat_id: %w", err) + } + t.ChatID = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode toggleGeneralForumTopicIsHidden#5f1d1448: field is_hidden: %w", err) + } + t.IsHidden = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (t *ToggleGeneralForumTopicIsHiddenRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if t == nil { + return fmt.Errorf("can't encode toggleGeneralForumTopicIsHidden#5f1d1448 as nil") + } + b.ObjStart() + b.PutID("toggleGeneralForumTopicIsHidden") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(t.ChatID) + b.Comma() + b.FieldStart("is_hidden") + b.PutBool(t.IsHidden) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (t *ToggleGeneralForumTopicIsHiddenRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if t == nil { + return fmt.Errorf("can't decode toggleGeneralForumTopicIsHidden#5f1d1448 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("toggleGeneralForumTopicIsHidden"); err != nil { + return fmt.Errorf("unable to decode toggleGeneralForumTopicIsHidden#5f1d1448: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode toggleGeneralForumTopicIsHidden#5f1d1448: field chat_id: %w", err) + } + t.ChatID = value + case "is_hidden": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode toggleGeneralForumTopicIsHidden#5f1d1448: field is_hidden: %w", err) + } + t.IsHidden = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (t *ToggleGeneralForumTopicIsHiddenRequest) GetChatID() (value int64) { + if t == nil { + return + } + return t.ChatID +} + +// GetIsHidden returns value of IsHidden field. +func (t *ToggleGeneralForumTopicIsHiddenRequest) GetIsHidden() (value bool) { + if t == nil { + return + } + return t.IsHidden +} + +// ToggleGeneralForumTopicIsHidden invokes method toggleGeneralForumTopicIsHidden#5f1d1448 returning error if any. +func (c *Client) ToggleGeneralForumTopicIsHidden(ctx context.Context, request *ToggleGeneralForumTopicIsHiddenRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_toggle_group_call_screen_sharing_is_paused_gen.go b/tdapi/tl_toggle_group_call_screen_sharing_is_paused_gen.go index 9fd9bc64f8..3fedc27850 100644 --- a/tdapi/tl_toggle_group_call_screen_sharing_is_paused_gen.go +++ b/tdapi/tl_toggle_group_call_screen_sharing_is_paused_gen.go @@ -35,7 +35,7 @@ var ( type ToggleGroupCallScreenSharingIsPausedRequest struct { // Group call identifier GroupCallID int32 - // True if screen sharing is paused + // True, if screen sharing is paused IsPaused bool } diff --git a/tdapi/tl_toggle_supergroup_is_aggressive_anti_spam_enabled_gen.go b/tdapi/tl_toggle_supergroup_is_aggressive_anti_spam_enabled_gen.go new file mode 100644 index 0000000000..f9f5641cf1 --- /dev/null +++ b/tdapi/tl_toggle_supergroup_is_aggressive_anti_spam_enabled_gen.go @@ -0,0 +1,237 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +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{} +) + +// ToggleSupergroupIsAggressiveAntiSpamEnabledRequest represents TL type `toggleSupergroupIsAggressiveAntiSpamEnabled#a87019f8`. +type ToggleSupergroupIsAggressiveAntiSpamEnabledRequest struct { + // The identifier of the supergroup, which isn't a broadcast group + SupergroupID int64 + // The new value of is_aggressive_anti_spam_enabled + IsAggressiveAntiSpamEnabled bool +} + +// ToggleSupergroupIsAggressiveAntiSpamEnabledRequestTypeID is TL type id of ToggleSupergroupIsAggressiveAntiSpamEnabledRequest. +const ToggleSupergroupIsAggressiveAntiSpamEnabledRequestTypeID = 0xa87019f8 + +// Ensuring interfaces in compile-time for ToggleSupergroupIsAggressiveAntiSpamEnabledRequest. +var ( + _ bin.Encoder = &ToggleSupergroupIsAggressiveAntiSpamEnabledRequest{} + _ bin.Decoder = &ToggleSupergroupIsAggressiveAntiSpamEnabledRequest{} + _ bin.BareEncoder = &ToggleSupergroupIsAggressiveAntiSpamEnabledRequest{} + _ bin.BareDecoder = &ToggleSupergroupIsAggressiveAntiSpamEnabledRequest{} +) + +func (t *ToggleSupergroupIsAggressiveAntiSpamEnabledRequest) Zero() bool { + if t == nil { + return true + } + if !(t.SupergroupID == 0) { + return false + } + if !(t.IsAggressiveAntiSpamEnabled == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *ToggleSupergroupIsAggressiveAntiSpamEnabledRequest) String() string { + if t == nil { + return "ToggleSupergroupIsAggressiveAntiSpamEnabledRequest(nil)" + } + type Alias ToggleSupergroupIsAggressiveAntiSpamEnabledRequest + return fmt.Sprintf("ToggleSupergroupIsAggressiveAntiSpamEnabledRequest%+v", Alias(*t)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ToggleSupergroupIsAggressiveAntiSpamEnabledRequest) TypeID() uint32 { + return ToggleSupergroupIsAggressiveAntiSpamEnabledRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ToggleSupergroupIsAggressiveAntiSpamEnabledRequest) TypeName() string { + return "toggleSupergroupIsAggressiveAntiSpamEnabled" +} + +// TypeInfo returns info about TL type. +func (t *ToggleSupergroupIsAggressiveAntiSpamEnabledRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "toggleSupergroupIsAggressiveAntiSpamEnabled", + ID: ToggleSupergroupIsAggressiveAntiSpamEnabledRequestTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "SupergroupID", + SchemaName: "supergroup_id", + }, + { + Name: "IsAggressiveAntiSpamEnabled", + SchemaName: "is_aggressive_anti_spam_enabled", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *ToggleSupergroupIsAggressiveAntiSpamEnabledRequest) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode toggleSupergroupIsAggressiveAntiSpamEnabled#a87019f8 as nil") + } + b.PutID(ToggleSupergroupIsAggressiveAntiSpamEnabledRequestTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *ToggleSupergroupIsAggressiveAntiSpamEnabledRequest) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode toggleSupergroupIsAggressiveAntiSpamEnabled#a87019f8 as nil") + } + b.PutInt53(t.SupergroupID) + b.PutBool(t.IsAggressiveAntiSpamEnabled) + return nil +} + +// Decode implements bin.Decoder. +func (t *ToggleSupergroupIsAggressiveAntiSpamEnabledRequest) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode toggleSupergroupIsAggressiveAntiSpamEnabled#a87019f8 to nil") + } + if err := b.ConsumeID(ToggleSupergroupIsAggressiveAntiSpamEnabledRequestTypeID); err != nil { + return fmt.Errorf("unable to decode toggleSupergroupIsAggressiveAntiSpamEnabled#a87019f8: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *ToggleSupergroupIsAggressiveAntiSpamEnabledRequest) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode toggleSupergroupIsAggressiveAntiSpamEnabled#a87019f8 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode toggleSupergroupIsAggressiveAntiSpamEnabled#a87019f8: field supergroup_id: %w", err) + } + t.SupergroupID = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode toggleSupergroupIsAggressiveAntiSpamEnabled#a87019f8: field is_aggressive_anti_spam_enabled: %w", err) + } + t.IsAggressiveAntiSpamEnabled = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (t *ToggleSupergroupIsAggressiveAntiSpamEnabledRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if t == nil { + return fmt.Errorf("can't encode toggleSupergroupIsAggressiveAntiSpamEnabled#a87019f8 as nil") + } + b.ObjStart() + b.PutID("toggleSupergroupIsAggressiveAntiSpamEnabled") + b.Comma() + b.FieldStart("supergroup_id") + b.PutInt53(t.SupergroupID) + b.Comma() + b.FieldStart("is_aggressive_anti_spam_enabled") + b.PutBool(t.IsAggressiveAntiSpamEnabled) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (t *ToggleSupergroupIsAggressiveAntiSpamEnabledRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if t == nil { + return fmt.Errorf("can't decode toggleSupergroupIsAggressiveAntiSpamEnabled#a87019f8 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("toggleSupergroupIsAggressiveAntiSpamEnabled"); err != nil { + return fmt.Errorf("unable to decode toggleSupergroupIsAggressiveAntiSpamEnabled#a87019f8: %w", err) + } + case "supergroup_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode toggleSupergroupIsAggressiveAntiSpamEnabled#a87019f8: field supergroup_id: %w", err) + } + t.SupergroupID = value + case "is_aggressive_anti_spam_enabled": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode toggleSupergroupIsAggressiveAntiSpamEnabled#a87019f8: field is_aggressive_anti_spam_enabled: %w", err) + } + t.IsAggressiveAntiSpamEnabled = value + default: + return b.Skip() + } + return nil + }) +} + +// GetSupergroupID returns value of SupergroupID field. +func (t *ToggleSupergroupIsAggressiveAntiSpamEnabledRequest) GetSupergroupID() (value int64) { + if t == nil { + return + } + return t.SupergroupID +} + +// GetIsAggressiveAntiSpamEnabled returns value of IsAggressiveAntiSpamEnabled field. +func (t *ToggleSupergroupIsAggressiveAntiSpamEnabledRequest) GetIsAggressiveAntiSpamEnabled() (value bool) { + if t == nil { + return + } + return t.IsAggressiveAntiSpamEnabled +} + +// ToggleSupergroupIsAggressiveAntiSpamEnabled invokes method toggleSupergroupIsAggressiveAntiSpamEnabled#a87019f8 returning error if any. +func (c *Client) ToggleSupergroupIsAggressiveAntiSpamEnabled(ctx context.Context, request *ToggleSupergroupIsAggressiveAntiSpamEnabledRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_toggle_supergroup_is_forum_gen.go b/tdapi/tl_toggle_supergroup_is_forum_gen.go index ce0ae5bfda..648d6d1f34 100644 --- a/tdapi/tl_toggle_supergroup_is_forum_gen.go +++ b/tdapi/tl_toggle_supergroup_is_forum_gen.go @@ -36,7 +36,7 @@ type ToggleSupergroupIsForumRequest struct { // Identifier of the supergroup SupergroupID int64 // New value of is_forum. A supergroup can be converted to a forum, only if it has at - // least GetOption("forum_member_count_min") members + // least getOption("forum_member_count_min") members IsForum bool } diff --git a/tdapi/tl_user_gen.go b/tdapi/tl_user_gen.go index 999b662ecd..0ab2d28255 100644 --- a/tdapi/tl_user_gen.go +++ b/tdapi/tl_user_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// User represents TL type `user#d9250b34`. +// User represents TL type `user#5cdc7c44`. type User struct { // User identifier ID int64 @@ -61,6 +61,8 @@ type User struct { IsPremium bool // True, if the user is Telegram support account IsSupport bool + // True, if the user's phone number was bought on Fragment and isn't tied to a SIM card + HasAnonymousPhoneNumber bool // If non-empty, it contains a human-readable description of the reason why access to // this user must be restricted RestrictionReason string @@ -69,7 +71,7 @@ type User struct { // True, if many users reported this user as a fake account IsFake bool // If false, the user is inaccessible, and the only information known about the user is - // inside this class. Identifier of the user can't be passed to any method except GetUser + // inside this class. Identifier of the user can't be passed to any method HaveAccess bool // Type of the user Type UserTypeClass @@ -80,7 +82,7 @@ type User struct { } // UserTypeID is TL type id of User. -const UserTypeID = 0xd9250b34 +const UserTypeID = 0x5cdc7c44 // Ensuring interfaces in compile-time for User. var ( @@ -133,6 +135,9 @@ func (u *User) Zero() bool { if !(u.IsSupport == false) { return false } + if !(u.HasAnonymousPhoneNumber == false) { + return false + } if !(u.RestrictionReason == "") { return false } @@ -242,6 +247,10 @@ func (u *User) TypeInfo() tdp.Type { Name: "IsSupport", SchemaName: "is_support", }, + { + Name: "HasAnonymousPhoneNumber", + SchemaName: "has_anonymous_phone_number", + }, { Name: "RestrictionReason", SchemaName: "restriction_reason", @@ -277,7 +286,7 @@ func (u *User) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (u *User) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode user#d9250b34 as nil") + return fmt.Errorf("can't encode user#5cdc7c44 as nil") } b.PutID(UserTypeID) return u.EncodeBare(b) @@ -286,41 +295,42 @@ func (u *User) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *User) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode user#d9250b34 as nil") + return fmt.Errorf("can't encode user#5cdc7c44 as nil") } b.PutInt53(u.ID) b.PutString(u.FirstName) b.PutString(u.LastName) if err := u.Usernames.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#d9250b34: field usernames: %w", err) + return fmt.Errorf("unable to encode user#5cdc7c44: field usernames: %w", err) } b.PutString(u.PhoneNumber) if u.Status == nil { - return fmt.Errorf("unable to encode user#d9250b34: field status is nil") + return fmt.Errorf("unable to encode user#5cdc7c44: field status is nil") } if err := u.Status.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#d9250b34: field status: %w", err) + return fmt.Errorf("unable to encode user#5cdc7c44: field status: %w", err) } if err := u.ProfilePhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#d9250b34: field profile_photo: %w", err) + return fmt.Errorf("unable to encode user#5cdc7c44: field profile_photo: %w", err) } if err := u.EmojiStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#d9250b34: field emoji_status: %w", err) + return fmt.Errorf("unable to encode user#5cdc7c44: field emoji_status: %w", err) } b.PutBool(u.IsContact) b.PutBool(u.IsMutualContact) b.PutBool(u.IsVerified) b.PutBool(u.IsPremium) b.PutBool(u.IsSupport) + b.PutBool(u.HasAnonymousPhoneNumber) b.PutString(u.RestrictionReason) b.PutBool(u.IsScam) b.PutBool(u.IsFake) b.PutBool(u.HaveAccess) if u.Type == nil { - return fmt.Errorf("unable to encode user#d9250b34: field type is nil") + return fmt.Errorf("unable to encode user#5cdc7c44: field type is nil") } if err := u.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#d9250b34: field type: %w", err) + return fmt.Errorf("unable to encode user#5cdc7c44: field type: %w", err) } b.PutString(u.LanguageCode) b.PutBool(u.AddedToAttachmentMenu) @@ -330,10 +340,10 @@ func (u *User) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (u *User) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode user#d9250b34 to nil") + return fmt.Errorf("can't decode user#5cdc7c44 to nil") } if err := b.ConsumeID(UserTypeID); err != nil { - return fmt.Errorf("unable to decode user#d9250b34: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: %w", err) } return u.DecodeBare(b) } @@ -341,139 +351,146 @@ func (u *User) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *User) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode user#d9250b34 to nil") + return fmt.Errorf("can't decode user#5cdc7c44 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field id: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field id: %w", err) } u.ID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field first_name: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field first_name: %w", err) } u.FirstName = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field last_name: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field last_name: %w", err) } u.LastName = value } { if err := u.Usernames.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field usernames: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field usernames: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field phone_number: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field phone_number: %w", err) } u.PhoneNumber = value } { value, err := DecodeUserStatus(b) if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field status: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field status: %w", err) } u.Status = value } { if err := u.ProfilePhoto.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field profile_photo: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field profile_photo: %w", err) } } { if err := u.EmojiStatus.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field emoji_status: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field emoji_status: %w", err) } } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field is_contact: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field is_contact: %w", err) } u.IsContact = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field is_mutual_contact: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field is_mutual_contact: %w", err) } u.IsMutualContact = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field is_verified: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field is_verified: %w", err) } u.IsVerified = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field is_premium: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field is_premium: %w", err) } u.IsPremium = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field is_support: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field is_support: %w", err) } u.IsSupport = value } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode user#5cdc7c44: field has_anonymous_phone_number: %w", err) + } + u.HasAnonymousPhoneNumber = value + } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field restriction_reason: %w", err) } u.RestrictionReason = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field is_scam: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field is_scam: %w", err) } u.IsScam = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field is_fake: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field is_fake: %w", err) } u.IsFake = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field have_access: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field have_access: %w", err) } u.HaveAccess = value } { value, err := DecodeUserType(b) if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field type: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field type: %w", err) } u.Type = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field language_code: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field language_code: %w", err) } u.LanguageCode = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field added_to_attachment_menu: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field added_to_attachment_menu: %w", err) } u.AddedToAttachmentMenu = value } @@ -483,7 +500,7 @@ func (u *User) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode user#d9250b34 as nil") + return fmt.Errorf("can't encode user#5cdc7c44 as nil") } b.ObjStart() b.PutID("user") @@ -499,7 +516,7 @@ func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("usernames") if err := u.Usernames.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#d9250b34: field usernames: %w", err) + return fmt.Errorf("unable to encode user#5cdc7c44: field usernames: %w", err) } b.Comma() b.FieldStart("phone_number") @@ -507,20 +524,20 @@ func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("status") if u.Status == nil { - return fmt.Errorf("unable to encode user#d9250b34: field status is nil") + return fmt.Errorf("unable to encode user#5cdc7c44: field status is nil") } if err := u.Status.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#d9250b34: field status: %w", err) + return fmt.Errorf("unable to encode user#5cdc7c44: field status: %w", err) } b.Comma() b.FieldStart("profile_photo") if err := u.ProfilePhoto.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#d9250b34: field profile_photo: %w", err) + return fmt.Errorf("unable to encode user#5cdc7c44: field profile_photo: %w", err) } b.Comma() b.FieldStart("emoji_status") if err := u.EmojiStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#d9250b34: field emoji_status: %w", err) + return fmt.Errorf("unable to encode user#5cdc7c44: field emoji_status: %w", err) } b.Comma() b.FieldStart("is_contact") @@ -538,6 +555,9 @@ func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("is_support") b.PutBool(u.IsSupport) b.Comma() + b.FieldStart("has_anonymous_phone_number") + b.PutBool(u.HasAnonymousPhoneNumber) + b.Comma() b.FieldStart("restriction_reason") b.PutString(u.RestrictionReason) b.Comma() @@ -552,10 +572,10 @@ func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("type") if u.Type == nil { - return fmt.Errorf("unable to encode user#d9250b34: field type is nil") + return fmt.Errorf("unable to encode user#5cdc7c44: field type is nil") } if err := u.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#d9250b34: field type: %w", err) + return fmt.Errorf("unable to encode user#5cdc7c44: field type: %w", err) } b.Comma() b.FieldStart("language_code") @@ -572,127 +592,133 @@ func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *User) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode user#d9250b34 to nil") + return fmt.Errorf("can't decode user#5cdc7c44 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("user"); err != nil { - return fmt.Errorf("unable to decode user#d9250b34: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: %w", err) } case "id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field id: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field id: %w", err) } u.ID = value case "first_name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field first_name: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field first_name: %w", err) } u.FirstName = value case "last_name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field last_name: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field last_name: %w", err) } u.LastName = value case "usernames": if err := u.Usernames.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field usernames: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field usernames: %w", err) } case "phone_number": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field phone_number: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field phone_number: %w", err) } u.PhoneNumber = value case "status": value, err := DecodeTDLibJSONUserStatus(b) if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field status: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field status: %w", err) } u.Status = value case "profile_photo": if err := u.ProfilePhoto.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field profile_photo: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field profile_photo: %w", err) } case "emoji_status": if err := u.EmojiStatus.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field emoji_status: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field emoji_status: %w", err) } case "is_contact": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field is_contact: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field is_contact: %w", err) } u.IsContact = value case "is_mutual_contact": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field is_mutual_contact: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field is_mutual_contact: %w", err) } u.IsMutualContact = value case "is_verified": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field is_verified: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field is_verified: %w", err) } u.IsVerified = value case "is_premium": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field is_premium: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field is_premium: %w", err) } u.IsPremium = value case "is_support": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field is_support: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field is_support: %w", err) } u.IsSupport = value + case "has_anonymous_phone_number": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode user#5cdc7c44: field has_anonymous_phone_number: %w", err) + } + u.HasAnonymousPhoneNumber = value case "restriction_reason": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field restriction_reason: %w", err) } u.RestrictionReason = value case "is_scam": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field is_scam: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field is_scam: %w", err) } u.IsScam = value case "is_fake": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field is_fake: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field is_fake: %w", err) } u.IsFake = value case "have_access": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field have_access: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field have_access: %w", err) } u.HaveAccess = value case "type": value, err := DecodeTDLibJSONUserType(b) if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field type: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field type: %w", err) } u.Type = value case "language_code": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field language_code: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field language_code: %w", err) } u.LanguageCode = value case "added_to_attachment_menu": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#d9250b34: field added_to_attachment_menu: %w", err) + return fmt.Errorf("unable to decode user#5cdc7c44: field added_to_attachment_menu: %w", err) } u.AddedToAttachmentMenu = value default: @@ -806,6 +832,14 @@ func (u *User) GetIsSupport() (value bool) { return u.IsSupport } +// GetHasAnonymousPhoneNumber returns value of HasAnonymousPhoneNumber field. +func (u *User) GetHasAnonymousPhoneNumber() (value bool) { + if u == nil { + return + } + return u.HasAnonymousPhoneNumber +} + // GetRestrictionReason returns value of RestrictionReason field. func (u *User) GetRestrictionReason() (value string) { if u == nil { diff --git a/tdapi/tl_user_link_gen.go b/tdapi/tl_user_link_gen.go new file mode 100644 index 0000000000..97ae64fed6 --- /dev/null +++ b/tdapi/tl_user_link_gen.go @@ -0,0 +1,228 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +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{} +) + +// UserLink represents TL type `userLink#1db0fef8`. +type UserLink struct { + // The URL + URL string + // Left time for which the link is valid, in seconds; 0 if the link is a public username + // link + ExpiresIn int32 +} + +// UserLinkTypeID is TL type id of UserLink. +const UserLinkTypeID = 0x1db0fef8 + +// Ensuring interfaces in compile-time for UserLink. +var ( + _ bin.Encoder = &UserLink{} + _ bin.Decoder = &UserLink{} + _ bin.BareEncoder = &UserLink{} + _ bin.BareDecoder = &UserLink{} +) + +func (u *UserLink) Zero() bool { + if u == nil { + return true + } + if !(u.URL == "") { + return false + } + if !(u.ExpiresIn == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UserLink) String() string { + if u == nil { + return "UserLink(nil)" + } + type Alias UserLink + return fmt.Sprintf("UserLink%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UserLink) TypeID() uint32 { + return UserLinkTypeID +} + +// TypeName returns name of type in TL schema. +func (*UserLink) TypeName() string { + return "userLink" +} + +// TypeInfo returns info about TL type. +func (u *UserLink) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "userLink", + ID: UserLinkTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "URL", + SchemaName: "url", + }, + { + Name: "ExpiresIn", + SchemaName: "expires_in", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UserLink) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode userLink#1db0fef8 as nil") + } + b.PutID(UserLinkTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UserLink) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode userLink#1db0fef8 as nil") + } + b.PutString(u.URL) + b.PutInt32(u.ExpiresIn) + return nil +} + +// Decode implements bin.Decoder. +func (u *UserLink) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode userLink#1db0fef8 to nil") + } + if err := b.ConsumeID(UserLinkTypeID); err != nil { + return fmt.Errorf("unable to decode userLink#1db0fef8: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UserLink) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode userLink#1db0fef8 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode userLink#1db0fef8: field url: %w", err) + } + u.URL = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode userLink#1db0fef8: field expires_in: %w", err) + } + u.ExpiresIn = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UserLink) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode userLink#1db0fef8 as nil") + } + b.ObjStart() + b.PutID("userLink") + b.Comma() + b.FieldStart("url") + b.PutString(u.URL) + b.Comma() + b.FieldStart("expires_in") + b.PutInt32(u.ExpiresIn) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UserLink) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode userLink#1db0fef8 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("userLink"); err != nil { + return fmt.Errorf("unable to decode userLink#1db0fef8: %w", err) + } + case "url": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode userLink#1db0fef8: field url: %w", err) + } + u.URL = value + case "expires_in": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode userLink#1db0fef8: field expires_in: %w", err) + } + u.ExpiresIn = value + default: + return b.Skip() + } + return nil + }) +} + +// GetURL returns value of URL field. +func (u *UserLink) GetURL() (value string) { + if u == nil { + return + } + return u.URL +} + +// GetExpiresIn returns value of ExpiresIn field. +func (u *UserLink) GetExpiresIn() (value int32) { + if u == nil { + return + } + return u.ExpiresIn +}