From ca6f44058783e69c91adac602a4e36da29b77f31 Mon Sep 17 00:00:00 2001 From: GitHub Date: Fri, 16 Feb 2024 07:44:13 +0000 Subject: [PATCH] feat(schema): update TDLib to the latest layer --- _schema/tdapi.tl | 351 +++++---- tdapi/tl_accent_color_gen.go | 76 +- tdapi/tl_available_reactions_gen.go | 3 +- tdapi/tl_chat_administrator_rights_gen.go | 15 +- tdapi/tl_chat_boost_features_gen.go | 124 +++- tdapi/tl_chat_boost_level_features_gen.go | 133 +++- tdapi/tl_chat_event_action_gen.go | 215 ++++++ tdapi/tl_chat_gen.go | 2 +- tdapi/tl_create_video_chat_gen.go | 2 +- ...delete_saved_messages_topic_history_gen.go | 72 +- ...ved_messages_topic_messages_by_date_gen.go | 76 +- tdapi/tl_draft_message_gen.go | 3 +- tdapi/tl_forward_messages_gen.go | 2 +- tdapi/tl_found_saved_messages_topic_gen.go | 237 ------ tdapi/tl_found_saved_messages_topics_gen.go | 289 -------- tdapi/tl_get_chat_boost_features_gen.go | 66 +- tdapi/tl_get_chat_boost_level_features_gen.go | 66 +- tdapi/tl_get_chat_boost_status_gen.go | 2 +- tdapi/tl_get_chat_message_calendar_gen.go | 90 ++- tdapi/tl_get_chat_message_count_gen.go | 90 ++- tdapi/tl_get_chat_message_position_gen.go | 94 ++- ...l_get_chat_sparse_message_positions_gen.go | 94 ++- ...et_message_import_confirmation_text_gen.go | 2 +- ...tl_get_pinned_saved_messages_topics_gen.go | 169 ----- ...t_premium_gift_code_payment_options_gen.go | 4 +- tdapi/tl_get_saved_messages_tags_gen.go | 66 +- ...tl_get_saved_messages_topic_history_gen.go | 80 +-- ...aved_messages_topic_message_by_date_gen.go | 72 +- tdapi/tl_get_saved_messages_topics_gen.go | 238 ------ tdapi/tl_import_messages_gen.go | 2 +- tdapi/tl_input_message_content_gen.go | 14 +- tdapi/tl_input_message_reply_to_gen.go | 2 +- tdapi/tl_load_saved_messages_topics_gen.go | 208 ++++++ tdapi/tl_message_content_gen.go | 181 +++++ tdapi/tl_message_gen.go | 344 +++++---- tdapi/tl_message_reactions_gen.go | 3 +- tdapi/tl_open_web_app_gen.go | 2 +- tdapi/tl_premium_feature_gen.go | 438 ++++++++++++ tdapi/tl_premium_giveaway_parameters_gen.go | 10 +- tdapi/tl_premium_story_feature_gen.go | 146 ++++ tdapi/tl_profile_accent_color_gen.go | 106 ++- tdapi/tl_register_user_gen.go | 65 +- tdapi/tl_registry_gen.go | 136 ++-- tdapi/tl_saved_messages_tag_gen.go | 3 +- tdapi/tl_saved_messages_topic_gen.go | 676 ++++++------------ tdapi/tl_saved_messages_topic_type_gen.go | 612 ++++++++++++++++ tdapi/tl_search_chat_messages_gen.go | 118 ++- tdapi/tl_search_saved_messages_gen.go | 85 ++- tdapi/tl_send_chat_action_gen.go | 2 +- ...tl_send_inline_query_result_message_gen.go | 2 +- tdapi/tl_send_message_album_gen.go | 2 +- tdapi/tl_send_message_gen.go | 2 +- tdapi/tl_send_story_gen.go | 3 +- tdapi/tl_set_chat_accent_color_gen.go | 2 +- tdapi/tl_set_chat_available_reactions_gen.go | 4 +- tdapi/tl_set_chat_description_gen.go | 2 +- tdapi/tl_set_chat_discussion_group_gen.go | 4 +- tdapi/tl_set_chat_draft_message_gen.go | 5 +- tdapi/tl_set_chat_profile_accent_color_gen.go | 3 +- ...tl_set_pinned_saved_messages_topics_gen.go | 84 +-- tdapi/tl_set_story_privacy_settings_gen.go | 72 +- ...supergroup_custom_emoji_sticker_set_gen.go | 238 ++++++ ...t_supergroup_unrestrict_boost_count_gen.go | 238 ++++++ tdapi/tl_store_payment_purpose_gen.go | 5 +- tdapi/tl_story_gen.go | 201 ++++-- tdapi/tl_supergroup_full_info_gen.go | 249 +++++-- tdapi/tl_supergroup_gen.go | 6 +- tdapi/tl_telegram_payment_purpose_gen.go | 5 +- ...ggle_saved_messages_topic_is_pinned_gen.go | 72 +- tdapi/tl_update_gen.go | 389 ++++++++-- 70 files changed, 4646 insertions(+), 2828 deletions(-) delete mode 100644 tdapi/tl_found_saved_messages_topic_gen.go delete mode 100644 tdapi/tl_found_saved_messages_topics_gen.go delete mode 100644 tdapi/tl_get_pinned_saved_messages_topics_gen.go delete mode 100644 tdapi/tl_get_saved_messages_topics_gen.go create mode 100644 tdapi/tl_load_saved_messages_topics_gen.go create mode 100644 tdapi/tl_saved_messages_topic_type_gen.go create mode 100644 tdapi/tl_set_supergroup_custom_emoji_sticker_set_gen.go create mode 100644 tdapi/tl_set_supergroup_unrestrict_boost_count_gen.go diff --git a/_schema/tdapi.tl b/_schema/tdapi.tl index 85596ef719..e0a5c389db 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: 7bf72b42815b06b577251b130dfb61c7b151732762affd5efaa76c9c4f0712d3 +// SHA256: 42f55ed5d40f0429913c9485aa57b5b7db6c703772ef4e7832de930882d2e14b double#2210c154 ? = Double; @@ -659,7 +659,7 @@ inputChatPhotoSticker#4e6e735d sticker:chatPhotoSticker = InputChatPhoto; chatPermissions#94d147b6 can_send_basic_messages:Bool can_send_audios:Bool can_send_documents:Bool can_send_photos:Bool can_send_videos:Bool can_send_video_notes:Bool can_send_voice_notes:Bool can_send_polls:Bool can_send_other_messages:Bool can_add_web_page_previews:Bool can_change_info:Bool can_invite_users:Bool can_pin_messages:Bool can_create_topics:Bool = ChatPermissions; //@description Describes rights of the administrator -//@can_manage_chat True, if the administrator can get chat event log, get chat boosts in channels, get channel members, report supergroup spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only +//@can_manage_chat True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only //@can_change_info True, if the administrator can change the chat title, photo, and other settings //@can_post_messages True, if the administrator can create channel posts or view channel statistics; applicable to channels only //@can_edit_messages True, if the administrator can edit messages of other users and pin messages; applicable to channels only @@ -670,9 +670,9 @@ chatPermissions#94d147b6 can_send_basic_messages:Bool can_send_audios:Bool can_s //@can_manage_topics True, if the administrator can create, rename, close, reopen, hide, and unhide forum topics; applicable to forum supergroups only //@can_promote_members True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that were directly or indirectly promoted by them //@can_manage_video_chats True, if the administrator can manage video chats -//@can_post_stories True, if the administrator can create new channel stories, or edit and delete posted stories; applicable to channels only -//@can_edit_stories True, if the administrator can edit stories posted by other users, pin stories and access story archive; applicable to channels only -//@can_delete_stories True, if the administrator can delete stories posted by other users; applicable to channels only +//@can_post_stories True, if the administrator can create new chat stories, or edit and delete posted stories; applicable to supergroups and channels only +//@can_edit_stories True, if the administrator can edit stories posted by other users, pin stories and access story archive; applicable to supergroups and channels only +//@can_delete_stories True, if the administrator can delete stories posted by other users; applicable to supergroups and channels only //@is_anonymous True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only chatAdministratorRights#5f4f9044 can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool is_anonymous:Bool = ChatAdministratorRights; @@ -757,8 +757,8 @@ premiumGiveawayInfoCompleted#fc8b501b creation_date:int32 actual_winners_selecti //@built_in_accent_color_id Identifier of a built-in color to use in places, where only one color is needed; 0-6 //@light_theme_colors The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in light themes //@dark_theme_colors The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in dark themes -//@min_chat_boost_level The minimum chat boost level required to use the color -accentColor#ed4c76c9 id:int32 built_in_accent_color_id:int32 light_theme_colors:vector dark_theme_colors:vector min_chat_boost_level:int32 = AccentColor; +//@min_channel_chat_boost_level The minimum chat boost level required to use the color in a channel chat +accentColor#53312690 id:int32 built_in_accent_color_id:int32 light_theme_colors:vector dark_theme_colors:vector min_channel_chat_boost_level:int32 = AccentColor; //@description Contains information about supported accent colors for user profile photo background in RGB format //@palette_colors The list of 1-2 colors in RGB format, describing the colors, as expected to be shown in the color palette settings @@ -770,8 +770,9 @@ profileAccentColors#218e9367 palette_colors:vector background_colors:vect //@id Profile accent color identifier //@light_theme_colors Accent colors expected to be used in light themes //@dark_theme_colors Accent colors expected to be used in dark themes -//@min_chat_boost_level The minimum chat boost level required to use the color -profileAccentColor#87d7df12 id:int32 light_theme_colors:profileAccentColors dark_theme_colors:profileAccentColors min_chat_boost_level:int32 = ProfileAccentColor; +//@min_supergroup_chat_boost_level The minimum chat boost level required to use the color in a supergroup chat +//@min_channel_chat_boost_level The minimum chat boost level required to use the color in a channel chat +profileAccentColor#213d8295 id:int32 light_theme_colors:profileAccentColors dark_theme_colors:profileAccentColors min_supergroup_chat_boost_level:int32 min_channel_chat_boost_level:int32 = ProfileAccentColor; //@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 @@ -1091,8 +1092,8 @@ basicGroupFullInfo#d62e521e photo:chatPhoto description:string creator_user_id:i //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted //@is_scam True, if many users reported this supergroup or channel as a scam //@is_fake True, if many users reported this supergroup or channel as a fake account -//@has_active_stories True, if the channel has non-expired stories available to the current user -//@has_unread_active_stories True, if the channel has unread non-expired stories available to the current user +//@has_active_stories True, if the supergroup or channel has non-expired stories available to the current user +//@has_unread_active_stories True, if the supergroup or channel has unread non-expired stories available to the current user supergroup#39a14289 id:int53 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_verified:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; //@description Contains full information about a supergroup or channel @@ -1114,14 +1115,17 @@ supergroup#39a14289 id:int53 usernames:usernames date:int32 status:ChatMemberSta //@can_toggle_aggressive_anti_spam True, if aggressive anti-spam checks can be enabled or disabled in the supergroup //@is_all_history_available True, if new chat members will have access to old messages. In public, discussion, of forum groups and all channels, old messages are always available, //@has_aggressive_anti_spam_enabled True, if aggressive anti-spam checks are enabled in the supergroup. The value of this field is only available to chat administrators -//@has_pinned_stories True, if the channel has pinned stories -//@sticker_set_id Identifier of the supergroup sticker set; 0 if none +//@has_pinned_stories True, if the supergroup or channel has pinned stories +//@my_boost_count Number of times the current user boosted the supergroup or channel +//@unrestrict_boost_count Number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; 0 if unspecified +//@sticker_set_id Identifier of the supergroup sticker set that must be shown before user sticker sets; 0 if none +//@custom_emoji_sticker_set_id Identifier of the custom emoji sticker set that can be used in the supergroup without Telegram Premium subscription; 0 if none //@location Location to which the supergroup is connected; may be null if none //@invite_link Primary invite link for the chat; may be null. For chat administrators with can_invite_users right only //@bot_commands List of commands of bots in the group //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo#f2f19203 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 has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool has_aggressive_anti_spam_enabled:Bool has_pinned_stories: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; +supergroupFullInfo#3459badb 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 has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool has_aggressive_anti_spam_enabled:Bool has_pinned_stories:Bool my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_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 @@ -1264,7 +1268,7 @@ messageReaction#7d9e9864 type:ReactionType total_count:int32 is_chosen:Bool used //@description Contains a list of reactions added to a message //@reactions List of added reactions -//@are_tags True, if the reactions are tags and Telegram Premium users can filter messages by them; currently, always false +//@are_tags True, if the reactions are tags and Telegram Premium users can filter messages by them messageReactions#91986cd8 reactions:vector are_tags:Bool = MessageReactions; //@description Contains information about interactions with a message @@ -1331,7 +1335,7 @@ messageReplyToStory#708ca939 story_sender_chat_id:int53 story_id:int32 = Message inputMessageReplyToMessage#11e3fd76 chat_id:int53 message_id:int53 quote:inputTextQuote = InputMessageReplyTo; //@description Describes a story to be replied -//@story_sender_chat_id The identifier of the sender of the story. Currently, stories can be replied only in the sender's chat +//@story_sender_chat_id The identifier of the sender of the story. Currently, stories can be replied only in the sender's chat and channel stories can't be replied //@story_id The identifier of the story inputMessageReplyToStory#51aece78 story_sender_chat_id:int53 story_id:int32 = InputMessageReplyTo; @@ -1368,17 +1372,18 @@ inputMessageReplyToStory#51aece78 story_sender_chat_id:int53 story_id:int32 = In //@unread_reactions Information about unread reactions added to the message //@reply_to Information about the message or the story this message is replying to; may be null if none //@message_thread_id If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs -//@saved_messages_topic Information about topic of the message in the Saved Messages chat; may be null for messages not from Saved Messages +//@saved_messages_topic_id Identifier of the Saved Messages topic for the message; 0 for messages not from Saved Messages //@self_destruct_type The message's self-destruct type; may be null if none //@self_destruct_in Time left before the message self-destruct timer expires, in seconds; 0 if self-destruction isn't scheduled yet //@auto_delete_in Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never //@via_bot_user_id If non-zero, the user identifier of the bot through which this message was sent +//@sender_boost_count Number of times the sender of the message boosted the supergroup at the time the message was sent; 0 if none or unknown. For messages sent by the current user, supergroupFullInfo.my_boost_count must be used instead //@author_signature For channel posts and anonymous group messages, optional author signature //@media_album_id Unique identifier of an album this message belongs to. Only audios, documents, photos and videos can be grouped together in albums //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message#9a056371 id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic:SavedMessagesTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message#34e12c0 id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_boost_count:int32 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages //@total_count Approximate total number of messages found @@ -1562,7 +1567,7 @@ scopeNotificationSettings#dc4a615f mute_for:int32 sound_id:int64 show_preview:Bo //@description Contains information about a message draft //@reply_to Information about the message to be replied; must be of the type inputMessageReplyToMessage; may be null if none //@date Point in time (Unix timestamp) when the draft was created -//@input_message_text Content of the message draft; must be of the type inputMessageText +//@input_message_text Content of the message draft; must be of the type inputMessageText, inputMessageVideoNote, or inputMessageVoiceNote draftMessage#f67c6a5c reply_to:InputMessageReplyTo date:int32 input_message_text:InputMessageContent = DraftMessage; //@class ChatType @description Describes the type of a chat @@ -1687,9 +1692,9 @@ chatAvailableReactionsAll#dff07c4e = ChatAvailableReactions; //@reactions The list of reactions chatAvailableReactionsSome#d3cc0a6b reactions:vector = ChatAvailableReactions; -//@description Represents a tag used in Saved Messages +//@description Represents a tag used in Saved Messages or a Saved Messages topic //@tag The tag -//@label Label of the tag; 0-12 characters +//@label Label of the tag; 0-12 characters. Always empty if the tag is returned for a Saved Messages topic //@count Number of times the tag was used; may be 0 if the tag has non-empty label savedMessagesTag#6a67bc61 tag:ReactionType label:string count:int32 = SavedMessagesTag; @@ -1720,7 +1725,7 @@ videoChat#ae158d28 group_call_id:int32 has_participants:Bool default_participant //@has_protected_content True, if chat content can't be saved locally, forwarded, or copied //@is_translatable True, if translation of all messages in the chat must be suggested to the user //@is_marked_as_unread True, if the chat is marked as unread -//@view_as_topics True, if the chat is a forum supergroup that must be shown in the "View as topics" mode +//@view_as_topics True, if the chat is a forum supergroup that must be shown in the "View as topics" mode, or Saved Messages chat that must be shown in the "View as chats" //@has_scheduled_messages True, if the chat has scheduled messages //@can_be_deleted_only_for_self True, if the chat messages can be deleted only for the current user while other users will continue to see the messages //@can_be_deleted_for_all_users True, if the chat messages can be deleted for all users @@ -1946,28 +1951,26 @@ webAppInfo#2efdb2e8 launch_id:int64 url:string = WebAppInfo; //@draft_message A draft of a message in the message thread; may be null if none messageThreadInfo#683fd5ad chat_id:int53 message_thread_id:int53 reply_info:messageReplyInfo unread_message_count:int32 messages:vector draft_message:draftMessage = MessageThreadInfo; -//@class SavedMessagesTopic @description Contains information about a Saved Messages topic +//@class SavedMessagesTopicType @description Describes type of a Saved Messages topic //@description Topic containing messages sent by the current user of forwarded from an unknown chat -savedMessagesTopicMyNotes#9dd7231d = SavedMessagesTopic; +savedMessagesTopicTypeMyNotes#b38a41f5 = SavedMessagesTopicType; //@description Topic containing messages forwarded from a user with hidden privacy -savedMessagesTopicAuthorHidden#6e75aff7 = SavedMessagesTopic; +savedMessagesTopicTypeAuthorHidden#703c4195 = SavedMessagesTopicType; //@description Topic containing messages forwarded from a specific chat //@chat_id Identifier of the chat -savedMessagesTopicSavedFromChat#16543670 chat_id:int53 = SavedMessagesTopic; +savedMessagesTopicTypeSavedFromChat#993fad58 chat_id:int53 = SavedMessagesTopicType; -//@description Contains information about a found Saved Messages topic -//@topic The topic +//@description Contains information about a Saved Messages topic +//@id Unique topic identifier +//@type Type of the topic +//@is_pinned True, if the topic is pinned +//@order A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order //@last_message Last message in the topic; may be null if none or unknown -foundSavedMessagesTopic#240681ec topic:SavedMessagesTopic last_message:message = FoundSavedMessagesTopic; - -//@description Contains a list of Saved Messages topics -//@total_count Total number of Saved Messages topics found -//@topics List of Saved Messages topics -//@next_offset The offset for the next request. If empty, then there are no more results -foundSavedMessagesTopics#60f30fbf total_count:int32 topics:vector next_offset:string = FoundSavedMessagesTopics; +//@draft_message A draft of a message in the topic; may be null if none +savedMessagesTopic#d2a8e1a4 id:int53 type:SavedMessagesTopicType is_pinned:Bool order:int64 last_message:message draft_message:draftMessage = SavedMessagesTopic; //@description Describes a forum topic icon //@color Color of the topic icon in RGB format @@ -2557,8 +2560,8 @@ messageExtendedMediaVideo#11acbf3b video:video caption:formattedText = MessageEx messageExtendedMediaUnsupported#141f5020 caption:formattedText = MessageExtendedMedia; //@description Describes parameters of a Telegram Premium giveaway -//@boosted_chat_id Identifier of the channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Premium subscription -//@additional_chat_ids Identifiers of other channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats +//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Premium subscription. +//@additional_chat_ids Identifiers of other supergroup or channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats //@winners_selection_date Point in time (Unix timestamp) when the giveaway is expected to be performed; must be 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways //@only_new_members True, if only new members of the chats will be eligible for the giveaway //@has_public_winners True, if the list of winners of the giveaway will be available to everyone @@ -3107,6 +3110,10 @@ messageChatSetTheme#99ae9408 theme_name:string = MessageContent; //@from_user_id If not 0, a user identifier, which default setting was automatically applied messageChatSetMessageAutoDeleteTime#619e052e message_auto_delete_time:int32 from_user_id:int53 = MessageContent; +//@description The chat was boosted by the sender of the message +//@boost_count Number of times the chat was boosted +messageChatBoost#5e5f658b boost_count:int32 = MessageContent; + //@description A forum topic has been created //@name Name of the topic //@icon Icon of the topic @@ -3373,7 +3380,7 @@ messageCopyOptions#48076039 send_copy:Bool replace_caption:Bool new_caption:form //@description A text message //@text Formatted text to be sent; 0-getOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually -//@link_preview_options Options to be used for generation of a link preview; pass null to use default link preview options +//@link_preview_options Options to be used for generation of a link preview; may be null if none; pass null to use default link preview options //@clear_draft True, if a chat message draft must be deleted inputMessageText#f350d894 text:formattedText link_preview_options:linkPreviewOptions clear_draft:Bool = InputMessageContent; @@ -3438,18 +3445,18 @@ inputMessageVideo#f17014da video:InputFile thumbnail:inputThumbnail added_sticke //@description A video note message //@video_note Video note to be sent -//@thumbnail Video thumbnail; pass null to skip thumbnail uploading +//@thumbnail Video thumbnail; may be null if empty; pass null to skip thumbnail uploading //@duration Duration of the video, in seconds //@length Video width and height; must be positive and not greater than 640 -//@self_destruct_type Video note self-destruct type; pass null if none; private chats only +//@self_destruct_type Video note self-destruct type; may be null if none; pass null if none; private chats only inputMessageVideoNote#d56816dd video_note:InputFile thumbnail:inputThumbnail duration:int32 length:int32 self_destruct_type:MessageSelfDestructType = InputMessageContent; //@description A voice note message //@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 -//@self_destruct_type Voice note self-destruct type; pass null if none; private chats only +//@caption Voice note caption; may be null if empty; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters +//@self_destruct_type Voice note self-destruct type; may be null if none; pass null if none; private chats only inputMessageVoiceNote#5723ffac voice_note:InputFile duration:int32 waveform:bytes caption:formattedText self_destruct_type:MessageSelfDestructType = InputMessageContent; //@description A message with a location @@ -3875,6 +3882,7 @@ storyInteractionInfo#e1557fc7 view_count:int32 forward_count:int32 reaction_coun //@description Represents a story //@id Unique story identifier among stories of the given sender //@sender_chat_id Identifier of the chat that posted the story +//@sender_id Identifier of the sender of the story; may be null if the story is posted on behalf of the sender_chat_id //@date Point in time (Unix timestamp) when the story was published //@is_being_sent True, if the story is being sent by the current user //@is_being_edited True, if the story is being edited by the current user @@ -3896,7 +3904,7 @@ storyInteractionInfo#e1557fc7 view_count:int32 forward_count:int32 reaction_coun //@content Content of the story //@areas Clickable areas to be shown on the story content //@caption Caption of the story -story#8e358ca2 id:int32 sender_chat_id:int53 date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_pinned:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; +story#27f4e5b1 id:int32 sender_chat_id:int53 sender_id:MessageSender date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_pinned:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; //@description Represents a list of stories //@total_count Approximate total number of stories found @@ -3979,16 +3987,20 @@ publicForwards#3ed29447 total_count:int32 forwards:vector next_of //@can_set_emoji_status True, if emoji status can be set //@chat_theme_background_count Number of chat theme backgrounds that can be set as chat background //@can_set_custom_background True, if custom background can be set in the chat for all users -chatBoostLevelFeatures#fe9f29de level:int32 story_per_day_count:int32 custom_emoji_reaction_count:int32 title_color_count:int32 profile_accent_color_count:int32 can_set_profile_background_custom_emoji:Bool accent_color_count:int32 can_set_background_custom_emoji:Bool can_set_emoji_status:Bool chat_theme_background_count:int32 can_set_custom_background:Bool = ChatBoostLevelFeatures; +//@can_set_custom_emoji_sticker_set True, if custom emoji sticker set can be set for the chat +//@can_recognize_speech True, if speech recognition can be used for video note and voice note messages by all users +chatBoostLevelFeatures#d248546f level:int32 story_per_day_count:int32 custom_emoji_reaction_count:int32 title_color_count:int32 profile_accent_color_count:int32 can_set_profile_background_custom_emoji:Bool accent_color_count:int32 can_set_background_custom_emoji:Bool can_set_emoji_status:Bool chat_theme_background_count:int32 can_set_custom_background:Bool can_set_custom_emoji_sticker_set:Bool can_recognize_speech:Bool = ChatBoostLevelFeatures; //@description Contains a list of features available on the first chat boost levels //@features The list of features //@min_profile_background_custom_emoji_boost_level The minimum boost level required to set custom emoji for profile background -//@min_background_custom_emoji_boost_level The minimum boost level required to set custom emoji for reply header and link preview background +//@min_background_custom_emoji_boost_level The minimum boost level required to set custom emoji for reply header and link preview background; for channel chats only //@min_emoji_status_boost_level The minimum boost level required to set emoji status //@min_chat_theme_background_boost_level The minimum boost level required to set a chat theme background as chat background //@min_custom_background_boost_level The minimum boost level required to set custom chat background -chatBoostFeatures#4dd864af features:vector min_profile_background_custom_emoji_boost_level:int32 min_background_custom_emoji_boost_level:int32 min_emoji_status_boost_level:int32 min_chat_theme_background_boost_level:int32 min_custom_background_boost_level:int32 = ChatBoostFeatures; +//@min_custom_emoji_sticker_set_boost_level The minimum boost level required to set custom emoji sticker set for the chat; for supergroup chats only +//@min_speech_recognition_boost_level The minimum boost level allowing to recognize speech in video note and voice note messages for non-Premium users; for supergroup chats only +chatBoostFeatures#1921fd49 features:vector min_profile_background_custom_emoji_boost_level:int32 min_background_custom_emoji_boost_level:int32 min_emoji_status_boost_level:int32 min_chat_theme_background_boost_level:int32 min_custom_background_boost_level:int32 min_custom_emoji_sticker_set_boost_level:int32 min_speech_recognition_boost_level:int32 = ChatBoostFeatures; //@class ChatBoostSource @description Describes source of a chat boost @@ -4308,7 +4320,7 @@ availableReaction#f9024387 type:ReactionType needs_premium:Bool = AvailableReact //@recent_reactions List of recently used reactions //@popular_reactions List of popular reactions //@allow_custom_emoji True, if any custom emoji reaction can be added by Telegram Premium subscribers -//@are_tags True, if the reactions will be tags and the message can be found by them; currently, always false +//@are_tags True, if the reactions will be tags and the message can be found by them //@unavailability_reason The reason why the current user can't add reactions to the message, despite some other users can; may be null if none availableReactions#3596f453 top_reactions:vector recent_reactions:vector popular_reactions:vector allow_custom_emoji:Bool are_tags:Bool unavailability_reason:ReactionUnavailabilityReason = AvailableReactions; @@ -4812,6 +4824,11 @@ chatEventSlowModeDelayChanged#9d763c0b old_slow_mode_delay:int32 new_slow_mode_d //@new_sticker_set_id New identifier of the chat sticker set; 0 if none chatEventStickerSetChanged#b5e7558f old_sticker_set_id:int64 new_sticker_set_id:int64 = ChatEventAction; +//@description The supergroup sticker set with allowed custom emoji was changed +//@old_sticker_set_id Previous identifier of the chat sticker set; 0 if none +//@new_sticker_set_id New identifier of the chat sticker set; 0 if none +chatEventCustomEmojiStickerSetChanged#70c431b old_sticker_set_id:int64 new_sticker_set_id:int64 = ChatEventAction; + //@description The chat title was changed //@old_title Previous chat title //@new_title New chat title @@ -5118,9 +5135,18 @@ premiumFeatureAccentColor#361ac59e = PremiumFeature; //@description The ability to set private chat background for both users premiumFeatureBackgroundForBoth#2246eefa = PremiumFeature; +//@description The ability to use tags in Saved Messages +premiumFeatureSavedMessagesTags#3bcbe986 = PremiumFeature; + +//@description The ability to disallow incoming voice and video note messages in private chats using setUserPrivacySettingRules with userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages +premiumFeatureMessagePrivacy#2fd278f6 = PremiumFeature; + +//@description The ability to view last seen and read times of other users even they can't view last seen or read time for the current user +premiumFeatureLastSeenTimes#d2914a8f = PremiumFeature; + //@class PremiumStoryFeature @description Describes a story feature available to Premium users -//@description User stories are displayed before stories of non-premium contacts and channels +//@description Stories of the current user are displayed before stories of non-Premium contacts, supergroups, and channels premiumStoryFeaturePriorityOrder#8ff172c7 = PremiumStoryFeature; //@description The ability to hide the fact that the user viewed other's stories @@ -5138,6 +5164,9 @@ premiumStoryFeatureSaveStories#a6842fbd = PremiumStoryFeature; //@description The ability to use links and formatting in story caption premiumStoryFeatureLinksAndFormatting#dae383f7 = PremiumStoryFeature; +//@description The ability to choose better quality for viewed stories +premiumStoryFeatureVideoQuality#baafbea9 = PremiumStoryFeature; + //@description Contains information about a limit, increased for Premium users //@type The type of the limit //@default_value Default value of the limit @@ -5196,13 +5225,13 @@ storePaymentPurposePremiumSubscription#4b558114 is_restore:Bool is_upgrade:Bool storePaymentPurposeGiftedPremium#7240c0d1 user_id:int53 currency:string amount:int53 = StorePaymentPurpose; //@description The user creating Telegram Premium gift codes for other users -//@boosted_chat_id Identifier of the channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none +//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none //@currency ISO 4217 currency code of the payment currency //@amount Paid amount, in the smallest units of the currency //@user_ids Identifiers of the users which can activate the gift codes storePaymentPurposePremiumGiftCodes#9e11cf42 boosted_chat_id:int53 currency:string amount:int53 user_ids:vector = StorePaymentPurpose; -//@description The user creating a Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels +//@description The user creating a Telegram Premium giveaway //@parameters Giveaway parameters //@currency ISO 4217 currency code of the payment currency //@amount Paid amount, in the smallest units of the currency @@ -5211,14 +5240,14 @@ storePaymentPurposePremiumGiveaway#504790d9 parameters:premiumGiveawayParameters //@class TelegramPaymentPurpose @description Describes a purpose of a payment toward Telegram //@description The user creating Telegram Premium gift codes for other users -//@boosted_chat_id Identifier of the channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none +//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none //@currency ISO 4217 currency code of the payment currency //@amount Paid amount, in the smallest units of the currency //@user_ids Identifiers of the users which can activate the gift codes //@month_count Number of months the Telegram Premium subscription will be active for the users telegramPaymentPurposePremiumGiftCodes#91009cc boosted_chat_id:int53 currency:string amount:int53 user_ids:vector month_count:int32 = TelegramPaymentPurpose; -//@description The user creating a Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels +//@description The user creating a Telegram Premium giveaway //@parameters Giveaway parameters //@currency ISO 4217 currency code of the payment currency //@amount Paid amount, in the smallest units of the currency @@ -5365,7 +5394,7 @@ canSendStoryResultOk#503cf0fd = CanSendStoryResult; //@description The user must subscribe to Telegram Premium to be able to post stories canSendStoryResultPremiumNeeded#567fde69 = CanSendStoryResult; -//@description The channel chat must be boosted first by Telegram Premium subscribers to post more stories. Call getChatBoostStatus to get current boost status of the chat +//@description The chat must be boosted first by Telegram Premium subscribers to post more stories. Call getChatBoostStatus to get current boost status of the chat canSendStoryResultBoostNeeded#9e60e92f = CanSendStoryResult; //@description The limit for the number of active stories exceeded. The user can buy Telegram Premium, delete an active story, or wait for the oldest story to expire @@ -5807,7 +5836,7 @@ userPrivacySettingAllowPeerToPeerCalls#1502b940 = UserPrivacySetting; //@description A privacy setting for managing whether the user can be found by their phone number. Checked only if the phone number is not known to the other user. Can be set only to "Allow contacts" or "Allow all" userPrivacySettingAllowFindingByPhoneNumber#91ee6d51 = UserPrivacySetting; -//@description A privacy setting for managing whether the user can receive voice and video messages in private chats +//@description A privacy setting for managing whether the user can receive voice and video messages in private chats; for Telegram Premium users only userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c = UserPrivacySetting; //@description Contains privacy settings for message read date in private chats. Read dates are always shown to the users that can see online status of the current user regardless of this setting @@ -6861,7 +6890,7 @@ updateChatAvailableReactions#8ab413f9 chat_id:int53 available_reactions:ChatAvai //@description A chat draft has changed. Be aware that the update may come in the currently opened chat but with old content of the draft. If the user has changed the content of the draft, this update mustn't be applied //@chat_id Chat identifier -//@draft_message The new draft message; may be null +//@draft_message The new draft message; may be null if none //@positions The new chat positions in the chat lists updateChatDraftMessage#2bf257d4 chat_id:int53 draft_message:draftMessage positions:vector = Update; @@ -6965,8 +6994,13 @@ updateChatFolders#71a4b3a chat_folders:vector main_chat_list_pos //@online_member_count New number of online members in the chat, or 0 if unknown updateChatOnlineMemberCount#1d0caa9d chat_id:int53 online_member_count:int32 = Update; -//@description The list of pinned Saved Messages topics has changed. The app can call getPinnedSavedMessagesTopics to get the new list -updatePinnedSavedMessagesTopics#2101c3a3 = Update; +//@description Basic information about a Saved Messages topic has changed. This update is guaranteed to come before the topic identifier is returned to the application +//@topic New data about the topic +updateSavedMessagesTopic#9f823b30 topic:savedMessagesTopic = Update; + +//@description Number of Saved Messages topics has changed +//@topic_count Approximate total number of Saved Messages topics +updateSavedMessagesTopicCount#fbd279d1 topic_count:int32 = Update; //@description Basic information about a topic in a forum chat was changed //@chat_id Chat identifier @@ -7012,7 +7046,7 @@ updateDeleteMessages#6a05bf9 chat_id:int53 message_ids:vector is_permanen //@description A message sender activity in the chat has changed //@chat_id Chat identifier -//@message_thread_id If not 0, a message thread identifier in which the action was performed +//@message_thread_id If not 0, the message thread identifier in which the action was performed //@sender_id Identifier of a message sender performing the action //@action The action updateChatAction#9abfd628 chat_id:int53 message_thread_id:int53 sender_id:MessageSender action:ChatAction = Update; @@ -7262,9 +7296,10 @@ updateActiveEmojiReactions#691ffcb7 emojis:vector = Update; //@reaction_type The new type of the default reaction updateDefaultReactionType#4b615105 reaction_type:ReactionType = Update; -//@description Used Saved Messages tags have changed -//@tags The new used tags -updateSavedMessagesTags#dfc2ab29 tags:savedMessagesTags = Update; +//@description Tags used in Saved Messages or a Saved Messages topic have changed +//@saved_messages_topic_id Identifier of Saved Messages topic which tags were changed; 0 if tags for the whole chat has changed +//@tags The new tags +updateSavedMessagesTags#7386424a saved_messages_topic_id:int53 tags:savedMessagesTags = Update; //@description The parameters of speech recognition without Telegram Premium subscription has changed //@max_media_duration The maximum allowed duration of media for speech recognition without Telegram Premium subscription @@ -7522,7 +7557,8 @@ requestQrCodeAuthentication#56fe3c4e other_user_ids:vector = Ok; //@description Finishes user registration. Works only when the current authorization state is authorizationStateWaitRegistration //@first_name The first name of the user; 1-64 characters //@last_name The last name of the user; 0-64 characters -registerUser#f9719e1d first_name:string last_name:string = Ok; +//@disable_notification Pass true to disable notification about the current user joining Telegram for other users that added them to contact list +registerUser#c3aa52ec first_name:string last_name:string disable_notification:Bool = Ok; //@description Resets the login email address. May return an error with a message "TASK_ALREADY_EXISTS" if reset is still pending. resetAuthenticationEmailAddress#e742722c = Ok; @@ -7824,44 +7860,40 @@ getSuitableDiscussionChats#2ec5df6 = Chats; //@description Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives CHANNELS_TOO_MUCH error. Also, the limit can be increased with Telegram Premium getInactiveSupergroupChats#d8cbf9b5 = Chats; -//@description Returns list of all pinned Saved Messages topics -getPinnedSavedMessagesTopics#8555e144 = FoundSavedMessagesTopics; - -//@description Returns list of non-pinned Saved Messages topics from the specified offset -//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of Saved Messages topics to be returned; up to 100 -getSavedMessagesTopics#c5038df6 offset:string limit:int32 = FoundSavedMessagesTopics; +//@description Loads more Saved Messages topics. The loaded topics will be sent through updateSavedMessagesTopic. Topics are sorted by their topic.order in descending order. Returns a 404 error if all topics have been loaded +//@limit The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached +loadSavedMessagesTopics#1146d6b8 limit:int32 = Ok; //@description Returns messages in a Saved Messages topic. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) -//@saved_messages_topic Saved Messages topic which messages will be fetched +//@saved_messages_topic_id Identifier of Saved Messages topic which messages will be fetched //@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message //@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages //@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. -getSavedMessagesTopicHistory#f115a1aa saved_messages_topic:SavedMessagesTopic from_message_id:int53 offset:int32 limit:int32 = Messages; +getSavedMessagesTopicHistory#77e5da68 saved_messages_topic_id:int53 from_message_id:int53 offset:int32 limit:int32 = Messages; //@description Returns the last message sent in a Saved Messages topic no later than the specified date -//@saved_messages_topic Saved Messages topic which message will be returned +//@saved_messages_topic_id Identifier of Saved Messages topic which message will be returned //@date Point in time (Unix timestamp) relative to which to search for messages -getSavedMessagesTopicMessageByDate#78ebcc7f saved_messages_topic:SavedMessagesTopic date:int32 = Message; +getSavedMessagesTopicMessageByDate#c15e4680 saved_messages_topic_id:int53 date:int32 = Message; //@description Deletes all messages in a Saved Messages topic -//@saved_messages_topic Saved Messages topic which messages will be deleted -deleteSavedMessagesTopicHistory#c1dc4e3d saved_messages_topic:SavedMessagesTopic = Ok; +//@saved_messages_topic_id Identifier of Saved Messages topic which messages will be deleted +deleteSavedMessagesTopicHistory#69df3d6a saved_messages_topic_id:int53 = Ok; //@description Deletes all messages between the specified dates in a Saved Messages topic. Messages sent in the last 30 seconds will not be deleted -//@saved_messages_topic Saved Messages topic which messages will be deleted +//@saved_messages_topic_id Identifier of Saved Messages topic which messages will be deleted //@min_date The minimum date of the messages to delete //@max_date The maximum date of the messages to delete -deleteSavedMessagesTopicMessagesByDate#a18f779d saved_messages_topic:SavedMessagesTopic min_date:int32 max_date:int32 = Ok; +deleteSavedMessagesTopicMessagesByDate#160a25 saved_messages_topic_id:int53 min_date:int32 max_date:int32 = Ok; //@description Changes the pinned state of a Saved Messages topic. There can be up to getOption("pinned_saved_messages_topic_count_max") pinned topics. The limit can be increased with Telegram Premium -//@saved_messages_topic Saved Messages topic to pin or unpin +//@saved_messages_topic_id Identifier of Saved Messages topic to pin or unpin //@is_pinned Pass true to pin the topic; pass false to unpin it -toggleSavedMessagesTopicIsPinned#3f8a8c2d saved_messages_topic:SavedMessagesTopic is_pinned:Bool = Ok; +toggleSavedMessagesTopicIsPinned#a15345cc saved_messages_topic_id:int53 is_pinned:Bool = Ok; //@description Changes the order of pinned Saved Messages topics -//@saved_messages_topics The new list of pinned Saved Messages topics -setPinnedSavedMessagesTopics#81065db4 saved_messages_topics:vector = Ok; +//@saved_messages_topic_ids Identifiers of the new pinned Saved Messages topics +setPinnedSavedMessagesTopics#475a1110 saved_messages_topic_ids:vector = Ok; //@description Returns a list of common group chats with a given user. Chats are sorted by their type and creation date //@user_id User identifier @@ -7904,8 +7936,8 @@ deleteChat#f5cae05e chat_id:int53 = Ok; //@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. //@filter Additional filter for messages to search; pass null to search for all messages //@message_thread_id If not 0, only messages in the specified thread will be returned; supergroups only -//@saved_messages_topic If not null, only messages in the specified Saved Messages topic will be returned; pass null to return all messages, or for chats other than Saved Messages -searchChatMessages#8dbde5c5 chat_id:int53 query:string sender_id:MessageSender from_message_id:int53 offset:int32 limit:int32 filter:SearchMessagesFilter message_thread_id:int53 saved_messages_topic:SavedMessagesTopic = FoundChatMessages; +//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be returned; pass 0 to return all messages, or for chats other than Saved Messages +searchChatMessages#dfdeb5c6 chat_id:int53 query:string sender_id:MessageSender from_message_id:int53 offset:int32 limit:int32 filter:SearchMessagesFilter message_thread_id:int53 saved_messages_topic_id:int53 = FoundChatMessages; //@description Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). //@chat_list Chat list in which to search messages; pass null to search in all chats regardless of their chat list. Only Main and Archive chat lists are supported @@ -7926,12 +7958,13 @@ searchMessages#2a8f08a7 chat_list:ChatList query:string offset:string limit:int3 searchSecretMessages#cd2a4c9c chat_id:int53 query:string offset:string limit:int32 filter:SearchMessagesFilter = FoundMessages; //@description Searches for messages tagged by the given reaction and with the given words in the Saved Messages chat; for Telegram Premium users only. +//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages //@tag Tag to search for; pass null to return all suitable messages //@query Query to search for //@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message //@offset Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages //@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. -searchSavedMessages#da8efe2a tag:ReactionType query:string from_message_id:int53 offset:int32 limit:int32 = FoundChatMessages; +searchSavedMessages#8a9b9f96 saved_messages_topic_id:int53 tag:ReactionType query:string from_message_id:int53 offset:int32 limit:int32 = FoundChatMessages; //@description Searches for call messages. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results @@ -7966,30 +7999,30 @@ getChatMessageByDate#3f557136 chat_id:int53 date:int32 = Message; //@filter Filter for message content. Filters searchMessagesFilterEmpty, searchMessagesFilterMention, searchMessagesFilterUnreadMention, and searchMessagesFilterUnreadReaction are unsupported in this function //@from_message_id The message identifier from which to return information about message positions //@limit The expected number of message positions to be returned; 50-2000. A smaller number of positions can be returned, if there are not enough appropriate messages -//@saved_messages_topic If not null, only messages in the specified Saved Messages topic will be considered; pass null to consider all messages, or for chats other than Saved Messages -getChatSparseMessagePositions#7a9bab8e chat_id:int53 filter:SearchMessagesFilter from_message_id:int53 limit:int32 saved_messages_topic:SavedMessagesTopic = MessagePositions; +//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages, or for chats other than Saved Messages +getChatSparseMessagePositions#3b452efd chat_id:int53 filter:SearchMessagesFilter from_message_id:int53 limit:int32 saved_messages_topic_id:int53 = MessagePositions; //@description Returns information about the next messages of the specified type in the chat split by days. Returns the results in reverse chronological order. Can return partial result for the last returned day. Behavior of this method depends on the value of the option "utc_time_offset" //@chat_id Identifier of the chat in which to return information about messages //@filter Filter for message content. Filters searchMessagesFilterEmpty, searchMessagesFilterMention, searchMessagesFilterUnreadMention, and searchMessagesFilterUnreadReaction are unsupported in this function //@from_message_id The message identifier from which to return information about messages; use 0 to get results from the last message -//@saved_messages_topic If not null, only messages in the specified Saved Messages topic will be considered; pass null to consider all messages, or for chats other than Saved Messages -getChatMessageCalendar#69fdc3d2 chat_id:int53 filter:SearchMessagesFilter from_message_id:int53 saved_messages_topic:SavedMessagesTopic = MessageCalendar; +//@saved_messages_topic_id If not0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages, or for chats other than Saved Messages +getChatMessageCalendar#81af2db7 chat_id:int53 filter:SearchMessagesFilter from_message_id:int53 saved_messages_topic_id:int53 = MessageCalendar; //@description Returns approximate number of messages of the specified type in the chat //@chat_id Identifier of the chat in which to count messages //@filter Filter for message content; searchMessagesFilterEmpty is unsupported in this function -//@saved_messages_topic If not null, only messages in the specified Saved Messages topic will be counted; pass null to count all messages, or for chats other than Saved Messages +//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be counted; pass 0 to count all messages, or for chats other than Saved Messages //@return_local Pass true to get the number of messages without sending network requests, or -1 if the number of messages is unknown locally -getChatMessageCount#d1d1952d chat_id:int53 filter:SearchMessagesFilter saved_messages_topic:SavedMessagesTopic return_local:Bool = Count; +getChatMessageCount#38f78909 chat_id:int53 filter:SearchMessagesFilter saved_messages_topic_id:int53 return_local:Bool = Count; //@description Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat. Cannot be used in secret chats //@chat_id Identifier of the chat in which to find message position //@message_id Message identifier //@filter Filter for message content; searchMessagesFilterEmpty, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, and searchMessagesFilterFailedToSend are unsupported in this function //@message_thread_id If not 0, only messages in the specified thread will be considered; supergroups only -//@saved_messages_topic If not null, only messages in the specified Saved Messages topic will be considered; pass null to consider all relevant messages, or for chats other than Saved Messages -getChatMessagePosition#e9d7d767 chat_id:int53 message_id:int53 filter:SearchMessagesFilter message_thread_id:int53 saved_messages_topic:SavedMessagesTopic = Count; +//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all relevant messages, or for chats other than Saved Messages +getChatMessagePosition#81bfcc7 chat_id:int53 message_id:int53 filter:SearchMessagesFilter message_thread_id:int53 saved_messages_topic_id:int53 = Count; //@description Returns all scheduled messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) //@chat_id Chat identifier @@ -8065,7 +8098,7 @@ setChatMessageSender#ab456b7e chat_id:int53 message_sender_id:MessageSender = Ok //@description Sends a message. Returns the sent message //@chat_id Target chat -//@message_thread_id If not 0, a message thread identifier in which the message will be sent +//@message_thread_id If not 0, the message thread identifier in which the message will be sent //@reply_to Information about the message or story to be replied; pass null if none //@options Options to be used to send the message; pass null to use default options //@reply_markup Markup for replying to the message; pass null if none; for bots only @@ -8074,13 +8107,13 @@ sendMessage#e02d01e9 chat_id:int53 message_thread_id:int53 reply_to:InputMessage //@description Sends 2-10 messages grouped together into an album. Currently, only audio, document, photo and video messages can be grouped into an album. Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages //@chat_id Target chat -//@message_thread_id If not 0, a message thread identifier in which the messages will be sent +//@message_thread_id If not 0, the message thread identifier in which the messages will be sent //@reply_to Information about the message or story to be replied; pass null if none //@options Options to be used to send the messages; pass null to use default options //@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album sendMessageAlbum#74bcdacf chat_id:int53 message_thread_id:int53 reply_to:InputMessageReplyTo options:messageSendOptions input_message_contents:vector = Messages; -//@description Invites a bot to a chat (if it is not yet a member) and sends it the /start command. Bots can't be invited to a private chat other than the chat with the bot. Bots can't be invited to channels (although they can be added as admins) and secret chats. Returns the sent message +//@description Invites a bot to a chat (if it is not yet a member) and sends it the /start command; requires can_invite_users member right. Bots can't be invited to a private chat other than the chat with the bot. //@bot_user_id Identifier of the bot //@chat_id Identifier of the target chat //@parameter A hidden parameter sent to the bot for deep linking purposes (https://core.telegram.org/bots#deep-linking) @@ -8088,7 +8121,7 @@ sendBotStartMessage#aa6a3eee bot_user_id:int53 chat_id:int53 parameter:string = //@description Sends the result of an inline query as a message. Returns the sent message. Always clears a chat draft message //@chat_id Target chat -//@message_thread_id If not 0, a message thread identifier in which the message will be sent +//@message_thread_id If not 0, the message thread identifier in which the message will be sent //@reply_to Information about the message or story to be replied; pass null if none //@options Options to be used to send the message; pass null to use default options //@query_id Identifier of the inline query @@ -8098,7 +8131,7 @@ sendInlineQueryResultMessage#467c5478 chat_id:int53 message_thread_id:int53 repl //@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 //@chat_id Identifier of the chat to which to forward messages -//@message_thread_id If not 0, a message thread identifier in which the message will be sent; for forum threads only +//@message_thread_id If not 0, the message thread identifier in which the message will be sent; for forum threads only //@from_chat_id Identifier of the chat from which to forward messages //@message_ids Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously. A message can be forwarded only if message.can_be_forwarded //@options Options to be used to send the messages; pass null to use default options @@ -8214,7 +8247,7 @@ editMessageSchedulingState#ae2a0bc0 chat_id:int53 message_id:int53 scheduling_st //@description Returns list of custom emojis, which can be used as forum topic icon by all users getForumTopicDefaultIcons#583574dc = Stickers; -//@description Creates a topic in a forum supergroup chat; requires can_manage_topics or can_create_topics rights in the supergroup +//@description Creates a topic in a forum supergroup chat; requires can_manage_topics administrator or can_create_topics member right in the supergroup //@chat_id Identifier of the chat //@name Name of the topic; 1-128 characters //@icon Icon of the topic. Icon color must be one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. Telegram Premium users can use any custom emoji as topic icon, other users can use only a custom emoji returned by getForumTopicDefaultIcons @@ -8329,8 +8362,9 @@ getMessageAddedReactions#7dc6ae52 chat_id:int53 message_id:int53 reaction_type:R //@reaction_type New type of the default reaction setDefaultReactionType#65038a3d reaction_type:ReactionType = Ok; -//@description Returns tags used in Saved Messages; for Telegram Premium users only -getSavedMessagesTags#611591cb = SavedMessagesTags; +//@description Returns tags used in Saved Messages or a Saved Messages topic +//@saved_messages_topic_id Identifier of Saved Messages topic which tags will be returned; pass 0 to get all Saved Messages tags +getSavedMessagesTags#8cd667a9 saved_messages_topic_id:int53 = SavedMessagesTags; //@description Changes label of a Saved Messages tag; for Telegram Premium users only //@tag The tag which label will be changed @@ -8499,7 +8533,7 @@ sendWebAppData#ab1fce0c bot_user_id:int53 button_text:string data:string = Ok; //@url The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise //@theme Preferred Web App theme; pass null to use the default theme //@application_name Short name of the application; 0-64 English letters, digits, and underscores -//@message_thread_id If not 0, a message thread identifier in which the message will be sent +//@message_thread_id If not 0, the message thread identifier in which the message will be sent //@reply_to Information about the message or story to be replied in the message sent by the Web App; pass null if none openWebApp#b02666b0 chat_id:int53 bot_user_id:int53 url:string theme:themeParameters application_name:string message_thread_id:int53 reply_to:InputMessageReplyTo = WebAppInfo; @@ -8572,7 +8606,7 @@ deleteChatReplyMarkup#5ff9b5b chat_id:int53 message_id:int53 = Ok; //@description Sends a notification about user activity in a chat //@chat_id Chat identifier -//@message_thread_id If not 0, a message thread identifier in which the action was performed +//@message_thread_id If not 0, the message thread identifier in which the action was performed //@action The action description; pass null to cancel the currently active action sendChatAction#7cfce154 chat_id:int53 message_thread_id:int53 action:ChatAction = Ok; @@ -8676,7 +8710,7 @@ createNewSupergroupChat#2fecf6c6 title:string is_forum:Bool is_channel:Bool desc //@user_id Identifier of the target user createNewSecretChat#db012265 user_id:int53 = Chat; -//@description Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and messageChatUpgradeFrom; requires creator privileges. Deactivates the original basic group +//@description Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and messageChatUpgradeFrom; requires owner privileges. Deactivates the original basic group //@chat_id Identifier of the chat to upgrade upgradeBasicGroupChatToSupergroupChat#11e915ba chat_id:int53 = Chat; @@ -8778,25 +8812,25 @@ getArchiveChatListSettings#838d8e60 = ArchiveChatListSettings; //@settings New settings setArchiveChatListSettings#cb454c0a settings:archiveChatListSettings = Ok; -//@description Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info administrator right +//@description Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info member right //@chat_id Chat identifier //@title New title of the chat; 1-128 characters setChatTitle#9cabebf chat_id:int53 title:string = Ok; -//@description Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info administrator right +//@description Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info member right //@chat_id Chat identifier //@photo New chat photo; pass null to delete the chat photo setChatPhoto#e97b8d03 chat_id:int53 photo:InputChatPhoto = Ok; -//@description Changes accent color and background custom emoji of a chat. Requires can_change_info administrator right +//@description Changes accent color and background custom emoji of a channel chat. Requires can_change_info administrator right //@chat_id Chat identifier -//@accent_color_id Identifier of the accent color to use. The chat must have at least accentColor.min_chat_boost_level boost level to pass the corresponding color +//@accent_color_id Identifier of the accent color to use. The chat must have at least accentColor.min_channel_chat_boost_level boost level to pass the corresponding color //@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none. Use chatBoostLevelFeatures.can_set_background_custom_emoji to check whether a custom emoji can be set setChatAccentColor#349f57ca chat_id:int53 accent_color_id:int32 background_custom_emoji_id:int64 = Ok; -//@description Changes accent color and background custom emoji for profile of a chat. Requires can_change_info administrator right +//@description Changes accent color and background custom emoji for profile of a supergroup or channel chat. Requires can_change_info administrator right //@chat_id Chat identifier -//@profile_accent_color_id Identifier of the accent color to use for profile; pass -1 if none. The chat must have at least profileAccentColor.min_chat_boost_level boost level to pass the corresponding color +//@profile_accent_color_id Identifier of the accent color to use for profile; pass -1 if none. The chat must have at least profileAccentColor.min_supergroup_chat_boost_level for supergroups //@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the chat's profile photo background; 0 if none. Use chatBoostLevelFeatures.can_set_profile_background_custom_emoji to check whether a custom emoji can be set setChatProfileAccentColor#4227ae7a chat_id:int53 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 = Ok; @@ -8835,8 +8869,8 @@ setChatTheme#8f090293 chat_id:int53 theme_name:string = Ok; //@description Changes the draft message in a chat //@chat_id Chat identifier -//@message_thread_id If not 0, a message thread identifier in which the draft was changed -//@draft_message New draft message; pass null to remove the draft +//@message_thread_id If not 0, the message thread identifier in which the draft was changed +//@draft_message New draft message; pass null to remove the draft. All files in draft message content must be of the type inputFileLocal. Media thumbnails and captions are ignored setChatDraftMessage#645e1f1a chat_id:int53 message_thread_id:int53 draft_message:draftMessage = Ok; //@description Changes the notification settings of a chat. Notification settings of a chat with the current user (Saved Messages) can't be changed @@ -8849,7 +8883,7 @@ setChatNotificationSettings#2e531ffe chat_id:int53 notification_settings:chatNot //@has_protected_content New value of has_protected_content toggleChatHasProtectedContent#3a20d94d chat_id:int53 has_protected_content:Bool = Ok; -//@description Changes the view_as_topics setting of a forum chat +//@description Changes the view_as_topics setting of a forum chat or Saved Messages //@chat_id Chat identifier //@view_as_topics New value of view_as_topics toggleChatViewAsTopics#2b2783dc chat_id:int53 view_as_topics:Bool = Ok; @@ -8869,9 +8903,9 @@ toggleChatIsMarkedAsUnread#c538dadf chat_id:int53 is_marked_as_unread:Bool = Ok; //@default_disable_notification New value of default_disable_notification toggleChatDefaultDisableNotification#12c36012 chat_id:int53 default_disable_notification:Bool = Ok; -//@description Changes reactions, available in a chat. Available for basic groups, supergroups, and channels. Requires can_change_info administrator right +//@description Changes reactions, available in a chat. Available for basic groups, supergroups, and channels. Requires can_change_info member right //@chat_id Identifier of the chat -//@available_reactions Reactions available in the chat. All explicitly specified emoji reactions must be active. Up to the chat's boost level custom emoji reactions can be explicitly specified +//@available_reactions Reactions available in the chat. All explicitly specified emoji reactions must be active. In channel chats up to the chat's boost level custom emoji reactions can be explicitly specified setChatAvailableReactions#feb3e06 chat_id:int53 available_reactions:ChatAvailableReactions = Ok; //@description Changes application-specific data associated with a chat @@ -8879,13 +8913,13 @@ setChatAvailableReactions#feb3e06 chat_id:int53 available_reactions:ChatAvailabl //@client_data New value of client_data setChatClientData#ceb3273d chat_id:int53 client_data:string = Ok; -//@description Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info administrator right +//@description Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info member right //@chat_id Identifier of the chat //@param_description New chat description; 0-255 characters setChatDescription#74a8b45d chat_id:int53 description:string = Ok; //@description Changes the discussion group of a channel chat; requires can_change_info administrator right in the channel if it is specified -//@chat_id Identifier of the channel chat. Pass 0 to remove a link from the supergroup passed in the second argument to a linked channel chat (requires can_pin_messages rights in the supergroup) +//@chat_id Identifier of the channel chat. Pass 0 to remove a link from the supergroup passed in the second argument to a linked channel chat (requires can_pin_messages member right in the supergroup) //@discussion_chat_id Identifier of a new channel's discussion group. Use 0 to remove the discussion group. Use the method getSuitableDiscussionChats to find all suitable groups. setChatDiscussionGroup#c93c32b8 chat_id:int53 discussion_chat_id:int53 = Ok; @@ -8894,28 +8928,28 @@ setChatDiscussionGroup#c93c32b8 chat_id:int53 discussion_chat_id:int53 = Ok; //@location New location for the chat; must be valid and not null setChatLocation#d2471daa chat_id:int53 location:chatLocation = Ok; -//@description Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members rights +//@description Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members right //@chat_id Chat identifier //@slow_mode_delay New slow mode delay for the chat, in seconds; must be one of 0, 10, 30, 60, 300, 900, 3600 setChatSlowModeDelay#dfcae63e chat_id:int53 slow_mode_delay:int32 = Ok; -//@description Pins a message in a chat; requires can_pin_messages rights or can_edit_messages rights in the channel +//@description Pins a message in a chat; requires can_pin_messages member right if the chat is a basic group or supergroup, or can_edit_messages administrator right if the chat is a channel //@chat_id Identifier of the chat //@message_id Identifier of the new pinned message //@disable_notification Pass true to disable notification about the pinned message. Notifications are always disabled in channels and private chats //@only_for_self Pass true to pin the message only for self; private chats only pinChatMessage#79475baf chat_id:int53 message_id:int53 disable_notification:Bool only_for_self:Bool = Ok; -//@description Removes a pinned message from a chat; requires can_pin_messages rights in the group or can_edit_messages rights in the channel +//@description Removes a pinned message from a chat; requires can_pin_messages member right if the chat is a basic group or supergroup, or can_edit_messages administrator right if the chat is a channel //@chat_id Identifier of the chat //@message_id Identifier of the removed pinned message unpinChatMessage#7b1c3ede chat_id:int53 message_id:int53 = Ok; -//@description Removes all pinned messages from a chat; requires can_pin_messages rights in the group or can_edit_messages rights in the channel +//@description Removes all pinned messages from a chat; requires can_pin_messages member right if the chat is a basic group or supergroup, or can_edit_messages administrator right if the chat is a channel //@chat_id Identifier of the chat unpinAllChatMessages#aa4cd4b7 chat_id:int53 = Ok; -//@description Removes all pinned messages from a forum topic; requires can_pin_messages rights in the supergroup +//@description Removes all pinned messages from a forum topic; requires can_pin_messages member right in the supergroup //@chat_id Identifier of the chat //@message_thread_id Message thread identifier in which messages will be unpinned unpinAllMessageThreadMessages#b7c69f00 chat_id:int53 message_thread_id:int53 = Ok; @@ -8928,24 +8962,24 @@ joinChat#137a1aa1 chat_id:int53 = Ok; //@chat_id Chat identifier leaveChat#93377a61 chat_id:int53 = Ok; -//@description Adds a new member to a chat. Members can't be added to private or secret chats +//@description Adds a new member to a chat; requires can_invite_users member right. Members can't be added to private or secret chats //@chat_id Chat identifier //@user_id Identifier of the user //@forward_limit The number of earlier messages from the chat to be forwarded to the new member; up to 100. Ignored for supergroups and channels, or if the added user is a bot addChatMember#1dc4a5fa chat_id:int53 user_id:int53 forward_limit:int32 = Ok; -//@description Adds multiple new members to a chat. Currently, this method is only available for supergroups and channels. This method can't be used to join a chat. Members can't be added to a channel if it has more than 200 members +//@description Adds multiple new members to a chat; requires can_invite_users member right. Currently, this method is only available for supergroups and channels. This method can't be used to join a chat. Members can't be added to a channel if it has more than 200 members //@chat_id Chat identifier //@user_ids Identifiers of the users to be added to the chat. The maximum number of added users is 20 for supergroups and 100 for channels addChatMembers#b4f60138 chat_id:int53 user_ids:vector = Ok; -//@description Changes the status of a chat member, needs appropriate privileges. This function is currently not suitable for transferring chat ownership; use transferChatOwnership instead. Use addChatMember or banChatMember if some additional parameters needs to be passed +//@description Changes the status of a chat member; requires can_invite_users member right to add a chat member, can_promote_members administrator right to change administrator rights of the member, //@chat_id Chat identifier //@member_id Member identifier. Chats can be only banned and unbanned in supergroups and channels //@status The new status of the member in the chat setChatMemberStatus#4e0171f chat_id:int53 member_id:MessageSender status:ChatMemberStatus = Ok; -//@description Bans a member in a chat. Members can't be banned in private or secret chats. In supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first +//@description Bans a member in a chat; requires can_restrict_members administrator right. Members can't be banned in private or secret chats. In supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first //@chat_id Chat identifier //@member_id Member identifier //@banned_until_date Point in time (Unix timestamp) when the user will be unbanned; 0 if never. If the user is banned for more than 366 days or for less than 30 seconds from the current time, the user is considered to be banned forever. Ignored in basic groups and if a chat is banned @@ -8955,7 +8989,7 @@ banChatMember#cb107d7c chat_id:int53 member_id:MessageSender banned_until_date:i //@description Checks whether the current session can be used to transfer a chat ownership to another user canTransferOwnership#25d3440c = CanTransferOwnershipResult; -//@description Changes the owner of a chat. The current user must be a current owner of the chat. Use the method canTransferOwnership to check whether the ownership can be transferred from the current session. Available only for supergroups and channel chats +//@description Changes the owner of a chat; requires owner privileges in the chat. Use the method canTransferOwnership to check whether the ownership can be transferred from the current session. Available only for supergroups and channel chats //@chat_id Chat identifier //@user_id Identifier of the user to which transfer the ownership. The ownership can't be transferred to a bot or to a deleted user //@password The 2-step verification password of the current user @@ -8966,7 +9000,7 @@ transferChatOwnership#77a00a13 chat_id:int53 user_id:int53 password:string = Ok; //@member_id Member identifier getChatMember#d0c15272 chat_id:int53 member_id:MessageSender = ChatMember; -//@description Searches for a specified query in the first name, last name and usernames of the members of a specified chat. Requires administrator rights in channels +//@description Searches for a specified query in the first name, last name and usernames of the members of a specified chat. Requires administrator rights if the chat is a channel //@chat_id Chat identifier //@query Query to search for //@limit The maximum number of users to be returned; up to 200 @@ -9034,19 +9068,19 @@ readChatList#bd6498aa chat_list:ChatList = Ok; //@only_local Pass true to get only locally available information without sending network requests getStory#717b1c78 story_sender_chat_id:int53 story_id:int32 only_local:Bool = Story; -//@description Returns channel chats in which the current user has the right to post stories. The chats must be rechecked with canSendStory before actually trying to post a story there +//@description Returns supergroup and channel chats in which the current user has the right to post stories. The chats must be rechecked with canSendStory before actually trying to post a story there getChatsToSendStories#22f9e3a4 = Chats; -//@description Checks whether the current user can send a story on behalf of a chat; requires can_post_stories rights for channel chats +//@description Checks whether the current user can send a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats //@chat_id Chat identifier canSendStory#b6e0216b chat_id:int53 = CanSendStoryResult; -//@description Sends a new story to a chat; requires can_post_stories rights for channel chats. Returns a temporary story +//@description Sends a new story to a chat; requires can_post_stories right for supergroup and channel chats. Returns a temporary story //@chat_id Identifier of the chat that will post the story //@content Content of the story //@areas Clickable rectangle areas to be shown on the story media; pass null if none //@caption Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters -//@privacy_settings The privacy settings for the story +//@privacy_settings The privacy settings for the story; ignored for stories sent to supergroup and channel chats //@active_period Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise //@from_story_full_id Full identifier of the original story, which content was used to create the story //@is_pinned Pass true to keep the story accessible after expiration @@ -9061,11 +9095,10 @@ sendStory#736858bb chat_id:int53 content:InputStoryContent areas:inputStoryAreas //@caption New story caption; pass null to keep the current caption editStory#5e6a21b1 story_sender_chat_id:int53 story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText = Ok; -//@description Changes privacy settings of a story. Can be called only if story.can_be_edited == true -//@story_sender_chat_id Identifier of the chat that posted the story +//@description Changes privacy settings of a story. The method can be called only for stories posted on behalf of the current user and if story.can_be_edited == true //@story_id Identifier of the story //@privacy_settings The new privacy settigs for the story -setStoryPrivacySettings#1b6c5434 story_sender_chat_id:int53 story_id:int32 privacy_settings:StoryPrivacySettings = Ok; +setStoryPrivacySettings#d8e94332 story_id:int32 privacy_settings:StoryPrivacySettings = Ok; //@description Toggles whether a story is accessible after expiration. Can be called only if story.can_toggle_is_pinned == true //@story_sender_chat_id Identifier of the chat that posted the story @@ -9100,7 +9133,7 @@ getChatActiveStories#2e4ffbf5 chat_id:int53 = ChatActiveStories; //@limit The maximum number of stories to be returned getChatPinnedStories#53c82a1 chat_id:int53 from_story_id:int32 limit:int32 = Stories; -//@description Returns the list of all stories posted by the given chat; requires can_edit_stories rights for channel chats. +//@description Returns the list of all stories posted by the given chat; requires can_edit_stories right in the chat. //@chat_id Chat identifier //@from_story_id Identifier of the story starting from which stories must be returned; use 0 to get results from the last story //@limit The maximum number of stories to be returned @@ -9120,7 +9153,7 @@ closeStory#443d0f55 story_sender_chat_id:int53 story_id:int32 = Ok; //@row_size Number of reaction per row, 5-25 getStoryAvailableReactions#23854d3b row_size:int32 = AvailableReactions; -//@description Changes chosen reaction on a story +//@description Changes chosen reaction on a story that has already been sent //@story_sender_chat_id The identifier of the sender of the story //@story_id The identifier of the story //@reaction_type Type of the reaction to set; pass null to remove the reaction. `reactionTypeCustomEmoji` reactions can be used only by Telegram Premium users @@ -9164,17 +9197,19 @@ activateStoryStealthMode#c3db8491 = Ok; getStoryPublicForwards#68f7dcbb story_sender_chat_id:int53 story_id:int32 offset:string limit:int32 = PublicForwards; //@description Returns list of features available on the specific chat boost level; this is an offline request +//@is_channel Pass true to get the list of features for channels; pass false to get the list of features for supergroups //@level Chat boost level -getChatBoostLevelFeatures#71f15dfb level:int32 = ChatBoostLevelFeatures; +getChatBoostLevelFeatures#45e63e8b is_channel:Bool level:int32 = ChatBoostLevelFeatures; //@description Returns list of features available on the first 10 chat boost levels; this is an offline request -getChatBoostFeatures#34e76822 = ChatBoostFeatures; +//@is_channel Pass true to get the list of features for channels; pass false to get the list of features for supergroups +getChatBoostFeatures#e8c128a0 is_channel:Bool = ChatBoostFeatures; //@description Returns the list of available chat boost slots for the current user getAvailableChatBoostSlots#7307ebd5 = ChatBoostSlots; -//@description Returns the current boost status for a channel chat -//@chat_id Identifier of the channel chat +//@description Returns the current boost status for a supergroup or a channel chat +//@chat_id Identifier of the chat getChatBoostStatus#cfac8acf chat_id:int53 = ChatBoostStatus; //@description Boosts a chat and returns the list of available chat boost slots for the current user after the boost @@ -9182,7 +9217,7 @@ getChatBoostStatus#cfac8acf chat_id:int53 = ChatBoostStatus; //@slot_ids Identifiers of boost slots of the current user from which to apply boosts to the chat boostChat#890ccd68 chat_id:int53 slot_ids:vector = ChatBoostSlots; -//@description Returns an HTTPS link to boost the specified channel chat +//@description Returns an HTTPS link to boost the specified supergroup or channel chat //@chat_id Identifier of the chat getChatBoostLink#56f16c85 chat_id:int53 = ChatBoostLink; @@ -9190,14 +9225,14 @@ getChatBoostLink#56f16c85 chat_id:int53 = ChatBoostLink; //@url The link to boost a chat getChatBoostLinkInfo#26fc4b5c url:string = ChatBoostLinkInfo; -//@description Returns list of boosts applied to a chat; requires administrator rights in the channel chat +//@description Returns list of boosts applied to a chat; requires administrator rights in the chat //@chat_id Identifier of the chat //@only_gift_codes Pass true to receive only boosts received from gift codes and giveaways created by the chat //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of boosts to be returned; up to 100. For optimal performance, the number of returned boosts can be smaller than the specified limit getChatBoosts#ab5eaa38 chat_id:int53 only_gift_codes:Bool offset:string limit:int32 = FoundChatBoosts; -//@description Returns list of boosts applied to a chat by a given user; requires administrator rights in the channel chat; for bots only +//@description Returns list of boosts applied to a chat by a given user; requires administrator rights in the chat; for bots only //@chat_id Identifier of the chat //@user_id Identifier of the user getUserChatBoosts#b90ee799 chat_id:int53 user_id:int53 = FoundChatBoosts; @@ -9333,11 +9368,11 @@ searchFileDownloads#2a1e0856 query:string only_active:Bool only_completed:Bool o getMessageFileType#e2c70fd4 message_file_head:string = MessageFileType; //@description Returns a confirmation text to be shown to the user before starting message import -//@chat_id Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info administrator right +//@chat_id Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info member right getMessageImportConfirmationText#174881a8 chat_id:int53 = Text; //@description Imports messages exported from another app -//@chat_id Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info administrator right +//@chat_id Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info member right //@message_file File with messages to import. Only inputFileLocal and inputFileGenerated are supported. The file must not be previously uploaded //@attached_files Files used in the imported messages. Only inputFileLocal and inputFileGenerated are supported. The files must not be previously uploaded importMessages#7e98592b chat_id:int53 message_file:InputFile attached_files:vector = Ok; @@ -9481,18 +9516,18 @@ getVideoChatAvailableParticipants#c45da305 chat_id:int53 = MessageSenders; //@default_participant_id Default group call participant identifier to join the video chats setVideoChatDefaultParticipant#f1a672b3 chat_id:int53 default_participant_id:MessageSender = Ok; -//@description Creates a video chat (a group call bound to a chat). Available only for basic groups, supergroups and channels; requires can_manage_video_chats rights +//@description Creates a video chat (a group call bound to a chat). Available only for basic groups, supergroups and channels; requires can_manage_video_chats administrator right //@chat_id Identifier of a chat in which the video chat will be created //@title Group call title; if empty, chat title will be used //@start_date Point in time (Unix timestamp) when the group call is supposed to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future -//@is_rtmp_stream Pass true to create an RTMP stream instead of an ordinary video chat; requires creator privileges +//@is_rtmp_stream Pass true to create an RTMP stream instead of an ordinary video chat; requires owner privileges createVideoChat#7ea4958d chat_id:int53 title:string start_date:int32 is_rtmp_stream:Bool = GroupCallId; -//@description Returns RTMP URL for streaming to the chat; requires creator privileges +//@description Returns RTMP URL for streaming to the chat; requires owner privileges //@chat_id Chat identifier getVideoChatRtmpUrl#482b1b1f chat_id:int53 = RtmpUrl; -//@description Replaces the current RTMP URL for streaming to the chat; requires creator privileges +//@description Replaces the current RTMP URL for streaming to the chat; requires owner privileges //@chat_id Chat identifier replaceVideoChatRtmpUrl#214f8fe0 chat_id:int53 = RtmpUrl; @@ -10114,7 +10149,17 @@ reorderSupergroupActiveUsernames#663c7f3b supergroup_id:int53 usernames:vector 0 { @@ -207,7 +207,7 @@ func (a *AccentColor) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode accentColor#ed4c76c9: field light_theme_colors: %w", err) + return fmt.Errorf("unable to decode accentColor#53312690: field light_theme_colors: %w", err) } a.LightThemeColors = append(a.LightThemeColors, value) } @@ -215,7 +215,7 @@ func (a *AccentColor) DecodeBare(b *bin.Buffer) error { { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode accentColor#ed4c76c9: field dark_theme_colors: %w", err) + return fmt.Errorf("unable to decode accentColor#53312690: field dark_theme_colors: %w", err) } if headerLen > 0 { @@ -224,7 +224,7 @@ func (a *AccentColor) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode accentColor#ed4c76c9: field dark_theme_colors: %w", err) + return fmt.Errorf("unable to decode accentColor#53312690: field dark_theme_colors: %w", err) } a.DarkThemeColors = append(a.DarkThemeColors, value) } @@ -232,9 +232,9 @@ func (a *AccentColor) DecodeBare(b *bin.Buffer) error { { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode accentColor#ed4c76c9: field min_chat_boost_level: %w", err) + return fmt.Errorf("unable to decode accentColor#53312690: field min_channel_chat_boost_level: %w", err) } - a.MinChatBoostLevel = value + a.MinChannelChatBoostLevel = value } return nil } @@ -242,7 +242,7 @@ func (a *AccentColor) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (a *AccentColor) EncodeTDLibJSON(b tdjson.Encoder) error { if a == nil { - return fmt.Errorf("can't encode accentColor#ed4c76c9 as nil") + return fmt.Errorf("can't encode accentColor#53312690 as nil") } b.ObjStart() b.PutID("accentColor") @@ -271,8 +271,8 @@ func (a *AccentColor) EncodeTDLibJSON(b tdjson.Encoder) error { b.StripComma() b.ArrEnd() b.Comma() - b.FieldStart("min_chat_boost_level") - b.PutInt32(a.MinChatBoostLevel) + b.FieldStart("min_channel_chat_boost_level") + b.PutInt32(a.MinChannelChatBoostLevel) b.Comma() b.StripComma() b.ObjEnd() @@ -282,55 +282,55 @@ func (a *AccentColor) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (a *AccentColor) DecodeTDLibJSON(b tdjson.Decoder) error { if a == nil { - return fmt.Errorf("can't decode accentColor#ed4c76c9 to nil") + return fmt.Errorf("can't decode accentColor#53312690 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("accentColor"); err != nil { - return fmt.Errorf("unable to decode accentColor#ed4c76c9: %w", err) + return fmt.Errorf("unable to decode accentColor#53312690: %w", err) } case "id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode accentColor#ed4c76c9: field id: %w", err) + return fmt.Errorf("unable to decode accentColor#53312690: field id: %w", err) } a.ID = value case "built_in_accent_color_id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode accentColor#ed4c76c9: field built_in_accent_color_id: %w", err) + return fmt.Errorf("unable to decode accentColor#53312690: field built_in_accent_color_id: %w", err) } a.BuiltInAccentColorID = value case "light_theme_colors": if err := b.Arr(func(b tdjson.Decoder) error { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode accentColor#ed4c76c9: field light_theme_colors: %w", err) + return fmt.Errorf("unable to decode accentColor#53312690: field light_theme_colors: %w", err) } a.LightThemeColors = append(a.LightThemeColors, value) return nil }); err != nil { - return fmt.Errorf("unable to decode accentColor#ed4c76c9: field light_theme_colors: %w", err) + return fmt.Errorf("unable to decode accentColor#53312690: field light_theme_colors: %w", err) } case "dark_theme_colors": if err := b.Arr(func(b tdjson.Decoder) error { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode accentColor#ed4c76c9: field dark_theme_colors: %w", err) + return fmt.Errorf("unable to decode accentColor#53312690: field dark_theme_colors: %w", err) } a.DarkThemeColors = append(a.DarkThemeColors, value) return nil }); err != nil { - return fmt.Errorf("unable to decode accentColor#ed4c76c9: field dark_theme_colors: %w", err) + return fmt.Errorf("unable to decode accentColor#53312690: field dark_theme_colors: %w", err) } - case "min_chat_boost_level": + case "min_channel_chat_boost_level": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode accentColor#ed4c76c9: field min_chat_boost_level: %w", err) + return fmt.Errorf("unable to decode accentColor#53312690: field min_channel_chat_boost_level: %w", err) } - a.MinChatBoostLevel = value + a.MinChannelChatBoostLevel = value default: return b.Skip() } @@ -370,10 +370,10 @@ func (a *AccentColor) GetDarkThemeColors() (value []int32) { return a.DarkThemeColors } -// GetMinChatBoostLevel returns value of MinChatBoostLevel field. -func (a *AccentColor) GetMinChatBoostLevel() (value int32) { +// GetMinChannelChatBoostLevel returns value of MinChannelChatBoostLevel field. +func (a *AccentColor) GetMinChannelChatBoostLevel() (value int32) { if a == nil { return } - return a.MinChatBoostLevel + return a.MinChannelChatBoostLevel } diff --git a/tdapi/tl_available_reactions_gen.go b/tdapi/tl_available_reactions_gen.go index 7692070343..fa09e3b63e 100644 --- a/tdapi/tl_available_reactions_gen.go +++ b/tdapi/tl_available_reactions_gen.go @@ -41,8 +41,7 @@ type AvailableReactions struct { PopularReactions []AvailableReaction // True, if any custom emoji reaction can be added by Telegram Premium subscribers AllowCustomEmoji bool - // True, if the reactions will be tags and the message can be found by them; currently, - // always false + // True, if the reactions will be tags and the message can be found by them AreTags bool // The reason why the current user can't add reactions to the message, despite some other // users can; may be null if none diff --git a/tdapi/tl_chat_administrator_rights_gen.go b/tdapi/tl_chat_administrator_rights_gen.go index 5dd3985a07..fa3a7f0fa6 100644 --- a/tdapi/tl_chat_administrator_rights_gen.go +++ b/tdapi/tl_chat_administrator_rights_gen.go @@ -33,10 +33,9 @@ var ( // ChatAdministratorRights represents TL type `chatAdministratorRights#5f4f9044`. type ChatAdministratorRights struct { - // True, if the administrator can get chat event log, get chat boosts in channels, get - // channel members, report supergroup spam messages, see anonymous administrators in - // supergroups and ignore slow mode. Implied by any other privilege; applicable to - // supergroups and channels only + // True, if the administrator can access the chat event log, get boost list, see hidden + // supergroup and channel members, report supergroup spam messages and ignore slow mode. + // Implied by any other privilege; applicable to supergroups and channels only CanManageChat bool // True, if the administrator can change the chat title, photo, and other settings CanChangeInfo bool @@ -64,14 +63,14 @@ type ChatAdministratorRights struct { CanPromoteMembers bool // True, if the administrator can manage video chats CanManageVideoChats bool - // True, if the administrator can create new channel stories, or edit and delete posted - // stories; applicable to channels only + // True, if the administrator can create new chat stories, or edit and delete posted + // stories; applicable to supergroups and channels only CanPostStories bool // True, if the administrator can edit stories posted by other users, pin stories and - // access story archive; applicable to channels only + // access story archive; applicable to supergroups and channels only CanEditStories bool // True, if the administrator can delete stories posted by other users; applicable to - // channels only + // supergroups and channels only CanDeleteStories bool // True, if the administrator isn't shown in the chat member list and sends messages // anonymously; applicable to supergroups only diff --git a/tdapi/tl_chat_boost_features_gen.go b/tdapi/tl_chat_boost_features_gen.go index 8ddadf3dae..231c7b2202 100644 --- a/tdapi/tl_chat_boost_features_gen.go +++ b/tdapi/tl_chat_boost_features_gen.go @@ -31,14 +31,14 @@ var ( _ = tdjson.Encoder{} ) -// ChatBoostFeatures represents TL type `chatBoostFeatures#4dd864af`. +// ChatBoostFeatures represents TL type `chatBoostFeatures#1921fd49`. type ChatBoostFeatures struct { // The list of features Features []ChatBoostLevelFeatures // The minimum boost level required to set custom emoji for profile background MinProfileBackgroundCustomEmojiBoostLevel int32 // The minimum boost level required to set custom emoji for reply header and link preview - // background + // background; for channel chats only MinBackgroundCustomEmojiBoostLevel int32 // The minimum boost level required to set emoji status MinEmojiStatusBoostLevel int32 @@ -46,10 +46,16 @@ type ChatBoostFeatures struct { MinChatThemeBackgroundBoostLevel int32 // The minimum boost level required to set custom chat background MinCustomBackgroundBoostLevel int32 + // The minimum boost level required to set custom emoji sticker set for the chat; for + // supergroup chats only + MinCustomEmojiStickerSetBoostLevel int32 + // The minimum boost level allowing to recognize speech in video note and voice note + // messages for non-Premium users; for supergroup chats only + MinSpeechRecognitionBoostLevel int32 } // ChatBoostFeaturesTypeID is TL type id of ChatBoostFeatures. -const ChatBoostFeaturesTypeID = 0x4dd864af +const ChatBoostFeaturesTypeID = 0x1921fd49 // Ensuring interfaces in compile-time for ChatBoostFeatures. var ( @@ -81,6 +87,12 @@ func (c *ChatBoostFeatures) Zero() bool { if !(c.MinCustomBackgroundBoostLevel == 0) { return false } + if !(c.MinCustomEmojiStickerSetBoostLevel == 0) { + return false + } + if !(c.MinSpeechRecognitionBoostLevel == 0) { + return false + } return true } @@ -141,6 +153,14 @@ func (c *ChatBoostFeatures) TypeInfo() tdp.Type { Name: "MinCustomBackgroundBoostLevel", SchemaName: "min_custom_background_boost_level", }, + { + Name: "MinCustomEmojiStickerSetBoostLevel", + SchemaName: "min_custom_emoji_sticker_set_boost_level", + }, + { + Name: "MinSpeechRecognitionBoostLevel", + SchemaName: "min_speech_recognition_boost_level", + }, } return typ } @@ -148,7 +168,7 @@ func (c *ChatBoostFeatures) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *ChatBoostFeatures) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatBoostFeatures#4dd864af as nil") + return fmt.Errorf("can't encode chatBoostFeatures#1921fd49 as nil") } b.PutID(ChatBoostFeaturesTypeID) return c.EncodeBare(b) @@ -157,12 +177,12 @@ func (c *ChatBoostFeatures) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatBoostFeatures) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatBoostFeatures#4dd864af as nil") + return fmt.Errorf("can't encode chatBoostFeatures#1921fd49 as nil") } b.PutInt(len(c.Features)) for idx, v := range c.Features { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatBoostFeatures#4dd864af: field features element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare chatBoostFeatures#1921fd49: field features element with index %d: %w", idx, err) } } b.PutInt32(c.MinProfileBackgroundCustomEmojiBoostLevel) @@ -170,16 +190,18 @@ func (c *ChatBoostFeatures) EncodeBare(b *bin.Buffer) error { b.PutInt32(c.MinEmojiStatusBoostLevel) b.PutInt32(c.MinChatThemeBackgroundBoostLevel) b.PutInt32(c.MinCustomBackgroundBoostLevel) + b.PutInt32(c.MinCustomEmojiStickerSetBoostLevel) + b.PutInt32(c.MinSpeechRecognitionBoostLevel) return nil } // Decode implements bin.Decoder. func (c *ChatBoostFeatures) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatBoostFeatures#4dd864af to nil") + return fmt.Errorf("can't decode chatBoostFeatures#1921fd49 to nil") } if err := b.ConsumeID(ChatBoostFeaturesTypeID); err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#4dd864af: %w", err) + return fmt.Errorf("unable to decode chatBoostFeatures#1921fd49: %w", err) } return c.DecodeBare(b) } @@ -187,12 +209,12 @@ func (c *ChatBoostFeatures) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatBoostFeatures) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatBoostFeatures#4dd864af to nil") + return fmt.Errorf("can't decode chatBoostFeatures#1921fd49 to nil") } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#4dd864af: field features: %w", err) + return fmt.Errorf("unable to decode chatBoostFeatures#1921fd49: field features: %w", err) } if headerLen > 0 { @@ -201,7 +223,7 @@ func (c *ChatBoostFeatures) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value ChatBoostLevelFeatures if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatBoostFeatures#4dd864af: field features: %w", err) + return fmt.Errorf("unable to decode bare chatBoostFeatures#1921fd49: field features: %w", err) } c.Features = append(c.Features, value) } @@ -209,45 +231,59 @@ func (c *ChatBoostFeatures) DecodeBare(b *bin.Buffer) error { { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#4dd864af: field min_profile_background_custom_emoji_boost_level: %w", err) + return fmt.Errorf("unable to decode chatBoostFeatures#1921fd49: field min_profile_background_custom_emoji_boost_level: %w", err) } c.MinProfileBackgroundCustomEmojiBoostLevel = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#4dd864af: field min_background_custom_emoji_boost_level: %w", err) + return fmt.Errorf("unable to decode chatBoostFeatures#1921fd49: field min_background_custom_emoji_boost_level: %w", err) } c.MinBackgroundCustomEmojiBoostLevel = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#4dd864af: field min_emoji_status_boost_level: %w", err) + return fmt.Errorf("unable to decode chatBoostFeatures#1921fd49: field min_emoji_status_boost_level: %w", err) } c.MinEmojiStatusBoostLevel = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#4dd864af: field min_chat_theme_background_boost_level: %w", err) + return fmt.Errorf("unable to decode chatBoostFeatures#1921fd49: field min_chat_theme_background_boost_level: %w", err) } c.MinChatThemeBackgroundBoostLevel = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#4dd864af: field min_custom_background_boost_level: %w", err) + return fmt.Errorf("unable to decode chatBoostFeatures#1921fd49: field min_custom_background_boost_level: %w", err) } c.MinCustomBackgroundBoostLevel = value } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatBoostFeatures#1921fd49: field min_custom_emoji_sticker_set_boost_level: %w", err) + } + c.MinCustomEmojiStickerSetBoostLevel = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatBoostFeatures#1921fd49: field min_speech_recognition_boost_level: %w", err) + } + c.MinSpeechRecognitionBoostLevel = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *ChatBoostFeatures) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatBoostFeatures#4dd864af as nil") + return fmt.Errorf("can't encode chatBoostFeatures#1921fd49 as nil") } b.ObjStart() b.PutID("chatBoostFeatures") @@ -256,7 +292,7 @@ func (c *ChatBoostFeatures) EncodeTDLibJSON(b tdjson.Encoder) error { b.ArrStart() for idx, v := range c.Features { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatBoostFeatures#4dd864af: field features element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode chatBoostFeatures#1921fd49: field features element with index %d: %w", idx, err) } b.Comma() } @@ -278,6 +314,12 @@ func (c *ChatBoostFeatures) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("min_custom_background_boost_level") b.PutInt32(c.MinCustomBackgroundBoostLevel) b.Comma() + b.FieldStart("min_custom_emoji_sticker_set_boost_level") + b.PutInt32(c.MinCustomEmojiStickerSetBoostLevel) + b.Comma() + b.FieldStart("min_speech_recognition_boost_level") + b.PutInt32(c.MinSpeechRecognitionBoostLevel) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -286,56 +328,68 @@ func (c *ChatBoostFeatures) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *ChatBoostFeatures) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatBoostFeatures#4dd864af to nil") + return fmt.Errorf("can't decode chatBoostFeatures#1921fd49 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("chatBoostFeatures"); err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#4dd864af: %w", err) + return fmt.Errorf("unable to decode chatBoostFeatures#1921fd49: %w", err) } case "features": if err := b.Arr(func(b tdjson.Decoder) error { var value ChatBoostLevelFeatures if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#4dd864af: field features: %w", err) + return fmt.Errorf("unable to decode chatBoostFeatures#1921fd49: field features: %w", err) } c.Features = append(c.Features, value) return nil }); err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#4dd864af: field features: %w", err) + return fmt.Errorf("unable to decode chatBoostFeatures#1921fd49: field features: %w", err) } case "min_profile_background_custom_emoji_boost_level": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#4dd864af: field min_profile_background_custom_emoji_boost_level: %w", err) + return fmt.Errorf("unable to decode chatBoostFeatures#1921fd49: field min_profile_background_custom_emoji_boost_level: %w", err) } c.MinProfileBackgroundCustomEmojiBoostLevel = value case "min_background_custom_emoji_boost_level": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#4dd864af: field min_background_custom_emoji_boost_level: %w", err) + return fmt.Errorf("unable to decode chatBoostFeatures#1921fd49: field min_background_custom_emoji_boost_level: %w", err) } c.MinBackgroundCustomEmojiBoostLevel = value case "min_emoji_status_boost_level": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#4dd864af: field min_emoji_status_boost_level: %w", err) + return fmt.Errorf("unable to decode chatBoostFeatures#1921fd49: field min_emoji_status_boost_level: %w", err) } c.MinEmojiStatusBoostLevel = value case "min_chat_theme_background_boost_level": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#4dd864af: field min_chat_theme_background_boost_level: %w", err) + return fmt.Errorf("unable to decode chatBoostFeatures#1921fd49: field min_chat_theme_background_boost_level: %w", err) } c.MinChatThemeBackgroundBoostLevel = value case "min_custom_background_boost_level": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#4dd864af: field min_custom_background_boost_level: %w", err) + return fmt.Errorf("unable to decode chatBoostFeatures#1921fd49: field min_custom_background_boost_level: %w", err) } c.MinCustomBackgroundBoostLevel = value + case "min_custom_emoji_sticker_set_boost_level": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatBoostFeatures#1921fd49: field min_custom_emoji_sticker_set_boost_level: %w", err) + } + c.MinCustomEmojiStickerSetBoostLevel = value + case "min_speech_recognition_boost_level": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatBoostFeatures#1921fd49: field min_speech_recognition_boost_level: %w", err) + } + c.MinSpeechRecognitionBoostLevel = value default: return b.Skip() } @@ -390,3 +444,19 @@ func (c *ChatBoostFeatures) GetMinCustomBackgroundBoostLevel() (value int32) { } return c.MinCustomBackgroundBoostLevel } + +// GetMinCustomEmojiStickerSetBoostLevel returns value of MinCustomEmojiStickerSetBoostLevel field. +func (c *ChatBoostFeatures) GetMinCustomEmojiStickerSetBoostLevel() (value int32) { + if c == nil { + return + } + return c.MinCustomEmojiStickerSetBoostLevel +} + +// GetMinSpeechRecognitionBoostLevel returns value of MinSpeechRecognitionBoostLevel field. +func (c *ChatBoostFeatures) GetMinSpeechRecognitionBoostLevel() (value int32) { + if c == nil { + return + } + return c.MinSpeechRecognitionBoostLevel +} diff --git a/tdapi/tl_chat_boost_level_features_gen.go b/tdapi/tl_chat_boost_level_features_gen.go index b6879cdc44..b1cf1634b4 100644 --- a/tdapi/tl_chat_boost_level_features_gen.go +++ b/tdapi/tl_chat_boost_level_features_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// ChatBoostLevelFeatures represents TL type `chatBoostLevelFeatures#fe9f29de`. +// ChatBoostLevelFeatures represents TL type `chatBoostLevelFeatures#d248546f`. type ChatBoostLevelFeatures struct { // Target chat boost level Level int32 @@ -56,10 +56,15 @@ type ChatBoostLevelFeatures struct { ChatThemeBackgroundCount int32 // True, if custom background can be set in the chat for all users CanSetCustomBackground bool + // True, if custom emoji sticker set can be set for the chat + CanSetCustomEmojiStickerSet bool + // True, if speech recognition can be used for video note and voice note messages by all + // users + CanRecognizeSpeech bool } // ChatBoostLevelFeaturesTypeID is TL type id of ChatBoostLevelFeatures. -const ChatBoostLevelFeaturesTypeID = 0xfe9f29de +const ChatBoostLevelFeaturesTypeID = 0xd248546f // Ensuring interfaces in compile-time for ChatBoostLevelFeatures. var ( @@ -106,6 +111,12 @@ func (c *ChatBoostLevelFeatures) Zero() bool { if !(c.CanSetCustomBackground == false) { return false } + if !(c.CanSetCustomEmojiStickerSet == false) { + return false + } + if !(c.CanRecognizeSpeech == false) { + return false + } return true } @@ -186,6 +197,14 @@ func (c *ChatBoostLevelFeatures) TypeInfo() tdp.Type { Name: "CanSetCustomBackground", SchemaName: "can_set_custom_background", }, + { + Name: "CanSetCustomEmojiStickerSet", + SchemaName: "can_set_custom_emoji_sticker_set", + }, + { + Name: "CanRecognizeSpeech", + SchemaName: "can_recognize_speech", + }, } return typ } @@ -193,7 +212,7 @@ func (c *ChatBoostLevelFeatures) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *ChatBoostLevelFeatures) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatBoostLevelFeatures#fe9f29de as nil") + return fmt.Errorf("can't encode chatBoostLevelFeatures#d248546f as nil") } b.PutID(ChatBoostLevelFeaturesTypeID) return c.EncodeBare(b) @@ -202,7 +221,7 @@ func (c *ChatBoostLevelFeatures) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatBoostLevelFeatures) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatBoostLevelFeatures#fe9f29de as nil") + return fmt.Errorf("can't encode chatBoostLevelFeatures#d248546f as nil") } b.PutInt32(c.Level) b.PutInt32(c.StoryPerDayCount) @@ -215,16 +234,18 @@ func (c *ChatBoostLevelFeatures) EncodeBare(b *bin.Buffer) error { b.PutBool(c.CanSetEmojiStatus) b.PutInt32(c.ChatThemeBackgroundCount) b.PutBool(c.CanSetCustomBackground) + b.PutBool(c.CanSetCustomEmojiStickerSet) + b.PutBool(c.CanRecognizeSpeech) return nil } // Decode implements bin.Decoder. func (c *ChatBoostLevelFeatures) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatBoostLevelFeatures#fe9f29de to nil") + return fmt.Errorf("can't decode chatBoostLevelFeatures#d248546f to nil") } if err := b.ConsumeID(ChatBoostLevelFeaturesTypeID); err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: %w", err) } return c.DecodeBare(b) } @@ -232,92 +253,106 @@ func (c *ChatBoostLevelFeatures) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatBoostLevelFeatures) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatBoostLevelFeatures#fe9f29de to nil") + return fmt.Errorf("can't decode chatBoostLevelFeatures#d248546f to nil") } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field level: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field level: %w", err) } c.Level = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field story_per_day_count: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field story_per_day_count: %w", err) } c.StoryPerDayCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field custom_emoji_reaction_count: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field custom_emoji_reaction_count: %w", err) } c.CustomEmojiReactionCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field title_color_count: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field title_color_count: %w", err) } c.TitleColorCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field profile_accent_color_count: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field profile_accent_color_count: %w", err) } c.ProfileAccentColorCount = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field can_set_profile_background_custom_emoji: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field can_set_profile_background_custom_emoji: %w", err) } c.CanSetProfileBackgroundCustomEmoji = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field accent_color_count: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field accent_color_count: %w", err) } c.AccentColorCount = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field can_set_background_custom_emoji: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field can_set_background_custom_emoji: %w", err) } c.CanSetBackgroundCustomEmoji = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field can_set_emoji_status: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field can_set_emoji_status: %w", err) } c.CanSetEmojiStatus = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field chat_theme_background_count: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field chat_theme_background_count: %w", err) } c.ChatThemeBackgroundCount = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field can_set_custom_background: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field can_set_custom_background: %w", err) } c.CanSetCustomBackground = value } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field can_set_custom_emoji_sticker_set: %w", err) + } + c.CanSetCustomEmojiStickerSet = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field can_recognize_speech: %w", err) + } + c.CanRecognizeSpeech = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *ChatBoostLevelFeatures) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatBoostLevelFeatures#fe9f29de as nil") + return fmt.Errorf("can't encode chatBoostLevelFeatures#d248546f as nil") } b.ObjStart() b.PutID("chatBoostLevelFeatures") @@ -355,6 +390,12 @@ func (c *ChatBoostLevelFeatures) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("can_set_custom_background") b.PutBool(c.CanSetCustomBackground) b.Comma() + b.FieldStart("can_set_custom_emoji_sticker_set") + b.PutBool(c.CanSetCustomEmojiStickerSet) + b.Comma() + b.FieldStart("can_recognize_speech") + b.PutBool(c.CanRecognizeSpeech) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -363,81 +404,93 @@ func (c *ChatBoostLevelFeatures) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *ChatBoostLevelFeatures) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatBoostLevelFeatures#fe9f29de to nil") + return fmt.Errorf("can't decode chatBoostLevelFeatures#d248546f to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("chatBoostLevelFeatures"); err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: %w", err) } case "level": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field level: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field level: %w", err) } c.Level = value case "story_per_day_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field story_per_day_count: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field story_per_day_count: %w", err) } c.StoryPerDayCount = value case "custom_emoji_reaction_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field custom_emoji_reaction_count: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field custom_emoji_reaction_count: %w", err) } c.CustomEmojiReactionCount = value case "title_color_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field title_color_count: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field title_color_count: %w", err) } c.TitleColorCount = value case "profile_accent_color_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field profile_accent_color_count: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field profile_accent_color_count: %w", err) } c.ProfileAccentColorCount = value case "can_set_profile_background_custom_emoji": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field can_set_profile_background_custom_emoji: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field can_set_profile_background_custom_emoji: %w", err) } c.CanSetProfileBackgroundCustomEmoji = value case "accent_color_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field accent_color_count: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field accent_color_count: %w", err) } c.AccentColorCount = value case "can_set_background_custom_emoji": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field can_set_background_custom_emoji: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field can_set_background_custom_emoji: %w", err) } c.CanSetBackgroundCustomEmoji = value case "can_set_emoji_status": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field can_set_emoji_status: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field can_set_emoji_status: %w", err) } c.CanSetEmojiStatus = value case "chat_theme_background_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field chat_theme_background_count: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field chat_theme_background_count: %w", err) } c.ChatThemeBackgroundCount = value case "can_set_custom_background": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#fe9f29de: field can_set_custom_background: %w", err) + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field can_set_custom_background: %w", err) } c.CanSetCustomBackground = value + case "can_set_custom_emoji_sticker_set": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field can_set_custom_emoji_sticker_set: %w", err) + } + c.CanSetCustomEmojiStickerSet = value + case "can_recognize_speech": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatBoostLevelFeatures#d248546f: field can_recognize_speech: %w", err) + } + c.CanRecognizeSpeech = value default: return b.Skip() } @@ -532,3 +585,19 @@ func (c *ChatBoostLevelFeatures) GetCanSetCustomBackground() (value bool) { } return c.CanSetCustomBackground } + +// GetCanSetCustomEmojiStickerSet returns value of CanSetCustomEmojiStickerSet field. +func (c *ChatBoostLevelFeatures) GetCanSetCustomEmojiStickerSet() (value bool) { + if c == nil { + return + } + return c.CanSetCustomEmojiStickerSet +} + +// GetCanRecognizeSpeech returns value of CanRecognizeSpeech field. +func (c *ChatBoostLevelFeatures) GetCanRecognizeSpeech() (value bool) { + if c == nil { + return + } + return c.CanRecognizeSpeech +} diff --git a/tdapi/tl_chat_event_action_gen.go b/tdapi/tl_chat_event_action_gen.go index 7560e0e6ec..3d9e78aeb1 100644 --- a/tdapi/tl_chat_event_action_gen.go +++ b/tdapi/tl_chat_event_action_gen.go @@ -4540,6 +4540,206 @@ func (c *ChatEventStickerSetChanged) GetNewStickerSetID() (value int64) { return c.NewStickerSetID } +// ChatEventCustomEmojiStickerSetChanged represents TL type `chatEventCustomEmojiStickerSetChanged#70c431b`. +type ChatEventCustomEmojiStickerSetChanged struct { + // Previous identifier of the chat sticker set; 0 if none + OldStickerSetID int64 + // New identifier of the chat sticker set; 0 if none + NewStickerSetID int64 +} + +// ChatEventCustomEmojiStickerSetChangedTypeID is TL type id of ChatEventCustomEmojiStickerSetChanged. +const ChatEventCustomEmojiStickerSetChangedTypeID = 0x70c431b + +// construct implements constructor of ChatEventActionClass. +func (c ChatEventCustomEmojiStickerSetChanged) construct() ChatEventActionClass { return &c } + +// Ensuring interfaces in compile-time for ChatEventCustomEmojiStickerSetChanged. +var ( + _ bin.Encoder = &ChatEventCustomEmojiStickerSetChanged{} + _ bin.Decoder = &ChatEventCustomEmojiStickerSetChanged{} + _ bin.BareEncoder = &ChatEventCustomEmojiStickerSetChanged{} + _ bin.BareDecoder = &ChatEventCustomEmojiStickerSetChanged{} + + _ ChatEventActionClass = &ChatEventCustomEmojiStickerSetChanged{} +) + +func (c *ChatEventCustomEmojiStickerSetChanged) Zero() bool { + if c == nil { + return true + } + if !(c.OldStickerSetID == 0) { + return false + } + if !(c.NewStickerSetID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChatEventCustomEmojiStickerSetChanged) String() string { + if c == nil { + return "ChatEventCustomEmojiStickerSetChanged(nil)" + } + type Alias ChatEventCustomEmojiStickerSetChanged + return fmt.Sprintf("ChatEventCustomEmojiStickerSetChanged%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChatEventCustomEmojiStickerSetChanged) TypeID() uint32 { + return ChatEventCustomEmojiStickerSetChangedTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChatEventCustomEmojiStickerSetChanged) TypeName() string { + return "chatEventCustomEmojiStickerSetChanged" +} + +// TypeInfo returns info about TL type. +func (c *ChatEventCustomEmojiStickerSetChanged) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "chatEventCustomEmojiStickerSetChanged", + ID: ChatEventCustomEmojiStickerSetChangedTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "OldStickerSetID", + SchemaName: "old_sticker_set_id", + }, + { + Name: "NewStickerSetID", + SchemaName: "new_sticker_set_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChatEventCustomEmojiStickerSetChanged) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatEventCustomEmojiStickerSetChanged#70c431b as nil") + } + b.PutID(ChatEventCustomEmojiStickerSetChangedTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChatEventCustomEmojiStickerSetChanged) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatEventCustomEmojiStickerSetChanged#70c431b as nil") + } + b.PutLong(c.OldStickerSetID) + b.PutLong(c.NewStickerSetID) + return nil +} + +// Decode implements bin.Decoder. +func (c *ChatEventCustomEmojiStickerSetChanged) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatEventCustomEmojiStickerSetChanged#70c431b to nil") + } + if err := b.ConsumeID(ChatEventCustomEmojiStickerSetChangedTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventCustomEmojiStickerSetChanged#70c431b: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChatEventCustomEmojiStickerSetChanged) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatEventCustomEmojiStickerSetChanged#70c431b to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode chatEventCustomEmojiStickerSetChanged#70c431b: field old_sticker_set_id: %w", err) + } + c.OldStickerSetID = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode chatEventCustomEmojiStickerSetChanged#70c431b: field new_sticker_set_id: %w", err) + } + c.NewStickerSetID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatEventCustomEmojiStickerSetChanged) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatEventCustomEmojiStickerSetChanged#70c431b as nil") + } + b.ObjStart() + b.PutID("chatEventCustomEmojiStickerSetChanged") + b.Comma() + b.FieldStart("old_sticker_set_id") + b.PutLong(c.OldStickerSetID) + b.Comma() + b.FieldStart("new_sticker_set_id") + b.PutLong(c.NewStickerSetID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ChatEventCustomEmojiStickerSetChanged) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode chatEventCustomEmojiStickerSetChanged#70c431b to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("chatEventCustomEmojiStickerSetChanged"); err != nil { + return fmt.Errorf("unable to decode chatEventCustomEmojiStickerSetChanged#70c431b: %w", err) + } + case "old_sticker_set_id": + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode chatEventCustomEmojiStickerSetChanged#70c431b: field old_sticker_set_id: %w", err) + } + c.OldStickerSetID = value + case "new_sticker_set_id": + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode chatEventCustomEmojiStickerSetChanged#70c431b: field new_sticker_set_id: %w", err) + } + c.NewStickerSetID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetOldStickerSetID returns value of OldStickerSetID field. +func (c *ChatEventCustomEmojiStickerSetChanged) GetOldStickerSetID() (value int64) { + if c == nil { + return + } + return c.OldStickerSetID +} + +// GetNewStickerSetID returns value of NewStickerSetID field. +func (c *ChatEventCustomEmojiStickerSetChanged) GetNewStickerSetID() (value int64) { + if c == nil { + return + } + return c.NewStickerSetID +} + // ChatEventTitleChanged represents TL type `chatEventTitleChanged#43990ad2`. type ChatEventTitleChanged struct { // Previous chat title @@ -9271,6 +9471,7 @@ const ChatEventActionClassName = "ChatEventAction" // case *tdapi.ChatEventPhotoChanged: // chatEventPhotoChanged#cfa062c3 // case *tdapi.ChatEventSlowModeDelayChanged: // chatEventSlowModeDelayChanged#9d763c0b // case *tdapi.ChatEventStickerSetChanged: // chatEventStickerSetChanged#b5e7558f +// case *tdapi.ChatEventCustomEmojiStickerSetChanged: // chatEventCustomEmojiStickerSetChanged#70c431b // case *tdapi.ChatEventTitleChanged: // chatEventTitleChanged#43990ad2 // case *tdapi.ChatEventUsernameChanged: // chatEventUsernameChanged#6707b56b // case *tdapi.ChatEventActiveUsernamesChanged: // chatEventActiveUsernamesChanged#95e54656 @@ -9488,6 +9689,13 @@ func DecodeChatEventAction(buf *bin.Buffer) (ChatEventActionClass, error) { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil + case ChatEventCustomEmojiStickerSetChangedTypeID: + // Decoding chatEventCustomEmojiStickerSetChanged#70c431b. + v := ChatEventCustomEmojiStickerSetChanged{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) + } + return &v, nil case ChatEventTitleChangedTypeID: // Decoding chatEventTitleChanged#43990ad2. v := ChatEventTitleChanged{} @@ -9836,6 +10044,13 @@ func DecodeTDLibJSONChatEventAction(buf tdjson.Decoder) (ChatEventActionClass, e return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil + case "chatEventCustomEmojiStickerSetChanged": + // Decoding chatEventCustomEmojiStickerSetChanged#70c431b. + v := ChatEventCustomEmojiStickerSetChanged{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) + } + return &v, nil case "chatEventTitleChanged": // Decoding chatEventTitleChanged#43990ad2. v := ChatEventTitleChanged{} diff --git a/tdapi/tl_chat_gen.go b/tdapi/tl_chat_gen.go index f882902ba2..78d8724a7c 100644 --- a/tdapi/tl_chat_gen.go +++ b/tdapi/tl_chat_gen.go @@ -70,7 +70,7 @@ type Chat struct { // True, if the chat is marked as unread IsMarkedAsUnread bool // True, if the chat is a forum supergroup that must be shown in the "View as topics" - // mode + // mode, or Saved Messages chat that must be shown in the "View as chats" ViewAsTopics bool // True, if the chat has scheduled messages HasScheduledMessages bool diff --git a/tdapi/tl_create_video_chat_gen.go b/tdapi/tl_create_video_chat_gen.go index 912cac30ce..4b876e974c 100644 --- a/tdapi/tl_create_video_chat_gen.go +++ b/tdapi/tl_create_video_chat_gen.go @@ -41,7 +41,7 @@ type CreateVideoChatRequest struct { // administrator; 0 to start the video chat immediately. The date must be at least 10 // seconds and at most 8 days in the future StartDate int32 - // Pass true to create an RTMP stream instead of an ordinary video chat; requires creator + // Pass true to create an RTMP stream instead of an ordinary video chat; requires owner // privileges IsRtmpStream bool } diff --git a/tdapi/tl_delete_saved_messages_topic_history_gen.go b/tdapi/tl_delete_saved_messages_topic_history_gen.go index 17d00b8705..fcd409f937 100644 --- a/tdapi/tl_delete_saved_messages_topic_history_gen.go +++ b/tdapi/tl_delete_saved_messages_topic_history_gen.go @@ -31,14 +31,14 @@ var ( _ = tdjson.Encoder{} ) -// DeleteSavedMessagesTopicHistoryRequest represents TL type `deleteSavedMessagesTopicHistory#c1dc4e3d`. +// DeleteSavedMessagesTopicHistoryRequest represents TL type `deleteSavedMessagesTopicHistory#69df3d6a`. type DeleteSavedMessagesTopicHistoryRequest struct { - // Saved Messages topic which messages will be deleted - SavedMessagesTopic SavedMessagesTopicClass + // Identifier of Saved Messages topic which messages will be deleted + SavedMessagesTopicID int64 } // DeleteSavedMessagesTopicHistoryRequestTypeID is TL type id of DeleteSavedMessagesTopicHistoryRequest. -const DeleteSavedMessagesTopicHistoryRequestTypeID = 0xc1dc4e3d +const DeleteSavedMessagesTopicHistoryRequestTypeID = 0x69df3d6a // Ensuring interfaces in compile-time for DeleteSavedMessagesTopicHistoryRequest. var ( @@ -52,7 +52,7 @@ func (d *DeleteSavedMessagesTopicHistoryRequest) Zero() bool { if d == nil { return true } - if !(d.SavedMessagesTopic == nil) { + if !(d.SavedMessagesTopicID == 0) { return false } @@ -92,8 +92,8 @@ func (d *DeleteSavedMessagesTopicHistoryRequest) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "SavedMessagesTopic", - SchemaName: "saved_messages_topic", + Name: "SavedMessagesTopicID", + SchemaName: "saved_messages_topic_id", }, } return typ @@ -102,7 +102,7 @@ func (d *DeleteSavedMessagesTopicHistoryRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (d *DeleteSavedMessagesTopicHistoryRequest) Encode(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't encode deleteSavedMessagesTopicHistory#c1dc4e3d as nil") + return fmt.Errorf("can't encode deleteSavedMessagesTopicHistory#69df3d6a as nil") } b.PutID(DeleteSavedMessagesTopicHistoryRequestTypeID) return d.EncodeBare(b) @@ -111,24 +111,19 @@ func (d *DeleteSavedMessagesTopicHistoryRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (d *DeleteSavedMessagesTopicHistoryRequest) EncodeBare(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't encode deleteSavedMessagesTopicHistory#c1dc4e3d as nil") - } - if d.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode deleteSavedMessagesTopicHistory#c1dc4e3d: field saved_messages_topic is nil") - } - if err := d.SavedMessagesTopic.Encode(b); err != nil { - return fmt.Errorf("unable to encode deleteSavedMessagesTopicHistory#c1dc4e3d: field saved_messages_topic: %w", err) + return fmt.Errorf("can't encode deleteSavedMessagesTopicHistory#69df3d6a as nil") } + b.PutInt53(d.SavedMessagesTopicID) return nil } // Decode implements bin.Decoder. func (d *DeleteSavedMessagesTopicHistoryRequest) Decode(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't decode deleteSavedMessagesTopicHistory#c1dc4e3d to nil") + return fmt.Errorf("can't decode deleteSavedMessagesTopicHistory#69df3d6a to nil") } if err := b.ConsumeID(DeleteSavedMessagesTopicHistoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicHistory#c1dc4e3d: %w", err) + return fmt.Errorf("unable to decode deleteSavedMessagesTopicHistory#69df3d6a: %w", err) } return d.DecodeBare(b) } @@ -136,14 +131,14 @@ func (d *DeleteSavedMessagesTopicHistoryRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (d *DeleteSavedMessagesTopicHistoryRequest) DecodeBare(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't decode deleteSavedMessagesTopicHistory#c1dc4e3d to nil") + return fmt.Errorf("can't decode deleteSavedMessagesTopicHistory#69df3d6a to nil") } { - value, err := DecodeSavedMessagesTopic(b) + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicHistory#c1dc4e3d: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode deleteSavedMessagesTopicHistory#69df3d6a: field saved_messages_topic_id: %w", err) } - d.SavedMessagesTopic = value + d.SavedMessagesTopicID = value } return nil } @@ -151,18 +146,13 @@ func (d *DeleteSavedMessagesTopicHistoryRequest) DecodeBare(b *bin.Buffer) error // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (d *DeleteSavedMessagesTopicHistoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if d == nil { - return fmt.Errorf("can't encode deleteSavedMessagesTopicHistory#c1dc4e3d as nil") + return fmt.Errorf("can't encode deleteSavedMessagesTopicHistory#69df3d6a as nil") } b.ObjStart() b.PutID("deleteSavedMessagesTopicHistory") b.Comma() - b.FieldStart("saved_messages_topic") - if d.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode deleteSavedMessagesTopicHistory#c1dc4e3d: field saved_messages_topic is nil") - } - if err := d.SavedMessagesTopic.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode deleteSavedMessagesTopicHistory#c1dc4e3d: field saved_messages_topic: %w", err) - } + b.FieldStart("saved_messages_topic_id") + b.PutInt53(d.SavedMessagesTopicID) b.Comma() b.StripComma() b.ObjEnd() @@ -172,21 +162,21 @@ func (d *DeleteSavedMessagesTopicHistoryRequest) EncodeTDLibJSON(b tdjson.Encode // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (d *DeleteSavedMessagesTopicHistoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if d == nil { - return fmt.Errorf("can't decode deleteSavedMessagesTopicHistory#c1dc4e3d to nil") + return fmt.Errorf("can't decode deleteSavedMessagesTopicHistory#69df3d6a to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("deleteSavedMessagesTopicHistory"); err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicHistory#c1dc4e3d: %w", err) + return fmt.Errorf("unable to decode deleteSavedMessagesTopicHistory#69df3d6a: %w", err) } - case "saved_messages_topic": - value, err := DecodeTDLibJSONSavedMessagesTopic(b) + case "saved_messages_topic_id": + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicHistory#c1dc4e3d: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode deleteSavedMessagesTopicHistory#69df3d6a: field saved_messages_topic_id: %w", err) } - d.SavedMessagesTopic = value + d.SavedMessagesTopicID = value default: return b.Skip() } @@ -194,20 +184,20 @@ func (d *DeleteSavedMessagesTopicHistoryRequest) DecodeTDLibJSON(b tdjson.Decode }) } -// GetSavedMessagesTopic returns value of SavedMessagesTopic field. -func (d *DeleteSavedMessagesTopicHistoryRequest) GetSavedMessagesTopic() (value SavedMessagesTopicClass) { +// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. +func (d *DeleteSavedMessagesTopicHistoryRequest) GetSavedMessagesTopicID() (value int64) { if d == nil { return } - return d.SavedMessagesTopic + return d.SavedMessagesTopicID } -// DeleteSavedMessagesTopicHistory invokes method deleteSavedMessagesTopicHistory#c1dc4e3d returning error if any. -func (c *Client) DeleteSavedMessagesTopicHistory(ctx context.Context, savedmessagestopic SavedMessagesTopicClass) error { +// DeleteSavedMessagesTopicHistory invokes method deleteSavedMessagesTopicHistory#69df3d6a returning error if any. +func (c *Client) DeleteSavedMessagesTopicHistory(ctx context.Context, savedmessagestopicid int64) error { var ok Ok request := &DeleteSavedMessagesTopicHistoryRequest{ - SavedMessagesTopic: savedmessagestopic, + SavedMessagesTopicID: savedmessagestopicid, } if err := c.rpc.Invoke(ctx, request, &ok); err != nil { return err diff --git a/tdapi/tl_delete_saved_messages_topic_messages_by_date_gen.go b/tdapi/tl_delete_saved_messages_topic_messages_by_date_gen.go index 220504b4e2..c08cf7922b 100644 --- a/tdapi/tl_delete_saved_messages_topic_messages_by_date_gen.go +++ b/tdapi/tl_delete_saved_messages_topic_messages_by_date_gen.go @@ -31,10 +31,10 @@ var ( _ = tdjson.Encoder{} ) -// DeleteSavedMessagesTopicMessagesByDateRequest represents TL type `deleteSavedMessagesTopicMessagesByDate#a18f779d`. +// DeleteSavedMessagesTopicMessagesByDateRequest represents TL type `deleteSavedMessagesTopicMessagesByDate#160a25`. type DeleteSavedMessagesTopicMessagesByDateRequest struct { - // Saved Messages topic which messages will be deleted - SavedMessagesTopic SavedMessagesTopicClass + // Identifier of Saved Messages topic which messages will be deleted + SavedMessagesTopicID int64 // The minimum date of the messages to delete MinDate int32 // The maximum date of the messages to delete @@ -42,7 +42,7 @@ type DeleteSavedMessagesTopicMessagesByDateRequest struct { } // DeleteSavedMessagesTopicMessagesByDateRequestTypeID is TL type id of DeleteSavedMessagesTopicMessagesByDateRequest. -const DeleteSavedMessagesTopicMessagesByDateRequestTypeID = 0xa18f779d +const DeleteSavedMessagesTopicMessagesByDateRequestTypeID = 0x160a25 // Ensuring interfaces in compile-time for DeleteSavedMessagesTopicMessagesByDateRequest. var ( @@ -56,7 +56,7 @@ func (d *DeleteSavedMessagesTopicMessagesByDateRequest) Zero() bool { if d == nil { return true } - if !(d.SavedMessagesTopic == nil) { + if !(d.SavedMessagesTopicID == 0) { return false } if !(d.MinDate == 0) { @@ -102,8 +102,8 @@ func (d *DeleteSavedMessagesTopicMessagesByDateRequest) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "SavedMessagesTopic", - SchemaName: "saved_messages_topic", + Name: "SavedMessagesTopicID", + SchemaName: "saved_messages_topic_id", }, { Name: "MinDate", @@ -120,7 +120,7 @@ func (d *DeleteSavedMessagesTopicMessagesByDateRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (d *DeleteSavedMessagesTopicMessagesByDateRequest) Encode(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't encode deleteSavedMessagesTopicMessagesByDate#a18f779d as nil") + return fmt.Errorf("can't encode deleteSavedMessagesTopicMessagesByDate#160a25 as nil") } b.PutID(DeleteSavedMessagesTopicMessagesByDateRequestTypeID) return d.EncodeBare(b) @@ -129,14 +129,9 @@ func (d *DeleteSavedMessagesTopicMessagesByDateRequest) Encode(b *bin.Buffer) er // EncodeBare implements bin.BareEncoder. func (d *DeleteSavedMessagesTopicMessagesByDateRequest) EncodeBare(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't encode deleteSavedMessagesTopicMessagesByDate#a18f779d as nil") - } - if d.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode deleteSavedMessagesTopicMessagesByDate#a18f779d: field saved_messages_topic is nil") - } - if err := d.SavedMessagesTopic.Encode(b); err != nil { - return fmt.Errorf("unable to encode deleteSavedMessagesTopicMessagesByDate#a18f779d: field saved_messages_topic: %w", err) + return fmt.Errorf("can't encode deleteSavedMessagesTopicMessagesByDate#160a25 as nil") } + b.PutInt53(d.SavedMessagesTopicID) b.PutInt32(d.MinDate) b.PutInt32(d.MaxDate) return nil @@ -145,10 +140,10 @@ func (d *DeleteSavedMessagesTopicMessagesByDateRequest) EncodeBare(b *bin.Buffer // Decode implements bin.Decoder. func (d *DeleteSavedMessagesTopicMessagesByDateRequest) Decode(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't decode deleteSavedMessagesTopicMessagesByDate#a18f779d to nil") + return fmt.Errorf("can't decode deleteSavedMessagesTopicMessagesByDate#160a25 to nil") } if err := b.ConsumeID(DeleteSavedMessagesTopicMessagesByDateRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#a18f779d: %w", err) + return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#160a25: %w", err) } return d.DecodeBare(b) } @@ -156,26 +151,26 @@ func (d *DeleteSavedMessagesTopicMessagesByDateRequest) Decode(b *bin.Buffer) er // DecodeBare implements bin.BareDecoder. func (d *DeleteSavedMessagesTopicMessagesByDateRequest) DecodeBare(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't decode deleteSavedMessagesTopicMessagesByDate#a18f779d to nil") + return fmt.Errorf("can't decode deleteSavedMessagesTopicMessagesByDate#160a25 to nil") } { - value, err := DecodeSavedMessagesTopic(b) + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#a18f779d: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#160a25: field saved_messages_topic_id: %w", err) } - d.SavedMessagesTopic = value + d.SavedMessagesTopicID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#a18f779d: field min_date: %w", err) + return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#160a25: field min_date: %w", err) } d.MinDate = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#a18f779d: field max_date: %w", err) + return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#160a25: field max_date: %w", err) } d.MaxDate = value } @@ -185,18 +180,13 @@ func (d *DeleteSavedMessagesTopicMessagesByDateRequest) DecodeBare(b *bin.Buffer // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (d *DeleteSavedMessagesTopicMessagesByDateRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if d == nil { - return fmt.Errorf("can't encode deleteSavedMessagesTopicMessagesByDate#a18f779d as nil") + return fmt.Errorf("can't encode deleteSavedMessagesTopicMessagesByDate#160a25 as nil") } b.ObjStart() b.PutID("deleteSavedMessagesTopicMessagesByDate") b.Comma() - b.FieldStart("saved_messages_topic") - if d.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode deleteSavedMessagesTopicMessagesByDate#a18f779d: field saved_messages_topic is nil") - } - if err := d.SavedMessagesTopic.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode deleteSavedMessagesTopicMessagesByDate#a18f779d: field saved_messages_topic: %w", err) - } + b.FieldStart("saved_messages_topic_id") + b.PutInt53(d.SavedMessagesTopicID) b.Comma() b.FieldStart("min_date") b.PutInt32(d.MinDate) @@ -212,31 +202,31 @@ func (d *DeleteSavedMessagesTopicMessagesByDateRequest) EncodeTDLibJSON(b tdjson // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (d *DeleteSavedMessagesTopicMessagesByDateRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if d == nil { - return fmt.Errorf("can't decode deleteSavedMessagesTopicMessagesByDate#a18f779d to nil") + return fmt.Errorf("can't decode deleteSavedMessagesTopicMessagesByDate#160a25 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("deleteSavedMessagesTopicMessagesByDate"); err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#a18f779d: %w", err) + return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#160a25: %w", err) } - case "saved_messages_topic": - value, err := DecodeTDLibJSONSavedMessagesTopic(b) + case "saved_messages_topic_id": + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#a18f779d: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#160a25: field saved_messages_topic_id: %w", err) } - d.SavedMessagesTopic = value + d.SavedMessagesTopicID = value case "min_date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#a18f779d: field min_date: %w", err) + return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#160a25: field min_date: %w", err) } d.MinDate = value case "max_date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#a18f779d: field max_date: %w", err) + return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#160a25: field max_date: %w", err) } d.MaxDate = value default: @@ -246,12 +236,12 @@ func (d *DeleteSavedMessagesTopicMessagesByDateRequest) DecodeTDLibJSON(b tdjson }) } -// GetSavedMessagesTopic returns value of SavedMessagesTopic field. -func (d *DeleteSavedMessagesTopicMessagesByDateRequest) GetSavedMessagesTopic() (value SavedMessagesTopicClass) { +// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. +func (d *DeleteSavedMessagesTopicMessagesByDateRequest) GetSavedMessagesTopicID() (value int64) { if d == nil { return } - return d.SavedMessagesTopic + return d.SavedMessagesTopicID } // GetMinDate returns value of MinDate field. @@ -270,7 +260,7 @@ func (d *DeleteSavedMessagesTopicMessagesByDateRequest) GetMaxDate() (value int3 return d.MaxDate } -// DeleteSavedMessagesTopicMessagesByDate invokes method deleteSavedMessagesTopicMessagesByDate#a18f779d returning error if any. +// DeleteSavedMessagesTopicMessagesByDate invokes method deleteSavedMessagesTopicMessagesByDate#160a25 returning error if any. func (c *Client) DeleteSavedMessagesTopicMessagesByDate(ctx context.Context, request *DeleteSavedMessagesTopicMessagesByDateRequest) error { var ok Ok diff --git a/tdapi/tl_draft_message_gen.go b/tdapi/tl_draft_message_gen.go index 91288c8eac..c6f945f018 100644 --- a/tdapi/tl_draft_message_gen.go +++ b/tdapi/tl_draft_message_gen.go @@ -38,7 +38,8 @@ type DraftMessage struct { ReplyTo InputMessageReplyToClass // Point in time (Unix timestamp) when the draft was created Date int32 - // Content of the message draft; must be of the type inputMessageText + // Content of the message draft; must be of the type inputMessageText, + // inputMessageVideoNote, or inputMessageVoiceNote InputMessageText InputMessageContentClass } diff --git a/tdapi/tl_forward_messages_gen.go b/tdapi/tl_forward_messages_gen.go index 96d2895349..dcea2db3af 100644 --- a/tdapi/tl_forward_messages_gen.go +++ b/tdapi/tl_forward_messages_gen.go @@ -35,7 +35,7 @@ var ( type ForwardMessagesRequest struct { // Identifier of the chat to which to forward messages ChatID int64 - // If not 0, a message thread identifier in which the message will be sent; for forum + // If not 0, the message thread identifier in which the message will be sent; for forum // threads only MessageThreadID int64 // Identifier of the chat from which to forward messages diff --git a/tdapi/tl_found_saved_messages_topic_gen.go b/tdapi/tl_found_saved_messages_topic_gen.go deleted file mode 100644 index ce15e2c6ad..0000000000 --- a/tdapi/tl_found_saved_messages_topic_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// 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{} -) - -// FoundSavedMessagesTopic represents TL type `foundSavedMessagesTopic#240681ec`. -type FoundSavedMessagesTopic struct { - // The topic - Topic SavedMessagesTopicClass - // Last message in the topic; may be null if none or unknown - LastMessage Message -} - -// FoundSavedMessagesTopicTypeID is TL type id of FoundSavedMessagesTopic. -const FoundSavedMessagesTopicTypeID = 0x240681ec - -// Ensuring interfaces in compile-time for FoundSavedMessagesTopic. -var ( - _ bin.Encoder = &FoundSavedMessagesTopic{} - _ bin.Decoder = &FoundSavedMessagesTopic{} - _ bin.BareEncoder = &FoundSavedMessagesTopic{} - _ bin.BareDecoder = &FoundSavedMessagesTopic{} -) - -func (f *FoundSavedMessagesTopic) Zero() bool { - if f == nil { - return true - } - if !(f.Topic == nil) { - return false - } - if !(f.LastMessage.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FoundSavedMessagesTopic) String() string { - if f == nil { - return "FoundSavedMessagesTopic(nil)" - } - type Alias FoundSavedMessagesTopic - return fmt.Sprintf("FoundSavedMessagesTopic%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FoundSavedMessagesTopic) TypeID() uint32 { - return FoundSavedMessagesTopicTypeID -} - -// TypeName returns name of type in TL schema. -func (*FoundSavedMessagesTopic) TypeName() string { - return "foundSavedMessagesTopic" -} - -// TypeInfo returns info about TL type. -func (f *FoundSavedMessagesTopic) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "foundSavedMessagesTopic", - ID: FoundSavedMessagesTopicTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Topic", - SchemaName: "topic", - }, - { - Name: "LastMessage", - SchemaName: "last_message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FoundSavedMessagesTopic) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundSavedMessagesTopic#240681ec as nil") - } - b.PutID(FoundSavedMessagesTopicTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FoundSavedMessagesTopic) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundSavedMessagesTopic#240681ec as nil") - } - if f.Topic == nil { - return fmt.Errorf("unable to encode foundSavedMessagesTopic#240681ec: field topic is nil") - } - if err := f.Topic.Encode(b); err != nil { - return fmt.Errorf("unable to encode foundSavedMessagesTopic#240681ec: field topic: %w", err) - } - if err := f.LastMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode foundSavedMessagesTopic#240681ec: field last_message: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FoundSavedMessagesTopic) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundSavedMessagesTopic#240681ec to nil") - } - if err := b.ConsumeID(FoundSavedMessagesTopicTypeID); err != nil { - return fmt.Errorf("unable to decode foundSavedMessagesTopic#240681ec: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FoundSavedMessagesTopic) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundSavedMessagesTopic#240681ec to nil") - } - { - value, err := DecodeSavedMessagesTopic(b) - if err != nil { - return fmt.Errorf("unable to decode foundSavedMessagesTopic#240681ec: field topic: %w", err) - } - f.Topic = value - } - { - if err := f.LastMessage.Decode(b); err != nil { - return fmt.Errorf("unable to decode foundSavedMessagesTopic#240681ec: field last_message: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FoundSavedMessagesTopic) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode foundSavedMessagesTopic#240681ec as nil") - } - b.ObjStart() - b.PutID("foundSavedMessagesTopic") - b.Comma() - b.FieldStart("topic") - if f.Topic == nil { - return fmt.Errorf("unable to encode foundSavedMessagesTopic#240681ec: field topic is nil") - } - if err := f.Topic.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode foundSavedMessagesTopic#240681ec: field topic: %w", err) - } - b.Comma() - b.FieldStart("last_message") - if err := f.LastMessage.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode foundSavedMessagesTopic#240681ec: field last_message: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FoundSavedMessagesTopic) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode foundSavedMessagesTopic#240681ec to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("foundSavedMessagesTopic"); err != nil { - return fmt.Errorf("unable to decode foundSavedMessagesTopic#240681ec: %w", err) - } - case "topic": - value, err := DecodeTDLibJSONSavedMessagesTopic(b) - if err != nil { - return fmt.Errorf("unable to decode foundSavedMessagesTopic#240681ec: field topic: %w", err) - } - f.Topic = value - case "last_message": - if err := f.LastMessage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode foundSavedMessagesTopic#240681ec: field last_message: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTopic returns value of Topic field. -func (f *FoundSavedMessagesTopic) GetTopic() (value SavedMessagesTopicClass) { - if f == nil { - return - } - return f.Topic -} - -// GetLastMessage returns value of LastMessage field. -func (f *FoundSavedMessagesTopic) GetLastMessage() (value Message) { - if f == nil { - return - } - return f.LastMessage -} diff --git a/tdapi/tl_found_saved_messages_topics_gen.go b/tdapi/tl_found_saved_messages_topics_gen.go deleted file mode 100644 index c61a4969d5..0000000000 --- a/tdapi/tl_found_saved_messages_topics_gen.go +++ /dev/null @@ -1,289 +0,0 @@ -// 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{} -) - -// FoundSavedMessagesTopics represents TL type `foundSavedMessagesTopics#60f30fbf`. -type FoundSavedMessagesTopics struct { - // Total number of Saved Messages topics found - TotalCount int32 - // List of Saved Messages topics - Topics []FoundSavedMessagesTopic - // The offset for the next request. If empty, then there are no more results - NextOffset string -} - -// FoundSavedMessagesTopicsTypeID is TL type id of FoundSavedMessagesTopics. -const FoundSavedMessagesTopicsTypeID = 0x60f30fbf - -// Ensuring interfaces in compile-time for FoundSavedMessagesTopics. -var ( - _ bin.Encoder = &FoundSavedMessagesTopics{} - _ bin.Decoder = &FoundSavedMessagesTopics{} - _ bin.BareEncoder = &FoundSavedMessagesTopics{} - _ bin.BareDecoder = &FoundSavedMessagesTopics{} -) - -func (f *FoundSavedMessagesTopics) Zero() bool { - if f == nil { - return true - } - if !(f.TotalCount == 0) { - return false - } - if !(f.Topics == nil) { - return false - } - if !(f.NextOffset == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FoundSavedMessagesTopics) String() string { - if f == nil { - return "FoundSavedMessagesTopics(nil)" - } - type Alias FoundSavedMessagesTopics - return fmt.Sprintf("FoundSavedMessagesTopics%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FoundSavedMessagesTopics) TypeID() uint32 { - return FoundSavedMessagesTopicsTypeID -} - -// TypeName returns name of type in TL schema. -func (*FoundSavedMessagesTopics) TypeName() string { - return "foundSavedMessagesTopics" -} - -// TypeInfo returns info about TL type. -func (f *FoundSavedMessagesTopics) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "foundSavedMessagesTopics", - ID: FoundSavedMessagesTopicsTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Topics", - SchemaName: "topics", - }, - { - Name: "NextOffset", - SchemaName: "next_offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FoundSavedMessagesTopics) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundSavedMessagesTopics#60f30fbf as nil") - } - b.PutID(FoundSavedMessagesTopicsTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FoundSavedMessagesTopics) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundSavedMessagesTopics#60f30fbf 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 foundSavedMessagesTopics#60f30fbf: field topics element with index %d: %w", idx, err) - } - } - b.PutString(f.NextOffset) - return nil -} - -// Decode implements bin.Decoder. -func (f *FoundSavedMessagesTopics) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundSavedMessagesTopics#60f30fbf to nil") - } - if err := b.ConsumeID(FoundSavedMessagesTopicsTypeID); err != nil { - return fmt.Errorf("unable to decode foundSavedMessagesTopics#60f30fbf: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FoundSavedMessagesTopics) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundSavedMessagesTopics#60f30fbf to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode foundSavedMessagesTopics#60f30fbf: field total_count: %w", err) - } - f.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode foundSavedMessagesTopics#60f30fbf: field topics: %w", err) - } - - if headerLen > 0 { - f.Topics = make([]FoundSavedMessagesTopic, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value FoundSavedMessagesTopic - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare foundSavedMessagesTopics#60f30fbf: field topics: %w", err) - } - f.Topics = append(f.Topics, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode foundSavedMessagesTopics#60f30fbf: field next_offset: %w", err) - } - f.NextOffset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FoundSavedMessagesTopics) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode foundSavedMessagesTopics#60f30fbf as nil") - } - b.ObjStart() - b.PutID("foundSavedMessagesTopics") - 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 foundSavedMessagesTopics#60f30fbf: field topics element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("next_offset") - b.PutString(f.NextOffset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FoundSavedMessagesTopics) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode foundSavedMessagesTopics#60f30fbf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("foundSavedMessagesTopics"); err != nil { - return fmt.Errorf("unable to decode foundSavedMessagesTopics#60f30fbf: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode foundSavedMessagesTopics#60f30fbf: field total_count: %w", err) - } - f.TotalCount = value - case "topics": - if err := b.Arr(func(b tdjson.Decoder) error { - var value FoundSavedMessagesTopic - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode foundSavedMessagesTopics#60f30fbf: field topics: %w", err) - } - f.Topics = append(f.Topics, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode foundSavedMessagesTopics#60f30fbf: field topics: %w", err) - } - case "next_offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode foundSavedMessagesTopics#60f30fbf: field next_offset: %w", err) - } - f.NextOffset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (f *FoundSavedMessagesTopics) GetTotalCount() (value int32) { - if f == nil { - return - } - return f.TotalCount -} - -// GetTopics returns value of Topics field. -func (f *FoundSavedMessagesTopics) GetTopics() (value []FoundSavedMessagesTopic) { - if f == nil { - return - } - return f.Topics -} - -// GetNextOffset returns value of NextOffset field. -func (f *FoundSavedMessagesTopics) GetNextOffset() (value string) { - if f == nil { - return - } - return f.NextOffset -} diff --git a/tdapi/tl_get_chat_boost_features_gen.go b/tdapi/tl_get_chat_boost_features_gen.go index 537f6edcc9..29f4e83b40 100644 --- a/tdapi/tl_get_chat_boost_features_gen.go +++ b/tdapi/tl_get_chat_boost_features_gen.go @@ -31,12 +31,15 @@ var ( _ = tdjson.Encoder{} ) -// GetChatBoostFeaturesRequest represents TL type `getChatBoostFeatures#34e76822`. +// GetChatBoostFeaturesRequest represents TL type `getChatBoostFeatures#e8c128a0`. type GetChatBoostFeaturesRequest struct { + // Pass true to get the list of features for channels; pass false to get the list of + // features for supergroups + IsChannel bool } // GetChatBoostFeaturesRequestTypeID is TL type id of GetChatBoostFeaturesRequest. -const GetChatBoostFeaturesRequestTypeID = 0x34e76822 +const GetChatBoostFeaturesRequestTypeID = 0xe8c128a0 // Ensuring interfaces in compile-time for GetChatBoostFeaturesRequest. var ( @@ -50,6 +53,9 @@ func (g *GetChatBoostFeaturesRequest) Zero() bool { if g == nil { return true } + if !(g.IsChannel == false) { + return false + } return true } @@ -85,14 +91,19 @@ func (g *GetChatBoostFeaturesRequest) TypeInfo() tdp.Type { typ.Null = true return typ } - typ.Fields = []tdp.Field{} + typ.Fields = []tdp.Field{ + { + Name: "IsChannel", + SchemaName: "is_channel", + }, + } return typ } // Encode implements bin.Encoder. func (g *GetChatBoostFeaturesRequest) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode getChatBoostFeatures#34e76822 as nil") + return fmt.Errorf("can't encode getChatBoostFeatures#e8c128a0 as nil") } b.PutID(GetChatBoostFeaturesRequestTypeID) return g.EncodeBare(b) @@ -101,18 +112,19 @@ func (g *GetChatBoostFeaturesRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (g *GetChatBoostFeaturesRequest) EncodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode getChatBoostFeatures#34e76822 as nil") + return fmt.Errorf("can't encode getChatBoostFeatures#e8c128a0 as nil") } + b.PutBool(g.IsChannel) return nil } // Decode implements bin.Decoder. func (g *GetChatBoostFeaturesRequest) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode getChatBoostFeatures#34e76822 to nil") + return fmt.Errorf("can't decode getChatBoostFeatures#e8c128a0 to nil") } if err := b.ConsumeID(GetChatBoostFeaturesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatBoostFeatures#34e76822: %w", err) + return fmt.Errorf("unable to decode getChatBoostFeatures#e8c128a0: %w", err) } return g.DecodeBare(b) } @@ -120,7 +132,14 @@ func (g *GetChatBoostFeaturesRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (g *GetChatBoostFeaturesRequest) DecodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode getChatBoostFeatures#34e76822 to nil") + return fmt.Errorf("can't decode getChatBoostFeatures#e8c128a0 to nil") + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode getChatBoostFeatures#e8c128a0: field is_channel: %w", err) + } + g.IsChannel = value } return nil } @@ -128,11 +147,14 @@ func (g *GetChatBoostFeaturesRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (g *GetChatBoostFeaturesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if g == nil { - return fmt.Errorf("can't encode getChatBoostFeatures#34e76822 as nil") + return fmt.Errorf("can't encode getChatBoostFeatures#e8c128a0 as nil") } b.ObjStart() b.PutID("getChatBoostFeatures") b.Comma() + b.FieldStart("is_channel") + b.PutBool(g.IsChannel) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -141,15 +163,21 @@ func (g *GetChatBoostFeaturesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (g *GetChatBoostFeaturesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if g == nil { - return fmt.Errorf("can't decode getChatBoostFeatures#34e76822 to nil") + return fmt.Errorf("can't decode getChatBoostFeatures#e8c128a0 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("getChatBoostFeatures"); err != nil { - return fmt.Errorf("unable to decode getChatBoostFeatures#34e76822: %w", err) + return fmt.Errorf("unable to decode getChatBoostFeatures#e8c128a0: %w", err) + } + case "is_channel": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode getChatBoostFeatures#e8c128a0: field is_channel: %w", err) } + g.IsChannel = value default: return b.Skip() } @@ -157,11 +185,21 @@ func (g *GetChatBoostFeaturesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetChatBoostFeatures invokes method getChatBoostFeatures#34e76822 returning error if any. -func (c *Client) GetChatBoostFeatures(ctx context.Context) (*ChatBoostFeatures, error) { +// GetIsChannel returns value of IsChannel field. +func (g *GetChatBoostFeaturesRequest) GetIsChannel() (value bool) { + if g == nil { + return + } + return g.IsChannel +} + +// GetChatBoostFeatures invokes method getChatBoostFeatures#e8c128a0 returning error if any. +func (c *Client) GetChatBoostFeatures(ctx context.Context, ischannel bool) (*ChatBoostFeatures, error) { var result ChatBoostFeatures - request := &GetChatBoostFeaturesRequest{} + request := &GetChatBoostFeaturesRequest{ + IsChannel: ischannel, + } if err := c.rpc.Invoke(ctx, request, &result); err != nil { return nil, err } diff --git a/tdapi/tl_get_chat_boost_level_features_gen.go b/tdapi/tl_get_chat_boost_level_features_gen.go index f0626a0c97..4854624f21 100644 --- a/tdapi/tl_get_chat_boost_level_features_gen.go +++ b/tdapi/tl_get_chat_boost_level_features_gen.go @@ -31,14 +31,17 @@ var ( _ = tdjson.Encoder{} ) -// GetChatBoostLevelFeaturesRequest represents TL type `getChatBoostLevelFeatures#71f15dfb`. +// GetChatBoostLevelFeaturesRequest represents TL type `getChatBoostLevelFeatures#45e63e8b`. type GetChatBoostLevelFeaturesRequest struct { + // Pass true to get the list of features for channels; pass false to get the list of + // features for supergroups + IsChannel bool // Chat boost level Level int32 } // GetChatBoostLevelFeaturesRequestTypeID is TL type id of GetChatBoostLevelFeaturesRequest. -const GetChatBoostLevelFeaturesRequestTypeID = 0x71f15dfb +const GetChatBoostLevelFeaturesRequestTypeID = 0x45e63e8b // Ensuring interfaces in compile-time for GetChatBoostLevelFeaturesRequest. var ( @@ -52,6 +55,9 @@ func (g *GetChatBoostLevelFeaturesRequest) Zero() bool { if g == nil { return true } + if !(g.IsChannel == false) { + return false + } if !(g.Level == 0) { return false } @@ -91,6 +97,10 @@ func (g *GetChatBoostLevelFeaturesRequest) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "IsChannel", + SchemaName: "is_channel", + }, { Name: "Level", SchemaName: "level", @@ -102,7 +112,7 @@ func (g *GetChatBoostLevelFeaturesRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (g *GetChatBoostLevelFeaturesRequest) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode getChatBoostLevelFeatures#71f15dfb as nil") + return fmt.Errorf("can't encode getChatBoostLevelFeatures#45e63e8b as nil") } b.PutID(GetChatBoostLevelFeaturesRequestTypeID) return g.EncodeBare(b) @@ -111,8 +121,9 @@ func (g *GetChatBoostLevelFeaturesRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (g *GetChatBoostLevelFeaturesRequest) EncodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode getChatBoostLevelFeatures#71f15dfb as nil") + return fmt.Errorf("can't encode getChatBoostLevelFeatures#45e63e8b as nil") } + b.PutBool(g.IsChannel) b.PutInt32(g.Level) return nil } @@ -120,10 +131,10 @@ func (g *GetChatBoostLevelFeaturesRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (g *GetChatBoostLevelFeaturesRequest) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode getChatBoostLevelFeatures#71f15dfb to nil") + return fmt.Errorf("can't decode getChatBoostLevelFeatures#45e63e8b to nil") } if err := b.ConsumeID(GetChatBoostLevelFeaturesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatBoostLevelFeatures#71f15dfb: %w", err) + return fmt.Errorf("unable to decode getChatBoostLevelFeatures#45e63e8b: %w", err) } return g.DecodeBare(b) } @@ -131,12 +142,19 @@ func (g *GetChatBoostLevelFeaturesRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (g *GetChatBoostLevelFeaturesRequest) DecodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode getChatBoostLevelFeatures#71f15dfb to nil") + return fmt.Errorf("can't decode getChatBoostLevelFeatures#45e63e8b to nil") + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode getChatBoostLevelFeatures#45e63e8b: field is_channel: %w", err) + } + g.IsChannel = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode getChatBoostLevelFeatures#71f15dfb: field level: %w", err) + return fmt.Errorf("unable to decode getChatBoostLevelFeatures#45e63e8b: field level: %w", err) } g.Level = value } @@ -146,11 +164,14 @@ func (g *GetChatBoostLevelFeaturesRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (g *GetChatBoostLevelFeaturesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if g == nil { - return fmt.Errorf("can't encode getChatBoostLevelFeatures#71f15dfb as nil") + return fmt.Errorf("can't encode getChatBoostLevelFeatures#45e63e8b as nil") } b.ObjStart() b.PutID("getChatBoostLevelFeatures") b.Comma() + b.FieldStart("is_channel") + b.PutBool(g.IsChannel) + b.Comma() b.FieldStart("level") b.PutInt32(g.Level) b.Comma() @@ -162,19 +183,25 @@ func (g *GetChatBoostLevelFeaturesRequest) EncodeTDLibJSON(b tdjson.Encoder) err // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (g *GetChatBoostLevelFeaturesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if g == nil { - return fmt.Errorf("can't decode getChatBoostLevelFeatures#71f15dfb to nil") + return fmt.Errorf("can't decode getChatBoostLevelFeatures#45e63e8b to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("getChatBoostLevelFeatures"); err != nil { - return fmt.Errorf("unable to decode getChatBoostLevelFeatures#71f15dfb: %w", err) + return fmt.Errorf("unable to decode getChatBoostLevelFeatures#45e63e8b: %w", err) } + case "is_channel": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode getChatBoostLevelFeatures#45e63e8b: field is_channel: %w", err) + } + g.IsChannel = value case "level": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode getChatBoostLevelFeatures#71f15dfb: field level: %w", err) + return fmt.Errorf("unable to decode getChatBoostLevelFeatures#45e63e8b: field level: %w", err) } g.Level = value default: @@ -184,6 +211,14 @@ func (g *GetChatBoostLevelFeaturesRequest) DecodeTDLibJSON(b tdjson.Decoder) err }) } +// GetIsChannel returns value of IsChannel field. +func (g *GetChatBoostLevelFeaturesRequest) GetIsChannel() (value bool) { + if g == nil { + return + } + return g.IsChannel +} + // GetLevel returns value of Level field. func (g *GetChatBoostLevelFeaturesRequest) GetLevel() (value int32) { if g == nil { @@ -192,13 +227,10 @@ func (g *GetChatBoostLevelFeaturesRequest) GetLevel() (value int32) { return g.Level } -// GetChatBoostLevelFeatures invokes method getChatBoostLevelFeatures#71f15dfb returning error if any. -func (c *Client) GetChatBoostLevelFeatures(ctx context.Context, level int32) (*ChatBoostLevelFeatures, error) { +// GetChatBoostLevelFeatures invokes method getChatBoostLevelFeatures#45e63e8b returning error if any. +func (c *Client) GetChatBoostLevelFeatures(ctx context.Context, request *GetChatBoostLevelFeaturesRequest) (*ChatBoostLevelFeatures, error) { var result ChatBoostLevelFeatures - request := &GetChatBoostLevelFeaturesRequest{ - Level: level, - } if err := c.rpc.Invoke(ctx, request, &result); err != nil { return nil, err } diff --git a/tdapi/tl_get_chat_boost_status_gen.go b/tdapi/tl_get_chat_boost_status_gen.go index 5e3f1c12d9..db0e4037ec 100644 --- a/tdapi/tl_get_chat_boost_status_gen.go +++ b/tdapi/tl_get_chat_boost_status_gen.go @@ -33,7 +33,7 @@ var ( // GetChatBoostStatusRequest represents TL type `getChatBoostStatus#cfac8acf`. type GetChatBoostStatusRequest struct { - // Identifier of the channel chat + // Identifier of the chat ChatID int64 } diff --git a/tdapi/tl_get_chat_message_calendar_gen.go b/tdapi/tl_get_chat_message_calendar_gen.go index 7b7dda2a67..f79cbdedd8 100644 --- a/tdapi/tl_get_chat_message_calendar_gen.go +++ b/tdapi/tl_get_chat_message_calendar_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// GetChatMessageCalendarRequest represents TL type `getChatMessageCalendar#69fdc3d2`. +// GetChatMessageCalendarRequest represents TL type `getChatMessageCalendar#81af2db7`. type GetChatMessageCalendarRequest struct { // Identifier of the chat in which to return information about messages ChatID int64 @@ -42,13 +42,13 @@ type GetChatMessageCalendarRequest struct { // The message identifier from which to return information about messages; use 0 to get // results from the last message FromMessageID int64 - // If not null, only messages in the specified Saved Messages topic will be considered; - // pass null to consider all messages, or for chats other than Saved Messages - SavedMessagesTopic SavedMessagesTopicClass + // If not0, only messages in the specified Saved Messages topic will be considered; pass + // 0 to consider all messages, or for chats other than Saved Messages + SavedMessagesTopicID int64 } // GetChatMessageCalendarRequestTypeID is TL type id of GetChatMessageCalendarRequest. -const GetChatMessageCalendarRequestTypeID = 0x69fdc3d2 +const GetChatMessageCalendarRequestTypeID = 0x81af2db7 // Ensuring interfaces in compile-time for GetChatMessageCalendarRequest. var ( @@ -71,7 +71,7 @@ func (g *GetChatMessageCalendarRequest) Zero() bool { if !(g.FromMessageID == 0) { return false } - if !(g.SavedMessagesTopic == nil) { + if !(g.SavedMessagesTopicID == 0) { return false } @@ -123,8 +123,8 @@ func (g *GetChatMessageCalendarRequest) TypeInfo() tdp.Type { SchemaName: "from_message_id", }, { - Name: "SavedMessagesTopic", - SchemaName: "saved_messages_topic", + Name: "SavedMessagesTopicID", + SchemaName: "saved_messages_topic_id", }, } return typ @@ -133,7 +133,7 @@ func (g *GetChatMessageCalendarRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (g *GetChatMessageCalendarRequest) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode getChatMessageCalendar#69fdc3d2 as nil") + return fmt.Errorf("can't encode getChatMessageCalendar#81af2db7 as nil") } b.PutID(GetChatMessageCalendarRequestTypeID) return g.EncodeBare(b) @@ -142,32 +142,27 @@ func (g *GetChatMessageCalendarRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (g *GetChatMessageCalendarRequest) EncodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode getChatMessageCalendar#69fdc3d2 as nil") + return fmt.Errorf("can't encode getChatMessageCalendar#81af2db7 as nil") } b.PutInt53(g.ChatID) if g.Filter == nil { - return fmt.Errorf("unable to encode getChatMessageCalendar#69fdc3d2: field filter is nil") + return fmt.Errorf("unable to encode getChatMessageCalendar#81af2db7: field filter is nil") } if err := g.Filter.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChatMessageCalendar#69fdc3d2: field filter: %w", err) + return fmt.Errorf("unable to encode getChatMessageCalendar#81af2db7: field filter: %w", err) } b.PutInt53(g.FromMessageID) - if g.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode getChatMessageCalendar#69fdc3d2: field saved_messages_topic is nil") - } - if err := g.SavedMessagesTopic.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChatMessageCalendar#69fdc3d2: field saved_messages_topic: %w", err) - } + b.PutInt53(g.SavedMessagesTopicID) return nil } // Decode implements bin.Decoder. func (g *GetChatMessageCalendarRequest) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode getChatMessageCalendar#69fdc3d2 to nil") + return fmt.Errorf("can't decode getChatMessageCalendar#81af2db7 to nil") } if err := b.ConsumeID(GetChatMessageCalendarRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatMessageCalendar#69fdc3d2: %w", err) + return fmt.Errorf("unable to decode getChatMessageCalendar#81af2db7: %w", err) } return g.DecodeBare(b) } @@ -175,35 +170,35 @@ func (g *GetChatMessageCalendarRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (g *GetChatMessageCalendarRequest) DecodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode getChatMessageCalendar#69fdc3d2 to nil") + return fmt.Errorf("can't decode getChatMessageCalendar#81af2db7 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatMessageCalendar#69fdc3d2: field chat_id: %w", err) + return fmt.Errorf("unable to decode getChatMessageCalendar#81af2db7: field chat_id: %w", err) } g.ChatID = value } { value, err := DecodeSearchMessagesFilter(b) if err != nil { - return fmt.Errorf("unable to decode getChatMessageCalendar#69fdc3d2: field filter: %w", err) + return fmt.Errorf("unable to decode getChatMessageCalendar#81af2db7: field filter: %w", err) } g.Filter = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatMessageCalendar#69fdc3d2: field from_message_id: %w", err) + return fmt.Errorf("unable to decode getChatMessageCalendar#81af2db7: field from_message_id: %w", err) } g.FromMessageID = value } { - value, err := DecodeSavedMessagesTopic(b) + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatMessageCalendar#69fdc3d2: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode getChatMessageCalendar#81af2db7: field saved_messages_topic_id: %w", err) } - g.SavedMessagesTopic = value + g.SavedMessagesTopicID = value } return nil } @@ -211,7 +206,7 @@ func (g *GetChatMessageCalendarRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (g *GetChatMessageCalendarRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if g == nil { - return fmt.Errorf("can't encode getChatMessageCalendar#69fdc3d2 as nil") + return fmt.Errorf("can't encode getChatMessageCalendar#81af2db7 as nil") } b.ObjStart() b.PutID("getChatMessageCalendar") @@ -221,22 +216,17 @@ func (g *GetChatMessageCalendarRequest) EncodeTDLibJSON(b tdjson.Encoder) error b.Comma() b.FieldStart("filter") if g.Filter == nil { - return fmt.Errorf("unable to encode getChatMessageCalendar#69fdc3d2: field filter is nil") + return fmt.Errorf("unable to encode getChatMessageCalendar#81af2db7: field filter is nil") } if err := g.Filter.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChatMessageCalendar#69fdc3d2: field filter: %w", err) + return fmt.Errorf("unable to encode getChatMessageCalendar#81af2db7: field filter: %w", err) } b.Comma() b.FieldStart("from_message_id") b.PutInt53(g.FromMessageID) b.Comma() - b.FieldStart("saved_messages_topic") - if g.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode getChatMessageCalendar#69fdc3d2: field saved_messages_topic is nil") - } - if err := g.SavedMessagesTopic.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChatMessageCalendar#69fdc3d2: field saved_messages_topic: %w", err) - } + b.FieldStart("saved_messages_topic_id") + b.PutInt53(g.SavedMessagesTopicID) b.Comma() b.StripComma() b.ObjEnd() @@ -246,39 +236,39 @@ func (g *GetChatMessageCalendarRequest) EncodeTDLibJSON(b tdjson.Encoder) error // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (g *GetChatMessageCalendarRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if g == nil { - return fmt.Errorf("can't decode getChatMessageCalendar#69fdc3d2 to nil") + return fmt.Errorf("can't decode getChatMessageCalendar#81af2db7 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("getChatMessageCalendar"); err != nil { - return fmt.Errorf("unable to decode getChatMessageCalendar#69fdc3d2: %w", err) + return fmt.Errorf("unable to decode getChatMessageCalendar#81af2db7: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatMessageCalendar#69fdc3d2: field chat_id: %w", err) + return fmt.Errorf("unable to decode getChatMessageCalendar#81af2db7: field chat_id: %w", err) } g.ChatID = value case "filter": value, err := DecodeTDLibJSONSearchMessagesFilter(b) if err != nil { - return fmt.Errorf("unable to decode getChatMessageCalendar#69fdc3d2: field filter: %w", err) + return fmt.Errorf("unable to decode getChatMessageCalendar#81af2db7: field filter: %w", err) } g.Filter = value case "from_message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatMessageCalendar#69fdc3d2: field from_message_id: %w", err) + return fmt.Errorf("unable to decode getChatMessageCalendar#81af2db7: field from_message_id: %w", err) } g.FromMessageID = value - case "saved_messages_topic": - value, err := DecodeTDLibJSONSavedMessagesTopic(b) + case "saved_messages_topic_id": + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatMessageCalendar#69fdc3d2: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode getChatMessageCalendar#81af2db7: field saved_messages_topic_id: %w", err) } - g.SavedMessagesTopic = value + g.SavedMessagesTopicID = value default: return b.Skip() } @@ -310,15 +300,15 @@ func (g *GetChatMessageCalendarRequest) GetFromMessageID() (value int64) { return g.FromMessageID } -// GetSavedMessagesTopic returns value of SavedMessagesTopic field. -func (g *GetChatMessageCalendarRequest) GetSavedMessagesTopic() (value SavedMessagesTopicClass) { +// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. +func (g *GetChatMessageCalendarRequest) GetSavedMessagesTopicID() (value int64) { if g == nil { return } - return g.SavedMessagesTopic + return g.SavedMessagesTopicID } -// GetChatMessageCalendar invokes method getChatMessageCalendar#69fdc3d2 returning error if any. +// GetChatMessageCalendar invokes method getChatMessageCalendar#81af2db7 returning error if any. func (c *Client) GetChatMessageCalendar(ctx context.Context, request *GetChatMessageCalendarRequest) (*MessageCalendar, error) { var result MessageCalendar diff --git a/tdapi/tl_get_chat_message_count_gen.go b/tdapi/tl_get_chat_message_count_gen.go index 0344c7a411..95cfdf2b59 100644 --- a/tdapi/tl_get_chat_message_count_gen.go +++ b/tdapi/tl_get_chat_message_count_gen.go @@ -31,22 +31,22 @@ var ( _ = tdjson.Encoder{} ) -// GetChatMessageCountRequest represents TL type `getChatMessageCount#d1d1952d`. +// GetChatMessageCountRequest represents TL type `getChatMessageCount#38f78909`. type GetChatMessageCountRequest struct { // Identifier of the chat in which to count messages ChatID int64 // Filter for message content; searchMessagesFilterEmpty is unsupported in this function Filter SearchMessagesFilterClass - // If not null, only messages in the specified Saved Messages topic will be counted; pass - // null to count all messages, or for chats other than Saved Messages - SavedMessagesTopic SavedMessagesTopicClass + // If not 0, only messages in the specified Saved Messages topic will be counted; pass 0 + // to count all messages, or for chats other than Saved Messages + SavedMessagesTopicID int64 // Pass true to get the number of messages without sending network requests, or -1 if the // number of messages is unknown locally ReturnLocal bool } // GetChatMessageCountRequestTypeID is TL type id of GetChatMessageCountRequest. -const GetChatMessageCountRequestTypeID = 0xd1d1952d +const GetChatMessageCountRequestTypeID = 0x38f78909 // Ensuring interfaces in compile-time for GetChatMessageCountRequest. var ( @@ -66,7 +66,7 @@ func (g *GetChatMessageCountRequest) Zero() bool { if !(g.Filter == nil) { return false } - if !(g.SavedMessagesTopic == nil) { + if !(g.SavedMessagesTopicID == 0) { return false } if !(g.ReturnLocal == false) { @@ -117,8 +117,8 @@ func (g *GetChatMessageCountRequest) TypeInfo() tdp.Type { SchemaName: "filter", }, { - Name: "SavedMessagesTopic", - SchemaName: "saved_messages_topic", + Name: "SavedMessagesTopicID", + SchemaName: "saved_messages_topic_id", }, { Name: "ReturnLocal", @@ -131,7 +131,7 @@ func (g *GetChatMessageCountRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (g *GetChatMessageCountRequest) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode getChatMessageCount#d1d1952d as nil") + return fmt.Errorf("can't encode getChatMessageCount#38f78909 as nil") } b.PutID(GetChatMessageCountRequestTypeID) return g.EncodeBare(b) @@ -140,21 +140,16 @@ func (g *GetChatMessageCountRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (g *GetChatMessageCountRequest) EncodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode getChatMessageCount#d1d1952d as nil") + return fmt.Errorf("can't encode getChatMessageCount#38f78909 as nil") } b.PutInt53(g.ChatID) if g.Filter == nil { - return fmt.Errorf("unable to encode getChatMessageCount#d1d1952d: field filter is nil") + return fmt.Errorf("unable to encode getChatMessageCount#38f78909: field filter is nil") } if err := g.Filter.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChatMessageCount#d1d1952d: field filter: %w", err) - } - if g.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode getChatMessageCount#d1d1952d: field saved_messages_topic is nil") - } - if err := g.SavedMessagesTopic.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChatMessageCount#d1d1952d: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to encode getChatMessageCount#38f78909: field filter: %w", err) } + b.PutInt53(g.SavedMessagesTopicID) b.PutBool(g.ReturnLocal) return nil } @@ -162,10 +157,10 @@ func (g *GetChatMessageCountRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (g *GetChatMessageCountRequest) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode getChatMessageCount#d1d1952d to nil") + return fmt.Errorf("can't decode getChatMessageCount#38f78909 to nil") } if err := b.ConsumeID(GetChatMessageCountRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatMessageCount#d1d1952d: %w", err) + return fmt.Errorf("unable to decode getChatMessageCount#38f78909: %w", err) } return g.DecodeBare(b) } @@ -173,33 +168,33 @@ func (g *GetChatMessageCountRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (g *GetChatMessageCountRequest) DecodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode getChatMessageCount#d1d1952d to nil") + return fmt.Errorf("can't decode getChatMessageCount#38f78909 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatMessageCount#d1d1952d: field chat_id: %w", err) + return fmt.Errorf("unable to decode getChatMessageCount#38f78909: field chat_id: %w", err) } g.ChatID = value } { value, err := DecodeSearchMessagesFilter(b) if err != nil { - return fmt.Errorf("unable to decode getChatMessageCount#d1d1952d: field filter: %w", err) + return fmt.Errorf("unable to decode getChatMessageCount#38f78909: field filter: %w", err) } g.Filter = value } { - value, err := DecodeSavedMessagesTopic(b) + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatMessageCount#d1d1952d: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode getChatMessageCount#38f78909: field saved_messages_topic_id: %w", err) } - g.SavedMessagesTopic = value + g.SavedMessagesTopicID = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode getChatMessageCount#d1d1952d: field return_local: %w", err) + return fmt.Errorf("unable to decode getChatMessageCount#38f78909: field return_local: %w", err) } g.ReturnLocal = value } @@ -209,7 +204,7 @@ func (g *GetChatMessageCountRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (g *GetChatMessageCountRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if g == nil { - return fmt.Errorf("can't encode getChatMessageCount#d1d1952d as nil") + return fmt.Errorf("can't encode getChatMessageCount#38f78909 as nil") } b.ObjStart() b.PutID("getChatMessageCount") @@ -219,19 +214,14 @@ func (g *GetChatMessageCountRequest) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("filter") if g.Filter == nil { - return fmt.Errorf("unable to encode getChatMessageCount#d1d1952d: field filter is nil") + return fmt.Errorf("unable to encode getChatMessageCount#38f78909: field filter is nil") } if err := g.Filter.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChatMessageCount#d1d1952d: field filter: %w", err) + return fmt.Errorf("unable to encode getChatMessageCount#38f78909: field filter: %w", err) } b.Comma() - b.FieldStart("saved_messages_topic") - if g.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode getChatMessageCount#d1d1952d: field saved_messages_topic is nil") - } - if err := g.SavedMessagesTopic.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChatMessageCount#d1d1952d: field saved_messages_topic: %w", err) - } + b.FieldStart("saved_messages_topic_id") + b.PutInt53(g.SavedMessagesTopicID) b.Comma() b.FieldStart("return_local") b.PutBool(g.ReturnLocal) @@ -244,37 +234,37 @@ func (g *GetChatMessageCountRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (g *GetChatMessageCountRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if g == nil { - return fmt.Errorf("can't decode getChatMessageCount#d1d1952d to nil") + return fmt.Errorf("can't decode getChatMessageCount#38f78909 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("getChatMessageCount"); err != nil { - return fmt.Errorf("unable to decode getChatMessageCount#d1d1952d: %w", err) + return fmt.Errorf("unable to decode getChatMessageCount#38f78909: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatMessageCount#d1d1952d: field chat_id: %w", err) + return fmt.Errorf("unable to decode getChatMessageCount#38f78909: field chat_id: %w", err) } g.ChatID = value case "filter": value, err := DecodeTDLibJSONSearchMessagesFilter(b) if err != nil { - return fmt.Errorf("unable to decode getChatMessageCount#d1d1952d: field filter: %w", err) + return fmt.Errorf("unable to decode getChatMessageCount#38f78909: field filter: %w", err) } g.Filter = value - case "saved_messages_topic": - value, err := DecodeTDLibJSONSavedMessagesTopic(b) + case "saved_messages_topic_id": + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatMessageCount#d1d1952d: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode getChatMessageCount#38f78909: field saved_messages_topic_id: %w", err) } - g.SavedMessagesTopic = value + g.SavedMessagesTopicID = value case "return_local": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode getChatMessageCount#d1d1952d: field return_local: %w", err) + return fmt.Errorf("unable to decode getChatMessageCount#38f78909: field return_local: %w", err) } g.ReturnLocal = value default: @@ -300,12 +290,12 @@ func (g *GetChatMessageCountRequest) GetFilter() (value SearchMessagesFilterClas return g.Filter } -// GetSavedMessagesTopic returns value of SavedMessagesTopic field. -func (g *GetChatMessageCountRequest) GetSavedMessagesTopic() (value SavedMessagesTopicClass) { +// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. +func (g *GetChatMessageCountRequest) GetSavedMessagesTopicID() (value int64) { if g == nil { return } - return g.SavedMessagesTopic + return g.SavedMessagesTopicID } // GetReturnLocal returns value of ReturnLocal field. @@ -316,7 +306,7 @@ func (g *GetChatMessageCountRequest) GetReturnLocal() (value bool) { return g.ReturnLocal } -// GetChatMessageCount invokes method getChatMessageCount#d1d1952d returning error if any. +// GetChatMessageCount invokes method getChatMessageCount#38f78909 returning error if any. func (c *Client) GetChatMessageCount(ctx context.Context, request *GetChatMessageCountRequest) (*Count, error) { var result Count diff --git a/tdapi/tl_get_chat_message_position_gen.go b/tdapi/tl_get_chat_message_position_gen.go index c3d1ef5bdb..f7cc1f9468 100644 --- a/tdapi/tl_get_chat_message_position_gen.go +++ b/tdapi/tl_get_chat_message_position_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// GetChatMessagePositionRequest represents TL type `getChatMessagePosition#e9d7d767`. +// GetChatMessagePositionRequest represents TL type `getChatMessagePosition#81bfcc7`. type GetChatMessagePositionRequest struct { // Identifier of the chat in which to find message position ChatID int64 @@ -43,13 +43,13 @@ type GetChatMessagePositionRequest struct { Filter SearchMessagesFilterClass // If not 0, only messages in the specified thread will be considered; supergroups only MessageThreadID int64 - // If not null, only messages in the specified Saved Messages topic will be considered; - // pass null to consider all relevant messages, or for chats other than Saved Messages - SavedMessagesTopic SavedMessagesTopicClass + // If not 0, only messages in the specified Saved Messages topic will be considered; pass + // 0 to consider all relevant messages, or for chats other than Saved Messages + SavedMessagesTopicID int64 } // GetChatMessagePositionRequestTypeID is TL type id of GetChatMessagePositionRequest. -const GetChatMessagePositionRequestTypeID = 0xe9d7d767 +const GetChatMessagePositionRequestTypeID = 0x81bfcc7 // Ensuring interfaces in compile-time for GetChatMessagePositionRequest. var ( @@ -75,7 +75,7 @@ func (g *GetChatMessagePositionRequest) Zero() bool { if !(g.MessageThreadID == 0) { return false } - if !(g.SavedMessagesTopic == nil) { + if !(g.SavedMessagesTopicID == 0) { return false } @@ -131,8 +131,8 @@ func (g *GetChatMessagePositionRequest) TypeInfo() tdp.Type { SchemaName: "message_thread_id", }, { - Name: "SavedMessagesTopic", - SchemaName: "saved_messages_topic", + Name: "SavedMessagesTopicID", + SchemaName: "saved_messages_topic_id", }, } return typ @@ -141,7 +141,7 @@ func (g *GetChatMessagePositionRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (g *GetChatMessagePositionRequest) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode getChatMessagePosition#e9d7d767 as nil") + return fmt.Errorf("can't encode getChatMessagePosition#81bfcc7 as nil") } b.PutID(GetChatMessagePositionRequestTypeID) return g.EncodeBare(b) @@ -150,33 +150,28 @@ func (g *GetChatMessagePositionRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (g *GetChatMessagePositionRequest) EncodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode getChatMessagePosition#e9d7d767 as nil") + return fmt.Errorf("can't encode getChatMessagePosition#81bfcc7 as nil") } b.PutInt53(g.ChatID) b.PutInt53(g.MessageID) if g.Filter == nil { - return fmt.Errorf("unable to encode getChatMessagePosition#e9d7d767: field filter is nil") + return fmt.Errorf("unable to encode getChatMessagePosition#81bfcc7: field filter is nil") } if err := g.Filter.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChatMessagePosition#e9d7d767: field filter: %w", err) + return fmt.Errorf("unable to encode getChatMessagePosition#81bfcc7: field filter: %w", err) } b.PutInt53(g.MessageThreadID) - if g.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode getChatMessagePosition#e9d7d767: field saved_messages_topic is nil") - } - if err := g.SavedMessagesTopic.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChatMessagePosition#e9d7d767: field saved_messages_topic: %w", err) - } + b.PutInt53(g.SavedMessagesTopicID) return nil } // Decode implements bin.Decoder. func (g *GetChatMessagePositionRequest) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode getChatMessagePosition#e9d7d767 to nil") + return fmt.Errorf("can't decode getChatMessagePosition#81bfcc7 to nil") } if err := b.ConsumeID(GetChatMessagePositionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#e9d7d767: %w", err) + return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: %w", err) } return g.DecodeBare(b) } @@ -184,42 +179,42 @@ func (g *GetChatMessagePositionRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (g *GetChatMessagePositionRequest) DecodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode getChatMessagePosition#e9d7d767 to nil") + return fmt.Errorf("can't decode getChatMessagePosition#81bfcc7 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#e9d7d767: field chat_id: %w", err) + return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: field chat_id: %w", err) } g.ChatID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#e9d7d767: field message_id: %w", err) + return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: field message_id: %w", err) } g.MessageID = value } { value, err := DecodeSearchMessagesFilter(b) if err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#e9d7d767: field filter: %w", err) + return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: field filter: %w", err) } g.Filter = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#e9d7d767: field message_thread_id: %w", err) + return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: field message_thread_id: %w", err) } g.MessageThreadID = value } { - value, err := DecodeSavedMessagesTopic(b) + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#e9d7d767: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: field saved_messages_topic_id: %w", err) } - g.SavedMessagesTopic = value + g.SavedMessagesTopicID = value } return nil } @@ -227,7 +222,7 @@ func (g *GetChatMessagePositionRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (g *GetChatMessagePositionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if g == nil { - return fmt.Errorf("can't encode getChatMessagePosition#e9d7d767 as nil") + return fmt.Errorf("can't encode getChatMessagePosition#81bfcc7 as nil") } b.ObjStart() b.PutID("getChatMessagePosition") @@ -240,22 +235,17 @@ func (g *GetChatMessagePositionRequest) EncodeTDLibJSON(b tdjson.Encoder) error b.Comma() b.FieldStart("filter") if g.Filter == nil { - return fmt.Errorf("unable to encode getChatMessagePosition#e9d7d767: field filter is nil") + return fmt.Errorf("unable to encode getChatMessagePosition#81bfcc7: field filter is nil") } if err := g.Filter.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChatMessagePosition#e9d7d767: field filter: %w", err) + return fmt.Errorf("unable to encode getChatMessagePosition#81bfcc7: field filter: %w", err) } b.Comma() b.FieldStart("message_thread_id") b.PutInt53(g.MessageThreadID) b.Comma() - b.FieldStart("saved_messages_topic") - if g.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode getChatMessagePosition#e9d7d767: field saved_messages_topic is nil") - } - if err := g.SavedMessagesTopic.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChatMessagePosition#e9d7d767: field saved_messages_topic: %w", err) - } + b.FieldStart("saved_messages_topic_id") + b.PutInt53(g.SavedMessagesTopicID) b.Comma() b.StripComma() b.ObjEnd() @@ -265,45 +255,45 @@ func (g *GetChatMessagePositionRequest) EncodeTDLibJSON(b tdjson.Encoder) error // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (g *GetChatMessagePositionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if g == nil { - return fmt.Errorf("can't decode getChatMessagePosition#e9d7d767 to nil") + return fmt.Errorf("can't decode getChatMessagePosition#81bfcc7 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("getChatMessagePosition"); err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#e9d7d767: %w", err) + return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#e9d7d767: field chat_id: %w", err) + return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: field chat_id: %w", err) } g.ChatID = value case "message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#e9d7d767: field message_id: %w", err) + return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: field message_id: %w", err) } g.MessageID = value case "filter": value, err := DecodeTDLibJSONSearchMessagesFilter(b) if err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#e9d7d767: field filter: %w", err) + return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: field filter: %w", err) } g.Filter = value case "message_thread_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#e9d7d767: field message_thread_id: %w", err) + return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: field message_thread_id: %w", err) } g.MessageThreadID = value - case "saved_messages_topic": - value, err := DecodeTDLibJSONSavedMessagesTopic(b) + case "saved_messages_topic_id": + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#e9d7d767: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: field saved_messages_topic_id: %w", err) } - g.SavedMessagesTopic = value + g.SavedMessagesTopicID = value default: return b.Skip() } @@ -343,15 +333,15 @@ func (g *GetChatMessagePositionRequest) GetMessageThreadID() (value int64) { return g.MessageThreadID } -// GetSavedMessagesTopic returns value of SavedMessagesTopic field. -func (g *GetChatMessagePositionRequest) GetSavedMessagesTopic() (value SavedMessagesTopicClass) { +// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. +func (g *GetChatMessagePositionRequest) GetSavedMessagesTopicID() (value int64) { if g == nil { return } - return g.SavedMessagesTopic + return g.SavedMessagesTopicID } -// GetChatMessagePosition invokes method getChatMessagePosition#e9d7d767 returning error if any. +// GetChatMessagePosition invokes method getChatMessagePosition#81bfcc7 returning error if any. func (c *Client) GetChatMessagePosition(ctx context.Context, request *GetChatMessagePositionRequest) (*Count, error) { var result Count diff --git a/tdapi/tl_get_chat_sparse_message_positions_gen.go b/tdapi/tl_get_chat_sparse_message_positions_gen.go index 35825fc48a..2747c6d915 100644 --- a/tdapi/tl_get_chat_sparse_message_positions_gen.go +++ b/tdapi/tl_get_chat_sparse_message_positions_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// GetChatSparseMessagePositionsRequest represents TL type `getChatSparseMessagePositions#7a9bab8e`. +// GetChatSparseMessagePositionsRequest represents TL type `getChatSparseMessagePositions#3b452efd`. type GetChatSparseMessagePositionsRequest struct { // Identifier of the chat in which to return information about message positions ChatID int64 @@ -44,13 +44,13 @@ type GetChatSparseMessagePositionsRequest struct { // The expected number of message positions to be returned; 50-2000. A smaller number of // positions can be returned, if there are not enough appropriate messages Limit int32 - // If not null, only messages in the specified Saved Messages topic will be considered; - // pass null to consider all messages, or for chats other than Saved Messages - SavedMessagesTopic SavedMessagesTopicClass + // If not 0, only messages in the specified Saved Messages topic will be considered; pass + // 0 to consider all messages, or for chats other than Saved Messages + SavedMessagesTopicID int64 } // GetChatSparseMessagePositionsRequestTypeID is TL type id of GetChatSparseMessagePositionsRequest. -const GetChatSparseMessagePositionsRequestTypeID = 0x7a9bab8e +const GetChatSparseMessagePositionsRequestTypeID = 0x3b452efd // Ensuring interfaces in compile-time for GetChatSparseMessagePositionsRequest. var ( @@ -76,7 +76,7 @@ func (g *GetChatSparseMessagePositionsRequest) Zero() bool { if !(g.Limit == 0) { return false } - if !(g.SavedMessagesTopic == nil) { + if !(g.SavedMessagesTopicID == 0) { return false } @@ -132,8 +132,8 @@ func (g *GetChatSparseMessagePositionsRequest) TypeInfo() tdp.Type { SchemaName: "limit", }, { - Name: "SavedMessagesTopic", - SchemaName: "saved_messages_topic", + Name: "SavedMessagesTopicID", + SchemaName: "saved_messages_topic_id", }, } return typ @@ -142,7 +142,7 @@ func (g *GetChatSparseMessagePositionsRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (g *GetChatSparseMessagePositionsRequest) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode getChatSparseMessagePositions#7a9bab8e as nil") + return fmt.Errorf("can't encode getChatSparseMessagePositions#3b452efd as nil") } b.PutID(GetChatSparseMessagePositionsRequestTypeID) return g.EncodeBare(b) @@ -151,33 +151,28 @@ func (g *GetChatSparseMessagePositionsRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (g *GetChatSparseMessagePositionsRequest) EncodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode getChatSparseMessagePositions#7a9bab8e as nil") + return fmt.Errorf("can't encode getChatSparseMessagePositions#3b452efd as nil") } b.PutInt53(g.ChatID) if g.Filter == nil { - return fmt.Errorf("unable to encode getChatSparseMessagePositions#7a9bab8e: field filter is nil") + return fmt.Errorf("unable to encode getChatSparseMessagePositions#3b452efd: field filter is nil") } if err := g.Filter.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChatSparseMessagePositions#7a9bab8e: field filter: %w", err) + return fmt.Errorf("unable to encode getChatSparseMessagePositions#3b452efd: field filter: %w", err) } b.PutInt53(g.FromMessageID) b.PutInt32(g.Limit) - if g.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode getChatSparseMessagePositions#7a9bab8e: field saved_messages_topic is nil") - } - if err := g.SavedMessagesTopic.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChatSparseMessagePositions#7a9bab8e: field saved_messages_topic: %w", err) - } + b.PutInt53(g.SavedMessagesTopicID) return nil } // Decode implements bin.Decoder. func (g *GetChatSparseMessagePositionsRequest) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode getChatSparseMessagePositions#7a9bab8e to nil") + return fmt.Errorf("can't decode getChatSparseMessagePositions#3b452efd to nil") } if err := b.ConsumeID(GetChatSparseMessagePositionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#7a9bab8e: %w", err) + return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: %w", err) } return g.DecodeBare(b) } @@ -185,42 +180,42 @@ func (g *GetChatSparseMessagePositionsRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (g *GetChatSparseMessagePositionsRequest) DecodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode getChatSparseMessagePositions#7a9bab8e to nil") + return fmt.Errorf("can't decode getChatSparseMessagePositions#3b452efd to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#7a9bab8e: field chat_id: %w", err) + return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: field chat_id: %w", err) } g.ChatID = value } { value, err := DecodeSearchMessagesFilter(b) if err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#7a9bab8e: field filter: %w", err) + return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: field filter: %w", err) } g.Filter = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#7a9bab8e: field from_message_id: %w", err) + return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: field from_message_id: %w", err) } g.FromMessageID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#7a9bab8e: field limit: %w", err) + return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: field limit: %w", err) } g.Limit = value } { - value, err := DecodeSavedMessagesTopic(b) + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#7a9bab8e: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: field saved_messages_topic_id: %w", err) } - g.SavedMessagesTopic = value + g.SavedMessagesTopicID = value } return nil } @@ -228,7 +223,7 @@ func (g *GetChatSparseMessagePositionsRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (g *GetChatSparseMessagePositionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if g == nil { - return fmt.Errorf("can't encode getChatSparseMessagePositions#7a9bab8e as nil") + return fmt.Errorf("can't encode getChatSparseMessagePositions#3b452efd as nil") } b.ObjStart() b.PutID("getChatSparseMessagePositions") @@ -238,10 +233,10 @@ func (g *GetChatSparseMessagePositionsRequest) EncodeTDLibJSON(b tdjson.Encoder) b.Comma() b.FieldStart("filter") if g.Filter == nil { - return fmt.Errorf("unable to encode getChatSparseMessagePositions#7a9bab8e: field filter is nil") + return fmt.Errorf("unable to encode getChatSparseMessagePositions#3b452efd: field filter is nil") } if err := g.Filter.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChatSparseMessagePositions#7a9bab8e: field filter: %w", err) + return fmt.Errorf("unable to encode getChatSparseMessagePositions#3b452efd: field filter: %w", err) } b.Comma() b.FieldStart("from_message_id") @@ -250,13 +245,8 @@ func (g *GetChatSparseMessagePositionsRequest) EncodeTDLibJSON(b tdjson.Encoder) b.FieldStart("limit") b.PutInt32(g.Limit) b.Comma() - b.FieldStart("saved_messages_topic") - if g.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode getChatSparseMessagePositions#7a9bab8e: field saved_messages_topic is nil") - } - if err := g.SavedMessagesTopic.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChatSparseMessagePositions#7a9bab8e: field saved_messages_topic: %w", err) - } + b.FieldStart("saved_messages_topic_id") + b.PutInt53(g.SavedMessagesTopicID) b.Comma() b.StripComma() b.ObjEnd() @@ -266,45 +256,45 @@ func (g *GetChatSparseMessagePositionsRequest) EncodeTDLibJSON(b tdjson.Encoder) // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (g *GetChatSparseMessagePositionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if g == nil { - return fmt.Errorf("can't decode getChatSparseMessagePositions#7a9bab8e to nil") + return fmt.Errorf("can't decode getChatSparseMessagePositions#3b452efd to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("getChatSparseMessagePositions"); err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#7a9bab8e: %w", err) + return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#7a9bab8e: field chat_id: %w", err) + return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: field chat_id: %w", err) } g.ChatID = value case "filter": value, err := DecodeTDLibJSONSearchMessagesFilter(b) if err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#7a9bab8e: field filter: %w", err) + return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: field filter: %w", err) } g.Filter = value case "from_message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#7a9bab8e: field from_message_id: %w", err) + return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: field from_message_id: %w", err) } g.FromMessageID = value case "limit": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#7a9bab8e: field limit: %w", err) + return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: field limit: %w", err) } g.Limit = value - case "saved_messages_topic": - value, err := DecodeTDLibJSONSavedMessagesTopic(b) + case "saved_messages_topic_id": + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#7a9bab8e: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: field saved_messages_topic_id: %w", err) } - g.SavedMessagesTopic = value + g.SavedMessagesTopicID = value default: return b.Skip() } @@ -344,15 +334,15 @@ func (g *GetChatSparseMessagePositionsRequest) GetLimit() (value int32) { return g.Limit } -// GetSavedMessagesTopic returns value of SavedMessagesTopic field. -func (g *GetChatSparseMessagePositionsRequest) GetSavedMessagesTopic() (value SavedMessagesTopicClass) { +// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. +func (g *GetChatSparseMessagePositionsRequest) GetSavedMessagesTopicID() (value int64) { if g == nil { return } - return g.SavedMessagesTopic + return g.SavedMessagesTopicID } -// GetChatSparseMessagePositions invokes method getChatSparseMessagePositions#7a9bab8e returning error if any. +// GetChatSparseMessagePositions invokes method getChatSparseMessagePositions#3b452efd returning error if any. func (c *Client) GetChatSparseMessagePositions(ctx context.Context, request *GetChatSparseMessagePositionsRequest) (*MessagePositions, error) { var result MessagePositions diff --git a/tdapi/tl_get_message_import_confirmation_text_gen.go b/tdapi/tl_get_message_import_confirmation_text_gen.go index 369e39eebe..047ed1e8c8 100644 --- a/tdapi/tl_get_message_import_confirmation_text_gen.go +++ b/tdapi/tl_get_message_import_confirmation_text_gen.go @@ -35,7 +35,7 @@ var ( type GetMessageImportConfirmationTextRequest struct { // Identifier of a chat to which the messages will be imported. It must be an identifier // of a private chat with a mutual contact or an identifier of a supergroup chat with - // can_change_info administrator right + // can_change_info member right ChatID int64 } diff --git a/tdapi/tl_get_pinned_saved_messages_topics_gen.go b/tdapi/tl_get_pinned_saved_messages_topics_gen.go deleted file mode 100644 index e8e8bde154..0000000000 --- a/tdapi/tl_get_pinned_saved_messages_topics_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// 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{} -) - -// GetPinnedSavedMessagesTopicsRequest represents TL type `getPinnedSavedMessagesTopics#8555e144`. -type GetPinnedSavedMessagesTopicsRequest struct { -} - -// GetPinnedSavedMessagesTopicsRequestTypeID is TL type id of GetPinnedSavedMessagesTopicsRequest. -const GetPinnedSavedMessagesTopicsRequestTypeID = 0x8555e144 - -// Ensuring interfaces in compile-time for GetPinnedSavedMessagesTopicsRequest. -var ( - _ bin.Encoder = &GetPinnedSavedMessagesTopicsRequest{} - _ bin.Decoder = &GetPinnedSavedMessagesTopicsRequest{} - _ bin.BareEncoder = &GetPinnedSavedMessagesTopicsRequest{} - _ bin.BareDecoder = &GetPinnedSavedMessagesTopicsRequest{} -) - -func (g *GetPinnedSavedMessagesTopicsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPinnedSavedMessagesTopicsRequest) String() string { - if g == nil { - return "GetPinnedSavedMessagesTopicsRequest(nil)" - } - type Alias GetPinnedSavedMessagesTopicsRequest - return fmt.Sprintf("GetPinnedSavedMessagesTopicsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPinnedSavedMessagesTopicsRequest) TypeID() uint32 { - return GetPinnedSavedMessagesTopicsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPinnedSavedMessagesTopicsRequest) TypeName() string { - return "getPinnedSavedMessagesTopics" -} - -// TypeInfo returns info about TL type. -func (g *GetPinnedSavedMessagesTopicsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPinnedSavedMessagesTopics", - ID: GetPinnedSavedMessagesTopicsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPinnedSavedMessagesTopicsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPinnedSavedMessagesTopics#8555e144 as nil") - } - b.PutID(GetPinnedSavedMessagesTopicsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPinnedSavedMessagesTopicsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPinnedSavedMessagesTopics#8555e144 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPinnedSavedMessagesTopicsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPinnedSavedMessagesTopics#8555e144 to nil") - } - if err := b.ConsumeID(GetPinnedSavedMessagesTopicsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPinnedSavedMessagesTopics#8555e144: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPinnedSavedMessagesTopicsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPinnedSavedMessagesTopics#8555e144 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPinnedSavedMessagesTopicsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPinnedSavedMessagesTopics#8555e144 as nil") - } - b.ObjStart() - b.PutID("getPinnedSavedMessagesTopics") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPinnedSavedMessagesTopicsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPinnedSavedMessagesTopics#8555e144 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPinnedSavedMessagesTopics"); err != nil { - return fmt.Errorf("unable to decode getPinnedSavedMessagesTopics#8555e144: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPinnedSavedMessagesTopics invokes method getPinnedSavedMessagesTopics#8555e144 returning error if any. -func (c *Client) GetPinnedSavedMessagesTopics(ctx context.Context) (*FoundSavedMessagesTopics, error) { - var result FoundSavedMessagesTopics - - request := &GetPinnedSavedMessagesTopicsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_premium_gift_code_payment_options_gen.go b/tdapi/tl_get_premium_gift_code_payment_options_gen.go index e1f2324140..9a1fdb3713 100644 --- a/tdapi/tl_get_premium_gift_code_payment_options_gen.go +++ b/tdapi/tl_get_premium_gift_code_payment_options_gen.go @@ -33,8 +33,8 @@ var ( // GetPremiumGiftCodePaymentOptionsRequest represents TL type `getPremiumGiftCodePaymentOptions#89523a2c`. type GetPremiumGiftCodePaymentOptionsRequest struct { - // Identifier of the channel chat, which will be automatically boosted by receivers of - // the gift codes and which is administered by the user; 0 if none + // Identifier of the supergroup or channel chat, which will be automatically boosted by + // receivers of the gift codes and which is administered by the user; 0 if none BoostedChatID int64 } diff --git a/tdapi/tl_get_saved_messages_tags_gen.go b/tdapi/tl_get_saved_messages_tags_gen.go index 963cf183ea..b5e191f223 100644 --- a/tdapi/tl_get_saved_messages_tags_gen.go +++ b/tdapi/tl_get_saved_messages_tags_gen.go @@ -31,12 +31,15 @@ var ( _ = tdjson.Encoder{} ) -// GetSavedMessagesTagsRequest represents TL type `getSavedMessagesTags#611591cb`. +// GetSavedMessagesTagsRequest represents TL type `getSavedMessagesTags#8cd667a9`. type GetSavedMessagesTagsRequest struct { + // Identifier of Saved Messages topic which tags will be returned; pass 0 to get all + // Saved Messages tags + SavedMessagesTopicID int64 } // GetSavedMessagesTagsRequestTypeID is TL type id of GetSavedMessagesTagsRequest. -const GetSavedMessagesTagsRequestTypeID = 0x611591cb +const GetSavedMessagesTagsRequestTypeID = 0x8cd667a9 // Ensuring interfaces in compile-time for GetSavedMessagesTagsRequest. var ( @@ -50,6 +53,9 @@ func (g *GetSavedMessagesTagsRequest) Zero() bool { if g == nil { return true } + if !(g.SavedMessagesTopicID == 0) { + return false + } return true } @@ -85,14 +91,19 @@ func (g *GetSavedMessagesTagsRequest) TypeInfo() tdp.Type { typ.Null = true return typ } - typ.Fields = []tdp.Field{} + typ.Fields = []tdp.Field{ + { + Name: "SavedMessagesTopicID", + SchemaName: "saved_messages_topic_id", + }, + } return typ } // Encode implements bin.Encoder. func (g *GetSavedMessagesTagsRequest) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTags#611591cb as nil") + return fmt.Errorf("can't encode getSavedMessagesTags#8cd667a9 as nil") } b.PutID(GetSavedMessagesTagsRequestTypeID) return g.EncodeBare(b) @@ -101,18 +112,19 @@ func (g *GetSavedMessagesTagsRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (g *GetSavedMessagesTagsRequest) EncodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTags#611591cb as nil") + return fmt.Errorf("can't encode getSavedMessagesTags#8cd667a9 as nil") } + b.PutInt53(g.SavedMessagesTopicID) return nil } // Decode implements bin.Decoder. func (g *GetSavedMessagesTagsRequest) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTags#611591cb to nil") + return fmt.Errorf("can't decode getSavedMessagesTags#8cd667a9 to nil") } if err := b.ConsumeID(GetSavedMessagesTagsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTags#611591cb: %w", err) + return fmt.Errorf("unable to decode getSavedMessagesTags#8cd667a9: %w", err) } return g.DecodeBare(b) } @@ -120,7 +132,14 @@ func (g *GetSavedMessagesTagsRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (g *GetSavedMessagesTagsRequest) DecodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTags#611591cb to nil") + return fmt.Errorf("can't decode getSavedMessagesTags#8cd667a9 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getSavedMessagesTags#8cd667a9: field saved_messages_topic_id: %w", err) + } + g.SavedMessagesTopicID = value } return nil } @@ -128,11 +147,14 @@ func (g *GetSavedMessagesTagsRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (g *GetSavedMessagesTagsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTags#611591cb as nil") + return fmt.Errorf("can't encode getSavedMessagesTags#8cd667a9 as nil") } b.ObjStart() b.PutID("getSavedMessagesTags") b.Comma() + b.FieldStart("saved_messages_topic_id") + b.PutInt53(g.SavedMessagesTopicID) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -141,15 +163,21 @@ func (g *GetSavedMessagesTagsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (g *GetSavedMessagesTagsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTags#611591cb to nil") + return fmt.Errorf("can't decode getSavedMessagesTags#8cd667a9 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("getSavedMessagesTags"); err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTags#611591cb: %w", err) + return fmt.Errorf("unable to decode getSavedMessagesTags#8cd667a9: %w", err) + } + case "saved_messages_topic_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getSavedMessagesTags#8cd667a9: field saved_messages_topic_id: %w", err) } + g.SavedMessagesTopicID = value default: return b.Skip() } @@ -157,11 +185,21 @@ func (g *GetSavedMessagesTagsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetSavedMessagesTags invokes method getSavedMessagesTags#611591cb returning error if any. -func (c *Client) GetSavedMessagesTags(ctx context.Context) (*SavedMessagesTags, error) { +// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. +func (g *GetSavedMessagesTagsRequest) GetSavedMessagesTopicID() (value int64) { + if g == nil { + return + } + return g.SavedMessagesTopicID +} + +// GetSavedMessagesTags invokes method getSavedMessagesTags#8cd667a9 returning error if any. +func (c *Client) GetSavedMessagesTags(ctx context.Context, savedmessagestopicid int64) (*SavedMessagesTags, error) { var result SavedMessagesTags - request := &GetSavedMessagesTagsRequest{} + request := &GetSavedMessagesTagsRequest{ + SavedMessagesTopicID: savedmessagestopicid, + } if err := c.rpc.Invoke(ctx, request, &result); err != nil { return nil, err } diff --git a/tdapi/tl_get_saved_messages_topic_history_gen.go b/tdapi/tl_get_saved_messages_topic_history_gen.go index 4153c1d38d..20a1a2183d 100644 --- a/tdapi/tl_get_saved_messages_topic_history_gen.go +++ b/tdapi/tl_get_saved_messages_topic_history_gen.go @@ -31,10 +31,10 @@ var ( _ = tdjson.Encoder{} ) -// GetSavedMessagesTopicHistoryRequest represents TL type `getSavedMessagesTopicHistory#f115a1aa`. +// GetSavedMessagesTopicHistoryRequest represents TL type `getSavedMessagesTopicHistory#77e5da68`. type GetSavedMessagesTopicHistoryRequest struct { - // Saved Messages topic which messages will be fetched - SavedMessagesTopic SavedMessagesTopicClass + // Identifier of Saved Messages topic which messages will be fetched + SavedMessagesTopicID int64 // Identifier of the message starting from which messages must be fetched; use 0 to get // results from the last message FromMessageID int64 @@ -48,7 +48,7 @@ type GetSavedMessagesTopicHistoryRequest struct { } // GetSavedMessagesTopicHistoryRequestTypeID is TL type id of GetSavedMessagesTopicHistoryRequest. -const GetSavedMessagesTopicHistoryRequestTypeID = 0xf115a1aa +const GetSavedMessagesTopicHistoryRequestTypeID = 0x77e5da68 // Ensuring interfaces in compile-time for GetSavedMessagesTopicHistoryRequest. var ( @@ -62,7 +62,7 @@ func (g *GetSavedMessagesTopicHistoryRequest) Zero() bool { if g == nil { return true } - if !(g.SavedMessagesTopic == nil) { + if !(g.SavedMessagesTopicID == 0) { return false } if !(g.FromMessageID == 0) { @@ -111,8 +111,8 @@ func (g *GetSavedMessagesTopicHistoryRequest) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "SavedMessagesTopic", - SchemaName: "saved_messages_topic", + Name: "SavedMessagesTopicID", + SchemaName: "saved_messages_topic_id", }, { Name: "FromMessageID", @@ -133,7 +133,7 @@ func (g *GetSavedMessagesTopicHistoryRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (g *GetSavedMessagesTopicHistoryRequest) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTopicHistory#f115a1aa as nil") + return fmt.Errorf("can't encode getSavedMessagesTopicHistory#77e5da68 as nil") } b.PutID(GetSavedMessagesTopicHistoryRequestTypeID) return g.EncodeBare(b) @@ -142,14 +142,9 @@ func (g *GetSavedMessagesTopicHistoryRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (g *GetSavedMessagesTopicHistoryRequest) EncodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTopicHistory#f115a1aa as nil") - } - if g.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode getSavedMessagesTopicHistory#f115a1aa: field saved_messages_topic is nil") - } - if err := g.SavedMessagesTopic.Encode(b); err != nil { - return fmt.Errorf("unable to encode getSavedMessagesTopicHistory#f115a1aa: field saved_messages_topic: %w", err) + return fmt.Errorf("can't encode getSavedMessagesTopicHistory#77e5da68 as nil") } + b.PutInt53(g.SavedMessagesTopicID) b.PutInt53(g.FromMessageID) b.PutInt32(g.Offset) b.PutInt32(g.Limit) @@ -159,10 +154,10 @@ func (g *GetSavedMessagesTopicHistoryRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (g *GetSavedMessagesTopicHistoryRequest) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTopicHistory#f115a1aa to nil") + return fmt.Errorf("can't decode getSavedMessagesTopicHistory#77e5da68 to nil") } if err := b.ConsumeID(GetSavedMessagesTopicHistoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#f115a1aa: %w", err) + return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#77e5da68: %w", err) } return g.DecodeBare(b) } @@ -170,33 +165,33 @@ func (g *GetSavedMessagesTopicHistoryRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (g *GetSavedMessagesTopicHistoryRequest) DecodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTopicHistory#f115a1aa to nil") + return fmt.Errorf("can't decode getSavedMessagesTopicHistory#77e5da68 to nil") } { - value, err := DecodeSavedMessagesTopic(b) + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#f115a1aa: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#77e5da68: field saved_messages_topic_id: %w", err) } - g.SavedMessagesTopic = value + g.SavedMessagesTopicID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#f115a1aa: field from_message_id: %w", err) + return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#77e5da68: field from_message_id: %w", err) } g.FromMessageID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#f115a1aa: field offset: %w", err) + return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#77e5da68: field offset: %w", err) } g.Offset = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#f115a1aa: field limit: %w", err) + return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#77e5da68: field limit: %w", err) } g.Limit = value } @@ -206,18 +201,13 @@ func (g *GetSavedMessagesTopicHistoryRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (g *GetSavedMessagesTopicHistoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTopicHistory#f115a1aa as nil") + return fmt.Errorf("can't encode getSavedMessagesTopicHistory#77e5da68 as nil") } b.ObjStart() b.PutID("getSavedMessagesTopicHistory") b.Comma() - b.FieldStart("saved_messages_topic") - if g.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode getSavedMessagesTopicHistory#f115a1aa: field saved_messages_topic is nil") - } - if err := g.SavedMessagesTopic.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getSavedMessagesTopicHistory#f115a1aa: field saved_messages_topic: %w", err) - } + b.FieldStart("saved_messages_topic_id") + b.PutInt53(g.SavedMessagesTopicID) b.Comma() b.FieldStart("from_message_id") b.PutInt53(g.FromMessageID) @@ -236,37 +226,37 @@ func (g *GetSavedMessagesTopicHistoryRequest) EncodeTDLibJSON(b tdjson.Encoder) // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (g *GetSavedMessagesTopicHistoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTopicHistory#f115a1aa to nil") + return fmt.Errorf("can't decode getSavedMessagesTopicHistory#77e5da68 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("getSavedMessagesTopicHistory"); err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#f115a1aa: %w", err) + return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#77e5da68: %w", err) } - case "saved_messages_topic": - value, err := DecodeTDLibJSONSavedMessagesTopic(b) + case "saved_messages_topic_id": + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#f115a1aa: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#77e5da68: field saved_messages_topic_id: %w", err) } - g.SavedMessagesTopic = value + g.SavedMessagesTopicID = value case "from_message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#f115a1aa: field from_message_id: %w", err) + return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#77e5da68: field from_message_id: %w", err) } g.FromMessageID = value case "offset": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#f115a1aa: field offset: %w", err) + return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#77e5da68: field offset: %w", err) } g.Offset = value case "limit": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#f115a1aa: field limit: %w", err) + return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#77e5da68: field limit: %w", err) } g.Limit = value default: @@ -276,12 +266,12 @@ func (g *GetSavedMessagesTopicHistoryRequest) DecodeTDLibJSON(b tdjson.Decoder) }) } -// GetSavedMessagesTopic returns value of SavedMessagesTopic field. -func (g *GetSavedMessagesTopicHistoryRequest) GetSavedMessagesTopic() (value SavedMessagesTopicClass) { +// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. +func (g *GetSavedMessagesTopicHistoryRequest) GetSavedMessagesTopicID() (value int64) { if g == nil { return } - return g.SavedMessagesTopic + return g.SavedMessagesTopicID } // GetFromMessageID returns value of FromMessageID field. @@ -308,7 +298,7 @@ func (g *GetSavedMessagesTopicHistoryRequest) GetLimit() (value int32) { return g.Limit } -// GetSavedMessagesTopicHistory invokes method getSavedMessagesTopicHistory#f115a1aa returning error if any. +// GetSavedMessagesTopicHistory invokes method getSavedMessagesTopicHistory#77e5da68 returning error if any. func (c *Client) GetSavedMessagesTopicHistory(ctx context.Context, request *GetSavedMessagesTopicHistoryRequest) (*Messages, error) { var result Messages diff --git a/tdapi/tl_get_saved_messages_topic_message_by_date_gen.go b/tdapi/tl_get_saved_messages_topic_message_by_date_gen.go index 981a19155c..de976ec312 100644 --- a/tdapi/tl_get_saved_messages_topic_message_by_date_gen.go +++ b/tdapi/tl_get_saved_messages_topic_message_by_date_gen.go @@ -31,16 +31,16 @@ var ( _ = tdjson.Encoder{} ) -// GetSavedMessagesTopicMessageByDateRequest represents TL type `getSavedMessagesTopicMessageByDate#78ebcc7f`. +// GetSavedMessagesTopicMessageByDateRequest represents TL type `getSavedMessagesTopicMessageByDate#c15e4680`. type GetSavedMessagesTopicMessageByDateRequest struct { - // Saved Messages topic which message will be returned - SavedMessagesTopic SavedMessagesTopicClass + // Identifier of Saved Messages topic which message will be returned + SavedMessagesTopicID int64 // Point in time (Unix timestamp) relative to which to search for messages Date int32 } // GetSavedMessagesTopicMessageByDateRequestTypeID is TL type id of GetSavedMessagesTopicMessageByDateRequest. -const GetSavedMessagesTopicMessageByDateRequestTypeID = 0x78ebcc7f +const GetSavedMessagesTopicMessageByDateRequestTypeID = 0xc15e4680 // Ensuring interfaces in compile-time for GetSavedMessagesTopicMessageByDateRequest. var ( @@ -54,7 +54,7 @@ func (g *GetSavedMessagesTopicMessageByDateRequest) Zero() bool { if g == nil { return true } - if !(g.SavedMessagesTopic == nil) { + if !(g.SavedMessagesTopicID == 0) { return false } if !(g.Date == 0) { @@ -97,8 +97,8 @@ func (g *GetSavedMessagesTopicMessageByDateRequest) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "SavedMessagesTopic", - SchemaName: "saved_messages_topic", + Name: "SavedMessagesTopicID", + SchemaName: "saved_messages_topic_id", }, { Name: "Date", @@ -111,7 +111,7 @@ func (g *GetSavedMessagesTopicMessageByDateRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (g *GetSavedMessagesTopicMessageByDateRequest) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTopicMessageByDate#78ebcc7f as nil") + return fmt.Errorf("can't encode getSavedMessagesTopicMessageByDate#c15e4680 as nil") } b.PutID(GetSavedMessagesTopicMessageByDateRequestTypeID) return g.EncodeBare(b) @@ -120,14 +120,9 @@ func (g *GetSavedMessagesTopicMessageByDateRequest) Encode(b *bin.Buffer) error // EncodeBare implements bin.BareEncoder. func (g *GetSavedMessagesTopicMessageByDateRequest) EncodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTopicMessageByDate#78ebcc7f as nil") - } - if g.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode getSavedMessagesTopicMessageByDate#78ebcc7f: field saved_messages_topic is nil") - } - if err := g.SavedMessagesTopic.Encode(b); err != nil { - return fmt.Errorf("unable to encode getSavedMessagesTopicMessageByDate#78ebcc7f: field saved_messages_topic: %w", err) + return fmt.Errorf("can't encode getSavedMessagesTopicMessageByDate#c15e4680 as nil") } + b.PutInt53(g.SavedMessagesTopicID) b.PutInt32(g.Date) return nil } @@ -135,10 +130,10 @@ func (g *GetSavedMessagesTopicMessageByDateRequest) EncodeBare(b *bin.Buffer) er // Decode implements bin.Decoder. func (g *GetSavedMessagesTopicMessageByDateRequest) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTopicMessageByDate#78ebcc7f to nil") + return fmt.Errorf("can't decode getSavedMessagesTopicMessageByDate#c15e4680 to nil") } if err := b.ConsumeID(GetSavedMessagesTopicMessageByDateRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicMessageByDate#78ebcc7f: %w", err) + return fmt.Errorf("unable to decode getSavedMessagesTopicMessageByDate#c15e4680: %w", err) } return g.DecodeBare(b) } @@ -146,19 +141,19 @@ func (g *GetSavedMessagesTopicMessageByDateRequest) Decode(b *bin.Buffer) error // DecodeBare implements bin.BareDecoder. func (g *GetSavedMessagesTopicMessageByDateRequest) DecodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTopicMessageByDate#78ebcc7f to nil") + return fmt.Errorf("can't decode getSavedMessagesTopicMessageByDate#c15e4680 to nil") } { - value, err := DecodeSavedMessagesTopic(b) + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicMessageByDate#78ebcc7f: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode getSavedMessagesTopicMessageByDate#c15e4680: field saved_messages_topic_id: %w", err) } - g.SavedMessagesTopic = value + g.SavedMessagesTopicID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicMessageByDate#78ebcc7f: field date: %w", err) + return fmt.Errorf("unable to decode getSavedMessagesTopicMessageByDate#c15e4680: field date: %w", err) } g.Date = value } @@ -168,18 +163,13 @@ func (g *GetSavedMessagesTopicMessageByDateRequest) DecodeBare(b *bin.Buffer) er // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (g *GetSavedMessagesTopicMessageByDateRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTopicMessageByDate#78ebcc7f as nil") + return fmt.Errorf("can't encode getSavedMessagesTopicMessageByDate#c15e4680 as nil") } b.ObjStart() b.PutID("getSavedMessagesTopicMessageByDate") b.Comma() - b.FieldStart("saved_messages_topic") - if g.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode getSavedMessagesTopicMessageByDate#78ebcc7f: field saved_messages_topic is nil") - } - if err := g.SavedMessagesTopic.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getSavedMessagesTopicMessageByDate#78ebcc7f: field saved_messages_topic: %w", err) - } + b.FieldStart("saved_messages_topic_id") + b.PutInt53(g.SavedMessagesTopicID) b.Comma() b.FieldStart("date") b.PutInt32(g.Date) @@ -192,25 +182,25 @@ func (g *GetSavedMessagesTopicMessageByDateRequest) EncodeTDLibJSON(b tdjson.Enc // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (g *GetSavedMessagesTopicMessageByDateRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTopicMessageByDate#78ebcc7f to nil") + return fmt.Errorf("can't decode getSavedMessagesTopicMessageByDate#c15e4680 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("getSavedMessagesTopicMessageByDate"); err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicMessageByDate#78ebcc7f: %w", err) + return fmt.Errorf("unable to decode getSavedMessagesTopicMessageByDate#c15e4680: %w", err) } - case "saved_messages_topic": - value, err := DecodeTDLibJSONSavedMessagesTopic(b) + case "saved_messages_topic_id": + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicMessageByDate#78ebcc7f: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode getSavedMessagesTopicMessageByDate#c15e4680: field saved_messages_topic_id: %w", err) } - g.SavedMessagesTopic = value + g.SavedMessagesTopicID = value case "date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicMessageByDate#78ebcc7f: field date: %w", err) + return fmt.Errorf("unable to decode getSavedMessagesTopicMessageByDate#c15e4680: field date: %w", err) } g.Date = value default: @@ -220,12 +210,12 @@ func (g *GetSavedMessagesTopicMessageByDateRequest) DecodeTDLibJSON(b tdjson.Dec }) } -// GetSavedMessagesTopic returns value of SavedMessagesTopic field. -func (g *GetSavedMessagesTopicMessageByDateRequest) GetSavedMessagesTopic() (value SavedMessagesTopicClass) { +// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. +func (g *GetSavedMessagesTopicMessageByDateRequest) GetSavedMessagesTopicID() (value int64) { if g == nil { return } - return g.SavedMessagesTopic + return g.SavedMessagesTopicID } // GetDate returns value of Date field. @@ -236,7 +226,7 @@ func (g *GetSavedMessagesTopicMessageByDateRequest) GetDate() (value int32) { return g.Date } -// GetSavedMessagesTopicMessageByDate invokes method getSavedMessagesTopicMessageByDate#78ebcc7f returning error if any. +// GetSavedMessagesTopicMessageByDate invokes method getSavedMessagesTopicMessageByDate#c15e4680 returning error if any. func (c *Client) GetSavedMessagesTopicMessageByDate(ctx context.Context, request *GetSavedMessagesTopicMessageByDateRequest) (*Message, error) { var result Message diff --git a/tdapi/tl_get_saved_messages_topics_gen.go b/tdapi/tl_get_saved_messages_topics_gen.go deleted file mode 100644 index 2d3e4e3b61..0000000000 --- a/tdapi/tl_get_saved_messages_topics_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// 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{} -) - -// GetSavedMessagesTopicsRequest represents TL type `getSavedMessagesTopics#c5038df6`. -type GetSavedMessagesTopicsRequest struct { - // Offset of the first entry to return as received from the previous request; use empty - // string to get the first chunk of results - Offset string - // The maximum number of Saved Messages topics to be returned; up to 100 - Limit int32 -} - -// GetSavedMessagesTopicsRequestTypeID is TL type id of GetSavedMessagesTopicsRequest. -const GetSavedMessagesTopicsRequestTypeID = 0xc5038df6 - -// Ensuring interfaces in compile-time for GetSavedMessagesTopicsRequest. -var ( - _ bin.Encoder = &GetSavedMessagesTopicsRequest{} - _ bin.Decoder = &GetSavedMessagesTopicsRequest{} - _ bin.BareEncoder = &GetSavedMessagesTopicsRequest{} - _ bin.BareDecoder = &GetSavedMessagesTopicsRequest{} -) - -func (g *GetSavedMessagesTopicsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Offset == "") { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetSavedMessagesTopicsRequest) String() string { - if g == nil { - return "GetSavedMessagesTopicsRequest(nil)" - } - type Alias GetSavedMessagesTopicsRequest - return fmt.Sprintf("GetSavedMessagesTopicsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetSavedMessagesTopicsRequest) TypeID() uint32 { - return GetSavedMessagesTopicsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetSavedMessagesTopicsRequest) TypeName() string { - return "getSavedMessagesTopics" -} - -// TypeInfo returns info about TL type. -func (g *GetSavedMessagesTopicsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getSavedMessagesTopics", - ID: GetSavedMessagesTopicsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetSavedMessagesTopicsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTopics#c5038df6 as nil") - } - b.PutID(GetSavedMessagesTopicsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetSavedMessagesTopicsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTopics#c5038df6 as nil") - } - b.PutString(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetSavedMessagesTopicsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTopics#c5038df6 to nil") - } - if err := b.ConsumeID(GetSavedMessagesTopicsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopics#c5038df6: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetSavedMessagesTopicsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTopics#c5038df6 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopics#c5038df6: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopics#c5038df6: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetSavedMessagesTopicsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTopics#c5038df6 as nil") - } - b.ObjStart() - b.PutID("getSavedMessagesTopics") - b.Comma() - b.FieldStart("offset") - b.PutString(g.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetSavedMessagesTopicsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTopics#c5038df6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getSavedMessagesTopics"); err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopics#c5038df6: %w", err) - } - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopics#c5038df6: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopics#c5038df6: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOffset returns value of Offset field. -func (g *GetSavedMessagesTopicsRequest) GetOffset() (value string) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetSavedMessagesTopicsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetSavedMessagesTopics invokes method getSavedMessagesTopics#c5038df6 returning error if any. -func (c *Client) GetSavedMessagesTopics(ctx context.Context, request *GetSavedMessagesTopicsRequest) (*FoundSavedMessagesTopics, error) { - var result FoundSavedMessagesTopics - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_import_messages_gen.go b/tdapi/tl_import_messages_gen.go index 71c1ac783d..e11d3311e2 100644 --- a/tdapi/tl_import_messages_gen.go +++ b/tdapi/tl_import_messages_gen.go @@ -35,7 +35,7 @@ var ( type ImportMessagesRequest struct { // Identifier of a chat to which the messages will be imported. It must be an identifier // of a private chat with a mutual contact or an identifier of a supergroup chat with - // can_change_info administrator right + // can_change_info member right ChatID int64 // File with messages to import. Only inputFileLocal and inputFileGenerated are supported // The file must not be previously uploaded diff --git a/tdapi/tl_input_message_content_gen.go b/tdapi/tl_input_message_content_gen.go index 92a0e44168..079bf43d14 100644 --- a/tdapi/tl_input_message_content_gen.go +++ b/tdapi/tl_input_message_content_gen.go @@ -37,8 +37,8 @@ type InputMessageText struct { // Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, Code, Pre, // PreCode, TextUrl and MentionName entities are allowed to be specified manually Text FormattedText - // Options to be used for generation of a link preview; pass null to use default link - // preview options + // Options to be used for generation of a link preview; may be null if none; pass null to + // use default link preview options LinkPreviewOptions LinkPreviewOptions // True, if a chat message draft must be deleted ClearDraft bool @@ -2621,13 +2621,14 @@ func (i *InputMessageVideo) GetHasSpoiler() (value bool) { type InputMessageVideoNote struct { // Video note to be sent VideoNote InputFileClass - // Video thumbnail; pass null to skip thumbnail uploading + // Video thumbnail; may be null if empty; pass null to skip thumbnail uploading Thumbnail InputThumbnail // Duration of the video, in seconds Duration int32 // Video width and height; must be positive and not greater than 640 Length int32 - // Video note self-destruct type; pass null if none; private chats only + // Video note self-destruct type; may be null if none; pass null if none; private chats + // only SelfDestructType MessageSelfDestructTypeClass } @@ -2947,10 +2948,11 @@ type InputMessageVoiceNote struct { Duration int32 // Waveform representation of the voice note in 5-bit format Waveform []byte - // Voice note caption; pass null to use an empty caption; + // Voice note caption; may be null if empty; pass null to use an empty caption; // 0-getOption("message_caption_length_max") characters Caption FormattedText - // Voice note self-destruct type; pass null if none; private chats only + // Voice note self-destruct type; may be null if none; pass null if none; private chats + // only SelfDestructType MessageSelfDestructTypeClass } diff --git a/tdapi/tl_input_message_reply_to_gen.go b/tdapi/tl_input_message_reply_to_gen.go index c74c4e9519..6e74c05a68 100644 --- a/tdapi/tl_input_message_reply_to_gen.go +++ b/tdapi/tl_input_message_reply_to_gen.go @@ -272,7 +272,7 @@ func (i *InputMessageReplyToMessage) GetQuote() (value InputTextQuote) { // InputMessageReplyToStory represents TL type `inputMessageReplyToStory#51aece78`. type InputMessageReplyToStory struct { // The identifier of the sender of the story. Currently, stories can be replied only in - // the sender's chat + // the sender's chat and channel stories can't be replied StorySenderChatID int64 // The identifier of the story StoryID int32 diff --git a/tdapi/tl_load_saved_messages_topics_gen.go b/tdapi/tl_load_saved_messages_topics_gen.go new file mode 100644 index 0000000000..245e3fd61e --- /dev/null +++ b/tdapi/tl_load_saved_messages_topics_gen.go @@ -0,0 +1,208 @@ +// 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{} +) + +// LoadSavedMessagesTopicsRequest represents TL type `loadSavedMessagesTopics#1146d6b8`. +type LoadSavedMessagesTopicsRequest struct { + // The maximum number of topics to be loaded. For optimal performance, the number of + // loaded topics is chosen by TDLib and can be smaller than the specified limit, even if + // the end of the list is not reached + Limit int32 +} + +// LoadSavedMessagesTopicsRequestTypeID is TL type id of LoadSavedMessagesTopicsRequest. +const LoadSavedMessagesTopicsRequestTypeID = 0x1146d6b8 + +// Ensuring interfaces in compile-time for LoadSavedMessagesTopicsRequest. +var ( + _ bin.Encoder = &LoadSavedMessagesTopicsRequest{} + _ bin.Decoder = &LoadSavedMessagesTopicsRequest{} + _ bin.BareEncoder = &LoadSavedMessagesTopicsRequest{} + _ bin.BareDecoder = &LoadSavedMessagesTopicsRequest{} +) + +func (l *LoadSavedMessagesTopicsRequest) Zero() bool { + if l == nil { + return true + } + if !(l.Limit == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (l *LoadSavedMessagesTopicsRequest) String() string { + if l == nil { + return "LoadSavedMessagesTopicsRequest(nil)" + } + type Alias LoadSavedMessagesTopicsRequest + return fmt.Sprintf("LoadSavedMessagesTopicsRequest%+v", Alias(*l)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*LoadSavedMessagesTopicsRequest) TypeID() uint32 { + return LoadSavedMessagesTopicsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*LoadSavedMessagesTopicsRequest) TypeName() string { + return "loadSavedMessagesTopics" +} + +// TypeInfo returns info about TL type. +func (l *LoadSavedMessagesTopicsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "loadSavedMessagesTopics", + ID: LoadSavedMessagesTopicsRequestTypeID, + } + if l == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Limit", + SchemaName: "limit", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (l *LoadSavedMessagesTopicsRequest) Encode(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't encode loadSavedMessagesTopics#1146d6b8 as nil") + } + b.PutID(LoadSavedMessagesTopicsRequestTypeID) + return l.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (l *LoadSavedMessagesTopicsRequest) EncodeBare(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't encode loadSavedMessagesTopics#1146d6b8 as nil") + } + b.PutInt32(l.Limit) + return nil +} + +// Decode implements bin.Decoder. +func (l *LoadSavedMessagesTopicsRequest) Decode(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't decode loadSavedMessagesTopics#1146d6b8 to nil") + } + if err := b.ConsumeID(LoadSavedMessagesTopicsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode loadSavedMessagesTopics#1146d6b8: %w", err) + } + return l.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (l *LoadSavedMessagesTopicsRequest) DecodeBare(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't decode loadSavedMessagesTopics#1146d6b8 to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode loadSavedMessagesTopics#1146d6b8: field limit: %w", err) + } + l.Limit = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (l *LoadSavedMessagesTopicsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if l == nil { + return fmt.Errorf("can't encode loadSavedMessagesTopics#1146d6b8 as nil") + } + b.ObjStart() + b.PutID("loadSavedMessagesTopics") + b.Comma() + b.FieldStart("limit") + b.PutInt32(l.Limit) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (l *LoadSavedMessagesTopicsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if l == nil { + return fmt.Errorf("can't decode loadSavedMessagesTopics#1146d6b8 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("loadSavedMessagesTopics"); err != nil { + return fmt.Errorf("unable to decode loadSavedMessagesTopics#1146d6b8: %w", err) + } + case "limit": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode loadSavedMessagesTopics#1146d6b8: field limit: %w", err) + } + l.Limit = value + default: + return b.Skip() + } + return nil + }) +} + +// GetLimit returns value of Limit field. +func (l *LoadSavedMessagesTopicsRequest) GetLimit() (value int32) { + if l == nil { + return + } + return l.Limit +} + +// LoadSavedMessagesTopics invokes method loadSavedMessagesTopics#1146d6b8 returning error if any. +func (c *Client) LoadSavedMessagesTopics(ctx context.Context, limit int32) error { + var ok Ok + + request := &LoadSavedMessagesTopicsRequest{ + Limit: limit, + } + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_message_content_gen.go b/tdapi/tl_message_content_gen.go index d7f060d6b9..07400f1631 100644 --- a/tdapi/tl_message_content_gen.go +++ b/tdapi/tl_message_content_gen.go @@ -8618,6 +8618,172 @@ func (m *MessageChatSetMessageAutoDeleteTime) GetFromUserID() (value int64) { return m.FromUserID } +// MessageChatBoost represents TL type `messageChatBoost#5e5f658b`. +type MessageChatBoost struct { + // Number of times the chat was boosted + BoostCount int32 +} + +// MessageChatBoostTypeID is TL type id of MessageChatBoost. +const MessageChatBoostTypeID = 0x5e5f658b + +// construct implements constructor of MessageContentClass. +func (m MessageChatBoost) construct() MessageContentClass { return &m } + +// Ensuring interfaces in compile-time for MessageChatBoost. +var ( + _ bin.Encoder = &MessageChatBoost{} + _ bin.Decoder = &MessageChatBoost{} + _ bin.BareEncoder = &MessageChatBoost{} + _ bin.BareDecoder = &MessageChatBoost{} + + _ MessageContentClass = &MessageChatBoost{} +) + +func (m *MessageChatBoost) Zero() bool { + if m == nil { + return true + } + if !(m.BoostCount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageChatBoost) String() string { + if m == nil { + return "MessageChatBoost(nil)" + } + type Alias MessageChatBoost + return fmt.Sprintf("MessageChatBoost%+v", Alias(*m)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageChatBoost) TypeID() uint32 { + return MessageChatBoostTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageChatBoost) TypeName() string { + return "messageChatBoost" +} + +// TypeInfo returns info about TL type. +func (m *MessageChatBoost) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageChatBoost", + ID: MessageChatBoostTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "BoostCount", + SchemaName: "boost_count", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MessageChatBoost) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageChatBoost#5e5f658b as nil") + } + b.PutID(MessageChatBoostTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageChatBoost) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageChatBoost#5e5f658b as nil") + } + b.PutInt32(m.BoostCount) + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageChatBoost) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageChatBoost#5e5f658b to nil") + } + if err := b.ConsumeID(MessageChatBoostTypeID); err != nil { + return fmt.Errorf("unable to decode messageChatBoost#5e5f658b: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageChatBoost) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageChatBoost#5e5f658b to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode messageChatBoost#5e5f658b: field boost_count: %w", err) + } + m.BoostCount = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (m *MessageChatBoost) EncodeTDLibJSON(b tdjson.Encoder) error { + if m == nil { + return fmt.Errorf("can't encode messageChatBoost#5e5f658b as nil") + } + b.ObjStart() + b.PutID("messageChatBoost") + b.Comma() + b.FieldStart("boost_count") + b.PutInt32(m.BoostCount) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (m *MessageChatBoost) DecodeTDLibJSON(b tdjson.Decoder) error { + if m == nil { + return fmt.Errorf("can't decode messageChatBoost#5e5f658b to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("messageChatBoost"); err != nil { + return fmt.Errorf("unable to decode messageChatBoost#5e5f658b: %w", err) + } + case "boost_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode messageChatBoost#5e5f658b: field boost_count: %w", err) + } + m.BoostCount = value + default: + return b.Skip() + } + return nil + }) +} + +// GetBoostCount returns value of BoostCount field. +func (m *MessageChatBoost) GetBoostCount() (value int32) { + if m == nil { + return + } + return m.BoostCount +} + // MessageForumTopicCreated represents TL type `messageForumTopicCreated#b8ce47d1`. type MessageForumTopicCreated struct { // Name of the topic @@ -14747,6 +14913,7 @@ const MessageContentClassName = "MessageContent" // case *tdapi.MessageChatSetBackground: // messageChatSetBackground#3d5d7c40 // case *tdapi.MessageChatSetTheme: // messageChatSetTheme#99ae9408 // case *tdapi.MessageChatSetMessageAutoDeleteTime: // messageChatSetMessageAutoDeleteTime#619e052e +// case *tdapi.MessageChatBoost: // messageChatBoost#5e5f658b // case *tdapi.MessageForumTopicCreated: // messageForumTopicCreated#b8ce47d1 // case *tdapi.MessageForumTopicEdited: // messageForumTopicEdited#c0b780 // case *tdapi.MessageForumTopicIsClosedToggled: // messageForumTopicIsClosedToggled#4b578fe0 @@ -15104,6 +15271,13 @@ func DecodeMessageContent(buf *bin.Buffer) (MessageContentClass, error) { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil + case MessageChatBoostTypeID: + // Decoding messageChatBoost#5e5f658b. + v := MessageChatBoost{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) + } + return &v, nil case MessageForumTopicCreatedTypeID: // Decoding messageForumTopicCreated#b8ce47d1. v := MessageForumTopicCreated{} @@ -15592,6 +15766,13 @@ func DecodeTDLibJSONMessageContent(buf tdjson.Decoder) (MessageContentClass, err return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil + case "messageChatBoost": + // Decoding messageChatBoost#5e5f658b. + v := MessageChatBoost{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) + } + return &v, nil case "messageForumTopicCreated": // Decoding messageForumTopicCreated#b8ce47d1. v := MessageForumTopicCreated{} diff --git a/tdapi/tl_message_gen.go b/tdapi/tl_message_gen.go index cbc3423be6..0c63db99f7 100644 --- a/tdapi/tl_message_gen.go +++ b/tdapi/tl_message_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// Message represents TL type `message#9a056371`. +// Message represents TL type `message#34e12c0`. type Message struct { // Message identifier; unique for the chat to which the message belongs ID int64 @@ -109,9 +109,9 @@ type Message struct { // If non-zero, the identifier of the message thread the message belongs to; unique // within the chat to which the message belongs MessageThreadID int64 - // Information about topic of the message in the Saved Messages chat; may be null for - // messages not from Saved Messages - SavedMessagesTopic SavedMessagesTopicClass + // Identifier of the Saved Messages topic for the message; 0 for messages not from Saved + // Messages + SavedMessagesTopicID int64 // The message's self-destruct type; may be null if none SelfDestructType MessageSelfDestructTypeClass // Time left before the message self-destruct timer expires, in seconds; 0 if @@ -122,6 +122,10 @@ type Message struct { AutoDeleteIn float64 // If non-zero, the user identifier of the bot through which this message was sent ViaBotUserID int64 + // Number of times the sender of the message boosted the supergroup at the time the + // message was sent; 0 if none or unknown. For messages sent by the current user, + // supergroupFullInfo.my_boost_count must be used instead + SenderBoostCount int32 // For channel posts and anonymous group messages, optional author signature AuthorSignature string // Unique identifier of an album this message belongs to. Only audios, documents, photos @@ -137,7 +141,7 @@ type Message struct { } // MessageTypeID is TL type id of Message. -const MessageTypeID = 0x9a056371 +const MessageTypeID = 0x34e12c0 // Ensuring interfaces in compile-time for Message. var ( @@ -247,7 +251,7 @@ func (m *Message) Zero() bool { if !(m.MessageThreadID == 0) { return false } - if !(m.SavedMessagesTopic == nil) { + if !(m.SavedMessagesTopicID == 0) { return false } if !(m.SelfDestructType == nil) { @@ -262,6 +266,9 @@ func (m *Message) Zero() bool { if !(m.ViaBotUserID == 0) { return false } + if !(m.SenderBoostCount == 0) { + return false + } if !(m.AuthorSignature == "") { return false } @@ -442,8 +449,8 @@ func (m *Message) TypeInfo() tdp.Type { SchemaName: "message_thread_id", }, { - Name: "SavedMessagesTopic", - SchemaName: "saved_messages_topic", + Name: "SavedMessagesTopicID", + SchemaName: "saved_messages_topic_id", }, { Name: "SelfDestructType", @@ -461,6 +468,10 @@ func (m *Message) TypeInfo() tdp.Type { Name: "ViaBotUserID", SchemaName: "via_bot_user_id", }, + { + Name: "SenderBoostCount", + SchemaName: "sender_boost_count", + }, { Name: "AuthorSignature", SchemaName: "author_signature", @@ -488,7 +499,7 @@ func (m *Message) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (m *Message) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode message#9a056371 as nil") + return fmt.Errorf("can't encode message#34e12c0 as nil") } b.PutID(MessageTypeID) return m.EncodeBare(b) @@ -497,27 +508,27 @@ func (m *Message) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *Message) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode message#9a056371 as nil") + return fmt.Errorf("can't encode message#34e12c0 as nil") } b.PutInt53(m.ID) if m.SenderID == nil { - return fmt.Errorf("unable to encode message#9a056371: field sender_id is nil") + return fmt.Errorf("unable to encode message#34e12c0: field sender_id is nil") } if err := m.SenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field sender_id: %w", err) + return fmt.Errorf("unable to encode message#34e12c0: field sender_id: %w", err) } b.PutInt53(m.ChatID) if m.SendingState == nil { - return fmt.Errorf("unable to encode message#9a056371: field sending_state is nil") + return fmt.Errorf("unable to encode message#34e12c0: field sending_state is nil") } if err := m.SendingState.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field sending_state: %w", err) + return fmt.Errorf("unable to encode message#34e12c0: field sending_state: %w", err) } if m.SchedulingState == nil { - return fmt.Errorf("unable to encode message#9a056371: field scheduling_state is nil") + return fmt.Errorf("unable to encode message#34e12c0: field scheduling_state is nil") } if err := m.SchedulingState.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field scheduling_state: %w", err) + return fmt.Errorf("unable to encode message#34e12c0: field scheduling_state: %w", err) } b.PutBool(m.IsOutgoing) b.PutBool(m.IsPinned) @@ -541,56 +552,52 @@ func (m *Message) EncodeBare(b *bin.Buffer) error { b.PutInt32(m.Date) b.PutInt32(m.EditDate) if err := m.ForwardInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field forward_info: %w", err) + return fmt.Errorf("unable to encode message#34e12c0: field forward_info: %w", err) } if err := m.ImportInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field import_info: %w", err) + return fmt.Errorf("unable to encode message#34e12c0: field import_info: %w", err) } if err := m.InteractionInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field interaction_info: %w", err) + return fmt.Errorf("unable to encode message#34e12c0: field interaction_info: %w", err) } b.PutInt(len(m.UnreadReactions)) for idx, v := range m.UnreadReactions { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare message#9a056371: field unread_reactions element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare message#34e12c0: field unread_reactions element with index %d: %w", idx, err) } } if m.ReplyTo == nil { - return fmt.Errorf("unable to encode message#9a056371: field reply_to is nil") + return fmt.Errorf("unable to encode message#34e12c0: field reply_to is nil") } if err := m.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field reply_to: %w", err) + return fmt.Errorf("unable to encode message#34e12c0: field reply_to: %w", err) } b.PutInt53(m.MessageThreadID) - if m.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode message#9a056371: field saved_messages_topic is nil") - } - if err := m.SavedMessagesTopic.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field saved_messages_topic: %w", err) - } + b.PutInt53(m.SavedMessagesTopicID) if m.SelfDestructType == nil { - return fmt.Errorf("unable to encode message#9a056371: field self_destruct_type is nil") + return fmt.Errorf("unable to encode message#34e12c0: field self_destruct_type is nil") } if err := m.SelfDestructType.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field self_destruct_type: %w", err) + return fmt.Errorf("unable to encode message#34e12c0: field self_destruct_type: %w", err) } b.PutDouble(m.SelfDestructIn) b.PutDouble(m.AutoDeleteIn) b.PutInt53(m.ViaBotUserID) + b.PutInt32(m.SenderBoostCount) b.PutString(m.AuthorSignature) b.PutLong(m.MediaAlbumID) b.PutString(m.RestrictionReason) if m.Content == nil { - return fmt.Errorf("unable to encode message#9a056371: field content is nil") + return fmt.Errorf("unable to encode message#34e12c0: field content is nil") } if err := m.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field content: %w", err) + return fmt.Errorf("unable to encode message#34e12c0: field content: %w", err) } if m.ReplyMarkup == nil { - return fmt.Errorf("unable to encode message#9a056371: field reply_markup is nil") + return fmt.Errorf("unable to encode message#34e12c0: field reply_markup is nil") } if err := m.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field reply_markup: %w", err) + return fmt.Errorf("unable to encode message#34e12c0: field reply_markup: %w", err) } return nil } @@ -598,10 +605,10 @@ func (m *Message) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *Message) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode message#9a056371 to nil") + return fmt.Errorf("can't decode message#34e12c0 to nil") } if err := b.ConsumeID(MessageTypeID); err != nil { - return fmt.Errorf("unable to decode message#9a056371: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: %w", err) } return m.DecodeBare(b) } @@ -609,209 +616,209 @@ func (m *Message) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *Message) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode message#9a056371 to nil") + return fmt.Errorf("can't decode message#34e12c0 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field id: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field id: %w", err) } m.ID = value } { value, err := DecodeMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field sender_id: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field sender_id: %w", err) } m.SenderID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field chat_id: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field chat_id: %w", err) } m.ChatID = value } { value, err := DecodeMessageSendingState(b) if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field sending_state: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field sending_state: %w", err) } m.SendingState = value } { value, err := DecodeMessageSchedulingState(b) if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field scheduling_state: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field scheduling_state: %w", err) } m.SchedulingState = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field is_outgoing: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field is_outgoing: %w", err) } m.IsOutgoing = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field is_pinned: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field is_pinned: %w", err) } m.IsPinned = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_be_edited: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_be_edited: %w", err) } m.CanBeEdited = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_be_forwarded: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_be_forwarded: %w", err) } m.CanBeForwarded = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_be_replied_in_another_chat: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_be_replied_in_another_chat: %w", err) } m.CanBeRepliedInAnotherChat = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_be_saved: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_be_saved: %w", err) } m.CanBeSaved = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_be_deleted_only_for_self: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_be_deleted_only_for_self: %w", err) } m.CanBeDeletedOnlyForSelf = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_be_deleted_for_all_users: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_be_deleted_for_all_users: %w", err) } m.CanBeDeletedForAllUsers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_get_added_reactions: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_get_added_reactions: %w", err) } m.CanGetAddedReactions = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_get_statistics: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_get_statistics: %w", err) } m.CanGetStatistics = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_get_message_thread: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_get_message_thread: %w", err) } m.CanGetMessageThread = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_get_read_date: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_get_read_date: %w", err) } m.CanGetReadDate = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_get_viewers: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_get_viewers: %w", err) } m.CanGetViewers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_get_media_timestamp_links: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_get_media_timestamp_links: %w", err) } m.CanGetMediaTimestampLinks = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_report_reactions: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_report_reactions: %w", err) } m.CanReportReactions = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field has_timestamped_media: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field has_timestamped_media: %w", err) } m.HasTimestampedMedia = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field is_channel_post: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field is_channel_post: %w", err) } m.IsChannelPost = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field is_topic_message: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field is_topic_message: %w", err) } m.IsTopicMessage = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field contains_unread_mention: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field contains_unread_mention: %w", err) } m.ContainsUnreadMention = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field date: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field date: %w", err) } m.Date = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field edit_date: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field edit_date: %w", err) } m.EditDate = value } { if err := m.ForwardInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#9a056371: field forward_info: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field forward_info: %w", err) } } { if err := m.ImportInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#9a056371: field import_info: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field import_info: %w", err) } } { if err := m.InteractionInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#9a056371: field interaction_info: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field interaction_info: %w", err) } } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field unread_reactions: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field unread_reactions: %w", err) } if headerLen > 0 { @@ -820,7 +827,7 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value UnreadReaction if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare message#9a056371: field unread_reactions: %w", err) + return fmt.Errorf("unable to decode bare message#34e12c0: field unread_reactions: %w", err) } m.UnreadReactions = append(m.UnreadReactions, value) } @@ -828,84 +835,91 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { { value, err := DecodeMessageReplyTo(b) if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field reply_to: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field reply_to: %w", err) } m.ReplyTo = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field message_thread_id: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field message_thread_id: %w", err) } m.MessageThreadID = value } { - value, err := DecodeSavedMessagesTopic(b) + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field saved_messages_topic_id: %w", err) } - m.SavedMessagesTopic = value + m.SavedMessagesTopicID = value } { value, err := DecodeMessageSelfDestructType(b) if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field self_destruct_type: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field self_destruct_type: %w", err) } m.SelfDestructType = value } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field self_destruct_in: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field self_destruct_in: %w", err) } m.SelfDestructIn = value } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field auto_delete_in: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field auto_delete_in: %w", err) } m.AutoDeleteIn = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field via_bot_user_id: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field via_bot_user_id: %w", err) } m.ViaBotUserID = value } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode message#34e12c0: field sender_boost_count: %w", err) + } + m.SenderBoostCount = value + } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field author_signature: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field author_signature: %w", err) } m.AuthorSignature = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field media_album_id: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field media_album_id: %w", err) } m.MediaAlbumID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field restriction_reason: %w", err) } m.RestrictionReason = value } { value, err := DecodeMessageContent(b) if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field content: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field content: %w", err) } m.Content = value } { value, err := DecodeReplyMarkup(b) if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field reply_markup: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field reply_markup: %w", err) } m.ReplyMarkup = value } @@ -915,7 +929,7 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { if m == nil { - return fmt.Errorf("can't encode message#9a056371 as nil") + return fmt.Errorf("can't encode message#34e12c0 as nil") } b.ObjStart() b.PutID("message") @@ -925,10 +939,10 @@ func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("sender_id") if m.SenderID == nil { - return fmt.Errorf("unable to encode message#9a056371: field sender_id is nil") + return fmt.Errorf("unable to encode message#34e12c0: field sender_id is nil") } if err := m.SenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field sender_id: %w", err) + return fmt.Errorf("unable to encode message#34e12c0: field sender_id: %w", err) } b.Comma() b.FieldStart("chat_id") @@ -936,18 +950,18 @@ func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("sending_state") if m.SendingState == nil { - return fmt.Errorf("unable to encode message#9a056371: field sending_state is nil") + return fmt.Errorf("unable to encode message#34e12c0: field sending_state is nil") } if err := m.SendingState.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field sending_state: %w", err) + return fmt.Errorf("unable to encode message#34e12c0: field sending_state: %w", err) } b.Comma() b.FieldStart("scheduling_state") if m.SchedulingState == nil { - return fmt.Errorf("unable to encode message#9a056371: field scheduling_state is nil") + return fmt.Errorf("unable to encode message#34e12c0: field scheduling_state is nil") } if err := m.SchedulingState.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field scheduling_state: %w", err) + return fmt.Errorf("unable to encode message#34e12c0: field scheduling_state: %w", err) } b.Comma() b.FieldStart("is_outgoing") @@ -1015,24 +1029,24 @@ func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("forward_info") if err := m.ForwardInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field forward_info: %w", err) + return fmt.Errorf("unable to encode message#34e12c0: field forward_info: %w", err) } b.Comma() b.FieldStart("import_info") if err := m.ImportInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field import_info: %w", err) + return fmt.Errorf("unable to encode message#34e12c0: field import_info: %w", err) } b.Comma() b.FieldStart("interaction_info") if err := m.InteractionInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field interaction_info: %w", err) + return fmt.Errorf("unable to encode message#34e12c0: field interaction_info: %w", err) } b.Comma() b.FieldStart("unread_reactions") b.ArrStart() for idx, v := range m.UnreadReactions { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field unread_reactions element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode message#34e12c0: field unread_reactions element with index %d: %w", idx, err) } b.Comma() } @@ -1041,29 +1055,24 @@ func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("reply_to") if m.ReplyTo == nil { - return fmt.Errorf("unable to encode message#9a056371: field reply_to is nil") + return fmt.Errorf("unable to encode message#34e12c0: field reply_to is nil") } if err := m.ReplyTo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field reply_to: %w", err) + return fmt.Errorf("unable to encode message#34e12c0: field reply_to: %w", err) } b.Comma() b.FieldStart("message_thread_id") b.PutInt53(m.MessageThreadID) b.Comma() - b.FieldStart("saved_messages_topic") - if m.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode message#9a056371: field saved_messages_topic is nil") - } - if err := m.SavedMessagesTopic.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field saved_messages_topic: %w", err) - } + b.FieldStart("saved_messages_topic_id") + b.PutInt53(m.SavedMessagesTopicID) b.Comma() b.FieldStart("self_destruct_type") if m.SelfDestructType == nil { - return fmt.Errorf("unable to encode message#9a056371: field self_destruct_type is nil") + return fmt.Errorf("unable to encode message#34e12c0: field self_destruct_type is nil") } if err := m.SelfDestructType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field self_destruct_type: %w", err) + return fmt.Errorf("unable to encode message#34e12c0: field self_destruct_type: %w", err) } b.Comma() b.FieldStart("self_destruct_in") @@ -1075,6 +1084,9 @@ func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("via_bot_user_id") b.PutInt53(m.ViaBotUserID) b.Comma() + b.FieldStart("sender_boost_count") + b.PutInt32(m.SenderBoostCount) + b.Comma() b.FieldStart("author_signature") b.PutString(m.AuthorSignature) b.Comma() @@ -1086,18 +1098,18 @@ func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("content") if m.Content == nil { - return fmt.Errorf("unable to encode message#9a056371: field content is nil") + return fmt.Errorf("unable to encode message#34e12c0: field content is nil") } if err := m.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field content: %w", err) + return fmt.Errorf("unable to encode message#34e12c0: field content: %w", err) } b.Comma() b.FieldStart("reply_markup") if m.ReplyMarkup == nil { - return fmt.Errorf("unable to encode message#9a056371: field reply_markup is nil") + return fmt.Errorf("unable to encode message#34e12c0: field reply_markup is nil") } if err := m.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#9a056371: field reply_markup: %w", err) + return fmt.Errorf("unable to encode message#34e12c0: field reply_markup: %w", err) } b.Comma() b.StripComma() @@ -1108,264 +1120,270 @@ func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (m *Message) DecodeTDLibJSON(b tdjson.Decoder) error { if m == nil { - return fmt.Errorf("can't decode message#9a056371 to nil") + return fmt.Errorf("can't decode message#34e12c0 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("message"); err != nil { - return fmt.Errorf("unable to decode message#9a056371: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: %w", err) } case "id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field id: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field id: %w", err) } m.ID = value case "sender_id": value, err := DecodeTDLibJSONMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field sender_id: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field sender_id: %w", err) } m.SenderID = value case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field chat_id: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field chat_id: %w", err) } m.ChatID = value case "sending_state": value, err := DecodeTDLibJSONMessageSendingState(b) if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field sending_state: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field sending_state: %w", err) } m.SendingState = value case "scheduling_state": value, err := DecodeTDLibJSONMessageSchedulingState(b) if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field scheduling_state: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field scheduling_state: %w", err) } m.SchedulingState = value case "is_outgoing": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field is_outgoing: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field is_outgoing: %w", err) } m.IsOutgoing = value case "is_pinned": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field is_pinned: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field is_pinned: %w", err) } m.IsPinned = value case "can_be_edited": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_be_edited: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_be_edited: %w", err) } m.CanBeEdited = value case "can_be_forwarded": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_be_forwarded: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_be_forwarded: %w", err) } m.CanBeForwarded = value case "can_be_replied_in_another_chat": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_be_replied_in_another_chat: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_be_replied_in_another_chat: %w", err) } m.CanBeRepliedInAnotherChat = value case "can_be_saved": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_be_saved: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_be_saved: %w", err) } m.CanBeSaved = value case "can_be_deleted_only_for_self": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_be_deleted_only_for_self: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_be_deleted_only_for_self: %w", err) } m.CanBeDeletedOnlyForSelf = value case "can_be_deleted_for_all_users": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_be_deleted_for_all_users: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_be_deleted_for_all_users: %w", err) } m.CanBeDeletedForAllUsers = value case "can_get_added_reactions": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_get_added_reactions: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_get_added_reactions: %w", err) } m.CanGetAddedReactions = value case "can_get_statistics": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_get_statistics: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_get_statistics: %w", err) } m.CanGetStatistics = value case "can_get_message_thread": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_get_message_thread: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_get_message_thread: %w", err) } m.CanGetMessageThread = value case "can_get_read_date": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_get_read_date: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_get_read_date: %w", err) } m.CanGetReadDate = value case "can_get_viewers": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_get_viewers: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_get_viewers: %w", err) } m.CanGetViewers = value case "can_get_media_timestamp_links": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_get_media_timestamp_links: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_get_media_timestamp_links: %w", err) } m.CanGetMediaTimestampLinks = value case "can_report_reactions": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field can_report_reactions: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field can_report_reactions: %w", err) } m.CanReportReactions = value case "has_timestamped_media": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field has_timestamped_media: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field has_timestamped_media: %w", err) } m.HasTimestampedMedia = value case "is_channel_post": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field is_channel_post: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field is_channel_post: %w", err) } m.IsChannelPost = value case "is_topic_message": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field is_topic_message: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field is_topic_message: %w", err) } m.IsTopicMessage = value case "contains_unread_mention": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field contains_unread_mention: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field contains_unread_mention: %w", err) } m.ContainsUnreadMention = value case "date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field date: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field date: %w", err) } m.Date = value case "edit_date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field edit_date: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field edit_date: %w", err) } m.EditDate = value case "forward_info": if err := m.ForwardInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode message#9a056371: field forward_info: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field forward_info: %w", err) } case "import_info": if err := m.ImportInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode message#9a056371: field import_info: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field import_info: %w", err) } case "interaction_info": if err := m.InteractionInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode message#9a056371: field interaction_info: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field interaction_info: %w", err) } case "unread_reactions": if err := b.Arr(func(b tdjson.Decoder) error { var value UnreadReaction if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode message#9a056371: field unread_reactions: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field unread_reactions: %w", err) } m.UnreadReactions = append(m.UnreadReactions, value) return nil }); err != nil { - return fmt.Errorf("unable to decode message#9a056371: field unread_reactions: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field unread_reactions: %w", err) } case "reply_to": value, err := DecodeTDLibJSONMessageReplyTo(b) if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field reply_to: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field reply_to: %w", err) } m.ReplyTo = value case "message_thread_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field message_thread_id: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field message_thread_id: %w", err) } m.MessageThreadID = value - case "saved_messages_topic": - value, err := DecodeTDLibJSONSavedMessagesTopic(b) + case "saved_messages_topic_id": + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field saved_messages_topic_id: %w", err) } - m.SavedMessagesTopic = value + m.SavedMessagesTopicID = value case "self_destruct_type": value, err := DecodeTDLibJSONMessageSelfDestructType(b) if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field self_destruct_type: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field self_destruct_type: %w", err) } m.SelfDestructType = value case "self_destruct_in": value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field self_destruct_in: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field self_destruct_in: %w", err) } m.SelfDestructIn = value case "auto_delete_in": value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field auto_delete_in: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field auto_delete_in: %w", err) } m.AutoDeleteIn = value case "via_bot_user_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field via_bot_user_id: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field via_bot_user_id: %w", err) } m.ViaBotUserID = value + case "sender_boost_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode message#34e12c0: field sender_boost_count: %w", err) + } + m.SenderBoostCount = value case "author_signature": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field author_signature: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field author_signature: %w", err) } m.AuthorSignature = value case "media_album_id": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field media_album_id: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field media_album_id: %w", err) } m.MediaAlbumID = value case "restriction_reason": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field restriction_reason: %w", err) } m.RestrictionReason = value case "content": value, err := DecodeTDLibJSONMessageContent(b) if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field content: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field content: %w", err) } m.Content = value case "reply_markup": value, err := DecodeTDLibJSONReplyMarkup(b) if err != nil { - return fmt.Errorf("unable to decode message#9a056371: field reply_markup: %w", err) + return fmt.Errorf("unable to decode message#34e12c0: field reply_markup: %w", err) } m.ReplyMarkup = value default: @@ -1631,12 +1649,12 @@ func (m *Message) GetMessageThreadID() (value int64) { return m.MessageThreadID } -// GetSavedMessagesTopic returns value of SavedMessagesTopic field. -func (m *Message) GetSavedMessagesTopic() (value SavedMessagesTopicClass) { +// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. +func (m *Message) GetSavedMessagesTopicID() (value int64) { if m == nil { return } - return m.SavedMessagesTopic + return m.SavedMessagesTopicID } // GetSelfDestructType returns value of SelfDestructType field. @@ -1671,6 +1689,14 @@ func (m *Message) GetViaBotUserID() (value int64) { return m.ViaBotUserID } +// GetSenderBoostCount returns value of SenderBoostCount field. +func (m *Message) GetSenderBoostCount() (value int32) { + if m == nil { + return + } + return m.SenderBoostCount +} + // GetAuthorSignature returns value of AuthorSignature field. func (m *Message) GetAuthorSignature() (value string) { if m == nil { diff --git a/tdapi/tl_message_reactions_gen.go b/tdapi/tl_message_reactions_gen.go index 4835ecd023..b329b5abfd 100644 --- a/tdapi/tl_message_reactions_gen.go +++ b/tdapi/tl_message_reactions_gen.go @@ -35,8 +35,7 @@ var ( type MessageReactions struct { // List of added reactions Reactions []MessageReaction - // True, if the reactions are tags and Telegram Premium users can filter messages by - // them; currently, always false + // True, if the reactions are tags and Telegram Premium users can filter messages by them AreTags bool } diff --git a/tdapi/tl_open_web_app_gen.go b/tdapi/tl_open_web_app_gen.go index d57cbfa336..f68098f3e6 100644 --- a/tdapi/tl_open_web_app_gen.go +++ b/tdapi/tl_open_web_app_gen.go @@ -45,7 +45,7 @@ type OpenWebAppRequest struct { Theme ThemeParameters // Short name of the application; 0-64 English letters, digits, and underscores ApplicationName string - // If not 0, a message thread identifier in which the message will be sent + // If not 0, the message thread identifier in which the message will be sent MessageThreadID int64 // Information about the message or story to be replied in the message sent by the Web // App; pass null if none diff --git a/tdapi/tl_premium_feature_gen.go b/tdapi/tl_premium_feature_gen.go index a073001a73..c4f0c5e503 100644 --- a/tdapi/tl_premium_feature_gen.go +++ b/tdapi/tl_premium_feature_gen.go @@ -2520,6 +2520,399 @@ func (p *PremiumFeatureBackgroundForBoth) DecodeTDLibJSON(b tdjson.Decoder) erro }) } +// PremiumFeatureSavedMessagesTags represents TL type `premiumFeatureSavedMessagesTags#3bcbe986`. +type PremiumFeatureSavedMessagesTags struct { +} + +// PremiumFeatureSavedMessagesTagsTypeID is TL type id of PremiumFeatureSavedMessagesTags. +const PremiumFeatureSavedMessagesTagsTypeID = 0x3bcbe986 + +// construct implements constructor of PremiumFeatureClass. +func (p PremiumFeatureSavedMessagesTags) construct() PremiumFeatureClass { return &p } + +// Ensuring interfaces in compile-time for PremiumFeatureSavedMessagesTags. +var ( + _ bin.Encoder = &PremiumFeatureSavedMessagesTags{} + _ bin.Decoder = &PremiumFeatureSavedMessagesTags{} + _ bin.BareEncoder = &PremiumFeatureSavedMessagesTags{} + _ bin.BareDecoder = &PremiumFeatureSavedMessagesTags{} + + _ PremiumFeatureClass = &PremiumFeatureSavedMessagesTags{} +) + +func (p *PremiumFeatureSavedMessagesTags) Zero() bool { + if p == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (p *PremiumFeatureSavedMessagesTags) String() string { + if p == nil { + return "PremiumFeatureSavedMessagesTags(nil)" + } + type Alias PremiumFeatureSavedMessagesTags + return fmt.Sprintf("PremiumFeatureSavedMessagesTags%+v", Alias(*p)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PremiumFeatureSavedMessagesTags) TypeID() uint32 { + return PremiumFeatureSavedMessagesTagsTypeID +} + +// TypeName returns name of type in TL schema. +func (*PremiumFeatureSavedMessagesTags) TypeName() string { + return "premiumFeatureSavedMessagesTags" +} + +// TypeInfo returns info about TL type. +func (p *PremiumFeatureSavedMessagesTags) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "premiumFeatureSavedMessagesTags", + ID: PremiumFeatureSavedMessagesTagsTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (p *PremiumFeatureSavedMessagesTags) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode premiumFeatureSavedMessagesTags#3bcbe986 as nil") + } + b.PutID(PremiumFeatureSavedMessagesTagsTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *PremiumFeatureSavedMessagesTags) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode premiumFeatureSavedMessagesTags#3bcbe986 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (p *PremiumFeatureSavedMessagesTags) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode premiumFeatureSavedMessagesTags#3bcbe986 to nil") + } + if err := b.ConsumeID(PremiumFeatureSavedMessagesTagsTypeID); err != nil { + return fmt.Errorf("unable to decode premiumFeatureSavedMessagesTags#3bcbe986: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *PremiumFeatureSavedMessagesTags) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode premiumFeatureSavedMessagesTags#3bcbe986 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (p *PremiumFeatureSavedMessagesTags) EncodeTDLibJSON(b tdjson.Encoder) error { + if p == nil { + return fmt.Errorf("can't encode premiumFeatureSavedMessagesTags#3bcbe986 as nil") + } + b.ObjStart() + b.PutID("premiumFeatureSavedMessagesTags") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (p *PremiumFeatureSavedMessagesTags) DecodeTDLibJSON(b tdjson.Decoder) error { + if p == nil { + return fmt.Errorf("can't decode premiumFeatureSavedMessagesTags#3bcbe986 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("premiumFeatureSavedMessagesTags"); err != nil { + return fmt.Errorf("unable to decode premiumFeatureSavedMessagesTags#3bcbe986: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// PremiumFeatureMessagePrivacy represents TL type `premiumFeatureMessagePrivacy#2fd278f6`. +type PremiumFeatureMessagePrivacy struct { +} + +// PremiumFeatureMessagePrivacyTypeID is TL type id of PremiumFeatureMessagePrivacy. +const PremiumFeatureMessagePrivacyTypeID = 0x2fd278f6 + +// construct implements constructor of PremiumFeatureClass. +func (p PremiumFeatureMessagePrivacy) construct() PremiumFeatureClass { return &p } + +// Ensuring interfaces in compile-time for PremiumFeatureMessagePrivacy. +var ( + _ bin.Encoder = &PremiumFeatureMessagePrivacy{} + _ bin.Decoder = &PremiumFeatureMessagePrivacy{} + _ bin.BareEncoder = &PremiumFeatureMessagePrivacy{} + _ bin.BareDecoder = &PremiumFeatureMessagePrivacy{} + + _ PremiumFeatureClass = &PremiumFeatureMessagePrivacy{} +) + +func (p *PremiumFeatureMessagePrivacy) Zero() bool { + if p == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (p *PremiumFeatureMessagePrivacy) String() string { + if p == nil { + return "PremiumFeatureMessagePrivacy(nil)" + } + type Alias PremiumFeatureMessagePrivacy + return fmt.Sprintf("PremiumFeatureMessagePrivacy%+v", Alias(*p)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PremiumFeatureMessagePrivacy) TypeID() uint32 { + return PremiumFeatureMessagePrivacyTypeID +} + +// TypeName returns name of type in TL schema. +func (*PremiumFeatureMessagePrivacy) TypeName() string { + return "premiumFeatureMessagePrivacy" +} + +// TypeInfo returns info about TL type. +func (p *PremiumFeatureMessagePrivacy) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "premiumFeatureMessagePrivacy", + ID: PremiumFeatureMessagePrivacyTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (p *PremiumFeatureMessagePrivacy) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode premiumFeatureMessagePrivacy#2fd278f6 as nil") + } + b.PutID(PremiumFeatureMessagePrivacyTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *PremiumFeatureMessagePrivacy) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode premiumFeatureMessagePrivacy#2fd278f6 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (p *PremiumFeatureMessagePrivacy) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode premiumFeatureMessagePrivacy#2fd278f6 to nil") + } + if err := b.ConsumeID(PremiumFeatureMessagePrivacyTypeID); err != nil { + return fmt.Errorf("unable to decode premiumFeatureMessagePrivacy#2fd278f6: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *PremiumFeatureMessagePrivacy) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode premiumFeatureMessagePrivacy#2fd278f6 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (p *PremiumFeatureMessagePrivacy) EncodeTDLibJSON(b tdjson.Encoder) error { + if p == nil { + return fmt.Errorf("can't encode premiumFeatureMessagePrivacy#2fd278f6 as nil") + } + b.ObjStart() + b.PutID("premiumFeatureMessagePrivacy") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (p *PremiumFeatureMessagePrivacy) DecodeTDLibJSON(b tdjson.Decoder) error { + if p == nil { + return fmt.Errorf("can't decode premiumFeatureMessagePrivacy#2fd278f6 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("premiumFeatureMessagePrivacy"); err != nil { + return fmt.Errorf("unable to decode premiumFeatureMessagePrivacy#2fd278f6: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// PremiumFeatureLastSeenTimes represents TL type `premiumFeatureLastSeenTimes#d2914a8f`. +type PremiumFeatureLastSeenTimes struct { +} + +// PremiumFeatureLastSeenTimesTypeID is TL type id of PremiumFeatureLastSeenTimes. +const PremiumFeatureLastSeenTimesTypeID = 0xd2914a8f + +// construct implements constructor of PremiumFeatureClass. +func (p PremiumFeatureLastSeenTimes) construct() PremiumFeatureClass { return &p } + +// Ensuring interfaces in compile-time for PremiumFeatureLastSeenTimes. +var ( + _ bin.Encoder = &PremiumFeatureLastSeenTimes{} + _ bin.Decoder = &PremiumFeatureLastSeenTimes{} + _ bin.BareEncoder = &PremiumFeatureLastSeenTimes{} + _ bin.BareDecoder = &PremiumFeatureLastSeenTimes{} + + _ PremiumFeatureClass = &PremiumFeatureLastSeenTimes{} +) + +func (p *PremiumFeatureLastSeenTimes) Zero() bool { + if p == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (p *PremiumFeatureLastSeenTimes) String() string { + if p == nil { + return "PremiumFeatureLastSeenTimes(nil)" + } + type Alias PremiumFeatureLastSeenTimes + return fmt.Sprintf("PremiumFeatureLastSeenTimes%+v", Alias(*p)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PremiumFeatureLastSeenTimes) TypeID() uint32 { + return PremiumFeatureLastSeenTimesTypeID +} + +// TypeName returns name of type in TL schema. +func (*PremiumFeatureLastSeenTimes) TypeName() string { + return "premiumFeatureLastSeenTimes" +} + +// TypeInfo returns info about TL type. +func (p *PremiumFeatureLastSeenTimes) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "premiumFeatureLastSeenTimes", + ID: PremiumFeatureLastSeenTimesTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (p *PremiumFeatureLastSeenTimes) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode premiumFeatureLastSeenTimes#d2914a8f as nil") + } + b.PutID(PremiumFeatureLastSeenTimesTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *PremiumFeatureLastSeenTimes) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode premiumFeatureLastSeenTimes#d2914a8f as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (p *PremiumFeatureLastSeenTimes) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode premiumFeatureLastSeenTimes#d2914a8f to nil") + } + if err := b.ConsumeID(PremiumFeatureLastSeenTimesTypeID); err != nil { + return fmt.Errorf("unable to decode premiumFeatureLastSeenTimes#d2914a8f: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *PremiumFeatureLastSeenTimes) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode premiumFeatureLastSeenTimes#d2914a8f to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (p *PremiumFeatureLastSeenTimes) EncodeTDLibJSON(b tdjson.Encoder) error { + if p == nil { + return fmt.Errorf("can't encode premiumFeatureLastSeenTimes#d2914a8f as nil") + } + b.ObjStart() + b.PutID("premiumFeatureLastSeenTimes") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (p *PremiumFeatureLastSeenTimes) DecodeTDLibJSON(b tdjson.Decoder) error { + if p == nil { + return fmt.Errorf("can't decode premiumFeatureLastSeenTimes#d2914a8f to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("premiumFeatureLastSeenTimes"); err != nil { + return fmt.Errorf("unable to decode premiumFeatureLastSeenTimes#d2914a8f: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + // PremiumFeatureClassName is schema name of PremiumFeatureClass. const PremiumFeatureClassName = "PremiumFeature" @@ -2551,6 +2944,9 @@ const PremiumFeatureClassName = "PremiumFeature" // case *tdapi.PremiumFeatureChatBoost: // premiumFeatureChatBoost#5df89f1b // case *tdapi.PremiumFeatureAccentColor: // premiumFeatureAccentColor#361ac59e // case *tdapi.PremiumFeatureBackgroundForBoth: // premiumFeatureBackgroundForBoth#2246eefa +// case *tdapi.PremiumFeatureSavedMessagesTags: // premiumFeatureSavedMessagesTags#3bcbe986 +// case *tdapi.PremiumFeatureMessagePrivacy: // premiumFeatureMessagePrivacy#2fd278f6 +// case *tdapi.PremiumFeatureLastSeenTimes: // premiumFeatureLastSeenTimes#d2914a8f // default: panic(v) // } type PremiumFeatureClass interface { @@ -2715,6 +3111,27 @@ func DecodePremiumFeature(buf *bin.Buffer) (PremiumFeatureClass, error) { return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) } return &v, nil + case PremiumFeatureSavedMessagesTagsTypeID: + // Decoding premiumFeatureSavedMessagesTags#3bcbe986. + v := PremiumFeatureSavedMessagesTags{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) + } + return &v, nil + case PremiumFeatureMessagePrivacyTypeID: + // Decoding premiumFeatureMessagePrivacy#2fd278f6. + v := PremiumFeatureMessagePrivacy{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) + } + return &v, nil + case PremiumFeatureLastSeenTimesTypeID: + // Decoding premiumFeatureLastSeenTimes#d2914a8f. + v := PremiumFeatureLastSeenTimes{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", bin.NewUnexpectedID(id)) } @@ -2860,6 +3277,27 @@ func DecodeTDLibJSONPremiumFeature(buf tdjson.Decoder) (PremiumFeatureClass, err return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) } return &v, nil + case "premiumFeatureSavedMessagesTags": + // Decoding premiumFeatureSavedMessagesTags#3bcbe986. + v := PremiumFeatureSavedMessagesTags{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) + } + return &v, nil + case "premiumFeatureMessagePrivacy": + // Decoding premiumFeatureMessagePrivacy#2fd278f6. + v := PremiumFeatureMessagePrivacy{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) + } + return &v, nil + case "premiumFeatureLastSeenTimes": + // Decoding premiumFeatureLastSeenTimes#d2914a8f. + v := PremiumFeatureLastSeenTimes{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", tdjson.NewUnexpectedID(id)) } diff --git a/tdapi/tl_premium_giveaway_parameters_gen.go b/tdapi/tl_premium_giveaway_parameters_gen.go index e4de1e34b1..00a40ae43b 100644 --- a/tdapi/tl_premium_giveaway_parameters_gen.go +++ b/tdapi/tl_premium_giveaway_parameters_gen.go @@ -33,12 +33,12 @@ var ( // PremiumGiveawayParameters represents TL type `premiumGiveawayParameters#f9f5bf5e`. type PremiumGiveawayParameters struct { - // Identifier of the channel chat, which will be automatically boosted by the winners of - // the giveaway for duration of the Premium subscription + // Identifier of the supergroup or channel chat, which will be automatically boosted by + // the winners of the giveaway for duration of the Premium subscription. BoostedChatID int64 - // Identifiers of other channel chats that must be subscribed by the users to be eligible - // for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") - // additional chats + // Identifiers of other supergroup or channel chats that must be subscribed by the users + // to be eligible for the giveaway. There can be up to + // getOption("giveaway_additional_chat_count_max") additional chats AdditionalChatIDs []int64 // Point in time (Unix timestamp) when the giveaway is expected to be performed; must be // 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways diff --git a/tdapi/tl_premium_story_feature_gen.go b/tdapi/tl_premium_story_feature_gen.go index 8bef0c744e..d3ffd1b05c 100644 --- a/tdapi/tl_premium_story_feature_gen.go +++ b/tdapi/tl_premium_story_feature_gen.go @@ -817,6 +817,137 @@ func (p *PremiumStoryFeatureLinksAndFormatting) DecodeTDLibJSON(b tdjson.Decoder }) } +// PremiumStoryFeatureVideoQuality represents TL type `premiumStoryFeatureVideoQuality#baafbea9`. +type PremiumStoryFeatureVideoQuality struct { +} + +// PremiumStoryFeatureVideoQualityTypeID is TL type id of PremiumStoryFeatureVideoQuality. +const PremiumStoryFeatureVideoQualityTypeID = 0xbaafbea9 + +// construct implements constructor of PremiumStoryFeatureClass. +func (p PremiumStoryFeatureVideoQuality) construct() PremiumStoryFeatureClass { return &p } + +// Ensuring interfaces in compile-time for PremiumStoryFeatureVideoQuality. +var ( + _ bin.Encoder = &PremiumStoryFeatureVideoQuality{} + _ bin.Decoder = &PremiumStoryFeatureVideoQuality{} + _ bin.BareEncoder = &PremiumStoryFeatureVideoQuality{} + _ bin.BareDecoder = &PremiumStoryFeatureVideoQuality{} + + _ PremiumStoryFeatureClass = &PremiumStoryFeatureVideoQuality{} +) + +func (p *PremiumStoryFeatureVideoQuality) Zero() bool { + if p == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (p *PremiumStoryFeatureVideoQuality) String() string { + if p == nil { + return "PremiumStoryFeatureVideoQuality(nil)" + } + type Alias PremiumStoryFeatureVideoQuality + return fmt.Sprintf("PremiumStoryFeatureVideoQuality%+v", Alias(*p)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PremiumStoryFeatureVideoQuality) TypeID() uint32 { + return PremiumStoryFeatureVideoQualityTypeID +} + +// TypeName returns name of type in TL schema. +func (*PremiumStoryFeatureVideoQuality) TypeName() string { + return "premiumStoryFeatureVideoQuality" +} + +// TypeInfo returns info about TL type. +func (p *PremiumStoryFeatureVideoQuality) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "premiumStoryFeatureVideoQuality", + ID: PremiumStoryFeatureVideoQualityTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (p *PremiumStoryFeatureVideoQuality) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode premiumStoryFeatureVideoQuality#baafbea9 as nil") + } + b.PutID(PremiumStoryFeatureVideoQualityTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *PremiumStoryFeatureVideoQuality) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode premiumStoryFeatureVideoQuality#baafbea9 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (p *PremiumStoryFeatureVideoQuality) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode premiumStoryFeatureVideoQuality#baafbea9 to nil") + } + if err := b.ConsumeID(PremiumStoryFeatureVideoQualityTypeID); err != nil { + return fmt.Errorf("unable to decode premiumStoryFeatureVideoQuality#baafbea9: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *PremiumStoryFeatureVideoQuality) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode premiumStoryFeatureVideoQuality#baafbea9 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (p *PremiumStoryFeatureVideoQuality) EncodeTDLibJSON(b tdjson.Encoder) error { + if p == nil { + return fmt.Errorf("can't encode premiumStoryFeatureVideoQuality#baafbea9 as nil") + } + b.ObjStart() + b.PutID("premiumStoryFeatureVideoQuality") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (p *PremiumStoryFeatureVideoQuality) DecodeTDLibJSON(b tdjson.Decoder) error { + if p == nil { + return fmt.Errorf("can't decode premiumStoryFeatureVideoQuality#baafbea9 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("premiumStoryFeatureVideoQuality"); err != nil { + return fmt.Errorf("unable to decode premiumStoryFeatureVideoQuality#baafbea9: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + // PremiumStoryFeatureClassName is schema name of PremiumStoryFeatureClass. const PremiumStoryFeatureClassName = "PremiumStoryFeature" @@ -835,6 +966,7 @@ const PremiumStoryFeatureClassName = "PremiumStoryFeature" // case *tdapi.PremiumStoryFeatureCustomExpirationDuration: // premiumStoryFeatureCustomExpirationDuration#dca40a96 // case *tdapi.PremiumStoryFeatureSaveStories: // premiumStoryFeatureSaveStories#a6842fbd // case *tdapi.PremiumStoryFeatureLinksAndFormatting: // premiumStoryFeatureLinksAndFormatting#dae383f7 +// case *tdapi.PremiumStoryFeatureVideoQuality: // premiumStoryFeatureVideoQuality#baafbea9 // default: panic(v) // } type PremiumStoryFeatureClass interface { @@ -908,6 +1040,13 @@ func DecodePremiumStoryFeature(buf *bin.Buffer) (PremiumStoryFeatureClass, error return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", err) } return &v, nil + case PremiumStoryFeatureVideoQualityTypeID: + // Decoding premiumStoryFeatureVideoQuality#baafbea9. + v := PremiumStoryFeatureVideoQuality{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", bin.NewUnexpectedID(id)) } @@ -962,6 +1101,13 @@ func DecodeTDLibJSONPremiumStoryFeature(buf tdjson.Decoder) (PremiumStoryFeature return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", err) } return &v, nil + case "premiumStoryFeatureVideoQuality": + // Decoding premiumStoryFeatureVideoQuality#baafbea9. + v := PremiumStoryFeatureVideoQuality{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", tdjson.NewUnexpectedID(id)) } diff --git a/tdapi/tl_profile_accent_color_gen.go b/tdapi/tl_profile_accent_color_gen.go index 545a200a1e..3ed2d11eba 100644 --- a/tdapi/tl_profile_accent_color_gen.go +++ b/tdapi/tl_profile_accent_color_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// ProfileAccentColor represents TL type `profileAccentColor#87d7df12`. +// ProfileAccentColor represents TL type `profileAccentColor#213d8295`. type ProfileAccentColor struct { // Profile accent color identifier ID int32 @@ -39,12 +39,14 @@ type ProfileAccentColor struct { LightThemeColors ProfileAccentColors // Accent colors expected to be used in dark themes DarkThemeColors ProfileAccentColors - // The minimum chat boost level required to use the color - MinChatBoostLevel int32 + // The minimum chat boost level required to use the color in a supergroup chat + MinSupergroupChatBoostLevel int32 + // The minimum chat boost level required to use the color in a channel chat + MinChannelChatBoostLevel int32 } // ProfileAccentColorTypeID is TL type id of ProfileAccentColor. -const ProfileAccentColorTypeID = 0x87d7df12 +const ProfileAccentColorTypeID = 0x213d8295 // Ensuring interfaces in compile-time for ProfileAccentColor. var ( @@ -67,7 +69,10 @@ func (p *ProfileAccentColor) Zero() bool { if !(p.DarkThemeColors.Zero()) { return false } - if !(p.MinChatBoostLevel == 0) { + if !(p.MinSupergroupChatBoostLevel == 0) { + return false + } + if !(p.MinChannelChatBoostLevel == 0) { return false } @@ -119,8 +124,12 @@ func (p *ProfileAccentColor) TypeInfo() tdp.Type { SchemaName: "dark_theme_colors", }, { - Name: "MinChatBoostLevel", - SchemaName: "min_chat_boost_level", + Name: "MinSupergroupChatBoostLevel", + SchemaName: "min_supergroup_chat_boost_level", + }, + { + Name: "MinChannelChatBoostLevel", + SchemaName: "min_channel_chat_boost_level", }, } return typ @@ -129,7 +138,7 @@ func (p *ProfileAccentColor) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (p *ProfileAccentColor) Encode(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't encode profileAccentColor#87d7df12 as nil") + return fmt.Errorf("can't encode profileAccentColor#213d8295 as nil") } b.PutID(ProfileAccentColorTypeID) return p.EncodeBare(b) @@ -138,26 +147,27 @@ func (p *ProfileAccentColor) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (p *ProfileAccentColor) EncodeBare(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't encode profileAccentColor#87d7df12 as nil") + return fmt.Errorf("can't encode profileAccentColor#213d8295 as nil") } b.PutInt32(p.ID) if err := p.LightThemeColors.Encode(b); err != nil { - return fmt.Errorf("unable to encode profileAccentColor#87d7df12: field light_theme_colors: %w", err) + return fmt.Errorf("unable to encode profileAccentColor#213d8295: field light_theme_colors: %w", err) } if err := p.DarkThemeColors.Encode(b); err != nil { - return fmt.Errorf("unable to encode profileAccentColor#87d7df12: field dark_theme_colors: %w", err) + return fmt.Errorf("unable to encode profileAccentColor#213d8295: field dark_theme_colors: %w", err) } - b.PutInt32(p.MinChatBoostLevel) + b.PutInt32(p.MinSupergroupChatBoostLevel) + b.PutInt32(p.MinChannelChatBoostLevel) return nil } // Decode implements bin.Decoder. func (p *ProfileAccentColor) Decode(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't decode profileAccentColor#87d7df12 to nil") + return fmt.Errorf("can't decode profileAccentColor#213d8295 to nil") } if err := b.ConsumeID(ProfileAccentColorTypeID); err != nil { - return fmt.Errorf("unable to decode profileAccentColor#87d7df12: %w", err) + return fmt.Errorf("unable to decode profileAccentColor#213d8295: %w", err) } return p.DecodeBare(b) } @@ -165,31 +175,38 @@ func (p *ProfileAccentColor) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (p *ProfileAccentColor) DecodeBare(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't decode profileAccentColor#87d7df12 to nil") + return fmt.Errorf("can't decode profileAccentColor#213d8295 to nil") } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode profileAccentColor#87d7df12: field id: %w", err) + return fmt.Errorf("unable to decode profileAccentColor#213d8295: field id: %w", err) } p.ID = value } { if err := p.LightThemeColors.Decode(b); err != nil { - return fmt.Errorf("unable to decode profileAccentColor#87d7df12: field light_theme_colors: %w", err) + return fmt.Errorf("unable to decode profileAccentColor#213d8295: field light_theme_colors: %w", err) } } { if err := p.DarkThemeColors.Decode(b); err != nil { - return fmt.Errorf("unable to decode profileAccentColor#87d7df12: field dark_theme_colors: %w", err) + return fmt.Errorf("unable to decode profileAccentColor#213d8295: field dark_theme_colors: %w", err) + } + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode profileAccentColor#213d8295: field min_supergroup_chat_boost_level: %w", err) } + p.MinSupergroupChatBoostLevel = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode profileAccentColor#87d7df12: field min_chat_boost_level: %w", err) + return fmt.Errorf("unable to decode profileAccentColor#213d8295: field min_channel_chat_boost_level: %w", err) } - p.MinChatBoostLevel = value + p.MinChannelChatBoostLevel = value } return nil } @@ -197,7 +214,7 @@ func (p *ProfileAccentColor) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (p *ProfileAccentColor) EncodeTDLibJSON(b tdjson.Encoder) error { if p == nil { - return fmt.Errorf("can't encode profileAccentColor#87d7df12 as nil") + return fmt.Errorf("can't encode profileAccentColor#213d8295 as nil") } b.ObjStart() b.PutID("profileAccentColor") @@ -207,16 +224,19 @@ func (p *ProfileAccentColor) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("light_theme_colors") if err := p.LightThemeColors.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode profileAccentColor#87d7df12: field light_theme_colors: %w", err) + return fmt.Errorf("unable to encode profileAccentColor#213d8295: field light_theme_colors: %w", err) } b.Comma() b.FieldStart("dark_theme_colors") if err := p.DarkThemeColors.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode profileAccentColor#87d7df12: field dark_theme_colors: %w", err) + return fmt.Errorf("unable to encode profileAccentColor#213d8295: field dark_theme_colors: %w", err) } b.Comma() - b.FieldStart("min_chat_boost_level") - b.PutInt32(p.MinChatBoostLevel) + b.FieldStart("min_supergroup_chat_boost_level") + b.PutInt32(p.MinSupergroupChatBoostLevel) + b.Comma() + b.FieldStart("min_channel_chat_boost_level") + b.PutInt32(p.MinChannelChatBoostLevel) b.Comma() b.StripComma() b.ObjEnd() @@ -226,35 +246,41 @@ func (p *ProfileAccentColor) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (p *ProfileAccentColor) DecodeTDLibJSON(b tdjson.Decoder) error { if p == nil { - return fmt.Errorf("can't decode profileAccentColor#87d7df12 to nil") + return fmt.Errorf("can't decode profileAccentColor#213d8295 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("profileAccentColor"); err != nil { - return fmt.Errorf("unable to decode profileAccentColor#87d7df12: %w", err) + return fmt.Errorf("unable to decode profileAccentColor#213d8295: %w", err) } case "id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode profileAccentColor#87d7df12: field id: %w", err) + return fmt.Errorf("unable to decode profileAccentColor#213d8295: field id: %w", err) } p.ID = value case "light_theme_colors": if err := p.LightThemeColors.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode profileAccentColor#87d7df12: field light_theme_colors: %w", err) + return fmt.Errorf("unable to decode profileAccentColor#213d8295: field light_theme_colors: %w", err) } case "dark_theme_colors": if err := p.DarkThemeColors.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode profileAccentColor#87d7df12: field dark_theme_colors: %w", err) + return fmt.Errorf("unable to decode profileAccentColor#213d8295: field dark_theme_colors: %w", err) } - case "min_chat_boost_level": + case "min_supergroup_chat_boost_level": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode profileAccentColor#87d7df12: field min_chat_boost_level: %w", err) + return fmt.Errorf("unable to decode profileAccentColor#213d8295: field min_supergroup_chat_boost_level: %w", err) } - p.MinChatBoostLevel = value + p.MinSupergroupChatBoostLevel = value + case "min_channel_chat_boost_level": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode profileAccentColor#213d8295: field min_channel_chat_boost_level: %w", err) + } + p.MinChannelChatBoostLevel = value default: return b.Skip() } @@ -286,10 +312,18 @@ func (p *ProfileAccentColor) GetDarkThemeColors() (value ProfileAccentColors) { return p.DarkThemeColors } -// GetMinChatBoostLevel returns value of MinChatBoostLevel field. -func (p *ProfileAccentColor) GetMinChatBoostLevel() (value int32) { +// GetMinSupergroupChatBoostLevel returns value of MinSupergroupChatBoostLevel field. +func (p *ProfileAccentColor) GetMinSupergroupChatBoostLevel() (value int32) { + if p == nil { + return + } + return p.MinSupergroupChatBoostLevel +} + +// GetMinChannelChatBoostLevel returns value of MinChannelChatBoostLevel field. +func (p *ProfileAccentColor) GetMinChannelChatBoostLevel() (value int32) { if p == nil { return } - return p.MinChatBoostLevel + return p.MinChannelChatBoostLevel } diff --git a/tdapi/tl_register_user_gen.go b/tdapi/tl_register_user_gen.go index e52e353e84..98200b95eb 100644 --- a/tdapi/tl_register_user_gen.go +++ b/tdapi/tl_register_user_gen.go @@ -31,16 +31,19 @@ var ( _ = tdjson.Encoder{} ) -// RegisterUserRequest represents TL type `registerUser#f9719e1d`. +// RegisterUserRequest represents TL type `registerUser#c3aa52ec`. type RegisterUserRequest struct { // The first name of the user; 1-64 characters FirstName string // The last name of the user; 0-64 characters LastName string + // Pass true to disable notification about the current user joining Telegram for other + // users that added them to contact list + DisableNotification bool } // RegisterUserRequestTypeID is TL type id of RegisterUserRequest. -const RegisterUserRequestTypeID = 0xf9719e1d +const RegisterUserRequestTypeID = 0xc3aa52ec // Ensuring interfaces in compile-time for RegisterUserRequest. var ( @@ -60,6 +63,9 @@ func (r *RegisterUserRequest) Zero() bool { if !(r.LastName == "") { return false } + if !(r.DisableNotification == false) { + return false + } return true } @@ -104,6 +110,10 @@ func (r *RegisterUserRequest) TypeInfo() tdp.Type { Name: "LastName", SchemaName: "last_name", }, + { + Name: "DisableNotification", + SchemaName: "disable_notification", + }, } return typ } @@ -111,7 +121,7 @@ func (r *RegisterUserRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (r *RegisterUserRequest) Encode(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't encode registerUser#f9719e1d as nil") + return fmt.Errorf("can't encode registerUser#c3aa52ec as nil") } b.PutID(RegisterUserRequestTypeID) return r.EncodeBare(b) @@ -120,20 +130,21 @@ func (r *RegisterUserRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (r *RegisterUserRequest) EncodeBare(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't encode registerUser#f9719e1d as nil") + return fmt.Errorf("can't encode registerUser#c3aa52ec as nil") } b.PutString(r.FirstName) b.PutString(r.LastName) + b.PutBool(r.DisableNotification) return nil } // Decode implements bin.Decoder. func (r *RegisterUserRequest) Decode(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't decode registerUser#f9719e1d to nil") + return fmt.Errorf("can't decode registerUser#c3aa52ec to nil") } if err := b.ConsumeID(RegisterUserRequestTypeID); err != nil { - return fmt.Errorf("unable to decode registerUser#f9719e1d: %w", err) + return fmt.Errorf("unable to decode registerUser#c3aa52ec: %w", err) } return r.DecodeBare(b) } @@ -141,29 +152,36 @@ func (r *RegisterUserRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (r *RegisterUserRequest) DecodeBare(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't decode registerUser#f9719e1d to nil") + return fmt.Errorf("can't decode registerUser#c3aa52ec to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode registerUser#f9719e1d: field first_name: %w", err) + return fmt.Errorf("unable to decode registerUser#c3aa52ec: field first_name: %w", err) } r.FirstName = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode registerUser#f9719e1d: field last_name: %w", err) + return fmt.Errorf("unable to decode registerUser#c3aa52ec: field last_name: %w", err) } r.LastName = value } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode registerUser#c3aa52ec: field disable_notification: %w", err) + } + r.DisableNotification = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (r *RegisterUserRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if r == nil { - return fmt.Errorf("can't encode registerUser#f9719e1d as nil") + return fmt.Errorf("can't encode registerUser#c3aa52ec as nil") } b.ObjStart() b.PutID("registerUser") @@ -174,6 +192,9 @@ func (r *RegisterUserRequest) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("last_name") b.PutString(r.LastName) b.Comma() + b.FieldStart("disable_notification") + b.PutBool(r.DisableNotification) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -182,27 +203,33 @@ func (r *RegisterUserRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (r *RegisterUserRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if r == nil { - return fmt.Errorf("can't decode registerUser#f9719e1d to nil") + return fmt.Errorf("can't decode registerUser#c3aa52ec to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("registerUser"); err != nil { - return fmt.Errorf("unable to decode registerUser#f9719e1d: %w", err) + return fmt.Errorf("unable to decode registerUser#c3aa52ec: %w", err) } case "first_name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode registerUser#f9719e1d: field first_name: %w", err) + return fmt.Errorf("unable to decode registerUser#c3aa52ec: field first_name: %w", err) } r.FirstName = value case "last_name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode registerUser#f9719e1d: field last_name: %w", err) + return fmt.Errorf("unable to decode registerUser#c3aa52ec: field last_name: %w", err) } r.LastName = value + case "disable_notification": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode registerUser#c3aa52ec: field disable_notification: %w", err) + } + r.DisableNotification = value default: return b.Skip() } @@ -226,7 +253,15 @@ func (r *RegisterUserRequest) GetLastName() (value string) { return r.LastName } -// RegisterUser invokes method registerUser#f9719e1d returning error if any. +// GetDisableNotification returns value of DisableNotification field. +func (r *RegisterUserRequest) GetDisableNotification() (value bool) { + if r == nil { + return + } + return r.DisableNotification +} + +// RegisterUser invokes method registerUser#c3aa52ec returning error if any. func (c *Client) RegisterUser(ctx context.Context, request *RegisterUserRequest) error { var ok Ok diff --git a/tdapi/tl_registry_gen.go b/tdapi/tl_registry_gen.go index 91c9715f56..a25bb3c643 100644 --- a/tdapi/tl_registry_gen.go +++ b/tdapi/tl_registry_gen.go @@ -165,9 +165,9 @@ func TypesMap() map[uint32]string { PremiumGiveawayParticipantStatusDisallowedCountryTypeID: "premiumGiveawayParticipantStatusDisallowedCountry#89684090", PremiumGiveawayInfoOngoingTypeID: "premiumGiveawayInfoOngoing#48d3ce6f", PremiumGiveawayInfoCompletedTypeID: "premiumGiveawayInfoCompleted#fc8b501b", - AccentColorTypeID: "accentColor#ed4c76c9", + AccentColorTypeID: "accentColor#53312690", ProfileAccentColorsTypeID: "profileAccentColors#218e9367", - ProfileAccentColorTypeID: "profileAccentColor#87d7df12", + ProfileAccentColorTypeID: "profileAccentColor#213d8295", EmojiStatusTypeID: "emojiStatus#dbd91636", EmojiStatusesTypeID: "emojiStatuses#eaeb9bdc", UsernamesTypeID: "usernames#bf343063", @@ -216,7 +216,7 @@ func TypesMap() map[uint32]string { BasicGroupTypeID: "basicGroup#f464168f", BasicGroupFullInfoTypeID: "basicGroupFullInfo#d62e521e", SupergroupTypeID: "supergroup#39a14289", - SupergroupFullInfoTypeID: "supergroupFullInfo#f2f19203", + SupergroupFullInfoTypeID: "supergroupFullInfo#3459badb", SecretChatStatePendingTypeID: "secretChatStatePending#9e6c967c", SecretChatStateReadyTypeID: "secretChatStateReady#9ff4b7e9", SecretChatStateClosedTypeID: "secretChatStateClosed#8c1006ed", @@ -255,7 +255,7 @@ func TypesMap() map[uint32]string { MessageReplyToStoryTypeID: "messageReplyToStory#708ca939", InputMessageReplyToMessageTypeID: "inputMessageReplyToMessage#11e3fd76", InputMessageReplyToStoryTypeID: "inputMessageReplyToStory#51aece78", - MessageTypeID: "message#9a056371", + MessageTypeID: "message#34e12c0", MessagesTypeID: "messages#b34c8c60", FoundMessagesTypeID: "foundMessages#2515f708", FoundChatMessagesTypeID: "foundChatMessages#4a25270c", @@ -355,11 +355,10 @@ func TypesMap() map[uint32]string { FoundWebAppTypeID: "foundWebApp#eea8d01e", WebAppInfoTypeID: "webAppInfo#2efdb2e8", MessageThreadInfoTypeID: "messageThreadInfo#683fd5ad", - SavedMessagesTopicMyNotesTypeID: "savedMessagesTopicMyNotes#9dd7231d", - SavedMessagesTopicAuthorHiddenTypeID: "savedMessagesTopicAuthorHidden#6e75aff7", - SavedMessagesTopicSavedFromChatTypeID: "savedMessagesTopicSavedFromChat#16543670", - FoundSavedMessagesTopicTypeID: "foundSavedMessagesTopic#240681ec", - FoundSavedMessagesTopicsTypeID: "foundSavedMessagesTopics#60f30fbf", + SavedMessagesTopicTypeMyNotesTypeID: "savedMessagesTopicTypeMyNotes#b38a41f5", + SavedMessagesTopicTypeAuthorHiddenTypeID: "savedMessagesTopicTypeAuthorHidden#703c4195", + SavedMessagesTopicTypeSavedFromChatTypeID: "savedMessagesTopicTypeSavedFromChat#993fad58", + SavedMessagesTopicTypeID: "savedMessagesTopic#d2a8e1a4", ForumTopicIconTypeID: "forumTopicIcon#cf32a193", ForumTopicInfoTypeID: "forumTopicInfo#8ff3df9e", ForumTopicTypeID: "forumTopic#1213ace6", @@ -571,6 +570,7 @@ func TypesMap() map[uint32]string { MessageChatSetBackgroundTypeID: "messageChatSetBackground#3d5d7c40", MessageChatSetThemeTypeID: "messageChatSetTheme#99ae9408", MessageChatSetMessageAutoDeleteTimeTypeID: "messageChatSetMessageAutoDeleteTime#619e052e", + MessageChatBoostTypeID: "messageChatBoost#5e5f658b", MessageForumTopicCreatedTypeID: "messageForumTopicCreated#b8ce47d1", MessageForumTopicEditedTypeID: "messageForumTopicEdited#c0b780", MessageForumTopicIsClosedToggledTypeID: "messageForumTopicIsClosedToggled#4b578fe0", @@ -718,7 +718,7 @@ func TypesMap() map[uint32]string { StoryOriginHiddenUserTypeID: "storyOriginHiddenUser#5a1f89ec", StoryRepostInfoTypeID: "storyRepostInfo#ff7fa440", StoryInteractionInfoTypeID: "storyInteractionInfo#e1557fc7", - StoryTypeID: "story#8e358ca2", + StoryTypeID: "story#27f4e5b1", StoriesTypeID: "stories#5a860711", StoryFullIDTypeID: "storyFullId#701d31f5", StoryInfoTypeID: "storyInfo#8997c352", @@ -731,8 +731,8 @@ func TypesMap() map[uint32]string { PublicForwardMessageTypeID: "publicForwardMessage#317b3d2", PublicForwardStoryTypeID: "publicForwardStory#7fdf26af", PublicForwardsTypeID: "publicForwards#3ed29447", - ChatBoostLevelFeaturesTypeID: "chatBoostLevelFeatures#fe9f29de", - ChatBoostFeaturesTypeID: "chatBoostFeatures#4dd864af", + ChatBoostLevelFeaturesTypeID: "chatBoostLevelFeatures#d248546f", + ChatBoostFeaturesTypeID: "chatBoostFeatures#1921fd49", ChatBoostSourceGiftCodeTypeID: "chatBoostSourceGiftCode#fa2412ba", ChatBoostSourceGiveawayTypeID: "chatBoostSourceGiveaway#90d1c70", ChatBoostSourcePremiumTypeID: "chatBoostSourcePremium#ed4eb", @@ -864,6 +864,7 @@ func TypesMap() map[uint32]string { ChatEventPhotoChangedTypeID: "chatEventPhotoChanged#cfa062c3", ChatEventSlowModeDelayChangedTypeID: "chatEventSlowModeDelayChanged#9d763c0b", ChatEventStickerSetChangedTypeID: "chatEventStickerSetChanged#b5e7558f", + ChatEventCustomEmojiStickerSetChangedTypeID: "chatEventCustomEmojiStickerSetChanged#70c431b", ChatEventTitleChangedTypeID: "chatEventTitleChanged#43990ad2", ChatEventUsernameChangedTypeID: "chatEventUsernameChanged#6707b56b", ChatEventActiveUsernamesChangedTypeID: "chatEventActiveUsernamesChanged#95e54656", @@ -937,12 +938,16 @@ func TypesMap() map[uint32]string { PremiumFeatureChatBoostTypeID: "premiumFeatureChatBoost#5df89f1b", PremiumFeatureAccentColorTypeID: "premiumFeatureAccentColor#361ac59e", PremiumFeatureBackgroundForBothTypeID: "premiumFeatureBackgroundForBoth#2246eefa", + PremiumFeatureSavedMessagesTagsTypeID: "premiumFeatureSavedMessagesTags#3bcbe986", + PremiumFeatureMessagePrivacyTypeID: "premiumFeatureMessagePrivacy#2fd278f6", + PremiumFeatureLastSeenTimesTypeID: "premiumFeatureLastSeenTimes#d2914a8f", PremiumStoryFeaturePriorityOrderTypeID: "premiumStoryFeaturePriorityOrder#8ff172c7", PremiumStoryFeatureStealthModeTypeID: "premiumStoryFeatureStealthMode#47343da4", PremiumStoryFeaturePermanentViewsHistoryTypeID: "premiumStoryFeaturePermanentViewsHistory#c2a047a0", PremiumStoryFeatureCustomExpirationDurationTypeID: "premiumStoryFeatureCustomExpirationDuration#dca40a96", PremiumStoryFeatureSaveStoriesTypeID: "premiumStoryFeatureSaveStories#a6842fbd", PremiumStoryFeatureLinksAndFormattingTypeID: "premiumStoryFeatureLinksAndFormatting#dae383f7", + PremiumStoryFeatureVideoQualityTypeID: "premiumStoryFeatureVideoQuality#baafbea9", PremiumLimitTypeID: "premiumLimit#7ed372e6", PremiumFeaturesTypeID: "premiumFeatures#4cf10e82", PremiumSourceLimitExceededTypeID: "premiumSourceLimitExceeded#85ae8702", @@ -1335,7 +1340,8 @@ func TypesMap() map[uint32]string { UpdateChatHasScheduledMessagesTypeID: "updateChatHasScheduledMessages#7b14c2d7", UpdateChatFoldersTypeID: "updateChatFolders#71a4b3a", UpdateChatOnlineMemberCountTypeID: "updateChatOnlineMemberCount#1d0caa9d", - UpdatePinnedSavedMessagesTopicsTypeID: "updatePinnedSavedMessagesTopics#2101c3a3", + UpdateSavedMessagesTopicTypeID: "updateSavedMessagesTopic#9f823b30", + UpdateSavedMessagesTopicCountTypeID: "updateSavedMessagesTopicCount#fbd279d1", UpdateForumTopicInfoTypeID: "updateForumTopicInfo#6b6f2cc9", UpdateScopeNotificationSettingsTypeID: "updateScopeNotificationSettings#b83ccb73", UpdateNotificationTypeID: "updateNotification#8ee67ed4", @@ -1395,7 +1401,7 @@ func TypesMap() map[uint32]string { UpdateWebAppMessageSentTypeID: "updateWebAppMessageSent#58431229", UpdateActiveEmojiReactionsTypeID: "updateActiveEmojiReactions#691ffcb7", UpdateDefaultReactionTypeTypeID: "updateDefaultReactionType#4b615105", - UpdateSavedMessagesTagsTypeID: "updateSavedMessagesTags#dfc2ab29", + UpdateSavedMessagesTagsTypeID: "updateSavedMessagesTags#7386424a", UpdateSpeechRecognitionTrialTypeID: "updateSpeechRecognitionTrial#ff4efcc1", UpdateDiceEmojisTypeID: "updateDiceEmojis#9d0f91df", UpdateAnimatedEmojiMessageClickedTypeID: "updateAnimatedEmojiMessageClicked#a3167405", @@ -1440,7 +1446,7 @@ func TypesMap() map[uint32]string { CheckAuthenticationEmailCodeRequestTypeID: "checkAuthenticationEmailCode#dd42c29f", CheckAuthenticationCodeRequestTypeID: "checkAuthenticationCode#edfe44aa", RequestQrCodeAuthenticationRequestTypeID: "requestQrCodeAuthentication#56fe3c4e", - RegisterUserRequestTypeID: "registerUser#f9719e1d", + RegisterUserRequestTypeID: "registerUser#c3aa52ec", ResetAuthenticationEmailAddressRequestTypeID: "resetAuthenticationEmailAddress#e742722c", CheckAuthenticationPasswordRequestTypeID: "checkAuthenticationPassword#87424ba0", RequestAuthenticationPasswordRecoveryRequestTypeID: "requestAuthenticationPasswordRecovery#53152ab6", @@ -1513,33 +1519,32 @@ func TypesMap() map[uint32]string { CheckCreatedPublicChatsLimitRequestTypeID: "checkCreatedPublicChatsLimit#e5717fa1", GetSuitableDiscussionChatsRequestTypeID: "getSuitableDiscussionChats#2ec5df6", GetInactiveSupergroupChatsRequestTypeID: "getInactiveSupergroupChats#d8cbf9b5", - GetPinnedSavedMessagesTopicsRequestTypeID: "getPinnedSavedMessagesTopics#8555e144", - GetSavedMessagesTopicsRequestTypeID: "getSavedMessagesTopics#c5038df6", - GetSavedMessagesTopicHistoryRequestTypeID: "getSavedMessagesTopicHistory#f115a1aa", - GetSavedMessagesTopicMessageByDateRequestTypeID: "getSavedMessagesTopicMessageByDate#78ebcc7f", - DeleteSavedMessagesTopicHistoryRequestTypeID: "deleteSavedMessagesTopicHistory#c1dc4e3d", - DeleteSavedMessagesTopicMessagesByDateRequestTypeID: "deleteSavedMessagesTopicMessagesByDate#a18f779d", - ToggleSavedMessagesTopicIsPinnedRequestTypeID: "toggleSavedMessagesTopicIsPinned#3f8a8c2d", - SetPinnedSavedMessagesTopicsRequestTypeID: "setPinnedSavedMessagesTopics#81065db4", + LoadSavedMessagesTopicsRequestTypeID: "loadSavedMessagesTopics#1146d6b8", + GetSavedMessagesTopicHistoryRequestTypeID: "getSavedMessagesTopicHistory#77e5da68", + GetSavedMessagesTopicMessageByDateRequestTypeID: "getSavedMessagesTopicMessageByDate#c15e4680", + DeleteSavedMessagesTopicHistoryRequestTypeID: "deleteSavedMessagesTopicHistory#69df3d6a", + DeleteSavedMessagesTopicMessagesByDateRequestTypeID: "deleteSavedMessagesTopicMessagesByDate#160a25", + ToggleSavedMessagesTopicIsPinnedRequestTypeID: "toggleSavedMessagesTopicIsPinned#a15345cc", + SetPinnedSavedMessagesTopicsRequestTypeID: "setPinnedSavedMessagesTopics#475a1110", GetGroupsInCommonRequestTypeID: "getGroupsInCommon#16bdd36a", GetChatHistoryRequestTypeID: "getChatHistory#d051927d", GetMessageThreadHistoryRequestTypeID: "getMessageThreadHistory#9435d428", DeleteChatHistoryRequestTypeID: "deleteChatHistory#a841d09f", DeleteChatRequestTypeID: "deleteChat#f5cae05e", - SearchChatMessagesRequestTypeID: "searchChatMessages#8dbde5c5", + SearchChatMessagesRequestTypeID: "searchChatMessages#dfdeb5c6", SearchMessagesRequestTypeID: "searchMessages#2a8f08a7", SearchSecretMessagesRequestTypeID: "searchSecretMessages#cd2a4c9c", - SearchSavedMessagesRequestTypeID: "searchSavedMessages#da8efe2a", + SearchSavedMessagesRequestTypeID: "searchSavedMessages#8a9b9f96", SearchCallMessagesRequestTypeID: "searchCallMessages#8c3bef1b", SearchOutgoingDocumentMessagesRequestTypeID: "searchOutgoingDocumentMessages#c023c47e", DeleteAllCallMessagesRequestTypeID: "deleteAllCallMessages#a897d1f3", SearchChatRecentLocationMessagesRequestTypeID: "searchChatRecentLocationMessages#38a37ee6", GetActiveLiveLocationMessagesRequestTypeID: "getActiveLiveLocationMessages#ab093691", GetChatMessageByDateRequestTypeID: "getChatMessageByDate#3f557136", - GetChatSparseMessagePositionsRequestTypeID: "getChatSparseMessagePositions#7a9bab8e", - GetChatMessageCalendarRequestTypeID: "getChatMessageCalendar#69fdc3d2", - GetChatMessageCountRequestTypeID: "getChatMessageCount#d1d1952d", - GetChatMessagePositionRequestTypeID: "getChatMessagePosition#e9d7d767", + GetChatSparseMessagePositionsRequestTypeID: "getChatSparseMessagePositions#3b452efd", + GetChatMessageCalendarRequestTypeID: "getChatMessageCalendar#81af2db7", + GetChatMessageCountRequestTypeID: "getChatMessageCount#38f78909", + GetChatMessagePositionRequestTypeID: "getChatMessagePosition#81bfcc7", GetChatScheduledMessagesRequestTypeID: "getChatScheduledMessages#df3d2ffb", GetChatSponsoredMessagesRequestTypeID: "getChatSponsoredMessages#50a84098", ClickChatSponsoredMessageRequestTypeID: "clickChatSponsoredMessage#d9c09feb", @@ -1596,7 +1601,7 @@ func TypesMap() map[uint32]string { SetMessageReactionsRequestTypeID: "setMessageReactions#71fa9e8f", GetMessageAddedReactionsRequestTypeID: "getMessageAddedReactions#7dc6ae52", SetDefaultReactionTypeRequestTypeID: "setDefaultReactionType#65038a3d", - GetSavedMessagesTagsRequestTypeID: "getSavedMessagesTags#611591cb", + GetSavedMessagesTagsRequestTypeID: "getSavedMessagesTags#8cd667a9", SetSavedMessagesTagLabelRequestTypeID: "setSavedMessagesTagLabel#b03acd10", SearchQuoteRequestTypeID: "searchQuote#6864011f", GetTextEntitiesRequestTypeID: "getTextEntities#eba543fb", @@ -1736,7 +1741,7 @@ func TypesMap() map[uint32]string { CanSendStoryRequestTypeID: "canSendStory#b6e0216b", SendStoryRequestTypeID: "sendStory#736858bb", EditStoryRequestTypeID: "editStory#5e6a21b1", - SetStoryPrivacySettingsRequestTypeID: "setStoryPrivacySettings#1b6c5434", + SetStoryPrivacySettingsRequestTypeID: "setStoryPrivacySettings#d8e94332", ToggleStoryIsPinnedRequestTypeID: "toggleStoryIsPinned#b493b30e", DeleteStoryRequestTypeID: "deleteStory#9f35af16", GetStoryNotificationSettingsExceptionsRequestTypeID: "getStoryNotificationSettingsExceptions#256a2eb0", @@ -1754,8 +1759,8 @@ func TypesMap() map[uint32]string { ReportStoryRequestTypeID: "reportStory#9b5f709b", ActivateStoryStealthModeRequestTypeID: "activateStoryStealthMode#c3db8491", GetStoryPublicForwardsRequestTypeID: "getStoryPublicForwards#68f7dcbb", - GetChatBoostLevelFeaturesRequestTypeID: "getChatBoostLevelFeatures#71f15dfb", - GetChatBoostFeaturesRequestTypeID: "getChatBoostFeatures#34e76822", + GetChatBoostLevelFeaturesRequestTypeID: "getChatBoostLevelFeatures#45e63e8b", + GetChatBoostFeaturesRequestTypeID: "getChatBoostFeatures#e8c128a0", GetAvailableChatBoostSlotsRequestTypeID: "getAvailableChatBoostSlots#7307ebd5", GetChatBoostStatusRequestTypeID: "getChatBoostStatus#cfac8acf", BoostChatRequestTypeID: "boostChat#890ccd68", @@ -1952,6 +1957,8 @@ func TypesMap() map[uint32]string { DisableAllSupergroupUsernamesRequestTypeID: "disableAllSupergroupUsernames#3246f5b0", ReorderSupergroupActiveUsernamesRequestTypeID: "reorderSupergroupActiveUsernames#663c7f3b", SetSupergroupStickerSetRequestTypeID: "setSupergroupStickerSet#856ead69", + SetSupergroupCustomEmojiStickerSetRequestTypeID: "setSupergroupCustomEmojiStickerSet#4f3552af", + SetSupergroupUnrestrictBoostCountRequestTypeID: "setSupergroupUnrestrictBoostCount#39ce30a3", ToggleSupergroupSignMessagesRequestTypeID: "toggleSupergroupSignMessages#44efd524", ToggleSupergroupJoinToSendMessagesRequestTypeID: "toggleSupergroupJoinToSendMessages#f5268e0e", ToggleSupergroupJoinByRequestRequestTypeID: "toggleSupergroupJoinByRequest#7ddf9fde", @@ -2451,11 +2458,10 @@ func NamesMap() map[string]uint32 { "foundWebApp": FoundWebAppTypeID, "webAppInfo": WebAppInfoTypeID, "messageThreadInfo": MessageThreadInfoTypeID, - "savedMessagesTopicMyNotes": SavedMessagesTopicMyNotesTypeID, - "savedMessagesTopicAuthorHidden": SavedMessagesTopicAuthorHiddenTypeID, - "savedMessagesTopicSavedFromChat": SavedMessagesTopicSavedFromChatTypeID, - "foundSavedMessagesTopic": FoundSavedMessagesTopicTypeID, - "foundSavedMessagesTopics": FoundSavedMessagesTopicsTypeID, + "savedMessagesTopicTypeMyNotes": SavedMessagesTopicTypeMyNotesTypeID, + "savedMessagesTopicTypeAuthorHidden": SavedMessagesTopicTypeAuthorHiddenTypeID, + "savedMessagesTopicTypeSavedFromChat": SavedMessagesTopicTypeSavedFromChatTypeID, + "savedMessagesTopic": SavedMessagesTopicTypeID, "forumTopicIcon": ForumTopicIconTypeID, "forumTopicInfo": ForumTopicInfoTypeID, "forumTopic": ForumTopicTypeID, @@ -2667,6 +2673,7 @@ func NamesMap() map[string]uint32 { "messageChatSetBackground": MessageChatSetBackgroundTypeID, "messageChatSetTheme": MessageChatSetThemeTypeID, "messageChatSetMessageAutoDeleteTime": MessageChatSetMessageAutoDeleteTimeTypeID, + "messageChatBoost": MessageChatBoostTypeID, "messageForumTopicCreated": MessageForumTopicCreatedTypeID, "messageForumTopicEdited": MessageForumTopicEditedTypeID, "messageForumTopicIsClosedToggled": MessageForumTopicIsClosedToggledTypeID, @@ -2960,6 +2967,7 @@ func NamesMap() map[string]uint32 { "chatEventPhotoChanged": ChatEventPhotoChangedTypeID, "chatEventSlowModeDelayChanged": ChatEventSlowModeDelayChangedTypeID, "chatEventStickerSetChanged": ChatEventStickerSetChangedTypeID, + "chatEventCustomEmojiStickerSetChanged": ChatEventCustomEmojiStickerSetChangedTypeID, "chatEventTitleChanged": ChatEventTitleChangedTypeID, "chatEventUsernameChanged": ChatEventUsernameChangedTypeID, "chatEventActiveUsernamesChanged": ChatEventActiveUsernamesChangedTypeID, @@ -3033,12 +3041,16 @@ func NamesMap() map[string]uint32 { "premiumFeatureChatBoost": PremiumFeatureChatBoostTypeID, "premiumFeatureAccentColor": PremiumFeatureAccentColorTypeID, "premiumFeatureBackgroundForBoth": PremiumFeatureBackgroundForBothTypeID, + "premiumFeatureSavedMessagesTags": PremiumFeatureSavedMessagesTagsTypeID, + "premiumFeatureMessagePrivacy": PremiumFeatureMessagePrivacyTypeID, + "premiumFeatureLastSeenTimes": PremiumFeatureLastSeenTimesTypeID, "premiumStoryFeaturePriorityOrder": PremiumStoryFeaturePriorityOrderTypeID, "premiumStoryFeatureStealthMode": PremiumStoryFeatureStealthModeTypeID, "premiumStoryFeaturePermanentViewsHistory": PremiumStoryFeaturePermanentViewsHistoryTypeID, "premiumStoryFeatureCustomExpirationDuration": PremiumStoryFeatureCustomExpirationDurationTypeID, "premiumStoryFeatureSaveStories": PremiumStoryFeatureSaveStoriesTypeID, "premiumStoryFeatureLinksAndFormatting": PremiumStoryFeatureLinksAndFormattingTypeID, + "premiumStoryFeatureVideoQuality": PremiumStoryFeatureVideoQualityTypeID, "premiumLimit": PremiumLimitTypeID, "premiumFeatures": PremiumFeaturesTypeID, "premiumSourceLimitExceeded": PremiumSourceLimitExceededTypeID, @@ -3431,7 +3443,8 @@ func NamesMap() map[string]uint32 { "updateChatHasScheduledMessages": UpdateChatHasScheduledMessagesTypeID, "updateChatFolders": UpdateChatFoldersTypeID, "updateChatOnlineMemberCount": UpdateChatOnlineMemberCountTypeID, - "updatePinnedSavedMessagesTopics": UpdatePinnedSavedMessagesTopicsTypeID, + "updateSavedMessagesTopic": UpdateSavedMessagesTopicTypeID, + "updateSavedMessagesTopicCount": UpdateSavedMessagesTopicCountTypeID, "updateForumTopicInfo": UpdateForumTopicInfoTypeID, "updateScopeNotificationSettings": UpdateScopeNotificationSettingsTypeID, "updateNotification": UpdateNotificationTypeID, @@ -3609,8 +3622,7 @@ func NamesMap() map[string]uint32 { "checkCreatedPublicChatsLimit": CheckCreatedPublicChatsLimitRequestTypeID, "getSuitableDiscussionChats": GetSuitableDiscussionChatsRequestTypeID, "getInactiveSupergroupChats": GetInactiveSupergroupChatsRequestTypeID, - "getPinnedSavedMessagesTopics": GetPinnedSavedMessagesTopicsRequestTypeID, - "getSavedMessagesTopics": GetSavedMessagesTopicsRequestTypeID, + "loadSavedMessagesTopics": LoadSavedMessagesTopicsRequestTypeID, "getSavedMessagesTopicHistory": GetSavedMessagesTopicHistoryRequestTypeID, "getSavedMessagesTopicMessageByDate": GetSavedMessagesTopicMessageByDateRequestTypeID, "deleteSavedMessagesTopicHistory": DeleteSavedMessagesTopicHistoryRequestTypeID, @@ -4048,6 +4060,8 @@ func NamesMap() map[string]uint32 { "disableAllSupergroupUsernames": DisableAllSupergroupUsernamesRequestTypeID, "reorderSupergroupActiveUsernames": ReorderSupergroupActiveUsernamesRequestTypeID, "setSupergroupStickerSet": SetSupergroupStickerSetRequestTypeID, + "setSupergroupCustomEmojiStickerSet": SetSupergroupCustomEmojiStickerSetRequestTypeID, + "setSupergroupUnrestrictBoostCount": SetSupergroupUnrestrictBoostCountRequestTypeID, "toggleSupergroupSignMessages": ToggleSupergroupSignMessagesRequestTypeID, "toggleSupergroupJoinToSendMessages": ToggleSupergroupJoinToSendMessagesRequestTypeID, "toggleSupergroupJoinByRequest": ToggleSupergroupJoinByRequestRequestTypeID, @@ -4547,11 +4561,10 @@ func TypesConstructorMap() map[uint32]func() bin.Object { FoundWebAppTypeID: func() bin.Object { return &FoundWebApp{} }, WebAppInfoTypeID: func() bin.Object { return &WebAppInfo{} }, MessageThreadInfoTypeID: func() bin.Object { return &MessageThreadInfo{} }, - SavedMessagesTopicMyNotesTypeID: func() bin.Object { return &SavedMessagesTopicMyNotes{} }, - SavedMessagesTopicAuthorHiddenTypeID: func() bin.Object { return &SavedMessagesTopicAuthorHidden{} }, - SavedMessagesTopicSavedFromChatTypeID: func() bin.Object { return &SavedMessagesTopicSavedFromChat{} }, - FoundSavedMessagesTopicTypeID: func() bin.Object { return &FoundSavedMessagesTopic{} }, - FoundSavedMessagesTopicsTypeID: func() bin.Object { return &FoundSavedMessagesTopics{} }, + SavedMessagesTopicTypeMyNotesTypeID: func() bin.Object { return &SavedMessagesTopicTypeMyNotes{} }, + SavedMessagesTopicTypeAuthorHiddenTypeID: func() bin.Object { return &SavedMessagesTopicTypeAuthorHidden{} }, + SavedMessagesTopicTypeSavedFromChatTypeID: func() bin.Object { return &SavedMessagesTopicTypeSavedFromChat{} }, + SavedMessagesTopicTypeID: func() bin.Object { return &SavedMessagesTopic{} }, ForumTopicIconTypeID: func() bin.Object { return &ForumTopicIcon{} }, ForumTopicInfoTypeID: func() bin.Object { return &ForumTopicInfo{} }, ForumTopicTypeID: func() bin.Object { return &ForumTopic{} }, @@ -4763,6 +4776,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessageChatSetBackgroundTypeID: func() bin.Object { return &MessageChatSetBackground{} }, MessageChatSetThemeTypeID: func() bin.Object { return &MessageChatSetTheme{} }, MessageChatSetMessageAutoDeleteTimeTypeID: func() bin.Object { return &MessageChatSetMessageAutoDeleteTime{} }, + MessageChatBoostTypeID: func() bin.Object { return &MessageChatBoost{} }, MessageForumTopicCreatedTypeID: func() bin.Object { return &MessageForumTopicCreated{} }, MessageForumTopicEditedTypeID: func() bin.Object { return &MessageForumTopicEdited{} }, MessageForumTopicIsClosedToggledTypeID: func() bin.Object { return &MessageForumTopicIsClosedToggled{} }, @@ -5056,6 +5070,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ChatEventPhotoChangedTypeID: func() bin.Object { return &ChatEventPhotoChanged{} }, ChatEventSlowModeDelayChangedTypeID: func() bin.Object { return &ChatEventSlowModeDelayChanged{} }, ChatEventStickerSetChangedTypeID: func() bin.Object { return &ChatEventStickerSetChanged{} }, + ChatEventCustomEmojiStickerSetChangedTypeID: func() bin.Object { return &ChatEventCustomEmojiStickerSetChanged{} }, ChatEventTitleChangedTypeID: func() bin.Object { return &ChatEventTitleChanged{} }, ChatEventUsernameChangedTypeID: func() bin.Object { return &ChatEventUsernameChanged{} }, ChatEventActiveUsernamesChangedTypeID: func() bin.Object { return &ChatEventActiveUsernamesChanged{} }, @@ -5129,12 +5144,16 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PremiumFeatureChatBoostTypeID: func() bin.Object { return &PremiumFeatureChatBoost{} }, PremiumFeatureAccentColorTypeID: func() bin.Object { return &PremiumFeatureAccentColor{} }, PremiumFeatureBackgroundForBothTypeID: func() bin.Object { return &PremiumFeatureBackgroundForBoth{} }, + PremiumFeatureSavedMessagesTagsTypeID: func() bin.Object { return &PremiumFeatureSavedMessagesTags{} }, + PremiumFeatureMessagePrivacyTypeID: func() bin.Object { return &PremiumFeatureMessagePrivacy{} }, + PremiumFeatureLastSeenTimesTypeID: func() bin.Object { return &PremiumFeatureLastSeenTimes{} }, PremiumStoryFeaturePriorityOrderTypeID: func() bin.Object { return &PremiumStoryFeaturePriorityOrder{} }, PremiumStoryFeatureStealthModeTypeID: func() bin.Object { return &PremiumStoryFeatureStealthMode{} }, PremiumStoryFeaturePermanentViewsHistoryTypeID: func() bin.Object { return &PremiumStoryFeaturePermanentViewsHistory{} }, PremiumStoryFeatureCustomExpirationDurationTypeID: func() bin.Object { return &PremiumStoryFeatureCustomExpirationDuration{} }, PremiumStoryFeatureSaveStoriesTypeID: func() bin.Object { return &PremiumStoryFeatureSaveStories{} }, PremiumStoryFeatureLinksAndFormattingTypeID: func() bin.Object { return &PremiumStoryFeatureLinksAndFormatting{} }, + PremiumStoryFeatureVideoQualityTypeID: func() bin.Object { return &PremiumStoryFeatureVideoQuality{} }, PremiumLimitTypeID: func() bin.Object { return &PremiumLimit{} }, PremiumFeaturesTypeID: func() bin.Object { return &PremiumFeatures{} }, PremiumSourceLimitExceededTypeID: func() bin.Object { return &PremiumSourceLimitExceeded{} }, @@ -5527,7 +5546,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UpdateChatHasScheduledMessagesTypeID: func() bin.Object { return &UpdateChatHasScheduledMessages{} }, UpdateChatFoldersTypeID: func() bin.Object { return &UpdateChatFolders{} }, UpdateChatOnlineMemberCountTypeID: func() bin.Object { return &UpdateChatOnlineMemberCount{} }, - UpdatePinnedSavedMessagesTopicsTypeID: func() bin.Object { return &UpdatePinnedSavedMessagesTopics{} }, + UpdateSavedMessagesTopicTypeID: func() bin.Object { return &UpdateSavedMessagesTopic{} }, + UpdateSavedMessagesTopicCountTypeID: func() bin.Object { return &UpdateSavedMessagesTopicCount{} }, UpdateForumTopicInfoTypeID: func() bin.Object { return &UpdateForumTopicInfo{} }, UpdateScopeNotificationSettingsTypeID: func() bin.Object { return &UpdateScopeNotificationSettings{} }, UpdateNotificationTypeID: func() bin.Object { return &UpdateNotification{} }, @@ -5705,8 +5725,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { CheckCreatedPublicChatsLimitRequestTypeID: func() bin.Object { return &CheckCreatedPublicChatsLimitRequest{} }, GetSuitableDiscussionChatsRequestTypeID: func() bin.Object { return &GetSuitableDiscussionChatsRequest{} }, GetInactiveSupergroupChatsRequestTypeID: func() bin.Object { return &GetInactiveSupergroupChatsRequest{} }, - GetPinnedSavedMessagesTopicsRequestTypeID: func() bin.Object { return &GetPinnedSavedMessagesTopicsRequest{} }, - GetSavedMessagesTopicsRequestTypeID: func() bin.Object { return &GetSavedMessagesTopicsRequest{} }, + LoadSavedMessagesTopicsRequestTypeID: func() bin.Object { return &LoadSavedMessagesTopicsRequest{} }, GetSavedMessagesTopicHistoryRequestTypeID: func() bin.Object { return &GetSavedMessagesTopicHistoryRequest{} }, GetSavedMessagesTopicMessageByDateRequestTypeID: func() bin.Object { return &GetSavedMessagesTopicMessageByDateRequest{} }, DeleteSavedMessagesTopicHistoryRequestTypeID: func() bin.Object { return &DeleteSavedMessagesTopicHistoryRequest{} }, @@ -6144,6 +6163,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { DisableAllSupergroupUsernamesRequestTypeID: func() bin.Object { return &DisableAllSupergroupUsernamesRequest{} }, ReorderSupergroupActiveUsernamesRequestTypeID: func() bin.Object { return &ReorderSupergroupActiveUsernamesRequest{} }, SetSupergroupStickerSetRequestTypeID: func() bin.Object { return &SetSupergroupStickerSetRequest{} }, + SetSupergroupCustomEmojiStickerSetRequestTypeID: func() bin.Object { return &SetSupergroupCustomEmojiStickerSetRequest{} }, + SetSupergroupUnrestrictBoostCountRequestTypeID: func() bin.Object { return &SetSupergroupUnrestrictBoostCountRequest{} }, ToggleSupergroupSignMessagesRequestTypeID: func() bin.Object { return &ToggleSupergroupSignMessagesRequest{} }, ToggleSupergroupJoinToSendMessagesRequestTypeID: func() bin.Object { return &ToggleSupergroupJoinToSendMessagesRequest{} }, ToggleSupergroupJoinByRequestRequestTypeID: func() bin.Object { return &ToggleSupergroupJoinByRequestRequest{} }, @@ -6499,6 +6520,7 @@ func ClassConstructorsMap() map[string][]uint32 { ChatEventPhotoChangedTypeID, ChatEventSlowModeDelayChangedTypeID, ChatEventStickerSetChangedTypeID, + ChatEventCustomEmojiStickerSetChangedTypeID, ChatEventTitleChangedTypeID, ChatEventUsernameChangedTypeID, ChatEventActiveUsernamesChangedTypeID, @@ -6914,6 +6936,7 @@ func ClassConstructorsMap() map[string][]uint32 { MessageChatSetBackgroundTypeID, MessageChatSetThemeTypeID, MessageChatSetMessageAutoDeleteTimeTypeID, + MessageChatBoostTypeID, MessageForumTopicCreatedTypeID, MessageForumTopicEditedTypeID, MessageForumTopicIsClosedToggledTypeID, @@ -7148,6 +7171,9 @@ func ClassConstructorsMap() map[string][]uint32 { PremiumFeatureChatBoostTypeID, PremiumFeatureAccentColorTypeID, PremiumFeatureBackgroundForBothTypeID, + PremiumFeatureSavedMessagesTagsTypeID, + PremiumFeatureMessagePrivacyTypeID, + PremiumFeatureLastSeenTimesTypeID, }, PremiumGiveawayInfoClassName: { PremiumGiveawayInfoOngoingTypeID, @@ -7195,6 +7221,7 @@ func ClassConstructorsMap() map[string][]uint32 { PremiumStoryFeatureCustomExpirationDurationTypeID, PremiumStoryFeatureSaveStoriesTypeID, PremiumStoryFeatureLinksAndFormattingTypeID, + PremiumStoryFeatureVideoQualityTypeID, }, ProxyTypeClassName: { ProxyTypeSocks5TypeID, @@ -7295,10 +7322,10 @@ func ClassConstructorsMap() map[string][]uint32 { RichTextAnchorLinkTypeID, RichTextsTypeID, }, - SavedMessagesTopicClassName: { - SavedMessagesTopicMyNotesTypeID, - SavedMessagesTopicAuthorHiddenTypeID, - SavedMessagesTopicSavedFromChatTypeID, + SavedMessagesTopicTypeClassName: { + SavedMessagesTopicTypeMyNotesTypeID, + SavedMessagesTopicTypeAuthorHiddenTypeID, + SavedMessagesTopicTypeSavedFromChatTypeID, }, SearchMessagesFilterClassName: { SearchMessagesFilterEmptyTypeID, @@ -7532,7 +7559,8 @@ func ClassConstructorsMap() map[string][]uint32 { UpdateChatHasScheduledMessagesTypeID, UpdateChatFoldersTypeID, UpdateChatOnlineMemberCountTypeID, - UpdatePinnedSavedMessagesTopicsTypeID, + UpdateSavedMessagesTopicTypeID, + UpdateSavedMessagesTopicCountTypeID, UpdateForumTopicInfoTypeID, UpdateScopeNotificationSettingsTypeID, UpdateNotificationTypeID, diff --git a/tdapi/tl_saved_messages_tag_gen.go b/tdapi/tl_saved_messages_tag_gen.go index 3953f5a47d..54eb74ab60 100644 --- a/tdapi/tl_saved_messages_tag_gen.go +++ b/tdapi/tl_saved_messages_tag_gen.go @@ -35,7 +35,8 @@ var ( type SavedMessagesTag struct { // The tag Tag ReactionTypeClass - // Label of the tag; 0-12 characters + // Label of the tag; 0-12 characters. Always empty if the tag is returned for a Saved + // Messages topic Label string // Number of times the tag was used; may be 0 if the tag has non-empty label Count int32 diff --git a/tdapi/tl_saved_messages_topic_gen.go b/tdapi/tl_saved_messages_topic_gen.go index e0eef6d0ec..ecb84e7eea 100644 --- a/tdapi/tl_saved_messages_topic_gen.go +++ b/tdapi/tl_saved_messages_topic_gen.go @@ -31,295 +31,54 @@ var ( _ = tdjson.Encoder{} ) -// SavedMessagesTopicMyNotes represents TL type `savedMessagesTopicMyNotes#9dd7231d`. -type SavedMessagesTopicMyNotes struct { -} - -// SavedMessagesTopicMyNotesTypeID is TL type id of SavedMessagesTopicMyNotes. -const SavedMessagesTopicMyNotesTypeID = 0x9dd7231d - -// construct implements constructor of SavedMessagesTopicClass. -func (s SavedMessagesTopicMyNotes) construct() SavedMessagesTopicClass { return &s } - -// Ensuring interfaces in compile-time for SavedMessagesTopicMyNotes. +// SavedMessagesTopic represents TL type `savedMessagesTopic#d2a8e1a4`. +type SavedMessagesTopic struct { + // Unique topic identifier + ID int64 + // Type of the topic + Type SavedMessagesTopicTypeClass + // True, if the topic is pinned + IsPinned bool + // A parameter used to determine order of the topic in the topic list. Topics must be + // sorted by the order in descending order + Order int64 + // Last message in the topic; may be null if none or unknown + LastMessage Message + // A draft of a message in the topic; may be null if none + DraftMessage DraftMessage +} + +// SavedMessagesTopicTypeID is TL type id of SavedMessagesTopic. +const SavedMessagesTopicTypeID = 0xd2a8e1a4 + +// Ensuring interfaces in compile-time for SavedMessagesTopic. var ( - _ bin.Encoder = &SavedMessagesTopicMyNotes{} - _ bin.Decoder = &SavedMessagesTopicMyNotes{} - _ bin.BareEncoder = &SavedMessagesTopicMyNotes{} - _ bin.BareDecoder = &SavedMessagesTopicMyNotes{} - - _ SavedMessagesTopicClass = &SavedMessagesTopicMyNotes{} + _ bin.Encoder = &SavedMessagesTopic{} + _ bin.Decoder = &SavedMessagesTopic{} + _ bin.BareEncoder = &SavedMessagesTopic{} + _ bin.BareDecoder = &SavedMessagesTopic{} ) -func (s *SavedMessagesTopicMyNotes) Zero() bool { +func (s *SavedMessagesTopic) Zero() bool { if s == nil { return true } - - return true -} - -// String implements fmt.Stringer. -func (s *SavedMessagesTopicMyNotes) String() string { - if s == nil { - return "SavedMessagesTopicMyNotes(nil)" - } - type Alias SavedMessagesTopicMyNotes - return fmt.Sprintf("SavedMessagesTopicMyNotes%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SavedMessagesTopicMyNotes) TypeID() uint32 { - return SavedMessagesTopicMyNotesTypeID -} - -// TypeName returns name of type in TL schema. -func (*SavedMessagesTopicMyNotes) TypeName() string { - return "savedMessagesTopicMyNotes" -} - -// TypeInfo returns info about TL type. -func (s *SavedMessagesTopicMyNotes) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "savedMessagesTopicMyNotes", - ID: SavedMessagesTopicMyNotesTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SavedMessagesTopicMyNotes) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTopicMyNotes#9dd7231d as nil") - } - b.PutID(SavedMessagesTopicMyNotesTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SavedMessagesTopicMyNotes) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTopicMyNotes#9dd7231d as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SavedMessagesTopicMyNotes) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTopicMyNotes#9dd7231d to nil") - } - if err := b.ConsumeID(SavedMessagesTopicMyNotesTypeID); err != nil { - return fmt.Errorf("unable to decode savedMessagesTopicMyNotes#9dd7231d: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SavedMessagesTopicMyNotes) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTopicMyNotes#9dd7231d to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SavedMessagesTopicMyNotes) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTopicMyNotes#9dd7231d as nil") - } - b.ObjStart() - b.PutID("savedMessagesTopicMyNotes") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SavedMessagesTopicMyNotes) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTopicMyNotes#9dd7231d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("savedMessagesTopicMyNotes"); err != nil { - return fmt.Errorf("unable to decode savedMessagesTopicMyNotes#9dd7231d: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SavedMessagesTopicAuthorHidden represents TL type `savedMessagesTopicAuthorHidden#6e75aff7`. -type SavedMessagesTopicAuthorHidden struct { -} - -// SavedMessagesTopicAuthorHiddenTypeID is TL type id of SavedMessagesTopicAuthorHidden. -const SavedMessagesTopicAuthorHiddenTypeID = 0x6e75aff7 - -// construct implements constructor of SavedMessagesTopicClass. -func (s SavedMessagesTopicAuthorHidden) construct() SavedMessagesTopicClass { return &s } - -// Ensuring interfaces in compile-time for SavedMessagesTopicAuthorHidden. -var ( - _ bin.Encoder = &SavedMessagesTopicAuthorHidden{} - _ bin.Decoder = &SavedMessagesTopicAuthorHidden{} - _ bin.BareEncoder = &SavedMessagesTopicAuthorHidden{} - _ bin.BareDecoder = &SavedMessagesTopicAuthorHidden{} - - _ SavedMessagesTopicClass = &SavedMessagesTopicAuthorHidden{} -) - -func (s *SavedMessagesTopicAuthorHidden) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SavedMessagesTopicAuthorHidden) String() string { - if s == nil { - return "SavedMessagesTopicAuthorHidden(nil)" - } - type Alias SavedMessagesTopicAuthorHidden - return fmt.Sprintf("SavedMessagesTopicAuthorHidden%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SavedMessagesTopicAuthorHidden) TypeID() uint32 { - return SavedMessagesTopicAuthorHiddenTypeID -} - -// TypeName returns name of type in TL schema. -func (*SavedMessagesTopicAuthorHidden) TypeName() string { - return "savedMessagesTopicAuthorHidden" -} - -// TypeInfo returns info about TL type. -func (s *SavedMessagesTopicAuthorHidden) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "savedMessagesTopicAuthorHidden", - ID: SavedMessagesTopicAuthorHiddenTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SavedMessagesTopicAuthorHidden) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTopicAuthorHidden#6e75aff7 as nil") - } - b.PutID(SavedMessagesTopicAuthorHiddenTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SavedMessagesTopicAuthorHidden) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTopicAuthorHidden#6e75aff7 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SavedMessagesTopicAuthorHidden) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTopicAuthorHidden#6e75aff7 to nil") - } - if err := b.ConsumeID(SavedMessagesTopicAuthorHiddenTypeID); err != nil { - return fmt.Errorf("unable to decode savedMessagesTopicAuthorHidden#6e75aff7: %w", err) + if !(s.ID == 0) { + return false } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SavedMessagesTopicAuthorHidden) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTopicAuthorHidden#6e75aff7 to nil") + if !(s.Type == nil) { + return false } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SavedMessagesTopicAuthorHidden) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTopicAuthorHidden#6e75aff7 as nil") + if !(s.IsPinned == false) { + return false } - b.ObjStart() - b.PutID("savedMessagesTopicAuthorHidden") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SavedMessagesTopicAuthorHidden) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTopicAuthorHidden#6e75aff7 to nil") + if !(s.Order == 0) { + return false } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("savedMessagesTopicAuthorHidden"); err != nil { - return fmt.Errorf("unable to decode savedMessagesTopicAuthorHidden#6e75aff7: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SavedMessagesTopicSavedFromChat represents TL type `savedMessagesTopicSavedFromChat#16543670`. -type SavedMessagesTopicSavedFromChat struct { - // Identifier of the chat - ChatID int64 -} - -// SavedMessagesTopicSavedFromChatTypeID is TL type id of SavedMessagesTopicSavedFromChat. -const SavedMessagesTopicSavedFromChatTypeID = 0x16543670 - -// construct implements constructor of SavedMessagesTopicClass. -func (s SavedMessagesTopicSavedFromChat) construct() SavedMessagesTopicClass { return &s } - -// Ensuring interfaces in compile-time for SavedMessagesTopicSavedFromChat. -var ( - _ bin.Encoder = &SavedMessagesTopicSavedFromChat{} - _ bin.Decoder = &SavedMessagesTopicSavedFromChat{} - _ bin.BareEncoder = &SavedMessagesTopicSavedFromChat{} - _ bin.BareDecoder = &SavedMessagesTopicSavedFromChat{} - - _ SavedMessagesTopicClass = &SavedMessagesTopicSavedFromChat{} -) - -func (s *SavedMessagesTopicSavedFromChat) Zero() bool { - if s == nil { - return true + if !(s.LastMessage.Zero()) { + return false } - if !(s.ChatID == 0) { + if !(s.DraftMessage.Zero()) { return false } @@ -327,31 +86,31 @@ func (s *SavedMessagesTopicSavedFromChat) Zero() bool { } // String implements fmt.Stringer. -func (s *SavedMessagesTopicSavedFromChat) String() string { +func (s *SavedMessagesTopic) String() string { if s == nil { - return "SavedMessagesTopicSavedFromChat(nil)" + return "SavedMessagesTopic(nil)" } - type Alias SavedMessagesTopicSavedFromChat - return fmt.Sprintf("SavedMessagesTopicSavedFromChat%+v", Alias(*s)) + type Alias SavedMessagesTopic + return fmt.Sprintf("SavedMessagesTopic%+v", Alias(*s)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SavedMessagesTopicSavedFromChat) TypeID() uint32 { - return SavedMessagesTopicSavedFromChatTypeID +func (*SavedMessagesTopic) TypeID() uint32 { + return SavedMessagesTopicTypeID } // TypeName returns name of type in TL schema. -func (*SavedMessagesTopicSavedFromChat) TypeName() string { - return "savedMessagesTopicSavedFromChat" +func (*SavedMessagesTopic) TypeName() string { + return "savedMessagesTopic" } // TypeInfo returns info about TL type. -func (s *SavedMessagesTopicSavedFromChat) TypeInfo() tdp.Type { +func (s *SavedMessagesTopic) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "savedMessagesTopicSavedFromChat", - ID: SavedMessagesTopicSavedFromChatTypeID, + Name: "savedMessagesTopic", + ID: SavedMessagesTopicTypeID, } if s == nil { typ.Null = true @@ -359,67 +118,156 @@ func (s *SavedMessagesTopicSavedFromChat) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "ChatID", - SchemaName: "chat_id", + Name: "ID", + SchemaName: "id", + }, + { + Name: "Type", + SchemaName: "type", + }, + { + Name: "IsPinned", + SchemaName: "is_pinned", + }, + { + Name: "Order", + SchemaName: "order", + }, + { + Name: "LastMessage", + SchemaName: "last_message", + }, + { + Name: "DraftMessage", + SchemaName: "draft_message", }, } return typ } // Encode implements bin.Encoder. -func (s *SavedMessagesTopicSavedFromChat) Encode(b *bin.Buffer) error { +func (s *SavedMessagesTopic) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode savedMessagesTopicSavedFromChat#16543670 as nil") + return fmt.Errorf("can't encode savedMessagesTopic#d2a8e1a4 as nil") } - b.PutID(SavedMessagesTopicSavedFromChatTypeID) + b.PutID(SavedMessagesTopicTypeID) return s.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (s *SavedMessagesTopicSavedFromChat) EncodeBare(b *bin.Buffer) error { +func (s *SavedMessagesTopic) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode savedMessagesTopicSavedFromChat#16543670 as nil") + return fmt.Errorf("can't encode savedMessagesTopic#d2a8e1a4 as nil") + } + b.PutInt53(s.ID) + if s.Type == nil { + return fmt.Errorf("unable to encode savedMessagesTopic#d2a8e1a4: field type is nil") + } + if err := s.Type.Encode(b); err != nil { + return fmt.Errorf("unable to encode savedMessagesTopic#d2a8e1a4: field type: %w", err) + } + b.PutBool(s.IsPinned) + b.PutLong(s.Order) + if err := s.LastMessage.Encode(b); err != nil { + return fmt.Errorf("unable to encode savedMessagesTopic#d2a8e1a4: field last_message: %w", err) + } + if err := s.DraftMessage.Encode(b); err != nil { + return fmt.Errorf("unable to encode savedMessagesTopic#d2a8e1a4: field draft_message: %w", err) } - b.PutInt53(s.ChatID) return nil } // Decode implements bin.Decoder. -func (s *SavedMessagesTopicSavedFromChat) Decode(b *bin.Buffer) error { +func (s *SavedMessagesTopic) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode savedMessagesTopicSavedFromChat#16543670 to nil") + return fmt.Errorf("can't decode savedMessagesTopic#d2a8e1a4 to nil") } - if err := b.ConsumeID(SavedMessagesTopicSavedFromChatTypeID); err != nil { - return fmt.Errorf("unable to decode savedMessagesTopicSavedFromChat#16543670: %w", err) + if err := b.ConsumeID(SavedMessagesTopicTypeID); err != nil { + return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: %w", err) } return s.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (s *SavedMessagesTopicSavedFromChat) DecodeBare(b *bin.Buffer) error { +func (s *SavedMessagesTopic) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode savedMessagesTopicSavedFromChat#16543670 to nil") + return fmt.Errorf("can't decode savedMessagesTopic#d2a8e1a4 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode savedMessagesTopicSavedFromChat#16543670: field chat_id: %w", err) + return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field id: %w", err) + } + s.ID = value + } + { + value, err := DecodeSavedMessagesTopicType(b) + if err != nil { + return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field type: %w", err) + } + s.Type = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field is_pinned: %w", err) + } + s.IsPinned = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field order: %w", err) + } + s.Order = value + } + { + if err := s.LastMessage.Decode(b); err != nil { + return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field last_message: %w", err) + } + } + { + if err := s.DraftMessage.Decode(b); err != nil { + return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field draft_message: %w", err) } - s.ChatID = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SavedMessagesTopicSavedFromChat) EncodeTDLibJSON(b tdjson.Encoder) error { +func (s *SavedMessagesTopic) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode savedMessagesTopicSavedFromChat#16543670 as nil") + return fmt.Errorf("can't encode savedMessagesTopic#d2a8e1a4 as nil") } b.ObjStart() - b.PutID("savedMessagesTopicSavedFromChat") + b.PutID("savedMessagesTopic") b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) + b.FieldStart("id") + b.PutInt53(s.ID) + b.Comma() + b.FieldStart("type") + if s.Type == nil { + return fmt.Errorf("unable to encode savedMessagesTopic#d2a8e1a4: field type is nil") + } + if err := s.Type.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode savedMessagesTopic#d2a8e1a4: field type: %w", err) + } + b.Comma() + b.FieldStart("is_pinned") + b.PutBool(s.IsPinned) + b.Comma() + b.FieldStart("order") + b.PutLong(s.Order) + b.Comma() + b.FieldStart("last_message") + if err := s.LastMessage.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode savedMessagesTopic#d2a8e1a4: field last_message: %w", err) + } + b.Comma() + b.FieldStart("draft_message") + if err := s.DraftMessage.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode savedMessagesTopic#d2a8e1a4: field draft_message: %w", err) + } b.Comma() b.StripComma() b.ObjEnd() @@ -427,23 +275,49 @@ func (s *SavedMessagesTopicSavedFromChat) EncodeTDLibJSON(b tdjson.Encoder) erro } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SavedMessagesTopicSavedFromChat) DecodeTDLibJSON(b tdjson.Decoder) error { +func (s *SavedMessagesTopic) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode savedMessagesTopicSavedFromChat#16543670 to nil") + return fmt.Errorf("can't decode savedMessagesTopic#d2a8e1a4 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("savedMessagesTopicSavedFromChat"); err != nil { - return fmt.Errorf("unable to decode savedMessagesTopicSavedFromChat#16543670: %w", err) + if err := b.ConsumeID("savedMessagesTopic"); err != nil { + return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: %w", err) } - case "chat_id": + case "id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode savedMessagesTopicSavedFromChat#16543670: field chat_id: %w", err) + return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field id: %w", err) + } + s.ID = value + case "type": + value, err := DecodeTDLibJSONSavedMessagesTopicType(b) + if err != nil { + return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field type: %w", err) + } + s.Type = value + case "is_pinned": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field is_pinned: %w", err) + } + s.IsPinned = value + case "order": + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field order: %w", err) + } + s.Order = value + case "last_message": + if err := s.LastMessage.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field last_message: %w", err) + } + case "draft_message": + if err := s.DraftMessage.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field draft_message: %w", err) } - s.ChatID = value default: return b.Skip() } @@ -451,162 +325,50 @@ func (s *SavedMessagesTopicSavedFromChat) DecodeTDLibJSON(b tdjson.Decoder) erro }) } -// GetChatID returns value of ChatID field. -func (s *SavedMessagesTopicSavedFromChat) GetChatID() (value int64) { +// GetID returns value of ID field. +func (s *SavedMessagesTopic) GetID() (value int64) { if s == nil { return } - return s.ChatID + return s.ID } -// SavedMessagesTopicClassName is schema name of SavedMessagesTopicClass. -const SavedMessagesTopicClassName = "SavedMessagesTopic" - -// SavedMessagesTopicClass represents SavedMessagesTopic generic type. -// -// Example: -// -// g, err := tdapi.DecodeSavedMessagesTopic(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.SavedMessagesTopicMyNotes: // savedMessagesTopicMyNotes#9dd7231d -// case *tdapi.SavedMessagesTopicAuthorHidden: // savedMessagesTopicAuthorHidden#6e75aff7 -// case *tdapi.SavedMessagesTopicSavedFromChat: // savedMessagesTopicSavedFromChat#16543670 -// default: panic(v) -// } -type SavedMessagesTopicClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() SavedMessagesTopicClass - - // TypeID returns type id in TL schema. - // - // See https://core.telegram.org/mtproto/TL-tl#remarks. - TypeID() uint32 - // TypeName returns name of type in TL schema. - TypeName() string - // String implements fmt.Stringer. - String() string - // Zero returns true if current object has a zero value. - Zero() bool - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeSavedMessagesTopic implements binary de-serialization for SavedMessagesTopicClass. -func DecodeSavedMessagesTopic(buf *bin.Buffer) (SavedMessagesTopicClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case SavedMessagesTopicMyNotesTypeID: - // Decoding savedMessagesTopicMyNotes#9dd7231d. - v := SavedMessagesTopicMyNotes{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SavedMessagesTopicClass: %w", err) - } - return &v, nil - case SavedMessagesTopicAuthorHiddenTypeID: - // Decoding savedMessagesTopicAuthorHidden#6e75aff7. - v := SavedMessagesTopicAuthorHidden{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SavedMessagesTopicClass: %w", err) - } - return &v, nil - case SavedMessagesTopicSavedFromChatTypeID: - // Decoding savedMessagesTopicSavedFromChat#16543670. - v := SavedMessagesTopicSavedFromChat{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SavedMessagesTopicClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode SavedMessagesTopicClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONSavedMessagesTopic implements binary de-serialization for SavedMessagesTopicClass. -func DecodeTDLibJSONSavedMessagesTopic(buf tdjson.Decoder) (SavedMessagesTopicClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "savedMessagesTopicMyNotes": - // Decoding savedMessagesTopicMyNotes#9dd7231d. - v := SavedMessagesTopicMyNotes{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SavedMessagesTopicClass: %w", err) - } - return &v, nil - case "savedMessagesTopicAuthorHidden": - // Decoding savedMessagesTopicAuthorHidden#6e75aff7. - v := SavedMessagesTopicAuthorHidden{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SavedMessagesTopicClass: %w", err) - } - return &v, nil - case "savedMessagesTopicSavedFromChat": - // Decoding savedMessagesTopicSavedFromChat#16543670. - v := SavedMessagesTopicSavedFromChat{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SavedMessagesTopicClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode SavedMessagesTopicClass: %w", tdjson.NewUnexpectedID(id)) +// GetType returns value of Type field. +func (s *SavedMessagesTopic) GetType() (value SavedMessagesTopicTypeClass) { + if s == nil { + return } + return s.Type } -// SavedMessagesTopic boxes the SavedMessagesTopicClass providing a helper. -type SavedMessagesTopicBox struct { - SavedMessagesTopic SavedMessagesTopicClass -} - -// Decode implements bin.Decoder for SavedMessagesTopicBox. -func (b *SavedMessagesTopicBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode SavedMessagesTopicBox to nil") - } - v, err := DecodeSavedMessagesTopic(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) +// GetIsPinned returns value of IsPinned field. +func (s *SavedMessagesTopic) GetIsPinned() (value bool) { + if s == nil { + return } - b.SavedMessagesTopic = v - return nil + return s.IsPinned } -// Encode implements bin.Encode for SavedMessagesTopicBox. -func (b *SavedMessagesTopicBox) Encode(buf *bin.Buffer) error { - if b == nil || b.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode SavedMessagesTopicClass as nil") +// GetOrder returns value of Order field. +func (s *SavedMessagesTopic) GetOrder() (value int64) { + if s == nil { + return } - return b.SavedMessagesTopic.Encode(buf) + return s.Order } -// DecodeTDLibJSON implements bin.Decoder for SavedMessagesTopicBox. -func (b *SavedMessagesTopicBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode SavedMessagesTopicBox to nil") - } - v, err := DecodeTDLibJSONSavedMessagesTopic(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) +// GetLastMessage returns value of LastMessage field. +func (s *SavedMessagesTopic) GetLastMessage() (value Message) { + if s == nil { + return } - b.SavedMessagesTopic = v - return nil + return s.LastMessage } -// EncodeTDLibJSON implements bin.Encode for SavedMessagesTopicBox. -func (b *SavedMessagesTopicBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode SavedMessagesTopicClass as nil") +// GetDraftMessage returns value of DraftMessage field. +func (s *SavedMessagesTopic) GetDraftMessage() (value DraftMessage) { + if s == nil { + return } - return b.SavedMessagesTopic.EncodeTDLibJSON(buf) + return s.DraftMessage } diff --git a/tdapi/tl_saved_messages_topic_type_gen.go b/tdapi/tl_saved_messages_topic_type_gen.go new file mode 100644 index 0000000000..94eab9b27c --- /dev/null +++ b/tdapi/tl_saved_messages_topic_type_gen.go @@ -0,0 +1,612 @@ +// 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{} +) + +// SavedMessagesTopicTypeMyNotes represents TL type `savedMessagesTopicTypeMyNotes#b38a41f5`. +type SavedMessagesTopicTypeMyNotes struct { +} + +// SavedMessagesTopicTypeMyNotesTypeID is TL type id of SavedMessagesTopicTypeMyNotes. +const SavedMessagesTopicTypeMyNotesTypeID = 0xb38a41f5 + +// construct implements constructor of SavedMessagesTopicTypeClass. +func (s SavedMessagesTopicTypeMyNotes) construct() SavedMessagesTopicTypeClass { return &s } + +// Ensuring interfaces in compile-time for SavedMessagesTopicTypeMyNotes. +var ( + _ bin.Encoder = &SavedMessagesTopicTypeMyNotes{} + _ bin.Decoder = &SavedMessagesTopicTypeMyNotes{} + _ bin.BareEncoder = &SavedMessagesTopicTypeMyNotes{} + _ bin.BareDecoder = &SavedMessagesTopicTypeMyNotes{} + + _ SavedMessagesTopicTypeClass = &SavedMessagesTopicTypeMyNotes{} +) + +func (s *SavedMessagesTopicTypeMyNotes) Zero() bool { + if s == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (s *SavedMessagesTopicTypeMyNotes) String() string { + if s == nil { + return "SavedMessagesTopicTypeMyNotes(nil)" + } + type Alias SavedMessagesTopicTypeMyNotes + return fmt.Sprintf("SavedMessagesTopicTypeMyNotes%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SavedMessagesTopicTypeMyNotes) TypeID() uint32 { + return SavedMessagesTopicTypeMyNotesTypeID +} + +// TypeName returns name of type in TL schema. +func (*SavedMessagesTopicTypeMyNotes) TypeName() string { + return "savedMessagesTopicTypeMyNotes" +} + +// TypeInfo returns info about TL type. +func (s *SavedMessagesTopicTypeMyNotes) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "savedMessagesTopicTypeMyNotes", + ID: SavedMessagesTopicTypeMyNotesTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (s *SavedMessagesTopicTypeMyNotes) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode savedMessagesTopicTypeMyNotes#b38a41f5 as nil") + } + b.PutID(SavedMessagesTopicTypeMyNotesTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SavedMessagesTopicTypeMyNotes) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode savedMessagesTopicTypeMyNotes#b38a41f5 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (s *SavedMessagesTopicTypeMyNotes) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode savedMessagesTopicTypeMyNotes#b38a41f5 to nil") + } + if err := b.ConsumeID(SavedMessagesTopicTypeMyNotesTypeID); err != nil { + return fmt.Errorf("unable to decode savedMessagesTopicTypeMyNotes#b38a41f5: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SavedMessagesTopicTypeMyNotes) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode savedMessagesTopicTypeMyNotes#b38a41f5 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SavedMessagesTopicTypeMyNotes) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode savedMessagesTopicTypeMyNotes#b38a41f5 as nil") + } + b.ObjStart() + b.PutID("savedMessagesTopicTypeMyNotes") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SavedMessagesTopicTypeMyNotes) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode savedMessagesTopicTypeMyNotes#b38a41f5 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("savedMessagesTopicTypeMyNotes"); err != nil { + return fmt.Errorf("unable to decode savedMessagesTopicTypeMyNotes#b38a41f5: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// SavedMessagesTopicTypeAuthorHidden represents TL type `savedMessagesTopicTypeAuthorHidden#703c4195`. +type SavedMessagesTopicTypeAuthorHidden struct { +} + +// SavedMessagesTopicTypeAuthorHiddenTypeID is TL type id of SavedMessagesTopicTypeAuthorHidden. +const SavedMessagesTopicTypeAuthorHiddenTypeID = 0x703c4195 + +// construct implements constructor of SavedMessagesTopicTypeClass. +func (s SavedMessagesTopicTypeAuthorHidden) construct() SavedMessagesTopicTypeClass { return &s } + +// Ensuring interfaces in compile-time for SavedMessagesTopicTypeAuthorHidden. +var ( + _ bin.Encoder = &SavedMessagesTopicTypeAuthorHidden{} + _ bin.Decoder = &SavedMessagesTopicTypeAuthorHidden{} + _ bin.BareEncoder = &SavedMessagesTopicTypeAuthorHidden{} + _ bin.BareDecoder = &SavedMessagesTopicTypeAuthorHidden{} + + _ SavedMessagesTopicTypeClass = &SavedMessagesTopicTypeAuthorHidden{} +) + +func (s *SavedMessagesTopicTypeAuthorHidden) Zero() bool { + if s == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (s *SavedMessagesTopicTypeAuthorHidden) String() string { + if s == nil { + return "SavedMessagesTopicTypeAuthorHidden(nil)" + } + type Alias SavedMessagesTopicTypeAuthorHidden + return fmt.Sprintf("SavedMessagesTopicTypeAuthorHidden%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SavedMessagesTopicTypeAuthorHidden) TypeID() uint32 { + return SavedMessagesTopicTypeAuthorHiddenTypeID +} + +// TypeName returns name of type in TL schema. +func (*SavedMessagesTopicTypeAuthorHidden) TypeName() string { + return "savedMessagesTopicTypeAuthorHidden" +} + +// TypeInfo returns info about TL type. +func (s *SavedMessagesTopicTypeAuthorHidden) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "savedMessagesTopicTypeAuthorHidden", + ID: SavedMessagesTopicTypeAuthorHiddenTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (s *SavedMessagesTopicTypeAuthorHidden) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode savedMessagesTopicTypeAuthorHidden#703c4195 as nil") + } + b.PutID(SavedMessagesTopicTypeAuthorHiddenTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SavedMessagesTopicTypeAuthorHidden) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode savedMessagesTopicTypeAuthorHidden#703c4195 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (s *SavedMessagesTopicTypeAuthorHidden) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode savedMessagesTopicTypeAuthorHidden#703c4195 to nil") + } + if err := b.ConsumeID(SavedMessagesTopicTypeAuthorHiddenTypeID); err != nil { + return fmt.Errorf("unable to decode savedMessagesTopicTypeAuthorHidden#703c4195: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SavedMessagesTopicTypeAuthorHidden) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode savedMessagesTopicTypeAuthorHidden#703c4195 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SavedMessagesTopicTypeAuthorHidden) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode savedMessagesTopicTypeAuthorHidden#703c4195 as nil") + } + b.ObjStart() + b.PutID("savedMessagesTopicTypeAuthorHidden") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SavedMessagesTopicTypeAuthorHidden) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode savedMessagesTopicTypeAuthorHidden#703c4195 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("savedMessagesTopicTypeAuthorHidden"); err != nil { + return fmt.Errorf("unable to decode savedMessagesTopicTypeAuthorHidden#703c4195: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// SavedMessagesTopicTypeSavedFromChat represents TL type `savedMessagesTopicTypeSavedFromChat#993fad58`. +type SavedMessagesTopicTypeSavedFromChat struct { + // Identifier of the chat + ChatID int64 +} + +// SavedMessagesTopicTypeSavedFromChatTypeID is TL type id of SavedMessagesTopicTypeSavedFromChat. +const SavedMessagesTopicTypeSavedFromChatTypeID = 0x993fad58 + +// construct implements constructor of SavedMessagesTopicTypeClass. +func (s SavedMessagesTopicTypeSavedFromChat) construct() SavedMessagesTopicTypeClass { return &s } + +// Ensuring interfaces in compile-time for SavedMessagesTopicTypeSavedFromChat. +var ( + _ bin.Encoder = &SavedMessagesTopicTypeSavedFromChat{} + _ bin.Decoder = &SavedMessagesTopicTypeSavedFromChat{} + _ bin.BareEncoder = &SavedMessagesTopicTypeSavedFromChat{} + _ bin.BareDecoder = &SavedMessagesTopicTypeSavedFromChat{} + + _ SavedMessagesTopicTypeClass = &SavedMessagesTopicTypeSavedFromChat{} +) + +func (s *SavedMessagesTopicTypeSavedFromChat) Zero() bool { + if s == nil { + return true + } + if !(s.ChatID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SavedMessagesTopicTypeSavedFromChat) String() string { + if s == nil { + return "SavedMessagesTopicTypeSavedFromChat(nil)" + } + type Alias SavedMessagesTopicTypeSavedFromChat + return fmt.Sprintf("SavedMessagesTopicTypeSavedFromChat%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SavedMessagesTopicTypeSavedFromChat) TypeID() uint32 { + return SavedMessagesTopicTypeSavedFromChatTypeID +} + +// TypeName returns name of type in TL schema. +func (*SavedMessagesTopicTypeSavedFromChat) TypeName() string { + return "savedMessagesTopicTypeSavedFromChat" +} + +// TypeInfo returns info about TL type. +func (s *SavedMessagesTopicTypeSavedFromChat) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "savedMessagesTopicTypeSavedFromChat", + ID: SavedMessagesTopicTypeSavedFromChatTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SavedMessagesTopicTypeSavedFromChat) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode savedMessagesTopicTypeSavedFromChat#993fad58 as nil") + } + b.PutID(SavedMessagesTopicTypeSavedFromChatTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SavedMessagesTopicTypeSavedFromChat) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode savedMessagesTopicTypeSavedFromChat#993fad58 as nil") + } + b.PutInt53(s.ChatID) + return nil +} + +// Decode implements bin.Decoder. +func (s *SavedMessagesTopicTypeSavedFromChat) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode savedMessagesTopicTypeSavedFromChat#993fad58 to nil") + } + if err := b.ConsumeID(SavedMessagesTopicTypeSavedFromChatTypeID); err != nil { + return fmt.Errorf("unable to decode savedMessagesTopicTypeSavedFromChat#993fad58: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SavedMessagesTopicTypeSavedFromChat) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode savedMessagesTopicTypeSavedFromChat#993fad58 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode savedMessagesTopicTypeSavedFromChat#993fad58: field chat_id: %w", err) + } + s.ChatID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SavedMessagesTopicTypeSavedFromChat) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode savedMessagesTopicTypeSavedFromChat#993fad58 as nil") + } + b.ObjStart() + b.PutID("savedMessagesTopicTypeSavedFromChat") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(s.ChatID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SavedMessagesTopicTypeSavedFromChat) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode savedMessagesTopicTypeSavedFromChat#993fad58 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("savedMessagesTopicTypeSavedFromChat"); err != nil { + return fmt.Errorf("unable to decode savedMessagesTopicTypeSavedFromChat#993fad58: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode savedMessagesTopicTypeSavedFromChat#993fad58: field chat_id: %w", err) + } + s.ChatID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (s *SavedMessagesTopicTypeSavedFromChat) GetChatID() (value int64) { + if s == nil { + return + } + return s.ChatID +} + +// SavedMessagesTopicTypeClassName is schema name of SavedMessagesTopicTypeClass. +const SavedMessagesTopicTypeClassName = "SavedMessagesTopicType" + +// SavedMessagesTopicTypeClass represents SavedMessagesTopicType generic type. +// +// Example: +// +// g, err := tdapi.DecodeSavedMessagesTopicType(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tdapi.SavedMessagesTopicTypeMyNotes: // savedMessagesTopicTypeMyNotes#b38a41f5 +// case *tdapi.SavedMessagesTopicTypeAuthorHidden: // savedMessagesTopicTypeAuthorHidden#703c4195 +// case *tdapi.SavedMessagesTopicTypeSavedFromChat: // savedMessagesTopicTypeSavedFromChat#993fad58 +// default: panic(v) +// } +type SavedMessagesTopicTypeClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() SavedMessagesTopicTypeClass + + // TypeID returns type id in TL schema. + // + // See https://core.telegram.org/mtproto/TL-tl#remarks. + TypeID() uint32 + // TypeName returns name of type in TL schema. + TypeName() string + // String implements fmt.Stringer. + String() string + // Zero returns true if current object has a zero value. + Zero() bool + + EncodeTDLibJSON(b tdjson.Encoder) error + DecodeTDLibJSON(b tdjson.Decoder) error +} + +// DecodeSavedMessagesTopicType implements binary de-serialization for SavedMessagesTopicTypeClass. +func DecodeSavedMessagesTopicType(buf *bin.Buffer) (SavedMessagesTopicTypeClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case SavedMessagesTopicTypeMyNotesTypeID: + // Decoding savedMessagesTopicTypeMyNotes#b38a41f5. + v := SavedMessagesTopicTypeMyNotes{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode SavedMessagesTopicTypeClass: %w", err) + } + return &v, nil + case SavedMessagesTopicTypeAuthorHiddenTypeID: + // Decoding savedMessagesTopicTypeAuthorHidden#703c4195. + v := SavedMessagesTopicTypeAuthorHidden{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode SavedMessagesTopicTypeClass: %w", err) + } + return &v, nil + case SavedMessagesTopicTypeSavedFromChatTypeID: + // Decoding savedMessagesTopicTypeSavedFromChat#993fad58. + v := SavedMessagesTopicTypeSavedFromChat{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode SavedMessagesTopicTypeClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode SavedMessagesTopicTypeClass: %w", bin.NewUnexpectedID(id)) + } +} + +// DecodeTDLibJSONSavedMessagesTopicType implements binary de-serialization for SavedMessagesTopicTypeClass. +func DecodeTDLibJSONSavedMessagesTopicType(buf tdjson.Decoder) (SavedMessagesTopicTypeClass, error) { + id, err := buf.FindTypeID() + if err != nil { + return nil, err + } + switch id { + case "savedMessagesTopicTypeMyNotes": + // Decoding savedMessagesTopicTypeMyNotes#b38a41f5. + v := SavedMessagesTopicTypeMyNotes{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode SavedMessagesTopicTypeClass: %w", err) + } + return &v, nil + case "savedMessagesTopicTypeAuthorHidden": + // Decoding savedMessagesTopicTypeAuthorHidden#703c4195. + v := SavedMessagesTopicTypeAuthorHidden{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode SavedMessagesTopicTypeClass: %w", err) + } + return &v, nil + case "savedMessagesTopicTypeSavedFromChat": + // Decoding savedMessagesTopicTypeSavedFromChat#993fad58. + v := SavedMessagesTopicTypeSavedFromChat{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode SavedMessagesTopicTypeClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode SavedMessagesTopicTypeClass: %w", tdjson.NewUnexpectedID(id)) + } +} + +// SavedMessagesTopicType boxes the SavedMessagesTopicTypeClass providing a helper. +type SavedMessagesTopicTypeBox struct { + SavedMessagesTopicType SavedMessagesTopicTypeClass +} + +// Decode implements bin.Decoder for SavedMessagesTopicTypeBox. +func (b *SavedMessagesTopicTypeBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode SavedMessagesTopicTypeBox to nil") + } + v, err := DecodeSavedMessagesTopicType(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.SavedMessagesTopicType = v + return nil +} + +// Encode implements bin.Encode for SavedMessagesTopicTypeBox. +func (b *SavedMessagesTopicTypeBox) Encode(buf *bin.Buffer) error { + if b == nil || b.SavedMessagesTopicType == nil { + return fmt.Errorf("unable to encode SavedMessagesTopicTypeClass as nil") + } + return b.SavedMessagesTopicType.Encode(buf) +} + +// DecodeTDLibJSON implements bin.Decoder for SavedMessagesTopicTypeBox. +func (b *SavedMessagesTopicTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("unable to decode SavedMessagesTopicTypeBox to nil") + } + v, err := DecodeTDLibJSONSavedMessagesTopicType(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.SavedMessagesTopicType = v + return nil +} + +// EncodeTDLibJSON implements bin.Encode for SavedMessagesTopicTypeBox. +func (b *SavedMessagesTopicTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil || b.SavedMessagesTopicType == nil { + return fmt.Errorf("unable to encode SavedMessagesTopicTypeClass as nil") + } + return b.SavedMessagesTopicType.EncodeTDLibJSON(buf) +} diff --git a/tdapi/tl_search_chat_messages_gen.go b/tdapi/tl_search_chat_messages_gen.go index ccb8659c4e..08e1330308 100644 --- a/tdapi/tl_search_chat_messages_gen.go +++ b/tdapi/tl_search_chat_messages_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// SearchChatMessagesRequest represents TL type `searchChatMessages#8dbde5c5`. +// SearchChatMessagesRequest represents TL type `searchChatMessages#dfdeb5c6`. type SearchChatMessagesRequest struct { // Identifier of the chat in which to search messages ChatID int64 @@ -53,13 +53,13 @@ type SearchChatMessagesRequest struct { Filter SearchMessagesFilterClass // If not 0, only messages in the specified thread will be returned; supergroups only MessageThreadID int64 - // If not null, only messages in the specified Saved Messages topic will be returned; - // pass null to return all messages, or for chats other than Saved Messages - SavedMessagesTopic SavedMessagesTopicClass + // If not 0, only messages in the specified Saved Messages topic will be returned; pass 0 + // to return all messages, or for chats other than Saved Messages + SavedMessagesTopicID int64 } // SearchChatMessagesRequestTypeID is TL type id of SearchChatMessagesRequest. -const SearchChatMessagesRequestTypeID = 0x8dbde5c5 +const SearchChatMessagesRequestTypeID = 0xdfdeb5c6 // Ensuring interfaces in compile-time for SearchChatMessagesRequest. var ( @@ -97,7 +97,7 @@ func (s *SearchChatMessagesRequest) Zero() bool { if !(s.MessageThreadID == 0) { return false } - if !(s.SavedMessagesTopic == nil) { + if !(s.SavedMessagesTopicID == 0) { return false } @@ -169,8 +169,8 @@ func (s *SearchChatMessagesRequest) TypeInfo() tdp.Type { SchemaName: "message_thread_id", }, { - Name: "SavedMessagesTopic", - SchemaName: "saved_messages_topic", + Name: "SavedMessagesTopicID", + SchemaName: "saved_messages_topic_id", }, } return typ @@ -179,7 +179,7 @@ func (s *SearchChatMessagesRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *SearchChatMessagesRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode searchChatMessages#8dbde5c5 as nil") + return fmt.Errorf("can't encode searchChatMessages#dfdeb5c6 as nil") } b.PutID(SearchChatMessagesRequestTypeID) return s.EncodeBare(b) @@ -188,42 +188,37 @@ func (s *SearchChatMessagesRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *SearchChatMessagesRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode searchChatMessages#8dbde5c5 as nil") + return fmt.Errorf("can't encode searchChatMessages#dfdeb5c6 as nil") } b.PutInt53(s.ChatID) b.PutString(s.Query) if s.SenderID == nil { - return fmt.Errorf("unable to encode searchChatMessages#8dbde5c5: field sender_id is nil") + return fmt.Errorf("unable to encode searchChatMessages#dfdeb5c6: field sender_id is nil") } if err := s.SenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchChatMessages#8dbde5c5: field sender_id: %w", err) + return fmt.Errorf("unable to encode searchChatMessages#dfdeb5c6: field sender_id: %w", err) } b.PutInt53(s.FromMessageID) b.PutInt32(s.Offset) b.PutInt32(s.Limit) if s.Filter == nil { - return fmt.Errorf("unable to encode searchChatMessages#8dbde5c5: field filter is nil") + return fmt.Errorf("unable to encode searchChatMessages#dfdeb5c6: field filter is nil") } if err := s.Filter.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchChatMessages#8dbde5c5: field filter: %w", err) + return fmt.Errorf("unable to encode searchChatMessages#dfdeb5c6: field filter: %w", err) } b.PutInt53(s.MessageThreadID) - if s.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode searchChatMessages#8dbde5c5: field saved_messages_topic is nil") - } - if err := s.SavedMessagesTopic.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchChatMessages#8dbde5c5: field saved_messages_topic: %w", err) - } + b.PutInt53(s.SavedMessagesTopicID) return nil } // Decode implements bin.Decoder. func (s *SearchChatMessagesRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode searchChatMessages#8dbde5c5 to nil") + return fmt.Errorf("can't decode searchChatMessages#dfdeb5c6 to nil") } if err := b.ConsumeID(SearchChatMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchChatMessages#8dbde5c5: %w", err) + return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: %w", err) } return s.DecodeBare(b) } @@ -231,70 +226,70 @@ func (s *SearchChatMessagesRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *SearchChatMessagesRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode searchChatMessages#8dbde5c5 to nil") + return fmt.Errorf("can't decode searchChatMessages#dfdeb5c6 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#8dbde5c5: field chat_id: %w", err) + return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field chat_id: %w", err) } s.ChatID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#8dbde5c5: field query: %w", err) + return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field query: %w", err) } s.Query = value } { value, err := DecodeMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#8dbde5c5: field sender_id: %w", err) + return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field sender_id: %w", err) } s.SenderID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#8dbde5c5: field from_message_id: %w", err) + return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field from_message_id: %w", err) } s.FromMessageID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#8dbde5c5: field offset: %w", err) + return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field offset: %w", err) } s.Offset = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#8dbde5c5: field limit: %w", err) + return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field limit: %w", err) } s.Limit = value } { value, err := DecodeSearchMessagesFilter(b) if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#8dbde5c5: field filter: %w", err) + return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field filter: %w", err) } s.Filter = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#8dbde5c5: field message_thread_id: %w", err) + return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field message_thread_id: %w", err) } s.MessageThreadID = value } { - value, err := DecodeSavedMessagesTopic(b) + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#8dbde5c5: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field saved_messages_topic_id: %w", err) } - s.SavedMessagesTopic = value + s.SavedMessagesTopicID = value } return nil } @@ -302,7 +297,7 @@ func (s *SearchChatMessagesRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *SearchChatMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode searchChatMessages#8dbde5c5 as nil") + return fmt.Errorf("can't encode searchChatMessages#dfdeb5c6 as nil") } b.ObjStart() b.PutID("searchChatMessages") @@ -315,10 +310,10 @@ func (s *SearchChatMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("sender_id") if s.SenderID == nil { - return fmt.Errorf("unable to encode searchChatMessages#8dbde5c5: field sender_id is nil") + return fmt.Errorf("unable to encode searchChatMessages#dfdeb5c6: field sender_id is nil") } if err := s.SenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchChatMessages#8dbde5c5: field sender_id: %w", err) + return fmt.Errorf("unable to encode searchChatMessages#dfdeb5c6: field sender_id: %w", err) } b.Comma() b.FieldStart("from_message_id") @@ -332,22 +327,17 @@ func (s *SearchChatMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("filter") if s.Filter == nil { - return fmt.Errorf("unable to encode searchChatMessages#8dbde5c5: field filter is nil") + return fmt.Errorf("unable to encode searchChatMessages#dfdeb5c6: field filter is nil") } if err := s.Filter.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchChatMessages#8dbde5c5: field filter: %w", err) + return fmt.Errorf("unable to encode searchChatMessages#dfdeb5c6: field filter: %w", err) } b.Comma() b.FieldStart("message_thread_id") b.PutInt53(s.MessageThreadID) b.Comma() - b.FieldStart("saved_messages_topic") - if s.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode searchChatMessages#8dbde5c5: field saved_messages_topic is nil") - } - if err := s.SavedMessagesTopic.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchChatMessages#8dbde5c5: field saved_messages_topic: %w", err) - } + b.FieldStart("saved_messages_topic_id") + b.PutInt53(s.SavedMessagesTopicID) b.Comma() b.StripComma() b.ObjEnd() @@ -357,69 +347,69 @@ func (s *SearchChatMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *SearchChatMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode searchChatMessages#8dbde5c5 to nil") + return fmt.Errorf("can't decode searchChatMessages#dfdeb5c6 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("searchChatMessages"); err != nil { - return fmt.Errorf("unable to decode searchChatMessages#8dbde5c5: %w", err) + return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#8dbde5c5: field chat_id: %w", err) + return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field chat_id: %w", err) } s.ChatID = value case "query": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#8dbde5c5: field query: %w", err) + return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field query: %w", err) } s.Query = value case "sender_id": value, err := DecodeTDLibJSONMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#8dbde5c5: field sender_id: %w", err) + return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field sender_id: %w", err) } s.SenderID = value case "from_message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#8dbde5c5: field from_message_id: %w", err) + return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field from_message_id: %w", err) } s.FromMessageID = value case "offset": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#8dbde5c5: field offset: %w", err) + return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field offset: %w", err) } s.Offset = value case "limit": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#8dbde5c5: field limit: %w", err) + return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field limit: %w", err) } s.Limit = value case "filter": value, err := DecodeTDLibJSONSearchMessagesFilter(b) if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#8dbde5c5: field filter: %w", err) + return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field filter: %w", err) } s.Filter = value case "message_thread_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#8dbde5c5: field message_thread_id: %w", err) + return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field message_thread_id: %w", err) } s.MessageThreadID = value - case "saved_messages_topic": - value, err := DecodeTDLibJSONSavedMessagesTopic(b) + case "saved_messages_topic_id": + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#8dbde5c5: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field saved_messages_topic_id: %w", err) } - s.SavedMessagesTopic = value + s.SavedMessagesTopicID = value default: return b.Skip() } @@ -491,15 +481,15 @@ func (s *SearchChatMessagesRequest) GetMessageThreadID() (value int64) { return s.MessageThreadID } -// GetSavedMessagesTopic returns value of SavedMessagesTopic field. -func (s *SearchChatMessagesRequest) GetSavedMessagesTopic() (value SavedMessagesTopicClass) { +// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. +func (s *SearchChatMessagesRequest) GetSavedMessagesTopicID() (value int64) { if s == nil { return } - return s.SavedMessagesTopic + return s.SavedMessagesTopicID } -// SearchChatMessages invokes method searchChatMessages#8dbde5c5 returning error if any. +// SearchChatMessages invokes method searchChatMessages#dfdeb5c6 returning error if any. func (c *Client) SearchChatMessages(ctx context.Context, request *SearchChatMessagesRequest) (*FoundChatMessages, error) { var result FoundChatMessages diff --git a/tdapi/tl_search_saved_messages_gen.go b/tdapi/tl_search_saved_messages_gen.go index 70209d9f94..84c5a66545 100644 --- a/tdapi/tl_search_saved_messages_gen.go +++ b/tdapi/tl_search_saved_messages_gen.go @@ -31,8 +31,11 @@ var ( _ = tdjson.Encoder{} ) -// SearchSavedMessagesRequest represents TL type `searchSavedMessages#da8efe2a`. +// SearchSavedMessagesRequest represents TL type `searchSavedMessages#8a9b9f96`. type SearchSavedMessagesRequest struct { + // If not 0, only messages in the specified Saved Messages topic will be considered; pass + // 0 to consider all messages + SavedMessagesTopicID int64 // Tag to search for; pass null to return all suitable messages Tag ReactionTypeClass // Query to search for @@ -49,7 +52,7 @@ type SearchSavedMessagesRequest struct { } // SearchSavedMessagesRequestTypeID is TL type id of SearchSavedMessagesRequest. -const SearchSavedMessagesRequestTypeID = 0xda8efe2a +const SearchSavedMessagesRequestTypeID = 0x8a9b9f96 // Ensuring interfaces in compile-time for SearchSavedMessagesRequest. var ( @@ -63,6 +66,9 @@ func (s *SearchSavedMessagesRequest) Zero() bool { if s == nil { return true } + if !(s.SavedMessagesTopicID == 0) { + return false + } if !(s.Tag == nil) { return false } @@ -114,6 +120,10 @@ func (s *SearchSavedMessagesRequest) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "SavedMessagesTopicID", + SchemaName: "saved_messages_topic_id", + }, { Name: "Tag", SchemaName: "tag", @@ -141,7 +151,7 @@ func (s *SearchSavedMessagesRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *SearchSavedMessagesRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode searchSavedMessages#da8efe2a as nil") + return fmt.Errorf("can't encode searchSavedMessages#8a9b9f96 as nil") } b.PutID(SearchSavedMessagesRequestTypeID) return s.EncodeBare(b) @@ -150,13 +160,14 @@ func (s *SearchSavedMessagesRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *SearchSavedMessagesRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode searchSavedMessages#da8efe2a as nil") + return fmt.Errorf("can't encode searchSavedMessages#8a9b9f96 as nil") } + b.PutInt53(s.SavedMessagesTopicID) if s.Tag == nil { - return fmt.Errorf("unable to encode searchSavedMessages#da8efe2a: field tag is nil") + return fmt.Errorf("unable to encode searchSavedMessages#8a9b9f96: field tag is nil") } if err := s.Tag.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchSavedMessages#da8efe2a: field tag: %w", err) + return fmt.Errorf("unable to encode searchSavedMessages#8a9b9f96: field tag: %w", err) } b.PutString(s.Query) b.PutInt53(s.FromMessageID) @@ -168,10 +179,10 @@ func (s *SearchSavedMessagesRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *SearchSavedMessagesRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode searchSavedMessages#da8efe2a to nil") + return fmt.Errorf("can't decode searchSavedMessages#8a9b9f96 to nil") } if err := b.ConsumeID(SearchSavedMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#da8efe2a: %w", err) + return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: %w", err) } return s.DecodeBare(b) } @@ -179,40 +190,47 @@ func (s *SearchSavedMessagesRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *SearchSavedMessagesRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode searchSavedMessages#da8efe2a to nil") + return fmt.Errorf("can't decode searchSavedMessages#8a9b9f96 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field saved_messages_topic_id: %w", err) + } + s.SavedMessagesTopicID = value } { value, err := DecodeReactionType(b) if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#da8efe2a: field tag: %w", err) + return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field tag: %w", err) } s.Tag = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#da8efe2a: field query: %w", err) + return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field query: %w", err) } s.Query = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#da8efe2a: field from_message_id: %w", err) + return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field from_message_id: %w", err) } s.FromMessageID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#da8efe2a: field offset: %w", err) + return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field offset: %w", err) } s.Offset = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#da8efe2a: field limit: %w", err) + return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field limit: %w", err) } s.Limit = value } @@ -222,17 +240,20 @@ func (s *SearchSavedMessagesRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *SearchSavedMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode searchSavedMessages#da8efe2a as nil") + return fmt.Errorf("can't encode searchSavedMessages#8a9b9f96 as nil") } b.ObjStart() b.PutID("searchSavedMessages") b.Comma() + b.FieldStart("saved_messages_topic_id") + b.PutInt53(s.SavedMessagesTopicID) + b.Comma() b.FieldStart("tag") if s.Tag == nil { - return fmt.Errorf("unable to encode searchSavedMessages#da8efe2a: field tag is nil") + return fmt.Errorf("unable to encode searchSavedMessages#8a9b9f96: field tag is nil") } if err := s.Tag.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchSavedMessages#da8efe2a: field tag: %w", err) + return fmt.Errorf("unable to encode searchSavedMessages#8a9b9f96: field tag: %w", err) } b.Comma() b.FieldStart("query") @@ -255,43 +276,49 @@ func (s *SearchSavedMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *SearchSavedMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode searchSavedMessages#da8efe2a to nil") + return fmt.Errorf("can't decode searchSavedMessages#8a9b9f96 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("searchSavedMessages"); err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#da8efe2a: %w", err) + return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: %w", err) } + case "saved_messages_topic_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field saved_messages_topic_id: %w", err) + } + s.SavedMessagesTopicID = value case "tag": value, err := DecodeTDLibJSONReactionType(b) if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#da8efe2a: field tag: %w", err) + return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field tag: %w", err) } s.Tag = value case "query": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#da8efe2a: field query: %w", err) + return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field query: %w", err) } s.Query = value case "from_message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#da8efe2a: field from_message_id: %w", err) + return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field from_message_id: %w", err) } s.FromMessageID = value case "offset": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#da8efe2a: field offset: %w", err) + return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field offset: %w", err) } s.Offset = value case "limit": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#da8efe2a: field limit: %w", err) + return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field limit: %w", err) } s.Limit = value default: @@ -301,6 +328,14 @@ func (s *SearchSavedMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { }) } +// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. +func (s *SearchSavedMessagesRequest) GetSavedMessagesTopicID() (value int64) { + if s == nil { + return + } + return s.SavedMessagesTopicID +} + // GetTag returns value of Tag field. func (s *SearchSavedMessagesRequest) GetTag() (value ReactionTypeClass) { if s == nil { @@ -341,7 +376,7 @@ func (s *SearchSavedMessagesRequest) GetLimit() (value int32) { return s.Limit } -// SearchSavedMessages invokes method searchSavedMessages#da8efe2a returning error if any. +// SearchSavedMessages invokes method searchSavedMessages#8a9b9f96 returning error if any. func (c *Client) SearchSavedMessages(ctx context.Context, request *SearchSavedMessagesRequest) (*FoundChatMessages, error) { var result FoundChatMessages diff --git a/tdapi/tl_send_chat_action_gen.go b/tdapi/tl_send_chat_action_gen.go index ab66c203d3..2717c011e0 100644 --- a/tdapi/tl_send_chat_action_gen.go +++ b/tdapi/tl_send_chat_action_gen.go @@ -35,7 +35,7 @@ var ( type SendChatActionRequest struct { // Chat identifier ChatID int64 - // If not 0, a message thread identifier in which the action was performed + // If not 0, the message thread identifier in which the action was performed MessageThreadID int64 // The action description; pass null to cancel the currently active action Action ChatActionClass diff --git a/tdapi/tl_send_inline_query_result_message_gen.go b/tdapi/tl_send_inline_query_result_message_gen.go index 25cbe2f4d3..b6bc302e21 100644 --- a/tdapi/tl_send_inline_query_result_message_gen.go +++ b/tdapi/tl_send_inline_query_result_message_gen.go @@ -35,7 +35,7 @@ var ( type SendInlineQueryResultMessageRequest struct { // Target chat ChatID int64 - // If not 0, a message thread identifier in which the message will be sent + // If not 0, the message thread identifier in which the message will be sent MessageThreadID int64 // Information about the message or story to be replied; pass null if none ReplyTo InputMessageReplyToClass diff --git a/tdapi/tl_send_message_album_gen.go b/tdapi/tl_send_message_album_gen.go index 65f451569b..238a6ef658 100644 --- a/tdapi/tl_send_message_album_gen.go +++ b/tdapi/tl_send_message_album_gen.go @@ -35,7 +35,7 @@ var ( type SendMessageAlbumRequest struct { // Target chat ChatID int64 - // If not 0, a message thread identifier in which the messages will be sent + // If not 0, the message thread identifier in which the messages will be sent MessageThreadID int64 // Information about the message or story to be replied; pass null if none ReplyTo InputMessageReplyToClass diff --git a/tdapi/tl_send_message_gen.go b/tdapi/tl_send_message_gen.go index ada196dc8e..e1ab95588a 100644 --- a/tdapi/tl_send_message_gen.go +++ b/tdapi/tl_send_message_gen.go @@ -35,7 +35,7 @@ var ( type SendMessageRequest struct { // Target chat ChatID int64 - // If not 0, a message thread identifier in which the message will be sent + // If not 0, the message thread identifier in which the message will be sent MessageThreadID int64 // Information about the message or story to be replied; pass null if none ReplyTo InputMessageReplyToClass diff --git a/tdapi/tl_send_story_gen.go b/tdapi/tl_send_story_gen.go index 6de81bf1f8..aceb543a87 100644 --- a/tdapi/tl_send_story_gen.go +++ b/tdapi/tl_send_story_gen.go @@ -42,7 +42,8 @@ type SendStoryRequest struct { // Story caption; pass null to use an empty caption; // 0-getOption("story_caption_length_max") characters Caption FormattedText - // The privacy settings for the story + // The privacy settings for the story; ignored for stories sent to supergroup and channel + // chats PrivacySettings StoryPrivacySettingsClass // Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, // 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise diff --git a/tdapi/tl_set_chat_accent_color_gen.go b/tdapi/tl_set_chat_accent_color_gen.go index c43ed4cd92..0c9f2ef86e 100644 --- a/tdapi/tl_set_chat_accent_color_gen.go +++ b/tdapi/tl_set_chat_accent_color_gen.go @@ -36,7 +36,7 @@ type SetChatAccentColorRequest struct { // Chat identifier ChatID int64 // Identifier of the accent color to use. The chat must have at least accentColor - // min_chat_boost_level boost level to pass the corresponding color + // min_channel_chat_boost_level boost level to pass the corresponding color AccentColorID int32 // Identifier of a custom emoji to be shown on the reply header and link preview // background; 0 if none. Use chatBoostLevelFeatures.can_set_background_custom_emoji to diff --git a/tdapi/tl_set_chat_available_reactions_gen.go b/tdapi/tl_set_chat_available_reactions_gen.go index 8aa646d13c..bbd527942f 100644 --- a/tdapi/tl_set_chat_available_reactions_gen.go +++ b/tdapi/tl_set_chat_available_reactions_gen.go @@ -36,8 +36,8 @@ type SetChatAvailableReactionsRequest struct { // Identifier of the chat ChatID int64 // Reactions available in the chat. All explicitly specified emoji reactions must be - // active. Up to the chat's boost level custom emoji reactions can be explicitly - // specified + // active. In channel chats up to the chat's boost level custom emoji reactions can be + // explicitly specified AvailableReactions ChatAvailableReactionsClass } diff --git a/tdapi/tl_set_chat_description_gen.go b/tdapi/tl_set_chat_description_gen.go index 085171d51d..4616e506eb 100644 --- a/tdapi/tl_set_chat_description_gen.go +++ b/tdapi/tl_set_chat_description_gen.go @@ -36,7 +36,7 @@ type SetChatDescriptionRequest struct { // Identifier of the chat ChatID int64 // Changes information about a chat. Available for basic groups, supergroups, and - // channels. Requires can_change_info administrator right + // channels. Requires can_change_info member right Description string } diff --git a/tdapi/tl_set_chat_discussion_group_gen.go b/tdapi/tl_set_chat_discussion_group_gen.go index b992bbdd8e..8b984e1b85 100644 --- a/tdapi/tl_set_chat_discussion_group_gen.go +++ b/tdapi/tl_set_chat_discussion_group_gen.go @@ -34,8 +34,8 @@ var ( // SetChatDiscussionGroupRequest represents TL type `setChatDiscussionGroup#c93c32b8`. type SetChatDiscussionGroupRequest struct { // Identifier of the channel chat. Pass 0 to remove a link from the supergroup passed in - // the second argument to a linked channel chat (requires can_pin_messages rights in the - // supergroup) + // the second argument to a linked channel chat (requires can_pin_messages member right + // in the supergroup) ChatID int64 // Identifier of a new channel's discussion group. Use 0 to remove the discussion group. // Use the method getSuitableDiscussionChats to find all suitable groups. diff --git a/tdapi/tl_set_chat_draft_message_gen.go b/tdapi/tl_set_chat_draft_message_gen.go index 8f0a31edd2..3fb1ca3a98 100644 --- a/tdapi/tl_set_chat_draft_message_gen.go +++ b/tdapi/tl_set_chat_draft_message_gen.go @@ -35,9 +35,10 @@ var ( type SetChatDraftMessageRequest struct { // Chat identifier ChatID int64 - // If not 0, a message thread identifier in which the draft was changed + // If not 0, the message thread identifier in which the draft was changed MessageThreadID int64 - // New draft message; pass null to remove the draft + // New draft message; pass null to remove the draft. All files in draft message content + // must be of the type inputFileLocal. Media thumbnails and captions are ignored DraftMessage DraftMessage } diff --git a/tdapi/tl_set_chat_profile_accent_color_gen.go b/tdapi/tl_set_chat_profile_accent_color_gen.go index 5dab4a2e6c..153486d581 100644 --- a/tdapi/tl_set_chat_profile_accent_color_gen.go +++ b/tdapi/tl_set_chat_profile_accent_color_gen.go @@ -36,8 +36,7 @@ type SetChatProfileAccentColorRequest struct { // Chat identifier ChatID int64 // Identifier of the accent color to use for profile; pass -1 if none. The chat must have - // at least profileAccentColor.min_chat_boost_level boost level to pass the corresponding - // color + // at least profileAccentColor.min_supergroup_chat_boost_level for supergroups ProfileAccentColorID int32 // Identifier of a custom emoji to be shown on the chat's profile photo background; 0 if // none. Use chatBoostLevelFeatures.can_set_profile_background_custom_emoji to check diff --git a/tdapi/tl_set_pinned_saved_messages_topics_gen.go b/tdapi/tl_set_pinned_saved_messages_topics_gen.go index 1a11b0dbe1..55f28297fa 100644 --- a/tdapi/tl_set_pinned_saved_messages_topics_gen.go +++ b/tdapi/tl_set_pinned_saved_messages_topics_gen.go @@ -31,14 +31,14 @@ var ( _ = tdjson.Encoder{} ) -// SetPinnedSavedMessagesTopicsRequest represents TL type `setPinnedSavedMessagesTopics#81065db4`. +// SetPinnedSavedMessagesTopicsRequest represents TL type `setPinnedSavedMessagesTopics#475a1110`. type SetPinnedSavedMessagesTopicsRequest struct { - // The new list of pinned Saved Messages topics - SavedMessagesTopics []SavedMessagesTopicClass + // Identifiers of the new pinned Saved Messages topics + SavedMessagesTopicIDs []int64 } // SetPinnedSavedMessagesTopicsRequestTypeID is TL type id of SetPinnedSavedMessagesTopicsRequest. -const SetPinnedSavedMessagesTopicsRequestTypeID = 0x81065db4 +const SetPinnedSavedMessagesTopicsRequestTypeID = 0x475a1110 // Ensuring interfaces in compile-time for SetPinnedSavedMessagesTopicsRequest. var ( @@ -52,7 +52,7 @@ func (s *SetPinnedSavedMessagesTopicsRequest) Zero() bool { if s == nil { return true } - if !(s.SavedMessagesTopics == nil) { + if !(s.SavedMessagesTopicIDs == nil) { return false } @@ -92,8 +92,8 @@ func (s *SetPinnedSavedMessagesTopicsRequest) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "SavedMessagesTopics", - SchemaName: "saved_messages_topics", + Name: "SavedMessagesTopicIDs", + SchemaName: "saved_messages_topic_ids", }, } return typ @@ -102,7 +102,7 @@ func (s *SetPinnedSavedMessagesTopicsRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *SetPinnedSavedMessagesTopicsRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode setPinnedSavedMessagesTopics#81065db4 as nil") + return fmt.Errorf("can't encode setPinnedSavedMessagesTopics#475a1110 as nil") } b.PutID(SetPinnedSavedMessagesTopicsRequestTypeID) return s.EncodeBare(b) @@ -111,16 +111,11 @@ func (s *SetPinnedSavedMessagesTopicsRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *SetPinnedSavedMessagesTopicsRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode setPinnedSavedMessagesTopics#81065db4 as nil") + return fmt.Errorf("can't encode setPinnedSavedMessagesTopics#475a1110 as nil") } - b.PutInt(len(s.SavedMessagesTopics)) - for idx, v := range s.SavedMessagesTopics { - if v == nil { - return fmt.Errorf("unable to encode setPinnedSavedMessagesTopics#81065db4: field saved_messages_topics element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare setPinnedSavedMessagesTopics#81065db4: field saved_messages_topics element with index %d: %w", idx, err) - } + b.PutInt(len(s.SavedMessagesTopicIDs)) + for _, v := range s.SavedMessagesTopicIDs { + b.PutInt53(v) } return nil } @@ -128,10 +123,10 @@ func (s *SetPinnedSavedMessagesTopicsRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *SetPinnedSavedMessagesTopicsRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode setPinnedSavedMessagesTopics#81065db4 to nil") + return fmt.Errorf("can't decode setPinnedSavedMessagesTopics#475a1110 to nil") } if err := b.ConsumeID(SetPinnedSavedMessagesTopicsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setPinnedSavedMessagesTopics#81065db4: %w", err) + return fmt.Errorf("unable to decode setPinnedSavedMessagesTopics#475a1110: %w", err) } return s.DecodeBare(b) } @@ -139,23 +134,23 @@ func (s *SetPinnedSavedMessagesTopicsRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *SetPinnedSavedMessagesTopicsRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode setPinnedSavedMessagesTopics#81065db4 to nil") + return fmt.Errorf("can't decode setPinnedSavedMessagesTopics#475a1110 to nil") } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode setPinnedSavedMessagesTopics#81065db4: field saved_messages_topics: %w", err) + return fmt.Errorf("unable to decode setPinnedSavedMessagesTopics#475a1110: field saved_messages_topic_ids: %w", err) } if headerLen > 0 { - s.SavedMessagesTopics = make([]SavedMessagesTopicClass, 0, headerLen%bin.PreallocateLimit) + s.SavedMessagesTopicIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) } for idx := 0; idx < headerLen; idx++ { - value, err := DecodeSavedMessagesTopic(b) + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode setPinnedSavedMessagesTopics#81065db4: field saved_messages_topics: %w", err) + return fmt.Errorf("unable to decode setPinnedSavedMessagesTopics#475a1110: field saved_messages_topic_ids: %w", err) } - s.SavedMessagesTopics = append(s.SavedMessagesTopics, value) + s.SavedMessagesTopicIDs = append(s.SavedMessagesTopicIDs, value) } } return nil @@ -164,20 +159,15 @@ func (s *SetPinnedSavedMessagesTopicsRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *SetPinnedSavedMessagesTopicsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode setPinnedSavedMessagesTopics#81065db4 as nil") + return fmt.Errorf("can't encode setPinnedSavedMessagesTopics#475a1110 as nil") } b.ObjStart() b.PutID("setPinnedSavedMessagesTopics") b.Comma() - b.FieldStart("saved_messages_topics") + b.FieldStart("saved_messages_topic_ids") b.ArrStart() - for idx, v := range s.SavedMessagesTopics { - if v == nil { - return fmt.Errorf("unable to encode setPinnedSavedMessagesTopics#81065db4: field saved_messages_topics element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setPinnedSavedMessagesTopics#81065db4: field saved_messages_topics element with index %d: %w", idx, err) - } + for _, v := range s.SavedMessagesTopicIDs { + b.PutInt53(v) b.Comma() } b.StripComma() @@ -191,25 +181,25 @@ func (s *SetPinnedSavedMessagesTopicsRequest) EncodeTDLibJSON(b tdjson.Encoder) // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *SetPinnedSavedMessagesTopicsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode setPinnedSavedMessagesTopics#81065db4 to nil") + return fmt.Errorf("can't decode setPinnedSavedMessagesTopics#475a1110 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("setPinnedSavedMessagesTopics"); err != nil { - return fmt.Errorf("unable to decode setPinnedSavedMessagesTopics#81065db4: %w", err) + return fmt.Errorf("unable to decode setPinnedSavedMessagesTopics#475a1110: %w", err) } - case "saved_messages_topics": + case "saved_messages_topic_ids": if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONSavedMessagesTopic(b) + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode setPinnedSavedMessagesTopics#81065db4: field saved_messages_topics: %w", err) + return fmt.Errorf("unable to decode setPinnedSavedMessagesTopics#475a1110: field saved_messages_topic_ids: %w", err) } - s.SavedMessagesTopics = append(s.SavedMessagesTopics, value) + s.SavedMessagesTopicIDs = append(s.SavedMessagesTopicIDs, value) return nil }); err != nil { - return fmt.Errorf("unable to decode setPinnedSavedMessagesTopics#81065db4: field saved_messages_topics: %w", err) + return fmt.Errorf("unable to decode setPinnedSavedMessagesTopics#475a1110: field saved_messages_topic_ids: %w", err) } default: return b.Skip() @@ -218,20 +208,20 @@ func (s *SetPinnedSavedMessagesTopicsRequest) DecodeTDLibJSON(b tdjson.Decoder) }) } -// GetSavedMessagesTopics returns value of SavedMessagesTopics field. -func (s *SetPinnedSavedMessagesTopicsRequest) GetSavedMessagesTopics() (value []SavedMessagesTopicClass) { +// GetSavedMessagesTopicIDs returns value of SavedMessagesTopicIDs field. +func (s *SetPinnedSavedMessagesTopicsRequest) GetSavedMessagesTopicIDs() (value []int64) { if s == nil { return } - return s.SavedMessagesTopics + return s.SavedMessagesTopicIDs } -// SetPinnedSavedMessagesTopics invokes method setPinnedSavedMessagesTopics#81065db4 returning error if any. -func (c *Client) SetPinnedSavedMessagesTopics(ctx context.Context, savedmessagestopics []SavedMessagesTopicClass) error { +// SetPinnedSavedMessagesTopics invokes method setPinnedSavedMessagesTopics#475a1110 returning error if any. +func (c *Client) SetPinnedSavedMessagesTopics(ctx context.Context, savedmessagestopicids []int64) error { var ok Ok request := &SetPinnedSavedMessagesTopicsRequest{ - SavedMessagesTopics: savedmessagestopics, + SavedMessagesTopicIDs: savedmessagestopicids, } if err := c.rpc.Invoke(ctx, request, &ok); err != nil { return err diff --git a/tdapi/tl_set_story_privacy_settings_gen.go b/tdapi/tl_set_story_privacy_settings_gen.go index 3367a46039..4f86c7b446 100644 --- a/tdapi/tl_set_story_privacy_settings_gen.go +++ b/tdapi/tl_set_story_privacy_settings_gen.go @@ -31,10 +31,8 @@ var ( _ = tdjson.Encoder{} ) -// SetStoryPrivacySettingsRequest represents TL type `setStoryPrivacySettings#1b6c5434`. +// SetStoryPrivacySettingsRequest represents TL type `setStoryPrivacySettings#d8e94332`. type SetStoryPrivacySettingsRequest struct { - // Identifier of the chat that posted the story - StorySenderChatID int64 // Identifier of the story StoryID int32 // The new privacy settigs for the story @@ -42,7 +40,7 @@ type SetStoryPrivacySettingsRequest struct { } // SetStoryPrivacySettingsRequestTypeID is TL type id of SetStoryPrivacySettingsRequest. -const SetStoryPrivacySettingsRequestTypeID = 0x1b6c5434 +const SetStoryPrivacySettingsRequestTypeID = 0xd8e94332 // Ensuring interfaces in compile-time for SetStoryPrivacySettingsRequest. var ( @@ -56,9 +54,6 @@ func (s *SetStoryPrivacySettingsRequest) Zero() bool { if s == nil { return true } - if !(s.StorySenderChatID == 0) { - return false - } if !(s.StoryID == 0) { return false } @@ -101,10 +96,6 @@ func (s *SetStoryPrivacySettingsRequest) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ - { - Name: "StorySenderChatID", - SchemaName: "story_sender_chat_id", - }, { Name: "StoryID", SchemaName: "story_id", @@ -120,7 +111,7 @@ func (s *SetStoryPrivacySettingsRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *SetStoryPrivacySettingsRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode setStoryPrivacySettings#1b6c5434 as nil") + return fmt.Errorf("can't encode setStoryPrivacySettings#d8e94332 as nil") } b.PutID(SetStoryPrivacySettingsRequestTypeID) return s.EncodeBare(b) @@ -129,15 +120,14 @@ func (s *SetStoryPrivacySettingsRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *SetStoryPrivacySettingsRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode setStoryPrivacySettings#1b6c5434 as nil") + return fmt.Errorf("can't encode setStoryPrivacySettings#d8e94332 as nil") } - b.PutInt53(s.StorySenderChatID) b.PutInt32(s.StoryID) if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode setStoryPrivacySettings#1b6c5434: field privacy_settings is nil") + return fmt.Errorf("unable to encode setStoryPrivacySettings#d8e94332: field privacy_settings is nil") } if err := s.PrivacySettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode setStoryPrivacySettings#1b6c5434: field privacy_settings: %w", err) + return fmt.Errorf("unable to encode setStoryPrivacySettings#d8e94332: field privacy_settings: %w", err) } return nil } @@ -145,10 +135,10 @@ func (s *SetStoryPrivacySettingsRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *SetStoryPrivacySettingsRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode setStoryPrivacySettings#1b6c5434 to nil") + return fmt.Errorf("can't decode setStoryPrivacySettings#d8e94332 to nil") } if err := b.ConsumeID(SetStoryPrivacySettingsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setStoryPrivacySettings#1b6c5434: %w", err) + return fmt.Errorf("unable to decode setStoryPrivacySettings#d8e94332: %w", err) } return s.DecodeBare(b) } @@ -156,26 +146,19 @@ func (s *SetStoryPrivacySettingsRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *SetStoryPrivacySettingsRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode setStoryPrivacySettings#1b6c5434 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setStoryPrivacySettings#1b6c5434: field story_sender_chat_id: %w", err) - } - s.StorySenderChatID = value + return fmt.Errorf("can't decode setStoryPrivacySettings#d8e94332 to nil") } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode setStoryPrivacySettings#1b6c5434: field story_id: %w", err) + return fmt.Errorf("unable to decode setStoryPrivacySettings#d8e94332: field story_id: %w", err) } s.StoryID = value } { value, err := DecodeStoryPrivacySettings(b) if err != nil { - return fmt.Errorf("unable to decode setStoryPrivacySettings#1b6c5434: field privacy_settings: %w", err) + return fmt.Errorf("unable to decode setStoryPrivacySettings#d8e94332: field privacy_settings: %w", err) } s.PrivacySettings = value } @@ -185,23 +168,20 @@ func (s *SetStoryPrivacySettingsRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *SetStoryPrivacySettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode setStoryPrivacySettings#1b6c5434 as nil") + return fmt.Errorf("can't encode setStoryPrivacySettings#d8e94332 as nil") } b.ObjStart() b.PutID("setStoryPrivacySettings") b.Comma() - b.FieldStart("story_sender_chat_id") - b.PutInt53(s.StorySenderChatID) - b.Comma() b.FieldStart("story_id") b.PutInt32(s.StoryID) b.Comma() b.FieldStart("privacy_settings") if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode setStoryPrivacySettings#1b6c5434: field privacy_settings is nil") + return fmt.Errorf("unable to encode setStoryPrivacySettings#d8e94332: field privacy_settings is nil") } if err := s.PrivacySettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setStoryPrivacySettings#1b6c5434: field privacy_settings: %w", err) + return fmt.Errorf("unable to encode setStoryPrivacySettings#d8e94332: field privacy_settings: %w", err) } b.Comma() b.StripComma() @@ -212,31 +192,25 @@ func (s *SetStoryPrivacySettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *SetStoryPrivacySettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode setStoryPrivacySettings#1b6c5434 to nil") + return fmt.Errorf("can't decode setStoryPrivacySettings#d8e94332 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("setStoryPrivacySettings"); err != nil { - return fmt.Errorf("unable to decode setStoryPrivacySettings#1b6c5434: %w", err) - } - case "story_sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setStoryPrivacySettings#1b6c5434: field story_sender_chat_id: %w", err) + return fmt.Errorf("unable to decode setStoryPrivacySettings#d8e94332: %w", err) } - s.StorySenderChatID = value case "story_id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode setStoryPrivacySettings#1b6c5434: field story_id: %w", err) + return fmt.Errorf("unable to decode setStoryPrivacySettings#d8e94332: field story_id: %w", err) } s.StoryID = value case "privacy_settings": value, err := DecodeTDLibJSONStoryPrivacySettings(b) if err != nil { - return fmt.Errorf("unable to decode setStoryPrivacySettings#1b6c5434: field privacy_settings: %w", err) + return fmt.Errorf("unable to decode setStoryPrivacySettings#d8e94332: field privacy_settings: %w", err) } s.PrivacySettings = value default: @@ -246,14 +220,6 @@ func (s *SetStoryPrivacySettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error }) } -// GetStorySenderChatID returns value of StorySenderChatID field. -func (s *SetStoryPrivacySettingsRequest) GetStorySenderChatID() (value int64) { - if s == nil { - return - } - return s.StorySenderChatID -} - // GetStoryID returns value of StoryID field. func (s *SetStoryPrivacySettingsRequest) GetStoryID() (value int32) { if s == nil { @@ -270,7 +236,7 @@ func (s *SetStoryPrivacySettingsRequest) GetPrivacySettings() (value StoryPrivac return s.PrivacySettings } -// SetStoryPrivacySettings invokes method setStoryPrivacySettings#1b6c5434 returning error if any. +// SetStoryPrivacySettings invokes method setStoryPrivacySettings#d8e94332 returning error if any. func (c *Client) SetStoryPrivacySettings(ctx context.Context, request *SetStoryPrivacySettingsRequest) error { var ok Ok diff --git a/tdapi/tl_set_supergroup_custom_emoji_sticker_set_gen.go b/tdapi/tl_set_supergroup_custom_emoji_sticker_set_gen.go new file mode 100644 index 0000000000..2648c909c2 --- /dev/null +++ b/tdapi/tl_set_supergroup_custom_emoji_sticker_set_gen.go @@ -0,0 +1,238 @@ +// 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{} +) + +// SetSupergroupCustomEmojiStickerSetRequest represents TL type `setSupergroupCustomEmojiStickerSet#4f3552af`. +type SetSupergroupCustomEmojiStickerSetRequest struct { + // Identifier of the supergroup + SupergroupID int64 + // New value of the custom emoji sticker set identifier for the supergroup. Use 0 to + // remove the custom emoji sticker set in the supergroup + CustomEmojiStickerSetID int64 +} + +// SetSupergroupCustomEmojiStickerSetRequestTypeID is TL type id of SetSupergroupCustomEmojiStickerSetRequest. +const SetSupergroupCustomEmojiStickerSetRequestTypeID = 0x4f3552af + +// Ensuring interfaces in compile-time for SetSupergroupCustomEmojiStickerSetRequest. +var ( + _ bin.Encoder = &SetSupergroupCustomEmojiStickerSetRequest{} + _ bin.Decoder = &SetSupergroupCustomEmojiStickerSetRequest{} + _ bin.BareEncoder = &SetSupergroupCustomEmojiStickerSetRequest{} + _ bin.BareDecoder = &SetSupergroupCustomEmojiStickerSetRequest{} +) + +func (s *SetSupergroupCustomEmojiStickerSetRequest) Zero() bool { + if s == nil { + return true + } + if !(s.SupergroupID == 0) { + return false + } + if !(s.CustomEmojiStickerSetID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SetSupergroupCustomEmojiStickerSetRequest) String() string { + if s == nil { + return "SetSupergroupCustomEmojiStickerSetRequest(nil)" + } + type Alias SetSupergroupCustomEmojiStickerSetRequest + return fmt.Sprintf("SetSupergroupCustomEmojiStickerSetRequest%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SetSupergroupCustomEmojiStickerSetRequest) TypeID() uint32 { + return SetSupergroupCustomEmojiStickerSetRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SetSupergroupCustomEmojiStickerSetRequest) TypeName() string { + return "setSupergroupCustomEmojiStickerSet" +} + +// TypeInfo returns info about TL type. +func (s *SetSupergroupCustomEmojiStickerSetRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "setSupergroupCustomEmojiStickerSet", + ID: SetSupergroupCustomEmojiStickerSetRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "SupergroupID", + SchemaName: "supergroup_id", + }, + { + Name: "CustomEmojiStickerSetID", + SchemaName: "custom_emoji_sticker_set_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SetSupergroupCustomEmojiStickerSetRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setSupergroupCustomEmojiStickerSet#4f3552af as nil") + } + b.PutID(SetSupergroupCustomEmojiStickerSetRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SetSupergroupCustomEmojiStickerSetRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setSupergroupCustomEmojiStickerSet#4f3552af as nil") + } + b.PutInt53(s.SupergroupID) + b.PutLong(s.CustomEmojiStickerSetID) + return nil +} + +// Decode implements bin.Decoder. +func (s *SetSupergroupCustomEmojiStickerSetRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setSupergroupCustomEmojiStickerSet#4f3552af to nil") + } + if err := b.ConsumeID(SetSupergroupCustomEmojiStickerSetRequestTypeID); err != nil { + return fmt.Errorf("unable to decode setSupergroupCustomEmojiStickerSet#4f3552af: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SetSupergroupCustomEmojiStickerSetRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setSupergroupCustomEmojiStickerSet#4f3552af to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setSupergroupCustomEmojiStickerSet#4f3552af: field supergroup_id: %w", err) + } + s.SupergroupID = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode setSupergroupCustomEmojiStickerSet#4f3552af: field custom_emoji_sticker_set_id: %w", err) + } + s.CustomEmojiStickerSetID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SetSupergroupCustomEmojiStickerSetRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode setSupergroupCustomEmojiStickerSet#4f3552af as nil") + } + b.ObjStart() + b.PutID("setSupergroupCustomEmojiStickerSet") + b.Comma() + b.FieldStart("supergroup_id") + b.PutInt53(s.SupergroupID) + b.Comma() + b.FieldStart("custom_emoji_sticker_set_id") + b.PutLong(s.CustomEmojiStickerSetID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SetSupergroupCustomEmojiStickerSetRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode setSupergroupCustomEmojiStickerSet#4f3552af to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("setSupergroupCustomEmojiStickerSet"); err != nil { + return fmt.Errorf("unable to decode setSupergroupCustomEmojiStickerSet#4f3552af: %w", err) + } + case "supergroup_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setSupergroupCustomEmojiStickerSet#4f3552af: field supergroup_id: %w", err) + } + s.SupergroupID = value + case "custom_emoji_sticker_set_id": + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode setSupergroupCustomEmojiStickerSet#4f3552af: field custom_emoji_sticker_set_id: %w", err) + } + s.CustomEmojiStickerSetID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetSupergroupID returns value of SupergroupID field. +func (s *SetSupergroupCustomEmojiStickerSetRequest) GetSupergroupID() (value int64) { + if s == nil { + return + } + return s.SupergroupID +} + +// GetCustomEmojiStickerSetID returns value of CustomEmojiStickerSetID field. +func (s *SetSupergroupCustomEmojiStickerSetRequest) GetCustomEmojiStickerSetID() (value int64) { + if s == nil { + return + } + return s.CustomEmojiStickerSetID +} + +// SetSupergroupCustomEmojiStickerSet invokes method setSupergroupCustomEmojiStickerSet#4f3552af returning error if any. +func (c *Client) SetSupergroupCustomEmojiStickerSet(ctx context.Context, request *SetSupergroupCustomEmojiStickerSetRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_set_supergroup_unrestrict_boost_count_gen.go b/tdapi/tl_set_supergroup_unrestrict_boost_count_gen.go new file mode 100644 index 0000000000..55e9c95437 --- /dev/null +++ b/tdapi/tl_set_supergroup_unrestrict_boost_count_gen.go @@ -0,0 +1,238 @@ +// 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{} +) + +// SetSupergroupUnrestrictBoostCountRequest represents TL type `setSupergroupUnrestrictBoostCount#39ce30a3`. +type SetSupergroupUnrestrictBoostCountRequest struct { + // Identifier of the supergroup + SupergroupID int64 + // New value of the unrestrict_boost_count supergroup setting; 0-8. Use 0 to remove the + // setting + UnrestrictBoostCount int32 +} + +// SetSupergroupUnrestrictBoostCountRequestTypeID is TL type id of SetSupergroupUnrestrictBoostCountRequest. +const SetSupergroupUnrestrictBoostCountRequestTypeID = 0x39ce30a3 + +// Ensuring interfaces in compile-time for SetSupergroupUnrestrictBoostCountRequest. +var ( + _ bin.Encoder = &SetSupergroupUnrestrictBoostCountRequest{} + _ bin.Decoder = &SetSupergroupUnrestrictBoostCountRequest{} + _ bin.BareEncoder = &SetSupergroupUnrestrictBoostCountRequest{} + _ bin.BareDecoder = &SetSupergroupUnrestrictBoostCountRequest{} +) + +func (s *SetSupergroupUnrestrictBoostCountRequest) Zero() bool { + if s == nil { + return true + } + if !(s.SupergroupID == 0) { + return false + } + if !(s.UnrestrictBoostCount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SetSupergroupUnrestrictBoostCountRequest) String() string { + if s == nil { + return "SetSupergroupUnrestrictBoostCountRequest(nil)" + } + type Alias SetSupergroupUnrestrictBoostCountRequest + return fmt.Sprintf("SetSupergroupUnrestrictBoostCountRequest%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SetSupergroupUnrestrictBoostCountRequest) TypeID() uint32 { + return SetSupergroupUnrestrictBoostCountRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SetSupergroupUnrestrictBoostCountRequest) TypeName() string { + return "setSupergroupUnrestrictBoostCount" +} + +// TypeInfo returns info about TL type. +func (s *SetSupergroupUnrestrictBoostCountRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "setSupergroupUnrestrictBoostCount", + ID: SetSupergroupUnrestrictBoostCountRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "SupergroupID", + SchemaName: "supergroup_id", + }, + { + Name: "UnrestrictBoostCount", + SchemaName: "unrestrict_boost_count", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SetSupergroupUnrestrictBoostCountRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setSupergroupUnrestrictBoostCount#39ce30a3 as nil") + } + b.PutID(SetSupergroupUnrestrictBoostCountRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SetSupergroupUnrestrictBoostCountRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setSupergroupUnrestrictBoostCount#39ce30a3 as nil") + } + b.PutInt53(s.SupergroupID) + b.PutInt32(s.UnrestrictBoostCount) + return nil +} + +// Decode implements bin.Decoder. +func (s *SetSupergroupUnrestrictBoostCountRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setSupergroupUnrestrictBoostCount#39ce30a3 to nil") + } + if err := b.ConsumeID(SetSupergroupUnrestrictBoostCountRequestTypeID); err != nil { + return fmt.Errorf("unable to decode setSupergroupUnrestrictBoostCount#39ce30a3: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SetSupergroupUnrestrictBoostCountRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setSupergroupUnrestrictBoostCount#39ce30a3 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setSupergroupUnrestrictBoostCount#39ce30a3: field supergroup_id: %w", err) + } + s.SupergroupID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode setSupergroupUnrestrictBoostCount#39ce30a3: field unrestrict_boost_count: %w", err) + } + s.UnrestrictBoostCount = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SetSupergroupUnrestrictBoostCountRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode setSupergroupUnrestrictBoostCount#39ce30a3 as nil") + } + b.ObjStart() + b.PutID("setSupergroupUnrestrictBoostCount") + b.Comma() + b.FieldStart("supergroup_id") + b.PutInt53(s.SupergroupID) + b.Comma() + b.FieldStart("unrestrict_boost_count") + b.PutInt32(s.UnrestrictBoostCount) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SetSupergroupUnrestrictBoostCountRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode setSupergroupUnrestrictBoostCount#39ce30a3 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("setSupergroupUnrestrictBoostCount"); err != nil { + return fmt.Errorf("unable to decode setSupergroupUnrestrictBoostCount#39ce30a3: %w", err) + } + case "supergroup_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setSupergroupUnrestrictBoostCount#39ce30a3: field supergroup_id: %w", err) + } + s.SupergroupID = value + case "unrestrict_boost_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode setSupergroupUnrestrictBoostCount#39ce30a3: field unrestrict_boost_count: %w", err) + } + s.UnrestrictBoostCount = value + default: + return b.Skip() + } + return nil + }) +} + +// GetSupergroupID returns value of SupergroupID field. +func (s *SetSupergroupUnrestrictBoostCountRequest) GetSupergroupID() (value int64) { + if s == nil { + return + } + return s.SupergroupID +} + +// GetUnrestrictBoostCount returns value of UnrestrictBoostCount field. +func (s *SetSupergroupUnrestrictBoostCountRequest) GetUnrestrictBoostCount() (value int32) { + if s == nil { + return + } + return s.UnrestrictBoostCount +} + +// SetSupergroupUnrestrictBoostCount invokes method setSupergroupUnrestrictBoostCount#39ce30a3 returning error if any. +func (c *Client) SetSupergroupUnrestrictBoostCount(ctx context.Context, request *SetSupergroupUnrestrictBoostCountRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_store_payment_purpose_gen.go b/tdapi/tl_store_payment_purpose_gen.go index ed92a5c08a..c80e7e84ce 100644 --- a/tdapi/tl_store_payment_purpose_gen.go +++ b/tdapi/tl_store_payment_purpose_gen.go @@ -468,8 +468,9 @@ func (s *StorePaymentPurposeGiftedPremium) GetAmount() (value int64) { // StorePaymentPurposePremiumGiftCodes represents TL type `storePaymentPurposePremiumGiftCodes#9e11cf42`. type StorePaymentPurposePremiumGiftCodes struct { - // Identifier of the channel chat, which will be automatically boosted by the users for - // duration of the Premium subscription and which is administered by the user; 0 if none + // Identifier of the supergroup or channel chat, which will be automatically boosted by + // the users for duration of the Premium subscription and which is administered by the + // user; 0 if none BoostedChatID int64 // ISO 4217 currency code of the payment currency Currency string diff --git a/tdapi/tl_story_gen.go b/tdapi/tl_story_gen.go index 54be8467cf..0f95f9eb59 100644 --- a/tdapi/tl_story_gen.go +++ b/tdapi/tl_story_gen.go @@ -31,12 +31,15 @@ var ( _ = tdjson.Encoder{} ) -// Story represents TL type `story#8e358ca2`. +// Story represents TL type `story#27f4e5b1`. type Story struct { // Unique story identifier among stories of the given sender ID int32 // Identifier of the chat that posted the story SenderChatID int64 + // Identifier of the sender of the story; may be null if the story is posted on behalf of + // the sender_chat_id + SenderID MessageSenderClass // Point in time (Unix timestamp) when the story was published Date int32 // True, if the story is being sent by the current user @@ -86,7 +89,7 @@ type Story struct { } // StoryTypeID is TL type id of Story. -const StoryTypeID = 0x8e358ca2 +const StoryTypeID = 0x27f4e5b1 // Ensuring interfaces in compile-time for Story. var ( @@ -106,6 +109,9 @@ func (s *Story) Zero() bool { if !(s.SenderChatID == 0) { return false } + if !(s.SenderID == nil) { + return false + } if !(s.Date == 0) { return false } @@ -213,6 +219,10 @@ func (s *Story) TypeInfo() tdp.Type { Name: "SenderChatID", SchemaName: "sender_chat_id", }, + { + Name: "SenderID", + SchemaName: "sender_id", + }, { Name: "Date", SchemaName: "date", @@ -304,7 +314,7 @@ func (s *Story) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *Story) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode story#8e358ca2 as nil") + return fmt.Errorf("can't encode story#27f4e5b1 as nil") } b.PutID(StoryTypeID) return s.EncodeBare(b) @@ -313,10 +323,16 @@ func (s *Story) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *Story) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode story#8e358ca2 as nil") + return fmt.Errorf("can't encode story#27f4e5b1 as nil") } b.PutInt32(s.ID) b.PutInt53(s.SenderChatID) + if s.SenderID == nil { + return fmt.Errorf("unable to encode story#27f4e5b1: field sender_id is nil") + } + if err := s.SenderID.Encode(b); err != nil { + return fmt.Errorf("unable to encode story#27f4e5b1: field sender_id: %w", err) + } b.PutInt32(s.Date) b.PutBool(s.IsBeingSent) b.PutBool(s.IsBeingEdited) @@ -332,37 +348,37 @@ func (s *Story) EncodeBare(b *bin.Buffer) error { b.PutBool(s.CanGetInteractions) b.PutBool(s.HasExpiredViewers) if err := s.RepostInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#8e358ca2: field repost_info: %w", err) + return fmt.Errorf("unable to encode story#27f4e5b1: field repost_info: %w", err) } if err := s.InteractionInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#8e358ca2: field interaction_info: %w", err) + return fmt.Errorf("unable to encode story#27f4e5b1: field interaction_info: %w", err) } if s.ChosenReactionType == nil { - return fmt.Errorf("unable to encode story#8e358ca2: field chosen_reaction_type is nil") + return fmt.Errorf("unable to encode story#27f4e5b1: field chosen_reaction_type is nil") } if err := s.ChosenReactionType.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#8e358ca2: field chosen_reaction_type: %w", err) + return fmt.Errorf("unable to encode story#27f4e5b1: field chosen_reaction_type: %w", err) } if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode story#8e358ca2: field privacy_settings is nil") + return fmt.Errorf("unable to encode story#27f4e5b1: field privacy_settings is nil") } if err := s.PrivacySettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#8e358ca2: field privacy_settings: %w", err) + return fmt.Errorf("unable to encode story#27f4e5b1: field privacy_settings: %w", err) } if s.Content == nil { - return fmt.Errorf("unable to encode story#8e358ca2: field content is nil") + return fmt.Errorf("unable to encode story#27f4e5b1: field content is nil") } if err := s.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#8e358ca2: field content: %w", err) + return fmt.Errorf("unable to encode story#27f4e5b1: field content: %w", err) } b.PutInt(len(s.Areas)) for idx, v := range s.Areas { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare story#8e358ca2: field areas element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare story#27f4e5b1: field areas element with index %d: %w", idx, err) } } if err := s.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#8e358ca2: field caption: %w", err) + return fmt.Errorf("unable to encode story#27f4e5b1: field caption: %w", err) } return nil } @@ -370,10 +386,10 @@ func (s *Story) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *Story) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode story#8e358ca2 to nil") + return fmt.Errorf("can't decode story#27f4e5b1 to nil") } if err := b.ConsumeID(StoryTypeID); err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: %w", err) } return s.DecodeBare(b) } @@ -381,155 +397,162 @@ func (s *Story) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *Story) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode story#8e358ca2 to nil") + return fmt.Errorf("can't decode story#27f4e5b1 to nil") } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field id: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field id: %w", err) } s.ID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field sender_chat_id: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field sender_chat_id: %w", err) } s.SenderChatID = value } + { + value, err := DecodeMessageSender(b) + if err != nil { + return fmt.Errorf("unable to decode story#27f4e5b1: field sender_id: %w", err) + } + s.SenderID = value + } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field date: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field date: %w", err) } s.Date = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field is_being_sent: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field is_being_sent: %w", err) } s.IsBeingSent = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field is_being_edited: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field is_being_edited: %w", err) } s.IsBeingEdited = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field is_edited: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field is_edited: %w", err) } s.IsEdited = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field is_pinned: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field is_pinned: %w", err) } s.IsPinned = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field is_visible_only_for_self: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field is_visible_only_for_self: %w", err) } s.IsVisibleOnlyForSelf = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field can_be_deleted: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field can_be_deleted: %w", err) } s.CanBeDeleted = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field can_be_edited: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field can_be_edited: %w", err) } s.CanBeEdited = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field can_be_forwarded: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field can_be_forwarded: %w", err) } s.CanBeForwarded = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field can_be_replied: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field can_be_replied: %w", err) } s.CanBeReplied = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field can_toggle_is_pinned: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field can_toggle_is_pinned: %w", err) } s.CanToggleIsPinned = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field can_get_statistics: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field can_get_statistics: %w", err) } s.CanGetStatistics = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field can_get_interactions: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field can_get_interactions: %w", err) } s.CanGetInteractions = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field has_expired_viewers: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field has_expired_viewers: %w", err) } s.HasExpiredViewers = value } { if err := s.RepostInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field repost_info: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field repost_info: %w", err) } } { if err := s.InteractionInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field interaction_info: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field interaction_info: %w", err) } } { value, err := DecodeReactionType(b) if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field chosen_reaction_type: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field chosen_reaction_type: %w", err) } s.ChosenReactionType = value } { value, err := DecodeStoryPrivacySettings(b) if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field privacy_settings: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field privacy_settings: %w", err) } s.PrivacySettings = value } { value, err := DecodeStoryContent(b) if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field content: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field content: %w", err) } s.Content = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field areas: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field areas: %w", err) } if headerLen > 0 { @@ -538,14 +561,14 @@ func (s *Story) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value StoryArea if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare story#8e358ca2: field areas: %w", err) + return fmt.Errorf("unable to decode bare story#27f4e5b1: field areas: %w", err) } s.Areas = append(s.Areas, value) } } { if err := s.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field caption: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field caption: %w", err) } } return nil @@ -554,7 +577,7 @@ func (s *Story) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *Story) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode story#8e358ca2 as nil") + return fmt.Errorf("can't encode story#27f4e5b1 as nil") } b.ObjStart() b.PutID("story") @@ -565,6 +588,14 @@ func (s *Story) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("sender_chat_id") b.PutInt53(s.SenderChatID) b.Comma() + b.FieldStart("sender_id") + if s.SenderID == nil { + return fmt.Errorf("unable to encode story#27f4e5b1: field sender_id is nil") + } + if err := s.SenderID.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode story#27f4e5b1: field sender_id: %w", err) + } + b.Comma() b.FieldStart("date") b.PutInt32(s.Date) b.Comma() @@ -609,43 +640,43 @@ func (s *Story) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("repost_info") if err := s.RepostInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#8e358ca2: field repost_info: %w", err) + return fmt.Errorf("unable to encode story#27f4e5b1: field repost_info: %w", err) } b.Comma() b.FieldStart("interaction_info") if err := s.InteractionInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#8e358ca2: field interaction_info: %w", err) + return fmt.Errorf("unable to encode story#27f4e5b1: field interaction_info: %w", err) } b.Comma() b.FieldStart("chosen_reaction_type") if s.ChosenReactionType == nil { - return fmt.Errorf("unable to encode story#8e358ca2: field chosen_reaction_type is nil") + return fmt.Errorf("unable to encode story#27f4e5b1: field chosen_reaction_type is nil") } if err := s.ChosenReactionType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#8e358ca2: field chosen_reaction_type: %w", err) + return fmt.Errorf("unable to encode story#27f4e5b1: field chosen_reaction_type: %w", err) } b.Comma() b.FieldStart("privacy_settings") if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode story#8e358ca2: field privacy_settings is nil") + return fmt.Errorf("unable to encode story#27f4e5b1: field privacy_settings is nil") } if err := s.PrivacySettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#8e358ca2: field privacy_settings: %w", err) + return fmt.Errorf("unable to encode story#27f4e5b1: field privacy_settings: %w", err) } b.Comma() b.FieldStart("content") if s.Content == nil { - return fmt.Errorf("unable to encode story#8e358ca2: field content is nil") + return fmt.Errorf("unable to encode story#27f4e5b1: field content is nil") } if err := s.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#8e358ca2: field content: %w", err) + return fmt.Errorf("unable to encode story#27f4e5b1: field content: %w", err) } b.Comma() b.FieldStart("areas") b.ArrStart() for idx, v := range s.Areas { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#8e358ca2: field areas element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode story#27f4e5b1: field areas element with index %d: %w", idx, err) } b.Comma() } @@ -654,7 +685,7 @@ func (s *Story) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("caption") if err := s.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#8e358ca2: field caption: %w", err) + return fmt.Errorf("unable to encode story#27f4e5b1: field caption: %w", err) } b.Comma() b.StripComma() @@ -665,151 +696,157 @@ func (s *Story) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *Story) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode story#8e358ca2 to nil") + return fmt.Errorf("can't decode story#27f4e5b1 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("story"); err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: %w", err) } case "id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field id: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field id: %w", err) } s.ID = value case "sender_chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field sender_chat_id: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field sender_chat_id: %w", err) } s.SenderChatID = value + case "sender_id": + value, err := DecodeTDLibJSONMessageSender(b) + if err != nil { + return fmt.Errorf("unable to decode story#27f4e5b1: field sender_id: %w", err) + } + s.SenderID = value case "date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field date: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field date: %w", err) } s.Date = value case "is_being_sent": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field is_being_sent: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field is_being_sent: %w", err) } s.IsBeingSent = value case "is_being_edited": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field is_being_edited: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field is_being_edited: %w", err) } s.IsBeingEdited = value case "is_edited": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field is_edited: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field is_edited: %w", err) } s.IsEdited = value case "is_pinned": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field is_pinned: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field is_pinned: %w", err) } s.IsPinned = value case "is_visible_only_for_self": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field is_visible_only_for_self: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field is_visible_only_for_self: %w", err) } s.IsVisibleOnlyForSelf = value case "can_be_deleted": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field can_be_deleted: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field can_be_deleted: %w", err) } s.CanBeDeleted = value case "can_be_edited": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field can_be_edited: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field can_be_edited: %w", err) } s.CanBeEdited = value case "can_be_forwarded": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field can_be_forwarded: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field can_be_forwarded: %w", err) } s.CanBeForwarded = value case "can_be_replied": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field can_be_replied: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field can_be_replied: %w", err) } s.CanBeReplied = value case "can_toggle_is_pinned": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field can_toggle_is_pinned: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field can_toggle_is_pinned: %w", err) } s.CanToggleIsPinned = value case "can_get_statistics": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field can_get_statistics: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field can_get_statistics: %w", err) } s.CanGetStatistics = value case "can_get_interactions": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field can_get_interactions: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field can_get_interactions: %w", err) } s.CanGetInteractions = value case "has_expired_viewers": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field has_expired_viewers: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field has_expired_viewers: %w", err) } s.HasExpiredViewers = value case "repost_info": if err := s.RepostInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field repost_info: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field repost_info: %w", err) } case "interaction_info": if err := s.InteractionInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field interaction_info: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field interaction_info: %w", err) } case "chosen_reaction_type": value, err := DecodeTDLibJSONReactionType(b) if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field chosen_reaction_type: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field chosen_reaction_type: %w", err) } s.ChosenReactionType = value case "privacy_settings": value, err := DecodeTDLibJSONStoryPrivacySettings(b) if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field privacy_settings: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field privacy_settings: %w", err) } s.PrivacySettings = value case "content": value, err := DecodeTDLibJSONStoryContent(b) if err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field content: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field content: %w", err) } s.Content = value case "areas": if err := b.Arr(func(b tdjson.Decoder) error { var value StoryArea if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field areas: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field areas: %w", err) } s.Areas = append(s.Areas, value) return nil }); err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field areas: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field areas: %w", err) } case "caption": if err := s.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode story#8e358ca2: field caption: %w", err) + return fmt.Errorf("unable to decode story#27f4e5b1: field caption: %w", err) } default: return b.Skip() @@ -834,6 +871,14 @@ func (s *Story) GetSenderChatID() (value int64) { return s.SenderChatID } +// GetSenderID returns value of SenderID field. +func (s *Story) GetSenderID() (value MessageSenderClass) { + if s == nil { + return + } + return s.SenderID +} + // GetDate returns value of Date field. func (s *Story) GetDate() (value int32) { if s == nil { diff --git a/tdapi/tl_supergroup_full_info_gen.go b/tdapi/tl_supergroup_full_info_gen.go index 72c742454d..feb84720a5 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#f2f19203`. +// SupergroupFullInfo represents TL type `supergroupFullInfo#3459badb`. 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 @@ -79,10 +79,19 @@ type SupergroupFullInfo struct { // True, if aggressive anti-spam checks are enabled in the supergroup. The value of this // field is only available to chat administrators HasAggressiveAntiSpamEnabled bool - // True, if the channel has pinned stories + // True, if the supergroup or channel has pinned stories HasPinnedStories bool - // Identifier of the supergroup sticker set; 0 if none + // Number of times the current user boosted the supergroup or channel + MyBoostCount int32 + // Number of times the supergroup must be boosted by a user to ignore slow mode and chat + // permission restrictions; 0 if unspecified + UnrestrictBoostCount int32 + // Identifier of the supergroup sticker set that must be shown before user sticker sets; + // 0 if none StickerSetID int64 + // Identifier of the custom emoji sticker set that can be used in the supergroup without + // Telegram Premium subscription; 0 if none + CustomEmojiStickerSetID int64 // Location to which the supergroup is connected; may be null if none Location ChatLocation // Primary invite link for the chat; may be null. For chat administrators with @@ -98,7 +107,7 @@ type SupergroupFullInfo struct { } // SupergroupFullInfoTypeID is TL type id of SupergroupFullInfo. -const SupergroupFullInfoTypeID = 0xf2f19203 +const SupergroupFullInfoTypeID = 0x3459badb // Ensuring interfaces in compile-time for SupergroupFullInfo. var ( @@ -169,9 +178,18 @@ func (s *SupergroupFullInfo) Zero() bool { if !(s.HasPinnedStories == false) { return false } + if !(s.MyBoostCount == 0) { + return false + } + if !(s.UnrestrictBoostCount == 0) { + return false + } if !(s.StickerSetID == 0) { return false } + if !(s.CustomEmojiStickerSetID == 0) { + return false + } if !(s.Location.Zero()) { return false } @@ -299,10 +317,22 @@ func (s *SupergroupFullInfo) TypeInfo() tdp.Type { Name: "HasPinnedStories", SchemaName: "has_pinned_stories", }, + { + Name: "MyBoostCount", + SchemaName: "my_boost_count", + }, + { + Name: "UnrestrictBoostCount", + SchemaName: "unrestrict_boost_count", + }, { Name: "StickerSetID", SchemaName: "sticker_set_id", }, + { + Name: "CustomEmojiStickerSetID", + SchemaName: "custom_emoji_sticker_set_id", + }, { Name: "Location", SchemaName: "location", @@ -330,7 +360,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#f2f19203 as nil") + return fmt.Errorf("can't encode supergroupFullInfo#3459badb as nil") } b.PutID(SupergroupFullInfoTypeID) return s.EncodeBare(b) @@ -339,10 +369,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#f2f19203 as nil") + return fmt.Errorf("can't encode supergroupFullInfo#3459badb as nil") } if err := s.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#f2f19203: field photo: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#3459badb: field photo: %w", err) } b.PutString(s.Description) b.PutInt32(s.MemberCount) @@ -362,17 +392,20 @@ func (s *SupergroupFullInfo) EncodeBare(b *bin.Buffer) error { b.PutBool(s.IsAllHistoryAvailable) b.PutBool(s.HasAggressiveAntiSpamEnabled) b.PutBool(s.HasPinnedStories) + b.PutInt32(s.MyBoostCount) + b.PutInt32(s.UnrestrictBoostCount) b.PutLong(s.StickerSetID) + b.PutLong(s.CustomEmojiStickerSetID) if err := s.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#f2f19203: field location: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#3459badb: field location: %w", err) } if err := s.InviteLink.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#f2f19203: field invite_link: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#3459badb: 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#f2f19203: field bot_commands element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare supergroupFullInfo#3459badb: field bot_commands element with index %d: %w", idx, err) } } b.PutInt53(s.UpgradedFromBasicGroupID) @@ -383,10 +416,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#f2f19203 to nil") + return fmt.Errorf("can't decode supergroupFullInfo#3459badb to nil") } if err := b.ConsumeID(SupergroupFullInfoTypeID); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: %w", err) } return s.DecodeBare(b) } @@ -394,160 +427,181 @@ 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#f2f19203 to nil") + return fmt.Errorf("can't decode supergroupFullInfo#3459badb to nil") } { if err := s.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field photo: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field photo: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field description: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field description: %w", err) } s.Description = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field member_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field member_count: %w", err) } s.MemberCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field administrator_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field administrator_count: %w", err) } s.AdministratorCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field restricted_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field restricted_count: %w", err) } s.RestrictedCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field banned_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field banned_count: %w", err) } s.BannedCount = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field linked_chat_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field linked_chat_id: %w", err) } s.LinkedChatID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field slow_mode_delay: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field slow_mode_delay: %w", err) } s.SlowModeDelay = value } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field slow_mode_delay_expires_in: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: 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#f2f19203: field can_get_members: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field can_get_members: %w", err) } s.CanGetMembers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field has_hidden_members: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field has_hidden_members: %w", err) } s.HasHiddenMembers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field can_hide_members: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field can_hide_members: %w", err) } s.CanHideMembers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field can_set_sticker_set: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field can_set_sticker_set: %w", err) } s.CanSetStickerSet = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field can_set_location: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field can_set_location: %w", err) } s.CanSetLocation = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field can_get_statistics: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field can_get_statistics: %w", err) } s.CanGetStatistics = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field can_toggle_aggressive_anti_spam: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field can_toggle_aggressive_anti_spam: %w", err) } s.CanToggleAggressiveAntiSpam = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field is_all_history_available: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field is_all_history_available: %w", err) } s.IsAllHistoryAvailable = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field has_aggressive_anti_spam_enabled: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field has_aggressive_anti_spam_enabled: %w", err) } s.HasAggressiveAntiSpamEnabled = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field has_pinned_stories: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field has_pinned_stories: %w", err) } s.HasPinnedStories = value } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field my_boost_count: %w", err) + } + s.MyBoostCount = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field unrestrict_boost_count: %w", err) + } + s.UnrestrictBoostCount = value + } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field sticker_set_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field sticker_set_id: %w", err) } s.StickerSetID = value } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field custom_emoji_sticker_set_id: %w", err) + } + s.CustomEmojiStickerSetID = value + } { if err := s.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field location: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field location: %w", err) } } { if err := s.InviteLink.Decode(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field invite_link: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field invite_link: %w", err) } } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field bot_commands: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field bot_commands: %w", err) } if headerLen > 0 { @@ -556,7 +610,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#f2f19203: field bot_commands: %w", err) + return fmt.Errorf("unable to decode bare supergroupFullInfo#3459badb: field bot_commands: %w", err) } s.BotCommands = append(s.BotCommands, value) } @@ -564,14 +618,14 @@ func (s *SupergroupFullInfo) DecodeBare(b *bin.Buffer) error { { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field upgraded_from_basic_group_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: 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#f2f19203: field upgraded_from_max_message_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field upgraded_from_max_message_id: %w", err) } s.UpgradedFromMaxMessageID = value } @@ -581,14 +635,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#f2f19203 as nil") + return fmt.Errorf("can't encode supergroupFullInfo#3459badb 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#f2f19203: field photo: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#3459badb: field photo: %w", err) } b.Comma() b.FieldStart("description") @@ -645,24 +699,33 @@ func (s *SupergroupFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("has_pinned_stories") b.PutBool(s.HasPinnedStories) b.Comma() + b.FieldStart("my_boost_count") + b.PutInt32(s.MyBoostCount) + b.Comma() + b.FieldStart("unrestrict_boost_count") + b.PutInt32(s.UnrestrictBoostCount) + b.Comma() b.FieldStart("sticker_set_id") b.PutLong(s.StickerSetID) b.Comma() + b.FieldStart("custom_emoji_sticker_set_id") + b.PutLong(s.CustomEmojiStickerSetID) + b.Comma() b.FieldStart("location") if err := s.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#f2f19203: field location: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#3459badb: 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#f2f19203: field invite_link: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#3459badb: 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#f2f19203: field bot_commands element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode supergroupFullInfo#3459badb: field bot_commands element with index %d: %w", idx, err) } b.Comma() } @@ -683,162 +746,180 @@ 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#f2f19203 to nil") + return fmt.Errorf("can't decode supergroupFullInfo#3459badb 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#f2f19203: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: %w", err) } case "photo": if err := s.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field photo: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field photo: %w", err) } case "description": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field description: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field description: %w", err) } s.Description = value case "member_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field member_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: 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#f2f19203: field administrator_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: 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#f2f19203: field restricted_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: 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#f2f19203: field banned_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: 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#f2f19203: field linked_chat_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: 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#f2f19203: field slow_mode_delay: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: 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#f2f19203: field slow_mode_delay_expires_in: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: 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#f2f19203: field can_get_members: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field can_get_members: %w", err) } s.CanGetMembers = value case "has_hidden_members": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field has_hidden_members: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field has_hidden_members: %w", err) } s.HasHiddenMembers = value case "can_hide_members": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field can_hide_members: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field can_hide_members: %w", err) } s.CanHideMembers = value case "can_set_sticker_set": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field can_set_sticker_set: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: 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#f2f19203: field can_set_location: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: 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#f2f19203: field can_get_statistics: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field can_get_statistics: %w", err) } s.CanGetStatistics = value case "can_toggle_aggressive_anti_spam": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field can_toggle_aggressive_anti_spam: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field can_toggle_aggressive_anti_spam: %w", err) } s.CanToggleAggressiveAntiSpam = value case "is_all_history_available": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field is_all_history_available: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field is_all_history_available: %w", err) } s.IsAllHistoryAvailable = value case "has_aggressive_anti_spam_enabled": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field has_aggressive_anti_spam_enabled: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field has_aggressive_anti_spam_enabled: %w", err) } s.HasAggressiveAntiSpamEnabled = value case "has_pinned_stories": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field has_pinned_stories: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field has_pinned_stories: %w", err) } s.HasPinnedStories = value + case "my_boost_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field my_boost_count: %w", err) + } + s.MyBoostCount = value + case "unrestrict_boost_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field unrestrict_boost_count: %w", err) + } + s.UnrestrictBoostCount = value case "sticker_set_id": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field sticker_set_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field sticker_set_id: %w", err) } s.StickerSetID = value + case "custom_emoji_sticker_set_id": + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field custom_emoji_sticker_set_id: %w", err) + } + s.CustomEmojiStickerSetID = value case "location": if err := s.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field location: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field location: %w", err) } case "invite_link": if err := s.InviteLink.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field invite_link: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: 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#f2f19203: field bot_commands: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field bot_commands: %w", err) } s.BotCommands = append(s.BotCommands, value) return nil }); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field bot_commands: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: 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#f2f19203: field upgraded_from_basic_group_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: 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#f2f19203: field upgraded_from_max_message_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#3459badb: field upgraded_from_max_message_id: %w", err) } s.UpgradedFromMaxMessageID = value default: @@ -1000,6 +1081,22 @@ func (s *SupergroupFullInfo) GetHasPinnedStories() (value bool) { return s.HasPinnedStories } +// GetMyBoostCount returns value of MyBoostCount field. +func (s *SupergroupFullInfo) GetMyBoostCount() (value int32) { + if s == nil { + return + } + return s.MyBoostCount +} + +// GetUnrestrictBoostCount returns value of UnrestrictBoostCount field. +func (s *SupergroupFullInfo) GetUnrestrictBoostCount() (value int32) { + if s == nil { + return + } + return s.UnrestrictBoostCount +} + // GetStickerSetID returns value of StickerSetID field. func (s *SupergroupFullInfo) GetStickerSetID() (value int64) { if s == nil { @@ -1008,6 +1105,14 @@ func (s *SupergroupFullInfo) GetStickerSetID() (value int64) { return s.StickerSetID } +// GetCustomEmojiStickerSetID returns value of CustomEmojiStickerSetID field. +func (s *SupergroupFullInfo) GetCustomEmojiStickerSetID() (value int64) { + if s == nil { + return + } + return s.CustomEmojiStickerSetID +} + // GetLocation returns value of Location field. func (s *SupergroupFullInfo) GetLocation() (value ChatLocation) { if s == nil { diff --git a/tdapi/tl_supergroup_gen.go b/tdapi/tl_supergroup_gen.go index 064796a723..3c623532c4 100644 --- a/tdapi/tl_supergroup_gen.go +++ b/tdapi/tl_supergroup_gen.go @@ -82,9 +82,11 @@ type Supergroup struct { IsScam bool // True, if many users reported this supergroup or channel as a fake account IsFake bool - // True, if the channel has non-expired stories available to the current user + // True, if the supergroup or channel has non-expired stories available to the current + // user HasActiveStories bool - // True, if the channel has unread non-expired stories available to the current user + // True, if the supergroup or channel has unread non-expired stories available to the + // current user HasUnreadActiveStories bool } diff --git a/tdapi/tl_telegram_payment_purpose_gen.go b/tdapi/tl_telegram_payment_purpose_gen.go index c3a8636a7c..ac7d27134d 100644 --- a/tdapi/tl_telegram_payment_purpose_gen.go +++ b/tdapi/tl_telegram_payment_purpose_gen.go @@ -33,8 +33,9 @@ var ( // TelegramPaymentPurposePremiumGiftCodes represents TL type `telegramPaymentPurposePremiumGiftCodes#91009cc`. type TelegramPaymentPurposePremiumGiftCodes struct { - // Identifier of the channel chat, which will be automatically boosted by the users for - // duration of the Premium subscription and which is administered by the user; 0 if none + // Identifier of the supergroup or channel chat, which will be automatically boosted by + // the users for duration of the Premium subscription and which is administered by the + // user; 0 if none BoostedChatID int64 // ISO 4217 currency code of the payment currency Currency string diff --git a/tdapi/tl_toggle_saved_messages_topic_is_pinned_gen.go b/tdapi/tl_toggle_saved_messages_topic_is_pinned_gen.go index 1ab7b4da0b..3f931a4ff9 100644 --- a/tdapi/tl_toggle_saved_messages_topic_is_pinned_gen.go +++ b/tdapi/tl_toggle_saved_messages_topic_is_pinned_gen.go @@ -31,16 +31,16 @@ var ( _ = tdjson.Encoder{} ) -// ToggleSavedMessagesTopicIsPinnedRequest represents TL type `toggleSavedMessagesTopicIsPinned#3f8a8c2d`. +// ToggleSavedMessagesTopicIsPinnedRequest represents TL type `toggleSavedMessagesTopicIsPinned#a15345cc`. type ToggleSavedMessagesTopicIsPinnedRequest struct { - // Saved Messages topic to pin or unpin - SavedMessagesTopic SavedMessagesTopicClass + // Identifier of Saved Messages topic to pin or unpin + SavedMessagesTopicID int64 // Pass true to pin the topic; pass false to unpin it IsPinned bool } // ToggleSavedMessagesTopicIsPinnedRequestTypeID is TL type id of ToggleSavedMessagesTopicIsPinnedRequest. -const ToggleSavedMessagesTopicIsPinnedRequestTypeID = 0x3f8a8c2d +const ToggleSavedMessagesTopicIsPinnedRequestTypeID = 0xa15345cc // Ensuring interfaces in compile-time for ToggleSavedMessagesTopicIsPinnedRequest. var ( @@ -54,7 +54,7 @@ func (t *ToggleSavedMessagesTopicIsPinnedRequest) Zero() bool { if t == nil { return true } - if !(t.SavedMessagesTopic == nil) { + if !(t.SavedMessagesTopicID == 0) { return false } if !(t.IsPinned == false) { @@ -97,8 +97,8 @@ func (t *ToggleSavedMessagesTopicIsPinnedRequest) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "SavedMessagesTopic", - SchemaName: "saved_messages_topic", + Name: "SavedMessagesTopicID", + SchemaName: "saved_messages_topic_id", }, { Name: "IsPinned", @@ -111,7 +111,7 @@ func (t *ToggleSavedMessagesTopicIsPinnedRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (t *ToggleSavedMessagesTopicIsPinnedRequest) Encode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode toggleSavedMessagesTopicIsPinned#3f8a8c2d as nil") + return fmt.Errorf("can't encode toggleSavedMessagesTopicIsPinned#a15345cc as nil") } b.PutID(ToggleSavedMessagesTopicIsPinnedRequestTypeID) return t.EncodeBare(b) @@ -120,14 +120,9 @@ func (t *ToggleSavedMessagesTopicIsPinnedRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (t *ToggleSavedMessagesTopicIsPinnedRequest) EncodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode toggleSavedMessagesTopicIsPinned#3f8a8c2d as nil") - } - if t.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode toggleSavedMessagesTopicIsPinned#3f8a8c2d: field saved_messages_topic is nil") - } - if err := t.SavedMessagesTopic.Encode(b); err != nil { - return fmt.Errorf("unable to encode toggleSavedMessagesTopicIsPinned#3f8a8c2d: field saved_messages_topic: %w", err) + return fmt.Errorf("can't encode toggleSavedMessagesTopicIsPinned#a15345cc as nil") } + b.PutInt53(t.SavedMessagesTopicID) b.PutBool(t.IsPinned) return nil } @@ -135,10 +130,10 @@ func (t *ToggleSavedMessagesTopicIsPinnedRequest) EncodeBare(b *bin.Buffer) erro // Decode implements bin.Decoder. func (t *ToggleSavedMessagesTopicIsPinnedRequest) Decode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode toggleSavedMessagesTopicIsPinned#3f8a8c2d to nil") + return fmt.Errorf("can't decode toggleSavedMessagesTopicIsPinned#a15345cc to nil") } if err := b.ConsumeID(ToggleSavedMessagesTopicIsPinnedRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleSavedMessagesTopicIsPinned#3f8a8c2d: %w", err) + return fmt.Errorf("unable to decode toggleSavedMessagesTopicIsPinned#a15345cc: %w", err) } return t.DecodeBare(b) } @@ -146,19 +141,19 @@ func (t *ToggleSavedMessagesTopicIsPinnedRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (t *ToggleSavedMessagesTopicIsPinnedRequest) DecodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode toggleSavedMessagesTopicIsPinned#3f8a8c2d to nil") + return fmt.Errorf("can't decode toggleSavedMessagesTopicIsPinned#a15345cc to nil") } { - value, err := DecodeSavedMessagesTopic(b) + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode toggleSavedMessagesTopicIsPinned#3f8a8c2d: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode toggleSavedMessagesTopicIsPinned#a15345cc: field saved_messages_topic_id: %w", err) } - t.SavedMessagesTopic = value + t.SavedMessagesTopicID = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode toggleSavedMessagesTopicIsPinned#3f8a8c2d: field is_pinned: %w", err) + return fmt.Errorf("unable to decode toggleSavedMessagesTopicIsPinned#a15345cc: field is_pinned: %w", err) } t.IsPinned = value } @@ -168,18 +163,13 @@ func (t *ToggleSavedMessagesTopicIsPinnedRequest) DecodeBare(b *bin.Buffer) erro // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (t *ToggleSavedMessagesTopicIsPinnedRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if t == nil { - return fmt.Errorf("can't encode toggleSavedMessagesTopicIsPinned#3f8a8c2d as nil") + return fmt.Errorf("can't encode toggleSavedMessagesTopicIsPinned#a15345cc as nil") } b.ObjStart() b.PutID("toggleSavedMessagesTopicIsPinned") b.Comma() - b.FieldStart("saved_messages_topic") - if t.SavedMessagesTopic == nil { - return fmt.Errorf("unable to encode toggleSavedMessagesTopicIsPinned#3f8a8c2d: field saved_messages_topic is nil") - } - if err := t.SavedMessagesTopic.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode toggleSavedMessagesTopicIsPinned#3f8a8c2d: field saved_messages_topic: %w", err) - } + b.FieldStart("saved_messages_topic_id") + b.PutInt53(t.SavedMessagesTopicID) b.Comma() b.FieldStart("is_pinned") b.PutBool(t.IsPinned) @@ -192,25 +182,25 @@ func (t *ToggleSavedMessagesTopicIsPinnedRequest) EncodeTDLibJSON(b tdjson.Encod // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (t *ToggleSavedMessagesTopicIsPinnedRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if t == nil { - return fmt.Errorf("can't decode toggleSavedMessagesTopicIsPinned#3f8a8c2d to nil") + return fmt.Errorf("can't decode toggleSavedMessagesTopicIsPinned#a15345cc to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("toggleSavedMessagesTopicIsPinned"); err != nil { - return fmt.Errorf("unable to decode toggleSavedMessagesTopicIsPinned#3f8a8c2d: %w", err) + return fmt.Errorf("unable to decode toggleSavedMessagesTopicIsPinned#a15345cc: %w", err) } - case "saved_messages_topic": - value, err := DecodeTDLibJSONSavedMessagesTopic(b) + case "saved_messages_topic_id": + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode toggleSavedMessagesTopicIsPinned#3f8a8c2d: field saved_messages_topic: %w", err) + return fmt.Errorf("unable to decode toggleSavedMessagesTopicIsPinned#a15345cc: field saved_messages_topic_id: %w", err) } - t.SavedMessagesTopic = value + t.SavedMessagesTopicID = value case "is_pinned": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode toggleSavedMessagesTopicIsPinned#3f8a8c2d: field is_pinned: %w", err) + return fmt.Errorf("unable to decode toggleSavedMessagesTopicIsPinned#a15345cc: field is_pinned: %w", err) } t.IsPinned = value default: @@ -220,12 +210,12 @@ func (t *ToggleSavedMessagesTopicIsPinnedRequest) DecodeTDLibJSON(b tdjson.Decod }) } -// GetSavedMessagesTopic returns value of SavedMessagesTopic field. -func (t *ToggleSavedMessagesTopicIsPinnedRequest) GetSavedMessagesTopic() (value SavedMessagesTopicClass) { +// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. +func (t *ToggleSavedMessagesTopicIsPinnedRequest) GetSavedMessagesTopicID() (value int64) { if t == nil { return } - return t.SavedMessagesTopic + return t.SavedMessagesTopicID } // GetIsPinned returns value of IsPinned field. @@ -236,7 +226,7 @@ func (t *ToggleSavedMessagesTopicIsPinnedRequest) GetIsPinned() (value bool) { return t.IsPinned } -// ToggleSavedMessagesTopicIsPinned invokes method toggleSavedMessagesTopicIsPinned#3f8a8c2d returning error if any. +// ToggleSavedMessagesTopicIsPinned invokes method toggleSavedMessagesTopicIsPinned#a15345cc returning error if any. func (c *Client) ToggleSavedMessagesTopicIsPinned(ctx context.Context, request *ToggleSavedMessagesTopicIsPinnedRequest) error { var ok Ok diff --git a/tdapi/tl_update_gen.go b/tdapi/tl_update_gen.go index 2231e49503..66a6e617ff 100644 --- a/tdapi/tl_update_gen.go +++ b/tdapi/tl_update_gen.go @@ -5319,7 +5319,7 @@ func (u *UpdateChatAvailableReactions) GetAvailableReactions() (value ChatAvaila type UpdateChatDraftMessage struct { // Chat identifier ChatID int64 - // The new draft message; may be null + // The new draft message; may be null if none DraftMessage DraftMessage // The new chat positions in the chat lists Positions []ChatPosition @@ -9626,112 +9626,135 @@ func (u *UpdateChatOnlineMemberCount) GetOnlineMemberCount() (value int32) { return u.OnlineMemberCount } -// UpdatePinnedSavedMessagesTopics represents TL type `updatePinnedSavedMessagesTopics#2101c3a3`. -type UpdatePinnedSavedMessagesTopics struct { +// UpdateSavedMessagesTopic represents TL type `updateSavedMessagesTopic#9f823b30`. +type UpdateSavedMessagesTopic struct { + // New data about the topic + Topic SavedMessagesTopic } -// UpdatePinnedSavedMessagesTopicsTypeID is TL type id of UpdatePinnedSavedMessagesTopics. -const UpdatePinnedSavedMessagesTopicsTypeID = 0x2101c3a3 +// UpdateSavedMessagesTopicTypeID is TL type id of UpdateSavedMessagesTopic. +const UpdateSavedMessagesTopicTypeID = 0x9f823b30 // construct implements constructor of UpdateClass. -func (u UpdatePinnedSavedMessagesTopics) construct() UpdateClass { return &u } +func (u UpdateSavedMessagesTopic) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdatePinnedSavedMessagesTopics. +// Ensuring interfaces in compile-time for UpdateSavedMessagesTopic. var ( - _ bin.Encoder = &UpdatePinnedSavedMessagesTopics{} - _ bin.Decoder = &UpdatePinnedSavedMessagesTopics{} - _ bin.BareEncoder = &UpdatePinnedSavedMessagesTopics{} - _ bin.BareDecoder = &UpdatePinnedSavedMessagesTopics{} + _ bin.Encoder = &UpdateSavedMessagesTopic{} + _ bin.Decoder = &UpdateSavedMessagesTopic{} + _ bin.BareEncoder = &UpdateSavedMessagesTopic{} + _ bin.BareDecoder = &UpdateSavedMessagesTopic{} - _ UpdateClass = &UpdatePinnedSavedMessagesTopics{} + _ UpdateClass = &UpdateSavedMessagesTopic{} ) -func (u *UpdatePinnedSavedMessagesTopics) Zero() bool { +func (u *UpdateSavedMessagesTopic) Zero() bool { if u == nil { return true } + if !(u.Topic.Zero()) { + return false + } return true } // String implements fmt.Stringer. -func (u *UpdatePinnedSavedMessagesTopics) String() string { +func (u *UpdateSavedMessagesTopic) String() string { if u == nil { - return "UpdatePinnedSavedMessagesTopics(nil)" + return "UpdateSavedMessagesTopic(nil)" } - type Alias UpdatePinnedSavedMessagesTopics - return fmt.Sprintf("UpdatePinnedSavedMessagesTopics%+v", Alias(*u)) + type Alias UpdateSavedMessagesTopic + return fmt.Sprintf("UpdateSavedMessagesTopic%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdatePinnedSavedMessagesTopics) TypeID() uint32 { - return UpdatePinnedSavedMessagesTopicsTypeID +func (*UpdateSavedMessagesTopic) TypeID() uint32 { + return UpdateSavedMessagesTopicTypeID } // TypeName returns name of type in TL schema. -func (*UpdatePinnedSavedMessagesTopics) TypeName() string { - return "updatePinnedSavedMessagesTopics" +func (*UpdateSavedMessagesTopic) TypeName() string { + return "updateSavedMessagesTopic" } // TypeInfo returns info about TL type. -func (u *UpdatePinnedSavedMessagesTopics) TypeInfo() tdp.Type { +func (u *UpdateSavedMessagesTopic) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updatePinnedSavedMessagesTopics", - ID: UpdatePinnedSavedMessagesTopicsTypeID, + Name: "updateSavedMessagesTopic", + ID: UpdateSavedMessagesTopicTypeID, } if u == nil { typ.Null = true return typ } - typ.Fields = []tdp.Field{} + typ.Fields = []tdp.Field{ + { + Name: "Topic", + SchemaName: "topic", + }, + } return typ } // Encode implements bin.Encoder. -func (u *UpdatePinnedSavedMessagesTopics) Encode(b *bin.Buffer) error { +func (u *UpdateSavedMessagesTopic) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updatePinnedSavedMessagesTopics#2101c3a3 as nil") + return fmt.Errorf("can't encode updateSavedMessagesTopic#9f823b30 as nil") } - b.PutID(UpdatePinnedSavedMessagesTopicsTypeID) + b.PutID(UpdateSavedMessagesTopicTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdatePinnedSavedMessagesTopics) EncodeBare(b *bin.Buffer) error { +func (u *UpdateSavedMessagesTopic) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updatePinnedSavedMessagesTopics#2101c3a3 as nil") + return fmt.Errorf("can't encode updateSavedMessagesTopic#9f823b30 as nil") + } + if err := u.Topic.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateSavedMessagesTopic#9f823b30: field topic: %w", err) } return nil } // Decode implements bin.Decoder. -func (u *UpdatePinnedSavedMessagesTopics) Decode(b *bin.Buffer) error { +func (u *UpdateSavedMessagesTopic) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updatePinnedSavedMessagesTopics#2101c3a3 to nil") + return fmt.Errorf("can't decode updateSavedMessagesTopic#9f823b30 to nil") } - if err := b.ConsumeID(UpdatePinnedSavedMessagesTopicsTypeID); err != nil { - return fmt.Errorf("unable to decode updatePinnedSavedMessagesTopics#2101c3a3: %w", err) + if err := b.ConsumeID(UpdateSavedMessagesTopicTypeID); err != nil { + return fmt.Errorf("unable to decode updateSavedMessagesTopic#9f823b30: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdatePinnedSavedMessagesTopics) DecodeBare(b *bin.Buffer) error { +func (u *UpdateSavedMessagesTopic) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updatePinnedSavedMessagesTopics#2101c3a3 to nil") + return fmt.Errorf("can't decode updateSavedMessagesTopic#9f823b30 to nil") + } + { + if err := u.Topic.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateSavedMessagesTopic#9f823b30: field topic: %w", err) + } } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdatePinnedSavedMessagesTopics) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateSavedMessagesTopic) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updatePinnedSavedMessagesTopics#2101c3a3 as nil") + return fmt.Errorf("can't encode updateSavedMessagesTopic#9f823b30 as nil") } b.ObjStart() - b.PutID("updatePinnedSavedMessagesTopics") + b.PutID("updateSavedMessagesTopic") + b.Comma() + b.FieldStart("topic") + if err := u.Topic.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateSavedMessagesTopic#9f823b30: field topic: %w", err) + } b.Comma() b.StripComma() b.ObjEnd() @@ -9739,16 +9762,20 @@ func (u *UpdatePinnedSavedMessagesTopics) EncodeTDLibJSON(b tdjson.Encoder) erro } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdatePinnedSavedMessagesTopics) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateSavedMessagesTopic) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updatePinnedSavedMessagesTopics#2101c3a3 to nil") + return fmt.Errorf("can't decode updateSavedMessagesTopic#9f823b30 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updatePinnedSavedMessagesTopics"); err != nil { - return fmt.Errorf("unable to decode updatePinnedSavedMessagesTopics#2101c3a3: %w", err) + if err := b.ConsumeID("updateSavedMessagesTopic"); err != nil { + return fmt.Errorf("unable to decode updateSavedMessagesTopic#9f823b30: %w", err) + } + case "topic": + if err := u.Topic.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode updateSavedMessagesTopic#9f823b30: field topic: %w", err) } default: return b.Skip() @@ -9757,6 +9784,180 @@ func (u *UpdatePinnedSavedMessagesTopics) DecodeTDLibJSON(b tdjson.Decoder) erro }) } +// GetTopic returns value of Topic field. +func (u *UpdateSavedMessagesTopic) GetTopic() (value SavedMessagesTopic) { + if u == nil { + return + } + return u.Topic +} + +// UpdateSavedMessagesTopicCount represents TL type `updateSavedMessagesTopicCount#fbd279d1`. +type UpdateSavedMessagesTopicCount struct { + // Approximate total number of Saved Messages topics + TopicCount int32 +} + +// UpdateSavedMessagesTopicCountTypeID is TL type id of UpdateSavedMessagesTopicCount. +const UpdateSavedMessagesTopicCountTypeID = 0xfbd279d1 + +// construct implements constructor of UpdateClass. +func (u UpdateSavedMessagesTopicCount) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateSavedMessagesTopicCount. +var ( + _ bin.Encoder = &UpdateSavedMessagesTopicCount{} + _ bin.Decoder = &UpdateSavedMessagesTopicCount{} + _ bin.BareEncoder = &UpdateSavedMessagesTopicCount{} + _ bin.BareDecoder = &UpdateSavedMessagesTopicCount{} + + _ UpdateClass = &UpdateSavedMessagesTopicCount{} +) + +func (u *UpdateSavedMessagesTopicCount) Zero() bool { + if u == nil { + return true + } + if !(u.TopicCount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateSavedMessagesTopicCount) String() string { + if u == nil { + return "UpdateSavedMessagesTopicCount(nil)" + } + type Alias UpdateSavedMessagesTopicCount + return fmt.Sprintf("UpdateSavedMessagesTopicCount%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateSavedMessagesTopicCount) TypeID() uint32 { + return UpdateSavedMessagesTopicCountTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateSavedMessagesTopicCount) TypeName() string { + return "updateSavedMessagesTopicCount" +} + +// TypeInfo returns info about TL type. +func (u *UpdateSavedMessagesTopicCount) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateSavedMessagesTopicCount", + ID: UpdateSavedMessagesTopicCountTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "TopicCount", + SchemaName: "topic_count", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateSavedMessagesTopicCount) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateSavedMessagesTopicCount#fbd279d1 as nil") + } + b.PutID(UpdateSavedMessagesTopicCountTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateSavedMessagesTopicCount) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateSavedMessagesTopicCount#fbd279d1 as nil") + } + b.PutInt32(u.TopicCount) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateSavedMessagesTopicCount) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateSavedMessagesTopicCount#fbd279d1 to nil") + } + if err := b.ConsumeID(UpdateSavedMessagesTopicCountTypeID); err != nil { + return fmt.Errorf("unable to decode updateSavedMessagesTopicCount#fbd279d1: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateSavedMessagesTopicCount) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateSavedMessagesTopicCount#fbd279d1 to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateSavedMessagesTopicCount#fbd279d1: field topic_count: %w", err) + } + u.TopicCount = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpdateSavedMessagesTopicCount) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode updateSavedMessagesTopicCount#fbd279d1 as nil") + } + b.ObjStart() + b.PutID("updateSavedMessagesTopicCount") + b.Comma() + b.FieldStart("topic_count") + b.PutInt32(u.TopicCount) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpdateSavedMessagesTopicCount) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode updateSavedMessagesTopicCount#fbd279d1 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("updateSavedMessagesTopicCount"); err != nil { + return fmt.Errorf("unable to decode updateSavedMessagesTopicCount#fbd279d1: %w", err) + } + case "topic_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateSavedMessagesTopicCount#fbd279d1: field topic_count: %w", err) + } + u.TopicCount = value + default: + return b.Skip() + } + return nil + }) +} + +// GetTopicCount returns value of TopicCount field. +func (u *UpdateSavedMessagesTopicCount) GetTopicCount() (value int32) { + if u == nil { + return + } + return u.TopicCount +} + // UpdateForumTopicInfo represents TL type `updateForumTopicInfo#6b6f2cc9`. type UpdateForumTopicInfo struct { // Chat identifier @@ -11528,7 +11729,7 @@ func (u *UpdateDeleteMessages) GetFromCache() (value bool) { type UpdateChatAction struct { // Chat identifier ChatID int64 - // If not 0, a message thread identifier in which the action was performed + // If not 0, the message thread identifier in which the action was performed MessageThreadID int64 // Identifier of a message sender performing the action SenderID MessageSenderClass @@ -22162,14 +22363,17 @@ func (u *UpdateDefaultReactionType) GetReactionType() (value ReactionTypeClass) return u.ReactionType } -// UpdateSavedMessagesTags represents TL type `updateSavedMessagesTags#dfc2ab29`. +// UpdateSavedMessagesTags represents TL type `updateSavedMessagesTags#7386424a`. type UpdateSavedMessagesTags struct { - // The new used tags + // Identifier of Saved Messages topic which tags were changed; 0 if tags for the whole + // chat has changed + SavedMessagesTopicID int64 + // The new tags Tags SavedMessagesTags } // UpdateSavedMessagesTagsTypeID is TL type id of UpdateSavedMessagesTags. -const UpdateSavedMessagesTagsTypeID = 0xdfc2ab29 +const UpdateSavedMessagesTagsTypeID = 0x7386424a // construct implements constructor of UpdateClass. func (u UpdateSavedMessagesTags) construct() UpdateClass { return &u } @@ -22188,6 +22392,9 @@ func (u *UpdateSavedMessagesTags) Zero() bool { if u == nil { return true } + if !(u.SavedMessagesTopicID == 0) { + return false + } if !(u.Tags.Zero()) { return false } @@ -22227,6 +22434,10 @@ func (u *UpdateSavedMessagesTags) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "SavedMessagesTopicID", + SchemaName: "saved_messages_topic_id", + }, { Name: "Tags", SchemaName: "tags", @@ -22238,7 +22449,7 @@ func (u *UpdateSavedMessagesTags) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (u *UpdateSavedMessagesTags) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateSavedMessagesTags#dfc2ab29 as nil") + return fmt.Errorf("can't encode updateSavedMessagesTags#7386424a as nil") } b.PutID(UpdateSavedMessagesTagsTypeID) return u.EncodeBare(b) @@ -22247,10 +22458,11 @@ func (u *UpdateSavedMessagesTags) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *UpdateSavedMessagesTags) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateSavedMessagesTags#dfc2ab29 as nil") + return fmt.Errorf("can't encode updateSavedMessagesTags#7386424a as nil") } + b.PutInt53(u.SavedMessagesTopicID) if err := u.Tags.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateSavedMessagesTags#dfc2ab29: field tags: %w", err) + return fmt.Errorf("unable to encode updateSavedMessagesTags#7386424a: field tags: %w", err) } return nil } @@ -22258,10 +22470,10 @@ func (u *UpdateSavedMessagesTags) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (u *UpdateSavedMessagesTags) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateSavedMessagesTags#dfc2ab29 to nil") + return fmt.Errorf("can't decode updateSavedMessagesTags#7386424a to nil") } if err := b.ConsumeID(UpdateSavedMessagesTagsTypeID); err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTags#dfc2ab29: %w", err) + return fmt.Errorf("unable to decode updateSavedMessagesTags#7386424a: %w", err) } return u.DecodeBare(b) } @@ -22269,11 +22481,18 @@ func (u *UpdateSavedMessagesTags) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *UpdateSavedMessagesTags) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateSavedMessagesTags#dfc2ab29 to nil") + return fmt.Errorf("can't decode updateSavedMessagesTags#7386424a to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode updateSavedMessagesTags#7386424a: field saved_messages_topic_id: %w", err) + } + u.SavedMessagesTopicID = value } { if err := u.Tags.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTags#dfc2ab29: field tags: %w", err) + return fmt.Errorf("unable to decode updateSavedMessagesTags#7386424a: field tags: %w", err) } } return nil @@ -22282,14 +22501,17 @@ func (u *UpdateSavedMessagesTags) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UpdateSavedMessagesTags) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateSavedMessagesTags#dfc2ab29 as nil") + return fmt.Errorf("can't encode updateSavedMessagesTags#7386424a as nil") } b.ObjStart() b.PutID("updateSavedMessagesTags") b.Comma() + b.FieldStart("saved_messages_topic_id") + b.PutInt53(u.SavedMessagesTopicID) + b.Comma() b.FieldStart("tags") if err := u.Tags.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateSavedMessagesTags#dfc2ab29: field tags: %w", err) + return fmt.Errorf("unable to encode updateSavedMessagesTags#7386424a: field tags: %w", err) } b.Comma() b.StripComma() @@ -22300,18 +22522,24 @@ func (u *UpdateSavedMessagesTags) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UpdateSavedMessagesTags) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateSavedMessagesTags#dfc2ab29 to nil") + return fmt.Errorf("can't decode updateSavedMessagesTags#7386424a to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("updateSavedMessagesTags"); err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTags#dfc2ab29: %w", err) + return fmt.Errorf("unable to decode updateSavedMessagesTags#7386424a: %w", err) + } + case "saved_messages_topic_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode updateSavedMessagesTags#7386424a: field saved_messages_topic_id: %w", err) } + u.SavedMessagesTopicID = value case "tags": if err := u.Tags.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTags#dfc2ab29: field tags: %w", err) + return fmt.Errorf("unable to decode updateSavedMessagesTags#7386424a: field tags: %w", err) } default: return b.Skip() @@ -22320,6 +22548,14 @@ func (u *UpdateSavedMessagesTags) DecodeTDLibJSON(b tdjson.Decoder) error { }) } +// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. +func (u *UpdateSavedMessagesTags) GetSavedMessagesTopicID() (value int64) { + if u == nil { + return + } + return u.SavedMessagesTopicID +} + // GetTags returns value of Tags field. func (u *UpdateSavedMessagesTags) GetTags() (value SavedMessagesTags) { if u == nil { @@ -28331,7 +28567,8 @@ const UpdateClassName = "Update" // case *tdapi.UpdateChatHasScheduledMessages: // updateChatHasScheduledMessages#7b14c2d7 // case *tdapi.UpdateChatFolders: // updateChatFolders#71a4b3a // case *tdapi.UpdateChatOnlineMemberCount: // updateChatOnlineMemberCount#1d0caa9d -// case *tdapi.UpdatePinnedSavedMessagesTopics: // updatePinnedSavedMessagesTopics#2101c3a3 +// case *tdapi.UpdateSavedMessagesTopic: // updateSavedMessagesTopic#9f823b30 +// case *tdapi.UpdateSavedMessagesTopicCount: // updateSavedMessagesTopicCount#fbd279d1 // case *tdapi.UpdateForumTopicInfo: // updateForumTopicInfo#6b6f2cc9 // case *tdapi.UpdateScopeNotificationSettings: // updateScopeNotificationSettings#b83ccb73 // case *tdapi.UpdateNotification: // updateNotification#8ee67ed4 @@ -28391,7 +28628,7 @@ const UpdateClassName = "Update" // case *tdapi.UpdateWebAppMessageSent: // updateWebAppMessageSent#58431229 // case *tdapi.UpdateActiveEmojiReactions: // updateActiveEmojiReactions#691ffcb7 // case *tdapi.UpdateDefaultReactionType: // updateDefaultReactionType#4b615105 -// case *tdapi.UpdateSavedMessagesTags: // updateSavedMessagesTags#dfc2ab29 +// case *tdapi.UpdateSavedMessagesTags: // updateSavedMessagesTags#7386424a // case *tdapi.UpdateSpeechRecognitionTrial: // updateSpeechRecognitionTrial#ff4efcc1 // case *tdapi.UpdateDiceEmojis: // updateDiceEmojis#9d0f91df // case *tdapi.UpdateAnimatedEmojiMessageClicked: // updateAnimatedEmojiMessageClicked#a3167405 @@ -28760,9 +28997,16 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil - case UpdatePinnedSavedMessagesTopicsTypeID: - // Decoding updatePinnedSavedMessagesTopics#2101c3a3. - v := UpdatePinnedSavedMessagesTopics{} + case UpdateSavedMessagesTopicTypeID: + // Decoding updateSavedMessagesTopic#9f823b30. + v := UpdateSavedMessagesTopic{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case UpdateSavedMessagesTopicCountTypeID: + // Decoding updateSavedMessagesTopicCount#fbd279d1. + v := UpdateSavedMessagesTopicCount{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } @@ -29181,7 +29425,7 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { } return &v, nil case UpdateSavedMessagesTagsTypeID: - // Decoding updateSavedMessagesTags#dfc2ab29. + // Decoding updateSavedMessagesTags#7386424a. v := UpdateSavedMessagesTags{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) @@ -29668,9 +29912,16 @@ func DecodeTDLibJSONUpdate(buf tdjson.Decoder) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil - case "updatePinnedSavedMessagesTopics": - // Decoding updatePinnedSavedMessagesTopics#2101c3a3. - v := UpdatePinnedSavedMessagesTopics{} + case "updateSavedMessagesTopic": + // Decoding updateSavedMessagesTopic#9f823b30. + v := UpdateSavedMessagesTopic{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case "updateSavedMessagesTopicCount": + // Decoding updateSavedMessagesTopicCount#fbd279d1. + v := UpdateSavedMessagesTopicCount{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } @@ -30089,7 +30340,7 @@ func DecodeTDLibJSONUpdate(buf tdjson.Decoder) (UpdateClass, error) { } return &v, nil case "updateSavedMessagesTags": - // Decoding updateSavedMessagesTags#dfc2ab29. + // Decoding updateSavedMessagesTags#7386424a. v := UpdateSavedMessagesTags{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)