From 420e180a9046398d10cb94bd3a94c071ec24961e Mon Sep 17 00:00:00 2001 From: GitHub Date: Sat, 2 Dec 2023 07:44:04 +0000 Subject: [PATCH] feat(schema): update TDLib to the latest layer --- _schema/tdapi.tl | 293 ++++-- tdapi/tl_added_reactions_gen.go | 2 +- tdapi/tl_available_reactions_gen.go | 2 +- tdapi/tl_chat_gen.go | 275 ++--- tdapi/tl_chat_notification_settings_gen.go | 22 +- tdapi/tl_chat_statistics_gen.go | 543 +++++++--- ...tl_chat_statistics_interaction_info_gen.go | 305 ++++++ ...statistics_message_interaction_info_gen.go | 261 ----- tdapi/tl_chat_statistics_object_type_gen.go | 501 +++++++++ tdapi/tl_delete_chat_background_gen.go | 238 +++++ tdapi/tl_found_chat_boosts_gen.go | 2 +- tdapi/tl_found_file_downloads_gen.go | 2 +- tdapi/tl_found_messages_gen.go | 2 +- tdapi/tl_get_chat_similar_chat_count_gen.go | 238 +++++ tdapi/tl_get_chat_similar_chats_gen.go | 206 ++++ tdapi/tl_get_story_public_forwards_gen.go | 308 ++++++ tdapi/tl_get_story_statistics_gen.go | 271 +++++ tdapi/tl_inline_query_results_gen.go | 2 +- tdapi/tl_input_message_reply_to_gen.go | 51 +- tdapi/tl_input_text_quote_gen.go | 229 +++++ tdapi/tl_message_content_gen.go | 323 +++++- tdapi/tl_message_reply_to_gen.go | 112 +-- tdapi/tl_message_sponsor_type_gen.go | 225 +++++ tdapi/tl_message_statistics_gen.go | 76 +- tdapi/tl_premium_feature_gen.go | 146 +++ tdapi/tl_premium_limit_type_gen.go | 146 +++ tdapi/tl_profile_accent_color_gen.go | 263 +++++ tdapi/tl_profile_accent_colors_gen.go | 336 +++++++ tdapi/tl_registry_gen.go | 137 ++- tdapi/tl_resend_messages_gen.go | 46 +- tdapi/tl_scope_notification_settings_gen.go | 6 +- tdapi/tl_search_sticker_sets_gen.go | 75 +- tdapi/tl_send_story_gen.go | 112 ++- tdapi/tl_set_chat_available_reactions_gen.go | 4 +- tdapi/tl_set_chat_background_gen.go | 95 +- tdapi/tl_set_profile_accent_color_gen.go | 238 +++++ tdapi/tl_sponsored_message_gen.go | 86 +- tdapi/tl_story_full_id_gen.go | 227 +++++ tdapi/tl_story_gen.go | 212 ++-- tdapi/tl_story_origin_gen.go | 535 ++++++++++ tdapi/tl_story_public_forward_gen.go | 501 +++++++++ tdapi/tl_story_public_forwards_gen.go | 295 ++++++ tdapi/tl_story_repost_info_gen.go | 237 +++++ tdapi/tl_story_statistics_gen.go | 247 +++++ tdapi/tl_story_viewers_gen.go | 2 +- tdapi/tl_supergroup_gen.go | 4 +- tdapi/tl_text_quote_gen.go | 262 +++++ tdapi/tl_toggle_chat_view_as_topics_gen.go | 237 +++++ tdapi/tl_update_gen.go | 948 ++++++++++++++++-- tdapi/tl_user_full_info_gen.go | 150 +-- tdapi/tl_user_gen.go | 220 ++-- 51 files changed, 9066 insertions(+), 1190 deletions(-) create mode 100644 tdapi/tl_chat_statistics_interaction_info_gen.go delete mode 100644 tdapi/tl_chat_statistics_message_interaction_info_gen.go create mode 100644 tdapi/tl_chat_statistics_object_type_gen.go create mode 100644 tdapi/tl_delete_chat_background_gen.go create mode 100644 tdapi/tl_get_chat_similar_chat_count_gen.go create mode 100644 tdapi/tl_get_chat_similar_chats_gen.go create mode 100644 tdapi/tl_get_story_public_forwards_gen.go create mode 100644 tdapi/tl_get_story_statistics_gen.go create mode 100644 tdapi/tl_input_text_quote_gen.go create mode 100644 tdapi/tl_profile_accent_color_gen.go create mode 100644 tdapi/tl_profile_accent_colors_gen.go create mode 100644 tdapi/tl_set_profile_accent_color_gen.go create mode 100644 tdapi/tl_story_full_id_gen.go create mode 100644 tdapi/tl_story_origin_gen.go create mode 100644 tdapi/tl_story_public_forward_gen.go create mode 100644 tdapi/tl_story_public_forwards_gen.go create mode 100644 tdapi/tl_story_repost_info_gen.go create mode 100644 tdapi/tl_story_statistics_gen.go create mode 100644 tdapi/tl_text_quote_gen.go create mode 100644 tdapi/tl_toggle_chat_view_as_topics_gen.go diff --git a/_schema/tdapi.tl b/_schema/tdapi.tl index 88274ba18e..9018586f52 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: bd8aa4da2ec994c4f642cd53c169ddd8fa28533d1617148f072788b5b9e6ba2e +// SHA256: ddea96ee6e96ca4d09562f72e5591dab97acae15ff1433aedc3cdc7d9aa5dd9d double#2210c154 ? = Double; @@ -759,6 +759,18 @@ premiumGiveawayInfoCompleted#fc8b501b creation_date:int32 actual_winners_selecti //@dark_theme_colors The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in dark themes accentColor#83d57cd6 id:int32 built_in_accent_color_id:int32 light_theme_colors:vector dark_theme_colors:vector = 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 +//@background_colors The list of 1-2 colors in RGB format, describing the colors, as expected to be used for the profile photo background +//@story_colors The list of 2 colors in RGB format, describing the colors of the gradient to be used for the unread active story indicator around profile photo +profileAccentColors#218e9367 palette_colors:vector background_colors:vector story_colors:vector = ProfileAccentColors; + +//@description Contains information about supported accent color for user profile photo background +//@id Profile accent color identifier +//@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 +profileAccentColor#2bea798e id:int32 light_theme_colors:profileAccentColors dark_theme_colors:profileAccentColors = 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 //@expiration_date Point in time (Unix timestamp) when the status will expire; 0 if never @@ -782,8 +794,10 @@ usernames#bf343063 active_usernames:vector disabled_usernames:vector disabled_usernames:vector group_in_common_count:int32 bot_info:botInfo = UserFullInfo; +userFullInfo#cc594e6f personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_pinned_stories:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText premium_gift_options:vector group_in_common_count:int32 bot_info:botInfo = UserFullInfo; //@description Represents a list of users //@total_count Approximate total number of users found @@ -1058,7 +1073,7 @@ basicGroupFullInfo#d62e521e photo:chatPhoto description:string creator_user_id:i //@usernames Usernames of the supergroup or channel; may be null //@date Point in time (Unix timestamp) when the current user joined, or the point in time when the supergroup or channel was created, in case the user is not a member //@status Status of the current user in the supergroup or channel; custom title will always be empty -//@member_count Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received +//@member_count Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through //@has_linked_chat True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel //@has_location True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup //@sign_messages True, if messages sent to the channel need to contain information about the sender. This field is only applicable to channels @@ -1067,7 +1082,7 @@ basicGroupFullInfo#d62e521e photo:chatPhoto description:string creator_user_id:i //@is_slow_mode_enabled True, if the slow mode is enabled in the supergroup //@is_channel True, if the supergroup is a channel //@is_broadcast_group True, if the supergroup is a broadcast group, i.e. only administrators can send messages and there is no limit on the number of members -//@is_forum True, if the supergroup must be shown as a forum by default +//@is_forum True, if the supergroup is a forum with topics //@is_verified True, if the supergroup or channel is verified //@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 @@ -1245,17 +1260,27 @@ messageSendingStatePending#f32b63b4 sending_id:int32 = MessageSendingState; //@retry_after Time left before the message can be re-sent, in seconds. No update is sent when this field changes messageSendingStateFailed#ac81ee5e error:error can_retry:Bool need_another_sender:Bool need_another_reply_quote:Bool need_drop_reply:Bool retry_after:double = MessageSendingState; +//@description Describes manually or automatically chosen quote from another message +//@text Text of the quote. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities can be present in the text +//@position Approximate quote position in the original message in UTF-16 code units +//@is_manual True, if the quote was manually chosen by the message sender +textQuote#8675b8b2 text:formattedText position:int32 is_manual:Bool = TextQuote; + +//@description Describes manually chosen quote from another message +//@text Text of the quote; 0-getOption("message_reply_quote_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed to be kept and must be kept in the quote +//@position Quote position in the original message in UTF-16 code units +inputTextQuote#b74a6d1c text:formattedText position:int32 = InputTextQuote; + //@class MessageReplyTo @description Contains information about the message or the story a message is replying to //@description Describes a message replied by a given message //@chat_id The identifier of the chat to which the message belongs; may be 0 if the replied message is in unknown chat //@message_id The identifier of the message; may be 0 if the replied message is in unknown chat -//@quote Manually or automatically chosen quote from the replied message; may be null if none. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities can be present in the quote -//@is_quote_manual True, if the quote was manually chosen by the message sender +//@quote Chosen quote from the replied message; may be null if none //@origin Information about origin of the message if the message was from another chat or topic; may be null for messages from the same chat //@origin_send_date Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat //@content Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. -messageReplyToMessage#1bb65082 chat_id:int53 message_id:int53 quote:formattedText is_quote_manual:Bool origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; +messageReplyToMessage#ee105987 chat_id:int53 message_id:int53 quote:textQuote origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; //@description Describes a story replied by a given message //@story_sender_chat_id The identifier of the sender of the story @@ -1267,8 +1292,8 @@ messageReplyToStory#708ca939 story_sender_chat_id:int53 story_id:int32 = Message //@description Describes a message to be replied //@chat_id The identifier of the chat to which the message to be replied belongs; pass 0 if the message to be replied is in the same chat. Must always be 0 for replies in secret chats. A message can be replied in another chat or topic only if message.can_be_replied_in_another_chat //@message_id The identifier of the message to be replied in the same or the specified chat -//@quote Manually chosen quote from the message to be replied; pass null if none; 0-getOption("message_reply_quote_length_max") characters. Must always be null for replies in secret chats. -inputMessageReplyToMessage#20b16f06 chat_id:int53 message_id:int53 quote:formattedText = InputMessageReplyTo; +//@quote Quote from the message to be replied; pass null if none. Must always be null for replies in secret chats +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 @@ -1326,7 +1351,7 @@ messages#b34c8c60 total_count:int32 messages:vector = Messages; //@description Contains a list of messages found by a search //@total_count Approximate total number of messages found; -1 if unknown //@messages List of messages -//@next_offset The offset for the next request. If empty, there are no more results +//@next_offset The offset for the next request. If empty, then there are no more results foundMessages#2515f708 total_count:int32 messages:vector next_offset:string = FoundMessages; //@description Contains a list of messages found by a search in a given chat @@ -1395,6 +1420,11 @@ messageSourceOther#35c0a702 = MessageSource; //@link An internal link to be opened when the sponsored message is clicked messageSponsorTypeBot#700d2304 bot_user_id:int53 link:InternalLinkType = MessageSponsorType; +//@description The sponsor is a web app +//@web_app_title Web App title +//@link An internal link to be opened when the sponsored message is clicked +messageSponsorTypeWebApp#25b74fb8 web_app_title:string link:InternalLinkType = MessageSponsorType; + //@description The sponsor is a public channel chat //@chat_id Sponsor chat identifier //@link An internal link to be opened when the sponsored message is clicked; may be null if the sponsor chat needs to be opened instead @@ -1421,8 +1451,9 @@ messageSponsor#a0b25071 type:MessageSponsorType photo:chatPhotoInfo info:string //@is_recommended True, if the message needs to be labeled as "recommended" instead of "sponsored" //@content Content of the message. Currently, can be only of the type messageText //@sponsor Information about the sponsor of the message +//@button_text If non-empty, text for the message action button //@additional_info If non-empty, additional information about the sponsored message to be shown along with the message -sponsoredMessage#844f0dc message_id:int53 is_recommended:Bool content:MessageContent sponsor:messageSponsor additional_info:string = SponsoredMessage; +sponsoredMessage#147623b4 message_id:int53 is_recommended:Bool content:MessageContent sponsor:messageSponsor button_text:string additional_info:string = SponsoredMessage; //@description Contains a list of sponsored messages //@messages List of sponsored messages @@ -1446,7 +1477,7 @@ downloadedFileCounts#8a572842 active_count:int32 paused_count:int32 completed_co //@description Contains a list of downloaded files, found by a search //@total_counts Total number of suitable files, ignoring offset //@files The list of files -//@next_offset The offset for the next request. If empty, there are no more results +//@next_offset The offset for the next request. If empty, then there are no more results foundFileDownloads#c7db4128 total_counts:downloadedFileCounts files:vector next_offset:string = FoundFileDownloads; //@class NotificationSettingsScope @description Describes the types of chats to which notification settings are relevant @@ -1461,21 +1492,21 @@ notificationSettingsScopeGroupChats#483fd1f3 = NotificationSettingsScope; notificationSettingsScopeChannelChats#20aa0588 = NotificationSettingsScope; //@description Contains information about notification settings for a chat or a forum topic -//@use_default_mute_for If true, mute_for is ignored and the value for the relevant type of chat or the forum chat is used instead +//@use_default_mute_for If true, the value for the relevant type of chat or the forum chat is used instead of mute_for //@mute_for Time left before notifications will be unmuted, in seconds //@use_default_sound If true, the value for the relevant type of chat or the forum chat is used instead of sound_id //@sound_id Identifier of the notification sound to be played for messages; 0 if sound is disabled -//@use_default_show_preview If true, show_preview is ignored and the value for the relevant type of chat or the forum chat is used instead +//@use_default_show_preview If true, the value for the relevant type of chat or the forum chat is used instead of show_preview //@show_preview True, if message content must be displayed in notifications -//@use_default_mute_stories If true, mute_stories is ignored and the value for the relevant type of chat is used instead +//@use_default_mute_stories If true, the value for the relevant type of chat is used instead of mute_stories //@mute_stories True, if story notifications are disabled for the chat //@use_default_story_sound If true, the value for the relevant type of chat is used instead of story_sound_id //@story_sound_id Identifier of the notification sound to be played for stories; 0 if sound is disabled -//@use_default_show_story_sender If true, show_story_sender is ignored and the value for the relevant type of chat is used instead +//@use_default_show_story_sender If true, the value for the relevant type of chat is used instead of show_story_sender //@show_story_sender True, if the sender of stories must be displayed in notifications -//@use_default_disable_pinned_message_notifications If true, disable_pinned_message_notifications is ignored and the value for the relevant type of chat or the forum chat is used instead +//@use_default_disable_pinned_message_notifications If true, the value for the relevant type of chat or the forum chat is used instead of disable_pinned_message_notifications //@disable_pinned_message_notifications If true, notifications for incoming pinned messages will be created as for an ordinary unread message -//@use_default_disable_mention_notifications If true, disable_mention_notifications is ignored and the value for the relevant type of chat or the forum chat is used instead +//@use_default_disable_mention_notifications If true, the value for the relevant type of chat or the forum chat is used instead of disable_mention_notifications //@disable_mention_notifications If true, notifications for messages with mentions will be created as for an ordinary unread message chatNotificationSettings#dddc12cf use_default_mute_for:Bool mute_for:int32 use_default_sound:Bool sound_id:int64 use_default_show_preview:Bool show_preview:Bool use_default_mute_stories:Bool mute_stories:Bool use_default_story_sound:Bool story_sound_id:int64 use_default_show_story_sender:Bool show_story_sender:Bool use_default_disable_pinned_message_notifications:Bool disable_pinned_message_notifications:Bool use_default_disable_mention_notifications:Bool disable_mention_notifications:Bool = ChatNotificationSettings; @@ -1483,8 +1514,8 @@ chatNotificationSettings#dddc12cf use_default_mute_for:Bool mute_for:int32 use_d //@mute_for Time left before notifications will be unmuted, in seconds //@sound_id Identifier of the notification sound to be played; 0 if sound is disabled //@show_preview True, if message content must be displayed in notifications -//@use_default_mute_stories If true, mute_stories is ignored and story notifications are received only for the first 5 chats from topChatCategoryUsers -//@mute_stories True, if story notifications are disabled for the chat +//@use_default_mute_stories If true, story notifications are received only for the first 5 chats from topChatCategoryUsers regardless of the value of mute_stories +//@mute_stories True, if story notifications are disabled //@story_sound_id Identifier of the notification sound to be played for stories; 0 if sound is disabled //@show_story_sender True, if the sender of stories must be displayed in notifications //@disable_pinned_message_notifications True, if notifications for incoming pinned messages will be created as for an ordinary unread message @@ -1640,6 +1671,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 //@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 @@ -1661,7 +1693,7 @@ videoChat#ae158d28 group_call_id:int32 has_participants:Bool default_participant //@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat //@draft_message A draft of a message in the chat; may be null if none //@client_data Application-specific data associated with the chat. (For example, the chat scroll position or local chat notification settings can be stored here.) Persistent if the message database is used -chat#5a9e2993 id:int53 type:ChatType title:string photo:chatPhotoInfo accent_color_id:int32 background_custom_emoji_id:int64 permissions:chatPermissions last_message:message positions:vector message_sender_id:MessageSender block_list:BlockList has_protected_content:Bool is_translatable:Bool is_marked_as_unread:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 background:chatBackground theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; +chat#4dd64d7d id:int53 type:ChatType title:string photo:chatPhotoInfo accent_color_id:int32 background_custom_emoji_id:int64 permissions:chatPermissions last_message:message positions:vector message_sender_id:MessageSender block_list:BlockList has_protected_content:Bool is_translatable:Bool is_marked_as_unread:Bool view_as_topics:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 background:chatBackground theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; //@description Represents a list of chats //@total_count Approximate total number of chats found @@ -2790,7 +2822,7 @@ inputPassportElementError#11084de2 type:PassportElementType message:string sourc //@description A text message //@text Text of the message //@web_page A link preview attached to the message; may be null -//@link_preview_options Options which was used for generation of the link preview; may be null if default options were used +//@link_preview_options Options which were used for generation of the link preview; may be null if default options were used messageText#c13562aa text:formattedText web_page:webPage link_preview_options:linkPreviewOptions = MessageContent; //@description An animation message (GIF-style). @@ -2980,7 +3012,8 @@ messageScreenshotTaken#a2b86dab = MessageContent; //@description A new background was set in the chat //@old_background_message_id Identifier of the message with a previously set same background; 0 if none. Can be an identifier of a deleted message //@background The new background -messageChatSetBackground#81819731 old_background_message_id:int53 background:chatBackground = MessageContent; +//@only_for_self True, if the background was set only for self +messageChatSetBackground#3d5d7c40 old_background_message_id:int53 background:chatBackground only_for_self:Bool = MessageContent; //@description A theme in the chat has been changed //@theme_name If non-empty, name of a new theme, set for the chat. Otherwise, chat theme was reset to the default one @@ -3075,6 +3108,12 @@ messagePremiumGiveawayCreated#270f2c44 = MessageContent; //@sticker A sticker to be shown in the message; may be null if unknown messagePremiumGiveaway#4aa0d0b0 parameters:premiumGiveawayParameters winner_count:int32 month_count:int32 sticker:sticker = MessageContent; +//@description A Telegram Premium giveaway has been completed for the chat +//@giveaway_message_id Identifier of the message with the giveaway, can be an identifier of a deleted message +//@winner_count Number of winners in the giveaway +//@unclaimed_prize_count Number of undistributed prizes +messagePremiumGiveawayCompleted#80533949 giveaway_message_id:int53 winner_count:int32 unclaimed_prize_count:int32 = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered#a678fcff = MessageContent; @@ -3585,7 +3624,7 @@ storyViewer#cf0fb132 user_id:int53 view_date:int32 block_list:BlockList chosen_r //@total_count Approximate total number of story viewers found //@total_reaction_count Approximate total number of reactions set by found story viewers //@viewers List of story viewers -//@next_offset The offset for the next request. If empty, there are no more results +//@next_offset The offset for the next request. If empty, then there are no more results storyViewers#9ae27d98 total_count:int32 total_reaction_count:int32 viewers:vector next_offset:string = StoryViewers; //@description Describes position of a clickable rectangle area on a story media @@ -3697,6 +3736,22 @@ storyListMain#d7eeb3ff = StoryList; //@description The list of stories, shown in the Arvhive chat list storyListArchive#fd80a741 = StoryList; +//@class StoryOrigin @description Contains information about the origin of a story that was reposted + +//@description The original story was a public story with known sender +//@chat_id Identifier of the chat that posted original story +//@story_id Story identifier of the original story +storyOriginPublicStory#2c379fbe chat_id:int53 story_id:int32 = StoryOrigin; + +//@description The original story was sent by an unknown user +//@sender_name Name of the story sender +storyOriginHiddenUser#5a1f89ec sender_name:string = StoryOrigin; + +//@description Contains information about original story that was reposted +//@origin Origin of the story that was reposted +//@is_content_modified True, if story content was modified during reposting; otherwise, story wasn't modified +storyRepostInfo#ff7fa440 origin:StoryOrigin is_content_modified:Bool = StoryRepostInfo; + //@description Contains information about interactions with a story //@view_count Number of times the story was viewed //@forward_count Number of times the story was forwarded; 0 if none or unknown @@ -3718,21 +3773,28 @@ storyInteractionInfo#e1557fc7 view_count:int32 forward_count:int32 reaction_coun //@can_be_forwarded True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden //@can_be_replied True, if the story can be replied in the chat with the story sender //@can_toggle_is_pinned True, if the story's is_pinned value can be changed +//@can_get_statistics True, if the story statistics are available through getStoryStatistics //@can_get_viewers True, if users viewed the story can be received through getStoryViewers //@has_expired_viewers True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago +//@repost_info Information about the original story; may be null if the story wasn't reposted //@interaction_info Information about interactions with the story; may be null if the story isn't owned or there were no interactions //@chosen_reaction_type Type of the chosen reaction; may be null if none //@privacy_settings Privacy rules affecting story visibility; may be approximate for non-owned stories //@content Content of the story //@areas Clickable areas to be shown on the story content //@caption Caption of the story -story#627556b4 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_viewers:Bool has_expired_viewers:Bool interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; +story#29dd2b0d 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_viewers: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 //@stories The list of stories stories#5a860711 total_count:int32 stories:vector = Stories; +//@description Contains identifier of a story along with identifier of its sender +//@sender_chat_id Identifier of the chat that posted the story +//@story_id Unique story identifier among stories of the given sender +storyFullId#701d31f5 sender_chat_id:int53 story_id:int32 = StoryFullId; + //@description Contains basic information about a story //@story_id Unique story identifier among stories of the given sender //@date Point in time (Unix timestamp) when the story was published @@ -3747,6 +3809,22 @@ storyInfo#8997c352 story_id:int32 date:int32 is_for_close_friends:Bool = StoryIn //@stories Basic information about the stories; use getStory to get full information about the stories. The stories are in a chronological order (i.e., in order of increasing story identifiers) chatActiveStories#d923d773 chat_id:int53 list:StoryList order:int53 max_read_story_id:int32 stories:vector = ChatActiveStories; +//@class StoryPublicForward @description Describes a public forward or repost of a story + +//@description Contains a public forward of a story as a message +//@message Information about the message with the story +storyPublicForwardMessage#fd39c20c message:message = StoryPublicForward; + +//@description Contains a public repost of a story as a story +//@story Information about the reposted story +storyPublicForwardStory#f7e6c146 story:story = StoryPublicForward; + +//@description Represents a list of public forwards and reposts of a story +//@total_count Approximate total number of messages and stories found +//@forwards List of found public forwards and reposts +//@next_offset The offset for the next request. If empty, then there are no more results +storyPublicForwards#fcacb389 total_count:int32 forwards:vector next_offset:string = StoryPublicForwards; + //@class ChatBoostSource @description Describes source of a chat boost //@description The chat created a Telegram Premium gift code for a user @@ -3796,7 +3874,7 @@ chatBoost#96bfccb2 id:string count:int32 source:ChatBoostSource start_date:int32 //@description Contains a list of boosts applied to a chat //@total_count Total number of boosts applied to the chat //@boosts List of boosts -//@next_offset The offset for the next request. If empty, there are no more results +//@next_offset The offset for the next request. If empty, then there are no more results foundChatBoosts#dc80d52e total_count:int32 boosts:vector next_offset:string = FoundChatBoosts; //@description Describes a slot for chat boost @@ -4052,7 +4130,7 @@ addedReaction#4b04819d type:ReactionType sender_id:MessageSender is_outgoing:Boo //@description Represents a list of reactions added to a message //@total_count The total number of found reactions //@reactions The list of added reactions -//@next_offset The offset for the next request. If empty, there are no more results +//@next_offset The offset for the next request. If empty, then there are no more results addedReactions#77bf7590 total_count:int32 reactions:vector next_offset:string = AddedReactions; //@description Represents an available reaction @@ -4064,7 +4142,7 @@ availableReaction#f9024387 type:ReactionType needs_premium:Bool = AvailableReact //@top_reactions List of reactions to be shown at the top //@recent_reactions List of recently used reactions //@popular_reactions List of popular reactions -//@allow_custom_emoji True, if custom emoji reactions could be added by Telegram Premium subscribers +//@allow_custom_emoji True, if any custom emoji reaction can be added by Telegram Premium subscribers availableReactions#d5568da9 top_reactions:vector recent_reactions:vector popular_reactions:vector allow_custom_emoji:Bool = AvailableReactions; //@description Contains information about a emoji reaction @@ -4409,7 +4487,7 @@ inlineQueryResultsButton#d0df08ae text:string type:InlineQueryResultsButtonType //@inline_query_id Unique identifier of the inline query //@button Button to be shown above inline query results; may be null //@results Results of the query -//@next_offset The offset for the next request. If empty, there are no more results +//@next_offset The offset for the next request. If empty, then there are no more results inlineQueryResults#ffd17579 inline_query_id:int64 button:inlineQueryResultsButton results:vector next_offset:string = InlineQueryResults; //@class CallbackQueryPayload @description Represents a payload of a callback query @@ -4529,7 +4607,7 @@ chatEventLocationChanged#e7cdfd4e old_location:chatLocation new_location:chatLoc //@new_message_auto_delete_time New value of message_auto_delete_time chatEventMessageAutoDeleteTimeChanged#1083f24 old_message_auto_delete_time:int32 new_message_auto_delete_time:int32 = ChatEventAction; -//@description The chat permissions was changed +//@description The chat permissions were changed //@old_permissions Previous chat permissions //@new_permissions New chat permissions chatEventPermissionsChanged#b1d337a8 old_permissions:chatPermissions new_permissions:chatPermissions = ChatEventAction; @@ -4786,6 +4864,9 @@ premiumLimitTypeStoryCaptionLength#bed53302 = PremiumLimitType; //@description The maximum number of suggested reaction areas on a story premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807 = PremiumLimitType; +//@description The maximum number of received similar chats +premiumLimitTypeSimilarChatCount#a2ce1f11 = PremiumLimitType; + //@class PremiumFeature @description Describes a feature available to Premium users //@description Increased limits @@ -4839,9 +4920,12 @@ premiumFeatureUpgradedStories#9008051b = PremiumFeature; //@description The ability to boost chats premiumFeatureChatBoost#5df89f1b = PremiumFeature; -//@description The ability to choose accent color +//@description The ability to choose accent color for replies and user profile premiumFeatureAccentColor#361ac59e = PremiumFeature; +//@description The ability to set private chat background for both users +premiumFeatureBackgroundForBoth#2246eefa = 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 @@ -5161,15 +5245,15 @@ resetPasswordResultDeclined#b857e0cb retry_date:int32 = ResetPasswordResult; //@class MessageFileType @description Contains information about a file with messages exported from another app -//@description The messages was exported from a private chat +//@description The messages were exported from a private chat //@name Name of the other party; may be empty if unrecognized messageFileTypePrivate#e0e44ed4 name:string = MessageFileType; -//@description The messages was exported from a group chat +//@description The messages were exported from a group chat //@title Title of the group chat; may be empty if unrecognized messageFileTypeGroup#f2e58f68 title:string = MessageFileType; -//@description The messages was exported from a chat of unknown type +//@description The messages were exported from a chat of unknown type messageFileTypeUnknown#461dbab2 = MessageFileType; //@class PushMessageContent @description Contains content of a push message notification @@ -6087,16 +6171,16 @@ autosaveSettings#c0d11a28 private_chat_settings:scopeAutosaveSettings group_sett //@class ConnectionState @description Describes the current state of the connection to Telegram servers -//@description Currently waiting for the network to become available. Use setNetworkType to change the available network type +//@description Waiting for the network to become available. Use setNetworkType to change the available network type connectionStateWaitingForNetwork#650dd758 = ConnectionState; -//@description Currently establishing a connection with a proxy server +//@description Establishing a connection with a proxy server connectionStateConnectingToProxy#fa721359 = ConnectionState; -//@description Currently establishing a connection to the Telegram servers +//@description Establishing a connection to the Telegram servers connectionStateConnecting#b29bfa62 = ConnectionState; -//@description Downloading data received while the application was offline +//@description Downloading data supposed to be received while the application was offline connectionStateUpdating#f4c9c2b7 = ConnectionState; //@description There is a working connection to the Telegram servers @@ -6285,11 +6369,22 @@ statisticalGraphAsync#19fb2b9f token:string = StatisticalGraph; //@error_message The error message statisticalGraphError#c3fda052 error_message:string = StatisticalGraph; -//@description Contains statistics about interactions with a message +//@class ChatStatisticsObjectType @description Describes type of an object, for which statistics are provided + +//@description Describes a message sent in the chat //@message_id Message identifier -//@view_count Number of times the message was viewed -//@forward_count Number of times the message was forwarded -chatStatisticsMessageInteractionInfo#d25e2a2c message_id:int53 view_count:int32 forward_count:int32 = ChatStatisticsMessageInteractionInfo; +chatStatisticsObjectTypeMessage#6f9f24f6 message_id:int53 = ChatStatisticsObjectType; + +//@description Describes a story sent by the chat +//@story_id Story identifier +chatStatisticsObjectTypeStory#15baf9b0 story_id:int32 = ChatStatisticsObjectType; + +//@description Contains statistics about interactions with a message sent in the chat or a story sent by the chat +//@object_type Type of the object +//@view_count Number of times the object was viewed +//@forward_count Number of times the object was forwarded +//@reaction_count Number of times reactions were added to the object +chatStatisticsInteractionInfo#694a9a8d object_type:ChatStatisticsObjectType view_count:int32 forward_count:int32 reaction_count:int32 = ChatStatisticsInteractionInfo; //@description Contains statistics about messages sent by a user //@user_id User identifier @@ -6333,8 +6428,12 @@ chatStatisticsSupergroup#c67549ef period:dateRange member_count:statisticalValue //@description A detailed statistics about a channel chat //@period A period to which the statistics applies //@member_count Number of members in the chat -//@mean_view_count Mean number of times the recently sent messages was viewed -//@mean_share_count Mean number of times the recently sent messages was shared +//@mean_message_view_count Mean number of times the recently sent messages were viewed +//@mean_message_share_count Mean number of times the recently sent messages were shared +//@mean_message_reaction_count Mean number of times reactions were added to the recently sent messages +//@mean_story_view_count Mean number of times the recently sent stories were viewed +//@mean_story_share_count Mean number of times the recently sent stories were shared +//@mean_story_reaction_count Mean number of times reactions were added to the recently sent stories //@enabled_notifications_percentage A percentage of users with enabled notifications for the chat; 0-100 //@member_count_graph A graph containing number of members in the chat //@join_graph A graph containing number of members joined and left the chat @@ -6344,13 +6443,22 @@ chatStatisticsSupergroup#c67549ef period:dateRange member_count:statisticalValue //@join_by_source_graph A graph containing number of new member joins per source //@language_graph A graph containing number of users viewed chat messages per language //@message_interaction_graph A graph containing number of chat message views and shares +//@message_reaction_graph A graph containing number of reactions on messages +//@story_interaction_graph A graph containing number of story views and shares +//@story_reaction_graph A graph containing number of reactions on stories //@instant_view_interaction_graph A graph containing number of views of associated with the chat instant views -//@recent_message_interactions Detailed statistics about number of views and shares of recently sent messages -chatStatisticsChannel#9be23786 period:dateRange member_count:statisticalValue mean_view_count:statisticalValue mean_share_count:statisticalValue enabled_notifications_percentage:double member_count_graph:StatisticalGraph join_graph:StatisticalGraph mute_graph:StatisticalGraph view_count_by_hour_graph:StatisticalGraph view_count_by_source_graph:StatisticalGraph join_by_source_graph:StatisticalGraph language_graph:StatisticalGraph message_interaction_graph:StatisticalGraph instant_view_interaction_graph:StatisticalGraph recent_message_interactions:vector = ChatStatistics; +//@recent_interactions Detailed statistics about number of views and shares of recently sent messages and stories +chatStatisticsChannel#b8e95b4 period:dateRange member_count:statisticalValue mean_message_view_count:statisticalValue mean_message_share_count:statisticalValue mean_message_reaction_count:statisticalValue mean_story_view_count:statisticalValue mean_story_share_count:statisticalValue mean_story_reaction_count:statisticalValue enabled_notifications_percentage:double member_count_graph:StatisticalGraph join_graph:StatisticalGraph mute_graph:StatisticalGraph view_count_by_hour_graph:StatisticalGraph view_count_by_source_graph:StatisticalGraph join_by_source_graph:StatisticalGraph language_graph:StatisticalGraph message_interaction_graph:StatisticalGraph message_reaction_graph:StatisticalGraph story_interaction_graph:StatisticalGraph story_reaction_graph:StatisticalGraph instant_view_interaction_graph:StatisticalGraph recent_interactions:vector = ChatStatistics; //@description A detailed statistics about a message //@message_interaction_graph A graph containing number of message views and shares -messageStatistics#c3b781b0 message_interaction_graph:StatisticalGraph = MessageStatistics; +//@message_reaction_graph A graph containing number of message reactions +messageStatistics#a2ce4f07 message_interaction_graph:StatisticalGraph message_reaction_graph:StatisticalGraph = MessageStatistics; + +//@description A detailed statistics about a story +//@story_interaction_graph A graph containing number of story views and shares +//@story_reaction_graph A graph containing number of story reactions +storyStatistics#46448b6b story_interaction_graph:StatisticalGraph story_reaction_graph:StatisticalGraph = StoryStatistics; //@description A point on a Cartesian plane //@x The point's first coordinate @@ -6494,7 +6602,7 @@ updateChatAccentColor#fc111634 chat_id:int53 accent_color_id:int32 = Update; //@background_custom_emoji_id The new identifier of a custom emoji to be shown on the reply header background; 0 if none updateChatBackgroundCustomEmoji#dcbad97a chat_id:int53 background_custom_emoji_id:int64 = Update; -//@description Chat permissions was changed +//@description Chat permissions were changed //@chat_id Chat identifier //@permissions The new chat permissions updateChatPermissions#9f52176d chat_id:int53 permissions:chatPermissions = Update; @@ -6607,6 +6715,11 @@ updateChatIsTranslatable#7b031617 chat_id:int53 is_translatable:Bool = Update; //@is_marked_as_unread New value of is_marked_as_unread updateChatIsMarkedAsUnread#57853334 chat_id:int53 is_marked_as_unread:Bool = Update; +//@description A chat default appearance has changed +//@chat_id Chat identifier +//@view_as_topics New value of view_as_topics +updateChatViewAsTopics#5bff163d chat_id:int53 view_as_topics:Bool = Update; + //@description A chat was blocked or unblocked //@chat_id Chat identifier //@block_list Block list to which the chat is added; may be null if none @@ -6653,7 +6766,7 @@ updateNotification#8ee67ed4 notification_group_id:int32 notification:notificatio //@removed_notification_ids Identifiers of removed group notifications, sorted by notification identifier updateNotificationGroup#96cd9e06 notification_group_id:int32 type:NotificationGroupType chat_id:int53 notification_settings_chat_id:int53 notification_sound_id:int64 total_count:int32 added_notifications:vector removed_notification_ids:vector = Update; -//@description Contains active notifications that was shown on previous application launches. This update is sent only if the message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update +//@description Contains active notifications that were shown on previous application launches. This update is sent only if the message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update //@groups Lists of active notification groups updateActiveNotifications#317d80f2 groups:vector = Update; @@ -6859,7 +6972,7 @@ updateFavoriteStickers#113f2b6a sticker_ids:vector = Update; //@animation_ids The new list of file identifiers of saved animations updateSavedAnimations#1084a1c8 animation_ids:vector = Update; -//@description The list of saved notifications sounds was updated. This update may not be sent until information about a notification sound was requested for the first time +//@description The list of saved notification sounds was updated. This update may not be sent until information about a notification sound was requested for the first time //@notification_sound_ids The new list of identifiers of saved notification sounds updateSavedNotificationSounds#5a6653b4 notification_sound_ids:vector = Update; @@ -6877,6 +6990,11 @@ updateChatThemes#98dc58d5 chat_themes:vector = Update; //@available_accent_color_ids The list of accent color identifiers, which can be set through setAccentColor and setChatAccentColor. The colors must be shown in the specififed order updateAccentColors#1316555e colors:vector available_accent_color_ids:vector = Update; +//@description The list of supported accent colors for user profiles has changed +//@colors Information about supported colors +//@available_accent_color_ids The list of accent color identifiers, which can be set through setProfileAccentColor. The colors must be shown in the specififed order +updateProfileAccentColors#bf8e7430 colors:vector available_accent_color_ids:vector = Update; + //@description Some language pack strings have been updated //@localization_target Localization target to which the language pack belongs //@language_pack_id Identifier of the updated language pack @@ -6916,6 +7034,13 @@ updateActiveEmojiReactions#691ffcb7 emojis:vector = Update; //@reaction_type The new type of the default reaction updateDefaultReactionType#4b615105 reaction_type:ReactionType = 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 +//@weekly_count The total number of allowed speech recognitions per week; 0 if none +//@left_count Number of left speech recognition attempts this week +//@next_reset_date Point in time (Unix timestamp) when the weekly number of tries will reset; 0 if unknown +updateSpeechRecognitionTrial#ff4efcc1 max_media_duration:int32 weekly_count:int32 left_count:int32 next_reset_date:int32 = Update; + //@description The list of supported dice emojis has changed //@emojis The new list of supported dice emojis updateDiceEmojis#9d0f91df emojis:vector = Update; @@ -7020,7 +7145,7 @@ updatePollAnswer#b67ac547 poll_id:int64 voter_id:MessageSender option_ids:vector //@description User rights changed in a chat; for bots only //@chat_id Chat identifier //@actor_user_id Identifier of the user, changing the rights -//@date Point in time (Unix timestamp) when the user rights was changed +//@date Point in time (Unix timestamp) when the user rights were changed //@invite_link If user has joined the chat using an invite link, the invite link; may be null //@via_chat_folder_invite_link True, if the user has joined the chat using an invite link for a chat folder //@old_chat_member Previous chat member @@ -7382,6 +7507,15 @@ searchChatsOnServer#baf42f74 query:string limit:int32 = Chats; //@location Current user location searchChatsNearby#f445c81f location:location = ChatsNearby; +//@description Returns a list of chats similar to the given chat +//@chat_id Identifier of the target chat; must be an identifier of a channel chat +getChatSimilarChats#bb508f83 chat_id:int53 = Chats; + +//@description Returns approximate number of chats similar to the given chat +//@chat_id Identifier of the target chat; must be an identifier of a channel chat +//@return_local Pass true to get the number of chats without sending network requests, or -1 if the number of chats is unknown locally +getChatSimilarChatCount#463e968e chat_id:int53 return_local:Bool = Count; + //@description Returns a list of frequently used chats //@category Category of chats to be returned //@limit The maximum number of chats to be returned; up to 30 @@ -7598,7 +7732,7 @@ translateText#252264f2 text:formattedText to_language_code:string = FormattedTex //@to_language_code Language code of the language to which the message is translated. Must be one of translateMessageText#53c51ed2 chat_id:int53 message_id:int53 to_language_code:string = FormattedText; -//@description Recognizes speech in a video note or a voice note message. The message must be successfully sent and must not be scheduled +//@description Recognizes speech in a video note or a voice note message. The message must be successfully sent, must not be scheduled, and must be from a non-secret chat //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message recognizeSpeech#67d402b9 chat_id:int53 message_id:int53 = Ok; @@ -7665,7 +7799,7 @@ forwardMessages#34de5b20 chat_id:int53 message_thread_id:int53 from_chat_id:int5 //@chat_id Identifier of the chat to send messages //@message_ids Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order //@quote New manually chosen quote from the message to be replied; pass null if none. Ignored if more than one message is re-sent, or if messageSendingStateFailed.need_another_reply_quote == false -resendMessages#4a0c68af chat_id:int53 message_ids:vector quote:formattedText = Messages; +resendMessages#90e36776 chat_id:int53 message_ids:vector quote:inputTextQuote = Messages; //@description Adds a local message to a chat. The message is persistent across application restarts only if the message database is used. Returns the added message //@chat_id Target chat @@ -8340,12 +8474,18 @@ setChatMessageAutoDeleteTime#a641b4ff chat_id:int53 message_auto_delete_time:int //@permissions New non-administrator members permissions in the chat setChatPermissions#7f7706fe chat_id:int53 permissions:chatPermissions = Ok; -//@description Changes the background in a specific chat. Supported only in private and secret chats with non-deleted users +//@description Sets the background in a specific chat. Supported only in private and secret chats with non-deleted users //@chat_id Chat identifier -//@background The input background to use; pass null to create a new filled background or to remove the current background -//@type Background type; pass null to remove the current background +//@background The input background to use; pass null to create a new filled background +//@type Background type; pass null to use default background type for the chosen background //@dark_theme_dimming Dimming of the background in dark themes, as a percentage; 0-100 -setChatBackground#3d3f1b28 chat_id:int53 background:InputBackground type:BackgroundType dark_theme_dimming:int32 = Ok; +//@only_for_self Pass true to set background only for self; pass false to set background for both chat users. Background can be set for both users only by Telegram Premium users and if set background isn't of the type inputBackgroundPrevious +setChatBackground#eb4c3fe chat_id:int53 background:InputBackground type:BackgroundType dark_theme_dimming:int32 only_for_self:Bool = Ok; + +//@description Deletes background in a specific chat +//@chat_id Chat identifier +//@restore_previous Pass true to restore previously set background. Can be used only in private and secret chats with non-deleted users if userFullInfo.set_chat_background == true. +deleteChatBackground#1316e678 chat_id:int53 restore_previous:Bool = Ok; //@description Changes the chat theme. Supported only in private and secret chats //@chat_id Chat identifier @@ -8368,7 +8508,12 @@ 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 translatable state of a chat; for Telegram Premium users only +//@description Changes the view_as_topics setting of a forum chat +//@chat_id Chat identifier +//@view_as_topics New value of view_as_topics +toggleChatViewAsTopics#2b2783dc chat_id:int53 view_as_topics:Bool = Ok; + +//@description Changes the translatable state of a chat //@chat_id Chat identifier //@is_translatable New value of is_translatable toggleChatIsTranslatable#93f9cbdf chat_id:int53 is_translatable:Bool = Ok; @@ -8385,7 +8530,7 @@ toggleChatDefaultDisableNotification#12c36012 chat_id:int53 default_disable_noti //@description Changes reactions, available in a chat. Available for basic groups, supergroups, and channels. Requires can_change_info administrator right //@chat_id Identifier of the chat -//@available_reactions Reactions available in the chat. All emoji reactions must be active +//@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 setChatAvailableReactions#feb3e06 chat_id:int53 available_reactions:ChatAvailableReactions = Ok; //@description Changes application-specific data associated with a chat @@ -8562,9 +8707,10 @@ canSendStory#b6e0216b chat_id:int53 = CanSendStoryResult; //@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 //@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 //@protect_content Pass true if the content of the story must be protected from forwarding and screenshotting -sendStory#53242a4 chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 is_pinned:Bool protect_content:Bool = Story; +sendStory#736858bb chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 from_story_full_id:storyFullId is_pinned:Bool protect_content:Bool = Story; //@description Changes content and caption 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 @@ -8659,6 +8805,13 @@ reportStory#9b5f709b story_sender_chat_id:int53 story_id:int32 reason:ReportReas //@description Activates stealth mode for stories, which hides all views of stories from the current user in the last "story_stealth_mode_past_period" seconds activateStoryStealthMode#c3db8491 = Ok; +//@description Returns forwards of a story as a message to public chats and reposts by public channels. Can be used only if the story is posted on behalf of the current user or story.can_get_statistics == true. +//@story_sender_chat_id The identifier of the sender of the story +//@story_id The identifier of the story +//@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 messages and stories to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit +getStoryPublicForwards#8b835be9 story_sender_chat_id:int53 story_id:int32 offset:string limit:int32 = StoryPublicForwards; + //@description Returns the list of available chat boost slots for the current user getAvailableChatBoostSlots#7307ebd5 = ChatBoostSlots; @@ -9246,9 +9399,10 @@ searchStickerSet#45049cee name:string = StickerSet; //@limit The maximum number of sticker sets to return searchInstalledStickerSets#7e5e7fa4 sticker_type:StickerType query:string limit:int32 = StickerSets; -//@description Searches for ordinary sticker sets by looking for specified query in their title and name. Excludes installed sticker sets from the results +//@description Searches for sticker sets by looking for specified query in their title and name. Excludes installed sticker sets from the results +//@sticker_type Type of the sticker sets to return //@query Query to search for -searchStickerSets#bf7d307b query:string = StickerSets; +searchStickerSets#faa066c sticker_type:StickerType query:string = StickerSets; //@description Installs/uninstalls or activates/archives a sticker set //@set_id Identifier of the sticker set @@ -9376,6 +9530,11 @@ deleteProfilePhoto#4eaa77c1 profile_photo_id:int64 = Ok; //@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header background; 0 if none setAccentColor#6389cb39 accent_color_id:int32 background_custom_emoji_id:int64 = Ok; +//@description Changes accent color and background custom emoji for profile of the current user; for Telegram Premium users only +//@profile_accent_color_id Identifier of the accent color to use for profile; pass -1 if none +//@profile_background_custom_emoji_id Identifier of a custom emoji to be shown in the on the user's profile photo background; 0 if none +setProfileAccentColor#899bc168 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 = Ok; + //@description Changes the first and last name of the current user //@first_name The new value of the first name for the current user; 1-64 characters //@last_name The new value of the optional last name for the current user; 0-64 characters @@ -9855,6 +10014,12 @@ getMessageStatistics#4bb5a1d8 chat_id:int53 message_id:int53 is_dark:Bool = Mess //@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit getMessagePublicForwards#6006a949 chat_id:int53 message_id:int53 offset:string limit:int32 = FoundMessages; +//@description Returns detailed statistics about a story. Can be used only if story.can_get_statistics == true +//@chat_id Chat identifier +//@story_id Story identifier +//@is_dark Pass true if a dark theme is used by the application +getStoryStatistics#3a964342 chat_id:int53 story_id:int32 is_dark:Bool = StoryStatistics; + //@description Loads an asynchronous or a zoomed in statistical graph //@chat_id Chat identifier //@token The token for graph loading diff --git a/tdapi/tl_added_reactions_gen.go b/tdapi/tl_added_reactions_gen.go index 896680c51b..e0faa8677c 100644 --- a/tdapi/tl_added_reactions_gen.go +++ b/tdapi/tl_added_reactions_gen.go @@ -37,7 +37,7 @@ type AddedReactions struct { TotalCount int32 // The list of added reactions Reactions []AddedReaction - // The offset for the next request. If empty, there are no more results + // The offset for the next request. If empty, then there are no more results NextOffset string } diff --git a/tdapi/tl_available_reactions_gen.go b/tdapi/tl_available_reactions_gen.go index dbf545d7f2..1640392c28 100644 --- a/tdapi/tl_available_reactions_gen.go +++ b/tdapi/tl_available_reactions_gen.go @@ -39,7 +39,7 @@ type AvailableReactions struct { RecentReactions []AvailableReaction // List of popular reactions PopularReactions []AvailableReaction - // True, if custom emoji reactions could be added by Telegram Premium subscribers + // True, if any custom emoji reaction can be added by Telegram Premium subscribers AllowCustomEmoji bool } diff --git a/tdapi/tl_chat_gen.go b/tdapi/tl_chat_gen.go index 97a2c05a01..ab8fc3ae4e 100644 --- a/tdapi/tl_chat_gen.go +++ b/tdapi/tl_chat_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// Chat represents TL type `chat#5a9e2993`. +// Chat represents TL type `chat#4dd64d7d`. type Chat struct { // Chat unique identifier ID int64 @@ -64,6 +64,9 @@ type Chat struct { IsTranslatable bool // 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 + ViewAsTopics bool // True, if the chat has scheduled messages HasScheduledMessages bool // True, if the chat messages can be deleted only for the current user while other users @@ -118,7 +121,7 @@ type Chat struct { } // ChatTypeID is TL type id of Chat. -const ChatTypeID = 0x5a9e2993 +const ChatTypeID = 0x4dd64d7d // Ensuring interfaces in compile-time for Chat. var ( @@ -174,6 +177,9 @@ func (c *Chat) Zero() bool { if !(c.IsMarkedAsUnread == false) { return false } + if !(c.ViewAsTopics == false) { + return false + } if !(c.HasScheduledMessages == false) { return false } @@ -329,6 +335,10 @@ func (c *Chat) TypeInfo() tdp.Type { Name: "IsMarkedAsUnread", SchemaName: "is_marked_as_unread", }, + { + Name: "ViewAsTopics", + SchemaName: "view_as_topics", + }, { Name: "HasScheduledMessages", SchemaName: "has_scheduled_messages", @@ -420,7 +430,7 @@ func (c *Chat) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *Chat) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chat#5a9e2993 as nil") + return fmt.Errorf("can't encode chat#4dd64d7d as nil") } b.PutID(ChatTypeID) return c.EncodeBare(b) @@ -429,48 +439,49 @@ func (c *Chat) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *Chat) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chat#5a9e2993 as nil") + return fmt.Errorf("can't encode chat#4dd64d7d as nil") } b.PutInt53(c.ID) if c.Type == nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field type is nil") + return fmt.Errorf("unable to encode chat#4dd64d7d: field type is nil") } if err := c.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field type: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field type: %w", err) } b.PutString(c.Title) if err := c.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field photo: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field photo: %w", err) } b.PutInt32(c.AccentColorID) b.PutLong(c.BackgroundCustomEmojiID) if err := c.Permissions.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field permissions: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field permissions: %w", err) } if err := c.LastMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field last_message: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field last_message: %w", err) } b.PutInt(len(c.Positions)) for idx, v := range c.Positions { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chat#5a9e2993: field positions element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare chat#4dd64d7d: field positions element with index %d: %w", idx, err) } } if c.MessageSenderID == nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field message_sender_id is nil") + return fmt.Errorf("unable to encode chat#4dd64d7d: field message_sender_id is nil") } if err := c.MessageSenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field message_sender_id: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field message_sender_id: %w", err) } if c.BlockList == nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field block_list is nil") + return fmt.Errorf("unable to encode chat#4dd64d7d: field block_list is nil") } if err := c.BlockList.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field block_list: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field block_list: %w", err) } b.PutBool(c.HasProtectedContent) b.PutBool(c.IsTranslatable) b.PutBool(c.IsMarkedAsUnread) + b.PutBool(c.ViewAsTopics) b.PutBool(c.HasScheduledMessages) b.PutBool(c.CanBeDeletedOnlyForSelf) b.PutBool(c.CanBeDeletedForAllUsers) @@ -482,34 +493,34 @@ func (c *Chat) EncodeBare(b *bin.Buffer) error { b.PutInt32(c.UnreadMentionCount) b.PutInt32(c.UnreadReactionCount) if err := c.NotificationSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field notification_settings: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field notification_settings: %w", err) } if c.AvailableReactions == nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field available_reactions is nil") + return fmt.Errorf("unable to encode chat#4dd64d7d: field available_reactions is nil") } if err := c.AvailableReactions.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field available_reactions: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field available_reactions: %w", err) } b.PutInt32(c.MessageAutoDeleteTime) if err := c.Background.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field background: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field background: %w", err) } b.PutString(c.ThemeName) if c.ActionBar == nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field action_bar is nil") + return fmt.Errorf("unable to encode chat#4dd64d7d: field action_bar is nil") } if err := c.ActionBar.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field action_bar: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field action_bar: %w", err) } if err := c.VideoChat.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field video_chat: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field video_chat: %w", err) } if err := c.PendingJoinRequests.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field pending_join_requests: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field pending_join_requests: %w", err) } b.PutInt53(c.ReplyMarkupMessageID) if err := c.DraftMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field draft_message: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field draft_message: %w", err) } b.PutString(c.ClientData) return nil @@ -518,10 +529,10 @@ func (c *Chat) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (c *Chat) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chat#5a9e2993 to nil") + return fmt.Errorf("can't decode chat#4dd64d7d to nil") } if err := b.ConsumeID(ChatTypeID); err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: %w", err) } return c.DecodeBare(b) } @@ -529,62 +540,62 @@ func (c *Chat) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *Chat) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chat#5a9e2993 to nil") + return fmt.Errorf("can't decode chat#4dd64d7d to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field id: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field id: %w", err) } c.ID = value } { value, err := DecodeChatType(b) if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field type: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field type: %w", err) } c.Type = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field title: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field title: %w", err) } c.Title = value } { if err := c.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field photo: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field photo: %w", err) } } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field accent_color_id: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field accent_color_id: %w", err) } c.AccentColorID = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field background_custom_emoji_id: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field background_custom_emoji_id: %w", err) } c.BackgroundCustomEmojiID = value } { if err := c.Permissions.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field permissions: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field permissions: %w", err) } } { if err := c.LastMessage.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field last_message: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field last_message: %w", err) } } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field positions: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field positions: %w", err) } if headerLen > 0 { @@ -593,7 +604,7 @@ func (c *Chat) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value ChatPosition if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chat#5a9e2993: field positions: %w", err) + return fmt.Errorf("unable to decode bare chat#4dd64d7d: field positions: %w", err) } c.Positions = append(c.Positions, value) } @@ -601,172 +612,179 @@ func (c *Chat) DecodeBare(b *bin.Buffer) error { { value, err := DecodeMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field message_sender_id: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field message_sender_id: %w", err) } c.MessageSenderID = value } { value, err := DecodeBlockList(b) if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field block_list: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field block_list: %w", err) } c.BlockList = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field has_protected_content: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field has_protected_content: %w", err) } c.HasProtectedContent = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field is_translatable: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field is_translatable: %w", err) } c.IsTranslatable = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field is_marked_as_unread: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field is_marked_as_unread: %w", err) } c.IsMarkedAsUnread = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field has_scheduled_messages: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field view_as_topics: %w", err) + } + c.ViewAsTopics = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chat#4dd64d7d: field has_scheduled_messages: %w", err) } c.HasScheduledMessages = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field can_be_deleted_only_for_self: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field can_be_deleted_only_for_self: %w", err) } c.CanBeDeletedOnlyForSelf = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field can_be_deleted_for_all_users: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field can_be_deleted_for_all_users: %w", err) } c.CanBeDeletedForAllUsers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field can_be_reported: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field can_be_reported: %w", err) } c.CanBeReported = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field default_disable_notification: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field default_disable_notification: %w", err) } c.DefaultDisableNotification = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field unread_count: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field unread_count: %w", err) } c.UnreadCount = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field last_read_inbox_message_id: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field last_read_inbox_message_id: %w", err) } c.LastReadInboxMessageID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field last_read_outbox_message_id: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field last_read_outbox_message_id: %w", err) } c.LastReadOutboxMessageID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field unread_mention_count: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field unread_mention_count: %w", err) } c.UnreadMentionCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field unread_reaction_count: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field unread_reaction_count: %w", err) } c.UnreadReactionCount = value } { if err := c.NotificationSettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field notification_settings: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field notification_settings: %w", err) } } { value, err := DecodeChatAvailableReactions(b) if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field available_reactions: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field available_reactions: %w", err) } c.AvailableReactions = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field message_auto_delete_time: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field message_auto_delete_time: %w", err) } c.MessageAutoDeleteTime = value } { if err := c.Background.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field background: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field background: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field theme_name: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field theme_name: %w", err) } c.ThemeName = value } { value, err := DecodeChatActionBar(b) if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field action_bar: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field action_bar: %w", err) } c.ActionBar = value } { if err := c.VideoChat.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field video_chat: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field video_chat: %w", err) } } { if err := c.PendingJoinRequests.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field pending_join_requests: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field pending_join_requests: %w", err) } } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field reply_markup_message_id: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field reply_markup_message_id: %w", err) } c.ReplyMarkupMessageID = value } { if err := c.DraftMessage.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field draft_message: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field draft_message: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field client_data: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field client_data: %w", err) } c.ClientData = value } @@ -776,7 +794,7 @@ func (c *Chat) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chat#5a9e2993 as nil") + return fmt.Errorf("can't encode chat#4dd64d7d as nil") } b.ObjStart() b.PutID("chat") @@ -786,10 +804,10 @@ func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("type") if c.Type == nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field type is nil") + return fmt.Errorf("unable to encode chat#4dd64d7d: field type is nil") } if err := c.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field type: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field type: %w", err) } b.Comma() b.FieldStart("title") @@ -797,7 +815,7 @@ func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("photo") if err := c.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field photo: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field photo: %w", err) } b.Comma() b.FieldStart("accent_color_id") @@ -808,19 +826,19 @@ func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("permissions") if err := c.Permissions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field permissions: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field permissions: %w", err) } b.Comma() b.FieldStart("last_message") if err := c.LastMessage.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field last_message: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field last_message: %w", err) } b.Comma() b.FieldStart("positions") b.ArrStart() for idx, v := range c.Positions { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field positions element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field positions element with index %d: %w", idx, err) } b.Comma() } @@ -829,18 +847,18 @@ func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("message_sender_id") if c.MessageSenderID == nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field message_sender_id is nil") + return fmt.Errorf("unable to encode chat#4dd64d7d: field message_sender_id is nil") } if err := c.MessageSenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field message_sender_id: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field message_sender_id: %w", err) } b.Comma() b.FieldStart("block_list") if c.BlockList == nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field block_list is nil") + return fmt.Errorf("unable to encode chat#4dd64d7d: field block_list is nil") } if err := c.BlockList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field block_list: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field block_list: %w", err) } b.Comma() b.FieldStart("has_protected_content") @@ -852,6 +870,9 @@ func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("is_marked_as_unread") b.PutBool(c.IsMarkedAsUnread) b.Comma() + b.FieldStart("view_as_topics") + b.PutBool(c.ViewAsTopics) + b.Comma() b.FieldStart("has_scheduled_messages") b.PutBool(c.HasScheduledMessages) b.Comma() @@ -884,15 +905,15 @@ func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("notification_settings") if err := c.NotificationSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field notification_settings: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field notification_settings: %w", err) } b.Comma() b.FieldStart("available_reactions") if c.AvailableReactions == nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field available_reactions is nil") + return fmt.Errorf("unable to encode chat#4dd64d7d: field available_reactions is nil") } if err := c.AvailableReactions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field available_reactions: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field available_reactions: %w", err) } b.Comma() b.FieldStart("message_auto_delete_time") @@ -900,7 +921,7 @@ func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("background") if err := c.Background.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field background: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field background: %w", err) } b.Comma() b.FieldStart("theme_name") @@ -908,20 +929,20 @@ func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("action_bar") if c.ActionBar == nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field action_bar is nil") + return fmt.Errorf("unable to encode chat#4dd64d7d: field action_bar is nil") } if err := c.ActionBar.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field action_bar: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field action_bar: %w", err) } b.Comma() b.FieldStart("video_chat") if err := c.VideoChat.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field video_chat: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field video_chat: %w", err) } b.Comma() b.FieldStart("pending_join_requests") if err := c.PendingJoinRequests.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field pending_join_requests: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field pending_join_requests: %w", err) } b.Comma() b.FieldStart("reply_markup_message_id") @@ -929,7 +950,7 @@ func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("draft_message") if err := c.DraftMessage.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#5a9e2993: field draft_message: %w", err) + return fmt.Errorf("unable to encode chat#4dd64d7d: field draft_message: %w", err) } b.Comma() b.FieldStart("client_data") @@ -943,212 +964,218 @@ func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *Chat) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chat#5a9e2993 to nil") + return fmt.Errorf("can't decode chat#4dd64d7d to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("chat"); err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: %w", err) } case "id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field id: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field id: %w", err) } c.ID = value case "type": value, err := DecodeTDLibJSONChatType(b) if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field type: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field type: %w", err) } c.Type = value case "title": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field title: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field title: %w", err) } c.Title = value case "photo": if err := c.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field photo: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field photo: %w", err) } case "accent_color_id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field accent_color_id: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field accent_color_id: %w", err) } c.AccentColorID = value case "background_custom_emoji_id": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field background_custom_emoji_id: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field background_custom_emoji_id: %w", err) } c.BackgroundCustomEmojiID = value case "permissions": if err := c.Permissions.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field permissions: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field permissions: %w", err) } case "last_message": if err := c.LastMessage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field last_message: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field last_message: %w", err) } case "positions": if err := b.Arr(func(b tdjson.Decoder) error { var value ChatPosition if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field positions: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field positions: %w", err) } c.Positions = append(c.Positions, value) return nil }); err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field positions: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field positions: %w", err) } case "message_sender_id": value, err := DecodeTDLibJSONMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field message_sender_id: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field message_sender_id: %w", err) } c.MessageSenderID = value case "block_list": value, err := DecodeTDLibJSONBlockList(b) if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field block_list: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field block_list: %w", err) } c.BlockList = value case "has_protected_content": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field has_protected_content: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field has_protected_content: %w", err) } c.HasProtectedContent = value case "is_translatable": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field is_translatable: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field is_translatable: %w", err) } c.IsTranslatable = value case "is_marked_as_unread": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field is_marked_as_unread: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field is_marked_as_unread: %w", err) } c.IsMarkedAsUnread = value + case "view_as_topics": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chat#4dd64d7d: field view_as_topics: %w", err) + } + c.ViewAsTopics = value case "has_scheduled_messages": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field has_scheduled_messages: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field has_scheduled_messages: %w", err) } c.HasScheduledMessages = value case "can_be_deleted_only_for_self": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field can_be_deleted_only_for_self: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field can_be_deleted_only_for_self: %w", err) } c.CanBeDeletedOnlyForSelf = value case "can_be_deleted_for_all_users": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field can_be_deleted_for_all_users: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field can_be_deleted_for_all_users: %w", err) } c.CanBeDeletedForAllUsers = value case "can_be_reported": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field can_be_reported: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field can_be_reported: %w", err) } c.CanBeReported = value case "default_disable_notification": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field default_disable_notification: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field default_disable_notification: %w", err) } c.DefaultDisableNotification = value case "unread_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field unread_count: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field unread_count: %w", err) } c.UnreadCount = value case "last_read_inbox_message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field last_read_inbox_message_id: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field last_read_inbox_message_id: %w", err) } c.LastReadInboxMessageID = value case "last_read_outbox_message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field last_read_outbox_message_id: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field last_read_outbox_message_id: %w", err) } c.LastReadOutboxMessageID = value case "unread_mention_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field unread_mention_count: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field unread_mention_count: %w", err) } c.UnreadMentionCount = value case "unread_reaction_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field unread_reaction_count: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field unread_reaction_count: %w", err) } c.UnreadReactionCount = value case "notification_settings": if err := c.NotificationSettings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field notification_settings: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field notification_settings: %w", err) } case "available_reactions": value, err := DecodeTDLibJSONChatAvailableReactions(b) if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field available_reactions: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field available_reactions: %w", err) } c.AvailableReactions = value case "message_auto_delete_time": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field message_auto_delete_time: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field message_auto_delete_time: %w", err) } c.MessageAutoDeleteTime = value case "background": if err := c.Background.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field background: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field background: %w", err) } case "theme_name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field theme_name: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field theme_name: %w", err) } c.ThemeName = value case "action_bar": value, err := DecodeTDLibJSONChatActionBar(b) if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field action_bar: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field action_bar: %w", err) } c.ActionBar = value case "video_chat": if err := c.VideoChat.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field video_chat: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field video_chat: %w", err) } case "pending_join_requests": if err := c.PendingJoinRequests.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field pending_join_requests: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field pending_join_requests: %w", err) } case "reply_markup_message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field reply_markup_message_id: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field reply_markup_message_id: %w", err) } c.ReplyMarkupMessageID = value case "draft_message": if err := c.DraftMessage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field draft_message: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field draft_message: %w", err) } case "client_data": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chat#5a9e2993: field client_data: %w", err) + return fmt.Errorf("unable to decode chat#4dd64d7d: field client_data: %w", err) } c.ClientData = value default: @@ -1270,6 +1297,14 @@ func (c *Chat) GetIsMarkedAsUnread() (value bool) { return c.IsMarkedAsUnread } +// GetViewAsTopics returns value of ViewAsTopics field. +func (c *Chat) GetViewAsTopics() (value bool) { + if c == nil { + return + } + return c.ViewAsTopics +} + // GetHasScheduledMessages returns value of HasScheduledMessages field. func (c *Chat) GetHasScheduledMessages() (value bool) { if c == nil { diff --git a/tdapi/tl_chat_notification_settings_gen.go b/tdapi/tl_chat_notification_settings_gen.go index 2d86479de2..e80a7e6c02 100644 --- a/tdapi/tl_chat_notification_settings_gen.go +++ b/tdapi/tl_chat_notification_settings_gen.go @@ -33,8 +33,8 @@ var ( // ChatNotificationSettings represents TL type `chatNotificationSettings#dddc12cf`. type ChatNotificationSettings struct { - // If true, mute_for is ignored and the value for the relevant type of chat or the forum - // chat is used instead + // If true, the value for the relevant type of chat or the forum chat is used instead of + // mute_for UseDefaultMuteFor bool // Time left before notifications will be unmuted, in seconds MuteFor int32 @@ -43,13 +43,12 @@ type ChatNotificationSettings struct { UseDefaultSound bool // Identifier of the notification sound to be played for messages; 0 if sound is disabled SoundID int64 - // If true, show_preview is ignored and the value for the relevant type of chat or the - // forum chat is used instead + // If true, the value for the relevant type of chat or the forum chat is used instead of + // show_preview UseDefaultShowPreview bool // True, if message content must be displayed in notifications ShowPreview bool - // If true, mute_stories is ignored and the value for the relevant type of chat is used - // instead + // If true, the value for the relevant type of chat is used instead of mute_stories UseDefaultMuteStories bool // True, if story notifications are disabled for the chat MuteStories bool @@ -57,19 +56,18 @@ type ChatNotificationSettings struct { UseDefaultStorySound bool // Identifier of the notification sound to be played for stories; 0 if sound is disabled StorySoundID int64 - // If true, show_story_sender is ignored and the value for the relevant type of chat is - // used instead + // If true, the value for the relevant type of chat is used instead of show_story_sender UseDefaultShowStorySender bool // True, if the sender of stories must be displayed in notifications ShowStorySender bool - // If true, disable_pinned_message_notifications is ignored and the value for the - // relevant type of chat or the forum chat is used instead + // If true, the value for the relevant type of chat or the forum chat is used instead of + // disable_pinned_message_notifications UseDefaultDisablePinnedMessageNotifications bool // If true, notifications for incoming pinned messages will be created as for an ordinary // unread message DisablePinnedMessageNotifications bool - // If true, disable_mention_notifications is ignored and the value for the relevant type - // of chat or the forum chat is used instead + // If true, the value for the relevant type of chat or the forum chat is used instead of + // disable_mention_notifications UseDefaultDisableMentionNotifications bool // If true, notifications for messages with mentions will be created as for an ordinary // unread message diff --git a/tdapi/tl_chat_statistics_gen.go b/tdapi/tl_chat_statistics_gen.go index 58a428e095..a6f6c64424 100644 --- a/tdapi/tl_chat_statistics_gen.go +++ b/tdapi/tl_chat_statistics_gen.go @@ -871,16 +871,24 @@ func (c *ChatStatisticsSupergroup) GetTopInviters() (value []ChatStatisticsInvit return c.TopInviters } -// ChatStatisticsChannel represents TL type `chatStatisticsChannel#9be23786`. +// ChatStatisticsChannel represents TL type `chatStatisticsChannel#b8e95b4`. type ChatStatisticsChannel struct { // A period to which the statistics applies Period DateRange // Number of members in the chat MemberCount StatisticalValue - // Mean number of times the recently sent messages was viewed - MeanViewCount StatisticalValue - // Mean number of times the recently sent messages was shared - MeanShareCount StatisticalValue + // Mean number of times the recently sent messages were viewed + MeanMessageViewCount StatisticalValue + // Mean number of times the recently sent messages were shared + MeanMessageShareCount StatisticalValue + // Mean number of times reactions were added to the recently sent messages + MeanMessageReactionCount StatisticalValue + // Mean number of times the recently sent stories were viewed + MeanStoryViewCount StatisticalValue + // Mean number of times the recently sent stories were shared + MeanStoryShareCount StatisticalValue + // Mean number of times reactions were added to the recently sent stories + MeanStoryReactionCount StatisticalValue // A percentage of users with enabled notifications for the chat; 0-100 EnabledNotificationsPercentage float64 // A graph containing number of members in the chat @@ -899,14 +907,21 @@ type ChatStatisticsChannel struct { LanguageGraph StatisticalGraphClass // A graph containing number of chat message views and shares MessageInteractionGraph StatisticalGraphClass + // A graph containing number of reactions on messages + MessageReactionGraph StatisticalGraphClass + // A graph containing number of story views and shares + StoryInteractionGraph StatisticalGraphClass + // A graph containing number of reactions on stories + StoryReactionGraph StatisticalGraphClass // A graph containing number of views of associated with the chat instant views InstantViewInteractionGraph StatisticalGraphClass - // Detailed statistics about number of views and shares of recently sent messages - RecentMessageInteractions []ChatStatisticsMessageInteractionInfo + // Detailed statistics about number of views and shares of recently sent messages and + // stories + RecentInteractions []ChatStatisticsInteractionInfo } // ChatStatisticsChannelTypeID is TL type id of ChatStatisticsChannel. -const ChatStatisticsChannelTypeID = 0x9be23786 +const ChatStatisticsChannelTypeID = 0xb8e95b4 // construct implements constructor of ChatStatisticsClass. func (c ChatStatisticsChannel) construct() ChatStatisticsClass { return &c } @@ -931,10 +946,22 @@ func (c *ChatStatisticsChannel) Zero() bool { if !(c.MemberCount.Zero()) { return false } - if !(c.MeanViewCount.Zero()) { + if !(c.MeanMessageViewCount.Zero()) { return false } - if !(c.MeanShareCount.Zero()) { + if !(c.MeanMessageShareCount.Zero()) { + return false + } + if !(c.MeanMessageReactionCount.Zero()) { + return false + } + if !(c.MeanStoryViewCount.Zero()) { + return false + } + if !(c.MeanStoryShareCount.Zero()) { + return false + } + if !(c.MeanStoryReactionCount.Zero()) { return false } if !(c.EnabledNotificationsPercentage == 0) { @@ -964,10 +991,19 @@ func (c *ChatStatisticsChannel) Zero() bool { if !(c.MessageInteractionGraph == nil) { return false } + if !(c.MessageReactionGraph == nil) { + return false + } + if !(c.StoryInteractionGraph == nil) { + return false + } + if !(c.StoryReactionGraph == nil) { + return false + } if !(c.InstantViewInteractionGraph == nil) { return false } - if !(c.RecentMessageInteractions == nil) { + if !(c.RecentInteractions == nil) { return false } @@ -1015,12 +1051,28 @@ func (c *ChatStatisticsChannel) TypeInfo() tdp.Type { SchemaName: "member_count", }, { - Name: "MeanViewCount", - SchemaName: "mean_view_count", + Name: "MeanMessageViewCount", + SchemaName: "mean_message_view_count", + }, + { + Name: "MeanMessageShareCount", + SchemaName: "mean_message_share_count", }, { - Name: "MeanShareCount", - SchemaName: "mean_share_count", + Name: "MeanMessageReactionCount", + SchemaName: "mean_message_reaction_count", + }, + { + Name: "MeanStoryViewCount", + SchemaName: "mean_story_view_count", + }, + { + Name: "MeanStoryShareCount", + SchemaName: "mean_story_share_count", + }, + { + Name: "MeanStoryReactionCount", + SchemaName: "mean_story_reaction_count", }, { Name: "EnabledNotificationsPercentage", @@ -1058,13 +1110,25 @@ func (c *ChatStatisticsChannel) TypeInfo() tdp.Type { Name: "MessageInteractionGraph", SchemaName: "message_interaction_graph", }, + { + Name: "MessageReactionGraph", + SchemaName: "message_reaction_graph", + }, + { + Name: "StoryInteractionGraph", + SchemaName: "story_interaction_graph", + }, + { + Name: "StoryReactionGraph", + SchemaName: "story_reaction_graph", + }, { Name: "InstantViewInteractionGraph", SchemaName: "instant_view_interaction_graph", }, { - Name: "RecentMessageInteractions", - SchemaName: "recent_message_interactions", + Name: "RecentInteractions", + SchemaName: "recent_interactions", }, } return typ @@ -1073,7 +1137,7 @@ func (c *ChatStatisticsChannel) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *ChatStatisticsChannel) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatStatisticsChannel#9be23786 as nil") + return fmt.Errorf("can't encode chatStatisticsChannel#b8e95b4 as nil") } b.PutID(ChatStatisticsChannelTypeID) return c.EncodeBare(b) @@ -1082,79 +1146,109 @@ func (c *ChatStatisticsChannel) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatStatisticsChannel) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatStatisticsChannel#9be23786 as nil") + return fmt.Errorf("can't encode chatStatisticsChannel#b8e95b4 as nil") } if err := c.Period.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field period: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field period: %w", err) } if err := c.MemberCount.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field member_count: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field member_count: %w", err) + } + if err := c.MeanMessageViewCount.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_message_view_count: %w", err) } - if err := c.MeanViewCount.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field mean_view_count: %w", err) + if err := c.MeanMessageShareCount.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_message_share_count: %w", err) } - if err := c.MeanShareCount.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field mean_share_count: %w", err) + if err := c.MeanMessageReactionCount.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_message_reaction_count: %w", err) + } + if err := c.MeanStoryViewCount.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_story_view_count: %w", err) + } + if err := c.MeanStoryShareCount.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_story_share_count: %w", err) + } + if err := c.MeanStoryReactionCount.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_story_reaction_count: %w", err) } b.PutDouble(c.EnabledNotificationsPercentage) if c.MemberCountGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field member_count_graph is nil") + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field member_count_graph is nil") } if err := c.MemberCountGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field member_count_graph: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field member_count_graph: %w", err) } if c.JoinGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field join_graph is nil") + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field join_graph is nil") } if err := c.JoinGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field join_graph: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field join_graph: %w", err) } if c.MuteGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field mute_graph is nil") + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mute_graph is nil") } if err := c.MuteGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field mute_graph: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mute_graph: %w", err) } if c.ViewCountByHourGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field view_count_by_hour_graph is nil") + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field view_count_by_hour_graph is nil") } if err := c.ViewCountByHourGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field view_count_by_hour_graph: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field view_count_by_hour_graph: %w", err) } if c.ViewCountBySourceGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field view_count_by_source_graph is nil") + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field view_count_by_source_graph is nil") } if err := c.ViewCountBySourceGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field view_count_by_source_graph: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field view_count_by_source_graph: %w", err) } if c.JoinBySourceGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field join_by_source_graph is nil") + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field join_by_source_graph is nil") } if err := c.JoinBySourceGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field join_by_source_graph: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field join_by_source_graph: %w", err) } if c.LanguageGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field language_graph is nil") + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field language_graph is nil") } if err := c.LanguageGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field language_graph: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field language_graph: %w", err) } if c.MessageInteractionGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field message_interaction_graph is nil") + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field message_interaction_graph is nil") } if err := c.MessageInteractionGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field message_interaction_graph: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field message_interaction_graph: %w", err) + } + if c.MessageReactionGraph == nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field message_reaction_graph is nil") + } + if err := c.MessageReactionGraph.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field message_reaction_graph: %w", err) + } + if c.StoryInteractionGraph == nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field story_interaction_graph is nil") + } + if err := c.StoryInteractionGraph.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field story_interaction_graph: %w", err) + } + if c.StoryReactionGraph == nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field story_reaction_graph is nil") + } + if err := c.StoryReactionGraph.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field story_reaction_graph: %w", err) } if c.InstantViewInteractionGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field instant_view_interaction_graph is nil") + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field instant_view_interaction_graph is nil") } if err := c.InstantViewInteractionGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field instant_view_interaction_graph: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field instant_view_interaction_graph: %w", err) } - b.PutInt(len(c.RecentMessageInteractions)) - for idx, v := range c.RecentMessageInteractions { + b.PutInt(len(c.RecentInteractions)) + for idx, v := range c.RecentInteractions { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatStatisticsChannel#9be23786: field recent_message_interactions element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare chatStatisticsChannel#b8e95b4: field recent_interactions element with index %d: %w", idx, err) } } return nil @@ -1163,10 +1257,10 @@ func (c *ChatStatisticsChannel) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (c *ChatStatisticsChannel) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatStatisticsChannel#9be23786 to nil") + return fmt.Errorf("can't decode chatStatisticsChannel#b8e95b4 to nil") } if err := b.ConsumeID(ChatStatisticsChannelTypeID); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: %w", err) } return c.DecodeBare(b) } @@ -1174,113 +1268,154 @@ func (c *ChatStatisticsChannel) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatStatisticsChannel) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatStatisticsChannel#9be23786 to nil") + return fmt.Errorf("can't decode chatStatisticsChannel#b8e95b4 to nil") } { if err := c.Period.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field period: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field period: %w", err) } } { if err := c.MemberCount.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field member_count: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field member_count: %w", err) + } + } + { + if err := c.MeanMessageViewCount.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_message_view_count: %w", err) + } + } + { + if err := c.MeanMessageShareCount.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_message_share_count: %w", err) + } + } + { + if err := c.MeanMessageReactionCount.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_message_reaction_count: %w", err) + } + } + { + if err := c.MeanStoryViewCount.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_story_view_count: %w", err) } } { - if err := c.MeanViewCount.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field mean_view_count: %w", err) + if err := c.MeanStoryShareCount.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_story_share_count: %w", err) } } { - if err := c.MeanShareCount.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field mean_share_count: %w", err) + if err := c.MeanStoryReactionCount.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_story_reaction_count: %w", err) } } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field enabled_notifications_percentage: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field enabled_notifications_percentage: %w", err) } c.EnabledNotificationsPercentage = value } { value, err := DecodeStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field member_count_graph: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field member_count_graph: %w", err) } c.MemberCountGraph = value } { value, err := DecodeStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field join_graph: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field join_graph: %w", err) } c.JoinGraph = value } { value, err := DecodeStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field mute_graph: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mute_graph: %w", err) } c.MuteGraph = value } { value, err := DecodeStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field view_count_by_hour_graph: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field view_count_by_hour_graph: %w", err) } c.ViewCountByHourGraph = value } { value, err := DecodeStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field view_count_by_source_graph: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field view_count_by_source_graph: %w", err) } c.ViewCountBySourceGraph = value } { value, err := DecodeStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field join_by_source_graph: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field join_by_source_graph: %w", err) } c.JoinBySourceGraph = value } { value, err := DecodeStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field language_graph: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field language_graph: %w", err) } c.LanguageGraph = value } { value, err := DecodeStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field message_interaction_graph: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field message_interaction_graph: %w", err) } c.MessageInteractionGraph = value } { value, err := DecodeStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field instant_view_interaction_graph: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field message_reaction_graph: %w", err) + } + c.MessageReactionGraph = value + } + { + value, err := DecodeStatisticalGraph(b) + if err != nil { + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field story_interaction_graph: %w", err) + } + c.StoryInteractionGraph = value + } + { + value, err := DecodeStatisticalGraph(b) + if err != nil { + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field story_reaction_graph: %w", err) + } + c.StoryReactionGraph = value + } + { + value, err := DecodeStatisticalGraph(b) + if err != nil { + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field instant_view_interaction_graph: %w", err) } c.InstantViewInteractionGraph = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field recent_message_interactions: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field recent_interactions: %w", err) } if headerLen > 0 { - c.RecentMessageInteractions = make([]ChatStatisticsMessageInteractionInfo, 0, headerLen%bin.PreallocateLimit) + c.RecentInteractions = make([]ChatStatisticsInteractionInfo, 0, headerLen%bin.PreallocateLimit) } for idx := 0; idx < headerLen; idx++ { - var value ChatStatisticsMessageInteractionInfo + var value ChatStatisticsInteractionInfo if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatStatisticsChannel#9be23786: field recent_message_interactions: %w", err) + return fmt.Errorf("unable to decode bare chatStatisticsChannel#b8e95b4: field recent_interactions: %w", err) } - c.RecentMessageInteractions = append(c.RecentMessageInteractions, value) + c.RecentInteractions = append(c.RecentInteractions, value) } } return nil @@ -1289,29 +1424,49 @@ func (c *ChatStatisticsChannel) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *ChatStatisticsChannel) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatStatisticsChannel#9be23786 as nil") + return fmt.Errorf("can't encode chatStatisticsChannel#b8e95b4 as nil") } b.ObjStart() b.PutID("chatStatisticsChannel") b.Comma() b.FieldStart("period") if err := c.Period.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field period: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field period: %w", err) } b.Comma() b.FieldStart("member_count") if err := c.MemberCount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field member_count: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field member_count: %w", err) } b.Comma() - b.FieldStart("mean_view_count") - if err := c.MeanViewCount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field mean_view_count: %w", err) + b.FieldStart("mean_message_view_count") + if err := c.MeanMessageViewCount.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_message_view_count: %w", err) } b.Comma() - b.FieldStart("mean_share_count") - if err := c.MeanShareCount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field mean_share_count: %w", err) + b.FieldStart("mean_message_share_count") + if err := c.MeanMessageShareCount.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_message_share_count: %w", err) + } + b.Comma() + b.FieldStart("mean_message_reaction_count") + if err := c.MeanMessageReactionCount.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_message_reaction_count: %w", err) + } + b.Comma() + b.FieldStart("mean_story_view_count") + if err := c.MeanStoryViewCount.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_story_view_count: %w", err) + } + b.Comma() + b.FieldStart("mean_story_share_count") + if err := c.MeanStoryShareCount.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_story_share_count: %w", err) + } + b.Comma() + b.FieldStart("mean_story_reaction_count") + if err := c.MeanStoryReactionCount.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_story_reaction_count: %w", err) } b.Comma() b.FieldStart("enabled_notifications_percentage") @@ -1319,81 +1474,105 @@ func (c *ChatStatisticsChannel) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("member_count_graph") if c.MemberCountGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field member_count_graph is nil") + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field member_count_graph is nil") } if err := c.MemberCountGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field member_count_graph: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field member_count_graph: %w", err) } b.Comma() b.FieldStart("join_graph") if c.JoinGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field join_graph is nil") + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field join_graph is nil") } if err := c.JoinGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field join_graph: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field join_graph: %w", err) } b.Comma() b.FieldStart("mute_graph") if c.MuteGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field mute_graph is nil") + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mute_graph is nil") } if err := c.MuteGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field mute_graph: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mute_graph: %w", err) } b.Comma() b.FieldStart("view_count_by_hour_graph") if c.ViewCountByHourGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field view_count_by_hour_graph is nil") + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field view_count_by_hour_graph is nil") } if err := c.ViewCountByHourGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field view_count_by_hour_graph: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field view_count_by_hour_graph: %w", err) } b.Comma() b.FieldStart("view_count_by_source_graph") if c.ViewCountBySourceGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field view_count_by_source_graph is nil") + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field view_count_by_source_graph is nil") } if err := c.ViewCountBySourceGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field view_count_by_source_graph: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field view_count_by_source_graph: %w", err) } b.Comma() b.FieldStart("join_by_source_graph") if c.JoinBySourceGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field join_by_source_graph is nil") + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field join_by_source_graph is nil") } if err := c.JoinBySourceGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field join_by_source_graph: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field join_by_source_graph: %w", err) } b.Comma() b.FieldStart("language_graph") if c.LanguageGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field language_graph is nil") + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field language_graph is nil") } if err := c.LanguageGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field language_graph: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field language_graph: %w", err) } b.Comma() b.FieldStart("message_interaction_graph") if c.MessageInteractionGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field message_interaction_graph is nil") + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field message_interaction_graph is nil") } if err := c.MessageInteractionGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field message_interaction_graph: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field message_interaction_graph: %w", err) + } + b.Comma() + b.FieldStart("message_reaction_graph") + if c.MessageReactionGraph == nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field message_reaction_graph is nil") + } + if err := c.MessageReactionGraph.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field message_reaction_graph: %w", err) + } + b.Comma() + b.FieldStart("story_interaction_graph") + if c.StoryInteractionGraph == nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field story_interaction_graph is nil") + } + if err := c.StoryInteractionGraph.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field story_interaction_graph: %w", err) + } + b.Comma() + b.FieldStart("story_reaction_graph") + if c.StoryReactionGraph == nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field story_reaction_graph is nil") + } + if err := c.StoryReactionGraph.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field story_reaction_graph: %w", err) } b.Comma() b.FieldStart("instant_view_interaction_graph") if c.InstantViewInteractionGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field instant_view_interaction_graph is nil") + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field instant_view_interaction_graph is nil") } if err := c.InstantViewInteractionGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field instant_view_interaction_graph: %w", err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field instant_view_interaction_graph: %w", err) } b.Comma() - b.FieldStart("recent_message_interactions") + b.FieldStart("recent_interactions") b.ArrStart() - for idx, v := range c.RecentMessageInteractions { + for idx, v := range c.RecentInteractions { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#9be23786: field recent_message_interactions element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field recent_interactions element with index %d: %w", idx, err) } b.Comma() } @@ -1408,101 +1587,135 @@ func (c *ChatStatisticsChannel) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *ChatStatisticsChannel) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatStatisticsChannel#9be23786 to nil") + return fmt.Errorf("can't decode chatStatisticsChannel#b8e95b4 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("chatStatisticsChannel"); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: %w", err) } case "period": if err := c.Period.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field period: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field period: %w", err) } case "member_count": if err := c.MemberCount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field member_count: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field member_count: %w", err) } - case "mean_view_count": - if err := c.MeanViewCount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field mean_view_count: %w", err) + case "mean_message_view_count": + if err := c.MeanMessageViewCount.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_message_view_count: %w", err) } - case "mean_share_count": - if err := c.MeanShareCount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field mean_share_count: %w", err) + case "mean_message_share_count": + if err := c.MeanMessageShareCount.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_message_share_count: %w", err) + } + case "mean_message_reaction_count": + if err := c.MeanMessageReactionCount.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_message_reaction_count: %w", err) + } + case "mean_story_view_count": + if err := c.MeanStoryViewCount.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_story_view_count: %w", err) + } + case "mean_story_share_count": + if err := c.MeanStoryShareCount.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_story_share_count: %w", err) + } + case "mean_story_reaction_count": + if err := c.MeanStoryReactionCount.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_story_reaction_count: %w", err) } case "enabled_notifications_percentage": value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field enabled_notifications_percentage: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field enabled_notifications_percentage: %w", err) } c.EnabledNotificationsPercentage = value case "member_count_graph": value, err := DecodeTDLibJSONStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field member_count_graph: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field member_count_graph: %w", err) } c.MemberCountGraph = value case "join_graph": value, err := DecodeTDLibJSONStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field join_graph: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field join_graph: %w", err) } c.JoinGraph = value case "mute_graph": value, err := DecodeTDLibJSONStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field mute_graph: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mute_graph: %w", err) } c.MuteGraph = value case "view_count_by_hour_graph": value, err := DecodeTDLibJSONStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field view_count_by_hour_graph: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field view_count_by_hour_graph: %w", err) } c.ViewCountByHourGraph = value case "view_count_by_source_graph": value, err := DecodeTDLibJSONStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field view_count_by_source_graph: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field view_count_by_source_graph: %w", err) } c.ViewCountBySourceGraph = value case "join_by_source_graph": value, err := DecodeTDLibJSONStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field join_by_source_graph: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field join_by_source_graph: %w", err) } c.JoinBySourceGraph = value case "language_graph": value, err := DecodeTDLibJSONStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field language_graph: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field language_graph: %w", err) } c.LanguageGraph = value case "message_interaction_graph": value, err := DecodeTDLibJSONStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field message_interaction_graph: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field message_interaction_graph: %w", err) } c.MessageInteractionGraph = value + case "message_reaction_graph": + value, err := DecodeTDLibJSONStatisticalGraph(b) + if err != nil { + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field message_reaction_graph: %w", err) + } + c.MessageReactionGraph = value + case "story_interaction_graph": + value, err := DecodeTDLibJSONStatisticalGraph(b) + if err != nil { + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field story_interaction_graph: %w", err) + } + c.StoryInteractionGraph = value + case "story_reaction_graph": + value, err := DecodeTDLibJSONStatisticalGraph(b) + if err != nil { + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field story_reaction_graph: %w", err) + } + c.StoryReactionGraph = value case "instant_view_interaction_graph": value, err := DecodeTDLibJSONStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field instant_view_interaction_graph: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field instant_view_interaction_graph: %w", err) } c.InstantViewInteractionGraph = value - case "recent_message_interactions": + case "recent_interactions": if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatStatisticsMessageInteractionInfo + var value ChatStatisticsInteractionInfo if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field recent_message_interactions: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field recent_interactions: %w", err) } - c.RecentMessageInteractions = append(c.RecentMessageInteractions, value) + c.RecentInteractions = append(c.RecentInteractions, value) return nil }); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#9be23786: field recent_message_interactions: %w", err) + return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field recent_interactions: %w", err) } default: return b.Skip() @@ -1527,20 +1740,52 @@ func (c *ChatStatisticsChannel) GetMemberCount() (value StatisticalValue) { return c.MemberCount } -// GetMeanViewCount returns value of MeanViewCount field. -func (c *ChatStatisticsChannel) GetMeanViewCount() (value StatisticalValue) { +// GetMeanMessageViewCount returns value of MeanMessageViewCount field. +func (c *ChatStatisticsChannel) GetMeanMessageViewCount() (value StatisticalValue) { if c == nil { return } - return c.MeanViewCount + return c.MeanMessageViewCount } -// GetMeanShareCount returns value of MeanShareCount field. -func (c *ChatStatisticsChannel) GetMeanShareCount() (value StatisticalValue) { +// GetMeanMessageShareCount returns value of MeanMessageShareCount field. +func (c *ChatStatisticsChannel) GetMeanMessageShareCount() (value StatisticalValue) { if c == nil { return } - return c.MeanShareCount + return c.MeanMessageShareCount +} + +// GetMeanMessageReactionCount returns value of MeanMessageReactionCount field. +func (c *ChatStatisticsChannel) GetMeanMessageReactionCount() (value StatisticalValue) { + if c == nil { + return + } + return c.MeanMessageReactionCount +} + +// GetMeanStoryViewCount returns value of MeanStoryViewCount field. +func (c *ChatStatisticsChannel) GetMeanStoryViewCount() (value StatisticalValue) { + if c == nil { + return + } + return c.MeanStoryViewCount +} + +// GetMeanStoryShareCount returns value of MeanStoryShareCount field. +func (c *ChatStatisticsChannel) GetMeanStoryShareCount() (value StatisticalValue) { + if c == nil { + return + } + return c.MeanStoryShareCount +} + +// GetMeanStoryReactionCount returns value of MeanStoryReactionCount field. +func (c *ChatStatisticsChannel) GetMeanStoryReactionCount() (value StatisticalValue) { + if c == nil { + return + } + return c.MeanStoryReactionCount } // GetEnabledNotificationsPercentage returns value of EnabledNotificationsPercentage field. @@ -1615,6 +1860,30 @@ func (c *ChatStatisticsChannel) GetMessageInteractionGraph() (value StatisticalG return c.MessageInteractionGraph } +// GetMessageReactionGraph returns value of MessageReactionGraph field. +func (c *ChatStatisticsChannel) GetMessageReactionGraph() (value StatisticalGraphClass) { + if c == nil { + return + } + return c.MessageReactionGraph +} + +// GetStoryInteractionGraph returns value of StoryInteractionGraph field. +func (c *ChatStatisticsChannel) GetStoryInteractionGraph() (value StatisticalGraphClass) { + if c == nil { + return + } + return c.StoryInteractionGraph +} + +// GetStoryReactionGraph returns value of StoryReactionGraph field. +func (c *ChatStatisticsChannel) GetStoryReactionGraph() (value StatisticalGraphClass) { + if c == nil { + return + } + return c.StoryReactionGraph +} + // GetInstantViewInteractionGraph returns value of InstantViewInteractionGraph field. func (c *ChatStatisticsChannel) GetInstantViewInteractionGraph() (value StatisticalGraphClass) { if c == nil { @@ -1623,12 +1892,12 @@ func (c *ChatStatisticsChannel) GetInstantViewInteractionGraph() (value Statisti return c.InstantViewInteractionGraph } -// GetRecentMessageInteractions returns value of RecentMessageInteractions field. -func (c *ChatStatisticsChannel) GetRecentMessageInteractions() (value []ChatStatisticsMessageInteractionInfo) { +// GetRecentInteractions returns value of RecentInteractions field. +func (c *ChatStatisticsChannel) GetRecentInteractions() (value []ChatStatisticsInteractionInfo) { if c == nil { return } - return c.RecentMessageInteractions + return c.RecentInteractions } // ChatStatisticsClassName is schema name of ChatStatisticsClass. @@ -1644,7 +1913,7 @@ const ChatStatisticsClassName = "ChatStatistics" // } // switch v := g.(type) { // case *tdapi.ChatStatisticsSupergroup: // chatStatisticsSupergroup#c67549ef -// case *tdapi.ChatStatisticsChannel: // chatStatisticsChannel#9be23786 +// case *tdapi.ChatStatisticsChannel: // chatStatisticsChannel#b8e95b4 // default: panic(v) // } type ChatStatisticsClass interface { @@ -1697,7 +1966,7 @@ func DecodeChatStatistics(buf *bin.Buffer) (ChatStatisticsClass, error) { } return &v, nil case ChatStatisticsChannelTypeID: - // Decoding chatStatisticsChannel#9be23786. + // Decoding chatStatisticsChannel#b8e95b4. v := ChatStatisticsChannel{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatStatisticsClass: %w", err) @@ -1723,7 +1992,7 @@ func DecodeTDLibJSONChatStatistics(buf tdjson.Decoder) (ChatStatisticsClass, err } return &v, nil case "chatStatisticsChannel": - // Decoding chatStatisticsChannel#9be23786. + // Decoding chatStatisticsChannel#b8e95b4. v := ChatStatisticsChannel{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatStatisticsClass: %w", err) diff --git a/tdapi/tl_chat_statistics_interaction_info_gen.go b/tdapi/tl_chat_statistics_interaction_info_gen.go new file mode 100644 index 0000000000..59e423e526 --- /dev/null +++ b/tdapi/tl_chat_statistics_interaction_info_gen.go @@ -0,0 +1,305 @@ +// 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{} +) + +// ChatStatisticsInteractionInfo represents TL type `chatStatisticsInteractionInfo#694a9a8d`. +type ChatStatisticsInteractionInfo struct { + // Type of the object + ObjectType ChatStatisticsObjectTypeClass + // Number of times the object was viewed + ViewCount int32 + // Number of times the object was forwarded + ForwardCount int32 + // Number of times reactions were added to the object + ReactionCount int32 +} + +// ChatStatisticsInteractionInfoTypeID is TL type id of ChatStatisticsInteractionInfo. +const ChatStatisticsInteractionInfoTypeID = 0x694a9a8d + +// Ensuring interfaces in compile-time for ChatStatisticsInteractionInfo. +var ( + _ bin.Encoder = &ChatStatisticsInteractionInfo{} + _ bin.Decoder = &ChatStatisticsInteractionInfo{} + _ bin.BareEncoder = &ChatStatisticsInteractionInfo{} + _ bin.BareDecoder = &ChatStatisticsInteractionInfo{} +) + +func (c *ChatStatisticsInteractionInfo) Zero() bool { + if c == nil { + return true + } + if !(c.ObjectType == nil) { + return false + } + if !(c.ViewCount == 0) { + return false + } + if !(c.ForwardCount == 0) { + return false + } + if !(c.ReactionCount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChatStatisticsInteractionInfo) String() string { + if c == nil { + return "ChatStatisticsInteractionInfo(nil)" + } + type Alias ChatStatisticsInteractionInfo + return fmt.Sprintf("ChatStatisticsInteractionInfo%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChatStatisticsInteractionInfo) TypeID() uint32 { + return ChatStatisticsInteractionInfoTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChatStatisticsInteractionInfo) TypeName() string { + return "chatStatisticsInteractionInfo" +} + +// TypeInfo returns info about TL type. +func (c *ChatStatisticsInteractionInfo) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "chatStatisticsInteractionInfo", + ID: ChatStatisticsInteractionInfoTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ObjectType", + SchemaName: "object_type", + }, + { + Name: "ViewCount", + SchemaName: "view_count", + }, + { + Name: "ForwardCount", + SchemaName: "forward_count", + }, + { + Name: "ReactionCount", + SchemaName: "reaction_count", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChatStatisticsInteractionInfo) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatStatisticsInteractionInfo#694a9a8d as nil") + } + b.PutID(ChatStatisticsInteractionInfoTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChatStatisticsInteractionInfo) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatStatisticsInteractionInfo#694a9a8d as nil") + } + if c.ObjectType == nil { + return fmt.Errorf("unable to encode chatStatisticsInteractionInfo#694a9a8d: field object_type is nil") + } + if err := c.ObjectType.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatStatisticsInteractionInfo#694a9a8d: field object_type: %w", err) + } + b.PutInt32(c.ViewCount) + b.PutInt32(c.ForwardCount) + b.PutInt32(c.ReactionCount) + return nil +} + +// Decode implements bin.Decoder. +func (c *ChatStatisticsInteractionInfo) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatStatisticsInteractionInfo#694a9a8d to nil") + } + if err := b.ConsumeID(ChatStatisticsInteractionInfoTypeID); err != nil { + return fmt.Errorf("unable to decode chatStatisticsInteractionInfo#694a9a8d: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChatStatisticsInteractionInfo) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatStatisticsInteractionInfo#694a9a8d to nil") + } + { + value, err := DecodeChatStatisticsObjectType(b) + if err != nil { + return fmt.Errorf("unable to decode chatStatisticsInteractionInfo#694a9a8d: field object_type: %w", err) + } + c.ObjectType = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatStatisticsInteractionInfo#694a9a8d: field view_count: %w", err) + } + c.ViewCount = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatStatisticsInteractionInfo#694a9a8d: field forward_count: %w", err) + } + c.ForwardCount = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatStatisticsInteractionInfo#694a9a8d: field reaction_count: %w", err) + } + c.ReactionCount = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatStatisticsInteractionInfo) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatStatisticsInteractionInfo#694a9a8d as nil") + } + b.ObjStart() + b.PutID("chatStatisticsInteractionInfo") + b.Comma() + b.FieldStart("object_type") + if c.ObjectType == nil { + return fmt.Errorf("unable to encode chatStatisticsInteractionInfo#694a9a8d: field object_type is nil") + } + if err := c.ObjectType.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatStatisticsInteractionInfo#694a9a8d: field object_type: %w", err) + } + b.Comma() + b.FieldStart("view_count") + b.PutInt32(c.ViewCount) + b.Comma() + b.FieldStart("forward_count") + b.PutInt32(c.ForwardCount) + b.Comma() + b.FieldStart("reaction_count") + b.PutInt32(c.ReactionCount) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ChatStatisticsInteractionInfo) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode chatStatisticsInteractionInfo#694a9a8d to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("chatStatisticsInteractionInfo"); err != nil { + return fmt.Errorf("unable to decode chatStatisticsInteractionInfo#694a9a8d: %w", err) + } + case "object_type": + value, err := DecodeTDLibJSONChatStatisticsObjectType(b) + if err != nil { + return fmt.Errorf("unable to decode chatStatisticsInteractionInfo#694a9a8d: field object_type: %w", err) + } + c.ObjectType = value + case "view_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatStatisticsInteractionInfo#694a9a8d: field view_count: %w", err) + } + c.ViewCount = value + case "forward_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatStatisticsInteractionInfo#694a9a8d: field forward_count: %w", err) + } + c.ForwardCount = value + case "reaction_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatStatisticsInteractionInfo#694a9a8d: field reaction_count: %w", err) + } + c.ReactionCount = value + default: + return b.Skip() + } + return nil + }) +} + +// GetObjectType returns value of ObjectType field. +func (c *ChatStatisticsInteractionInfo) GetObjectType() (value ChatStatisticsObjectTypeClass) { + if c == nil { + return + } + return c.ObjectType +} + +// GetViewCount returns value of ViewCount field. +func (c *ChatStatisticsInteractionInfo) GetViewCount() (value int32) { + if c == nil { + return + } + return c.ViewCount +} + +// GetForwardCount returns value of ForwardCount field. +func (c *ChatStatisticsInteractionInfo) GetForwardCount() (value int32) { + if c == nil { + return + } + return c.ForwardCount +} + +// GetReactionCount returns value of ReactionCount field. +func (c *ChatStatisticsInteractionInfo) GetReactionCount() (value int32) { + if c == nil { + return + } + return c.ReactionCount +} diff --git a/tdapi/tl_chat_statistics_message_interaction_info_gen.go b/tdapi/tl_chat_statistics_message_interaction_info_gen.go deleted file mode 100644 index 4d59da3266..0000000000 --- a/tdapi/tl_chat_statistics_message_interaction_info_gen.go +++ /dev/null @@ -1,261 +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{} -) - -// ChatStatisticsMessageInteractionInfo represents TL type `chatStatisticsMessageInteractionInfo#d25e2a2c`. -type ChatStatisticsMessageInteractionInfo struct { - // Message identifier - MessageID int64 - // Number of times the message was viewed - ViewCount int32 - // Number of times the message was forwarded - ForwardCount int32 -} - -// ChatStatisticsMessageInteractionInfoTypeID is TL type id of ChatStatisticsMessageInteractionInfo. -const ChatStatisticsMessageInteractionInfoTypeID = 0xd25e2a2c - -// Ensuring interfaces in compile-time for ChatStatisticsMessageInteractionInfo. -var ( - _ bin.Encoder = &ChatStatisticsMessageInteractionInfo{} - _ bin.Decoder = &ChatStatisticsMessageInteractionInfo{} - _ bin.BareEncoder = &ChatStatisticsMessageInteractionInfo{} - _ bin.BareDecoder = &ChatStatisticsMessageInteractionInfo{} -) - -func (c *ChatStatisticsMessageInteractionInfo) Zero() bool { - if c == nil { - return true - } - if !(c.MessageID == 0) { - return false - } - if !(c.ViewCount == 0) { - return false - } - if !(c.ForwardCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatStatisticsMessageInteractionInfo) String() string { - if c == nil { - return "ChatStatisticsMessageInteractionInfo(nil)" - } - type Alias ChatStatisticsMessageInteractionInfo - return fmt.Sprintf("ChatStatisticsMessageInteractionInfo%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatStatisticsMessageInteractionInfo) TypeID() uint32 { - return ChatStatisticsMessageInteractionInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatStatisticsMessageInteractionInfo) TypeName() string { - return "chatStatisticsMessageInteractionInfo" -} - -// TypeInfo returns info about TL type. -func (c *ChatStatisticsMessageInteractionInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatStatisticsMessageInteractionInfo", - ID: ChatStatisticsMessageInteractionInfoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ViewCount", - SchemaName: "view_count", - }, - { - Name: "ForwardCount", - SchemaName: "forward_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatStatisticsMessageInteractionInfo) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsMessageInteractionInfo#d25e2a2c as nil") - } - b.PutID(ChatStatisticsMessageInteractionInfoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatStatisticsMessageInteractionInfo) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsMessageInteractionInfo#d25e2a2c as nil") - } - b.PutInt53(c.MessageID) - b.PutInt32(c.ViewCount) - b.PutInt32(c.ForwardCount) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatStatisticsMessageInteractionInfo) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsMessageInteractionInfo#d25e2a2c to nil") - } - if err := b.ConsumeID(ChatStatisticsMessageInteractionInfoTypeID); err != nil { - return fmt.Errorf("unable to decode chatStatisticsMessageInteractionInfo#d25e2a2c: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatStatisticsMessageInteractionInfo) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsMessageInteractionInfo#d25e2a2c to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsMessageInteractionInfo#d25e2a2c: field message_id: %w", err) - } - c.MessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsMessageInteractionInfo#d25e2a2c: field view_count: %w", err) - } - c.ViewCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsMessageInteractionInfo#d25e2a2c: field forward_count: %w", err) - } - c.ForwardCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatStatisticsMessageInteractionInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsMessageInteractionInfo#d25e2a2c as nil") - } - b.ObjStart() - b.PutID("chatStatisticsMessageInteractionInfo") - b.Comma() - b.FieldStart("message_id") - b.PutInt53(c.MessageID) - b.Comma() - b.FieldStart("view_count") - b.PutInt32(c.ViewCount) - b.Comma() - b.FieldStart("forward_count") - b.PutInt32(c.ForwardCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatStatisticsMessageInteractionInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsMessageInteractionInfo#d25e2a2c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatStatisticsMessageInteractionInfo"); err != nil { - return fmt.Errorf("unable to decode chatStatisticsMessageInteractionInfo#d25e2a2c: %w", err) - } - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsMessageInteractionInfo#d25e2a2c: field message_id: %w", err) - } - c.MessageID = value - case "view_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsMessageInteractionInfo#d25e2a2c: field view_count: %w", err) - } - c.ViewCount = value - case "forward_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsMessageInteractionInfo#d25e2a2c: field forward_count: %w", err) - } - c.ForwardCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMessageID returns value of MessageID field. -func (c *ChatStatisticsMessageInteractionInfo) GetMessageID() (value int64) { - if c == nil { - return - } - return c.MessageID -} - -// GetViewCount returns value of ViewCount field. -func (c *ChatStatisticsMessageInteractionInfo) GetViewCount() (value int32) { - if c == nil { - return - } - return c.ViewCount -} - -// GetForwardCount returns value of ForwardCount field. -func (c *ChatStatisticsMessageInteractionInfo) GetForwardCount() (value int32) { - if c == nil { - return - } - return c.ForwardCount -} diff --git a/tdapi/tl_chat_statistics_object_type_gen.go b/tdapi/tl_chat_statistics_object_type_gen.go new file mode 100644 index 0000000000..e8342dc142 --- /dev/null +++ b/tdapi/tl_chat_statistics_object_type_gen.go @@ -0,0 +1,501 @@ +// 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{} +) + +// ChatStatisticsObjectTypeMessage represents TL type `chatStatisticsObjectTypeMessage#6f9f24f6`. +type ChatStatisticsObjectTypeMessage struct { + // Message identifier + MessageID int64 +} + +// ChatStatisticsObjectTypeMessageTypeID is TL type id of ChatStatisticsObjectTypeMessage. +const ChatStatisticsObjectTypeMessageTypeID = 0x6f9f24f6 + +// construct implements constructor of ChatStatisticsObjectTypeClass. +func (c ChatStatisticsObjectTypeMessage) construct() ChatStatisticsObjectTypeClass { return &c } + +// Ensuring interfaces in compile-time for ChatStatisticsObjectTypeMessage. +var ( + _ bin.Encoder = &ChatStatisticsObjectTypeMessage{} + _ bin.Decoder = &ChatStatisticsObjectTypeMessage{} + _ bin.BareEncoder = &ChatStatisticsObjectTypeMessage{} + _ bin.BareDecoder = &ChatStatisticsObjectTypeMessage{} + + _ ChatStatisticsObjectTypeClass = &ChatStatisticsObjectTypeMessage{} +) + +func (c *ChatStatisticsObjectTypeMessage) Zero() bool { + if c == nil { + return true + } + if !(c.MessageID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChatStatisticsObjectTypeMessage) String() string { + if c == nil { + return "ChatStatisticsObjectTypeMessage(nil)" + } + type Alias ChatStatisticsObjectTypeMessage + return fmt.Sprintf("ChatStatisticsObjectTypeMessage%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChatStatisticsObjectTypeMessage) TypeID() uint32 { + return ChatStatisticsObjectTypeMessageTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChatStatisticsObjectTypeMessage) TypeName() string { + return "chatStatisticsObjectTypeMessage" +} + +// TypeInfo returns info about TL type. +func (c *ChatStatisticsObjectTypeMessage) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "chatStatisticsObjectTypeMessage", + ID: ChatStatisticsObjectTypeMessageTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "MessageID", + SchemaName: "message_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChatStatisticsObjectTypeMessage) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatStatisticsObjectTypeMessage#6f9f24f6 as nil") + } + b.PutID(ChatStatisticsObjectTypeMessageTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChatStatisticsObjectTypeMessage) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatStatisticsObjectTypeMessage#6f9f24f6 as nil") + } + b.PutInt53(c.MessageID) + return nil +} + +// Decode implements bin.Decoder. +func (c *ChatStatisticsObjectTypeMessage) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatStatisticsObjectTypeMessage#6f9f24f6 to nil") + } + if err := b.ConsumeID(ChatStatisticsObjectTypeMessageTypeID); err != nil { + return fmt.Errorf("unable to decode chatStatisticsObjectTypeMessage#6f9f24f6: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChatStatisticsObjectTypeMessage) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatStatisticsObjectTypeMessage#6f9f24f6 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode chatStatisticsObjectTypeMessage#6f9f24f6: field message_id: %w", err) + } + c.MessageID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatStatisticsObjectTypeMessage) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatStatisticsObjectTypeMessage#6f9f24f6 as nil") + } + b.ObjStart() + b.PutID("chatStatisticsObjectTypeMessage") + b.Comma() + b.FieldStart("message_id") + b.PutInt53(c.MessageID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ChatStatisticsObjectTypeMessage) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode chatStatisticsObjectTypeMessage#6f9f24f6 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("chatStatisticsObjectTypeMessage"); err != nil { + return fmt.Errorf("unable to decode chatStatisticsObjectTypeMessage#6f9f24f6: %w", err) + } + case "message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode chatStatisticsObjectTypeMessage#6f9f24f6: field message_id: %w", err) + } + c.MessageID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetMessageID returns value of MessageID field. +func (c *ChatStatisticsObjectTypeMessage) GetMessageID() (value int64) { + if c == nil { + return + } + return c.MessageID +} + +// ChatStatisticsObjectTypeStory represents TL type `chatStatisticsObjectTypeStory#15baf9b0`. +type ChatStatisticsObjectTypeStory struct { + // Story identifier + StoryID int32 +} + +// ChatStatisticsObjectTypeStoryTypeID is TL type id of ChatStatisticsObjectTypeStory. +const ChatStatisticsObjectTypeStoryTypeID = 0x15baf9b0 + +// construct implements constructor of ChatStatisticsObjectTypeClass. +func (c ChatStatisticsObjectTypeStory) construct() ChatStatisticsObjectTypeClass { return &c } + +// Ensuring interfaces in compile-time for ChatStatisticsObjectTypeStory. +var ( + _ bin.Encoder = &ChatStatisticsObjectTypeStory{} + _ bin.Decoder = &ChatStatisticsObjectTypeStory{} + _ bin.BareEncoder = &ChatStatisticsObjectTypeStory{} + _ bin.BareDecoder = &ChatStatisticsObjectTypeStory{} + + _ ChatStatisticsObjectTypeClass = &ChatStatisticsObjectTypeStory{} +) + +func (c *ChatStatisticsObjectTypeStory) Zero() bool { + if c == nil { + return true + } + if !(c.StoryID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChatStatisticsObjectTypeStory) String() string { + if c == nil { + return "ChatStatisticsObjectTypeStory(nil)" + } + type Alias ChatStatisticsObjectTypeStory + return fmt.Sprintf("ChatStatisticsObjectTypeStory%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChatStatisticsObjectTypeStory) TypeID() uint32 { + return ChatStatisticsObjectTypeStoryTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChatStatisticsObjectTypeStory) TypeName() string { + return "chatStatisticsObjectTypeStory" +} + +// TypeInfo returns info about TL type. +func (c *ChatStatisticsObjectTypeStory) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "chatStatisticsObjectTypeStory", + ID: ChatStatisticsObjectTypeStoryTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "StoryID", + SchemaName: "story_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChatStatisticsObjectTypeStory) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatStatisticsObjectTypeStory#15baf9b0 as nil") + } + b.PutID(ChatStatisticsObjectTypeStoryTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChatStatisticsObjectTypeStory) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatStatisticsObjectTypeStory#15baf9b0 as nil") + } + b.PutInt32(c.StoryID) + return nil +} + +// Decode implements bin.Decoder. +func (c *ChatStatisticsObjectTypeStory) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatStatisticsObjectTypeStory#15baf9b0 to nil") + } + if err := b.ConsumeID(ChatStatisticsObjectTypeStoryTypeID); err != nil { + return fmt.Errorf("unable to decode chatStatisticsObjectTypeStory#15baf9b0: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChatStatisticsObjectTypeStory) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatStatisticsObjectTypeStory#15baf9b0 to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatStatisticsObjectTypeStory#15baf9b0: field story_id: %w", err) + } + c.StoryID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatStatisticsObjectTypeStory) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatStatisticsObjectTypeStory#15baf9b0 as nil") + } + b.ObjStart() + b.PutID("chatStatisticsObjectTypeStory") + b.Comma() + b.FieldStart("story_id") + b.PutInt32(c.StoryID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ChatStatisticsObjectTypeStory) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode chatStatisticsObjectTypeStory#15baf9b0 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("chatStatisticsObjectTypeStory"); err != nil { + return fmt.Errorf("unable to decode chatStatisticsObjectTypeStory#15baf9b0: %w", err) + } + case "story_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatStatisticsObjectTypeStory#15baf9b0: field story_id: %w", err) + } + c.StoryID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetStoryID returns value of StoryID field. +func (c *ChatStatisticsObjectTypeStory) GetStoryID() (value int32) { + if c == nil { + return + } + return c.StoryID +} + +// ChatStatisticsObjectTypeClassName is schema name of ChatStatisticsObjectTypeClass. +const ChatStatisticsObjectTypeClassName = "ChatStatisticsObjectType" + +// ChatStatisticsObjectTypeClass represents ChatStatisticsObjectType generic type. +// +// Example: +// +// g, err := tdapi.DecodeChatStatisticsObjectType(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tdapi.ChatStatisticsObjectTypeMessage: // chatStatisticsObjectTypeMessage#6f9f24f6 +// case *tdapi.ChatStatisticsObjectTypeStory: // chatStatisticsObjectTypeStory#15baf9b0 +// default: panic(v) +// } +type ChatStatisticsObjectTypeClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() ChatStatisticsObjectTypeClass + + // 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 +} + +// DecodeChatStatisticsObjectType implements binary de-serialization for ChatStatisticsObjectTypeClass. +func DecodeChatStatisticsObjectType(buf *bin.Buffer) (ChatStatisticsObjectTypeClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case ChatStatisticsObjectTypeMessageTypeID: + // Decoding chatStatisticsObjectTypeMessage#6f9f24f6. + v := ChatStatisticsObjectTypeMessage{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatStatisticsObjectTypeClass: %w", err) + } + return &v, nil + case ChatStatisticsObjectTypeStoryTypeID: + // Decoding chatStatisticsObjectTypeStory#15baf9b0. + v := ChatStatisticsObjectTypeStory{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatStatisticsObjectTypeClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode ChatStatisticsObjectTypeClass: %w", bin.NewUnexpectedID(id)) + } +} + +// DecodeTDLibJSONChatStatisticsObjectType implements binary de-serialization for ChatStatisticsObjectTypeClass. +func DecodeTDLibJSONChatStatisticsObjectType(buf tdjson.Decoder) (ChatStatisticsObjectTypeClass, error) { + id, err := buf.FindTypeID() + if err != nil { + return nil, err + } + switch id { + case "chatStatisticsObjectTypeMessage": + // Decoding chatStatisticsObjectTypeMessage#6f9f24f6. + v := ChatStatisticsObjectTypeMessage{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatStatisticsObjectTypeClass: %w", err) + } + return &v, nil + case "chatStatisticsObjectTypeStory": + // Decoding chatStatisticsObjectTypeStory#15baf9b0. + v := ChatStatisticsObjectTypeStory{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatStatisticsObjectTypeClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode ChatStatisticsObjectTypeClass: %w", tdjson.NewUnexpectedID(id)) + } +} + +// ChatStatisticsObjectType boxes the ChatStatisticsObjectTypeClass providing a helper. +type ChatStatisticsObjectTypeBox struct { + ChatStatisticsObjectType ChatStatisticsObjectTypeClass +} + +// Decode implements bin.Decoder for ChatStatisticsObjectTypeBox. +func (b *ChatStatisticsObjectTypeBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode ChatStatisticsObjectTypeBox to nil") + } + v, err := DecodeChatStatisticsObjectType(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.ChatStatisticsObjectType = v + return nil +} + +// Encode implements bin.Encode for ChatStatisticsObjectTypeBox. +func (b *ChatStatisticsObjectTypeBox) Encode(buf *bin.Buffer) error { + if b == nil || b.ChatStatisticsObjectType == nil { + return fmt.Errorf("unable to encode ChatStatisticsObjectTypeClass as nil") + } + return b.ChatStatisticsObjectType.Encode(buf) +} + +// DecodeTDLibJSON implements bin.Decoder for ChatStatisticsObjectTypeBox. +func (b *ChatStatisticsObjectTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("unable to decode ChatStatisticsObjectTypeBox to nil") + } + v, err := DecodeTDLibJSONChatStatisticsObjectType(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.ChatStatisticsObjectType = v + return nil +} + +// EncodeTDLibJSON implements bin.Encode for ChatStatisticsObjectTypeBox. +func (b *ChatStatisticsObjectTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil || b.ChatStatisticsObjectType == nil { + return fmt.Errorf("unable to encode ChatStatisticsObjectTypeClass as nil") + } + return b.ChatStatisticsObjectType.EncodeTDLibJSON(buf) +} diff --git a/tdapi/tl_delete_chat_background_gen.go b/tdapi/tl_delete_chat_background_gen.go new file mode 100644 index 0000000000..316bf6ca31 --- /dev/null +++ b/tdapi/tl_delete_chat_background_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{} +) + +// DeleteChatBackgroundRequest represents TL type `deleteChatBackground#1316e678`. +type DeleteChatBackgroundRequest struct { + // Chat identifier + ChatID int64 + // Pass true to restore previously set background. Can be used only in private and secret + // chats with non-deleted users if userFullInfo.set_chat_background == true. + RestorePrevious bool +} + +// DeleteChatBackgroundRequestTypeID is TL type id of DeleteChatBackgroundRequest. +const DeleteChatBackgroundRequestTypeID = 0x1316e678 + +// Ensuring interfaces in compile-time for DeleteChatBackgroundRequest. +var ( + _ bin.Encoder = &DeleteChatBackgroundRequest{} + _ bin.Decoder = &DeleteChatBackgroundRequest{} + _ bin.BareEncoder = &DeleteChatBackgroundRequest{} + _ bin.BareDecoder = &DeleteChatBackgroundRequest{} +) + +func (d *DeleteChatBackgroundRequest) Zero() bool { + if d == nil { + return true + } + if !(d.ChatID == 0) { + return false + } + if !(d.RestorePrevious == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (d *DeleteChatBackgroundRequest) String() string { + if d == nil { + return "DeleteChatBackgroundRequest(nil)" + } + type Alias DeleteChatBackgroundRequest + return fmt.Sprintf("DeleteChatBackgroundRequest%+v", Alias(*d)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*DeleteChatBackgroundRequest) TypeID() uint32 { + return DeleteChatBackgroundRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*DeleteChatBackgroundRequest) TypeName() string { + return "deleteChatBackground" +} + +// TypeInfo returns info about TL type. +func (d *DeleteChatBackgroundRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "deleteChatBackground", + ID: DeleteChatBackgroundRequestTypeID, + } + if d == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "RestorePrevious", + SchemaName: "restore_previous", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (d *DeleteChatBackgroundRequest) Encode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode deleteChatBackground#1316e678 as nil") + } + b.PutID(DeleteChatBackgroundRequestTypeID) + return d.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (d *DeleteChatBackgroundRequest) EncodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode deleteChatBackground#1316e678 as nil") + } + b.PutInt53(d.ChatID) + b.PutBool(d.RestorePrevious) + return nil +} + +// Decode implements bin.Decoder. +func (d *DeleteChatBackgroundRequest) Decode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode deleteChatBackground#1316e678 to nil") + } + if err := b.ConsumeID(DeleteChatBackgroundRequestTypeID); err != nil { + return fmt.Errorf("unable to decode deleteChatBackground#1316e678: %w", err) + } + return d.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (d *DeleteChatBackgroundRequest) DecodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode deleteChatBackground#1316e678 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode deleteChatBackground#1316e678: field chat_id: %w", err) + } + d.ChatID = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode deleteChatBackground#1316e678: field restore_previous: %w", err) + } + d.RestorePrevious = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (d *DeleteChatBackgroundRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if d == nil { + return fmt.Errorf("can't encode deleteChatBackground#1316e678 as nil") + } + b.ObjStart() + b.PutID("deleteChatBackground") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(d.ChatID) + b.Comma() + b.FieldStart("restore_previous") + b.PutBool(d.RestorePrevious) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (d *DeleteChatBackgroundRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if d == nil { + return fmt.Errorf("can't decode deleteChatBackground#1316e678 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("deleteChatBackground"); err != nil { + return fmt.Errorf("unable to decode deleteChatBackground#1316e678: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode deleteChatBackground#1316e678: field chat_id: %w", err) + } + d.ChatID = value + case "restore_previous": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode deleteChatBackground#1316e678: field restore_previous: %w", err) + } + d.RestorePrevious = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (d *DeleteChatBackgroundRequest) GetChatID() (value int64) { + if d == nil { + return + } + return d.ChatID +} + +// GetRestorePrevious returns value of RestorePrevious field. +func (d *DeleteChatBackgroundRequest) GetRestorePrevious() (value bool) { + if d == nil { + return + } + return d.RestorePrevious +} + +// DeleteChatBackground invokes method deleteChatBackground#1316e678 returning error if any. +func (c *Client) DeleteChatBackground(ctx context.Context, request *DeleteChatBackgroundRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_found_chat_boosts_gen.go b/tdapi/tl_found_chat_boosts_gen.go index 356cb9c5ba..aaf4790046 100644 --- a/tdapi/tl_found_chat_boosts_gen.go +++ b/tdapi/tl_found_chat_boosts_gen.go @@ -37,7 +37,7 @@ type FoundChatBoosts struct { TotalCount int32 // List of boosts Boosts []ChatBoost - // The offset for the next request. If empty, there are no more results + // The offset for the next request. If empty, then there are no more results NextOffset string } diff --git a/tdapi/tl_found_file_downloads_gen.go b/tdapi/tl_found_file_downloads_gen.go index 269337de78..cd3855f4c4 100644 --- a/tdapi/tl_found_file_downloads_gen.go +++ b/tdapi/tl_found_file_downloads_gen.go @@ -37,7 +37,7 @@ type FoundFileDownloads struct { TotalCounts DownloadedFileCounts // The list of files Files []FileDownload - // The offset for the next request. If empty, there are no more results + // The offset for the next request. If empty, then there are no more results NextOffset string } diff --git a/tdapi/tl_found_messages_gen.go b/tdapi/tl_found_messages_gen.go index f06f4da307..239f820b15 100644 --- a/tdapi/tl_found_messages_gen.go +++ b/tdapi/tl_found_messages_gen.go @@ -37,7 +37,7 @@ type FoundMessages struct { TotalCount int32 // List of messages Messages []Message - // The offset for the next request. If empty, there are no more results + // The offset for the next request. If empty, then there are no more results NextOffset string } diff --git a/tdapi/tl_get_chat_similar_chat_count_gen.go b/tdapi/tl_get_chat_similar_chat_count_gen.go new file mode 100644 index 0000000000..18156fd0a1 --- /dev/null +++ b/tdapi/tl_get_chat_similar_chat_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{} +) + +// GetChatSimilarChatCountRequest represents TL type `getChatSimilarChatCount#463e968e`. +type GetChatSimilarChatCountRequest struct { + // Identifier of the target chat; must be an identifier of a channel chat + ChatID int64 + // Pass true to get the number of chats without sending network requests, or -1 if the + // number of chats is unknown locally + ReturnLocal bool +} + +// GetChatSimilarChatCountRequestTypeID is TL type id of GetChatSimilarChatCountRequest. +const GetChatSimilarChatCountRequestTypeID = 0x463e968e + +// Ensuring interfaces in compile-time for GetChatSimilarChatCountRequest. +var ( + _ bin.Encoder = &GetChatSimilarChatCountRequest{} + _ bin.Decoder = &GetChatSimilarChatCountRequest{} + _ bin.BareEncoder = &GetChatSimilarChatCountRequest{} + _ bin.BareDecoder = &GetChatSimilarChatCountRequest{} +) + +func (g *GetChatSimilarChatCountRequest) Zero() bool { + if g == nil { + return true + } + if !(g.ChatID == 0) { + return false + } + if !(g.ReturnLocal == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetChatSimilarChatCountRequest) String() string { + if g == nil { + return "GetChatSimilarChatCountRequest(nil)" + } + type Alias GetChatSimilarChatCountRequest + return fmt.Sprintf("GetChatSimilarChatCountRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetChatSimilarChatCountRequest) TypeID() uint32 { + return GetChatSimilarChatCountRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetChatSimilarChatCountRequest) TypeName() string { + return "getChatSimilarChatCount" +} + +// TypeInfo returns info about TL type. +func (g *GetChatSimilarChatCountRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getChatSimilarChatCount", + ID: GetChatSimilarChatCountRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "ReturnLocal", + SchemaName: "return_local", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetChatSimilarChatCountRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getChatSimilarChatCount#463e968e as nil") + } + b.PutID(GetChatSimilarChatCountRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetChatSimilarChatCountRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getChatSimilarChatCount#463e968e as nil") + } + b.PutInt53(g.ChatID) + b.PutBool(g.ReturnLocal) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetChatSimilarChatCountRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getChatSimilarChatCount#463e968e to nil") + } + if err := b.ConsumeID(GetChatSimilarChatCountRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getChatSimilarChatCount#463e968e: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetChatSimilarChatCountRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getChatSimilarChatCount#463e968e to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getChatSimilarChatCount#463e968e: field chat_id: %w", err) + } + g.ChatID = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode getChatSimilarChatCount#463e968e: field return_local: %w", err) + } + g.ReturnLocal = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetChatSimilarChatCountRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getChatSimilarChatCount#463e968e as nil") + } + b.ObjStart() + b.PutID("getChatSimilarChatCount") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(g.ChatID) + b.Comma() + b.FieldStart("return_local") + b.PutBool(g.ReturnLocal) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetChatSimilarChatCountRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getChatSimilarChatCount#463e968e to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getChatSimilarChatCount"); err != nil { + return fmt.Errorf("unable to decode getChatSimilarChatCount#463e968e: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getChatSimilarChatCount#463e968e: field chat_id: %w", err) + } + g.ChatID = value + case "return_local": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode getChatSimilarChatCount#463e968e: field return_local: %w", err) + } + g.ReturnLocal = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (g *GetChatSimilarChatCountRequest) GetChatID() (value int64) { + if g == nil { + return + } + return g.ChatID +} + +// GetReturnLocal returns value of ReturnLocal field. +func (g *GetChatSimilarChatCountRequest) GetReturnLocal() (value bool) { + if g == nil { + return + } + return g.ReturnLocal +} + +// GetChatSimilarChatCount invokes method getChatSimilarChatCount#463e968e returning error if any. +func (c *Client) GetChatSimilarChatCount(ctx context.Context, request *GetChatSimilarChatCountRequest) (*Count, error) { + var result Count + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_chat_similar_chats_gen.go b/tdapi/tl_get_chat_similar_chats_gen.go new file mode 100644 index 0000000000..3b1aaa72e6 --- /dev/null +++ b/tdapi/tl_get_chat_similar_chats_gen.go @@ -0,0 +1,206 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// GetChatSimilarChatsRequest represents TL type `getChatSimilarChats#bb508f83`. +type GetChatSimilarChatsRequest struct { + // Identifier of the target chat; must be an identifier of a channel chat + ChatID int64 +} + +// GetChatSimilarChatsRequestTypeID is TL type id of GetChatSimilarChatsRequest. +const GetChatSimilarChatsRequestTypeID = 0xbb508f83 + +// Ensuring interfaces in compile-time for GetChatSimilarChatsRequest. +var ( + _ bin.Encoder = &GetChatSimilarChatsRequest{} + _ bin.Decoder = &GetChatSimilarChatsRequest{} + _ bin.BareEncoder = &GetChatSimilarChatsRequest{} + _ bin.BareDecoder = &GetChatSimilarChatsRequest{} +) + +func (g *GetChatSimilarChatsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.ChatID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetChatSimilarChatsRequest) String() string { + if g == nil { + return "GetChatSimilarChatsRequest(nil)" + } + type Alias GetChatSimilarChatsRequest + return fmt.Sprintf("GetChatSimilarChatsRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetChatSimilarChatsRequest) TypeID() uint32 { + return GetChatSimilarChatsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetChatSimilarChatsRequest) TypeName() string { + return "getChatSimilarChats" +} + +// TypeInfo returns info about TL type. +func (g *GetChatSimilarChatsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getChatSimilarChats", + ID: GetChatSimilarChatsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetChatSimilarChatsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getChatSimilarChats#bb508f83 as nil") + } + b.PutID(GetChatSimilarChatsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetChatSimilarChatsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getChatSimilarChats#bb508f83 as nil") + } + b.PutInt53(g.ChatID) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetChatSimilarChatsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getChatSimilarChats#bb508f83 to nil") + } + if err := b.ConsumeID(GetChatSimilarChatsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getChatSimilarChats#bb508f83: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetChatSimilarChatsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getChatSimilarChats#bb508f83 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getChatSimilarChats#bb508f83: field chat_id: %w", err) + } + g.ChatID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetChatSimilarChatsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getChatSimilarChats#bb508f83 as nil") + } + b.ObjStart() + b.PutID("getChatSimilarChats") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(g.ChatID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetChatSimilarChatsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getChatSimilarChats#bb508f83 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getChatSimilarChats"); err != nil { + return fmt.Errorf("unable to decode getChatSimilarChats#bb508f83: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getChatSimilarChats#bb508f83: field chat_id: %w", err) + } + g.ChatID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (g *GetChatSimilarChatsRequest) GetChatID() (value int64) { + if g == nil { + return + } + return g.ChatID +} + +// GetChatSimilarChats invokes method getChatSimilarChats#bb508f83 returning error if any. +func (c *Client) GetChatSimilarChats(ctx context.Context, chatid int64) (*Chats, error) { + var result Chats + + request := &GetChatSimilarChatsRequest{ + ChatID: chatid, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_story_public_forwards_gen.go b/tdapi/tl_get_story_public_forwards_gen.go new file mode 100644 index 0000000000..b1149781ea --- /dev/null +++ b/tdapi/tl_get_story_public_forwards_gen.go @@ -0,0 +1,308 @@ +// 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{} +) + +// GetStoryPublicForwardsRequest represents TL type `getStoryPublicForwards#8b835be9`. +type GetStoryPublicForwardsRequest struct { + // The identifier of the sender of the story + StorySenderChatID int64 + // The identifier of the story + StoryID int32 + // 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 messages and stories to be returned; must be positive and can't + // be greater than 100. For optimal performance, the number of returned objects is chosen + // by TDLib and can be smaller than the specified limit + Limit int32 +} + +// GetStoryPublicForwardsRequestTypeID is TL type id of GetStoryPublicForwardsRequest. +const GetStoryPublicForwardsRequestTypeID = 0x8b835be9 + +// Ensuring interfaces in compile-time for GetStoryPublicForwardsRequest. +var ( + _ bin.Encoder = &GetStoryPublicForwardsRequest{} + _ bin.Decoder = &GetStoryPublicForwardsRequest{} + _ bin.BareEncoder = &GetStoryPublicForwardsRequest{} + _ bin.BareDecoder = &GetStoryPublicForwardsRequest{} +) + +func (g *GetStoryPublicForwardsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.StorySenderChatID == 0) { + return false + } + if !(g.StoryID == 0) { + return false + } + if !(g.Offset == "") { + return false + } + if !(g.Limit == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetStoryPublicForwardsRequest) String() string { + if g == nil { + return "GetStoryPublicForwardsRequest(nil)" + } + type Alias GetStoryPublicForwardsRequest + return fmt.Sprintf("GetStoryPublicForwardsRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetStoryPublicForwardsRequest) TypeID() uint32 { + return GetStoryPublicForwardsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetStoryPublicForwardsRequest) TypeName() string { + return "getStoryPublicForwards" +} + +// TypeInfo returns info about TL type. +func (g *GetStoryPublicForwardsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getStoryPublicForwards", + ID: GetStoryPublicForwardsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "StorySenderChatID", + SchemaName: "story_sender_chat_id", + }, + { + Name: "StoryID", + SchemaName: "story_id", + }, + { + Name: "Offset", + SchemaName: "offset", + }, + { + Name: "Limit", + SchemaName: "limit", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetStoryPublicForwardsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getStoryPublicForwards#8b835be9 as nil") + } + b.PutID(GetStoryPublicForwardsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetStoryPublicForwardsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getStoryPublicForwards#8b835be9 as nil") + } + b.PutInt53(g.StorySenderChatID) + b.PutInt32(g.StoryID) + b.PutString(g.Offset) + b.PutInt32(g.Limit) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetStoryPublicForwardsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getStoryPublicForwards#8b835be9 to nil") + } + if err := b.ConsumeID(GetStoryPublicForwardsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getStoryPublicForwards#8b835be9: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetStoryPublicForwardsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getStoryPublicForwards#8b835be9 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getStoryPublicForwards#8b835be9: field story_sender_chat_id: %w", err) + } + g.StorySenderChatID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getStoryPublicForwards#8b835be9: field story_id: %w", err) + } + g.StoryID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getStoryPublicForwards#8b835be9: field offset: %w", err) + } + g.Offset = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getStoryPublicForwards#8b835be9: field limit: %w", err) + } + g.Limit = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetStoryPublicForwardsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getStoryPublicForwards#8b835be9 as nil") + } + b.ObjStart() + b.PutID("getStoryPublicForwards") + b.Comma() + b.FieldStart("story_sender_chat_id") + b.PutInt53(g.StorySenderChatID) + b.Comma() + b.FieldStart("story_id") + b.PutInt32(g.StoryID) + 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 *GetStoryPublicForwardsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getStoryPublicForwards#8b835be9 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getStoryPublicForwards"); err != nil { + return fmt.Errorf("unable to decode getStoryPublicForwards#8b835be9: %w", err) + } + case "story_sender_chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getStoryPublicForwards#8b835be9: field story_sender_chat_id: %w", err) + } + g.StorySenderChatID = value + case "story_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getStoryPublicForwards#8b835be9: field story_id: %w", err) + } + g.StoryID = value + case "offset": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getStoryPublicForwards#8b835be9: field offset: %w", err) + } + g.Offset = value + case "limit": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getStoryPublicForwards#8b835be9: field limit: %w", err) + } + g.Limit = value + default: + return b.Skip() + } + return nil + }) +} + +// GetStorySenderChatID returns value of StorySenderChatID field. +func (g *GetStoryPublicForwardsRequest) GetStorySenderChatID() (value int64) { + if g == nil { + return + } + return g.StorySenderChatID +} + +// GetStoryID returns value of StoryID field. +func (g *GetStoryPublicForwardsRequest) GetStoryID() (value int32) { + if g == nil { + return + } + return g.StoryID +} + +// GetOffset returns value of Offset field. +func (g *GetStoryPublicForwardsRequest) GetOffset() (value string) { + if g == nil { + return + } + return g.Offset +} + +// GetLimit returns value of Limit field. +func (g *GetStoryPublicForwardsRequest) GetLimit() (value int32) { + if g == nil { + return + } + return g.Limit +} + +// GetStoryPublicForwards invokes method getStoryPublicForwards#8b835be9 returning error if any. +func (c *Client) GetStoryPublicForwards(ctx context.Context, request *GetStoryPublicForwardsRequest) (*StoryPublicForwards, error) { + var result StoryPublicForwards + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_story_statistics_gen.go b/tdapi/tl_get_story_statistics_gen.go new file mode 100644 index 0000000000..0eaae4b0d0 --- /dev/null +++ b/tdapi/tl_get_story_statistics_gen.go @@ -0,0 +1,271 @@ +// 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{} +) + +// GetStoryStatisticsRequest represents TL type `getStoryStatistics#3a964342`. +type GetStoryStatisticsRequest struct { + // Chat identifier + ChatID int64 + // Story identifier + StoryID int32 + // Pass true if a dark theme is used by the application + IsDark bool +} + +// GetStoryStatisticsRequestTypeID is TL type id of GetStoryStatisticsRequest. +const GetStoryStatisticsRequestTypeID = 0x3a964342 + +// Ensuring interfaces in compile-time for GetStoryStatisticsRequest. +var ( + _ bin.Encoder = &GetStoryStatisticsRequest{} + _ bin.Decoder = &GetStoryStatisticsRequest{} + _ bin.BareEncoder = &GetStoryStatisticsRequest{} + _ bin.BareDecoder = &GetStoryStatisticsRequest{} +) + +func (g *GetStoryStatisticsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.ChatID == 0) { + return false + } + if !(g.StoryID == 0) { + return false + } + if !(g.IsDark == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetStoryStatisticsRequest) String() string { + if g == nil { + return "GetStoryStatisticsRequest(nil)" + } + type Alias GetStoryStatisticsRequest + return fmt.Sprintf("GetStoryStatisticsRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetStoryStatisticsRequest) TypeID() uint32 { + return GetStoryStatisticsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetStoryStatisticsRequest) TypeName() string { + return "getStoryStatistics" +} + +// TypeInfo returns info about TL type. +func (g *GetStoryStatisticsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getStoryStatistics", + ID: GetStoryStatisticsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "StoryID", + SchemaName: "story_id", + }, + { + Name: "IsDark", + SchemaName: "is_dark", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetStoryStatisticsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getStoryStatistics#3a964342 as nil") + } + b.PutID(GetStoryStatisticsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetStoryStatisticsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getStoryStatistics#3a964342 as nil") + } + b.PutInt53(g.ChatID) + b.PutInt32(g.StoryID) + b.PutBool(g.IsDark) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetStoryStatisticsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getStoryStatistics#3a964342 to nil") + } + if err := b.ConsumeID(GetStoryStatisticsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getStoryStatistics#3a964342: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetStoryStatisticsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getStoryStatistics#3a964342 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getStoryStatistics#3a964342: field chat_id: %w", err) + } + g.ChatID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getStoryStatistics#3a964342: field story_id: %w", err) + } + g.StoryID = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode getStoryStatistics#3a964342: field is_dark: %w", err) + } + g.IsDark = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetStoryStatisticsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getStoryStatistics#3a964342 as nil") + } + b.ObjStart() + b.PutID("getStoryStatistics") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(g.ChatID) + b.Comma() + b.FieldStart("story_id") + b.PutInt32(g.StoryID) + b.Comma() + b.FieldStart("is_dark") + b.PutBool(g.IsDark) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetStoryStatisticsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getStoryStatistics#3a964342 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getStoryStatistics"); err != nil { + return fmt.Errorf("unable to decode getStoryStatistics#3a964342: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getStoryStatistics#3a964342: field chat_id: %w", err) + } + g.ChatID = value + case "story_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getStoryStatistics#3a964342: field story_id: %w", err) + } + g.StoryID = value + case "is_dark": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode getStoryStatistics#3a964342: field is_dark: %w", err) + } + g.IsDark = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (g *GetStoryStatisticsRequest) GetChatID() (value int64) { + if g == nil { + return + } + return g.ChatID +} + +// GetStoryID returns value of StoryID field. +func (g *GetStoryStatisticsRequest) GetStoryID() (value int32) { + if g == nil { + return + } + return g.StoryID +} + +// GetIsDark returns value of IsDark field. +func (g *GetStoryStatisticsRequest) GetIsDark() (value bool) { + if g == nil { + return + } + return g.IsDark +} + +// GetStoryStatistics invokes method getStoryStatistics#3a964342 returning error if any. +func (c *Client) GetStoryStatistics(ctx context.Context, request *GetStoryStatisticsRequest) (*StoryStatistics, error) { + var result StoryStatistics + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_inline_query_results_gen.go b/tdapi/tl_inline_query_results_gen.go index ea3663457c..7d3eee6810 100644 --- a/tdapi/tl_inline_query_results_gen.go +++ b/tdapi/tl_inline_query_results_gen.go @@ -39,7 +39,7 @@ type InlineQueryResults struct { Button InlineQueryResultsButton // Results of the query Results []InlineQueryResultClass - // The offset for the next request. If empty, there are no more results + // The offset for the next request. If empty, then there are no more results NextOffset string } diff --git a/tdapi/tl_input_message_reply_to_gen.go b/tdapi/tl_input_message_reply_to_gen.go index eeb582a491..c74c4e9519 100644 --- a/tdapi/tl_input_message_reply_to_gen.go +++ b/tdapi/tl_input_message_reply_to_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// InputMessageReplyToMessage represents TL type `inputMessageReplyToMessage#20b16f06`. +// InputMessageReplyToMessage represents TL type `inputMessageReplyToMessage#11e3fd76`. type InputMessageReplyToMessage struct { // The identifier of the chat to which the message to be replied belongs; pass 0 if the // message to be replied is in the same chat. Must always be 0 for replies in secret @@ -40,14 +40,13 @@ type InputMessageReplyToMessage struct { ChatID int64 // The identifier of the message to be replied in the same or the specified chat MessageID int64 - // Manually chosen quote from the message to be replied; pass null if none; - // 0-getOption("message_reply_quote_length_max") characters. Must always be null for - // replies in secret chats. - Quote FormattedText + // Quote from the message to be replied; pass null if none. Must always be null for + // replies in secret chats + Quote InputTextQuote } // InputMessageReplyToMessageTypeID is TL type id of InputMessageReplyToMessage. -const InputMessageReplyToMessageTypeID = 0x20b16f06 +const InputMessageReplyToMessageTypeID = 0x11e3fd76 // construct implements constructor of InputMessageReplyToClass. func (i InputMessageReplyToMessage) construct() InputMessageReplyToClass { return &i } @@ -130,7 +129,7 @@ func (i *InputMessageReplyToMessage) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (i *InputMessageReplyToMessage) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputMessageReplyToMessage#20b16f06 as nil") + return fmt.Errorf("can't encode inputMessageReplyToMessage#11e3fd76 as nil") } b.PutID(InputMessageReplyToMessageTypeID) return i.EncodeBare(b) @@ -139,12 +138,12 @@ func (i *InputMessageReplyToMessage) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (i *InputMessageReplyToMessage) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputMessageReplyToMessage#20b16f06 as nil") + return fmt.Errorf("can't encode inputMessageReplyToMessage#11e3fd76 as nil") } b.PutInt53(i.ChatID) b.PutInt53(i.MessageID) if err := i.Quote.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageReplyToMessage#20b16f06: field quote: %w", err) + return fmt.Errorf("unable to encode inputMessageReplyToMessage#11e3fd76: field quote: %w", err) } return nil } @@ -152,10 +151,10 @@ func (i *InputMessageReplyToMessage) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (i *InputMessageReplyToMessage) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputMessageReplyToMessage#20b16f06 to nil") + return fmt.Errorf("can't decode inputMessageReplyToMessage#11e3fd76 to nil") } if err := b.ConsumeID(InputMessageReplyToMessageTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToMessage#20b16f06: %w", err) + return fmt.Errorf("unable to decode inputMessageReplyToMessage#11e3fd76: %w", err) } return i.DecodeBare(b) } @@ -163,25 +162,25 @@ func (i *InputMessageReplyToMessage) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (i *InputMessageReplyToMessage) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputMessageReplyToMessage#20b16f06 to nil") + return fmt.Errorf("can't decode inputMessageReplyToMessage#11e3fd76 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToMessage#20b16f06: field chat_id: %w", err) + return fmt.Errorf("unable to decode inputMessageReplyToMessage#11e3fd76: field chat_id: %w", err) } i.ChatID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToMessage#20b16f06: field message_id: %w", err) + return fmt.Errorf("unable to decode inputMessageReplyToMessage#11e3fd76: field message_id: %w", err) } i.MessageID = value } { if err := i.Quote.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToMessage#20b16f06: field quote: %w", err) + return fmt.Errorf("unable to decode inputMessageReplyToMessage#11e3fd76: field quote: %w", err) } } return nil @@ -190,7 +189,7 @@ func (i *InputMessageReplyToMessage) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (i *InputMessageReplyToMessage) EncodeTDLibJSON(b tdjson.Encoder) error { if i == nil { - return fmt.Errorf("can't encode inputMessageReplyToMessage#20b16f06 as nil") + return fmt.Errorf("can't encode inputMessageReplyToMessage#11e3fd76 as nil") } b.ObjStart() b.PutID("inputMessageReplyToMessage") @@ -203,7 +202,7 @@ func (i *InputMessageReplyToMessage) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("quote") if err := i.Quote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageReplyToMessage#20b16f06: field quote: %w", err) + return fmt.Errorf("unable to encode inputMessageReplyToMessage#11e3fd76: field quote: %w", err) } b.Comma() b.StripComma() @@ -214,30 +213,30 @@ func (i *InputMessageReplyToMessage) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (i *InputMessageReplyToMessage) DecodeTDLibJSON(b tdjson.Decoder) error { if i == nil { - return fmt.Errorf("can't decode inputMessageReplyToMessage#20b16f06 to nil") + return fmt.Errorf("can't decode inputMessageReplyToMessage#11e3fd76 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("inputMessageReplyToMessage"); err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToMessage#20b16f06: %w", err) + return fmt.Errorf("unable to decode inputMessageReplyToMessage#11e3fd76: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToMessage#20b16f06: field chat_id: %w", err) + return fmt.Errorf("unable to decode inputMessageReplyToMessage#11e3fd76: field chat_id: %w", err) } i.ChatID = value case "message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToMessage#20b16f06: field message_id: %w", err) + return fmt.Errorf("unable to decode inputMessageReplyToMessage#11e3fd76: field message_id: %w", err) } i.MessageID = value case "quote": if err := i.Quote.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToMessage#20b16f06: field quote: %w", err) + return fmt.Errorf("unable to decode inputMessageReplyToMessage#11e3fd76: field quote: %w", err) } default: return b.Skip() @@ -263,7 +262,7 @@ func (i *InputMessageReplyToMessage) GetMessageID() (value int64) { } // GetQuote returns value of Quote field. -func (i *InputMessageReplyToMessage) GetQuote() (value FormattedText) { +func (i *InputMessageReplyToMessage) GetQuote() (value InputTextQuote) { if i == nil { return } @@ -483,7 +482,7 @@ const InputMessageReplyToClassName = "InputMessageReplyTo" // panic(err) // } // switch v := g.(type) { -// case *tdapi.InputMessageReplyToMessage: // inputMessageReplyToMessage#20b16f06 +// case *tdapi.InputMessageReplyToMessage: // inputMessageReplyToMessage#11e3fd76 // case *tdapi.InputMessageReplyToStory: // inputMessageReplyToStory#51aece78 // default: panic(v) // } @@ -517,7 +516,7 @@ func DecodeInputMessageReplyTo(buf *bin.Buffer) (InputMessageReplyToClass, error } switch id { case InputMessageReplyToMessageTypeID: - // Decoding inputMessageReplyToMessage#20b16f06. + // Decoding inputMessageReplyToMessage#11e3fd76. v := InputMessageReplyToMessage{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode InputMessageReplyToClass: %w", err) @@ -543,7 +542,7 @@ func DecodeTDLibJSONInputMessageReplyTo(buf tdjson.Decoder) (InputMessageReplyTo } switch id { case "inputMessageReplyToMessage": - // Decoding inputMessageReplyToMessage#20b16f06. + // Decoding inputMessageReplyToMessage#11e3fd76. v := InputMessageReplyToMessage{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode InputMessageReplyToClass: %w", err) diff --git a/tdapi/tl_input_text_quote_gen.go b/tdapi/tl_input_text_quote_gen.go new file mode 100644 index 0000000000..109b32dcee --- /dev/null +++ b/tdapi/tl_input_text_quote_gen.go @@ -0,0 +1,229 @@ +// 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{} +) + +// InputTextQuote represents TL type `inputTextQuote#b74a6d1c`. +type InputTextQuote struct { + // Text of the quote; 0-getOption("message_reply_quote_length_max") characters. Only Bold + // Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed to be + // kept and must be kept in the quote + Text FormattedText + // Quote position in the original message in UTF-16 code units + Position int32 +} + +// InputTextQuoteTypeID is TL type id of InputTextQuote. +const InputTextQuoteTypeID = 0xb74a6d1c + +// Ensuring interfaces in compile-time for InputTextQuote. +var ( + _ bin.Encoder = &InputTextQuote{} + _ bin.Decoder = &InputTextQuote{} + _ bin.BareEncoder = &InputTextQuote{} + _ bin.BareDecoder = &InputTextQuote{} +) + +func (i *InputTextQuote) Zero() bool { + if i == nil { + return true + } + if !(i.Text.Zero()) { + return false + } + if !(i.Position == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputTextQuote) String() string { + if i == nil { + return "InputTextQuote(nil)" + } + type Alias InputTextQuote + return fmt.Sprintf("InputTextQuote%+v", Alias(*i)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputTextQuote) TypeID() uint32 { + return InputTextQuoteTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputTextQuote) TypeName() string { + return "inputTextQuote" +} + +// TypeInfo returns info about TL type. +func (i *InputTextQuote) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputTextQuote", + ID: InputTextQuoteTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Text", + SchemaName: "text", + }, + { + Name: "Position", + SchemaName: "position", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *InputTextQuote) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputTextQuote#b74a6d1c as nil") + } + b.PutID(InputTextQuoteTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputTextQuote) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputTextQuote#b74a6d1c as nil") + } + if err := i.Text.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputTextQuote#b74a6d1c: field text: %w", err) + } + b.PutInt32(i.Position) + return nil +} + +// Decode implements bin.Decoder. +func (i *InputTextQuote) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputTextQuote#b74a6d1c to nil") + } + if err := b.ConsumeID(InputTextQuoteTypeID); err != nil { + return fmt.Errorf("unable to decode inputTextQuote#b74a6d1c: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputTextQuote) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputTextQuote#b74a6d1c to nil") + } + { + if err := i.Text.Decode(b); err != nil { + return fmt.Errorf("unable to decode inputTextQuote#b74a6d1c: field text: %w", err) + } + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode inputTextQuote#b74a6d1c: field position: %w", err) + } + i.Position = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (i *InputTextQuote) EncodeTDLibJSON(b tdjson.Encoder) error { + if i == nil { + return fmt.Errorf("can't encode inputTextQuote#b74a6d1c as nil") + } + b.ObjStart() + b.PutID("inputTextQuote") + b.Comma() + b.FieldStart("text") + if err := i.Text.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode inputTextQuote#b74a6d1c: field text: %w", err) + } + b.Comma() + b.FieldStart("position") + b.PutInt32(i.Position) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (i *InputTextQuote) DecodeTDLibJSON(b tdjson.Decoder) error { + if i == nil { + return fmt.Errorf("can't decode inputTextQuote#b74a6d1c to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("inputTextQuote"); err != nil { + return fmt.Errorf("unable to decode inputTextQuote#b74a6d1c: %w", err) + } + case "text": + if err := i.Text.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode inputTextQuote#b74a6d1c: field text: %w", err) + } + case "position": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode inputTextQuote#b74a6d1c: field position: %w", err) + } + i.Position = value + default: + return b.Skip() + } + return nil + }) +} + +// GetText returns value of Text field. +func (i *InputTextQuote) GetText() (value FormattedText) { + if i == nil { + return + } + return i.Text +} + +// GetPosition returns value of Position field. +func (i *InputTextQuote) GetPosition() (value int32) { + if i == nil { + return + } + return i.Position +} diff --git a/tdapi/tl_message_content_gen.go b/tdapi/tl_message_content_gen.go index 14102f2b4c..ef1e10c61b 100644 --- a/tdapi/tl_message_content_gen.go +++ b/tdapi/tl_message_content_gen.go @@ -37,7 +37,7 @@ type MessageText struct { Text FormattedText // A link preview attached to the message; may be null WebPage WebPage - // Options which was used for generation of the link preview; may be null if default + // Options which were used for generation of the link preview; may be null if default // options were used LinkPreviewOptions LinkPreviewOptions } @@ -7754,17 +7754,19 @@ func (m *MessageScreenshotTaken) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// MessageChatSetBackground represents TL type `messageChatSetBackground#81819731`. +// MessageChatSetBackground represents TL type `messageChatSetBackground#3d5d7c40`. type MessageChatSetBackground struct { // Identifier of the message with a previously set same background; 0 if none. Can be an // identifier of a deleted message OldBackgroundMessageID int64 // The new background Background ChatBackground + // True, if the background was set only for self + OnlyForSelf bool } // MessageChatSetBackgroundTypeID is TL type id of MessageChatSetBackground. -const MessageChatSetBackgroundTypeID = 0x81819731 +const MessageChatSetBackgroundTypeID = 0x3d5d7c40 // construct implements constructor of MessageContentClass. func (m MessageChatSetBackground) construct() MessageContentClass { return &m } @@ -7789,6 +7791,9 @@ func (m *MessageChatSetBackground) Zero() bool { if !(m.Background.Zero()) { return false } + if !(m.OnlyForSelf == false) { + return false + } return true } @@ -7833,6 +7838,10 @@ func (m *MessageChatSetBackground) TypeInfo() tdp.Type { Name: "Background", SchemaName: "background", }, + { + Name: "OnlyForSelf", + SchemaName: "only_for_self", + }, } return typ } @@ -7840,7 +7849,7 @@ func (m *MessageChatSetBackground) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (m *MessageChatSetBackground) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageChatSetBackground#81819731 as nil") + return fmt.Errorf("can't encode messageChatSetBackground#3d5d7c40 as nil") } b.PutID(MessageChatSetBackgroundTypeID) return m.EncodeBare(b) @@ -7849,22 +7858,23 @@ func (m *MessageChatSetBackground) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageChatSetBackground) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageChatSetBackground#81819731 as nil") + return fmt.Errorf("can't encode messageChatSetBackground#3d5d7c40 as nil") } b.PutInt53(m.OldBackgroundMessageID) if err := m.Background.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageChatSetBackground#81819731: field background: %w", err) + return fmt.Errorf("unable to encode messageChatSetBackground#3d5d7c40: field background: %w", err) } + b.PutBool(m.OnlyForSelf) return nil } // Decode implements bin.Decoder. func (m *MessageChatSetBackground) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageChatSetBackground#81819731 to nil") + return fmt.Errorf("can't decode messageChatSetBackground#3d5d7c40 to nil") } if err := b.ConsumeID(MessageChatSetBackgroundTypeID); err != nil { - return fmt.Errorf("unable to decode messageChatSetBackground#81819731: %w", err) + return fmt.Errorf("unable to decode messageChatSetBackground#3d5d7c40: %w", err) } return m.DecodeBare(b) } @@ -7872,19 +7882,26 @@ func (m *MessageChatSetBackground) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageChatSetBackground) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageChatSetBackground#81819731 to nil") + return fmt.Errorf("can't decode messageChatSetBackground#3d5d7c40 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode messageChatSetBackground#81819731: field old_background_message_id: %w", err) + return fmt.Errorf("unable to decode messageChatSetBackground#3d5d7c40: field old_background_message_id: %w", err) } m.OldBackgroundMessageID = value } { if err := m.Background.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageChatSetBackground#81819731: field background: %w", err) + return fmt.Errorf("unable to decode messageChatSetBackground#3d5d7c40: field background: %w", err) + } + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageChatSetBackground#3d5d7c40: field only_for_self: %w", err) } + m.OnlyForSelf = value } return nil } @@ -7892,7 +7909,7 @@ func (m *MessageChatSetBackground) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (m *MessageChatSetBackground) EncodeTDLibJSON(b tdjson.Encoder) error { if m == nil { - return fmt.Errorf("can't encode messageChatSetBackground#81819731 as nil") + return fmt.Errorf("can't encode messageChatSetBackground#3d5d7c40 as nil") } b.ObjStart() b.PutID("messageChatSetBackground") @@ -7902,9 +7919,12 @@ func (m *MessageChatSetBackground) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("background") if err := m.Background.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageChatSetBackground#81819731: field background: %w", err) + return fmt.Errorf("unable to encode messageChatSetBackground#3d5d7c40: field background: %w", err) } b.Comma() + b.FieldStart("only_for_self") + b.PutBool(m.OnlyForSelf) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -7913,25 +7933,31 @@ func (m *MessageChatSetBackground) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (m *MessageChatSetBackground) DecodeTDLibJSON(b tdjson.Decoder) error { if m == nil { - return fmt.Errorf("can't decode messageChatSetBackground#81819731 to nil") + return fmt.Errorf("can't decode messageChatSetBackground#3d5d7c40 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("messageChatSetBackground"); err != nil { - return fmt.Errorf("unable to decode messageChatSetBackground#81819731: %w", err) + return fmt.Errorf("unable to decode messageChatSetBackground#3d5d7c40: %w", err) } case "old_background_message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode messageChatSetBackground#81819731: field old_background_message_id: %w", err) + return fmt.Errorf("unable to decode messageChatSetBackground#3d5d7c40: field old_background_message_id: %w", err) } m.OldBackgroundMessageID = value case "background": if err := m.Background.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageChatSetBackground#81819731: field background: %w", err) + return fmt.Errorf("unable to decode messageChatSetBackground#3d5d7c40: field background: %w", err) } + case "only_for_self": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageChatSetBackground#3d5d7c40: field only_for_self: %w", err) + } + m.OnlyForSelf = value default: return b.Skip() } @@ -7955,6 +7981,14 @@ func (m *MessageChatSetBackground) GetBackground() (value ChatBackground) { return m.Background } +// GetOnlyForSelf returns value of OnlyForSelf field. +func (m *MessageChatSetBackground) GetOnlyForSelf() (value bool) { + if m == nil { + return + } + return m.OnlyForSelf +} + // MessageChatSetTheme represents TL type `messageChatSetTheme#99ae9408`. type MessageChatSetTheme struct { // If non-empty, name of a new theme, set for the chat. Otherwise, chat theme was reset @@ -11581,6 +11615,240 @@ func (m *MessagePremiumGiveaway) GetSticker() (value Sticker) { return m.Sticker } +// MessagePremiumGiveawayCompleted represents TL type `messagePremiumGiveawayCompleted#80533949`. +type MessagePremiumGiveawayCompleted struct { + // Identifier of the message with the giveaway, can be an identifier of a deleted message + GiveawayMessageID int64 + // Number of winners in the giveaway + WinnerCount int32 + // Number of undistributed prizes + UnclaimedPrizeCount int32 +} + +// MessagePremiumGiveawayCompletedTypeID is TL type id of MessagePremiumGiveawayCompleted. +const MessagePremiumGiveawayCompletedTypeID = 0x80533949 + +// construct implements constructor of MessageContentClass. +func (m MessagePremiumGiveawayCompleted) construct() MessageContentClass { return &m } + +// Ensuring interfaces in compile-time for MessagePremiumGiveawayCompleted. +var ( + _ bin.Encoder = &MessagePremiumGiveawayCompleted{} + _ bin.Decoder = &MessagePremiumGiveawayCompleted{} + _ bin.BareEncoder = &MessagePremiumGiveawayCompleted{} + _ bin.BareDecoder = &MessagePremiumGiveawayCompleted{} + + _ MessageContentClass = &MessagePremiumGiveawayCompleted{} +) + +func (m *MessagePremiumGiveawayCompleted) Zero() bool { + if m == nil { + return true + } + if !(m.GiveawayMessageID == 0) { + return false + } + if !(m.WinnerCount == 0) { + return false + } + if !(m.UnclaimedPrizeCount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessagePremiumGiveawayCompleted) String() string { + if m == nil { + return "MessagePremiumGiveawayCompleted(nil)" + } + type Alias MessagePremiumGiveawayCompleted + return fmt.Sprintf("MessagePremiumGiveawayCompleted%+v", Alias(*m)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagePremiumGiveawayCompleted) TypeID() uint32 { + return MessagePremiumGiveawayCompletedTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagePremiumGiveawayCompleted) TypeName() string { + return "messagePremiumGiveawayCompleted" +} + +// TypeInfo returns info about TL type. +func (m *MessagePremiumGiveawayCompleted) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messagePremiumGiveawayCompleted", + ID: MessagePremiumGiveawayCompletedTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "GiveawayMessageID", + SchemaName: "giveaway_message_id", + }, + { + Name: "WinnerCount", + SchemaName: "winner_count", + }, + { + Name: "UnclaimedPrizeCount", + SchemaName: "unclaimed_prize_count", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MessagePremiumGiveawayCompleted) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messagePremiumGiveawayCompleted#80533949 as nil") + } + b.PutID(MessagePremiumGiveawayCompletedTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessagePremiumGiveawayCompleted) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messagePremiumGiveawayCompleted#80533949 as nil") + } + b.PutInt53(m.GiveawayMessageID) + b.PutInt32(m.WinnerCount) + b.PutInt32(m.UnclaimedPrizeCount) + return nil +} + +// Decode implements bin.Decoder. +func (m *MessagePremiumGiveawayCompleted) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messagePremiumGiveawayCompleted#80533949 to nil") + } + if err := b.ConsumeID(MessagePremiumGiveawayCompletedTypeID); err != nil { + return fmt.Errorf("unable to decode messagePremiumGiveawayCompleted#80533949: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessagePremiumGiveawayCompleted) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messagePremiumGiveawayCompleted#80533949 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messagePremiumGiveawayCompleted#80533949: field giveaway_message_id: %w", err) + } + m.GiveawayMessageID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode messagePremiumGiveawayCompleted#80533949: field winner_count: %w", err) + } + m.WinnerCount = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode messagePremiumGiveawayCompleted#80533949: field unclaimed_prize_count: %w", err) + } + m.UnclaimedPrizeCount = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (m *MessagePremiumGiveawayCompleted) EncodeTDLibJSON(b tdjson.Encoder) error { + if m == nil { + return fmt.Errorf("can't encode messagePremiumGiveawayCompleted#80533949 as nil") + } + b.ObjStart() + b.PutID("messagePremiumGiveawayCompleted") + b.Comma() + b.FieldStart("giveaway_message_id") + b.PutInt53(m.GiveawayMessageID) + b.Comma() + b.FieldStart("winner_count") + b.PutInt32(m.WinnerCount) + b.Comma() + b.FieldStart("unclaimed_prize_count") + b.PutInt32(m.UnclaimedPrizeCount) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (m *MessagePremiumGiveawayCompleted) DecodeTDLibJSON(b tdjson.Decoder) error { + if m == nil { + return fmt.Errorf("can't decode messagePremiumGiveawayCompleted#80533949 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("messagePremiumGiveawayCompleted"); err != nil { + return fmt.Errorf("unable to decode messagePremiumGiveawayCompleted#80533949: %w", err) + } + case "giveaway_message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messagePremiumGiveawayCompleted#80533949: field giveaway_message_id: %w", err) + } + m.GiveawayMessageID = value + case "winner_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode messagePremiumGiveawayCompleted#80533949: field winner_count: %w", err) + } + m.WinnerCount = value + case "unclaimed_prize_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode messagePremiumGiveawayCompleted#80533949: field unclaimed_prize_count: %w", err) + } + m.UnclaimedPrizeCount = value + default: + return b.Skip() + } + return nil + }) +} + +// GetGiveawayMessageID returns value of GiveawayMessageID field. +func (m *MessagePremiumGiveawayCompleted) GetGiveawayMessageID() (value int64) { + if m == nil { + return + } + return m.GiveawayMessageID +} + +// GetWinnerCount returns value of WinnerCount field. +func (m *MessagePremiumGiveawayCompleted) GetWinnerCount() (value int32) { + if m == nil { + return + } + return m.WinnerCount +} + +// GetUnclaimedPrizeCount returns value of UnclaimedPrizeCount field. +func (m *MessagePremiumGiveawayCompleted) GetUnclaimedPrizeCount() (value int32) { + if m == nil { + return + } + return m.UnclaimedPrizeCount +} + // MessageContactRegistered represents TL type `messageContactRegistered#a678fcff`. type MessageContactRegistered struct { } @@ -13517,7 +13785,7 @@ const MessageContentClassName = "MessageContent" // case *tdapi.MessageChatUpgradeFrom: // messageChatUpgradeFrom#136daadc // case *tdapi.MessagePinMessage: // messagePinMessage#38d55039 // case *tdapi.MessageScreenshotTaken: // messageScreenshotTaken#a2b86dab -// case *tdapi.MessageChatSetBackground: // messageChatSetBackground#81819731 +// case *tdapi.MessageChatSetBackground: // messageChatSetBackground#3d5d7c40 // case *tdapi.MessageChatSetTheme: // messageChatSetTheme#99ae9408 // case *tdapi.MessageChatSetMessageAutoDeleteTime: // messageChatSetMessageAutoDeleteTime#619e052e // case *tdapi.MessageForumTopicCreated: // messageForumTopicCreated#b8ce47d1 @@ -13533,6 +13801,7 @@ const MessageContentClassName = "MessageContent" // case *tdapi.MessagePremiumGiftCode: // messagePremiumGiftCode#7a9c468f // case *tdapi.MessagePremiumGiveawayCreated: // messagePremiumGiveawayCreated#270f2c44 // case *tdapi.MessagePremiumGiveaway: // messagePremiumGiveaway#4aa0d0b0 +// case *tdapi.MessagePremiumGiveawayCompleted: // messagePremiumGiveawayCompleted#80533949 // case *tdapi.MessageContactRegistered: // messageContactRegistered#a678fcff // case *tdapi.MessageUserShared: // messageUserShared#d4dcb77c // case *tdapi.MessageChatShared: // messageChatShared#22db7091 @@ -13841,7 +14110,7 @@ func DecodeMessageContent(buf *bin.Buffer) (MessageContentClass, error) { } return &v, nil case MessageChatSetBackgroundTypeID: - // Decoding messageChatSetBackground#81819731. + // Decoding messageChatSetBackground#3d5d7c40. v := MessageChatSetBackground{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) @@ -13952,6 +14221,13 @@ func DecodeMessageContent(buf *bin.Buffer) (MessageContentClass, error) { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil + case MessagePremiumGiveawayCompletedTypeID: + // Decoding messagePremiumGiveawayCompleted#80533949. + v := MessagePremiumGiveawayCompleted{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) + } + return &v, nil case MessageContactRegisteredTypeID: // Decoding messageContactRegistered#a678fcff. v := MessageContactRegistered{} @@ -14301,7 +14577,7 @@ func DecodeTDLibJSONMessageContent(buf tdjson.Decoder) (MessageContentClass, err } return &v, nil case "messageChatSetBackground": - // Decoding messageChatSetBackground#81819731. + // Decoding messageChatSetBackground#3d5d7c40. v := MessageChatSetBackground{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) @@ -14412,6 +14688,13 @@ func DecodeTDLibJSONMessageContent(buf tdjson.Decoder) (MessageContentClass, err return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil + case "messagePremiumGiveawayCompleted": + // Decoding messagePremiumGiveawayCompleted#80533949. + v := MessagePremiumGiveawayCompleted{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) + } + return &v, nil case "messageContactRegistered": // Decoding messageContactRegistered#a678fcff. v := MessageContactRegistered{} diff --git a/tdapi/tl_message_reply_to_gen.go b/tdapi/tl_message_reply_to_gen.go index 8101b99e18..2409a715e3 100644 --- a/tdapi/tl_message_reply_to_gen.go +++ b/tdapi/tl_message_reply_to_gen.go @@ -31,19 +31,15 @@ var ( _ = tdjson.Encoder{} ) -// MessageReplyToMessage represents TL type `messageReplyToMessage#1bb65082`. +// MessageReplyToMessage represents TL type `messageReplyToMessage#ee105987`. type MessageReplyToMessage struct { // The identifier of the chat to which the message belongs; may be 0 if the replied // message is in unknown chat ChatID int64 // The identifier of the message; may be 0 if the replied message is in unknown chat MessageID int64 - // Manually or automatically chosen quote from the replied message; may be null if none. - // Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities can be - // present in the quote - Quote FormattedText - // True, if the quote was manually chosen by the message sender - IsQuoteManual bool + // Chosen quote from the replied message; may be null if none + Quote TextQuote // Information about origin of the message if the message was from another chat or topic; // may be null for messages from the same chat Origin MessageOriginClass @@ -56,7 +52,7 @@ type MessageReplyToMessage struct { } // MessageReplyToMessageTypeID is TL type id of MessageReplyToMessage. -const MessageReplyToMessageTypeID = 0x1bb65082 +const MessageReplyToMessageTypeID = 0xee105987 // construct implements constructor of MessageReplyToClass. func (m MessageReplyToMessage) construct() MessageReplyToClass { return &m } @@ -84,9 +80,6 @@ func (m *MessageReplyToMessage) Zero() bool { if !(m.Quote.Zero()) { return false } - if !(m.IsQuoteManual == false) { - return false - } if !(m.Origin == nil) { return false } @@ -144,10 +137,6 @@ func (m *MessageReplyToMessage) TypeInfo() tdp.Type { Name: "Quote", SchemaName: "quote", }, - { - Name: "IsQuoteManual", - SchemaName: "is_quote_manual", - }, { Name: "Origin", SchemaName: "origin", @@ -167,7 +156,7 @@ func (m *MessageReplyToMessage) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (m *MessageReplyToMessage) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageReplyToMessage#1bb65082 as nil") + return fmt.Errorf("can't encode messageReplyToMessage#ee105987 as nil") } b.PutID(MessageReplyToMessageTypeID) return m.EncodeBare(b) @@ -176,26 +165,25 @@ func (m *MessageReplyToMessage) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageReplyToMessage) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageReplyToMessage#1bb65082 as nil") + return fmt.Errorf("can't encode messageReplyToMessage#ee105987 as nil") } b.PutInt53(m.ChatID) b.PutInt53(m.MessageID) if err := m.Quote.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageReplyToMessage#1bb65082: field quote: %w", err) + return fmt.Errorf("unable to encode messageReplyToMessage#ee105987: field quote: %w", err) } - b.PutBool(m.IsQuoteManual) if m.Origin == nil { - return fmt.Errorf("unable to encode messageReplyToMessage#1bb65082: field origin is nil") + return fmt.Errorf("unable to encode messageReplyToMessage#ee105987: field origin is nil") } if err := m.Origin.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageReplyToMessage#1bb65082: field origin: %w", err) + return fmt.Errorf("unable to encode messageReplyToMessage#ee105987: field origin: %w", err) } b.PutInt32(m.OriginSendDate) if m.Content == nil { - return fmt.Errorf("unable to encode messageReplyToMessage#1bb65082: field content is nil") + return fmt.Errorf("unable to encode messageReplyToMessage#ee105987: field content is nil") } if err := m.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageReplyToMessage#1bb65082: field content: %w", err) + return fmt.Errorf("unable to encode messageReplyToMessage#ee105987: field content: %w", err) } return nil } @@ -203,10 +191,10 @@ func (m *MessageReplyToMessage) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *MessageReplyToMessage) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageReplyToMessage#1bb65082 to nil") + return fmt.Errorf("can't decode messageReplyToMessage#ee105987 to nil") } if err := b.ConsumeID(MessageReplyToMessageTypeID); err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#1bb65082: %w", err) + return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: %w", err) } return m.DecodeBare(b) } @@ -214,52 +202,45 @@ func (m *MessageReplyToMessage) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageReplyToMessage) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageReplyToMessage#1bb65082 to nil") + return fmt.Errorf("can't decode messageReplyToMessage#ee105987 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#1bb65082: field chat_id: %w", err) + return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field chat_id: %w", err) } m.ChatID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#1bb65082: field message_id: %w", err) + return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field message_id: %w", err) } m.MessageID = value } { if err := m.Quote.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#1bb65082: field quote: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#1bb65082: field is_quote_manual: %w", err) + return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field quote: %w", err) } - m.IsQuoteManual = value } { value, err := DecodeMessageOrigin(b) if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#1bb65082: field origin: %w", err) + return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field origin: %w", err) } m.Origin = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#1bb65082: field origin_send_date: %w", err) + return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field origin_send_date: %w", err) } m.OriginSendDate = value } { value, err := DecodeMessageContent(b) if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#1bb65082: field content: %w", err) + return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field content: %w", err) } m.Content = value } @@ -269,7 +250,7 @@ func (m *MessageReplyToMessage) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (m *MessageReplyToMessage) EncodeTDLibJSON(b tdjson.Encoder) error { if m == nil { - return fmt.Errorf("can't encode messageReplyToMessage#1bb65082 as nil") + return fmt.Errorf("can't encode messageReplyToMessage#ee105987 as nil") } b.ObjStart() b.PutID("messageReplyToMessage") @@ -282,18 +263,15 @@ func (m *MessageReplyToMessage) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("quote") if err := m.Quote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageReplyToMessage#1bb65082: field quote: %w", err) + return fmt.Errorf("unable to encode messageReplyToMessage#ee105987: field quote: %w", err) } b.Comma() - b.FieldStart("is_quote_manual") - b.PutBool(m.IsQuoteManual) - b.Comma() b.FieldStart("origin") if m.Origin == nil { - return fmt.Errorf("unable to encode messageReplyToMessage#1bb65082: field origin is nil") + return fmt.Errorf("unable to encode messageReplyToMessage#ee105987: field origin is nil") } if err := m.Origin.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageReplyToMessage#1bb65082: field origin: %w", err) + return fmt.Errorf("unable to encode messageReplyToMessage#ee105987: field origin: %w", err) } b.Comma() b.FieldStart("origin_send_date") @@ -301,10 +279,10 @@ func (m *MessageReplyToMessage) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("content") if m.Content == nil { - return fmt.Errorf("unable to encode messageReplyToMessage#1bb65082: field content is nil") + return fmt.Errorf("unable to encode messageReplyToMessage#ee105987: field content is nil") } if err := m.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageReplyToMessage#1bb65082: field content: %w", err) + return fmt.Errorf("unable to encode messageReplyToMessage#ee105987: field content: %w", err) } b.Comma() b.StripComma() @@ -315,53 +293,47 @@ func (m *MessageReplyToMessage) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (m *MessageReplyToMessage) DecodeTDLibJSON(b tdjson.Decoder) error { if m == nil { - return fmt.Errorf("can't decode messageReplyToMessage#1bb65082 to nil") + return fmt.Errorf("can't decode messageReplyToMessage#ee105987 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("messageReplyToMessage"); err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#1bb65082: %w", err) + return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#1bb65082: field chat_id: %w", err) + return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field chat_id: %w", err) } m.ChatID = value case "message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#1bb65082: field message_id: %w", err) + return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field message_id: %w", err) } m.MessageID = value case "quote": if err := m.Quote.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#1bb65082: field quote: %w", err) - } - case "is_quote_manual": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#1bb65082: field is_quote_manual: %w", err) + return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field quote: %w", err) } - m.IsQuoteManual = value case "origin": value, err := DecodeTDLibJSONMessageOrigin(b) if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#1bb65082: field origin: %w", err) + return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field origin: %w", err) } m.Origin = value case "origin_send_date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#1bb65082: field origin_send_date: %w", err) + return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field origin_send_date: %w", err) } m.OriginSendDate = value case "content": value, err := DecodeTDLibJSONMessageContent(b) if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#1bb65082: field content: %w", err) + return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field content: %w", err) } m.Content = value default: @@ -388,21 +360,13 @@ func (m *MessageReplyToMessage) GetMessageID() (value int64) { } // GetQuote returns value of Quote field. -func (m *MessageReplyToMessage) GetQuote() (value FormattedText) { +func (m *MessageReplyToMessage) GetQuote() (value TextQuote) { if m == nil { return } return m.Quote } -// GetIsQuoteManual returns value of IsQuoteManual field. -func (m *MessageReplyToMessage) GetIsQuoteManual() (value bool) { - if m == nil { - return - } - return m.IsQuoteManual -} - // GetOrigin returns value of Origin field. func (m *MessageReplyToMessage) GetOrigin() (value MessageOriginClass) { if m == nil { @@ -639,7 +603,7 @@ const MessageReplyToClassName = "MessageReplyTo" // panic(err) // } // switch v := g.(type) { -// case *tdapi.MessageReplyToMessage: // messageReplyToMessage#1bb65082 +// case *tdapi.MessageReplyToMessage: // messageReplyToMessage#ee105987 // case *tdapi.MessageReplyToStory: // messageReplyToStory#708ca939 // default: panic(v) // } @@ -673,7 +637,7 @@ func DecodeMessageReplyTo(buf *bin.Buffer) (MessageReplyToClass, error) { } switch id { case MessageReplyToMessageTypeID: - // Decoding messageReplyToMessage#1bb65082. + // Decoding messageReplyToMessage#ee105987. v := MessageReplyToMessage{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageReplyToClass: %w", err) @@ -699,7 +663,7 @@ func DecodeTDLibJSONMessageReplyTo(buf tdjson.Decoder) (MessageReplyToClass, err } switch id { case "messageReplyToMessage": - // Decoding messageReplyToMessage#1bb65082. + // Decoding messageReplyToMessage#ee105987. v := MessageReplyToMessage{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageReplyToClass: %w", err) diff --git a/tdapi/tl_message_sponsor_type_gen.go b/tdapi/tl_message_sponsor_type_gen.go index cf5a4b48cc..62af0ec923 100644 --- a/tdapi/tl_message_sponsor_type_gen.go +++ b/tdapi/tl_message_sponsor_type_gen.go @@ -241,6 +241,216 @@ func (m *MessageSponsorTypeBot) GetLink() (value InternalLinkTypeClass) { return m.Link } +// MessageSponsorTypeWebApp represents TL type `messageSponsorTypeWebApp#25b74fb8`. +type MessageSponsorTypeWebApp struct { + // Web App title + WebAppTitle string + // An internal link to be opened when the sponsored message is clicked + Link InternalLinkTypeClass +} + +// MessageSponsorTypeWebAppTypeID is TL type id of MessageSponsorTypeWebApp. +const MessageSponsorTypeWebAppTypeID = 0x25b74fb8 + +// construct implements constructor of MessageSponsorTypeClass. +func (m MessageSponsorTypeWebApp) construct() MessageSponsorTypeClass { return &m } + +// Ensuring interfaces in compile-time for MessageSponsorTypeWebApp. +var ( + _ bin.Encoder = &MessageSponsorTypeWebApp{} + _ bin.Decoder = &MessageSponsorTypeWebApp{} + _ bin.BareEncoder = &MessageSponsorTypeWebApp{} + _ bin.BareDecoder = &MessageSponsorTypeWebApp{} + + _ MessageSponsorTypeClass = &MessageSponsorTypeWebApp{} +) + +func (m *MessageSponsorTypeWebApp) Zero() bool { + if m == nil { + return true + } + if !(m.WebAppTitle == "") { + return false + } + if !(m.Link == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageSponsorTypeWebApp) String() string { + if m == nil { + return "MessageSponsorTypeWebApp(nil)" + } + type Alias MessageSponsorTypeWebApp + return fmt.Sprintf("MessageSponsorTypeWebApp%+v", Alias(*m)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageSponsorTypeWebApp) TypeID() uint32 { + return MessageSponsorTypeWebAppTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageSponsorTypeWebApp) TypeName() string { + return "messageSponsorTypeWebApp" +} + +// TypeInfo returns info about TL type. +func (m *MessageSponsorTypeWebApp) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageSponsorTypeWebApp", + ID: MessageSponsorTypeWebAppTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "WebAppTitle", + SchemaName: "web_app_title", + }, + { + Name: "Link", + SchemaName: "link", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MessageSponsorTypeWebApp) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageSponsorTypeWebApp#25b74fb8 as nil") + } + b.PutID(MessageSponsorTypeWebAppTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageSponsorTypeWebApp) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageSponsorTypeWebApp#25b74fb8 as nil") + } + b.PutString(m.WebAppTitle) + if m.Link == nil { + return fmt.Errorf("unable to encode messageSponsorTypeWebApp#25b74fb8: field link is nil") + } + if err := m.Link.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageSponsorTypeWebApp#25b74fb8: field link: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageSponsorTypeWebApp) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageSponsorTypeWebApp#25b74fb8 to nil") + } + if err := b.ConsumeID(MessageSponsorTypeWebAppTypeID); err != nil { + return fmt.Errorf("unable to decode messageSponsorTypeWebApp#25b74fb8: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageSponsorTypeWebApp) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageSponsorTypeWebApp#25b74fb8 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageSponsorTypeWebApp#25b74fb8: field web_app_title: %w", err) + } + m.WebAppTitle = value + } + { + value, err := DecodeInternalLinkType(b) + if err != nil { + return fmt.Errorf("unable to decode messageSponsorTypeWebApp#25b74fb8: field link: %w", err) + } + m.Link = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (m *MessageSponsorTypeWebApp) EncodeTDLibJSON(b tdjson.Encoder) error { + if m == nil { + return fmt.Errorf("can't encode messageSponsorTypeWebApp#25b74fb8 as nil") + } + b.ObjStart() + b.PutID("messageSponsorTypeWebApp") + b.Comma() + b.FieldStart("web_app_title") + b.PutString(m.WebAppTitle) + b.Comma() + b.FieldStart("link") + if m.Link == nil { + return fmt.Errorf("unable to encode messageSponsorTypeWebApp#25b74fb8: field link is nil") + } + if err := m.Link.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode messageSponsorTypeWebApp#25b74fb8: field link: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (m *MessageSponsorTypeWebApp) DecodeTDLibJSON(b tdjson.Decoder) error { + if m == nil { + return fmt.Errorf("can't decode messageSponsorTypeWebApp#25b74fb8 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("messageSponsorTypeWebApp"); err != nil { + return fmt.Errorf("unable to decode messageSponsorTypeWebApp#25b74fb8: %w", err) + } + case "web_app_title": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageSponsorTypeWebApp#25b74fb8: field web_app_title: %w", err) + } + m.WebAppTitle = value + case "link": + value, err := DecodeTDLibJSONInternalLinkType(b) + if err != nil { + return fmt.Errorf("unable to decode messageSponsorTypeWebApp#25b74fb8: field link: %w", err) + } + m.Link = value + default: + return b.Skip() + } + return nil + }) +} + +// GetWebAppTitle returns value of WebAppTitle field. +func (m *MessageSponsorTypeWebApp) GetWebAppTitle() (value string) { + if m == nil { + return + } + return m.WebAppTitle +} + +// GetLink returns value of Link field. +func (m *MessageSponsorTypeWebApp) GetLink() (value InternalLinkTypeClass) { + if m == nil { + return + } + return m.Link +} + // MessageSponsorTypePublicChannel represents TL type `messageSponsorTypePublicChannel#ed645a47`. type MessageSponsorTypePublicChannel struct { // Sponsor chat identifier @@ -865,6 +1075,7 @@ const MessageSponsorTypeClassName = "MessageSponsorType" // } // switch v := g.(type) { // case *tdapi.MessageSponsorTypeBot: // messageSponsorTypeBot#700d2304 +// case *tdapi.MessageSponsorTypeWebApp: // messageSponsorTypeWebApp#25b74fb8 // case *tdapi.MessageSponsorTypePublicChannel: // messageSponsorTypePublicChannel#ed645a47 // case *tdapi.MessageSponsorTypePrivateChannel: // messageSponsorTypePrivateChannel#74d245a8 // case *tdapi.MessageSponsorTypeWebsite: // messageSponsorTypeWebsite#a4e45f9b @@ -906,6 +1117,13 @@ func DecodeMessageSponsorType(buf *bin.Buffer) (MessageSponsorTypeClass, error) return nil, fmt.Errorf("unable to decode MessageSponsorTypeClass: %w", err) } return &v, nil + case MessageSponsorTypeWebAppTypeID: + // Decoding messageSponsorTypeWebApp#25b74fb8. + v := MessageSponsorTypeWebApp{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageSponsorTypeClass: %w", err) + } + return &v, nil case MessageSponsorTypePublicChannelTypeID: // Decoding messageSponsorTypePublicChannel#ed645a47. v := MessageSponsorTypePublicChannel{} @@ -946,6 +1164,13 @@ func DecodeTDLibJSONMessageSponsorType(buf tdjson.Decoder) (MessageSponsorTypeCl return nil, fmt.Errorf("unable to decode MessageSponsorTypeClass: %w", err) } return &v, nil + case "messageSponsorTypeWebApp": + // Decoding messageSponsorTypeWebApp#25b74fb8. + v := MessageSponsorTypeWebApp{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageSponsorTypeClass: %w", err) + } + return &v, nil case "messageSponsorTypePublicChannel": // Decoding messageSponsorTypePublicChannel#ed645a47. v := MessageSponsorTypePublicChannel{} diff --git a/tdapi/tl_message_statistics_gen.go b/tdapi/tl_message_statistics_gen.go index 3cbd48f122..965ec38a41 100644 --- a/tdapi/tl_message_statistics_gen.go +++ b/tdapi/tl_message_statistics_gen.go @@ -31,14 +31,16 @@ var ( _ = tdjson.Encoder{} ) -// MessageStatistics represents TL type `messageStatistics#c3b781b0`. +// MessageStatistics represents TL type `messageStatistics#a2ce4f07`. type MessageStatistics struct { // A graph containing number of message views and shares MessageInteractionGraph StatisticalGraphClass + // A graph containing number of message reactions + MessageReactionGraph StatisticalGraphClass } // MessageStatisticsTypeID is TL type id of MessageStatistics. -const MessageStatisticsTypeID = 0xc3b781b0 +const MessageStatisticsTypeID = 0xa2ce4f07 // Ensuring interfaces in compile-time for MessageStatistics. var ( @@ -55,6 +57,9 @@ func (m *MessageStatistics) Zero() bool { if !(m.MessageInteractionGraph == nil) { return false } + if !(m.MessageReactionGraph == nil) { + return false + } return true } @@ -95,6 +100,10 @@ func (m *MessageStatistics) TypeInfo() tdp.Type { Name: "MessageInteractionGraph", SchemaName: "message_interaction_graph", }, + { + Name: "MessageReactionGraph", + SchemaName: "message_reaction_graph", + }, } return typ } @@ -102,7 +111,7 @@ func (m *MessageStatistics) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (m *MessageStatistics) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageStatistics#c3b781b0 as nil") + return fmt.Errorf("can't encode messageStatistics#a2ce4f07 as nil") } b.PutID(MessageStatisticsTypeID) return m.EncodeBare(b) @@ -111,13 +120,19 @@ func (m *MessageStatistics) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageStatistics) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageStatistics#c3b781b0 as nil") + return fmt.Errorf("can't encode messageStatistics#a2ce4f07 as nil") } if m.MessageInteractionGraph == nil { - return fmt.Errorf("unable to encode messageStatistics#c3b781b0: field message_interaction_graph is nil") + return fmt.Errorf("unable to encode messageStatistics#a2ce4f07: field message_interaction_graph is nil") } if err := m.MessageInteractionGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageStatistics#c3b781b0: field message_interaction_graph: %w", err) + return fmt.Errorf("unable to encode messageStatistics#a2ce4f07: field message_interaction_graph: %w", err) + } + if m.MessageReactionGraph == nil { + return fmt.Errorf("unable to encode messageStatistics#a2ce4f07: field message_reaction_graph is nil") + } + if err := m.MessageReactionGraph.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageStatistics#a2ce4f07: field message_reaction_graph: %w", err) } return nil } @@ -125,10 +140,10 @@ func (m *MessageStatistics) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *MessageStatistics) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageStatistics#c3b781b0 to nil") + return fmt.Errorf("can't decode messageStatistics#a2ce4f07 to nil") } if err := b.ConsumeID(MessageStatisticsTypeID); err != nil { - return fmt.Errorf("unable to decode messageStatistics#c3b781b0: %w", err) + return fmt.Errorf("unable to decode messageStatistics#a2ce4f07: %w", err) } return m.DecodeBare(b) } @@ -136,32 +151,47 @@ func (m *MessageStatistics) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageStatistics) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageStatistics#c3b781b0 to nil") + return fmt.Errorf("can't decode messageStatistics#a2ce4f07 to nil") } { value, err := DecodeStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode messageStatistics#c3b781b0: field message_interaction_graph: %w", err) + return fmt.Errorf("unable to decode messageStatistics#a2ce4f07: field message_interaction_graph: %w", err) } m.MessageInteractionGraph = value } + { + value, err := DecodeStatisticalGraph(b) + if err != nil { + return fmt.Errorf("unable to decode messageStatistics#a2ce4f07: field message_reaction_graph: %w", err) + } + m.MessageReactionGraph = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (m *MessageStatistics) EncodeTDLibJSON(b tdjson.Encoder) error { if m == nil { - return fmt.Errorf("can't encode messageStatistics#c3b781b0 as nil") + return fmt.Errorf("can't encode messageStatistics#a2ce4f07 as nil") } b.ObjStart() b.PutID("messageStatistics") b.Comma() b.FieldStart("message_interaction_graph") if m.MessageInteractionGraph == nil { - return fmt.Errorf("unable to encode messageStatistics#c3b781b0: field message_interaction_graph is nil") + return fmt.Errorf("unable to encode messageStatistics#a2ce4f07: field message_interaction_graph is nil") } if err := m.MessageInteractionGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageStatistics#c3b781b0: field message_interaction_graph: %w", err) + return fmt.Errorf("unable to encode messageStatistics#a2ce4f07: field message_interaction_graph: %w", err) + } + b.Comma() + b.FieldStart("message_reaction_graph") + if m.MessageReactionGraph == nil { + return fmt.Errorf("unable to encode messageStatistics#a2ce4f07: field message_reaction_graph is nil") + } + if err := m.MessageReactionGraph.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode messageStatistics#a2ce4f07: field message_reaction_graph: %w", err) } b.Comma() b.StripComma() @@ -172,21 +202,27 @@ func (m *MessageStatistics) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (m *MessageStatistics) DecodeTDLibJSON(b tdjson.Decoder) error { if m == nil { - return fmt.Errorf("can't decode messageStatistics#c3b781b0 to nil") + return fmt.Errorf("can't decode messageStatistics#a2ce4f07 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("messageStatistics"); err != nil { - return fmt.Errorf("unable to decode messageStatistics#c3b781b0: %w", err) + return fmt.Errorf("unable to decode messageStatistics#a2ce4f07: %w", err) } case "message_interaction_graph": value, err := DecodeTDLibJSONStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode messageStatistics#c3b781b0: field message_interaction_graph: %w", err) + return fmt.Errorf("unable to decode messageStatistics#a2ce4f07: field message_interaction_graph: %w", err) } m.MessageInteractionGraph = value + case "message_reaction_graph": + value, err := DecodeTDLibJSONStatisticalGraph(b) + if err != nil { + return fmt.Errorf("unable to decode messageStatistics#a2ce4f07: field message_reaction_graph: %w", err) + } + m.MessageReactionGraph = value default: return b.Skip() } @@ -201,3 +237,11 @@ func (m *MessageStatistics) GetMessageInteractionGraph() (value StatisticalGraph } return m.MessageInteractionGraph } + +// GetMessageReactionGraph returns value of MessageReactionGraph field. +func (m *MessageStatistics) GetMessageReactionGraph() (value StatisticalGraphClass) { + if m == nil { + return + } + return m.MessageReactionGraph +} diff --git a/tdapi/tl_premium_feature_gen.go b/tdapi/tl_premium_feature_gen.go index b88b2283f5..a073001a73 100644 --- a/tdapi/tl_premium_feature_gen.go +++ b/tdapi/tl_premium_feature_gen.go @@ -2389,6 +2389,137 @@ func (p *PremiumFeatureAccentColor) DecodeTDLibJSON(b tdjson.Decoder) error { }) } +// PremiumFeatureBackgroundForBoth represents TL type `premiumFeatureBackgroundForBoth#2246eefa`. +type PremiumFeatureBackgroundForBoth struct { +} + +// PremiumFeatureBackgroundForBothTypeID is TL type id of PremiumFeatureBackgroundForBoth. +const PremiumFeatureBackgroundForBothTypeID = 0x2246eefa + +// construct implements constructor of PremiumFeatureClass. +func (p PremiumFeatureBackgroundForBoth) construct() PremiumFeatureClass { return &p } + +// Ensuring interfaces in compile-time for PremiumFeatureBackgroundForBoth. +var ( + _ bin.Encoder = &PremiumFeatureBackgroundForBoth{} + _ bin.Decoder = &PremiumFeatureBackgroundForBoth{} + _ bin.BareEncoder = &PremiumFeatureBackgroundForBoth{} + _ bin.BareDecoder = &PremiumFeatureBackgroundForBoth{} + + _ PremiumFeatureClass = &PremiumFeatureBackgroundForBoth{} +) + +func (p *PremiumFeatureBackgroundForBoth) Zero() bool { + if p == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (p *PremiumFeatureBackgroundForBoth) String() string { + if p == nil { + return "PremiumFeatureBackgroundForBoth(nil)" + } + type Alias PremiumFeatureBackgroundForBoth + return fmt.Sprintf("PremiumFeatureBackgroundForBoth%+v", Alias(*p)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PremiumFeatureBackgroundForBoth) TypeID() uint32 { + return PremiumFeatureBackgroundForBothTypeID +} + +// TypeName returns name of type in TL schema. +func (*PremiumFeatureBackgroundForBoth) TypeName() string { + return "premiumFeatureBackgroundForBoth" +} + +// TypeInfo returns info about TL type. +func (p *PremiumFeatureBackgroundForBoth) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "premiumFeatureBackgroundForBoth", + ID: PremiumFeatureBackgroundForBothTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (p *PremiumFeatureBackgroundForBoth) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode premiumFeatureBackgroundForBoth#2246eefa as nil") + } + b.PutID(PremiumFeatureBackgroundForBothTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *PremiumFeatureBackgroundForBoth) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode premiumFeatureBackgroundForBoth#2246eefa as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (p *PremiumFeatureBackgroundForBoth) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode premiumFeatureBackgroundForBoth#2246eefa to nil") + } + if err := b.ConsumeID(PremiumFeatureBackgroundForBothTypeID); err != nil { + return fmt.Errorf("unable to decode premiumFeatureBackgroundForBoth#2246eefa: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *PremiumFeatureBackgroundForBoth) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode premiumFeatureBackgroundForBoth#2246eefa to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (p *PremiumFeatureBackgroundForBoth) EncodeTDLibJSON(b tdjson.Encoder) error { + if p == nil { + return fmt.Errorf("can't encode premiumFeatureBackgroundForBoth#2246eefa as nil") + } + b.ObjStart() + b.PutID("premiumFeatureBackgroundForBoth") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (p *PremiumFeatureBackgroundForBoth) DecodeTDLibJSON(b tdjson.Decoder) error { + if p == nil { + return fmt.Errorf("can't decode premiumFeatureBackgroundForBoth#2246eefa to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("premiumFeatureBackgroundForBoth"); err != nil { + return fmt.Errorf("unable to decode premiumFeatureBackgroundForBoth#2246eefa: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + // PremiumFeatureClassName is schema name of PremiumFeatureClass. const PremiumFeatureClassName = "PremiumFeature" @@ -2419,6 +2550,7 @@ const PremiumFeatureClassName = "PremiumFeature" // case *tdapi.PremiumFeatureUpgradedStories: // premiumFeatureUpgradedStories#9008051b // case *tdapi.PremiumFeatureChatBoost: // premiumFeatureChatBoost#5df89f1b // case *tdapi.PremiumFeatureAccentColor: // premiumFeatureAccentColor#361ac59e +// case *tdapi.PremiumFeatureBackgroundForBoth: // premiumFeatureBackgroundForBoth#2246eefa // default: panic(v) // } type PremiumFeatureClass interface { @@ -2576,6 +2708,13 @@ func DecodePremiumFeature(buf *bin.Buffer) (PremiumFeatureClass, error) { return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) } return &v, nil + case PremiumFeatureBackgroundForBothTypeID: + // Decoding premiumFeatureBackgroundForBoth#2246eefa. + v := PremiumFeatureBackgroundForBoth{} + 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)) } @@ -2714,6 +2853,13 @@ func DecodeTDLibJSONPremiumFeature(buf tdjson.Decoder) (PremiumFeatureClass, err return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) } return &v, nil + case "premiumFeatureBackgroundForBoth": + // Decoding premiumFeatureBackgroundForBoth#2246eefa. + v := PremiumFeatureBackgroundForBoth{} + 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_limit_type_gen.go b/tdapi/tl_premium_limit_type_gen.go index caca47d6ef..8bb07f1a14 100644 --- a/tdapi/tl_premium_limit_type_gen.go +++ b/tdapi/tl_premium_limit_type_gen.go @@ -2258,6 +2258,137 @@ func (p *PremiumLimitTypeStorySuggestedReactionAreaCount) DecodeTDLibJSON(b tdjs }) } +// PremiumLimitTypeSimilarChatCount represents TL type `premiumLimitTypeSimilarChatCount#a2ce1f11`. +type PremiumLimitTypeSimilarChatCount struct { +} + +// PremiumLimitTypeSimilarChatCountTypeID is TL type id of PremiumLimitTypeSimilarChatCount. +const PremiumLimitTypeSimilarChatCountTypeID = 0xa2ce1f11 + +// construct implements constructor of PremiumLimitTypeClass. +func (p PremiumLimitTypeSimilarChatCount) construct() PremiumLimitTypeClass { return &p } + +// Ensuring interfaces in compile-time for PremiumLimitTypeSimilarChatCount. +var ( + _ bin.Encoder = &PremiumLimitTypeSimilarChatCount{} + _ bin.Decoder = &PremiumLimitTypeSimilarChatCount{} + _ bin.BareEncoder = &PremiumLimitTypeSimilarChatCount{} + _ bin.BareDecoder = &PremiumLimitTypeSimilarChatCount{} + + _ PremiumLimitTypeClass = &PremiumLimitTypeSimilarChatCount{} +) + +func (p *PremiumLimitTypeSimilarChatCount) Zero() bool { + if p == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (p *PremiumLimitTypeSimilarChatCount) String() string { + if p == nil { + return "PremiumLimitTypeSimilarChatCount(nil)" + } + type Alias PremiumLimitTypeSimilarChatCount + return fmt.Sprintf("PremiumLimitTypeSimilarChatCount%+v", Alias(*p)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PremiumLimitTypeSimilarChatCount) TypeID() uint32 { + return PremiumLimitTypeSimilarChatCountTypeID +} + +// TypeName returns name of type in TL schema. +func (*PremiumLimitTypeSimilarChatCount) TypeName() string { + return "premiumLimitTypeSimilarChatCount" +} + +// TypeInfo returns info about TL type. +func (p *PremiumLimitTypeSimilarChatCount) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "premiumLimitTypeSimilarChatCount", + ID: PremiumLimitTypeSimilarChatCountTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (p *PremiumLimitTypeSimilarChatCount) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode premiumLimitTypeSimilarChatCount#a2ce1f11 as nil") + } + b.PutID(PremiumLimitTypeSimilarChatCountTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *PremiumLimitTypeSimilarChatCount) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode premiumLimitTypeSimilarChatCount#a2ce1f11 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (p *PremiumLimitTypeSimilarChatCount) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode premiumLimitTypeSimilarChatCount#a2ce1f11 to nil") + } + if err := b.ConsumeID(PremiumLimitTypeSimilarChatCountTypeID); err != nil { + return fmt.Errorf("unable to decode premiumLimitTypeSimilarChatCount#a2ce1f11: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *PremiumLimitTypeSimilarChatCount) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode premiumLimitTypeSimilarChatCount#a2ce1f11 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (p *PremiumLimitTypeSimilarChatCount) EncodeTDLibJSON(b tdjson.Encoder) error { + if p == nil { + return fmt.Errorf("can't encode premiumLimitTypeSimilarChatCount#a2ce1f11 as nil") + } + b.ObjStart() + b.PutID("premiumLimitTypeSimilarChatCount") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (p *PremiumLimitTypeSimilarChatCount) DecodeTDLibJSON(b tdjson.Decoder) error { + if p == nil { + return fmt.Errorf("can't decode premiumLimitTypeSimilarChatCount#a2ce1f11 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("premiumLimitTypeSimilarChatCount"); err != nil { + return fmt.Errorf("unable to decode premiumLimitTypeSimilarChatCount#a2ce1f11: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + // PremiumLimitTypeClassName is schema name of PremiumLimitTypeClass. const PremiumLimitTypeClassName = "PremiumLimitType" @@ -2287,6 +2418,7 @@ const PremiumLimitTypeClassName = "PremiumLimitType" // case *tdapi.PremiumLimitTypeMonthlySentStoryCount: // premiumLimitTypeMonthlySentStoryCount#30d84b83 // case *tdapi.PremiumLimitTypeStoryCaptionLength: // premiumLimitTypeStoryCaptionLength#bed53302 // case *tdapi.PremiumLimitTypeStorySuggestedReactionAreaCount: // premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807 +// case *tdapi.PremiumLimitTypeSimilarChatCount: // premiumLimitTypeSimilarChatCount#a2ce1f11 // default: panic(v) // } type PremiumLimitTypeClass interface { @@ -2437,6 +2569,13 @@ func DecodePremiumLimitType(buf *bin.Buffer) (PremiumLimitTypeClass, error) { return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) } return &v, nil + case PremiumLimitTypeSimilarChatCountTypeID: + // Decoding premiumLimitTypeSimilarChatCount#a2ce1f11. + v := PremiumLimitTypeSimilarChatCount{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", bin.NewUnexpectedID(id)) } @@ -2568,6 +2707,13 @@ func DecodeTDLibJSONPremiumLimitType(buf tdjson.Decoder) (PremiumLimitTypeClass, return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) } return &v, nil + case "premiumLimitTypeSimilarChatCount": + // Decoding premiumLimitTypeSimilarChatCount#a2ce1f11. + v := PremiumLimitTypeSimilarChatCount{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", tdjson.NewUnexpectedID(id)) } diff --git a/tdapi/tl_profile_accent_color_gen.go b/tdapi/tl_profile_accent_color_gen.go new file mode 100644 index 0000000000..ade82e9aa2 --- /dev/null +++ b/tdapi/tl_profile_accent_color_gen.go @@ -0,0 +1,263 @@ +// 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{} +) + +// ProfileAccentColor represents TL type `profileAccentColor#2bea798e`. +type ProfileAccentColor struct { + // Profile accent color identifier + ID int32 + // The list of 1-3 colors in RGB format, describing the accent color, as expected to be + // shown in light themes + LightThemeColors ProfileAccentColors + // The list of 1-3 colors in RGB format, describing the accent color, as expected to be + // shown in dark themes + DarkThemeColors ProfileAccentColors +} + +// ProfileAccentColorTypeID is TL type id of ProfileAccentColor. +const ProfileAccentColorTypeID = 0x2bea798e + +// Ensuring interfaces in compile-time for ProfileAccentColor. +var ( + _ bin.Encoder = &ProfileAccentColor{} + _ bin.Decoder = &ProfileAccentColor{} + _ bin.BareEncoder = &ProfileAccentColor{} + _ bin.BareDecoder = &ProfileAccentColor{} +) + +func (p *ProfileAccentColor) Zero() bool { + if p == nil { + return true + } + if !(p.ID == 0) { + return false + } + if !(p.LightThemeColors.Zero()) { + return false + } + if !(p.DarkThemeColors.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *ProfileAccentColor) String() string { + if p == nil { + return "ProfileAccentColor(nil)" + } + type Alias ProfileAccentColor + return fmt.Sprintf("ProfileAccentColor%+v", Alias(*p)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ProfileAccentColor) TypeID() uint32 { + return ProfileAccentColorTypeID +} + +// TypeName returns name of type in TL schema. +func (*ProfileAccentColor) TypeName() string { + return "profileAccentColor" +} + +// TypeInfo returns info about TL type. +func (p *ProfileAccentColor) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "profileAccentColor", + ID: ProfileAccentColorTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ID", + SchemaName: "id", + }, + { + Name: "LightThemeColors", + SchemaName: "light_theme_colors", + }, + { + Name: "DarkThemeColors", + SchemaName: "dark_theme_colors", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (p *ProfileAccentColor) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode profileAccentColor#2bea798e as nil") + } + b.PutID(ProfileAccentColorTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *ProfileAccentColor) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode profileAccentColor#2bea798e as nil") + } + b.PutInt32(p.ID) + if err := p.LightThemeColors.Encode(b); err != nil { + return fmt.Errorf("unable to encode profileAccentColor#2bea798e: field light_theme_colors: %w", err) + } + if err := p.DarkThemeColors.Encode(b); err != nil { + return fmt.Errorf("unable to encode profileAccentColor#2bea798e: field dark_theme_colors: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (p *ProfileAccentColor) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode profileAccentColor#2bea798e to nil") + } + if err := b.ConsumeID(ProfileAccentColorTypeID); err != nil { + return fmt.Errorf("unable to decode profileAccentColor#2bea798e: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *ProfileAccentColor) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode profileAccentColor#2bea798e to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode profileAccentColor#2bea798e: field id: %w", err) + } + p.ID = value + } + { + if err := p.LightThemeColors.Decode(b); err != nil { + return fmt.Errorf("unable to decode profileAccentColor#2bea798e: field light_theme_colors: %w", err) + } + } + { + if err := p.DarkThemeColors.Decode(b); err != nil { + return fmt.Errorf("unable to decode profileAccentColor#2bea798e: field dark_theme_colors: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (p *ProfileAccentColor) EncodeTDLibJSON(b tdjson.Encoder) error { + if p == nil { + return fmt.Errorf("can't encode profileAccentColor#2bea798e as nil") + } + b.ObjStart() + b.PutID("profileAccentColor") + b.Comma() + b.FieldStart("id") + b.PutInt32(p.ID) + b.Comma() + b.FieldStart("light_theme_colors") + if err := p.LightThemeColors.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode profileAccentColor#2bea798e: 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#2bea798e: field dark_theme_colors: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (p *ProfileAccentColor) DecodeTDLibJSON(b tdjson.Decoder) error { + if p == nil { + return fmt.Errorf("can't decode profileAccentColor#2bea798e 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#2bea798e: %w", err) + } + case "id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode profileAccentColor#2bea798e: 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#2bea798e: 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#2bea798e: field dark_theme_colors: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetID returns value of ID field. +func (p *ProfileAccentColor) GetID() (value int32) { + if p == nil { + return + } + return p.ID +} + +// GetLightThemeColors returns value of LightThemeColors field. +func (p *ProfileAccentColor) GetLightThemeColors() (value ProfileAccentColors) { + if p == nil { + return + } + return p.LightThemeColors +} + +// GetDarkThemeColors returns value of DarkThemeColors field. +func (p *ProfileAccentColor) GetDarkThemeColors() (value ProfileAccentColors) { + if p == nil { + return + } + return p.DarkThemeColors +} diff --git a/tdapi/tl_profile_accent_colors_gen.go b/tdapi/tl_profile_accent_colors_gen.go new file mode 100644 index 0000000000..d0e860303e --- /dev/null +++ b/tdapi/tl_profile_accent_colors_gen.go @@ -0,0 +1,336 @@ +// 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{} +) + +// ProfileAccentColors represents TL type `profileAccentColors#218e9367`. +type ProfileAccentColors struct { + // The list of 1-2 colors in RGB format, describing the colors, as expected to be shown + // in the color palette settings + PaletteColors []int32 + // The list of 1-2 colors in RGB format, describing the colors, as expected to be used + // for the profile photo background + BackgroundColors []int32 + // The list of 2 colors in RGB format, describing the colors of the gradient to be used + // for the unread active story indicator around profile photo + StoryColors []int32 +} + +// ProfileAccentColorsTypeID is TL type id of ProfileAccentColors. +const ProfileAccentColorsTypeID = 0x218e9367 + +// Ensuring interfaces in compile-time for ProfileAccentColors. +var ( + _ bin.Encoder = &ProfileAccentColors{} + _ bin.Decoder = &ProfileAccentColors{} + _ bin.BareEncoder = &ProfileAccentColors{} + _ bin.BareDecoder = &ProfileAccentColors{} +) + +func (p *ProfileAccentColors) Zero() bool { + if p == nil { + return true + } + if !(p.PaletteColors == nil) { + return false + } + if !(p.BackgroundColors == nil) { + return false + } + if !(p.StoryColors == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *ProfileAccentColors) String() string { + if p == nil { + return "ProfileAccentColors(nil)" + } + type Alias ProfileAccentColors + return fmt.Sprintf("ProfileAccentColors%+v", Alias(*p)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ProfileAccentColors) TypeID() uint32 { + return ProfileAccentColorsTypeID +} + +// TypeName returns name of type in TL schema. +func (*ProfileAccentColors) TypeName() string { + return "profileAccentColors" +} + +// TypeInfo returns info about TL type. +func (p *ProfileAccentColors) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "profileAccentColors", + ID: ProfileAccentColorsTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "PaletteColors", + SchemaName: "palette_colors", + }, + { + Name: "BackgroundColors", + SchemaName: "background_colors", + }, + { + Name: "StoryColors", + SchemaName: "story_colors", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (p *ProfileAccentColors) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode profileAccentColors#218e9367 as nil") + } + b.PutID(ProfileAccentColorsTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *ProfileAccentColors) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode profileAccentColors#218e9367 as nil") + } + b.PutInt(len(p.PaletteColors)) + for _, v := range p.PaletteColors { + b.PutInt32(v) + } + b.PutInt(len(p.BackgroundColors)) + for _, v := range p.BackgroundColors { + b.PutInt32(v) + } + b.PutInt(len(p.StoryColors)) + for _, v := range p.StoryColors { + b.PutInt32(v) + } + return nil +} + +// Decode implements bin.Decoder. +func (p *ProfileAccentColors) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode profileAccentColors#218e9367 to nil") + } + if err := b.ConsumeID(ProfileAccentColorsTypeID); err != nil { + return fmt.Errorf("unable to decode profileAccentColors#218e9367: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *ProfileAccentColors) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode profileAccentColors#218e9367 to nil") + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode profileAccentColors#218e9367: field palette_colors: %w", err) + } + + if headerLen > 0 { + p.PaletteColors = make([]int32, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode profileAccentColors#218e9367: field palette_colors: %w", err) + } + p.PaletteColors = append(p.PaletteColors, value) + } + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode profileAccentColors#218e9367: field background_colors: %w", err) + } + + if headerLen > 0 { + p.BackgroundColors = make([]int32, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode profileAccentColors#218e9367: field background_colors: %w", err) + } + p.BackgroundColors = append(p.BackgroundColors, value) + } + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode profileAccentColors#218e9367: field story_colors: %w", err) + } + + if headerLen > 0 { + p.StoryColors = make([]int32, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode profileAccentColors#218e9367: field story_colors: %w", err) + } + p.StoryColors = append(p.StoryColors, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (p *ProfileAccentColors) EncodeTDLibJSON(b tdjson.Encoder) error { + if p == nil { + return fmt.Errorf("can't encode profileAccentColors#218e9367 as nil") + } + b.ObjStart() + b.PutID("profileAccentColors") + b.Comma() + b.FieldStart("palette_colors") + b.ArrStart() + for _, v := range p.PaletteColors { + b.PutInt32(v) + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.FieldStart("background_colors") + b.ArrStart() + for _, v := range p.BackgroundColors { + b.PutInt32(v) + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.FieldStart("story_colors") + b.ArrStart() + for _, v := range p.StoryColors { + b.PutInt32(v) + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (p *ProfileAccentColors) DecodeTDLibJSON(b tdjson.Decoder) error { + if p == nil { + return fmt.Errorf("can't decode profileAccentColors#218e9367 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("profileAccentColors"); err != nil { + return fmt.Errorf("unable to decode profileAccentColors#218e9367: %w", err) + } + case "palette_colors": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode profileAccentColors#218e9367: field palette_colors: %w", err) + } + p.PaletteColors = append(p.PaletteColors, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode profileAccentColors#218e9367: field palette_colors: %w", err) + } + case "background_colors": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode profileAccentColors#218e9367: field background_colors: %w", err) + } + p.BackgroundColors = append(p.BackgroundColors, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode profileAccentColors#218e9367: field background_colors: %w", err) + } + case "story_colors": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode profileAccentColors#218e9367: field story_colors: %w", err) + } + p.StoryColors = append(p.StoryColors, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode profileAccentColors#218e9367: field story_colors: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetPaletteColors returns value of PaletteColors field. +func (p *ProfileAccentColors) GetPaletteColors() (value []int32) { + if p == nil { + return + } + return p.PaletteColors +} + +// GetBackgroundColors returns value of BackgroundColors field. +func (p *ProfileAccentColors) GetBackgroundColors() (value []int32) { + if p == nil { + return + } + return p.BackgroundColors +} + +// GetStoryColors returns value of StoryColors field. +func (p *ProfileAccentColors) GetStoryColors() (value []int32) { + if p == nil { + return + } + return p.StoryColors +} diff --git a/tdapi/tl_registry_gen.go b/tdapi/tl_registry_gen.go index 2ec52209f4..9736537b7a 100644 --- a/tdapi/tl_registry_gen.go +++ b/tdapi/tl_registry_gen.go @@ -166,12 +166,14 @@ func TypesMap() map[uint32]string { PremiumGiveawayInfoOngoingTypeID: "premiumGiveawayInfoOngoing#48d3ce6f", PremiumGiveawayInfoCompletedTypeID: "premiumGiveawayInfoCompleted#fc8b501b", AccentColorTypeID: "accentColor#83d57cd6", + ProfileAccentColorsTypeID: "profileAccentColors#218e9367", + ProfileAccentColorTypeID: "profileAccentColor#2bea798e", EmojiStatusTypeID: "emojiStatus#dbd91636", EmojiStatusesTypeID: "emojiStatuses#eaeb9bdc", UsernamesTypeID: "usernames#bf343063", - UserTypeID: "user#e39ad80a", + UserTypeID: "user#cd8cf8ac", BotInfoTypeID: "botInfo#bfdb89a", - UserFullInfoTypeID: "userFullInfo#a53c620b", + UserFullInfoTypeID: "userFullInfo#cc594e6f", UsersTypeID: "users#9d955a12", ChatAdministratorTypeID: "chatAdministrator#7277bd2c", ChatAdministratorsTypeID: "chatAdministrators#5141ca21", @@ -240,9 +242,11 @@ func TypesMap() map[uint32]string { UnreadReactionTypeID: "unreadReaction#8c5b3b82", MessageSendingStatePendingTypeID: "messageSendingStatePending#f32b63b4", MessageSendingStateFailedTypeID: "messageSendingStateFailed#ac81ee5e", - MessageReplyToMessageTypeID: "messageReplyToMessage#1bb65082", + TextQuoteTypeID: "textQuote#8675b8b2", + InputTextQuoteTypeID: "inputTextQuote#b74a6d1c", + MessageReplyToMessageTypeID: "messageReplyToMessage#ee105987", MessageReplyToStoryTypeID: "messageReplyToStory#708ca939", - InputMessageReplyToMessageTypeID: "inputMessageReplyToMessage#20b16f06", + InputMessageReplyToMessageTypeID: "inputMessageReplyToMessage#11e3fd76", InputMessageReplyToStoryTypeID: "inputMessageReplyToStory#51aece78", MessageTypeID: "message#5aa8fa7e", MessagesTypeID: "messages#b34c8c60", @@ -263,11 +267,12 @@ func TypesMap() map[uint32]string { MessageSourceScreenshotTypeID: "messageSourceScreenshot#1c035d0a", MessageSourceOtherTypeID: "messageSourceOther#35c0a702", MessageSponsorTypeBotTypeID: "messageSponsorTypeBot#700d2304", + MessageSponsorTypeWebAppTypeID: "messageSponsorTypeWebApp#25b74fb8", MessageSponsorTypePublicChannelTypeID: "messageSponsorTypePublicChannel#ed645a47", MessageSponsorTypePrivateChannelTypeID: "messageSponsorTypePrivateChannel#74d245a8", MessageSponsorTypeWebsiteTypeID: "messageSponsorTypeWebsite#a4e45f9b", MessageSponsorTypeID: "messageSponsor#a0b25071", - SponsoredMessageTypeID: "sponsoredMessage#844f0dc", + SponsoredMessageTypeID: "sponsoredMessage#147623b4", SponsoredMessagesTypeID: "sponsoredMessages#e402a0f", FileDownloadTypeID: "fileDownload#834d1354", DownloadedFileCountsTypeID: "downloadedFileCounts#8a572842", @@ -301,7 +306,7 @@ func TypesMap() map[uint32]string { ChatAvailableReactionsAllTypeID: "chatAvailableReactionsAll#dff07c4e", ChatAvailableReactionsSomeTypeID: "chatAvailableReactionsSome#d3cc0a6b", VideoChatTypeID: "videoChat#ae158d28", - ChatTypeID: "chat#5a9e2993", + ChatTypeID: "chat#4dd64d7d", ChatsTypeID: "chats#9b93e3eb", ChatNearbyTypeID: "chatNearby#2de4255", ChatsNearbyTypeID: "chatsNearby#cc744cff", @@ -547,7 +552,7 @@ func TypesMap() map[uint32]string { MessageChatUpgradeFromTypeID: "messageChatUpgradeFrom#136daadc", MessagePinMessageTypeID: "messagePinMessage#38d55039", MessageScreenshotTakenTypeID: "messageScreenshotTaken#a2b86dab", - MessageChatSetBackgroundTypeID: "messageChatSetBackground#81819731", + MessageChatSetBackgroundTypeID: "messageChatSetBackground#3d5d7c40", MessageChatSetThemeTypeID: "messageChatSetTheme#99ae9408", MessageChatSetMessageAutoDeleteTimeTypeID: "messageChatSetMessageAutoDeleteTime#619e052e", MessageForumTopicCreatedTypeID: "messageForumTopicCreated#b8ce47d1", @@ -563,6 +568,7 @@ func TypesMap() map[uint32]string { MessagePremiumGiftCodeTypeID: "messagePremiumGiftCode#7a9c468f", MessagePremiumGiveawayCreatedTypeID: "messagePremiumGiveawayCreated#270f2c44", MessagePremiumGiveawayTypeID: "messagePremiumGiveaway#4aa0d0b0", + MessagePremiumGiveawayCompletedTypeID: "messagePremiumGiveawayCompleted#80533949", MessageContactRegisteredTypeID: "messageContactRegistered#a678fcff", MessageUserSharedTypeID: "messageUserShared#d4dcb77c", MessageChatSharedTypeID: "messageChatShared#22db7091", @@ -689,11 +695,18 @@ func TypesMap() map[uint32]string { InputStoryContentVideoTypeID: "inputStoryContentVideo#d7383f99", StoryListMainTypeID: "storyListMain#d7eeb3ff", StoryListArchiveTypeID: "storyListArchive#fd80a741", + StoryOriginPublicStoryTypeID: "storyOriginPublicStory#2c379fbe", + StoryOriginHiddenUserTypeID: "storyOriginHiddenUser#5a1f89ec", + StoryRepostInfoTypeID: "storyRepostInfo#ff7fa440", StoryInteractionInfoTypeID: "storyInteractionInfo#e1557fc7", - StoryTypeID: "story#627556b4", + StoryTypeID: "story#29dd2b0d", StoriesTypeID: "stories#5a860711", + StoryFullIDTypeID: "storyFullId#701d31f5", StoryInfoTypeID: "storyInfo#8997c352", ChatActiveStoriesTypeID: "chatActiveStories#d923d773", + StoryPublicForwardMessageTypeID: "storyPublicForwardMessage#fd39c20c", + StoryPublicForwardStoryTypeID: "storyPublicForwardStory#f7e6c146", + StoryPublicForwardsTypeID: "storyPublicForwards#fcacb389", ChatBoostSourceGiftCodeTypeID: "chatBoostSourceGiftCode#fa2412ba", ChatBoostSourceGiveawayTypeID: "chatBoostSourceGiveaway#90d1c70", ChatBoostSourcePremiumTypeID: "chatBoostSourcePremium#ed4eb", @@ -873,6 +886,7 @@ func TypesMap() map[uint32]string { PremiumLimitTypeMonthlySentStoryCountTypeID: "premiumLimitTypeMonthlySentStoryCount#30d84b83", PremiumLimitTypeStoryCaptionLengthTypeID: "premiumLimitTypeStoryCaptionLength#bed53302", PremiumLimitTypeStorySuggestedReactionAreaCountTypeID: "premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807", + PremiumLimitTypeSimilarChatCountTypeID: "premiumLimitTypeSimilarChatCount#a2ce1f11", PremiumFeatureIncreasedLimitsTypeID: "premiumFeatureIncreasedLimits#6a6be1b7", PremiumFeatureIncreasedUploadFileSizeTypeID: "premiumFeatureIncreasedUploadFileSize#6ccce473", PremiumFeatureImprovedDownloadSpeedTypeID: "premiumFeatureImprovedDownloadSpeed#f00b4a3e", @@ -891,6 +905,7 @@ func TypesMap() map[uint32]string { PremiumFeatureUpgradedStoriesTypeID: "premiumFeatureUpgradedStories#9008051b", PremiumFeatureChatBoostTypeID: "premiumFeatureChatBoost#5df89f1b", PremiumFeatureAccentColorTypeID: "premiumFeatureAccentColor#361ac59e", + PremiumFeatureBackgroundForBothTypeID: "premiumFeatureBackgroundForBoth#2246eefa", PremiumStoryFeaturePriorityOrderTypeID: "premiumStoryFeaturePriorityOrder#8ff172c7", PremiumStoryFeatureStealthModeTypeID: "premiumStoryFeatureStealthMode#47343da4", PremiumStoryFeaturePermanentViewsHistoryTypeID: "premiumStoryFeaturePermanentViewsHistory#c2a047a0", @@ -1216,13 +1231,16 @@ func TypesMap() map[uint32]string { StatisticalGraphDataTypeID: "statisticalGraphData#89732e2c", StatisticalGraphAsyncTypeID: "statisticalGraphAsync#19fb2b9f", StatisticalGraphErrorTypeID: "statisticalGraphError#c3fda052", - ChatStatisticsMessageInteractionInfoTypeID: "chatStatisticsMessageInteractionInfo#d25e2a2c", + ChatStatisticsObjectTypeMessageTypeID: "chatStatisticsObjectTypeMessage#6f9f24f6", + ChatStatisticsObjectTypeStoryTypeID: "chatStatisticsObjectTypeStory#15baf9b0", + ChatStatisticsInteractionInfoTypeID: "chatStatisticsInteractionInfo#694a9a8d", ChatStatisticsMessageSenderInfoTypeID: "chatStatisticsMessageSenderInfo#690a7e4b", ChatStatisticsAdministratorActionsInfoTypeID: "chatStatisticsAdministratorActionsInfo#e7c5cd7e", ChatStatisticsInviterInfoTypeID: "chatStatisticsInviterInfo#2583d48b", ChatStatisticsSupergroupTypeID: "chatStatisticsSupergroup#c67549ef", - ChatStatisticsChannelTypeID: "chatStatisticsChannel#9be23786", - MessageStatisticsTypeID: "messageStatistics#c3b781b0", + ChatStatisticsChannelTypeID: "chatStatisticsChannel#b8e95b4", + MessageStatisticsTypeID: "messageStatistics#a2ce4f07", + StoryStatisticsTypeID: "storyStatistics#46448b6b", PointTypeID: "point#1a13f5b9", VectorPathCommandLineTypeID: "vectorPathCommandLine#db663c8a", VectorPathCommandCubicBezierCurveTypeID: "vectorPathCommandCubicBezierCurve#494c3e3a", @@ -1273,6 +1291,7 @@ func TypesMap() map[uint32]string { UpdateChatHasProtectedContentTypeID: "updateChatHasProtectedContent#6b50071b", UpdateChatIsTranslatableTypeID: "updateChatIsTranslatable#7b031617", UpdateChatIsMarkedAsUnreadTypeID: "updateChatIsMarkedAsUnread#57853334", + UpdateChatViewAsTopicsTypeID: "updateChatViewAsTopics#5bff163d", UpdateChatBlockListTypeID: "updateChatBlockList#872af48e", UpdateChatHasScheduledMessagesTypeID: "updateChatHasScheduledMessages#7b14c2d7", UpdateChatFoldersTypeID: "updateChatFolders#71a4b3a", @@ -1326,6 +1345,7 @@ func TypesMap() map[uint32]string { UpdateSelectedBackgroundTypeID: "updateSelectedBackground#99bd205d", UpdateChatThemesTypeID: "updateChatThemes#98dc58d5", UpdateAccentColorsTypeID: "updateAccentColors#1316555e", + UpdateProfileAccentColorsTypeID: "updateProfileAccentColors#bf8e7430", UpdateLanguagePackStringsTypeID: "updateLanguagePackStrings#af87919f", UpdateConnectionStateTypeID: "updateConnectionState#57939e2e", UpdateTermsOfServiceTypeID: "updateTermsOfService#b23cc55e", @@ -1335,6 +1355,7 @@ func TypesMap() map[uint32]string { UpdateWebAppMessageSentTypeID: "updateWebAppMessageSent#58431229", UpdateActiveEmojiReactionsTypeID: "updateActiveEmojiReactions#691ffcb7", UpdateDefaultReactionTypeTypeID: "updateDefaultReactionType#4b615105", + UpdateSpeechRecognitionTrialTypeID: "updateSpeechRecognitionTrial#ff4efcc1", UpdateDiceEmojisTypeID: "updateDiceEmojis#9d0f91df", UpdateAnimatedEmojiMessageClickedTypeID: "updateAnimatedEmojiMessageClicked#a3167405", UpdateAnimationSearchParametersTypeID: "updateAnimationSearchParameters#6016ef01", @@ -1432,6 +1453,8 @@ func TypesMap() map[uint32]string { SearchChatsRequestTypeID: "searchChats#8ff4b9cc", SearchChatsOnServerRequestTypeID: "searchChatsOnServer#baf42f74", SearchChatsNearbyRequestTypeID: "searchChatsNearby#f445c81f", + GetChatSimilarChatsRequestTypeID: "getChatSimilarChats#bb508f83", + GetChatSimilarChatCountRequestTypeID: "getChatSimilarChatCount#463e968e", GetTopChatsRequestTypeID: "getTopChats#e8d95221", RemoveTopChatRequestTypeID: "removeTopChat#8e481e55", SearchRecentlyFoundChatsRequestTypeID: "searchRecentlyFoundChats#62320591", @@ -1481,7 +1504,7 @@ func TypesMap() map[uint32]string { SendBotStartMessageRequestTypeID: "sendBotStartMessage#aa6a3eee", SendInlineQueryResultMessageRequestTypeID: "sendInlineQueryResultMessage#467c5478", ForwardMessagesRequestTypeID: "forwardMessages#34de5b20", - ResendMessagesRequestTypeID: "resendMessages#4a0c68af", + ResendMessagesRequestTypeID: "resendMessages#90e36776", AddLocalMessageRequestTypeID: "addLocalMessage#f617b7a1", DeleteMessagesRequestTypeID: "deleteMessages#c3ed9de2", DeleteChatMessagesBySenderRequestTypeID: "deleteChatMessagesBySender#ba9b2e67", @@ -1604,11 +1627,13 @@ func TypesMap() map[uint32]string { SetChatAccentColorRequestTypeID: "setChatAccentColor#349f57ca", SetChatMessageAutoDeleteTimeRequestTypeID: "setChatMessageAutoDeleteTime#a641b4ff", SetChatPermissionsRequestTypeID: "setChatPermissions#7f7706fe", - SetChatBackgroundRequestTypeID: "setChatBackground#3d3f1b28", + SetChatBackgroundRequestTypeID: "setChatBackground#eb4c3fe", + DeleteChatBackgroundRequestTypeID: "deleteChatBackground#1316e678", SetChatThemeRequestTypeID: "setChatTheme#8f090293", SetChatDraftMessageRequestTypeID: "setChatDraftMessage#645e1f1a", SetChatNotificationSettingsRequestTypeID: "setChatNotificationSettings#2e531ffe", ToggleChatHasProtectedContentRequestTypeID: "toggleChatHasProtectedContent#3a20d94d", + ToggleChatViewAsTopicsRequestTypeID: "toggleChatViewAsTopics#2b2783dc", ToggleChatIsTranslatableRequestTypeID: "toggleChatIsTranslatable#93f9cbdf", ToggleChatIsMarkedAsUnreadRequestTypeID: "toggleChatIsMarkedAsUnread#c538dadf", ToggleChatDefaultDisableNotificationRequestTypeID: "toggleChatDefaultDisableNotification#12c36012", @@ -1648,7 +1673,7 @@ func TypesMap() map[uint32]string { GetStoryRequestTypeID: "getStory#717b1c78", GetChatsToSendStoriesRequestTypeID: "getChatsToSendStories#22f9e3a4", CanSendStoryRequestTypeID: "canSendStory#b6e0216b", - SendStoryRequestTypeID: "sendStory#53242a4", + SendStoryRequestTypeID: "sendStory#736858bb", EditStoryRequestTypeID: "editStory#5e6a21b1", SetStoryPrivacySettingsRequestTypeID: "setStoryPrivacySettings#1b6c5434", ToggleStoryIsPinnedRequestTypeID: "toggleStoryIsPinned#b493b30e", @@ -1666,6 +1691,7 @@ func TypesMap() map[uint32]string { GetStoryViewersRequestTypeID: "getStoryViewers#40df8dba", ReportStoryRequestTypeID: "reportStory#9b5f709b", ActivateStoryStealthModeRequestTypeID: "activateStoryStealthMode#c3db8491", + GetStoryPublicForwardsRequestTypeID: "getStoryPublicForwards#8b835be9", GetAvailableChatBoostSlotsRequestTypeID: "getAvailableChatBoostSlots#7307ebd5", GetChatBoostStatusRequestTypeID: "getChatBoostStatus#cfac8acf", BoostChatRequestTypeID: "boostChat#890ccd68", @@ -1780,7 +1806,7 @@ func TypesMap() map[uint32]string { GetStickerSetRequestTypeID: "getStickerSet#3eb91bc3", SearchStickerSetRequestTypeID: "searchStickerSet#45049cee", SearchInstalledStickerSetsRequestTypeID: "searchInstalledStickerSets#7e5e7fa4", - SearchStickerSetsRequestTypeID: "searchStickerSets#bf7d307b", + SearchStickerSetsRequestTypeID: "searchStickerSets#faa066c", ChangeStickerSetRequestTypeID: "changeStickerSet#1ac8a5ed", ViewTrendingStickerSetsRequestTypeID: "viewTrendingStickerSets#36d6469", ReorderInstalledStickerSetsRequestTypeID: "reorderInstalledStickerSets#4a830a78", @@ -1811,6 +1837,7 @@ func TypesMap() map[uint32]string { SetProfilePhotoRequestTypeID: "setProfilePhoto#85ea05ed", DeleteProfilePhotoRequestTypeID: "deleteProfilePhoto#4eaa77c1", SetAccentColorRequestTypeID: "setAccentColor#6389cb39", + SetProfileAccentColorRequestTypeID: "setProfileAccentColor#899bc168", SetNameRequestTypeID: "setName#66065f10", SetBioRequestTypeID: "setBio#9f772354", SetUsernameRequestTypeID: "setUsername#1a385c1e", @@ -1914,6 +1941,7 @@ func TypesMap() map[uint32]string { GetChatStatisticsRequestTypeID: "getChatStatistics#137e8198", GetMessageStatisticsRequestTypeID: "getMessageStatistics#4bb5a1d8", GetMessagePublicForwardsRequestTypeID: "getMessagePublicForwards#6006a949", + GetStoryStatisticsRequestTypeID: "getStoryStatistics#3a964342", GetStatisticalGraphRequestTypeID: "getStatisticalGraph#419f8d9b", GetStorageStatisticsRequestTypeID: "getStorageStatistics#cd254b37", GetStorageStatisticsFastRequestTypeID: "getStorageStatisticsFast#3a86702", @@ -2161,6 +2189,8 @@ func NamesMap() map[string]uint32 { "premiumGiveawayInfoOngoing": PremiumGiveawayInfoOngoingTypeID, "premiumGiveawayInfoCompleted": PremiumGiveawayInfoCompletedTypeID, "accentColor": AccentColorTypeID, + "profileAccentColors": ProfileAccentColorsTypeID, + "profileAccentColor": ProfileAccentColorTypeID, "emojiStatus": EmojiStatusTypeID, "emojiStatuses": EmojiStatusesTypeID, "usernames": UsernamesTypeID, @@ -2235,6 +2265,8 @@ func NamesMap() map[string]uint32 { "unreadReaction": UnreadReactionTypeID, "messageSendingStatePending": MessageSendingStatePendingTypeID, "messageSendingStateFailed": MessageSendingStateFailedTypeID, + "textQuote": TextQuoteTypeID, + "inputTextQuote": InputTextQuoteTypeID, "messageReplyToMessage": MessageReplyToMessageTypeID, "messageReplyToStory": MessageReplyToStoryTypeID, "inputMessageReplyToMessage": InputMessageReplyToMessageTypeID, @@ -2258,6 +2290,7 @@ func NamesMap() map[string]uint32 { "messageSourceScreenshot": MessageSourceScreenshotTypeID, "messageSourceOther": MessageSourceOtherTypeID, "messageSponsorTypeBot": MessageSponsorTypeBotTypeID, + "messageSponsorTypeWebApp": MessageSponsorTypeWebAppTypeID, "messageSponsorTypePublicChannel": MessageSponsorTypePublicChannelTypeID, "messageSponsorTypePrivateChannel": MessageSponsorTypePrivateChannelTypeID, "messageSponsorTypeWebsite": MessageSponsorTypeWebsiteTypeID, @@ -2558,6 +2591,7 @@ func NamesMap() map[string]uint32 { "messagePremiumGiftCode": MessagePremiumGiftCodeTypeID, "messagePremiumGiveawayCreated": MessagePremiumGiveawayCreatedTypeID, "messagePremiumGiveaway": MessagePremiumGiveawayTypeID, + "messagePremiumGiveawayCompleted": MessagePremiumGiveawayCompletedTypeID, "messageContactRegistered": MessageContactRegisteredTypeID, "messageUserShared": MessageUserSharedTypeID, "messageChatShared": MessageChatSharedTypeID, @@ -2684,11 +2718,18 @@ func NamesMap() map[string]uint32 { "inputStoryContentVideo": InputStoryContentVideoTypeID, "storyListMain": StoryListMainTypeID, "storyListArchive": StoryListArchiveTypeID, + "storyOriginPublicStory": StoryOriginPublicStoryTypeID, + "storyOriginHiddenUser": StoryOriginHiddenUserTypeID, + "storyRepostInfo": StoryRepostInfoTypeID, "storyInteractionInfo": StoryInteractionInfoTypeID, "story": StoryTypeID, "stories": StoriesTypeID, + "storyFullId": StoryFullIDTypeID, "storyInfo": StoryInfoTypeID, "chatActiveStories": ChatActiveStoriesTypeID, + "storyPublicForwardMessage": StoryPublicForwardMessageTypeID, + "storyPublicForwardStory": StoryPublicForwardStoryTypeID, + "storyPublicForwards": StoryPublicForwardsTypeID, "chatBoostSourceGiftCode": ChatBoostSourceGiftCodeTypeID, "chatBoostSourceGiveaway": ChatBoostSourceGiveawayTypeID, "chatBoostSourcePremium": ChatBoostSourcePremiumTypeID, @@ -2868,6 +2909,7 @@ func NamesMap() map[string]uint32 { "premiumLimitTypeMonthlySentStoryCount": PremiumLimitTypeMonthlySentStoryCountTypeID, "premiumLimitTypeStoryCaptionLength": PremiumLimitTypeStoryCaptionLengthTypeID, "premiumLimitTypeStorySuggestedReactionAreaCount": PremiumLimitTypeStorySuggestedReactionAreaCountTypeID, + "premiumLimitTypeSimilarChatCount": PremiumLimitTypeSimilarChatCountTypeID, "premiumFeatureIncreasedLimits": PremiumFeatureIncreasedLimitsTypeID, "premiumFeatureIncreasedUploadFileSize": PremiumFeatureIncreasedUploadFileSizeTypeID, "premiumFeatureImprovedDownloadSpeed": PremiumFeatureImprovedDownloadSpeedTypeID, @@ -2886,6 +2928,7 @@ func NamesMap() map[string]uint32 { "premiumFeatureUpgradedStories": PremiumFeatureUpgradedStoriesTypeID, "premiumFeatureChatBoost": PremiumFeatureChatBoostTypeID, "premiumFeatureAccentColor": PremiumFeatureAccentColorTypeID, + "premiumFeatureBackgroundForBoth": PremiumFeatureBackgroundForBothTypeID, "premiumStoryFeaturePriorityOrder": PremiumStoryFeaturePriorityOrderTypeID, "premiumStoryFeatureStealthMode": PremiumStoryFeatureStealthModeTypeID, "premiumStoryFeaturePermanentViewsHistory": PremiumStoryFeaturePermanentViewsHistoryTypeID, @@ -3211,13 +3254,16 @@ func NamesMap() map[string]uint32 { "statisticalGraphData": StatisticalGraphDataTypeID, "statisticalGraphAsync": StatisticalGraphAsyncTypeID, "statisticalGraphError": StatisticalGraphErrorTypeID, - "chatStatisticsMessageInteractionInfo": ChatStatisticsMessageInteractionInfoTypeID, + "chatStatisticsObjectTypeMessage": ChatStatisticsObjectTypeMessageTypeID, + "chatStatisticsObjectTypeStory": ChatStatisticsObjectTypeStoryTypeID, + "chatStatisticsInteractionInfo": ChatStatisticsInteractionInfoTypeID, "chatStatisticsMessageSenderInfo": ChatStatisticsMessageSenderInfoTypeID, "chatStatisticsAdministratorActionsInfo": ChatStatisticsAdministratorActionsInfoTypeID, "chatStatisticsInviterInfo": ChatStatisticsInviterInfoTypeID, "chatStatisticsSupergroup": ChatStatisticsSupergroupTypeID, "chatStatisticsChannel": ChatStatisticsChannelTypeID, "messageStatistics": MessageStatisticsTypeID, + "storyStatistics": StoryStatisticsTypeID, "point": PointTypeID, "vectorPathCommandLine": VectorPathCommandLineTypeID, "vectorPathCommandCubicBezierCurve": VectorPathCommandCubicBezierCurveTypeID, @@ -3268,6 +3314,7 @@ func NamesMap() map[string]uint32 { "updateChatHasProtectedContent": UpdateChatHasProtectedContentTypeID, "updateChatIsTranslatable": UpdateChatIsTranslatableTypeID, "updateChatIsMarkedAsUnread": UpdateChatIsMarkedAsUnreadTypeID, + "updateChatViewAsTopics": UpdateChatViewAsTopicsTypeID, "updateChatBlockList": UpdateChatBlockListTypeID, "updateChatHasScheduledMessages": UpdateChatHasScheduledMessagesTypeID, "updateChatFolders": UpdateChatFoldersTypeID, @@ -3321,6 +3368,7 @@ func NamesMap() map[string]uint32 { "updateSelectedBackground": UpdateSelectedBackgroundTypeID, "updateChatThemes": UpdateChatThemesTypeID, "updateAccentColors": UpdateAccentColorsTypeID, + "updateProfileAccentColors": UpdateProfileAccentColorsTypeID, "updateLanguagePackStrings": UpdateLanguagePackStringsTypeID, "updateConnectionState": UpdateConnectionStateTypeID, "updateTermsOfService": UpdateTermsOfServiceTypeID, @@ -3330,6 +3378,7 @@ func NamesMap() map[string]uint32 { "updateWebAppMessageSent": UpdateWebAppMessageSentTypeID, "updateActiveEmojiReactions": UpdateActiveEmojiReactionsTypeID, "updateDefaultReactionType": UpdateDefaultReactionTypeTypeID, + "updateSpeechRecognitionTrial": UpdateSpeechRecognitionTrialTypeID, "updateDiceEmojis": UpdateDiceEmojisTypeID, "updateAnimatedEmojiMessageClicked": UpdateAnimatedEmojiMessageClickedTypeID, "updateAnimationSearchParameters": UpdateAnimationSearchParametersTypeID, @@ -3427,6 +3476,8 @@ func NamesMap() map[string]uint32 { "searchChats": SearchChatsRequestTypeID, "searchChatsOnServer": SearchChatsOnServerRequestTypeID, "searchChatsNearby": SearchChatsNearbyRequestTypeID, + "getChatSimilarChats": GetChatSimilarChatsRequestTypeID, + "getChatSimilarChatCount": GetChatSimilarChatCountRequestTypeID, "getTopChats": GetTopChatsRequestTypeID, "removeTopChat": RemoveTopChatRequestTypeID, "searchRecentlyFoundChats": SearchRecentlyFoundChatsRequestTypeID, @@ -3600,10 +3651,12 @@ func NamesMap() map[string]uint32 { "setChatMessageAutoDeleteTime": SetChatMessageAutoDeleteTimeRequestTypeID, "setChatPermissions": SetChatPermissionsRequestTypeID, "setChatBackground": SetChatBackgroundRequestTypeID, + "deleteChatBackground": DeleteChatBackgroundRequestTypeID, "setChatTheme": SetChatThemeRequestTypeID, "setChatDraftMessage": SetChatDraftMessageRequestTypeID, "setChatNotificationSettings": SetChatNotificationSettingsRequestTypeID, "toggleChatHasProtectedContent": ToggleChatHasProtectedContentRequestTypeID, + "toggleChatViewAsTopics": ToggleChatViewAsTopicsRequestTypeID, "toggleChatIsTranslatable": ToggleChatIsTranslatableRequestTypeID, "toggleChatIsMarkedAsUnread": ToggleChatIsMarkedAsUnreadRequestTypeID, "toggleChatDefaultDisableNotification": ToggleChatDefaultDisableNotificationRequestTypeID, @@ -3661,6 +3714,7 @@ func NamesMap() map[string]uint32 { "getStoryViewers": GetStoryViewersRequestTypeID, "reportStory": ReportStoryRequestTypeID, "activateStoryStealthMode": ActivateStoryStealthModeRequestTypeID, + "getStoryPublicForwards": GetStoryPublicForwardsRequestTypeID, "getAvailableChatBoostSlots": GetAvailableChatBoostSlotsRequestTypeID, "getChatBoostStatus": GetChatBoostStatusRequestTypeID, "boostChat": BoostChatRequestTypeID, @@ -3806,6 +3860,7 @@ func NamesMap() map[string]uint32 { "setProfilePhoto": SetProfilePhotoRequestTypeID, "deleteProfilePhoto": DeleteProfilePhotoRequestTypeID, "setAccentColor": SetAccentColorRequestTypeID, + "setProfileAccentColor": SetProfileAccentColorRequestTypeID, "setName": SetNameRequestTypeID, "setBio": SetBioRequestTypeID, "setUsername": SetUsernameRequestTypeID, @@ -3909,6 +3964,7 @@ func NamesMap() map[string]uint32 { "getChatStatistics": GetChatStatisticsRequestTypeID, "getMessageStatistics": GetMessageStatisticsRequestTypeID, "getMessagePublicForwards": GetMessagePublicForwardsRequestTypeID, + "getStoryStatistics": GetStoryStatisticsRequestTypeID, "getStatisticalGraph": GetStatisticalGraphRequestTypeID, "getStorageStatistics": GetStorageStatisticsRequestTypeID, "getStorageStatisticsFast": GetStorageStatisticsFastRequestTypeID, @@ -4156,6 +4212,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PremiumGiveawayInfoOngoingTypeID: func() bin.Object { return &PremiumGiveawayInfoOngoing{} }, PremiumGiveawayInfoCompletedTypeID: func() bin.Object { return &PremiumGiveawayInfoCompleted{} }, AccentColorTypeID: func() bin.Object { return &AccentColor{} }, + ProfileAccentColorsTypeID: func() bin.Object { return &ProfileAccentColors{} }, + ProfileAccentColorTypeID: func() bin.Object { return &ProfileAccentColor{} }, EmojiStatusTypeID: func() bin.Object { return &EmojiStatus{} }, EmojiStatusesTypeID: func() bin.Object { return &EmojiStatuses{} }, UsernamesTypeID: func() bin.Object { return &Usernames{} }, @@ -4230,6 +4288,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UnreadReactionTypeID: func() bin.Object { return &UnreadReaction{} }, MessageSendingStatePendingTypeID: func() bin.Object { return &MessageSendingStatePending{} }, MessageSendingStateFailedTypeID: func() bin.Object { return &MessageSendingStateFailed{} }, + TextQuoteTypeID: func() bin.Object { return &TextQuote{} }, + InputTextQuoteTypeID: func() bin.Object { return &InputTextQuote{} }, MessageReplyToMessageTypeID: func() bin.Object { return &MessageReplyToMessage{} }, MessageReplyToStoryTypeID: func() bin.Object { return &MessageReplyToStory{} }, InputMessageReplyToMessageTypeID: func() bin.Object { return &InputMessageReplyToMessage{} }, @@ -4253,6 +4313,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessageSourceScreenshotTypeID: func() bin.Object { return &MessageSourceScreenshot{} }, MessageSourceOtherTypeID: func() bin.Object { return &MessageSourceOther{} }, MessageSponsorTypeBotTypeID: func() bin.Object { return &MessageSponsorTypeBot{} }, + MessageSponsorTypeWebAppTypeID: func() bin.Object { return &MessageSponsorTypeWebApp{} }, MessageSponsorTypePublicChannelTypeID: func() bin.Object { return &MessageSponsorTypePublicChannel{} }, MessageSponsorTypePrivateChannelTypeID: func() bin.Object { return &MessageSponsorTypePrivateChannel{} }, MessageSponsorTypeWebsiteTypeID: func() bin.Object { return &MessageSponsorTypeWebsite{} }, @@ -4553,6 +4614,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessagePremiumGiftCodeTypeID: func() bin.Object { return &MessagePremiumGiftCode{} }, MessagePremiumGiveawayCreatedTypeID: func() bin.Object { return &MessagePremiumGiveawayCreated{} }, MessagePremiumGiveawayTypeID: func() bin.Object { return &MessagePremiumGiveaway{} }, + MessagePremiumGiveawayCompletedTypeID: func() bin.Object { return &MessagePremiumGiveawayCompleted{} }, MessageContactRegisteredTypeID: func() bin.Object { return &MessageContactRegistered{} }, MessageUserSharedTypeID: func() bin.Object { return &MessageUserShared{} }, MessageChatSharedTypeID: func() bin.Object { return &MessageChatShared{} }, @@ -4679,11 +4741,18 @@ func TypesConstructorMap() map[uint32]func() bin.Object { InputStoryContentVideoTypeID: func() bin.Object { return &InputStoryContentVideo{} }, StoryListMainTypeID: func() bin.Object { return &StoryListMain{} }, StoryListArchiveTypeID: func() bin.Object { return &StoryListArchive{} }, + StoryOriginPublicStoryTypeID: func() bin.Object { return &StoryOriginPublicStory{} }, + StoryOriginHiddenUserTypeID: func() bin.Object { return &StoryOriginHiddenUser{} }, + StoryRepostInfoTypeID: func() bin.Object { return &StoryRepostInfo{} }, StoryInteractionInfoTypeID: func() bin.Object { return &StoryInteractionInfo{} }, StoryTypeID: func() bin.Object { return &Story{} }, StoriesTypeID: func() bin.Object { return &Stories{} }, + StoryFullIDTypeID: func() bin.Object { return &StoryFullID{} }, StoryInfoTypeID: func() bin.Object { return &StoryInfo{} }, ChatActiveStoriesTypeID: func() bin.Object { return &ChatActiveStories{} }, + StoryPublicForwardMessageTypeID: func() bin.Object { return &StoryPublicForwardMessage{} }, + StoryPublicForwardStoryTypeID: func() bin.Object { return &StoryPublicForwardStory{} }, + StoryPublicForwardsTypeID: func() bin.Object { return &StoryPublicForwards{} }, ChatBoostSourceGiftCodeTypeID: func() bin.Object { return &ChatBoostSourceGiftCode{} }, ChatBoostSourceGiveawayTypeID: func() bin.Object { return &ChatBoostSourceGiveaway{} }, ChatBoostSourcePremiumTypeID: func() bin.Object { return &ChatBoostSourcePremium{} }, @@ -4863,6 +4932,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PremiumLimitTypeMonthlySentStoryCountTypeID: func() bin.Object { return &PremiumLimitTypeMonthlySentStoryCount{} }, PremiumLimitTypeStoryCaptionLengthTypeID: func() bin.Object { return &PremiumLimitTypeStoryCaptionLength{} }, PremiumLimitTypeStorySuggestedReactionAreaCountTypeID: func() bin.Object { return &PremiumLimitTypeStorySuggestedReactionAreaCount{} }, + PremiumLimitTypeSimilarChatCountTypeID: func() bin.Object { return &PremiumLimitTypeSimilarChatCount{} }, PremiumFeatureIncreasedLimitsTypeID: func() bin.Object { return &PremiumFeatureIncreasedLimits{} }, PremiumFeatureIncreasedUploadFileSizeTypeID: func() bin.Object { return &PremiumFeatureIncreasedUploadFileSize{} }, PremiumFeatureImprovedDownloadSpeedTypeID: func() bin.Object { return &PremiumFeatureImprovedDownloadSpeed{} }, @@ -4881,6 +4951,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PremiumFeatureUpgradedStoriesTypeID: func() bin.Object { return &PremiumFeatureUpgradedStories{} }, PremiumFeatureChatBoostTypeID: func() bin.Object { return &PremiumFeatureChatBoost{} }, PremiumFeatureAccentColorTypeID: func() bin.Object { return &PremiumFeatureAccentColor{} }, + PremiumFeatureBackgroundForBothTypeID: func() bin.Object { return &PremiumFeatureBackgroundForBoth{} }, PremiumStoryFeaturePriorityOrderTypeID: func() bin.Object { return &PremiumStoryFeaturePriorityOrder{} }, PremiumStoryFeatureStealthModeTypeID: func() bin.Object { return &PremiumStoryFeatureStealthMode{} }, PremiumStoryFeaturePermanentViewsHistoryTypeID: func() bin.Object { return &PremiumStoryFeaturePermanentViewsHistory{} }, @@ -5206,13 +5277,16 @@ func TypesConstructorMap() map[uint32]func() bin.Object { StatisticalGraphDataTypeID: func() bin.Object { return &StatisticalGraphData{} }, StatisticalGraphAsyncTypeID: func() bin.Object { return &StatisticalGraphAsync{} }, StatisticalGraphErrorTypeID: func() bin.Object { return &StatisticalGraphError{} }, - ChatStatisticsMessageInteractionInfoTypeID: func() bin.Object { return &ChatStatisticsMessageInteractionInfo{} }, + ChatStatisticsObjectTypeMessageTypeID: func() bin.Object { return &ChatStatisticsObjectTypeMessage{} }, + ChatStatisticsObjectTypeStoryTypeID: func() bin.Object { return &ChatStatisticsObjectTypeStory{} }, + ChatStatisticsInteractionInfoTypeID: func() bin.Object { return &ChatStatisticsInteractionInfo{} }, ChatStatisticsMessageSenderInfoTypeID: func() bin.Object { return &ChatStatisticsMessageSenderInfo{} }, ChatStatisticsAdministratorActionsInfoTypeID: func() bin.Object { return &ChatStatisticsAdministratorActionsInfo{} }, ChatStatisticsInviterInfoTypeID: func() bin.Object { return &ChatStatisticsInviterInfo{} }, ChatStatisticsSupergroupTypeID: func() bin.Object { return &ChatStatisticsSupergroup{} }, ChatStatisticsChannelTypeID: func() bin.Object { return &ChatStatisticsChannel{} }, MessageStatisticsTypeID: func() bin.Object { return &MessageStatistics{} }, + StoryStatisticsTypeID: func() bin.Object { return &StoryStatistics{} }, PointTypeID: func() bin.Object { return &Point{} }, VectorPathCommandLineTypeID: func() bin.Object { return &VectorPathCommandLine{} }, VectorPathCommandCubicBezierCurveTypeID: func() bin.Object { return &VectorPathCommandCubicBezierCurve{} }, @@ -5263,6 +5337,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UpdateChatHasProtectedContentTypeID: func() bin.Object { return &UpdateChatHasProtectedContent{} }, UpdateChatIsTranslatableTypeID: func() bin.Object { return &UpdateChatIsTranslatable{} }, UpdateChatIsMarkedAsUnreadTypeID: func() bin.Object { return &UpdateChatIsMarkedAsUnread{} }, + UpdateChatViewAsTopicsTypeID: func() bin.Object { return &UpdateChatViewAsTopics{} }, UpdateChatBlockListTypeID: func() bin.Object { return &UpdateChatBlockList{} }, UpdateChatHasScheduledMessagesTypeID: func() bin.Object { return &UpdateChatHasScheduledMessages{} }, UpdateChatFoldersTypeID: func() bin.Object { return &UpdateChatFolders{} }, @@ -5316,6 +5391,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UpdateSelectedBackgroundTypeID: func() bin.Object { return &UpdateSelectedBackground{} }, UpdateChatThemesTypeID: func() bin.Object { return &UpdateChatThemes{} }, UpdateAccentColorsTypeID: func() bin.Object { return &UpdateAccentColors{} }, + UpdateProfileAccentColorsTypeID: func() bin.Object { return &UpdateProfileAccentColors{} }, UpdateLanguagePackStringsTypeID: func() bin.Object { return &UpdateLanguagePackStrings{} }, UpdateConnectionStateTypeID: func() bin.Object { return &UpdateConnectionState{} }, UpdateTermsOfServiceTypeID: func() bin.Object { return &UpdateTermsOfService{} }, @@ -5325,6 +5401,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UpdateWebAppMessageSentTypeID: func() bin.Object { return &UpdateWebAppMessageSent{} }, UpdateActiveEmojiReactionsTypeID: func() bin.Object { return &UpdateActiveEmojiReactions{} }, UpdateDefaultReactionTypeTypeID: func() bin.Object { return &UpdateDefaultReactionType{} }, + UpdateSpeechRecognitionTrialTypeID: func() bin.Object { return &UpdateSpeechRecognitionTrial{} }, UpdateDiceEmojisTypeID: func() bin.Object { return &UpdateDiceEmojis{} }, UpdateAnimatedEmojiMessageClickedTypeID: func() bin.Object { return &UpdateAnimatedEmojiMessageClicked{} }, UpdateAnimationSearchParametersTypeID: func() bin.Object { return &UpdateAnimationSearchParameters{} }, @@ -5422,6 +5499,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { SearchChatsRequestTypeID: func() bin.Object { return &SearchChatsRequest{} }, SearchChatsOnServerRequestTypeID: func() bin.Object { return &SearchChatsOnServerRequest{} }, SearchChatsNearbyRequestTypeID: func() bin.Object { return &SearchChatsNearbyRequest{} }, + GetChatSimilarChatsRequestTypeID: func() bin.Object { return &GetChatSimilarChatsRequest{} }, + GetChatSimilarChatCountRequestTypeID: func() bin.Object { return &GetChatSimilarChatCountRequest{} }, GetTopChatsRequestTypeID: func() bin.Object { return &GetTopChatsRequest{} }, RemoveTopChatRequestTypeID: func() bin.Object { return &RemoveTopChatRequest{} }, SearchRecentlyFoundChatsRequestTypeID: func() bin.Object { return &SearchRecentlyFoundChatsRequest{} }, @@ -5595,10 +5674,12 @@ func TypesConstructorMap() map[uint32]func() bin.Object { SetChatMessageAutoDeleteTimeRequestTypeID: func() bin.Object { return &SetChatMessageAutoDeleteTimeRequest{} }, SetChatPermissionsRequestTypeID: func() bin.Object { return &SetChatPermissionsRequest{} }, SetChatBackgroundRequestTypeID: func() bin.Object { return &SetChatBackgroundRequest{} }, + DeleteChatBackgroundRequestTypeID: func() bin.Object { return &DeleteChatBackgroundRequest{} }, SetChatThemeRequestTypeID: func() bin.Object { return &SetChatThemeRequest{} }, SetChatDraftMessageRequestTypeID: func() bin.Object { return &SetChatDraftMessageRequest{} }, SetChatNotificationSettingsRequestTypeID: func() bin.Object { return &SetChatNotificationSettingsRequest{} }, ToggleChatHasProtectedContentRequestTypeID: func() bin.Object { return &ToggleChatHasProtectedContentRequest{} }, + ToggleChatViewAsTopicsRequestTypeID: func() bin.Object { return &ToggleChatViewAsTopicsRequest{} }, ToggleChatIsTranslatableRequestTypeID: func() bin.Object { return &ToggleChatIsTranslatableRequest{} }, ToggleChatIsMarkedAsUnreadRequestTypeID: func() bin.Object { return &ToggleChatIsMarkedAsUnreadRequest{} }, ToggleChatDefaultDisableNotificationRequestTypeID: func() bin.Object { return &ToggleChatDefaultDisableNotificationRequest{} }, @@ -5656,6 +5737,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { GetStoryViewersRequestTypeID: func() bin.Object { return &GetStoryViewersRequest{} }, ReportStoryRequestTypeID: func() bin.Object { return &ReportStoryRequest{} }, ActivateStoryStealthModeRequestTypeID: func() bin.Object { return &ActivateStoryStealthModeRequest{} }, + GetStoryPublicForwardsRequestTypeID: func() bin.Object { return &GetStoryPublicForwardsRequest{} }, GetAvailableChatBoostSlotsRequestTypeID: func() bin.Object { return &GetAvailableChatBoostSlotsRequest{} }, GetChatBoostStatusRequestTypeID: func() bin.Object { return &GetChatBoostStatusRequest{} }, BoostChatRequestTypeID: func() bin.Object { return &BoostChatRequest{} }, @@ -5801,6 +5883,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { SetProfilePhotoRequestTypeID: func() bin.Object { return &SetProfilePhotoRequest{} }, DeleteProfilePhotoRequestTypeID: func() bin.Object { return &DeleteProfilePhotoRequest{} }, SetAccentColorRequestTypeID: func() bin.Object { return &SetAccentColorRequest{} }, + SetProfileAccentColorRequestTypeID: func() bin.Object { return &SetProfileAccentColorRequest{} }, SetNameRequestTypeID: func() bin.Object { return &SetNameRequest{} }, SetBioRequestTypeID: func() bin.Object { return &SetBioRequest{} }, SetUsernameRequestTypeID: func() bin.Object { return &SetUsernameRequest{} }, @@ -5904,6 +5987,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { GetChatStatisticsRequestTypeID: func() bin.Object { return &GetChatStatisticsRequest{} }, GetMessageStatisticsRequestTypeID: func() bin.Object { return &GetMessageStatisticsRequest{} }, GetMessagePublicForwardsRequestTypeID: func() bin.Object { return &GetMessagePublicForwardsRequest{} }, + GetStoryStatisticsRequestTypeID: func() bin.Object { return &GetStoryStatisticsRequest{} }, GetStatisticalGraphRequestTypeID: func() bin.Object { return &GetStatisticalGraphRequest{} }, GetStorageStatisticsRequestTypeID: func() bin.Object { return &GetStorageStatisticsRequest{} }, GetStorageStatisticsFastRequestTypeID: func() bin.Object { return &GetStorageStatisticsFastRequest{} }, @@ -6248,6 +6332,10 @@ func ClassConstructorsMap() map[string][]uint32 { ChatStatisticsSupergroupTypeID, ChatStatisticsChannelTypeID, }, + ChatStatisticsObjectTypeClassName: { + ChatStatisticsObjectTypeMessageTypeID, + ChatStatisticsObjectTypeStoryTypeID, + }, ChatTypeClassName: { ChatTypePrivateTypeID, ChatTypeBasicGroupTypeID, @@ -6608,6 +6696,7 @@ func ClassConstructorsMap() map[string][]uint32 { MessagePremiumGiftCodeTypeID, MessagePremiumGiveawayCreatedTypeID, MessagePremiumGiveawayTypeID, + MessagePremiumGiveawayCompletedTypeID, MessageContactRegisteredTypeID, MessageUserSharedTypeID, MessageChatSharedTypeID, @@ -6670,6 +6759,7 @@ func ClassConstructorsMap() map[string][]uint32 { }, MessageSponsorTypeClassName: { MessageSponsorTypeBotTypeID, + MessageSponsorTypeWebAppTypeID, MessageSponsorTypePublicChannelTypeID, MessageSponsorTypePrivateChannelTypeID, MessageSponsorTypeWebsiteTypeID, @@ -6818,6 +6908,7 @@ func ClassConstructorsMap() map[string][]uint32 { PremiumFeatureUpgradedStoriesTypeID, PremiumFeatureChatBoostTypeID, PremiumFeatureAccentColorTypeID, + PremiumFeatureBackgroundForBothTypeID, }, PremiumGiveawayInfoClassName: { PremiumGiveawayInfoOngoingTypeID, @@ -6848,6 +6939,7 @@ func ClassConstructorsMap() map[string][]uint32 { PremiumLimitTypeMonthlySentStoryCountTypeID, PremiumLimitTypeStoryCaptionLengthTypeID, PremiumLimitTypeStorySuggestedReactionAreaCountTypeID, + PremiumLimitTypeSimilarChatCountTypeID, }, PremiumSourceClassName: { PremiumSourceLimitExceededTypeID, @@ -7043,12 +7135,20 @@ func ClassConstructorsMap() map[string][]uint32 { StoryListMainTypeID, StoryListArchiveTypeID, }, + StoryOriginClassName: { + StoryOriginPublicStoryTypeID, + StoryOriginHiddenUserTypeID, + }, StoryPrivacySettingsClassName: { StoryPrivacySettingsEveryoneTypeID, StoryPrivacySettingsContactsTypeID, StoryPrivacySettingsCloseFriendsTypeID, StoryPrivacySettingsSelectedUsersTypeID, }, + StoryPublicForwardClassName: { + StoryPublicForwardMessageTypeID, + StoryPublicForwardStoryTypeID, + }, SuggestedActionClassName: { SuggestedActionEnableArchiveAndMuteNewChatsTypeID, SuggestedActionCheckPasswordTypeID, @@ -7171,6 +7271,7 @@ func ClassConstructorsMap() map[string][]uint32 { UpdateChatHasProtectedContentTypeID, UpdateChatIsTranslatableTypeID, UpdateChatIsMarkedAsUnreadTypeID, + UpdateChatViewAsTopicsTypeID, UpdateChatBlockListTypeID, UpdateChatHasScheduledMessagesTypeID, UpdateChatFoldersTypeID, @@ -7224,6 +7325,7 @@ func ClassConstructorsMap() map[string][]uint32 { UpdateSelectedBackgroundTypeID, UpdateChatThemesTypeID, UpdateAccentColorsTypeID, + UpdateProfileAccentColorsTypeID, UpdateLanguagePackStringsTypeID, UpdateConnectionStateTypeID, UpdateTermsOfServiceTypeID, @@ -7233,6 +7335,7 @@ func ClassConstructorsMap() map[string][]uint32 { UpdateWebAppMessageSentTypeID, UpdateActiveEmojiReactionsTypeID, UpdateDefaultReactionTypeTypeID, + UpdateSpeechRecognitionTrialTypeID, UpdateDiceEmojisTypeID, UpdateAnimatedEmojiMessageClickedTypeID, UpdateAnimationSearchParametersTypeID, diff --git a/tdapi/tl_resend_messages_gen.go b/tdapi/tl_resend_messages_gen.go index dbca843686..00505c9451 100644 --- a/tdapi/tl_resend_messages_gen.go +++ b/tdapi/tl_resend_messages_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// ResendMessagesRequest represents TL type `resendMessages#4a0c68af`. +// ResendMessagesRequest represents TL type `resendMessages#90e36776`. type ResendMessagesRequest struct { // Identifier of the chat to send messages ChatID int64 @@ -41,11 +41,11 @@ type ResendMessagesRequest struct { // New manually chosen quote from the message to be replied; pass null if none. Ignored // if more than one message is re-sent, or if messageSendingStateFailed // need_another_reply_quote == false - Quote FormattedText + Quote InputTextQuote } // ResendMessagesRequestTypeID is TL type id of ResendMessagesRequest. -const ResendMessagesRequestTypeID = 0x4a0c68af +const ResendMessagesRequestTypeID = 0x90e36776 // Ensuring interfaces in compile-time for ResendMessagesRequest. var ( @@ -123,7 +123,7 @@ func (r *ResendMessagesRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (r *ResendMessagesRequest) Encode(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't encode resendMessages#4a0c68af as nil") + return fmt.Errorf("can't encode resendMessages#90e36776 as nil") } b.PutID(ResendMessagesRequestTypeID) return r.EncodeBare(b) @@ -132,7 +132,7 @@ func (r *ResendMessagesRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (r *ResendMessagesRequest) EncodeBare(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't encode resendMessages#4a0c68af as nil") + return fmt.Errorf("can't encode resendMessages#90e36776 as nil") } b.PutInt53(r.ChatID) b.PutInt(len(r.MessageIDs)) @@ -140,7 +140,7 @@ func (r *ResendMessagesRequest) EncodeBare(b *bin.Buffer) error { b.PutInt53(v) } if err := r.Quote.Encode(b); err != nil { - return fmt.Errorf("unable to encode resendMessages#4a0c68af: field quote: %w", err) + return fmt.Errorf("unable to encode resendMessages#90e36776: field quote: %w", err) } return nil } @@ -148,10 +148,10 @@ func (r *ResendMessagesRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (r *ResendMessagesRequest) Decode(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't decode resendMessages#4a0c68af to nil") + return fmt.Errorf("can't decode resendMessages#90e36776 to nil") } if err := b.ConsumeID(ResendMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode resendMessages#4a0c68af: %w", err) + return fmt.Errorf("unable to decode resendMessages#90e36776: %w", err) } return r.DecodeBare(b) } @@ -159,19 +159,19 @@ func (r *ResendMessagesRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (r *ResendMessagesRequest) DecodeBare(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't decode resendMessages#4a0c68af to nil") + return fmt.Errorf("can't decode resendMessages#90e36776 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode resendMessages#4a0c68af: field chat_id: %w", err) + return fmt.Errorf("unable to decode resendMessages#90e36776: field chat_id: %w", err) } r.ChatID = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode resendMessages#4a0c68af: field message_ids: %w", err) + return fmt.Errorf("unable to decode resendMessages#90e36776: field message_ids: %w", err) } if headerLen > 0 { @@ -180,14 +180,14 @@ func (r *ResendMessagesRequest) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode resendMessages#4a0c68af: field message_ids: %w", err) + return fmt.Errorf("unable to decode resendMessages#90e36776: field message_ids: %w", err) } r.MessageIDs = append(r.MessageIDs, value) } } { if err := r.Quote.Decode(b); err != nil { - return fmt.Errorf("unable to decode resendMessages#4a0c68af: field quote: %w", err) + return fmt.Errorf("unable to decode resendMessages#90e36776: field quote: %w", err) } } return nil @@ -196,7 +196,7 @@ func (r *ResendMessagesRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (r *ResendMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if r == nil { - return fmt.Errorf("can't encode resendMessages#4a0c68af as nil") + return fmt.Errorf("can't encode resendMessages#90e36776 as nil") } b.ObjStart() b.PutID("resendMessages") @@ -215,7 +215,7 @@ func (r *ResendMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("quote") if err := r.Quote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode resendMessages#4a0c68af: field quote: %w", err) + return fmt.Errorf("unable to encode resendMessages#90e36776: field quote: %w", err) } b.Comma() b.StripComma() @@ -226,35 +226,35 @@ func (r *ResendMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (r *ResendMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if r == nil { - return fmt.Errorf("can't decode resendMessages#4a0c68af to nil") + return fmt.Errorf("can't decode resendMessages#90e36776 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("resendMessages"); err != nil { - return fmt.Errorf("unable to decode resendMessages#4a0c68af: %w", err) + return fmt.Errorf("unable to decode resendMessages#90e36776: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode resendMessages#4a0c68af: field chat_id: %w", err) + return fmt.Errorf("unable to decode resendMessages#90e36776: field chat_id: %w", err) } r.ChatID = value case "message_ids": if err := b.Arr(func(b tdjson.Decoder) error { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode resendMessages#4a0c68af: field message_ids: %w", err) + return fmt.Errorf("unable to decode resendMessages#90e36776: field message_ids: %w", err) } r.MessageIDs = append(r.MessageIDs, value) return nil }); err != nil { - return fmt.Errorf("unable to decode resendMessages#4a0c68af: field message_ids: %w", err) + return fmt.Errorf("unable to decode resendMessages#90e36776: field message_ids: %w", err) } case "quote": if err := r.Quote.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode resendMessages#4a0c68af: field quote: %w", err) + return fmt.Errorf("unable to decode resendMessages#90e36776: field quote: %w", err) } default: return b.Skip() @@ -280,14 +280,14 @@ func (r *ResendMessagesRequest) GetMessageIDs() (value []int64) { } // GetQuote returns value of Quote field. -func (r *ResendMessagesRequest) GetQuote() (value FormattedText) { +func (r *ResendMessagesRequest) GetQuote() (value InputTextQuote) { if r == nil { return } return r.Quote } -// ResendMessages invokes method resendMessages#4a0c68af returning error if any. +// ResendMessages invokes method resendMessages#90e36776 returning error if any. func (c *Client) ResendMessages(ctx context.Context, request *ResendMessagesRequest) (*Messages, error) { var result Messages diff --git a/tdapi/tl_scope_notification_settings_gen.go b/tdapi/tl_scope_notification_settings_gen.go index 112f2fd697..b91c7d033a 100644 --- a/tdapi/tl_scope_notification_settings_gen.go +++ b/tdapi/tl_scope_notification_settings_gen.go @@ -39,10 +39,10 @@ type ScopeNotificationSettings struct { SoundID int64 // True, if message content must be displayed in notifications ShowPreview bool - // If true, mute_stories is ignored and story notifications are received only for the - // first 5 chats from topChatCategoryUsers + // If true, story notifications are received only for the first 5 chats from + // topChatCategoryUsers regardless of the value of mute_stories UseDefaultMuteStories bool - // True, if story notifications are disabled for the chat + // True, if story notifications are disabled MuteStories bool // Identifier of the notification sound to be played for stories; 0 if sound is disabled StorySoundID int64 diff --git a/tdapi/tl_search_sticker_sets_gen.go b/tdapi/tl_search_sticker_sets_gen.go index cf2e89215a..0823e42077 100644 --- a/tdapi/tl_search_sticker_sets_gen.go +++ b/tdapi/tl_search_sticker_sets_gen.go @@ -31,14 +31,16 @@ var ( _ = tdjson.Encoder{} ) -// SearchStickerSetsRequest represents TL type `searchStickerSets#bf7d307b`. +// SearchStickerSetsRequest represents TL type `searchStickerSets#faa066c`. type SearchStickerSetsRequest struct { + // Type of the sticker sets to return + StickerType StickerTypeClass // Query to search for Query string } // SearchStickerSetsRequestTypeID is TL type id of SearchStickerSetsRequest. -const SearchStickerSetsRequestTypeID = 0xbf7d307b +const SearchStickerSetsRequestTypeID = 0xfaa066c // Ensuring interfaces in compile-time for SearchStickerSetsRequest. var ( @@ -52,6 +54,9 @@ func (s *SearchStickerSetsRequest) Zero() bool { if s == nil { return true } + if !(s.StickerType == nil) { + return false + } if !(s.Query == "") { return false } @@ -91,6 +96,10 @@ func (s *SearchStickerSetsRequest) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "StickerType", + SchemaName: "sticker_type", + }, { Name: "Query", SchemaName: "query", @@ -102,7 +111,7 @@ func (s *SearchStickerSetsRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *SearchStickerSetsRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode searchStickerSets#bf7d307b as nil") + return fmt.Errorf("can't encode searchStickerSets#faa066c as nil") } b.PutID(SearchStickerSetsRequestTypeID) return s.EncodeBare(b) @@ -111,7 +120,13 @@ func (s *SearchStickerSetsRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *SearchStickerSetsRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode searchStickerSets#bf7d307b as nil") + return fmt.Errorf("can't encode searchStickerSets#faa066c as nil") + } + if s.StickerType == nil { + return fmt.Errorf("unable to encode searchStickerSets#faa066c: field sticker_type is nil") + } + if err := s.StickerType.Encode(b); err != nil { + return fmt.Errorf("unable to encode searchStickerSets#faa066c: field sticker_type: %w", err) } b.PutString(s.Query) return nil @@ -120,10 +135,10 @@ func (s *SearchStickerSetsRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *SearchStickerSetsRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode searchStickerSets#bf7d307b to nil") + return fmt.Errorf("can't decode searchStickerSets#faa066c to nil") } if err := b.ConsumeID(SearchStickerSetsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchStickerSets#bf7d307b: %w", err) + return fmt.Errorf("unable to decode searchStickerSets#faa066c: %w", err) } return s.DecodeBare(b) } @@ -131,12 +146,19 @@ func (s *SearchStickerSetsRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *SearchStickerSetsRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode searchStickerSets#bf7d307b to nil") + return fmt.Errorf("can't decode searchStickerSets#faa066c to nil") + } + { + value, err := DecodeStickerType(b) + if err != nil { + return fmt.Errorf("unable to decode searchStickerSets#faa066c: field sticker_type: %w", err) + } + s.StickerType = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode searchStickerSets#bf7d307b: field query: %w", err) + return fmt.Errorf("unable to decode searchStickerSets#faa066c: field query: %w", err) } s.Query = value } @@ -146,11 +168,19 @@ func (s *SearchStickerSetsRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *SearchStickerSetsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode searchStickerSets#bf7d307b as nil") + return fmt.Errorf("can't encode searchStickerSets#faa066c as nil") } b.ObjStart() b.PutID("searchStickerSets") b.Comma() + b.FieldStart("sticker_type") + if s.StickerType == nil { + return fmt.Errorf("unable to encode searchStickerSets#faa066c: field sticker_type is nil") + } + if err := s.StickerType.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode searchStickerSets#faa066c: field sticker_type: %w", err) + } + b.Comma() b.FieldStart("query") b.PutString(s.Query) b.Comma() @@ -162,19 +192,25 @@ func (s *SearchStickerSetsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *SearchStickerSetsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode searchStickerSets#bf7d307b to nil") + return fmt.Errorf("can't decode searchStickerSets#faa066c to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("searchStickerSets"); err != nil { - return fmt.Errorf("unable to decode searchStickerSets#bf7d307b: %w", err) + return fmt.Errorf("unable to decode searchStickerSets#faa066c: %w", err) } + case "sticker_type": + value, err := DecodeTDLibJSONStickerType(b) + if err != nil { + return fmt.Errorf("unable to decode searchStickerSets#faa066c: field sticker_type: %w", err) + } + s.StickerType = value case "query": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode searchStickerSets#bf7d307b: field query: %w", err) + return fmt.Errorf("unable to decode searchStickerSets#faa066c: field query: %w", err) } s.Query = value default: @@ -184,6 +220,14 @@ func (s *SearchStickerSetsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { }) } +// GetStickerType returns value of StickerType field. +func (s *SearchStickerSetsRequest) GetStickerType() (value StickerTypeClass) { + if s == nil { + return + } + return s.StickerType +} + // GetQuery returns value of Query field. func (s *SearchStickerSetsRequest) GetQuery() (value string) { if s == nil { @@ -192,13 +236,10 @@ func (s *SearchStickerSetsRequest) GetQuery() (value string) { return s.Query } -// SearchStickerSets invokes method searchStickerSets#bf7d307b returning error if any. -func (c *Client) SearchStickerSets(ctx context.Context, query string) (*StickerSets, error) { +// SearchStickerSets invokes method searchStickerSets#faa066c returning error if any. +func (c *Client) SearchStickerSets(ctx context.Context, request *SearchStickerSetsRequest) (*StickerSets, error) { var result StickerSets - request := &SearchStickerSetsRequest{ - Query: query, - } if err := c.rpc.Invoke(ctx, request, &result); err != nil { return nil, err } diff --git a/tdapi/tl_send_story_gen.go b/tdapi/tl_send_story_gen.go index be97b98e8c..6de81bf1f8 100644 --- a/tdapi/tl_send_story_gen.go +++ b/tdapi/tl_send_story_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// SendStoryRequest represents TL type `sendStory#53242a4`. +// SendStoryRequest represents TL type `sendStory#736858bb`. type SendStoryRequest struct { // Identifier of the chat that will post the story ChatID int64 @@ -47,6 +47,8 @@ type SendStoryRequest struct { // 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 ActivePeriod int32 + // Full identifier of the original story, which content was used to create the story + FromStoryFullID StoryFullID // Pass true to keep the story accessible after expiration IsPinned bool // Pass true if the content of the story must be protected from forwarding and @@ -55,7 +57,7 @@ type SendStoryRequest struct { } // SendStoryRequestTypeID is TL type id of SendStoryRequest. -const SendStoryRequestTypeID = 0x53242a4 +const SendStoryRequestTypeID = 0x736858bb // Ensuring interfaces in compile-time for SendStoryRequest. var ( @@ -87,6 +89,9 @@ func (s *SendStoryRequest) Zero() bool { if !(s.ActivePeriod == 0) { return false } + if !(s.FromStoryFullID.Zero()) { + return false + } if !(s.IsPinned == false) { return false } @@ -153,6 +158,10 @@ func (s *SendStoryRequest) TypeInfo() tdp.Type { Name: "ActivePeriod", SchemaName: "active_period", }, + { + Name: "FromStoryFullID", + SchemaName: "from_story_full_id", + }, { Name: "IsPinned", SchemaName: "is_pinned", @@ -168,7 +177,7 @@ func (s *SendStoryRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *SendStoryRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode sendStory#53242a4 as nil") + return fmt.Errorf("can't encode sendStory#736858bb as nil") } b.PutID(SendStoryRequestTypeID) return s.EncodeBare(b) @@ -177,28 +186,31 @@ func (s *SendStoryRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *SendStoryRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode sendStory#53242a4 as nil") + return fmt.Errorf("can't encode sendStory#736858bb as nil") } b.PutInt53(s.ChatID) if s.Content == nil { - return fmt.Errorf("unable to encode sendStory#53242a4: field content is nil") + return fmt.Errorf("unable to encode sendStory#736858bb: field content is nil") } if err := s.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendStory#53242a4: field content: %w", err) + return fmt.Errorf("unable to encode sendStory#736858bb: field content: %w", err) } if err := s.Areas.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendStory#53242a4: field areas: %w", err) + return fmt.Errorf("unable to encode sendStory#736858bb: field areas: %w", err) } if err := s.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendStory#53242a4: field caption: %w", err) + return fmt.Errorf("unable to encode sendStory#736858bb: field caption: %w", err) } if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode sendStory#53242a4: field privacy_settings is nil") + return fmt.Errorf("unable to encode sendStory#736858bb: field privacy_settings is nil") } if err := s.PrivacySettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendStory#53242a4: field privacy_settings: %w", err) + return fmt.Errorf("unable to encode sendStory#736858bb: field privacy_settings: %w", err) } b.PutInt32(s.ActivePeriod) + if err := s.FromStoryFullID.Encode(b); err != nil { + return fmt.Errorf("unable to encode sendStory#736858bb: field from_story_full_id: %w", err) + } b.PutBool(s.IsPinned) b.PutBool(s.ProtectContent) return nil @@ -207,10 +219,10 @@ func (s *SendStoryRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *SendStoryRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode sendStory#53242a4 to nil") + return fmt.Errorf("can't decode sendStory#736858bb to nil") } if err := b.ConsumeID(SendStoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendStory#53242a4: %w", err) + return fmt.Errorf("unable to decode sendStory#736858bb: %w", err) } return s.DecodeBare(b) } @@ -218,57 +230,62 @@ func (s *SendStoryRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *SendStoryRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode sendStory#53242a4 to nil") + return fmt.Errorf("can't decode sendStory#736858bb to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode sendStory#53242a4: field chat_id: %w", err) + return fmt.Errorf("unable to decode sendStory#736858bb: field chat_id: %w", err) } s.ChatID = value } { value, err := DecodeInputStoryContent(b) if err != nil { - return fmt.Errorf("unable to decode sendStory#53242a4: field content: %w", err) + return fmt.Errorf("unable to decode sendStory#736858bb: field content: %w", err) } s.Content = value } { if err := s.Areas.Decode(b); err != nil { - return fmt.Errorf("unable to decode sendStory#53242a4: field areas: %w", err) + return fmt.Errorf("unable to decode sendStory#736858bb: field areas: %w", err) } } { if err := s.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode sendStory#53242a4: field caption: %w", err) + return fmt.Errorf("unable to decode sendStory#736858bb: field caption: %w", err) } } { value, err := DecodeStoryPrivacySettings(b) if err != nil { - return fmt.Errorf("unable to decode sendStory#53242a4: field privacy_settings: %w", err) + return fmt.Errorf("unable to decode sendStory#736858bb: field privacy_settings: %w", err) } s.PrivacySettings = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode sendStory#53242a4: field active_period: %w", err) + return fmt.Errorf("unable to decode sendStory#736858bb: field active_period: %w", err) } s.ActivePeriod = value } + { + if err := s.FromStoryFullID.Decode(b); err != nil { + return fmt.Errorf("unable to decode sendStory#736858bb: field from_story_full_id: %w", err) + } + } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode sendStory#53242a4: field is_pinned: %w", err) + return fmt.Errorf("unable to decode sendStory#736858bb: field is_pinned: %w", err) } s.IsPinned = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode sendStory#53242a4: field protect_content: %w", err) + return fmt.Errorf("unable to decode sendStory#736858bb: field protect_content: %w", err) } s.ProtectContent = value } @@ -278,7 +295,7 @@ func (s *SendStoryRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *SendStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode sendStory#53242a4 as nil") + return fmt.Errorf("can't encode sendStory#736858bb as nil") } b.ObjStart() b.PutID("sendStory") @@ -288,33 +305,38 @@ func (s *SendStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("content") if s.Content == nil { - return fmt.Errorf("unable to encode sendStory#53242a4: field content is nil") + return fmt.Errorf("unable to encode sendStory#736858bb: field content is nil") } if err := s.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendStory#53242a4: field content: %w", err) + return fmt.Errorf("unable to encode sendStory#736858bb: field content: %w", err) } b.Comma() b.FieldStart("areas") if err := s.Areas.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendStory#53242a4: field areas: %w", err) + return fmt.Errorf("unable to encode sendStory#736858bb: field areas: %w", err) } b.Comma() b.FieldStart("caption") if err := s.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendStory#53242a4: field caption: %w", err) + return fmt.Errorf("unable to encode sendStory#736858bb: field caption: %w", err) } b.Comma() b.FieldStart("privacy_settings") if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode sendStory#53242a4: field privacy_settings is nil") + return fmt.Errorf("unable to encode sendStory#736858bb: field privacy_settings is nil") } if err := s.PrivacySettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendStory#53242a4: field privacy_settings: %w", err) + return fmt.Errorf("unable to encode sendStory#736858bb: field privacy_settings: %w", err) } b.Comma() b.FieldStart("active_period") b.PutInt32(s.ActivePeriod) b.Comma() + b.FieldStart("from_story_full_id") + if err := s.FromStoryFullID.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode sendStory#736858bb: field from_story_full_id: %w", err) + } + b.Comma() b.FieldStart("is_pinned") b.PutBool(s.IsPinned) b.Comma() @@ -329,57 +351,61 @@ func (s *SendStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *SendStoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode sendStory#53242a4 to nil") + return fmt.Errorf("can't decode sendStory#736858bb to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("sendStory"); err != nil { - return fmt.Errorf("unable to decode sendStory#53242a4: %w", err) + return fmt.Errorf("unable to decode sendStory#736858bb: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode sendStory#53242a4: field chat_id: %w", err) + return fmt.Errorf("unable to decode sendStory#736858bb: field chat_id: %w", err) } s.ChatID = value case "content": value, err := DecodeTDLibJSONInputStoryContent(b) if err != nil { - return fmt.Errorf("unable to decode sendStory#53242a4: field content: %w", err) + return fmt.Errorf("unable to decode sendStory#736858bb: field content: %w", err) } s.Content = value case "areas": if err := s.Areas.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sendStory#53242a4: field areas: %w", err) + return fmt.Errorf("unable to decode sendStory#736858bb: field areas: %w", err) } case "caption": if err := s.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sendStory#53242a4: field caption: %w", err) + return fmt.Errorf("unable to decode sendStory#736858bb: field caption: %w", err) } case "privacy_settings": value, err := DecodeTDLibJSONStoryPrivacySettings(b) if err != nil { - return fmt.Errorf("unable to decode sendStory#53242a4: field privacy_settings: %w", err) + return fmt.Errorf("unable to decode sendStory#736858bb: field privacy_settings: %w", err) } s.PrivacySettings = value case "active_period": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode sendStory#53242a4: field active_period: %w", err) + return fmt.Errorf("unable to decode sendStory#736858bb: field active_period: %w", err) } s.ActivePeriod = value + case "from_story_full_id": + if err := s.FromStoryFullID.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode sendStory#736858bb: field from_story_full_id: %w", err) + } case "is_pinned": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode sendStory#53242a4: field is_pinned: %w", err) + return fmt.Errorf("unable to decode sendStory#736858bb: field is_pinned: %w", err) } s.IsPinned = value case "protect_content": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode sendStory#53242a4: field protect_content: %w", err) + return fmt.Errorf("unable to decode sendStory#736858bb: field protect_content: %w", err) } s.ProtectContent = value default: @@ -437,6 +463,14 @@ func (s *SendStoryRequest) GetActivePeriod() (value int32) { return s.ActivePeriod } +// GetFromStoryFullID returns value of FromStoryFullID field. +func (s *SendStoryRequest) GetFromStoryFullID() (value StoryFullID) { + if s == nil { + return + } + return s.FromStoryFullID +} + // GetIsPinned returns value of IsPinned field. func (s *SendStoryRequest) GetIsPinned() (value bool) { if s == nil { @@ -453,7 +487,7 @@ func (s *SendStoryRequest) GetProtectContent() (value bool) { return s.ProtectContent } -// SendStory invokes method sendStory#53242a4 returning error if any. +// SendStory invokes method sendStory#736858bb returning error if any. func (c *Client) SendStory(ctx context.Context, request *SendStoryRequest) (*Story, error) { var result Story diff --git a/tdapi/tl_set_chat_available_reactions_gen.go b/tdapi/tl_set_chat_available_reactions_gen.go index 3484932a0b..8aa646d13c 100644 --- a/tdapi/tl_set_chat_available_reactions_gen.go +++ b/tdapi/tl_set_chat_available_reactions_gen.go @@ -35,7 +35,9 @@ var ( type SetChatAvailableReactionsRequest struct { // Identifier of the chat ChatID int64 - // Reactions available in the chat. All emoji reactions must be active + // 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 AvailableReactions ChatAvailableReactionsClass } diff --git a/tdapi/tl_set_chat_background_gen.go b/tdapi/tl_set_chat_background_gen.go index ae3451722d..eab3a594c5 100644 --- a/tdapi/tl_set_chat_background_gen.go +++ b/tdapi/tl_set_chat_background_gen.go @@ -31,21 +31,24 @@ var ( _ = tdjson.Encoder{} ) -// SetChatBackgroundRequest represents TL type `setChatBackground#3d3f1b28`. +// SetChatBackgroundRequest represents TL type `setChatBackground#eb4c3fe`. type SetChatBackgroundRequest struct { // Chat identifier ChatID int64 - // The input background to use; pass null to create a new filled background or to remove - // the current background + // The input background to use; pass null to create a new filled background Background InputBackgroundClass - // Background type; pass null to remove the current background + // Background type; pass null to use default background type for the chosen background Type BackgroundTypeClass // Dimming of the background in dark themes, as a percentage; 0-100 DarkThemeDimming int32 + // Pass true to set background only for self; pass false to set background for both chat + // users. Background can be set for both users only by Telegram Premium users and if set + // background isn't of the type inputBackgroundPrevious + OnlyForSelf bool } // SetChatBackgroundRequestTypeID is TL type id of SetChatBackgroundRequest. -const SetChatBackgroundRequestTypeID = 0x3d3f1b28 +const SetChatBackgroundRequestTypeID = 0xeb4c3fe // Ensuring interfaces in compile-time for SetChatBackgroundRequest. var ( @@ -71,6 +74,9 @@ func (s *SetChatBackgroundRequest) Zero() bool { if !(s.DarkThemeDimming == 0) { return false } + if !(s.OnlyForSelf == false) { + return false + } return true } @@ -123,6 +129,10 @@ func (s *SetChatBackgroundRequest) TypeInfo() tdp.Type { Name: "DarkThemeDimming", SchemaName: "dark_theme_dimming", }, + { + Name: "OnlyForSelf", + SchemaName: "only_for_self", + }, } return typ } @@ -130,7 +140,7 @@ func (s *SetChatBackgroundRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *SetChatBackgroundRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode setChatBackground#3d3f1b28 as nil") + return fmt.Errorf("can't encode setChatBackground#eb4c3fe as nil") } b.PutID(SetChatBackgroundRequestTypeID) return s.EncodeBare(b) @@ -139,32 +149,33 @@ func (s *SetChatBackgroundRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *SetChatBackgroundRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode setChatBackground#3d3f1b28 as nil") + return fmt.Errorf("can't encode setChatBackground#eb4c3fe as nil") } b.PutInt53(s.ChatID) if s.Background == nil { - return fmt.Errorf("unable to encode setChatBackground#3d3f1b28: field background is nil") + return fmt.Errorf("unable to encode setChatBackground#eb4c3fe: field background is nil") } if err := s.Background.Encode(b); err != nil { - return fmt.Errorf("unable to encode setChatBackground#3d3f1b28: field background: %w", err) + return fmt.Errorf("unable to encode setChatBackground#eb4c3fe: field background: %w", err) } if s.Type == nil { - return fmt.Errorf("unable to encode setChatBackground#3d3f1b28: field type is nil") + return fmt.Errorf("unable to encode setChatBackground#eb4c3fe: field type is nil") } if err := s.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode setChatBackground#3d3f1b28: field type: %w", err) + return fmt.Errorf("unable to encode setChatBackground#eb4c3fe: field type: %w", err) } b.PutInt32(s.DarkThemeDimming) + b.PutBool(s.OnlyForSelf) return nil } // Decode implements bin.Decoder. func (s *SetChatBackgroundRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode setChatBackground#3d3f1b28 to nil") + return fmt.Errorf("can't decode setChatBackground#eb4c3fe to nil") } if err := b.ConsumeID(SetChatBackgroundRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatBackground#3d3f1b28: %w", err) + return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: %w", err) } return s.DecodeBare(b) } @@ -172,43 +183,50 @@ func (s *SetChatBackgroundRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *SetChatBackgroundRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode setChatBackground#3d3f1b28 to nil") + return fmt.Errorf("can't decode setChatBackground#eb4c3fe to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode setChatBackground#3d3f1b28: field chat_id: %w", err) + return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: field chat_id: %w", err) } s.ChatID = value } { value, err := DecodeInputBackground(b) if err != nil { - return fmt.Errorf("unable to decode setChatBackground#3d3f1b28: field background: %w", err) + return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: field background: %w", err) } s.Background = value } { value, err := DecodeBackgroundType(b) if err != nil { - return fmt.Errorf("unable to decode setChatBackground#3d3f1b28: field type: %w", err) + return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: field type: %w", err) } s.Type = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode setChatBackground#3d3f1b28: field dark_theme_dimming: %w", err) + return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: field dark_theme_dimming: %w", err) } s.DarkThemeDimming = value } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: field only_for_self: %w", err) + } + s.OnlyForSelf = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *SetChatBackgroundRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode setChatBackground#3d3f1b28 as nil") + return fmt.Errorf("can't encode setChatBackground#eb4c3fe as nil") } b.ObjStart() b.PutID("setChatBackground") @@ -218,23 +236,26 @@ func (s *SetChatBackgroundRequest) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("background") if s.Background == nil { - return fmt.Errorf("unable to encode setChatBackground#3d3f1b28: field background is nil") + return fmt.Errorf("unable to encode setChatBackground#eb4c3fe: field background is nil") } if err := s.Background.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setChatBackground#3d3f1b28: field background: %w", err) + return fmt.Errorf("unable to encode setChatBackground#eb4c3fe: field background: %w", err) } b.Comma() b.FieldStart("type") if s.Type == nil { - return fmt.Errorf("unable to encode setChatBackground#3d3f1b28: field type is nil") + return fmt.Errorf("unable to encode setChatBackground#eb4c3fe: field type is nil") } if err := s.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setChatBackground#3d3f1b28: field type: %w", err) + return fmt.Errorf("unable to encode setChatBackground#eb4c3fe: field type: %w", err) } b.Comma() b.FieldStart("dark_theme_dimming") b.PutInt32(s.DarkThemeDimming) b.Comma() + b.FieldStart("only_for_self") + b.PutBool(s.OnlyForSelf) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -243,39 +264,45 @@ func (s *SetChatBackgroundRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *SetChatBackgroundRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode setChatBackground#3d3f1b28 to nil") + return fmt.Errorf("can't decode setChatBackground#eb4c3fe to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("setChatBackground"); err != nil { - return fmt.Errorf("unable to decode setChatBackground#3d3f1b28: %w", err) + return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode setChatBackground#3d3f1b28: field chat_id: %w", err) + return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: field chat_id: %w", err) } s.ChatID = value case "background": value, err := DecodeTDLibJSONInputBackground(b) if err != nil { - return fmt.Errorf("unable to decode setChatBackground#3d3f1b28: field background: %w", err) + return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: field background: %w", err) } s.Background = value case "type": value, err := DecodeTDLibJSONBackgroundType(b) if err != nil { - return fmt.Errorf("unable to decode setChatBackground#3d3f1b28: field type: %w", err) + return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: field type: %w", err) } s.Type = value case "dark_theme_dimming": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode setChatBackground#3d3f1b28: field dark_theme_dimming: %w", err) + return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: field dark_theme_dimming: %w", err) } s.DarkThemeDimming = value + case "only_for_self": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: field only_for_self: %w", err) + } + s.OnlyForSelf = value default: return b.Skip() } @@ -315,7 +342,15 @@ func (s *SetChatBackgroundRequest) GetDarkThemeDimming() (value int32) { return s.DarkThemeDimming } -// SetChatBackground invokes method setChatBackground#3d3f1b28 returning error if any. +// GetOnlyForSelf returns value of OnlyForSelf field. +func (s *SetChatBackgroundRequest) GetOnlyForSelf() (value bool) { + if s == nil { + return + } + return s.OnlyForSelf +} + +// SetChatBackground invokes method setChatBackground#eb4c3fe returning error if any. func (c *Client) SetChatBackground(ctx context.Context, request *SetChatBackgroundRequest) error { var ok Ok diff --git a/tdapi/tl_set_profile_accent_color_gen.go b/tdapi/tl_set_profile_accent_color_gen.go new file mode 100644 index 0000000000..99bd18a41e --- /dev/null +++ b/tdapi/tl_set_profile_accent_color_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{} +) + +// SetProfileAccentColorRequest represents TL type `setProfileAccentColor#899bc168`. +type SetProfileAccentColorRequest struct { + // Identifier of the accent color to use for profile; pass -1 if none + ProfileAccentColorID int32 + // Identifier of a custom emoji to be shown in the on the user's profile photo + // background; 0 if none + ProfileBackgroundCustomEmojiID int64 +} + +// SetProfileAccentColorRequestTypeID is TL type id of SetProfileAccentColorRequest. +const SetProfileAccentColorRequestTypeID = 0x899bc168 + +// Ensuring interfaces in compile-time for SetProfileAccentColorRequest. +var ( + _ bin.Encoder = &SetProfileAccentColorRequest{} + _ bin.Decoder = &SetProfileAccentColorRequest{} + _ bin.BareEncoder = &SetProfileAccentColorRequest{} + _ bin.BareDecoder = &SetProfileAccentColorRequest{} +) + +func (s *SetProfileAccentColorRequest) Zero() bool { + if s == nil { + return true + } + if !(s.ProfileAccentColorID == 0) { + return false + } + if !(s.ProfileBackgroundCustomEmojiID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SetProfileAccentColorRequest) String() string { + if s == nil { + return "SetProfileAccentColorRequest(nil)" + } + type Alias SetProfileAccentColorRequest + return fmt.Sprintf("SetProfileAccentColorRequest%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SetProfileAccentColorRequest) TypeID() uint32 { + return SetProfileAccentColorRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SetProfileAccentColorRequest) TypeName() string { + return "setProfileAccentColor" +} + +// TypeInfo returns info about TL type. +func (s *SetProfileAccentColorRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "setProfileAccentColor", + ID: SetProfileAccentColorRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ProfileAccentColorID", + SchemaName: "profile_accent_color_id", + }, + { + Name: "ProfileBackgroundCustomEmojiID", + SchemaName: "profile_background_custom_emoji_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SetProfileAccentColorRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setProfileAccentColor#899bc168 as nil") + } + b.PutID(SetProfileAccentColorRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SetProfileAccentColorRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setProfileAccentColor#899bc168 as nil") + } + b.PutInt32(s.ProfileAccentColorID) + b.PutLong(s.ProfileBackgroundCustomEmojiID) + return nil +} + +// Decode implements bin.Decoder. +func (s *SetProfileAccentColorRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setProfileAccentColor#899bc168 to nil") + } + if err := b.ConsumeID(SetProfileAccentColorRequestTypeID); err != nil { + return fmt.Errorf("unable to decode setProfileAccentColor#899bc168: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SetProfileAccentColorRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setProfileAccentColor#899bc168 to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode setProfileAccentColor#899bc168: field profile_accent_color_id: %w", err) + } + s.ProfileAccentColorID = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode setProfileAccentColor#899bc168: field profile_background_custom_emoji_id: %w", err) + } + s.ProfileBackgroundCustomEmojiID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SetProfileAccentColorRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode setProfileAccentColor#899bc168 as nil") + } + b.ObjStart() + b.PutID("setProfileAccentColor") + b.Comma() + b.FieldStart("profile_accent_color_id") + b.PutInt32(s.ProfileAccentColorID) + b.Comma() + b.FieldStart("profile_background_custom_emoji_id") + b.PutLong(s.ProfileBackgroundCustomEmojiID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SetProfileAccentColorRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode setProfileAccentColor#899bc168 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("setProfileAccentColor"); err != nil { + return fmt.Errorf("unable to decode setProfileAccentColor#899bc168: %w", err) + } + case "profile_accent_color_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode setProfileAccentColor#899bc168: field profile_accent_color_id: %w", err) + } + s.ProfileAccentColorID = value + case "profile_background_custom_emoji_id": + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode setProfileAccentColor#899bc168: field profile_background_custom_emoji_id: %w", err) + } + s.ProfileBackgroundCustomEmojiID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetProfileAccentColorID returns value of ProfileAccentColorID field. +func (s *SetProfileAccentColorRequest) GetProfileAccentColorID() (value int32) { + if s == nil { + return + } + return s.ProfileAccentColorID +} + +// GetProfileBackgroundCustomEmojiID returns value of ProfileBackgroundCustomEmojiID field. +func (s *SetProfileAccentColorRequest) GetProfileBackgroundCustomEmojiID() (value int64) { + if s == nil { + return + } + return s.ProfileBackgroundCustomEmojiID +} + +// SetProfileAccentColor invokes method setProfileAccentColor#899bc168 returning error if any. +func (c *Client) SetProfileAccentColor(ctx context.Context, request *SetProfileAccentColorRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_sponsored_message_gen.go b/tdapi/tl_sponsored_message_gen.go index 5f346fa54e..4276c66cd7 100644 --- a/tdapi/tl_sponsored_message_gen.go +++ b/tdapi/tl_sponsored_message_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// SponsoredMessage represents TL type `sponsoredMessage#844f0dc`. +// SponsoredMessage represents TL type `sponsoredMessage#147623b4`. type SponsoredMessage struct { // Message identifier; unique for the chat to which the sponsored message belongs among // both ordinary and sponsored messages @@ -42,13 +42,15 @@ type SponsoredMessage struct { Content MessageContentClass // Information about the sponsor of the message Sponsor MessageSponsor + // If non-empty, text for the message action button + ButtonText string // If non-empty, additional information about the sponsored message to be shown along // with the message AdditionalInfo string } // SponsoredMessageTypeID is TL type id of SponsoredMessage. -const SponsoredMessageTypeID = 0x844f0dc +const SponsoredMessageTypeID = 0x147623b4 // Ensuring interfaces in compile-time for SponsoredMessage. var ( @@ -74,6 +76,9 @@ func (s *SponsoredMessage) Zero() bool { if !(s.Sponsor.Zero()) { return false } + if !(s.ButtonText == "") { + return false + } if !(s.AdditionalInfo == "") { return false } @@ -129,6 +134,10 @@ func (s *SponsoredMessage) TypeInfo() tdp.Type { Name: "Sponsor", SchemaName: "sponsor", }, + { + Name: "ButtonText", + SchemaName: "button_text", + }, { Name: "AdditionalInfo", SchemaName: "additional_info", @@ -140,7 +149,7 @@ func (s *SponsoredMessage) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *SponsoredMessage) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode sponsoredMessage#844f0dc as nil") + return fmt.Errorf("can't encode sponsoredMessage#147623b4 as nil") } b.PutID(SponsoredMessageTypeID) return s.EncodeBare(b) @@ -149,19 +158,20 @@ func (s *SponsoredMessage) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *SponsoredMessage) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode sponsoredMessage#844f0dc as nil") + return fmt.Errorf("can't encode sponsoredMessage#147623b4 as nil") } b.PutInt53(s.MessageID) b.PutBool(s.IsRecommended) if s.Content == nil { - return fmt.Errorf("unable to encode sponsoredMessage#844f0dc: field content is nil") + return fmt.Errorf("unable to encode sponsoredMessage#147623b4: field content is nil") } if err := s.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#844f0dc: field content: %w", err) + return fmt.Errorf("unable to encode sponsoredMessage#147623b4: field content: %w", err) } if err := s.Sponsor.Encode(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#844f0dc: field sponsor: %w", err) + return fmt.Errorf("unable to encode sponsoredMessage#147623b4: field sponsor: %w", err) } + b.PutString(s.ButtonText) b.PutString(s.AdditionalInfo) return nil } @@ -169,10 +179,10 @@ func (s *SponsoredMessage) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *SponsoredMessage) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode sponsoredMessage#844f0dc to nil") + return fmt.Errorf("can't decode sponsoredMessage#147623b4 to nil") } if err := b.ConsumeID(SponsoredMessageTypeID); err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#844f0dc: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#147623b4: %w", err) } return s.DecodeBare(b) } @@ -180,38 +190,45 @@ func (s *SponsoredMessage) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *SponsoredMessage) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode sponsoredMessage#844f0dc to nil") + return fmt.Errorf("can't decode sponsoredMessage#147623b4 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#844f0dc: field message_id: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#147623b4: field message_id: %w", err) } s.MessageID = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#844f0dc: field is_recommended: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#147623b4: field is_recommended: %w", err) } s.IsRecommended = value } { value, err := DecodeMessageContent(b) if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#844f0dc: field content: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#147623b4: field content: %w", err) } s.Content = value } { if err := s.Sponsor.Decode(b); err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#844f0dc: field sponsor: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#147623b4: field sponsor: %w", err) + } + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode sponsoredMessage#147623b4: field button_text: %w", err) } + s.ButtonText = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#844f0dc: field additional_info: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#147623b4: field additional_info: %w", err) } s.AdditionalInfo = value } @@ -221,7 +238,7 @@ func (s *SponsoredMessage) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *SponsoredMessage) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode sponsoredMessage#844f0dc as nil") + return fmt.Errorf("can't encode sponsoredMessage#147623b4 as nil") } b.ObjStart() b.PutID("sponsoredMessage") @@ -234,17 +251,20 @@ func (s *SponsoredMessage) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("content") if s.Content == nil { - return fmt.Errorf("unable to encode sponsoredMessage#844f0dc: field content is nil") + return fmt.Errorf("unable to encode sponsoredMessage#147623b4: field content is nil") } if err := s.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#844f0dc: field content: %w", err) + return fmt.Errorf("unable to encode sponsoredMessage#147623b4: field content: %w", err) } b.Comma() b.FieldStart("sponsor") if err := s.Sponsor.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#844f0dc: field sponsor: %w", err) + return fmt.Errorf("unable to encode sponsoredMessage#147623b4: field sponsor: %w", err) } b.Comma() + b.FieldStart("button_text") + b.PutString(s.ButtonText) + b.Comma() b.FieldStart("additional_info") b.PutString(s.AdditionalInfo) b.Comma() @@ -256,41 +276,47 @@ func (s *SponsoredMessage) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *SponsoredMessage) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode sponsoredMessage#844f0dc to nil") + return fmt.Errorf("can't decode sponsoredMessage#147623b4 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("sponsoredMessage"); err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#844f0dc: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#147623b4: %w", err) } case "message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#844f0dc: field message_id: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#147623b4: field message_id: %w", err) } s.MessageID = value case "is_recommended": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#844f0dc: field is_recommended: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#147623b4: field is_recommended: %w", err) } s.IsRecommended = value case "content": value, err := DecodeTDLibJSONMessageContent(b) if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#844f0dc: field content: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#147623b4: field content: %w", err) } s.Content = value case "sponsor": if err := s.Sponsor.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#844f0dc: field sponsor: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#147623b4: field sponsor: %w", err) } + case "button_text": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode sponsoredMessage#147623b4: field button_text: %w", err) + } + s.ButtonText = value case "additional_info": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#844f0dc: field additional_info: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#147623b4: field additional_info: %w", err) } s.AdditionalInfo = value default: @@ -332,6 +358,14 @@ func (s *SponsoredMessage) GetSponsor() (value MessageSponsor) { return s.Sponsor } +// GetButtonText returns value of ButtonText field. +func (s *SponsoredMessage) GetButtonText() (value string) { + if s == nil { + return + } + return s.ButtonText +} + // GetAdditionalInfo returns value of AdditionalInfo field. func (s *SponsoredMessage) GetAdditionalInfo() (value string) { if s == nil { diff --git a/tdapi/tl_story_full_id_gen.go b/tdapi/tl_story_full_id_gen.go new file mode 100644 index 0000000000..f9be2d646a --- /dev/null +++ b/tdapi/tl_story_full_id_gen.go @@ -0,0 +1,227 @@ +// 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{} +) + +// StoryFullID represents TL type `storyFullId#701d31f5`. +type StoryFullID struct { + // Identifier of the chat that posted the story + SenderChatID int64 + // Unique story identifier among stories of the given sender + StoryID int32 +} + +// StoryFullIDTypeID is TL type id of StoryFullID. +const StoryFullIDTypeID = 0x701d31f5 + +// Ensuring interfaces in compile-time for StoryFullID. +var ( + _ bin.Encoder = &StoryFullID{} + _ bin.Decoder = &StoryFullID{} + _ bin.BareEncoder = &StoryFullID{} + _ bin.BareDecoder = &StoryFullID{} +) + +func (s *StoryFullID) Zero() bool { + if s == nil { + return true + } + if !(s.SenderChatID == 0) { + return false + } + if !(s.StoryID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StoryFullID) String() string { + if s == nil { + return "StoryFullID(nil)" + } + type Alias StoryFullID + return fmt.Sprintf("StoryFullID%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StoryFullID) TypeID() uint32 { + return StoryFullIDTypeID +} + +// TypeName returns name of type in TL schema. +func (*StoryFullID) TypeName() string { + return "storyFullId" +} + +// TypeInfo returns info about TL type. +func (s *StoryFullID) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "storyFullId", + ID: StoryFullIDTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "SenderChatID", + SchemaName: "sender_chat_id", + }, + { + Name: "StoryID", + SchemaName: "story_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StoryFullID) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyFullId#701d31f5 as nil") + } + b.PutID(StoryFullIDTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StoryFullID) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyFullId#701d31f5 as nil") + } + b.PutInt53(s.SenderChatID) + b.PutInt32(s.StoryID) + return nil +} + +// Decode implements bin.Decoder. +func (s *StoryFullID) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyFullId#701d31f5 to nil") + } + if err := b.ConsumeID(StoryFullIDTypeID); err != nil { + return fmt.Errorf("unable to decode storyFullId#701d31f5: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StoryFullID) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyFullId#701d31f5 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode storyFullId#701d31f5: field sender_chat_id: %w", err) + } + s.SenderChatID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode storyFullId#701d31f5: field story_id: %w", err) + } + s.StoryID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StoryFullID) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode storyFullId#701d31f5 as nil") + } + b.ObjStart() + b.PutID("storyFullId") + b.Comma() + b.FieldStart("sender_chat_id") + b.PutInt53(s.SenderChatID) + b.Comma() + b.FieldStart("story_id") + b.PutInt32(s.StoryID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StoryFullID) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode storyFullId#701d31f5 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("storyFullId"); err != nil { + return fmt.Errorf("unable to decode storyFullId#701d31f5: %w", err) + } + case "sender_chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode storyFullId#701d31f5: field sender_chat_id: %w", err) + } + s.SenderChatID = value + case "story_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode storyFullId#701d31f5: field story_id: %w", err) + } + s.StoryID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetSenderChatID returns value of SenderChatID field. +func (s *StoryFullID) GetSenderChatID() (value int64) { + if s == nil { + return + } + return s.SenderChatID +} + +// GetStoryID returns value of StoryID field. +func (s *StoryFullID) GetStoryID() (value int32) { + if s == nil { + return + } + return s.StoryID +} diff --git a/tdapi/tl_story_gen.go b/tdapi/tl_story_gen.go index 8dd7678114..51a0fb88b7 100644 --- a/tdapi/tl_story_gen.go +++ b/tdapi/tl_story_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// Story represents TL type `story#627556b4`. +// Story represents TL type `story#29dd2b0d`. type Story struct { // Unique story identifier among stories of the given sender ID int32 @@ -61,11 +61,15 @@ type Story struct { CanBeReplied bool // True, if the story's is_pinned value can be changed CanToggleIsPinned bool + // True, if the story statistics are available through getStoryStatistics + CanGetStatistics bool // True, if users viewed the story can be received through getStoryViewers CanGetViewers bool // True, if users viewed the story can't be received, because the story has expired more // than getOption("story_viewers_expiration_delay") seconds ago HasExpiredViewers bool + // Information about the original story; may be null if the story wasn't reposted + RepostInfo StoryRepostInfo // Information about interactions with the story; may be null if the story isn't owned or // there were no interactions InteractionInfo StoryInteractionInfo @@ -82,7 +86,7 @@ type Story struct { } // StoryTypeID is TL type id of Story. -const StoryTypeID = 0x627556b4 +const StoryTypeID = 0x29dd2b0d // Ensuring interfaces in compile-time for Story. var ( @@ -135,12 +139,18 @@ func (s *Story) Zero() bool { if !(s.CanToggleIsPinned == false) { return false } + if !(s.CanGetStatistics == false) { + return false + } if !(s.CanGetViewers == false) { return false } if !(s.HasExpiredViewers == false) { return false } + if !(s.RepostInfo.Zero()) { + return false + } if !(s.InteractionInfo.Zero()) { return false } @@ -247,6 +257,10 @@ func (s *Story) TypeInfo() tdp.Type { Name: "CanToggleIsPinned", SchemaName: "can_toggle_is_pinned", }, + { + Name: "CanGetStatistics", + SchemaName: "can_get_statistics", + }, { Name: "CanGetViewers", SchemaName: "can_get_viewers", @@ -255,6 +269,10 @@ func (s *Story) TypeInfo() tdp.Type { Name: "HasExpiredViewers", SchemaName: "has_expired_viewers", }, + { + Name: "RepostInfo", + SchemaName: "repost_info", + }, { Name: "InteractionInfo", SchemaName: "interaction_info", @@ -286,7 +304,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#627556b4 as nil") + return fmt.Errorf("can't encode story#29dd2b0d as nil") } b.PutID(StoryTypeID) return s.EncodeBare(b) @@ -295,7 +313,7 @@ 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#627556b4 as nil") + return fmt.Errorf("can't encode story#29dd2b0d as nil") } b.PutInt32(s.ID) b.PutInt53(s.SenderChatID) @@ -310,37 +328,41 @@ func (s *Story) EncodeBare(b *bin.Buffer) error { b.PutBool(s.CanBeForwarded) b.PutBool(s.CanBeReplied) b.PutBool(s.CanToggleIsPinned) + b.PutBool(s.CanGetStatistics) b.PutBool(s.CanGetViewers) b.PutBool(s.HasExpiredViewers) + if err := s.RepostInfo.Encode(b); err != nil { + return fmt.Errorf("unable to encode story#29dd2b0d: field repost_info: %w", err) + } if err := s.InteractionInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#627556b4: field interaction_info: %w", err) + return fmt.Errorf("unable to encode story#29dd2b0d: field interaction_info: %w", err) } if s.ChosenReactionType == nil { - return fmt.Errorf("unable to encode story#627556b4: field chosen_reaction_type is nil") + return fmt.Errorf("unable to encode story#29dd2b0d: field chosen_reaction_type is nil") } if err := s.ChosenReactionType.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#627556b4: field chosen_reaction_type: %w", err) + return fmt.Errorf("unable to encode story#29dd2b0d: field chosen_reaction_type: %w", err) } if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode story#627556b4: field privacy_settings is nil") + return fmt.Errorf("unable to encode story#29dd2b0d: field privacy_settings is nil") } if err := s.PrivacySettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#627556b4: field privacy_settings: %w", err) + return fmt.Errorf("unable to encode story#29dd2b0d: field privacy_settings: %w", err) } if s.Content == nil { - return fmt.Errorf("unable to encode story#627556b4: field content is nil") + return fmt.Errorf("unable to encode story#29dd2b0d: field content is nil") } if err := s.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#627556b4: field content: %w", err) + return fmt.Errorf("unable to encode story#29dd2b0d: 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#627556b4: field areas element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare story#29dd2b0d: field areas element with index %d: %w", idx, err) } } if err := s.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#627556b4: field caption: %w", err) + return fmt.Errorf("unable to encode story#29dd2b0d: field caption: %w", err) } return nil } @@ -348,10 +370,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#627556b4 to nil") + return fmt.Errorf("can't decode story#29dd2b0d to nil") } if err := b.ConsumeID(StoryTypeID); err != nil { - return fmt.Errorf("unable to decode story#627556b4: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: %w", err) } return s.DecodeBare(b) } @@ -359,143 +381,155 @@ 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#627556b4 to nil") + return fmt.Errorf("can't decode story#29dd2b0d to nil") } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field id: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field id: %w", err) } s.ID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field sender_chat_id: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field sender_chat_id: %w", err) } s.SenderChatID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field date: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field date: %w", err) } s.Date = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field is_being_sent: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field is_being_sent: %w", err) } s.IsBeingSent = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field is_being_edited: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field is_being_edited: %w", err) } s.IsBeingEdited = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field is_edited: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field is_edited: %w", err) } s.IsEdited = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field is_pinned: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field is_pinned: %w", err) } s.IsPinned = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field is_visible_only_for_self: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: 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#627556b4: field can_be_deleted: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field can_be_deleted: %w", err) } s.CanBeDeleted = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field can_be_edited: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field can_be_edited: %w", err) } s.CanBeEdited = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field can_be_forwarded: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field can_be_forwarded: %w", err) } s.CanBeForwarded = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field can_be_replied: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field can_be_replied: %w", err) } s.CanBeReplied = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field can_toggle_is_pinned: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field can_toggle_is_pinned: %w", err) } s.CanToggleIsPinned = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field can_get_viewers: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field can_get_statistics: %w", err) + } + s.CanGetStatistics = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode story#29dd2b0d: field can_get_viewers: %w", err) } s.CanGetViewers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field has_expired_viewers: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field has_expired_viewers: %w", err) } s.HasExpiredViewers = value } + { + if err := s.RepostInfo.Decode(b); err != nil { + return fmt.Errorf("unable to decode story#29dd2b0d: field repost_info: %w", err) + } + } { if err := s.InteractionInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode story#627556b4: field interaction_info: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field interaction_info: %w", err) } } { value, err := DecodeReactionType(b) if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field chosen_reaction_type: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field chosen_reaction_type: %w", err) } s.ChosenReactionType = value } { value, err := DecodeStoryPrivacySettings(b) if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field privacy_settings: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field privacy_settings: %w", err) } s.PrivacySettings = value } { value, err := DecodeStoryContent(b) if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field content: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field content: %w", err) } s.Content = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field areas: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field areas: %w", err) } if headerLen > 0 { @@ -504,14 +538,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#627556b4: field areas: %w", err) + return fmt.Errorf("unable to decode bare story#29dd2b0d: 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#627556b4: field caption: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field caption: %w", err) } } return nil @@ -520,7 +554,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#627556b4 as nil") + return fmt.Errorf("can't encode story#29dd2b0d as nil") } b.ObjStart() b.PutID("story") @@ -564,46 +598,54 @@ func (s *Story) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("can_toggle_is_pinned") b.PutBool(s.CanToggleIsPinned) b.Comma() + b.FieldStart("can_get_statistics") + b.PutBool(s.CanGetStatistics) + b.Comma() b.FieldStart("can_get_viewers") b.PutBool(s.CanGetViewers) b.Comma() b.FieldStart("has_expired_viewers") b.PutBool(s.HasExpiredViewers) b.Comma() + b.FieldStart("repost_info") + if err := s.RepostInfo.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode story#29dd2b0d: 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#627556b4: field interaction_info: %w", err) + return fmt.Errorf("unable to encode story#29dd2b0d: field interaction_info: %w", err) } b.Comma() b.FieldStart("chosen_reaction_type") if s.ChosenReactionType == nil { - return fmt.Errorf("unable to encode story#627556b4: field chosen_reaction_type is nil") + return fmt.Errorf("unable to encode story#29dd2b0d: field chosen_reaction_type is nil") } if err := s.ChosenReactionType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#627556b4: field chosen_reaction_type: %w", err) + return fmt.Errorf("unable to encode story#29dd2b0d: field chosen_reaction_type: %w", err) } b.Comma() b.FieldStart("privacy_settings") if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode story#627556b4: field privacy_settings is nil") + return fmt.Errorf("unable to encode story#29dd2b0d: field privacy_settings is nil") } if err := s.PrivacySettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#627556b4: field privacy_settings: %w", err) + return fmt.Errorf("unable to encode story#29dd2b0d: field privacy_settings: %w", err) } b.Comma() b.FieldStart("content") if s.Content == nil { - return fmt.Errorf("unable to encode story#627556b4: field content is nil") + return fmt.Errorf("unable to encode story#29dd2b0d: field content is nil") } if err := s.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#627556b4: field content: %w", err) + return fmt.Errorf("unable to encode story#29dd2b0d: 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#627556b4: field areas element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode story#29dd2b0d: field areas element with index %d: %w", idx, err) } b.Comma() } @@ -612,7 +654,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#627556b4: field caption: %w", err) + return fmt.Errorf("unable to encode story#29dd2b0d: field caption: %w", err) } b.Comma() b.StripComma() @@ -623,141 +665,151 @@ 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#627556b4 to nil") + return fmt.Errorf("can't decode story#29dd2b0d 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#627556b4: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: %w", err) } case "id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field id: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: 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#627556b4: field sender_chat_id: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field sender_chat_id: %w", err) } s.SenderChatID = value case "date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field date: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: 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#627556b4: field is_being_sent: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: 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#627556b4: field is_being_edited: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: 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#627556b4: field is_edited: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: 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#627556b4: field is_pinned: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: 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#627556b4: field is_visible_only_for_self: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: 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#627556b4: field can_be_deleted: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: 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#627556b4: field can_be_edited: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: 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#627556b4: field can_be_forwarded: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: 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#627556b4: field can_be_replied: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: 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#627556b4: field can_toggle_is_pinned: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: 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#29dd2b0d: field can_get_statistics: %w", err) + } + s.CanGetStatistics = value case "can_get_viewers": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field can_get_viewers: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field can_get_viewers: %w", err) } s.CanGetViewers = value case "has_expired_viewers": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field has_expired_viewers: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: 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#29dd2b0d: field repost_info: %w", err) + } case "interaction_info": if err := s.InteractionInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode story#627556b4: field interaction_info: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field interaction_info: %w", err) } case "chosen_reaction_type": value, err := DecodeTDLibJSONReactionType(b) if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field chosen_reaction_type: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: 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#627556b4: field privacy_settings: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field privacy_settings: %w", err) } s.PrivacySettings = value case "content": value, err := DecodeTDLibJSONStoryContent(b) if err != nil { - return fmt.Errorf("unable to decode story#627556b4: field content: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: 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#627556b4: field areas: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field areas: %w", err) } s.Areas = append(s.Areas, value) return nil }); err != nil { - return fmt.Errorf("unable to decode story#627556b4: field areas: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field areas: %w", err) } case "caption": if err := s.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode story#627556b4: field caption: %w", err) + return fmt.Errorf("unable to decode story#29dd2b0d: field caption: %w", err) } default: return b.Skip() @@ -870,6 +922,14 @@ func (s *Story) GetCanToggleIsPinned() (value bool) { return s.CanToggleIsPinned } +// GetCanGetStatistics returns value of CanGetStatistics field. +func (s *Story) GetCanGetStatistics() (value bool) { + if s == nil { + return + } + return s.CanGetStatistics +} + // GetCanGetViewers returns value of CanGetViewers field. func (s *Story) GetCanGetViewers() (value bool) { if s == nil { @@ -886,6 +946,14 @@ func (s *Story) GetHasExpiredViewers() (value bool) { return s.HasExpiredViewers } +// GetRepostInfo returns value of RepostInfo field. +func (s *Story) GetRepostInfo() (value StoryRepostInfo) { + if s == nil { + return + } + return s.RepostInfo +} + // GetInteractionInfo returns value of InteractionInfo field. func (s *Story) GetInteractionInfo() (value StoryInteractionInfo) { if s == nil { diff --git a/tdapi/tl_story_origin_gen.go b/tdapi/tl_story_origin_gen.go new file mode 100644 index 0000000000..5b434f35f6 --- /dev/null +++ b/tdapi/tl_story_origin_gen.go @@ -0,0 +1,535 @@ +// 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{} +) + +// StoryOriginPublicStory represents TL type `storyOriginPublicStory#2c379fbe`. +type StoryOriginPublicStory struct { + // Identifier of the chat that posted original story + ChatID int64 + // Story identifier of the original story + StoryID int32 +} + +// StoryOriginPublicStoryTypeID is TL type id of StoryOriginPublicStory. +const StoryOriginPublicStoryTypeID = 0x2c379fbe + +// construct implements constructor of StoryOriginClass. +func (s StoryOriginPublicStory) construct() StoryOriginClass { return &s } + +// Ensuring interfaces in compile-time for StoryOriginPublicStory. +var ( + _ bin.Encoder = &StoryOriginPublicStory{} + _ bin.Decoder = &StoryOriginPublicStory{} + _ bin.BareEncoder = &StoryOriginPublicStory{} + _ bin.BareDecoder = &StoryOriginPublicStory{} + + _ StoryOriginClass = &StoryOriginPublicStory{} +) + +func (s *StoryOriginPublicStory) Zero() bool { + if s == nil { + return true + } + if !(s.ChatID == 0) { + return false + } + if !(s.StoryID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StoryOriginPublicStory) String() string { + if s == nil { + return "StoryOriginPublicStory(nil)" + } + type Alias StoryOriginPublicStory + return fmt.Sprintf("StoryOriginPublicStory%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StoryOriginPublicStory) TypeID() uint32 { + return StoryOriginPublicStoryTypeID +} + +// TypeName returns name of type in TL schema. +func (*StoryOriginPublicStory) TypeName() string { + return "storyOriginPublicStory" +} + +// TypeInfo returns info about TL type. +func (s *StoryOriginPublicStory) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "storyOriginPublicStory", + ID: StoryOriginPublicStoryTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "StoryID", + SchemaName: "story_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StoryOriginPublicStory) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyOriginPublicStory#2c379fbe as nil") + } + b.PutID(StoryOriginPublicStoryTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StoryOriginPublicStory) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyOriginPublicStory#2c379fbe as nil") + } + b.PutInt53(s.ChatID) + b.PutInt32(s.StoryID) + return nil +} + +// Decode implements bin.Decoder. +func (s *StoryOriginPublicStory) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyOriginPublicStory#2c379fbe to nil") + } + if err := b.ConsumeID(StoryOriginPublicStoryTypeID); err != nil { + return fmt.Errorf("unable to decode storyOriginPublicStory#2c379fbe: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StoryOriginPublicStory) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyOriginPublicStory#2c379fbe to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode storyOriginPublicStory#2c379fbe: field chat_id: %w", err) + } + s.ChatID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode storyOriginPublicStory#2c379fbe: field story_id: %w", err) + } + s.StoryID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StoryOriginPublicStory) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode storyOriginPublicStory#2c379fbe as nil") + } + b.ObjStart() + b.PutID("storyOriginPublicStory") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(s.ChatID) + b.Comma() + b.FieldStart("story_id") + b.PutInt32(s.StoryID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StoryOriginPublicStory) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode storyOriginPublicStory#2c379fbe to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("storyOriginPublicStory"); err != nil { + return fmt.Errorf("unable to decode storyOriginPublicStory#2c379fbe: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode storyOriginPublicStory#2c379fbe: field chat_id: %w", err) + } + s.ChatID = value + case "story_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode storyOriginPublicStory#2c379fbe: field story_id: %w", err) + } + s.StoryID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (s *StoryOriginPublicStory) GetChatID() (value int64) { + if s == nil { + return + } + return s.ChatID +} + +// GetStoryID returns value of StoryID field. +func (s *StoryOriginPublicStory) GetStoryID() (value int32) { + if s == nil { + return + } + return s.StoryID +} + +// StoryOriginHiddenUser represents TL type `storyOriginHiddenUser#5a1f89ec`. +type StoryOriginHiddenUser struct { + // Name of the story sender + SenderName string +} + +// StoryOriginHiddenUserTypeID is TL type id of StoryOriginHiddenUser. +const StoryOriginHiddenUserTypeID = 0x5a1f89ec + +// construct implements constructor of StoryOriginClass. +func (s StoryOriginHiddenUser) construct() StoryOriginClass { return &s } + +// Ensuring interfaces in compile-time for StoryOriginHiddenUser. +var ( + _ bin.Encoder = &StoryOriginHiddenUser{} + _ bin.Decoder = &StoryOriginHiddenUser{} + _ bin.BareEncoder = &StoryOriginHiddenUser{} + _ bin.BareDecoder = &StoryOriginHiddenUser{} + + _ StoryOriginClass = &StoryOriginHiddenUser{} +) + +func (s *StoryOriginHiddenUser) Zero() bool { + if s == nil { + return true + } + if !(s.SenderName == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StoryOriginHiddenUser) String() string { + if s == nil { + return "StoryOriginHiddenUser(nil)" + } + type Alias StoryOriginHiddenUser + return fmt.Sprintf("StoryOriginHiddenUser%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StoryOriginHiddenUser) TypeID() uint32 { + return StoryOriginHiddenUserTypeID +} + +// TypeName returns name of type in TL schema. +func (*StoryOriginHiddenUser) TypeName() string { + return "storyOriginHiddenUser" +} + +// TypeInfo returns info about TL type. +func (s *StoryOriginHiddenUser) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "storyOriginHiddenUser", + ID: StoryOriginHiddenUserTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "SenderName", + SchemaName: "sender_name", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StoryOriginHiddenUser) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyOriginHiddenUser#5a1f89ec as nil") + } + b.PutID(StoryOriginHiddenUserTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StoryOriginHiddenUser) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyOriginHiddenUser#5a1f89ec as nil") + } + b.PutString(s.SenderName) + return nil +} + +// Decode implements bin.Decoder. +func (s *StoryOriginHiddenUser) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyOriginHiddenUser#5a1f89ec to nil") + } + if err := b.ConsumeID(StoryOriginHiddenUserTypeID); err != nil { + return fmt.Errorf("unable to decode storyOriginHiddenUser#5a1f89ec: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StoryOriginHiddenUser) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyOriginHiddenUser#5a1f89ec to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode storyOriginHiddenUser#5a1f89ec: field sender_name: %w", err) + } + s.SenderName = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StoryOriginHiddenUser) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode storyOriginHiddenUser#5a1f89ec as nil") + } + b.ObjStart() + b.PutID("storyOriginHiddenUser") + b.Comma() + b.FieldStart("sender_name") + b.PutString(s.SenderName) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StoryOriginHiddenUser) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode storyOriginHiddenUser#5a1f89ec to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("storyOriginHiddenUser"); err != nil { + return fmt.Errorf("unable to decode storyOriginHiddenUser#5a1f89ec: %w", err) + } + case "sender_name": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode storyOriginHiddenUser#5a1f89ec: field sender_name: %w", err) + } + s.SenderName = value + default: + return b.Skip() + } + return nil + }) +} + +// GetSenderName returns value of SenderName field. +func (s *StoryOriginHiddenUser) GetSenderName() (value string) { + if s == nil { + return + } + return s.SenderName +} + +// StoryOriginClassName is schema name of StoryOriginClass. +const StoryOriginClassName = "StoryOrigin" + +// StoryOriginClass represents StoryOrigin generic type. +// +// Example: +// +// g, err := tdapi.DecodeStoryOrigin(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tdapi.StoryOriginPublicStory: // storyOriginPublicStory#2c379fbe +// case *tdapi.StoryOriginHiddenUser: // storyOriginHiddenUser#5a1f89ec +// default: panic(v) +// } +type StoryOriginClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() StoryOriginClass + + // 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 +} + +// DecodeStoryOrigin implements binary de-serialization for StoryOriginClass. +func DecodeStoryOrigin(buf *bin.Buffer) (StoryOriginClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case StoryOriginPublicStoryTypeID: + // Decoding storyOriginPublicStory#2c379fbe. + v := StoryOriginPublicStory{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StoryOriginClass: %w", err) + } + return &v, nil + case StoryOriginHiddenUserTypeID: + // Decoding storyOriginHiddenUser#5a1f89ec. + v := StoryOriginHiddenUser{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StoryOriginClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode StoryOriginClass: %w", bin.NewUnexpectedID(id)) + } +} + +// DecodeTDLibJSONStoryOrigin implements binary de-serialization for StoryOriginClass. +func DecodeTDLibJSONStoryOrigin(buf tdjson.Decoder) (StoryOriginClass, error) { + id, err := buf.FindTypeID() + if err != nil { + return nil, err + } + switch id { + case "storyOriginPublicStory": + // Decoding storyOriginPublicStory#2c379fbe. + v := StoryOriginPublicStory{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode StoryOriginClass: %w", err) + } + return &v, nil + case "storyOriginHiddenUser": + // Decoding storyOriginHiddenUser#5a1f89ec. + v := StoryOriginHiddenUser{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode StoryOriginClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode StoryOriginClass: %w", tdjson.NewUnexpectedID(id)) + } +} + +// StoryOrigin boxes the StoryOriginClass providing a helper. +type StoryOriginBox struct { + StoryOrigin StoryOriginClass +} + +// Decode implements bin.Decoder for StoryOriginBox. +func (b *StoryOriginBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode StoryOriginBox to nil") + } + v, err := DecodeStoryOrigin(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.StoryOrigin = v + return nil +} + +// Encode implements bin.Encode for StoryOriginBox. +func (b *StoryOriginBox) Encode(buf *bin.Buffer) error { + if b == nil || b.StoryOrigin == nil { + return fmt.Errorf("unable to encode StoryOriginClass as nil") + } + return b.StoryOrigin.Encode(buf) +} + +// DecodeTDLibJSON implements bin.Decoder for StoryOriginBox. +func (b *StoryOriginBox) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("unable to decode StoryOriginBox to nil") + } + v, err := DecodeTDLibJSONStoryOrigin(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.StoryOrigin = v + return nil +} + +// EncodeTDLibJSON implements bin.Encode for StoryOriginBox. +func (b *StoryOriginBox) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil || b.StoryOrigin == nil { + return fmt.Errorf("unable to encode StoryOriginClass as nil") + } + return b.StoryOrigin.EncodeTDLibJSON(buf) +} diff --git a/tdapi/tl_story_public_forward_gen.go b/tdapi/tl_story_public_forward_gen.go new file mode 100644 index 0000000000..fd1ed5e3f3 --- /dev/null +++ b/tdapi/tl_story_public_forward_gen.go @@ -0,0 +1,501 @@ +// 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{} +) + +// StoryPublicForwardMessage represents TL type `storyPublicForwardMessage#fd39c20c`. +type StoryPublicForwardMessage struct { + // Information about the message with the story + Message Message +} + +// StoryPublicForwardMessageTypeID is TL type id of StoryPublicForwardMessage. +const StoryPublicForwardMessageTypeID = 0xfd39c20c + +// construct implements constructor of StoryPublicForwardClass. +func (s StoryPublicForwardMessage) construct() StoryPublicForwardClass { return &s } + +// Ensuring interfaces in compile-time for StoryPublicForwardMessage. +var ( + _ bin.Encoder = &StoryPublicForwardMessage{} + _ bin.Decoder = &StoryPublicForwardMessage{} + _ bin.BareEncoder = &StoryPublicForwardMessage{} + _ bin.BareDecoder = &StoryPublicForwardMessage{} + + _ StoryPublicForwardClass = &StoryPublicForwardMessage{} +) + +func (s *StoryPublicForwardMessage) Zero() bool { + if s == nil { + return true + } + if !(s.Message.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StoryPublicForwardMessage) String() string { + if s == nil { + return "StoryPublicForwardMessage(nil)" + } + type Alias StoryPublicForwardMessage + return fmt.Sprintf("StoryPublicForwardMessage%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StoryPublicForwardMessage) TypeID() uint32 { + return StoryPublicForwardMessageTypeID +} + +// TypeName returns name of type in TL schema. +func (*StoryPublicForwardMessage) TypeName() string { + return "storyPublicForwardMessage" +} + +// TypeInfo returns info about TL type. +func (s *StoryPublicForwardMessage) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "storyPublicForwardMessage", + ID: StoryPublicForwardMessageTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Message", + SchemaName: "message", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StoryPublicForwardMessage) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyPublicForwardMessage#fd39c20c as nil") + } + b.PutID(StoryPublicForwardMessageTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StoryPublicForwardMessage) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyPublicForwardMessage#fd39c20c as nil") + } + if err := s.Message.Encode(b); err != nil { + return fmt.Errorf("unable to encode storyPublicForwardMessage#fd39c20c: field message: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StoryPublicForwardMessage) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyPublicForwardMessage#fd39c20c to nil") + } + if err := b.ConsumeID(StoryPublicForwardMessageTypeID); err != nil { + return fmt.Errorf("unable to decode storyPublicForwardMessage#fd39c20c: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StoryPublicForwardMessage) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyPublicForwardMessage#fd39c20c to nil") + } + { + if err := s.Message.Decode(b); err != nil { + return fmt.Errorf("unable to decode storyPublicForwardMessage#fd39c20c: field message: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StoryPublicForwardMessage) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode storyPublicForwardMessage#fd39c20c as nil") + } + b.ObjStart() + b.PutID("storyPublicForwardMessage") + b.Comma() + b.FieldStart("message") + if err := s.Message.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode storyPublicForwardMessage#fd39c20c: field message: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StoryPublicForwardMessage) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode storyPublicForwardMessage#fd39c20c to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("storyPublicForwardMessage"); err != nil { + return fmt.Errorf("unable to decode storyPublicForwardMessage#fd39c20c: %w", err) + } + case "message": + if err := s.Message.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode storyPublicForwardMessage#fd39c20c: field message: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetMessage returns value of Message field. +func (s *StoryPublicForwardMessage) GetMessage() (value Message) { + if s == nil { + return + } + return s.Message +} + +// StoryPublicForwardStory represents TL type `storyPublicForwardStory#f7e6c146`. +type StoryPublicForwardStory struct { + // Information about the reposted story + Story Story +} + +// StoryPublicForwardStoryTypeID is TL type id of StoryPublicForwardStory. +const StoryPublicForwardStoryTypeID = 0xf7e6c146 + +// construct implements constructor of StoryPublicForwardClass. +func (s StoryPublicForwardStory) construct() StoryPublicForwardClass { return &s } + +// Ensuring interfaces in compile-time for StoryPublicForwardStory. +var ( + _ bin.Encoder = &StoryPublicForwardStory{} + _ bin.Decoder = &StoryPublicForwardStory{} + _ bin.BareEncoder = &StoryPublicForwardStory{} + _ bin.BareDecoder = &StoryPublicForwardStory{} + + _ StoryPublicForwardClass = &StoryPublicForwardStory{} +) + +func (s *StoryPublicForwardStory) Zero() bool { + if s == nil { + return true + } + if !(s.Story.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StoryPublicForwardStory) String() string { + if s == nil { + return "StoryPublicForwardStory(nil)" + } + type Alias StoryPublicForwardStory + return fmt.Sprintf("StoryPublicForwardStory%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StoryPublicForwardStory) TypeID() uint32 { + return StoryPublicForwardStoryTypeID +} + +// TypeName returns name of type in TL schema. +func (*StoryPublicForwardStory) TypeName() string { + return "storyPublicForwardStory" +} + +// TypeInfo returns info about TL type. +func (s *StoryPublicForwardStory) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "storyPublicForwardStory", + ID: StoryPublicForwardStoryTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Story", + SchemaName: "story", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StoryPublicForwardStory) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyPublicForwardStory#f7e6c146 as nil") + } + b.PutID(StoryPublicForwardStoryTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StoryPublicForwardStory) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyPublicForwardStory#f7e6c146 as nil") + } + if err := s.Story.Encode(b); err != nil { + return fmt.Errorf("unable to encode storyPublicForwardStory#f7e6c146: field story: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StoryPublicForwardStory) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyPublicForwardStory#f7e6c146 to nil") + } + if err := b.ConsumeID(StoryPublicForwardStoryTypeID); err != nil { + return fmt.Errorf("unable to decode storyPublicForwardStory#f7e6c146: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StoryPublicForwardStory) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyPublicForwardStory#f7e6c146 to nil") + } + { + if err := s.Story.Decode(b); err != nil { + return fmt.Errorf("unable to decode storyPublicForwardStory#f7e6c146: field story: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StoryPublicForwardStory) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode storyPublicForwardStory#f7e6c146 as nil") + } + b.ObjStart() + b.PutID("storyPublicForwardStory") + b.Comma() + b.FieldStart("story") + if err := s.Story.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode storyPublicForwardStory#f7e6c146: field story: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StoryPublicForwardStory) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode storyPublicForwardStory#f7e6c146 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("storyPublicForwardStory"); err != nil { + return fmt.Errorf("unable to decode storyPublicForwardStory#f7e6c146: %w", err) + } + case "story": + if err := s.Story.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode storyPublicForwardStory#f7e6c146: field story: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetStory returns value of Story field. +func (s *StoryPublicForwardStory) GetStory() (value Story) { + if s == nil { + return + } + return s.Story +} + +// StoryPublicForwardClassName is schema name of StoryPublicForwardClass. +const StoryPublicForwardClassName = "StoryPublicForward" + +// StoryPublicForwardClass represents StoryPublicForward generic type. +// +// Example: +// +// g, err := tdapi.DecodeStoryPublicForward(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tdapi.StoryPublicForwardMessage: // storyPublicForwardMessage#fd39c20c +// case *tdapi.StoryPublicForwardStory: // storyPublicForwardStory#f7e6c146 +// default: panic(v) +// } +type StoryPublicForwardClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() StoryPublicForwardClass + + // 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 +} + +// DecodeStoryPublicForward implements binary de-serialization for StoryPublicForwardClass. +func DecodeStoryPublicForward(buf *bin.Buffer) (StoryPublicForwardClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case StoryPublicForwardMessageTypeID: + // Decoding storyPublicForwardMessage#fd39c20c. + v := StoryPublicForwardMessage{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StoryPublicForwardClass: %w", err) + } + return &v, nil + case StoryPublicForwardStoryTypeID: + // Decoding storyPublicForwardStory#f7e6c146. + v := StoryPublicForwardStory{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StoryPublicForwardClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode StoryPublicForwardClass: %w", bin.NewUnexpectedID(id)) + } +} + +// DecodeTDLibJSONStoryPublicForward implements binary de-serialization for StoryPublicForwardClass. +func DecodeTDLibJSONStoryPublicForward(buf tdjson.Decoder) (StoryPublicForwardClass, error) { + id, err := buf.FindTypeID() + if err != nil { + return nil, err + } + switch id { + case "storyPublicForwardMessage": + // Decoding storyPublicForwardMessage#fd39c20c. + v := StoryPublicForwardMessage{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode StoryPublicForwardClass: %w", err) + } + return &v, nil + case "storyPublicForwardStory": + // Decoding storyPublicForwardStory#f7e6c146. + v := StoryPublicForwardStory{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode StoryPublicForwardClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode StoryPublicForwardClass: %w", tdjson.NewUnexpectedID(id)) + } +} + +// StoryPublicForward boxes the StoryPublicForwardClass providing a helper. +type StoryPublicForwardBox struct { + StoryPublicForward StoryPublicForwardClass +} + +// Decode implements bin.Decoder for StoryPublicForwardBox. +func (b *StoryPublicForwardBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode StoryPublicForwardBox to nil") + } + v, err := DecodeStoryPublicForward(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.StoryPublicForward = v + return nil +} + +// Encode implements bin.Encode for StoryPublicForwardBox. +func (b *StoryPublicForwardBox) Encode(buf *bin.Buffer) error { + if b == nil || b.StoryPublicForward == nil { + return fmt.Errorf("unable to encode StoryPublicForwardClass as nil") + } + return b.StoryPublicForward.Encode(buf) +} + +// DecodeTDLibJSON implements bin.Decoder for StoryPublicForwardBox. +func (b *StoryPublicForwardBox) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("unable to decode StoryPublicForwardBox to nil") + } + v, err := DecodeTDLibJSONStoryPublicForward(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.StoryPublicForward = v + return nil +} + +// EncodeTDLibJSON implements bin.Encode for StoryPublicForwardBox. +func (b *StoryPublicForwardBox) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil || b.StoryPublicForward == nil { + return fmt.Errorf("unable to encode StoryPublicForwardClass as nil") + } + return b.StoryPublicForward.EncodeTDLibJSON(buf) +} diff --git a/tdapi/tl_story_public_forwards_gen.go b/tdapi/tl_story_public_forwards_gen.go new file mode 100644 index 0000000000..415d34e5d2 --- /dev/null +++ b/tdapi/tl_story_public_forwards_gen.go @@ -0,0 +1,295 @@ +// 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{} +) + +// StoryPublicForwards represents TL type `storyPublicForwards#fcacb389`. +type StoryPublicForwards struct { + // Approximate total number of messages and stories found + TotalCount int32 + // List of found public forwards and reposts + Forwards []StoryPublicForwardClass + // The offset for the next request. If empty, then there are no more results + NextOffset string +} + +// StoryPublicForwardsTypeID is TL type id of StoryPublicForwards. +const StoryPublicForwardsTypeID = 0xfcacb389 + +// Ensuring interfaces in compile-time for StoryPublicForwards. +var ( + _ bin.Encoder = &StoryPublicForwards{} + _ bin.Decoder = &StoryPublicForwards{} + _ bin.BareEncoder = &StoryPublicForwards{} + _ bin.BareDecoder = &StoryPublicForwards{} +) + +func (s *StoryPublicForwards) Zero() bool { + if s == nil { + return true + } + if !(s.TotalCount == 0) { + return false + } + if !(s.Forwards == nil) { + return false + } + if !(s.NextOffset == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StoryPublicForwards) String() string { + if s == nil { + return "StoryPublicForwards(nil)" + } + type Alias StoryPublicForwards + return fmt.Sprintf("StoryPublicForwards%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StoryPublicForwards) TypeID() uint32 { + return StoryPublicForwardsTypeID +} + +// TypeName returns name of type in TL schema. +func (*StoryPublicForwards) TypeName() string { + return "storyPublicForwards" +} + +// TypeInfo returns info about TL type. +func (s *StoryPublicForwards) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "storyPublicForwards", + ID: StoryPublicForwardsTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "TotalCount", + SchemaName: "total_count", + }, + { + Name: "Forwards", + SchemaName: "forwards", + }, + { + Name: "NextOffset", + SchemaName: "next_offset", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StoryPublicForwards) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyPublicForwards#fcacb389 as nil") + } + b.PutID(StoryPublicForwardsTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StoryPublicForwards) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyPublicForwards#fcacb389 as nil") + } + b.PutInt32(s.TotalCount) + b.PutInt(len(s.Forwards)) + for idx, v := range s.Forwards { + if v == nil { + return fmt.Errorf("unable to encode storyPublicForwards#fcacb389: field forwards element with index %d is nil", idx) + } + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare storyPublicForwards#fcacb389: field forwards element with index %d: %w", idx, err) + } + } + b.PutString(s.NextOffset) + return nil +} + +// Decode implements bin.Decoder. +func (s *StoryPublicForwards) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyPublicForwards#fcacb389 to nil") + } + if err := b.ConsumeID(StoryPublicForwardsTypeID); err != nil { + return fmt.Errorf("unable to decode storyPublicForwards#fcacb389: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StoryPublicForwards) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyPublicForwards#fcacb389 to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode storyPublicForwards#fcacb389: field total_count: %w", err) + } + s.TotalCount = value + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode storyPublicForwards#fcacb389: field forwards: %w", err) + } + + if headerLen > 0 { + s.Forwards = make([]StoryPublicForwardClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeStoryPublicForward(b) + if err != nil { + return fmt.Errorf("unable to decode storyPublicForwards#fcacb389: field forwards: %w", err) + } + s.Forwards = append(s.Forwards, value) + } + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode storyPublicForwards#fcacb389: field next_offset: %w", err) + } + s.NextOffset = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StoryPublicForwards) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode storyPublicForwards#fcacb389 as nil") + } + b.ObjStart() + b.PutID("storyPublicForwards") + b.Comma() + b.FieldStart("total_count") + b.PutInt32(s.TotalCount) + b.Comma() + b.FieldStart("forwards") + b.ArrStart() + for idx, v := range s.Forwards { + if v == nil { + return fmt.Errorf("unable to encode storyPublicForwards#fcacb389: field forwards element with index %d is nil", idx) + } + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode storyPublicForwards#fcacb389: field forwards element with index %d: %w", idx, err) + } + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.FieldStart("next_offset") + b.PutString(s.NextOffset) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StoryPublicForwards) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode storyPublicForwards#fcacb389 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("storyPublicForwards"); err != nil { + return fmt.Errorf("unable to decode storyPublicForwards#fcacb389: %w", err) + } + case "total_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode storyPublicForwards#fcacb389: field total_count: %w", err) + } + s.TotalCount = value + case "forwards": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := DecodeTDLibJSONStoryPublicForward(b) + if err != nil { + return fmt.Errorf("unable to decode storyPublicForwards#fcacb389: field forwards: %w", err) + } + s.Forwards = append(s.Forwards, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode storyPublicForwards#fcacb389: field forwards: %w", err) + } + case "next_offset": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode storyPublicForwards#fcacb389: field next_offset: %w", err) + } + s.NextOffset = value + default: + return b.Skip() + } + return nil + }) +} + +// GetTotalCount returns value of TotalCount field. +func (s *StoryPublicForwards) GetTotalCount() (value int32) { + if s == nil { + return + } + return s.TotalCount +} + +// GetForwards returns value of Forwards field. +func (s *StoryPublicForwards) GetForwards() (value []StoryPublicForwardClass) { + if s == nil { + return + } + return s.Forwards +} + +// GetNextOffset returns value of NextOffset field. +func (s *StoryPublicForwards) GetNextOffset() (value string) { + if s == nil { + return + } + return s.NextOffset +} diff --git a/tdapi/tl_story_repost_info_gen.go b/tdapi/tl_story_repost_info_gen.go new file mode 100644 index 0000000000..a46f4df49d --- /dev/null +++ b/tdapi/tl_story_repost_info_gen.go @@ -0,0 +1,237 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// StoryRepostInfo represents TL type `storyRepostInfo#ff7fa440`. +type StoryRepostInfo struct { + // Origin of the story that was reposted + Origin StoryOriginClass + // True, if story content was modified during reposting; otherwise, story wasn't modified + IsContentModified bool +} + +// StoryRepostInfoTypeID is TL type id of StoryRepostInfo. +const StoryRepostInfoTypeID = 0xff7fa440 + +// Ensuring interfaces in compile-time for StoryRepostInfo. +var ( + _ bin.Encoder = &StoryRepostInfo{} + _ bin.Decoder = &StoryRepostInfo{} + _ bin.BareEncoder = &StoryRepostInfo{} + _ bin.BareDecoder = &StoryRepostInfo{} +) + +func (s *StoryRepostInfo) Zero() bool { + if s == nil { + return true + } + if !(s.Origin == nil) { + return false + } + if !(s.IsContentModified == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StoryRepostInfo) String() string { + if s == nil { + return "StoryRepostInfo(nil)" + } + type Alias StoryRepostInfo + return fmt.Sprintf("StoryRepostInfo%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StoryRepostInfo) TypeID() uint32 { + return StoryRepostInfoTypeID +} + +// TypeName returns name of type in TL schema. +func (*StoryRepostInfo) TypeName() string { + return "storyRepostInfo" +} + +// TypeInfo returns info about TL type. +func (s *StoryRepostInfo) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "storyRepostInfo", + ID: StoryRepostInfoTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Origin", + SchemaName: "origin", + }, + { + Name: "IsContentModified", + SchemaName: "is_content_modified", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StoryRepostInfo) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyRepostInfo#ff7fa440 as nil") + } + b.PutID(StoryRepostInfoTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StoryRepostInfo) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyRepostInfo#ff7fa440 as nil") + } + if s.Origin == nil { + return fmt.Errorf("unable to encode storyRepostInfo#ff7fa440: field origin is nil") + } + if err := s.Origin.Encode(b); err != nil { + return fmt.Errorf("unable to encode storyRepostInfo#ff7fa440: field origin: %w", err) + } + b.PutBool(s.IsContentModified) + return nil +} + +// Decode implements bin.Decoder. +func (s *StoryRepostInfo) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyRepostInfo#ff7fa440 to nil") + } + if err := b.ConsumeID(StoryRepostInfoTypeID); err != nil { + return fmt.Errorf("unable to decode storyRepostInfo#ff7fa440: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StoryRepostInfo) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyRepostInfo#ff7fa440 to nil") + } + { + value, err := DecodeStoryOrigin(b) + if err != nil { + return fmt.Errorf("unable to decode storyRepostInfo#ff7fa440: field origin: %w", err) + } + s.Origin = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode storyRepostInfo#ff7fa440: field is_content_modified: %w", err) + } + s.IsContentModified = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StoryRepostInfo) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode storyRepostInfo#ff7fa440 as nil") + } + b.ObjStart() + b.PutID("storyRepostInfo") + b.Comma() + b.FieldStart("origin") + if s.Origin == nil { + return fmt.Errorf("unable to encode storyRepostInfo#ff7fa440: field origin is nil") + } + if err := s.Origin.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode storyRepostInfo#ff7fa440: field origin: %w", err) + } + b.Comma() + b.FieldStart("is_content_modified") + b.PutBool(s.IsContentModified) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StoryRepostInfo) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode storyRepostInfo#ff7fa440 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("storyRepostInfo"); err != nil { + return fmt.Errorf("unable to decode storyRepostInfo#ff7fa440: %w", err) + } + case "origin": + value, err := DecodeTDLibJSONStoryOrigin(b) + if err != nil { + return fmt.Errorf("unable to decode storyRepostInfo#ff7fa440: field origin: %w", err) + } + s.Origin = value + case "is_content_modified": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode storyRepostInfo#ff7fa440: field is_content_modified: %w", err) + } + s.IsContentModified = value + default: + return b.Skip() + } + return nil + }) +} + +// GetOrigin returns value of Origin field. +func (s *StoryRepostInfo) GetOrigin() (value StoryOriginClass) { + if s == nil { + return + } + return s.Origin +} + +// GetIsContentModified returns value of IsContentModified field. +func (s *StoryRepostInfo) GetIsContentModified() (value bool) { + if s == nil { + return + } + return s.IsContentModified +} diff --git a/tdapi/tl_story_statistics_gen.go b/tdapi/tl_story_statistics_gen.go new file mode 100644 index 0000000000..634c4b8dd7 --- /dev/null +++ b/tdapi/tl_story_statistics_gen.go @@ -0,0 +1,247 @@ +// 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{} +) + +// StoryStatistics represents TL type `storyStatistics#46448b6b`. +type StoryStatistics struct { + // A graph containing number of story views and shares + StoryInteractionGraph StatisticalGraphClass + // A graph containing number of story reactions + StoryReactionGraph StatisticalGraphClass +} + +// StoryStatisticsTypeID is TL type id of StoryStatistics. +const StoryStatisticsTypeID = 0x46448b6b + +// Ensuring interfaces in compile-time for StoryStatistics. +var ( + _ bin.Encoder = &StoryStatistics{} + _ bin.Decoder = &StoryStatistics{} + _ bin.BareEncoder = &StoryStatistics{} + _ bin.BareDecoder = &StoryStatistics{} +) + +func (s *StoryStatistics) Zero() bool { + if s == nil { + return true + } + if !(s.StoryInteractionGraph == nil) { + return false + } + if !(s.StoryReactionGraph == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StoryStatistics) String() string { + if s == nil { + return "StoryStatistics(nil)" + } + type Alias StoryStatistics + return fmt.Sprintf("StoryStatistics%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StoryStatistics) TypeID() uint32 { + return StoryStatisticsTypeID +} + +// TypeName returns name of type in TL schema. +func (*StoryStatistics) TypeName() string { + return "storyStatistics" +} + +// TypeInfo returns info about TL type. +func (s *StoryStatistics) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "storyStatistics", + ID: StoryStatisticsTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "StoryInteractionGraph", + SchemaName: "story_interaction_graph", + }, + { + Name: "StoryReactionGraph", + SchemaName: "story_reaction_graph", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StoryStatistics) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyStatistics#46448b6b as nil") + } + b.PutID(StoryStatisticsTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StoryStatistics) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyStatistics#46448b6b as nil") + } + if s.StoryInteractionGraph == nil { + return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_interaction_graph is nil") + } + if err := s.StoryInteractionGraph.Encode(b); err != nil { + return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_interaction_graph: %w", err) + } + if s.StoryReactionGraph == nil { + return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_reaction_graph is nil") + } + if err := s.StoryReactionGraph.Encode(b); err != nil { + return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_reaction_graph: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StoryStatistics) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyStatistics#46448b6b to nil") + } + if err := b.ConsumeID(StoryStatisticsTypeID); err != nil { + return fmt.Errorf("unable to decode storyStatistics#46448b6b: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StoryStatistics) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyStatistics#46448b6b to nil") + } + { + value, err := DecodeStatisticalGraph(b) + if err != nil { + return fmt.Errorf("unable to decode storyStatistics#46448b6b: field story_interaction_graph: %w", err) + } + s.StoryInteractionGraph = value + } + { + value, err := DecodeStatisticalGraph(b) + if err != nil { + return fmt.Errorf("unable to decode storyStatistics#46448b6b: field story_reaction_graph: %w", err) + } + s.StoryReactionGraph = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StoryStatistics) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode storyStatistics#46448b6b as nil") + } + b.ObjStart() + b.PutID("storyStatistics") + b.Comma() + b.FieldStart("story_interaction_graph") + if s.StoryInteractionGraph == nil { + return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_interaction_graph is nil") + } + if err := s.StoryInteractionGraph.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_interaction_graph: %w", err) + } + b.Comma() + b.FieldStart("story_reaction_graph") + if s.StoryReactionGraph == nil { + return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_reaction_graph is nil") + } + if err := s.StoryReactionGraph.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_reaction_graph: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StoryStatistics) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode storyStatistics#46448b6b to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("storyStatistics"); err != nil { + return fmt.Errorf("unable to decode storyStatistics#46448b6b: %w", err) + } + case "story_interaction_graph": + value, err := DecodeTDLibJSONStatisticalGraph(b) + if err != nil { + return fmt.Errorf("unable to decode storyStatistics#46448b6b: field story_interaction_graph: %w", err) + } + s.StoryInteractionGraph = value + case "story_reaction_graph": + value, err := DecodeTDLibJSONStatisticalGraph(b) + if err != nil { + return fmt.Errorf("unable to decode storyStatistics#46448b6b: field story_reaction_graph: %w", err) + } + s.StoryReactionGraph = value + default: + return b.Skip() + } + return nil + }) +} + +// GetStoryInteractionGraph returns value of StoryInteractionGraph field. +func (s *StoryStatistics) GetStoryInteractionGraph() (value StatisticalGraphClass) { + if s == nil { + return + } + return s.StoryInteractionGraph +} + +// GetStoryReactionGraph returns value of StoryReactionGraph field. +func (s *StoryStatistics) GetStoryReactionGraph() (value StatisticalGraphClass) { + if s == nil { + return + } + return s.StoryReactionGraph +} diff --git a/tdapi/tl_story_viewers_gen.go b/tdapi/tl_story_viewers_gen.go index 86c17e8a34..21ee3a6c35 100644 --- a/tdapi/tl_story_viewers_gen.go +++ b/tdapi/tl_story_viewers_gen.go @@ -39,7 +39,7 @@ type StoryViewers struct { TotalReactionCount int32 // List of story viewers Viewers []StoryViewer - // The offset for the next request. If empty, there are no more results + // The offset for the next request. If empty, then there are no more results NextOffset string } diff --git a/tdapi/tl_supergroup_gen.go b/tdapi/tl_supergroup_gen.go index 350f7ad1d7..50583bd24d 100644 --- a/tdapi/tl_supergroup_gen.go +++ b/tdapi/tl_supergroup_gen.go @@ -44,7 +44,7 @@ type Supergroup struct { // empty Status ChatMemberStatusClass // Number of members in the supergroup or channel; 0 if unknown. Currently, it is - // guaranteed to be known only if the supergroup or channel was received + // guaranteed to be known only if the supergroup or channel was received through MemberCount int32 // True, if the channel has a discussion group, or the supergroup is the designated // discussion group for a channel @@ -69,7 +69,7 @@ type Supergroup struct { // True, if the supergroup is a broadcast group, i.e. only administrators can send // messages and there is no limit on the number of members IsBroadcastGroup bool - // True, if the supergroup must be shown as a forum by default + // True, if the supergroup is a forum with topics IsForum bool // True, if the supergroup or channel is verified IsVerified bool diff --git a/tdapi/tl_text_quote_gen.go b/tdapi/tl_text_quote_gen.go new file mode 100644 index 0000000000..43bd73942c --- /dev/null +++ b/tdapi/tl_text_quote_gen.go @@ -0,0 +1,262 @@ +// 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{} +) + +// TextQuote represents TL type `textQuote#8675b8b2`. +type TextQuote struct { + // Text of the quote. Only Bold, Italic, Underline, Strikethrough, Spoiler, and + // CustomEmoji entities can be present in the text + Text FormattedText + // Approximate quote position in the original message in UTF-16 code units + Position int32 + // True, if the quote was manually chosen by the message sender + IsManual bool +} + +// TextQuoteTypeID is TL type id of TextQuote. +const TextQuoteTypeID = 0x8675b8b2 + +// Ensuring interfaces in compile-time for TextQuote. +var ( + _ bin.Encoder = &TextQuote{} + _ bin.Decoder = &TextQuote{} + _ bin.BareEncoder = &TextQuote{} + _ bin.BareDecoder = &TextQuote{} +) + +func (t *TextQuote) Zero() bool { + if t == nil { + return true + } + if !(t.Text.Zero()) { + return false + } + if !(t.Position == 0) { + return false + } + if !(t.IsManual == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *TextQuote) String() string { + if t == nil { + return "TextQuote(nil)" + } + type Alias TextQuote + return fmt.Sprintf("TextQuote%+v", Alias(*t)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*TextQuote) TypeID() uint32 { + return TextQuoteTypeID +} + +// TypeName returns name of type in TL schema. +func (*TextQuote) TypeName() string { + return "textQuote" +} + +// TypeInfo returns info about TL type. +func (t *TextQuote) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "textQuote", + ID: TextQuoteTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Text", + SchemaName: "text", + }, + { + Name: "Position", + SchemaName: "position", + }, + { + Name: "IsManual", + SchemaName: "is_manual", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *TextQuote) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode textQuote#8675b8b2 as nil") + } + b.PutID(TextQuoteTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *TextQuote) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode textQuote#8675b8b2 as nil") + } + if err := t.Text.Encode(b); err != nil { + return fmt.Errorf("unable to encode textQuote#8675b8b2: field text: %w", err) + } + b.PutInt32(t.Position) + b.PutBool(t.IsManual) + return nil +} + +// Decode implements bin.Decoder. +func (t *TextQuote) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode textQuote#8675b8b2 to nil") + } + if err := b.ConsumeID(TextQuoteTypeID); err != nil { + return fmt.Errorf("unable to decode textQuote#8675b8b2: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *TextQuote) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode textQuote#8675b8b2 to nil") + } + { + if err := t.Text.Decode(b); err != nil { + return fmt.Errorf("unable to decode textQuote#8675b8b2: field text: %w", err) + } + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode textQuote#8675b8b2: field position: %w", err) + } + t.Position = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode textQuote#8675b8b2: field is_manual: %w", err) + } + t.IsManual = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (t *TextQuote) EncodeTDLibJSON(b tdjson.Encoder) error { + if t == nil { + return fmt.Errorf("can't encode textQuote#8675b8b2 as nil") + } + b.ObjStart() + b.PutID("textQuote") + b.Comma() + b.FieldStart("text") + if err := t.Text.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode textQuote#8675b8b2: field text: %w", err) + } + b.Comma() + b.FieldStart("position") + b.PutInt32(t.Position) + b.Comma() + b.FieldStart("is_manual") + b.PutBool(t.IsManual) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (t *TextQuote) DecodeTDLibJSON(b tdjson.Decoder) error { + if t == nil { + return fmt.Errorf("can't decode textQuote#8675b8b2 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("textQuote"); err != nil { + return fmt.Errorf("unable to decode textQuote#8675b8b2: %w", err) + } + case "text": + if err := t.Text.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode textQuote#8675b8b2: field text: %w", err) + } + case "position": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode textQuote#8675b8b2: field position: %w", err) + } + t.Position = value + case "is_manual": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode textQuote#8675b8b2: field is_manual: %w", err) + } + t.IsManual = value + default: + return b.Skip() + } + return nil + }) +} + +// GetText returns value of Text field. +func (t *TextQuote) GetText() (value FormattedText) { + if t == nil { + return + } + return t.Text +} + +// GetPosition returns value of Position field. +func (t *TextQuote) GetPosition() (value int32) { + if t == nil { + return + } + return t.Position +} + +// GetIsManual returns value of IsManual field. +func (t *TextQuote) GetIsManual() (value bool) { + if t == nil { + return + } + return t.IsManual +} diff --git a/tdapi/tl_toggle_chat_view_as_topics_gen.go b/tdapi/tl_toggle_chat_view_as_topics_gen.go new file mode 100644 index 0000000000..c4fc61947c --- /dev/null +++ b/tdapi/tl_toggle_chat_view_as_topics_gen.go @@ -0,0 +1,237 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// ToggleChatViewAsTopicsRequest represents TL type `toggleChatViewAsTopics#2b2783dc`. +type ToggleChatViewAsTopicsRequest struct { + // Chat identifier + ChatID int64 + // New value of view_as_topics + ViewAsTopics bool +} + +// ToggleChatViewAsTopicsRequestTypeID is TL type id of ToggleChatViewAsTopicsRequest. +const ToggleChatViewAsTopicsRequestTypeID = 0x2b2783dc + +// Ensuring interfaces in compile-time for ToggleChatViewAsTopicsRequest. +var ( + _ bin.Encoder = &ToggleChatViewAsTopicsRequest{} + _ bin.Decoder = &ToggleChatViewAsTopicsRequest{} + _ bin.BareEncoder = &ToggleChatViewAsTopicsRequest{} + _ bin.BareDecoder = &ToggleChatViewAsTopicsRequest{} +) + +func (t *ToggleChatViewAsTopicsRequest) Zero() bool { + if t == nil { + return true + } + if !(t.ChatID == 0) { + return false + } + if !(t.ViewAsTopics == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *ToggleChatViewAsTopicsRequest) String() string { + if t == nil { + return "ToggleChatViewAsTopicsRequest(nil)" + } + type Alias ToggleChatViewAsTopicsRequest + return fmt.Sprintf("ToggleChatViewAsTopicsRequest%+v", Alias(*t)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ToggleChatViewAsTopicsRequest) TypeID() uint32 { + return ToggleChatViewAsTopicsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ToggleChatViewAsTopicsRequest) TypeName() string { + return "toggleChatViewAsTopics" +} + +// TypeInfo returns info about TL type. +func (t *ToggleChatViewAsTopicsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "toggleChatViewAsTopics", + ID: ToggleChatViewAsTopicsRequestTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "ViewAsTopics", + SchemaName: "view_as_topics", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *ToggleChatViewAsTopicsRequest) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode toggleChatViewAsTopics#2b2783dc as nil") + } + b.PutID(ToggleChatViewAsTopicsRequestTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *ToggleChatViewAsTopicsRequest) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode toggleChatViewAsTopics#2b2783dc as nil") + } + b.PutInt53(t.ChatID) + b.PutBool(t.ViewAsTopics) + return nil +} + +// Decode implements bin.Decoder. +func (t *ToggleChatViewAsTopicsRequest) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode toggleChatViewAsTopics#2b2783dc to nil") + } + if err := b.ConsumeID(ToggleChatViewAsTopicsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode toggleChatViewAsTopics#2b2783dc: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *ToggleChatViewAsTopicsRequest) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode toggleChatViewAsTopics#2b2783dc to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode toggleChatViewAsTopics#2b2783dc: field chat_id: %w", err) + } + t.ChatID = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode toggleChatViewAsTopics#2b2783dc: field view_as_topics: %w", err) + } + t.ViewAsTopics = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (t *ToggleChatViewAsTopicsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if t == nil { + return fmt.Errorf("can't encode toggleChatViewAsTopics#2b2783dc as nil") + } + b.ObjStart() + b.PutID("toggleChatViewAsTopics") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(t.ChatID) + b.Comma() + b.FieldStart("view_as_topics") + b.PutBool(t.ViewAsTopics) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (t *ToggleChatViewAsTopicsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if t == nil { + return fmt.Errorf("can't decode toggleChatViewAsTopics#2b2783dc to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("toggleChatViewAsTopics"); err != nil { + return fmt.Errorf("unable to decode toggleChatViewAsTopics#2b2783dc: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode toggleChatViewAsTopics#2b2783dc: field chat_id: %w", err) + } + t.ChatID = value + case "view_as_topics": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode toggleChatViewAsTopics#2b2783dc: field view_as_topics: %w", err) + } + t.ViewAsTopics = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (t *ToggleChatViewAsTopicsRequest) GetChatID() (value int64) { + if t == nil { + return + } + return t.ChatID +} + +// GetViewAsTopics returns value of ViewAsTopics field. +func (t *ToggleChatViewAsTopicsRequest) GetViewAsTopics() (value bool) { + if t == nil { + return + } + return t.ViewAsTopics +} + +// ToggleChatViewAsTopics invokes method toggleChatViewAsTopics#2b2783dc returning error if any. +func (c *Client) ToggleChatViewAsTopics(ctx context.Context, request *ToggleChatViewAsTopicsRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_update_gen.go b/tdapi/tl_update_gen.go index ab6306a546..a56f9d6f43 100644 --- a/tdapi/tl_update_gen.go +++ b/tdapi/tl_update_gen.go @@ -8486,6 +8486,206 @@ func (u *UpdateChatIsMarkedAsUnread) GetIsMarkedAsUnread() (value bool) { return u.IsMarkedAsUnread } +// UpdateChatViewAsTopics represents TL type `updateChatViewAsTopics#5bff163d`. +type UpdateChatViewAsTopics struct { + // Chat identifier + ChatID int64 + // New value of view_as_topics + ViewAsTopics bool +} + +// UpdateChatViewAsTopicsTypeID is TL type id of UpdateChatViewAsTopics. +const UpdateChatViewAsTopicsTypeID = 0x5bff163d + +// construct implements constructor of UpdateClass. +func (u UpdateChatViewAsTopics) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateChatViewAsTopics. +var ( + _ bin.Encoder = &UpdateChatViewAsTopics{} + _ bin.Decoder = &UpdateChatViewAsTopics{} + _ bin.BareEncoder = &UpdateChatViewAsTopics{} + _ bin.BareDecoder = &UpdateChatViewAsTopics{} + + _ UpdateClass = &UpdateChatViewAsTopics{} +) + +func (u *UpdateChatViewAsTopics) Zero() bool { + if u == nil { + return true + } + if !(u.ChatID == 0) { + return false + } + if !(u.ViewAsTopics == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateChatViewAsTopics) String() string { + if u == nil { + return "UpdateChatViewAsTopics(nil)" + } + type Alias UpdateChatViewAsTopics + return fmt.Sprintf("UpdateChatViewAsTopics%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateChatViewAsTopics) TypeID() uint32 { + return UpdateChatViewAsTopicsTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateChatViewAsTopics) TypeName() string { + return "updateChatViewAsTopics" +} + +// TypeInfo returns info about TL type. +func (u *UpdateChatViewAsTopics) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateChatViewAsTopics", + ID: UpdateChatViewAsTopicsTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "ViewAsTopics", + SchemaName: "view_as_topics", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateChatViewAsTopics) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateChatViewAsTopics#5bff163d as nil") + } + b.PutID(UpdateChatViewAsTopicsTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateChatViewAsTopics) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateChatViewAsTopics#5bff163d as nil") + } + b.PutInt53(u.ChatID) + b.PutBool(u.ViewAsTopics) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateChatViewAsTopics) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateChatViewAsTopics#5bff163d to nil") + } + if err := b.ConsumeID(UpdateChatViewAsTopicsTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatViewAsTopics#5bff163d: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateChatViewAsTopics) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateChatViewAsTopics#5bff163d to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode updateChatViewAsTopics#5bff163d: field chat_id: %w", err) + } + u.ChatID = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode updateChatViewAsTopics#5bff163d: field view_as_topics: %w", err) + } + u.ViewAsTopics = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpdateChatViewAsTopics) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode updateChatViewAsTopics#5bff163d as nil") + } + b.ObjStart() + b.PutID("updateChatViewAsTopics") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(u.ChatID) + b.Comma() + b.FieldStart("view_as_topics") + b.PutBool(u.ViewAsTopics) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpdateChatViewAsTopics) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode updateChatViewAsTopics#5bff163d to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("updateChatViewAsTopics"); err != nil { + return fmt.Errorf("unable to decode updateChatViewAsTopics#5bff163d: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode updateChatViewAsTopics#5bff163d: field chat_id: %w", err) + } + u.ChatID = value + case "view_as_topics": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode updateChatViewAsTopics#5bff163d: field view_as_topics: %w", err) + } + u.ViewAsTopics = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (u *UpdateChatViewAsTopics) GetChatID() (value int64) { + if u == nil { + return + } + return u.ChatID +} + +// GetViewAsTopics returns value of ViewAsTopics field. +func (u *UpdateChatViewAsTopics) GetViewAsTopics() (value bool) { + if u == nil { + return + } + return u.ViewAsTopics +} + // UpdateChatBlockList represents TL type `updateChatBlockList#872af48e`. type UpdateChatBlockList struct { // Chat identifier @@ -19752,43 +19952,39 @@ func (u *UpdateAccentColors) GetAvailableAccentColorIDs() (value []int32) { return u.AvailableAccentColorIDs } -// UpdateLanguagePackStrings represents TL type `updateLanguagePackStrings#af87919f`. -type UpdateLanguagePackStrings struct { - // Localization target to which the language pack belongs - LocalizationTarget string - // Identifier of the updated language pack - LanguagePackID string - // List of changed language pack strings; empty if all strings have changed - Strings []LanguagePackString +// UpdateProfileAccentColors represents TL type `updateProfileAccentColors#bf8e7430`. +type UpdateProfileAccentColors struct { + // Information about supported colors + Colors []ProfileAccentColor + // The list of accent color identifiers, which can be set through setProfileAccentColor. + // The colors must be shown in the specififed order + AvailableAccentColorIDs []int32 } -// UpdateLanguagePackStringsTypeID is TL type id of UpdateLanguagePackStrings. -const UpdateLanguagePackStringsTypeID = 0xaf87919f +// UpdateProfileAccentColorsTypeID is TL type id of UpdateProfileAccentColors. +const UpdateProfileAccentColorsTypeID = 0xbf8e7430 // construct implements constructor of UpdateClass. -func (u UpdateLanguagePackStrings) construct() UpdateClass { return &u } +func (u UpdateProfileAccentColors) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateLanguagePackStrings. +// Ensuring interfaces in compile-time for UpdateProfileAccentColors. var ( - _ bin.Encoder = &UpdateLanguagePackStrings{} - _ bin.Decoder = &UpdateLanguagePackStrings{} - _ bin.BareEncoder = &UpdateLanguagePackStrings{} - _ bin.BareDecoder = &UpdateLanguagePackStrings{} + _ bin.Encoder = &UpdateProfileAccentColors{} + _ bin.Decoder = &UpdateProfileAccentColors{} + _ bin.BareEncoder = &UpdateProfileAccentColors{} + _ bin.BareDecoder = &UpdateProfileAccentColors{} - _ UpdateClass = &UpdateLanguagePackStrings{} + _ UpdateClass = &UpdateProfileAccentColors{} ) -func (u *UpdateLanguagePackStrings) Zero() bool { +func (u *UpdateProfileAccentColors) Zero() bool { if u == nil { return true } - if !(u.LocalizationTarget == "") { - return false - } - if !(u.LanguagePackID == "") { + if !(u.Colors == nil) { return false } - if !(u.Strings == nil) { + if !(u.AvailableAccentColorIDs == nil) { return false } @@ -19796,31 +19992,31 @@ func (u *UpdateLanguagePackStrings) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateLanguagePackStrings) String() string { +func (u *UpdateProfileAccentColors) String() string { if u == nil { - return "UpdateLanguagePackStrings(nil)" + return "UpdateProfileAccentColors(nil)" } - type Alias UpdateLanguagePackStrings - return fmt.Sprintf("UpdateLanguagePackStrings%+v", Alias(*u)) + type Alias UpdateProfileAccentColors + return fmt.Sprintf("UpdateProfileAccentColors%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateLanguagePackStrings) TypeID() uint32 { - return UpdateLanguagePackStringsTypeID +func (*UpdateProfileAccentColors) TypeID() uint32 { + return UpdateProfileAccentColorsTypeID } // TypeName returns name of type in TL schema. -func (*UpdateLanguagePackStrings) TypeName() string { - return "updateLanguagePackStrings" +func (*UpdateProfileAccentColors) TypeName() string { + return "updateProfileAccentColors" } // TypeInfo returns info about TL type. -func (u *UpdateLanguagePackStrings) TypeInfo() tdp.Type { +func (u *UpdateProfileAccentColors) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateLanguagePackStrings", - ID: UpdateLanguagePackStringsTypeID, + Name: "updateProfileAccentColors", + ID: UpdateProfileAccentColorsTypeID, } if u == nil { typ.Null = true @@ -19828,125 +20024,382 @@ func (u *UpdateLanguagePackStrings) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "LocalizationTarget", - SchemaName: "localization_target", - }, - { - Name: "LanguagePackID", - SchemaName: "language_pack_id", + Name: "Colors", + SchemaName: "colors", }, { - Name: "Strings", - SchemaName: "strings", + Name: "AvailableAccentColorIDs", + SchemaName: "available_accent_color_ids", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateLanguagePackStrings) Encode(b *bin.Buffer) error { +func (u *UpdateProfileAccentColors) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateLanguagePackStrings#af87919f as nil") + return fmt.Errorf("can't encode updateProfileAccentColors#bf8e7430 as nil") } - b.PutID(UpdateLanguagePackStringsTypeID) + b.PutID(UpdateProfileAccentColorsTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateLanguagePackStrings) EncodeBare(b *bin.Buffer) error { +func (u *UpdateProfileAccentColors) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateLanguagePackStrings#af87919f as nil") + return fmt.Errorf("can't encode updateProfileAccentColors#bf8e7430 as nil") } - b.PutString(u.LocalizationTarget) - b.PutString(u.LanguagePackID) - b.PutInt(len(u.Strings)) - for idx, v := range u.Strings { + b.PutInt(len(u.Colors)) + for idx, v := range u.Colors { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateLanguagePackStrings#af87919f: field strings element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare updateProfileAccentColors#bf8e7430: field colors element with index %d: %w", idx, err) } } + b.PutInt(len(u.AvailableAccentColorIDs)) + for _, v := range u.AvailableAccentColorIDs { + b.PutInt32(v) + } return nil } // Decode implements bin.Decoder. -func (u *UpdateLanguagePackStrings) Decode(b *bin.Buffer) error { +func (u *UpdateProfileAccentColors) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateLanguagePackStrings#af87919f to nil") + return fmt.Errorf("can't decode updateProfileAccentColors#bf8e7430 to nil") } - if err := b.ConsumeID(UpdateLanguagePackStringsTypeID); err != nil { - return fmt.Errorf("unable to decode updateLanguagePackStrings#af87919f: %w", err) + if err := b.ConsumeID(UpdateProfileAccentColorsTypeID); err != nil { + return fmt.Errorf("unable to decode updateProfileAccentColors#bf8e7430: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateLanguagePackStrings) DecodeBare(b *bin.Buffer) error { +func (u *UpdateProfileAccentColors) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateLanguagePackStrings#af87919f to nil") + return fmt.Errorf("can't decode updateProfileAccentColors#bf8e7430 to nil") } { - value, err := b.String() + headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode updateLanguagePackStrings#af87919f: field localization_target: %w", err) + return fmt.Errorf("unable to decode updateProfileAccentColors#bf8e7430: field colors: %w", err) } - u.LocalizationTarget = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateLanguagePackStrings#af87919f: field language_pack_id: %w", err) + + if headerLen > 0 { + u.Colors = make([]ProfileAccentColor, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value ProfileAccentColor + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare updateProfileAccentColors#bf8e7430: field colors: %w", err) + } + u.Colors = append(u.Colors, value) } - u.LanguagePackID = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode updateLanguagePackStrings#af87919f: field strings: %w", err) + return fmt.Errorf("unable to decode updateProfileAccentColors#bf8e7430: field available_accent_color_ids: %w", err) } if headerLen > 0 { - u.Strings = make([]LanguagePackString, 0, headerLen%bin.PreallocateLimit) + u.AvailableAccentColorIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) } for idx := 0; idx < headerLen; idx++ { - var value LanguagePackString - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare updateLanguagePackStrings#af87919f: field strings: %w", err) + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateProfileAccentColors#bf8e7430: field available_accent_color_ids: %w", err) } - u.Strings = append(u.Strings, value) + u.AvailableAccentColorIDs = append(u.AvailableAccentColorIDs, value) } } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateLanguagePackStrings) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateProfileAccentColors) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateLanguagePackStrings#af87919f as nil") + return fmt.Errorf("can't encode updateProfileAccentColors#bf8e7430 as nil") } b.ObjStart() - b.PutID("updateLanguagePackStrings") - b.Comma() - b.FieldStart("localization_target") - b.PutString(u.LocalizationTarget) + b.PutID("updateProfileAccentColors") b.Comma() - b.FieldStart("language_pack_id") - b.PutString(u.LanguagePackID) - b.Comma() - b.FieldStart("strings") + b.FieldStart("colors") b.ArrStart() - for idx, v := range u.Strings { + for idx, v := range u.Colors { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateLanguagePackStrings#af87919f: field strings element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode updateProfileAccentColors#bf8e7430: field colors element with index %d: %w", idx, err) } b.Comma() } b.StripComma() b.ArrEnd() b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} + b.FieldStart("available_accent_color_ids") + b.ArrStart() + for _, v := range u.AvailableAccentColorIDs { + b.PutInt32(v) + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpdateProfileAccentColors) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode updateProfileAccentColors#bf8e7430 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("updateProfileAccentColors"); err != nil { + return fmt.Errorf("unable to decode updateProfileAccentColors#bf8e7430: %w", err) + } + case "colors": + if err := b.Arr(func(b tdjson.Decoder) error { + var value ProfileAccentColor + if err := value.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode updateProfileAccentColors#bf8e7430: field colors: %w", err) + } + u.Colors = append(u.Colors, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode updateProfileAccentColors#bf8e7430: field colors: %w", err) + } + case "available_accent_color_ids": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateProfileAccentColors#bf8e7430: field available_accent_color_ids: %w", err) + } + u.AvailableAccentColorIDs = append(u.AvailableAccentColorIDs, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode updateProfileAccentColors#bf8e7430: field available_accent_color_ids: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetColors returns value of Colors field. +func (u *UpdateProfileAccentColors) GetColors() (value []ProfileAccentColor) { + if u == nil { + return + } + return u.Colors +} + +// GetAvailableAccentColorIDs returns value of AvailableAccentColorIDs field. +func (u *UpdateProfileAccentColors) GetAvailableAccentColorIDs() (value []int32) { + if u == nil { + return + } + return u.AvailableAccentColorIDs +} + +// UpdateLanguagePackStrings represents TL type `updateLanguagePackStrings#af87919f`. +type UpdateLanguagePackStrings struct { + // Localization target to which the language pack belongs + LocalizationTarget string + // Identifier of the updated language pack + LanguagePackID string + // List of changed language pack strings; empty if all strings have changed + Strings []LanguagePackString +} + +// UpdateLanguagePackStringsTypeID is TL type id of UpdateLanguagePackStrings. +const UpdateLanguagePackStringsTypeID = 0xaf87919f + +// construct implements constructor of UpdateClass. +func (u UpdateLanguagePackStrings) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateLanguagePackStrings. +var ( + _ bin.Encoder = &UpdateLanguagePackStrings{} + _ bin.Decoder = &UpdateLanguagePackStrings{} + _ bin.BareEncoder = &UpdateLanguagePackStrings{} + _ bin.BareDecoder = &UpdateLanguagePackStrings{} + + _ UpdateClass = &UpdateLanguagePackStrings{} +) + +func (u *UpdateLanguagePackStrings) Zero() bool { + if u == nil { + return true + } + if !(u.LocalizationTarget == "") { + return false + } + if !(u.LanguagePackID == "") { + return false + } + if !(u.Strings == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateLanguagePackStrings) String() string { + if u == nil { + return "UpdateLanguagePackStrings(nil)" + } + type Alias UpdateLanguagePackStrings + return fmt.Sprintf("UpdateLanguagePackStrings%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateLanguagePackStrings) TypeID() uint32 { + return UpdateLanguagePackStringsTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateLanguagePackStrings) TypeName() string { + return "updateLanguagePackStrings" +} + +// TypeInfo returns info about TL type. +func (u *UpdateLanguagePackStrings) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateLanguagePackStrings", + ID: UpdateLanguagePackStringsTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "LocalizationTarget", + SchemaName: "localization_target", + }, + { + Name: "LanguagePackID", + SchemaName: "language_pack_id", + }, + { + Name: "Strings", + SchemaName: "strings", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateLanguagePackStrings) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateLanguagePackStrings#af87919f as nil") + } + b.PutID(UpdateLanguagePackStringsTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateLanguagePackStrings) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateLanguagePackStrings#af87919f as nil") + } + b.PutString(u.LocalizationTarget) + b.PutString(u.LanguagePackID) + b.PutInt(len(u.Strings)) + for idx, v := range u.Strings { + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare updateLanguagePackStrings#af87919f: field strings element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateLanguagePackStrings) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateLanguagePackStrings#af87919f to nil") + } + if err := b.ConsumeID(UpdateLanguagePackStringsTypeID); err != nil { + return fmt.Errorf("unable to decode updateLanguagePackStrings#af87919f: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateLanguagePackStrings) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateLanguagePackStrings#af87919f to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode updateLanguagePackStrings#af87919f: field localization_target: %w", err) + } + u.LocalizationTarget = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode updateLanguagePackStrings#af87919f: field language_pack_id: %w", err) + } + u.LanguagePackID = value + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateLanguagePackStrings#af87919f: field strings: %w", err) + } + + if headerLen > 0 { + u.Strings = make([]LanguagePackString, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value LanguagePackString + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare updateLanguagePackStrings#af87919f: field strings: %w", err) + } + u.Strings = append(u.Strings, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpdateLanguagePackStrings) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode updateLanguagePackStrings#af87919f as nil") + } + b.ObjStart() + b.PutID("updateLanguagePackStrings") + b.Comma() + b.FieldStart("localization_target") + b.PutString(u.LocalizationTarget) + b.Comma() + b.FieldStart("language_pack_id") + b.PutString(u.LanguagePackID) + b.Comma() + b.FieldStart("strings") + b.ArrStart() + for idx, v := range u.Strings { + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateLanguagePackStrings#af87919f: field strings element with index %d: %w", idx, err) + } + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UpdateLanguagePackStrings) DecodeTDLibJSON(b tdjson.Decoder) error { @@ -21476,6 +21929,276 @@ func (u *UpdateDefaultReactionType) GetReactionType() (value ReactionTypeClass) return u.ReactionType } +// UpdateSpeechRecognitionTrial represents TL type `updateSpeechRecognitionTrial#ff4efcc1`. +type UpdateSpeechRecognitionTrial struct { + // The maximum allowed duration of media for speech recognition without Telegram Premium + // subscription + MaxMediaDuration int32 + // The total number of allowed speech recognitions per week; 0 if none + WeeklyCount int32 + // Number of left speech recognition attempts this week + LeftCount int32 + // Point in time (Unix timestamp) when the weekly number of tries will reset; 0 if + // unknown + NextResetDate int32 +} + +// UpdateSpeechRecognitionTrialTypeID is TL type id of UpdateSpeechRecognitionTrial. +const UpdateSpeechRecognitionTrialTypeID = 0xff4efcc1 + +// construct implements constructor of UpdateClass. +func (u UpdateSpeechRecognitionTrial) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateSpeechRecognitionTrial. +var ( + _ bin.Encoder = &UpdateSpeechRecognitionTrial{} + _ bin.Decoder = &UpdateSpeechRecognitionTrial{} + _ bin.BareEncoder = &UpdateSpeechRecognitionTrial{} + _ bin.BareDecoder = &UpdateSpeechRecognitionTrial{} + + _ UpdateClass = &UpdateSpeechRecognitionTrial{} +) + +func (u *UpdateSpeechRecognitionTrial) Zero() bool { + if u == nil { + return true + } + if !(u.MaxMediaDuration == 0) { + return false + } + if !(u.WeeklyCount == 0) { + return false + } + if !(u.LeftCount == 0) { + return false + } + if !(u.NextResetDate == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateSpeechRecognitionTrial) String() string { + if u == nil { + return "UpdateSpeechRecognitionTrial(nil)" + } + type Alias UpdateSpeechRecognitionTrial + return fmt.Sprintf("UpdateSpeechRecognitionTrial%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateSpeechRecognitionTrial) TypeID() uint32 { + return UpdateSpeechRecognitionTrialTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateSpeechRecognitionTrial) TypeName() string { + return "updateSpeechRecognitionTrial" +} + +// TypeInfo returns info about TL type. +func (u *UpdateSpeechRecognitionTrial) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateSpeechRecognitionTrial", + ID: UpdateSpeechRecognitionTrialTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "MaxMediaDuration", + SchemaName: "max_media_duration", + }, + { + Name: "WeeklyCount", + SchemaName: "weekly_count", + }, + { + Name: "LeftCount", + SchemaName: "left_count", + }, + { + Name: "NextResetDate", + SchemaName: "next_reset_date", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateSpeechRecognitionTrial) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateSpeechRecognitionTrial#ff4efcc1 as nil") + } + b.PutID(UpdateSpeechRecognitionTrialTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateSpeechRecognitionTrial) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateSpeechRecognitionTrial#ff4efcc1 as nil") + } + b.PutInt32(u.MaxMediaDuration) + b.PutInt32(u.WeeklyCount) + b.PutInt32(u.LeftCount) + b.PutInt32(u.NextResetDate) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateSpeechRecognitionTrial) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateSpeechRecognitionTrial#ff4efcc1 to nil") + } + if err := b.ConsumeID(UpdateSpeechRecognitionTrialTypeID); err != nil { + return fmt.Errorf("unable to decode updateSpeechRecognitionTrial#ff4efcc1: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateSpeechRecognitionTrial) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateSpeechRecognitionTrial#ff4efcc1 to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateSpeechRecognitionTrial#ff4efcc1: field max_media_duration: %w", err) + } + u.MaxMediaDuration = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateSpeechRecognitionTrial#ff4efcc1: field weekly_count: %w", err) + } + u.WeeklyCount = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateSpeechRecognitionTrial#ff4efcc1: field left_count: %w", err) + } + u.LeftCount = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateSpeechRecognitionTrial#ff4efcc1: field next_reset_date: %w", err) + } + u.NextResetDate = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpdateSpeechRecognitionTrial) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode updateSpeechRecognitionTrial#ff4efcc1 as nil") + } + b.ObjStart() + b.PutID("updateSpeechRecognitionTrial") + b.Comma() + b.FieldStart("max_media_duration") + b.PutInt32(u.MaxMediaDuration) + b.Comma() + b.FieldStart("weekly_count") + b.PutInt32(u.WeeklyCount) + b.Comma() + b.FieldStart("left_count") + b.PutInt32(u.LeftCount) + b.Comma() + b.FieldStart("next_reset_date") + b.PutInt32(u.NextResetDate) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpdateSpeechRecognitionTrial) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode updateSpeechRecognitionTrial#ff4efcc1 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("updateSpeechRecognitionTrial"); err != nil { + return fmt.Errorf("unable to decode updateSpeechRecognitionTrial#ff4efcc1: %w", err) + } + case "max_media_duration": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateSpeechRecognitionTrial#ff4efcc1: field max_media_duration: %w", err) + } + u.MaxMediaDuration = value + case "weekly_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateSpeechRecognitionTrial#ff4efcc1: field weekly_count: %w", err) + } + u.WeeklyCount = value + case "left_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateSpeechRecognitionTrial#ff4efcc1: field left_count: %w", err) + } + u.LeftCount = value + case "next_reset_date": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateSpeechRecognitionTrial#ff4efcc1: field next_reset_date: %w", err) + } + u.NextResetDate = value + default: + return b.Skip() + } + return nil + }) +} + +// GetMaxMediaDuration returns value of MaxMediaDuration field. +func (u *UpdateSpeechRecognitionTrial) GetMaxMediaDuration() (value int32) { + if u == nil { + return + } + return u.MaxMediaDuration +} + +// GetWeeklyCount returns value of WeeklyCount field. +func (u *UpdateSpeechRecognitionTrial) GetWeeklyCount() (value int32) { + if u == nil { + return + } + return u.WeeklyCount +} + +// GetLeftCount returns value of LeftCount field. +func (u *UpdateSpeechRecognitionTrial) GetLeftCount() (value int32) { + if u == nil { + return + } + return u.LeftCount +} + +// GetNextResetDate returns value of NextResetDate field. +func (u *UpdateSpeechRecognitionTrial) GetNextResetDate() (value int32) { + if u == nil { + return + } + return u.NextResetDate +} + // UpdateDiceEmojis represents TL type `updateDiceEmojis#9d0f91df`. type UpdateDiceEmojis struct { // The new list of supported dice emojis @@ -25610,7 +26333,7 @@ type UpdateChatMember struct { ChatID int64 // Identifier of the user, changing the rights ActorUserID int64 - // Point in time (Unix timestamp) when the user rights was changed + // Point in time (Unix timestamp) when the user rights were changed Date int32 // If user has joined the chat using an invite link, the invite link; may be null InviteLink ChatInviteLink @@ -26494,6 +27217,7 @@ const UpdateClassName = "Update" // case *tdapi.UpdateChatHasProtectedContent: // updateChatHasProtectedContent#6b50071b // case *tdapi.UpdateChatIsTranslatable: // updateChatIsTranslatable#7b031617 // case *tdapi.UpdateChatIsMarkedAsUnread: // updateChatIsMarkedAsUnread#57853334 +// case *tdapi.UpdateChatViewAsTopics: // updateChatViewAsTopics#5bff163d // case *tdapi.UpdateChatBlockList: // updateChatBlockList#872af48e // case *tdapi.UpdateChatHasScheduledMessages: // updateChatHasScheduledMessages#7b14c2d7 // case *tdapi.UpdateChatFolders: // updateChatFolders#71a4b3a @@ -26547,6 +27271,7 @@ const UpdateClassName = "Update" // case *tdapi.UpdateSelectedBackground: // updateSelectedBackground#99bd205d // case *tdapi.UpdateChatThemes: // updateChatThemes#98dc58d5 // case *tdapi.UpdateAccentColors: // updateAccentColors#1316555e +// case *tdapi.UpdateProfileAccentColors: // updateProfileAccentColors#bf8e7430 // case *tdapi.UpdateLanguagePackStrings: // updateLanguagePackStrings#af87919f // case *tdapi.UpdateConnectionState: // updateConnectionState#57939e2e // case *tdapi.UpdateTermsOfService: // updateTermsOfService#b23cc55e @@ -26556,6 +27281,7 @@ const UpdateClassName = "Update" // case *tdapi.UpdateWebAppMessageSent: // updateWebAppMessageSent#58431229 // case *tdapi.UpdateActiveEmojiReactions: // updateActiveEmojiReactions#691ffcb7 // case *tdapi.UpdateDefaultReactionType: // updateDefaultReactionType#4b615105 +// case *tdapi.UpdateSpeechRecognitionTrial: // updateSpeechRecognitionTrial#ff4efcc1 // case *tdapi.UpdateDiceEmojis: // updateDiceEmojis#9d0f91df // case *tdapi.UpdateAnimatedEmojiMessageClicked: // updateAnimatedEmojiMessageClicked#a3167405 // case *tdapi.UpdateAnimationSearchParameters: // updateAnimationSearchParameters#6016ef01 @@ -26886,6 +27612,13 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case UpdateChatViewAsTopicsTypeID: + // Decoding updateChatViewAsTopics#5bff163d. + v := UpdateChatViewAsTopics{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case UpdateChatBlockListTypeID: // Decoding updateChatBlockList#872af48e. v := UpdateChatBlockList{} @@ -27257,6 +27990,13 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case UpdateProfileAccentColorsTypeID: + // Decoding updateProfileAccentColors#bf8e7430. + v := UpdateProfileAccentColors{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case UpdateLanguagePackStringsTypeID: // Decoding updateLanguagePackStrings#af87919f. v := UpdateLanguagePackStrings{} @@ -27320,6 +28060,13 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case UpdateSpeechRecognitionTrialTypeID: + // Decoding updateSpeechRecognitionTrial#ff4efcc1. + v := UpdateSpeechRecognitionTrial{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case UpdateDiceEmojisTypeID: // Decoding updateDiceEmojis#9d0f91df. v := UpdateDiceEmojis{} @@ -27745,6 +28492,13 @@ func DecodeTDLibJSONUpdate(buf tdjson.Decoder) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case "updateChatViewAsTopics": + // Decoding updateChatViewAsTopics#5bff163d. + v := UpdateChatViewAsTopics{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case "updateChatBlockList": // Decoding updateChatBlockList#872af48e. v := UpdateChatBlockList{} @@ -28116,6 +28870,13 @@ func DecodeTDLibJSONUpdate(buf tdjson.Decoder) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case "updateProfileAccentColors": + // Decoding updateProfileAccentColors#bf8e7430. + v := UpdateProfileAccentColors{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case "updateLanguagePackStrings": // Decoding updateLanguagePackStrings#af87919f. v := UpdateLanguagePackStrings{} @@ -28179,6 +28940,13 @@ func DecodeTDLibJSONUpdate(buf tdjson.Decoder) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case "updateSpeechRecognitionTrial": + // Decoding updateSpeechRecognitionTrial#ff4efcc1. + v := UpdateSpeechRecognitionTrial{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case "updateDiceEmojis": // Decoding updateDiceEmojis#9d0f91df. v := UpdateDiceEmojis{} diff --git a/tdapi/tl_user_full_info_gen.go b/tdapi/tl_user_full_info_gen.go index 60075d012a..aa173de521 100644 --- a/tdapi/tl_user_full_info_gen.go +++ b/tdapi/tl_user_full_info_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// UserFullInfo represents TL type `userFullInfo#a53c620b`. +// UserFullInfo represents TL type `userFullInfo#cc594e6f`. type UserFullInfo struct { // User profile photo set by the current user for the contact; may be null. If null and // user.profile_photo is null, then the photo is empty; otherwise, it is unknown. @@ -60,6 +60,8 @@ type UserFullInfo struct { // True, if the current user needs to explicitly allow to share their phone number with // the user when the method addContact is used NeedPhoneNumberPrivacyException bool + // True, if the user set chat background for both chat users and it wasn't reverted yet + SetChatBackground bool // A short user bio; may be null for bots Bio FormattedText // The list of available options for gifting Telegram Premium to the user @@ -72,7 +74,7 @@ type UserFullInfo struct { } // UserFullInfoTypeID is TL type id of UserFullInfo. -const UserFullInfoTypeID = 0xa53c620b +const UserFullInfoTypeID = 0xcc594e6f // Ensuring interfaces in compile-time for UserFullInfo. var ( @@ -119,6 +121,9 @@ func (u *UserFullInfo) Zero() bool { if !(u.NeedPhoneNumberPrivacyException == false) { return false } + if !(u.SetChatBackground == false) { + return false + } if !(u.Bio.Zero()) { return false } @@ -211,6 +216,10 @@ func (u *UserFullInfo) TypeInfo() tdp.Type { Name: "NeedPhoneNumberPrivacyException", SchemaName: "need_phone_number_privacy_exception", }, + { + Name: "SetChatBackground", + SchemaName: "set_chat_background", + }, { Name: "Bio", SchemaName: "bio", @@ -234,7 +243,7 @@ func (u *UserFullInfo) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (u *UserFullInfo) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode userFullInfo#a53c620b as nil") + return fmt.Errorf("can't encode userFullInfo#cc594e6f as nil") } b.PutID(UserFullInfoTypeID) return u.EncodeBare(b) @@ -243,22 +252,22 @@ func (u *UserFullInfo) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *UserFullInfo) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode userFullInfo#a53c620b as nil") + return fmt.Errorf("can't encode userFullInfo#cc594e6f as nil") } if err := u.PersonalPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#a53c620b: field personal_photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field personal_photo: %w", err) } if err := u.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#a53c620b: field photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field photo: %w", err) } if err := u.PublicPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#a53c620b: field public_photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field public_photo: %w", err) } if u.BlockList == nil { - return fmt.Errorf("unable to encode userFullInfo#a53c620b: field block_list is nil") + return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field block_list is nil") } if err := u.BlockList.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#a53c620b: field block_list: %w", err) + return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field block_list: %w", err) } b.PutBool(u.CanBeCalled) b.PutBool(u.SupportsVideoCalls) @@ -267,18 +276,19 @@ func (u *UserFullInfo) EncodeBare(b *bin.Buffer) error { b.PutBool(u.HasRestrictedVoiceAndVideoNoteMessages) b.PutBool(u.HasPinnedStories) b.PutBool(u.NeedPhoneNumberPrivacyException) + b.PutBool(u.SetChatBackground) if err := u.Bio.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#a53c620b: field bio: %w", err) + return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field bio: %w", err) } b.PutInt(len(u.PremiumGiftOptions)) for idx, v := range u.PremiumGiftOptions { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare userFullInfo#a53c620b: field premium_gift_options element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare userFullInfo#cc594e6f: field premium_gift_options element with index %d: %w", idx, err) } } b.PutInt32(u.GroupInCommonCount) if err := u.BotInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#a53c620b: field bot_info: %w", err) + return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field bot_info: %w", err) } return nil } @@ -286,10 +296,10 @@ func (u *UserFullInfo) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (u *UserFullInfo) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode userFullInfo#a53c620b to nil") + return fmt.Errorf("can't decode userFullInfo#cc594e6f to nil") } if err := b.ConsumeID(UserFullInfoTypeID); err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: %w", err) } return u.DecodeBare(b) } @@ -297,88 +307,95 @@ func (u *UserFullInfo) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *UserFullInfo) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode userFullInfo#a53c620b to nil") + return fmt.Errorf("can't decode userFullInfo#cc594e6f to nil") } { if err := u.PersonalPhoto.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field personal_photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field personal_photo: %w", err) } } { if err := u.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field photo: %w", err) } } { if err := u.PublicPhoto.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field public_photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field public_photo: %w", err) } } { value, err := DecodeBlockList(b) if err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field block_list: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field block_list: %w", err) } u.BlockList = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field can_be_called: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field can_be_called: %w", err) } u.CanBeCalled = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field supports_video_calls: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field supports_video_calls: %w", err) } u.SupportsVideoCalls = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field has_private_calls: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field has_private_calls: %w", err) } u.HasPrivateCalls = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field has_private_forwards: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field has_private_forwards: %w", err) } u.HasPrivateForwards = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field has_restricted_voice_and_video_note_messages: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field has_restricted_voice_and_video_note_messages: %w", err) } u.HasRestrictedVoiceAndVideoNoteMessages = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field has_pinned_stories: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field has_pinned_stories: %w", err) } u.HasPinnedStories = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field need_phone_number_privacy_exception: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field need_phone_number_privacy_exception: %w", err) } u.NeedPhoneNumberPrivacyException = value } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field set_chat_background: %w", err) + } + u.SetChatBackground = value + } { if err := u.Bio.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field bio: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field bio: %w", err) } } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field premium_gift_options: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field premium_gift_options: %w", err) } if headerLen > 0 { @@ -387,7 +404,7 @@ func (u *UserFullInfo) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value PremiumPaymentOption if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare userFullInfo#a53c620b: field premium_gift_options: %w", err) + return fmt.Errorf("unable to decode bare userFullInfo#cc594e6f: field premium_gift_options: %w", err) } u.PremiumGiftOptions = append(u.PremiumGiftOptions, value) } @@ -395,13 +412,13 @@ func (u *UserFullInfo) DecodeBare(b *bin.Buffer) error { { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field group_in_common_count: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field group_in_common_count: %w", err) } u.GroupInCommonCount = value } { if err := u.BotInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field bot_info: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field bot_info: %w", err) } } return nil @@ -410,32 +427,32 @@ func (u *UserFullInfo) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UserFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode userFullInfo#a53c620b as nil") + return fmt.Errorf("can't encode userFullInfo#cc594e6f as nil") } b.ObjStart() b.PutID("userFullInfo") b.Comma() b.FieldStart("personal_photo") if err := u.PersonalPhoto.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#a53c620b: field personal_photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field personal_photo: %w", err) } b.Comma() b.FieldStart("photo") if err := u.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#a53c620b: field photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field photo: %w", err) } b.Comma() b.FieldStart("public_photo") if err := u.PublicPhoto.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#a53c620b: field public_photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field public_photo: %w", err) } b.Comma() b.FieldStart("block_list") if u.BlockList == nil { - return fmt.Errorf("unable to encode userFullInfo#a53c620b: field block_list is nil") + return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field block_list is nil") } if err := u.BlockList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#a53c620b: field block_list: %w", err) + return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field block_list: %w", err) } b.Comma() b.FieldStart("can_be_called") @@ -459,16 +476,19 @@ func (u *UserFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("need_phone_number_privacy_exception") b.PutBool(u.NeedPhoneNumberPrivacyException) b.Comma() + b.FieldStart("set_chat_background") + b.PutBool(u.SetChatBackground) + b.Comma() b.FieldStart("bio") if err := u.Bio.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#a53c620b: field bio: %w", err) + return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field bio: %w", err) } b.Comma() b.FieldStart("premium_gift_options") b.ArrStart() for idx, v := range u.PremiumGiftOptions { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#a53c620b: field premium_gift_options element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field premium_gift_options element with index %d: %w", idx, err) } b.Comma() } @@ -480,7 +500,7 @@ func (u *UserFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("bot_info") if err := u.BotInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#a53c620b: field bot_info: %w", err) + return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field bot_info: %w", err) } b.Comma() b.StripComma() @@ -491,99 +511,105 @@ func (u *UserFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UserFullInfo) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode userFullInfo#a53c620b to nil") + return fmt.Errorf("can't decode userFullInfo#cc594e6f to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("userFullInfo"); err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: %w", err) } case "personal_photo": if err := u.PersonalPhoto.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field personal_photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field personal_photo: %w", err) } case "photo": if err := u.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field photo: %w", err) } case "public_photo": if err := u.PublicPhoto.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field public_photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field public_photo: %w", err) } case "block_list": value, err := DecodeTDLibJSONBlockList(b) if err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field block_list: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field block_list: %w", err) } u.BlockList = value case "can_be_called": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field can_be_called: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field can_be_called: %w", err) } u.CanBeCalled = value case "supports_video_calls": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field supports_video_calls: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field supports_video_calls: %w", err) } u.SupportsVideoCalls = value case "has_private_calls": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field has_private_calls: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field has_private_calls: %w", err) } u.HasPrivateCalls = value case "has_private_forwards": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field has_private_forwards: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field has_private_forwards: %w", err) } u.HasPrivateForwards = value case "has_restricted_voice_and_video_note_messages": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field has_restricted_voice_and_video_note_messages: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field has_restricted_voice_and_video_note_messages: %w", err) } u.HasRestrictedVoiceAndVideoNoteMessages = value case "has_pinned_stories": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field has_pinned_stories: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field has_pinned_stories: %w", err) } u.HasPinnedStories = value case "need_phone_number_privacy_exception": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field need_phone_number_privacy_exception: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field need_phone_number_privacy_exception: %w", err) } u.NeedPhoneNumberPrivacyException = value + case "set_chat_background": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field set_chat_background: %w", err) + } + u.SetChatBackground = value case "bio": if err := u.Bio.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field bio: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field bio: %w", err) } case "premium_gift_options": if err := b.Arr(func(b tdjson.Decoder) error { var value PremiumPaymentOption if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field premium_gift_options: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field premium_gift_options: %w", err) } u.PremiumGiftOptions = append(u.PremiumGiftOptions, value) return nil }); err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field premium_gift_options: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field premium_gift_options: %w", err) } case "group_in_common_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field group_in_common_count: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field group_in_common_count: %w", err) } u.GroupInCommonCount = value case "bot_info": if err := u.BotInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#a53c620b: field bot_info: %w", err) + return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field bot_info: %w", err) } default: return b.Skip() @@ -680,6 +706,14 @@ func (u *UserFullInfo) GetNeedPhoneNumberPrivacyException() (value bool) { return u.NeedPhoneNumberPrivacyException } +// GetSetChatBackground returns value of SetChatBackground field. +func (u *UserFullInfo) GetSetChatBackground() (value bool) { + if u == nil { + return + } + return u.SetChatBackground +} + // GetBio returns value of Bio field. func (u *UserFullInfo) GetBio() (value FormattedText) { if u == nil { diff --git a/tdapi/tl_user_gen.go b/tdapi/tl_user_gen.go index 30132d2752..7bfa3227a0 100644 --- a/tdapi/tl_user_gen.go +++ b/tdapi/tl_user_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// User represents TL type `user#e39ad80a`. +// User represents TL type `user#cd8cf8ac`. type User struct { // User identifier ID int64 @@ -48,11 +48,17 @@ type User struct { // Profile photo of the user; may be null ProfilePhoto ProfilePhoto // Identifier of the accent color for name, and backgrounds of profile photo, reply - // header, and link preview + // header, and link preview. For Telegram Premium users only AccentColorID int32 // Identifier of a custom emoji to be shown on the reply header background; 0 if none. // For Telegram Premium users only BackgroundCustomEmojiID int64 + // Identifier of the accent color for the user's profile; -1 if none. For Telegram + // Premium users only + ProfileAccentColorID int32 + // Identifier of a custom emoji to be shown on the background of the user's profile; 0 if + // none. For Telegram Premium users only + ProfileBackgroundCustomEmojiID int64 // Emoji status to be shown instead of the default Telegram Premium badge; may be null. // For Telegram Premium users only EmojiStatus EmojiStatus @@ -92,7 +98,7 @@ type User struct { } // UserTypeID is TL type id of User. -const UserTypeID = 0xe39ad80a +const UserTypeID = 0xcd8cf8ac // Ensuring interfaces in compile-time for User. var ( @@ -133,6 +139,12 @@ func (u *User) Zero() bool { if !(u.BackgroundCustomEmojiID == 0) { return false } + if !(u.ProfileAccentColorID == 0) { + return false + } + if !(u.ProfileBackgroundCustomEmojiID == 0) { + return false + } if !(u.EmojiStatus.Zero()) { return false } @@ -253,6 +265,14 @@ func (u *User) TypeInfo() tdp.Type { Name: "BackgroundCustomEmojiID", SchemaName: "background_custom_emoji_id", }, + { + Name: "ProfileAccentColorID", + SchemaName: "profile_accent_color_id", + }, + { + Name: "ProfileBackgroundCustomEmojiID", + SchemaName: "profile_background_custom_emoji_id", + }, { Name: "EmojiStatus", SchemaName: "emoji_status", @@ -324,7 +344,7 @@ func (u *User) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (u *User) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode user#e39ad80a as nil") + return fmt.Errorf("can't encode user#cd8cf8ac as nil") } b.PutID(UserTypeID) return u.EncodeBare(b) @@ -333,28 +353,30 @@ func (u *User) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *User) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode user#e39ad80a as nil") + return fmt.Errorf("can't encode user#cd8cf8ac as nil") } b.PutInt53(u.ID) b.PutString(u.FirstName) b.PutString(u.LastName) if err := u.Usernames.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#e39ad80a: field usernames: %w", err) + return fmt.Errorf("unable to encode user#cd8cf8ac: field usernames: %w", err) } b.PutString(u.PhoneNumber) if u.Status == nil { - return fmt.Errorf("unable to encode user#e39ad80a: field status is nil") + return fmt.Errorf("unable to encode user#cd8cf8ac: field status is nil") } if err := u.Status.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#e39ad80a: field status: %w", err) + return fmt.Errorf("unable to encode user#cd8cf8ac: field status: %w", err) } if err := u.ProfilePhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#e39ad80a: field profile_photo: %w", err) + return fmt.Errorf("unable to encode user#cd8cf8ac: field profile_photo: %w", err) } b.PutInt32(u.AccentColorID) b.PutLong(u.BackgroundCustomEmojiID) + b.PutInt32(u.ProfileAccentColorID) + b.PutLong(u.ProfileBackgroundCustomEmojiID) if err := u.EmojiStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#e39ad80a: field emoji_status: %w", err) + return fmt.Errorf("unable to encode user#cd8cf8ac: field emoji_status: %w", err) } b.PutBool(u.IsContact) b.PutBool(u.IsMutualContact) @@ -369,10 +391,10 @@ func (u *User) EncodeBare(b *bin.Buffer) error { b.PutBool(u.HasUnreadActiveStories) b.PutBool(u.HaveAccess) if u.Type == nil { - return fmt.Errorf("unable to encode user#e39ad80a: field type is nil") + return fmt.Errorf("unable to encode user#cd8cf8ac: field type is nil") } if err := u.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#e39ad80a: field type: %w", err) + return fmt.Errorf("unable to encode user#cd8cf8ac: field type: %w", err) } b.PutString(u.LanguageCode) b.PutBool(u.AddedToAttachmentMenu) @@ -382,10 +404,10 @@ func (u *User) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (u *User) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode user#e39ad80a to nil") + return fmt.Errorf("can't decode user#cd8cf8ac to nil") } if err := b.ConsumeID(UserTypeID); err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: %w", err) } return u.DecodeBare(b) } @@ -393,174 +415,188 @@ func (u *User) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *User) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode user#e39ad80a to nil") + return fmt.Errorf("can't decode user#cd8cf8ac to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field id: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field id: %w", err) } u.ID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field first_name: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field first_name: %w", err) } u.FirstName = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field last_name: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field last_name: %w", err) } u.LastName = value } { if err := u.Usernames.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field usernames: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field usernames: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field phone_number: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field phone_number: %w", err) } u.PhoneNumber = value } { value, err := DecodeUserStatus(b) if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field status: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field status: %w", err) } u.Status = value } { if err := u.ProfilePhoto.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field profile_photo: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field profile_photo: %w", err) } } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field accent_color_id: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field accent_color_id: %w", err) } u.AccentColorID = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field background_custom_emoji_id: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field background_custom_emoji_id: %w", err) } u.BackgroundCustomEmojiID = value } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode user#cd8cf8ac: field profile_accent_color_id: %w", err) + } + u.ProfileAccentColorID = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode user#cd8cf8ac: field profile_background_custom_emoji_id: %w", err) + } + u.ProfileBackgroundCustomEmojiID = value + } { if err := u.EmojiStatus.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field emoji_status: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field emoji_status: %w", err) } } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field is_contact: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field is_contact: %w", err) } u.IsContact = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field is_mutual_contact: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field is_mutual_contact: %w", err) } u.IsMutualContact = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field is_close_friend: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field is_close_friend: %w", err) } u.IsCloseFriend = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field is_verified: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field is_verified: %w", err) } u.IsVerified = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field is_premium: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field is_premium: %w", err) } u.IsPremium = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field is_support: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field is_support: %w", err) } u.IsSupport = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field restriction_reason: %w", err) } u.RestrictionReason = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field is_scam: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field is_scam: %w", err) } u.IsScam = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field is_fake: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field is_fake: %w", err) } u.IsFake = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field has_active_stories: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field has_active_stories: %w", err) } u.HasActiveStories = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field has_unread_active_stories: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field has_unread_active_stories: %w", err) } u.HasUnreadActiveStories = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field have_access: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field have_access: %w", err) } u.HaveAccess = value } { value, err := DecodeUserType(b) if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field type: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field type: %w", err) } u.Type = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field language_code: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field language_code: %w", err) } u.LanguageCode = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field added_to_attachment_menu: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field added_to_attachment_menu: %w", err) } u.AddedToAttachmentMenu = value } @@ -570,7 +606,7 @@ func (u *User) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode user#e39ad80a as nil") + return fmt.Errorf("can't encode user#cd8cf8ac as nil") } b.ObjStart() b.PutID("user") @@ -586,7 +622,7 @@ func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("usernames") if err := u.Usernames.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#e39ad80a: field usernames: %w", err) + return fmt.Errorf("unable to encode user#cd8cf8ac: field usernames: %w", err) } b.Comma() b.FieldStart("phone_number") @@ -594,15 +630,15 @@ func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("status") if u.Status == nil { - return fmt.Errorf("unable to encode user#e39ad80a: field status is nil") + return fmt.Errorf("unable to encode user#cd8cf8ac: field status is nil") } if err := u.Status.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#e39ad80a: field status: %w", err) + return fmt.Errorf("unable to encode user#cd8cf8ac: field status: %w", err) } b.Comma() b.FieldStart("profile_photo") if err := u.ProfilePhoto.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#e39ad80a: field profile_photo: %w", err) + return fmt.Errorf("unable to encode user#cd8cf8ac: field profile_photo: %w", err) } b.Comma() b.FieldStart("accent_color_id") @@ -611,9 +647,15 @@ func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("background_custom_emoji_id") b.PutLong(u.BackgroundCustomEmojiID) b.Comma() + b.FieldStart("profile_accent_color_id") + b.PutInt32(u.ProfileAccentColorID) + b.Comma() + b.FieldStart("profile_background_custom_emoji_id") + b.PutLong(u.ProfileBackgroundCustomEmojiID) + b.Comma() b.FieldStart("emoji_status") if err := u.EmojiStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#e39ad80a: field emoji_status: %w", err) + return fmt.Errorf("unable to encode user#cd8cf8ac: field emoji_status: %w", err) } b.Comma() b.FieldStart("is_contact") @@ -654,10 +696,10 @@ func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("type") if u.Type == nil { - return fmt.Errorf("unable to encode user#e39ad80a: field type is nil") + return fmt.Errorf("unable to encode user#cd8cf8ac: field type is nil") } if err := u.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#e39ad80a: field type: %w", err) + return fmt.Errorf("unable to encode user#cd8cf8ac: field type: %w", err) } b.Comma() b.FieldStart("language_code") @@ -674,157 +716,169 @@ func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *User) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode user#e39ad80a to nil") + return fmt.Errorf("can't decode user#cd8cf8ac to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("user"); err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: %w", err) } case "id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field id: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field id: %w", err) } u.ID = value case "first_name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field first_name: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field first_name: %w", err) } u.FirstName = value case "last_name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field last_name: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field last_name: %w", err) } u.LastName = value case "usernames": if err := u.Usernames.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field usernames: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field usernames: %w", err) } case "phone_number": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field phone_number: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field phone_number: %w", err) } u.PhoneNumber = value case "status": value, err := DecodeTDLibJSONUserStatus(b) if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field status: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field status: %w", err) } u.Status = value case "profile_photo": if err := u.ProfilePhoto.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field profile_photo: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field profile_photo: %w", err) } case "accent_color_id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field accent_color_id: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field accent_color_id: %w", err) } u.AccentColorID = value case "background_custom_emoji_id": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field background_custom_emoji_id: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field background_custom_emoji_id: %w", err) } u.BackgroundCustomEmojiID = value + case "profile_accent_color_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode user#cd8cf8ac: field profile_accent_color_id: %w", err) + } + u.ProfileAccentColorID = value + case "profile_background_custom_emoji_id": + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode user#cd8cf8ac: field profile_background_custom_emoji_id: %w", err) + } + u.ProfileBackgroundCustomEmojiID = value case "emoji_status": if err := u.EmojiStatus.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field emoji_status: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field emoji_status: %w", err) } case "is_contact": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field is_contact: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field is_contact: %w", err) } u.IsContact = value case "is_mutual_contact": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field is_mutual_contact: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field is_mutual_contact: %w", err) } u.IsMutualContact = value case "is_close_friend": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field is_close_friend: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field is_close_friend: %w", err) } u.IsCloseFriend = value case "is_verified": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field is_verified: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field is_verified: %w", err) } u.IsVerified = value case "is_premium": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field is_premium: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field is_premium: %w", err) } u.IsPremium = value case "is_support": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field is_support: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field is_support: %w", err) } u.IsSupport = value case "restriction_reason": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field restriction_reason: %w", err) } u.RestrictionReason = value case "is_scam": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field is_scam: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field is_scam: %w", err) } u.IsScam = value case "is_fake": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field is_fake: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field is_fake: %w", err) } u.IsFake = value case "has_active_stories": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field has_active_stories: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field has_active_stories: %w", err) } u.HasActiveStories = value case "has_unread_active_stories": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field has_unread_active_stories: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field has_unread_active_stories: %w", err) } u.HasUnreadActiveStories = value case "have_access": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field have_access: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field have_access: %w", err) } u.HaveAccess = value case "type": value, err := DecodeTDLibJSONUserType(b) if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field type: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field type: %w", err) } u.Type = value case "language_code": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field language_code: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field language_code: %w", err) } u.LanguageCode = value case "added_to_attachment_menu": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#e39ad80a: field added_to_attachment_menu: %w", err) + return fmt.Errorf("unable to decode user#cd8cf8ac: field added_to_attachment_menu: %w", err) } u.AddedToAttachmentMenu = value default: @@ -906,6 +960,22 @@ func (u *User) GetBackgroundCustomEmojiID() (value int64) { return u.BackgroundCustomEmojiID } +// GetProfileAccentColorID returns value of ProfileAccentColorID field. +func (u *User) GetProfileAccentColorID() (value int32) { + if u == nil { + return + } + return u.ProfileAccentColorID +} + +// GetProfileBackgroundCustomEmojiID returns value of ProfileBackgroundCustomEmojiID field. +func (u *User) GetProfileBackgroundCustomEmojiID() (value int64) { + if u == nil { + return + } + return u.ProfileBackgroundCustomEmojiID +} + // GetEmojiStatus returns value of EmojiStatus field. func (u *User) GetEmojiStatus() (value EmojiStatus) { if u == nil {