diff --git a/_schema/tdapi.tl b/_schema/tdapi.tl index e0a5c389db..e40019246d 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: 42f55ed5d40f0429913c9485aa57b5b7db6c703772ef4e7832de930882d2e14b +// SHA256: b084771cd2e20e1cc227082ee83b733cbeae423fc68a7dc41cb944ff63d1be40 double#2210c154 ? = Double; @@ -585,6 +585,69 @@ botMenuButton#c7b57ce6 text:string url:string = BotMenuButton; //@address Location address; 1-64 characters, as defined by the chat owner chatLocation#a29b8f21 location:location address:string = ChatLocation; +//@class BusinessAwayMessageSchedule @description Describes conditions for sending of away messages by a Telegram Business account + +//@description Send away messages always +businessAwayMessageScheduleAlways#c9b9e2b9 = BusinessAwayMessageSchedule; + +//@description Send away messages outside of the business opening hours +businessAwayMessageScheduleOutsideOfOpeningHours#c643df16 = BusinessAwayMessageSchedule; + +//@description Send away messages only in the specified time span +//@start_date Point in time (Unix timestamp) when the away messages will start to be sent +//@end_date Point in time (Unix timestamp) when the away messages will stop to be sent +businessAwayMessageScheduleCustom#8ac04dd2 start_date:int32 end_date:int32 = BusinessAwayMessageSchedule; + +//@description Represents a location of a business +//@location The location; may be null if not specified +//@address Location address; 1-96 characters +businessLocation#bf54af5a location:location address:string = BusinessLocation; + +//@description Describes private chats chosen for automatic interaction with a business +//@chat_ids Identifiers of selected private chats +//@select_existing_chats True, if all existing private chats are selected +//@select_new_chats True, if all new private chats are selected +//@select_contacts True, if all private chats with contacts are selected +//@select_non_contacts True, if all private chats with non-contacts are selected +//@exclude_selected If true, then all private chats except the selected are chosen. Otherwise, only the selected chats are chosen +businessRecipients#2f3ca54a chat_ids:vector select_existing_chats:Bool select_new_chats:Bool select_contacts:Bool select_non_contacts:Bool exclude_selected:Bool = BusinessRecipients; + +//@description Describes settings for messages that are automatically sent by a Telegram Business account when it is away +//@shortcut_id Unique quick reply shortcut identifier for the away messages +//@recipients Chosen recipients of the away messages +//@schedule Settings used to check whether the current user is away +//@offline_only True, if the messages must not be sent if the account was online in the last 10 minutes +businessAwayMessageSettings#150ba2e9 shortcut_id:int32 recipients:businessRecipients schedule:BusinessAwayMessageSchedule offline_only:Bool = BusinessAwayMessageSettings; + +//@description Describes settings for greeting messages that are automatically sent by a Telegram Business account as response to incoming messages in an inactive private chat +//@shortcut_id Unique quick reply shortcut identifier for the greeting messages +//@recipients Chosen recipients of the greeting messages +//@inactivity_days The number of days after which a chat will be considered as inactive; currently, must be on of 7, 14, 21, or 28 +businessGreetingMessageSettings#64ae3e12 shortcut_id:int32 recipients:businessRecipients inactivity_days:int32 = BusinessGreetingMessageSettings; + +//@description Describes a bot connected to a business account +//@bot_user_id User identifier of the bot +//@recipients Private chats that will be accessible to the bot +//@can_reply True, if the bot can send messages to the private chats; false otherwise +businessConnectedBot#ec50ead7 bot_user_id:int53 recipients:businessRecipients can_reply:Bool = BusinessConnectedBot; + +//@description Describes an interval of time when the business is open +//@start_minute The first minute of the interval since start of the week; 0-7*24*60 +//@end_minute The first minute after the end of the interval since start of the week; 1-8*24*60 +businessOpeningHoursInterval#bdf05654 start_minute:int32 end_minute:int32 = BusinessOpeningHoursInterval; + +//@description Describes opening hours of a business +//@time_zone_id Unique time zone identifier +//@opening_hours Intervals of the time when the business is open +businessOpeningHours#a623e64a time_zone_id:string opening_hours:vector = BusinessOpeningHours; + +//@description Contains information about a Telegram Business account +//@location Location of the business; may be null if none +//@opening_hours Opening hours of the business; may be null if none. The hours are guaranteed to be valid and has already been split by week days +//@greeting_message_settings The greeting message; may be null if none or the Business account is not of the current user +//@away_message_settings The away message; may be null if none or the Business account is not of the current user +businessInfo#773c5066 location:businessLocation opening_hours:businessOpeningHours greeting_message_settings:businessGreetingMessageSettings away_message_settings:businessAwayMessageSettings = BusinessInfo; + //@class ChatPhotoStickerType @description Describes type of a sticker, which was used to create a chat photo //@description Information about the sticker, which was used to create the chat photo @@ -851,8 +914,9 @@ botInfo#bfdb89a short_description:string description:string photo:photo animatio //@bio A short user bio; may be null for bots //@premium_gift_options The list of available options for gifting Telegram Premium to the user //@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user +//@business_info Information about business settings for Telegram Business accounts; may be null if none //@bot_info For bots, information about the bot; may be null if the user isn't a bot -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; +userFullInfo#760faed8 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 business_info:businessInfo bot_info:botInfo = UserFullInfo; //@description Represents a list of users //@total_count Approximate total number of users found @@ -1597,6 +1661,7 @@ chatFolderIcon#f74aa0e6 name:string = ChatFolderIcon; //@description Represents a folder for user chats //@title The title of the folder; 1-12 characters without line feeds //@icon The chosen icon for the chat folder; may be null. If null, use getChatFolderDefaultIconName to get default icon name for the folder +//@color_id The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is didabled //@is_shareable True, if at least one link has been created for the folder //@pinned_chat_ids The chat identifiers of pinned chats in the folder. There can be up to getOption("chat_folder_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium //@included_chat_ids The chat identifiers of always included chats in the folder. There can be up to getOption("chat_folder_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium @@ -1609,15 +1674,16 @@ chatFolderIcon#f74aa0e6 name:string = ChatFolderIcon; //@include_bots True, if bots need to be included //@include_groups True, if basic groups and supergroups need to be included //@include_channels True, if channels need to be included -chatFolder#aa7d5740 title:string icon:chatFolderIcon is_shareable:Bool pinned_chat_ids:vector included_chat_ids:vector excluded_chat_ids:vector exclude_muted:Bool exclude_read:Bool exclude_archived:Bool include_contacts:Bool include_non_contacts:Bool include_bots:Bool include_groups:Bool include_channels:Bool = ChatFolder; +chatFolder#65805ba5 title:string icon:chatFolderIcon color_id:int32 is_shareable:Bool pinned_chat_ids:vector included_chat_ids:vector excluded_chat_ids:vector exclude_muted:Bool exclude_read:Bool exclude_archived:Bool include_contacts:Bool include_non_contacts:Bool include_bots:Bool include_groups:Bool include_channels:Bool = ChatFolder; //@description Contains basic information about a chat folder //@id Unique chat folder identifier //@title The title of the folder; 1-12 characters without line feeds //@icon The chosen or default icon for the chat folder +//@color_id The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is didabled //@is_shareable True, if at least one link has been created for the folder //@has_my_invite_links True, if the chat folder has invite links created by the current user -chatFolderInfo#4c3ee0d4 id:int32 title:string icon:chatFolderIcon is_shareable:Bool has_my_invite_links:Bool = ChatFolderInfo; +chatFolderInfo#b61a485 id:int32 title:string icon:chatFolderIcon color_id:int32 is_shareable:Bool has_my_invite_links:Bool = ChatFolderInfo; //@description Contains a chat folder invite link //@invite_link The chat folder invite link @@ -1720,6 +1786,7 @@ videoChat#ae158d28 group_call_id:int32 has_participants:Bool default_participant //@permissions Actions that non-administrator chat members are allowed to take in the chat //@last_message Last message in the chat; may be null if none or unknown //@positions Positions of the chat in chat lists +//@chat_lists Chat lists to which the chat belongs. A chat can have a non-zero position in a chat list even it doesn't belong to the chat list and have no position in a chat list even it belongs to the chat list //@message_sender_id Identifier of a user or chat that is selected to send messages in the chat; may be null if the user can't change message sender //@block_list Block list to which the chat is added; may be null if none //@has_protected_content True, if chat content can't be saved locally, forwarded, or copied @@ -1748,7 +1815,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#70f33afe id:int53 type:ChatType title:string photo:chatPhotoInfo accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_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 emoji_status:emojiStatus 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#57f1ba4 id:int53 type:ChatType title:string photo:chatPhotoInfo accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 permissions:chatPermissions last_message:message positions:vector chat_lists: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 emoji_status:emojiStatus 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 @@ -3959,6 +4026,24 @@ storyInteraction#d624d222 actor_id:MessageSender interaction_date:int32 block_li //@next_offset The offset for the next request. If empty, then there are no more results storyInteractions#f9f5d50f total_count:int32 total_forward_count:int32 total_reaction_count:int32 interactions:vector next_offset:string = StoryInteractions; +//@description Describes a message that can be used for quick reply +//@id Unique message identifier among all quick replies +//@sending_state The sending state of the message; may be null if the message isn't being sent and didn't fail to be sent +//@can_be_edited True, if the message can be edited +//@reply_to_message_id Information about the identifier of the quick reply message to which the message replies +//@via_bot_user_id If non-zero, the user identifier of the bot through which this message was sent +//@media_album_id Unique identifier of an album this message belongs to. Only audios, documents, photos and videos can be grouped together in albums +//@content Content of the message +//@reply_markup Inline keyboard reply markup for the message; may be null if none +quickReplyMessage#bef92f03 id:int53 sending_state:MessageSendingState can_be_edited:Bool reply_to_message_id:int53 via_bot_user_id:int53 media_album_id:int64 content:MessageContent reply_markup:ReplyMarkup = QuickReplyMessage; + +//@description Describes a shortcut that can be used for a quick reply +//@id Unique shortcut identifier +//@name The name of the shortcut that can be used to use the shortcut +//@first_message The first shortcut message +//@message_count The total number of messages in the shortcut +quickReplyShortcut#bdfd9a95 id:int32 name:string first_message:quickReplyMessage message_count:int32 = QuickReplyShortcut; + //@class PublicForward @description Describes a public forward or repost of a story //@description Contains a public forward as a message @@ -5382,6 +5467,16 @@ themeSettings#fc4c1c12 accent_color:int32 background:background outgoing_message //@dark_settings Theme settings for a dark chat theme chatTheme#f9406c39 name:string light_settings:themeSettings dark_settings:themeSettings = ChatTheme; +//@description Describes a time zone +//@id Unique time zone identifier +//@name Time zone name +//@utc_time_offset Current UTC time offset for the time zone +timeZone#b919f2dd id:string name:string utc_time_offset:int32 = TimeZone; + +//@description Contains a list of time zones +//@time_zones A list of time zones +timeZones#7c4881b9 time_zones:vector = TimeZones; + //@description Contains a list of hashtags //@hashtags A list of hashtags hashtags#6c2c0ae1 hashtags:vector = Hashtags; @@ -6867,6 +6962,16 @@ updateChatLastMessage#f10cab1d chat_id:int53 last_message:message positions:vect //@position New chat position. If new order is 0, then the chat needs to be removed from the list updateChatPosition#ff76fa77 chat_id:int53 position:chatPosition = Update; +//@description A chat was added to a chat list +//@chat_id Chat identifier +//@chat_list The chat list to which the chat was added +updateChatAddedToList#ab7004ec chat_id:int53 chat_list:ChatList = Update; + +//@description A chat was removed from a chat list +//@chat_id Chat identifier +//@chat_list The chat list from which the chat was removed +updateChatRemovedFromList#4d2ac21c chat_id:int53 chat_list:ChatList = Update; + //@description Incoming messages were read or the number of unread messages has been changed //@chat_id Chat identifier //@last_read_inbox_message_id Identifier of the last read incoming message @@ -6987,7 +7092,8 @@ updateChatHasScheduledMessages#7b14c2d7 chat_id:int53 has_scheduled_messages:Boo //@description The list of chat folders or a chat folder has changed //@chat_folders The new list of chat folders //@main_chat_list_position Position of the main chat list among chat folders, 0-based -updateChatFolders#71a4b3a chat_folders:vector main_chat_list_position:int32 = Update; +//@are_tags_enabled True, if folder tags are enabled +updateChatFolders#e110242a chat_folders:vector main_chat_list_position:int32 are_tags_enabled:Bool = Update; //@description The number of online group members has changed. This update with non-zero number of online group members is sent only for currently opened chats. //@chat_id Identifier of the chat @@ -7002,6 +7108,23 @@ updateSavedMessagesTopic#9f823b30 topic:savedMessagesTopic = Update; //@topic_count Approximate total number of Saved Messages topics updateSavedMessagesTopicCount#fbd279d1 topic_count:int32 = Update; +//@description Basic information about a quick reply shortcut has changed. This update is guaranteed to come before the quick shortcut name is returned to the application +//@shortcut New data about the shortcut +updateQuickReplyShortcut#c69338cf shortcut:quickReplyShortcut = Update; + +//@description A quick reply shortcut and all its messages were deleted +//@shortcut_id The identifier of the deleted shortcut +updateQuickReplyShortcutDeleted#e8b9bc3a shortcut_id:int32 = Update; + +//@description The list of quick reply shortcuts has changed +//@shortcut_ids The new list of identifiers of quick reply shortcuts +updateQuickReplyShortcuts#77d31a6a shortcut_ids:vector = Update; + +//@description The list of quick reply shortcut messages has changed +//@shortcut_id The identifier of the shortcut +//@messages The new list of quick reply messages for the shortcut in order from the first to the last sent +updateQuickReplyShortcutMessages#8bb36b72 shortcut_id:int32 messages:vector = Update; + //@description Basic information about a topic in a forum chat was changed //@chat_id Chat identifier //@info New information about the topic @@ -8139,6 +8262,12 @@ sendInlineQueryResultMessage#467c5478 chat_id:int53 message_thread_id:int53 repl //@remove_caption Pass true to remove media captions of message copies. Ignored if send_copy is false forwardMessages#34de5b20 chat_id:int53 message_thread_id:int53 from_chat_id:int53 message_ids:vector options:messageSendOptions send_copy:Bool remove_caption:Bool = Messages; +//@description Sends messages from a quick reply shortcut. Requires Telegram Business subscription +//@chat_id Identifier of the chat to which to send messages. The chat must be a private chat with a regular user +//@shortcut_id Unique identifier of the quick reply shortcut +//@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates +sendQuickReplyShortcutMessages#dd5169d chat_id:int53 shortcut_id:int32 sending_id:int32 = Messages; + //@description Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. //@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 @@ -8244,6 +8373,35 @@ editInlineMessageReplyMarkup#fbf906de inline_message_id:string reply_markup:Repl //@scheduling_state The new message scheduling state; pass null to send the message immediately editMessageSchedulingState#ae2a0bc0 chat_id:int53 message_id:int53 scheduling_state:MessageSchedulingState = Ok; +//@description Checks validness of a name for a quick reply shortcut. Can be called synchronously +//@name The name of the shortcut; 1-32 characters +checkQuickReplyShortcutName#7d3dd129 name:string = Ok; + +//@description Loads quick reply shortcuts created by the current user. The loaded topics will be sent through updateQuickReplyShortcuts +loadQuickReplyShortcuts#c367b29d = Ok; + +//@description Changes name of a quick reply shortcut +//@shortcut_id Unique identifier of the quick reply shortcut +//@name New name for the shortcut. Use checkQuickReplyShortcutName to check its validness +setQuickReplyShortcutName#b20f471 shortcut_id:int32 name:string = Ok; + +//@description Deletes a quick reply shortcut +//@shortcut_id Unique identifier of the quick reply shortcut +deleteQuickReplyShortcut#f1486c16 shortcut_id:int32 = Ok; + +//@description Changes the order of quick reply shortcuts +//@shortcut_ids The new order of quick reply shortcuts +reorderQuickReplyShortcuts#b04981c4 shortcut_ids:vector = Ok; + +//@description Loads quick reply messages that can be sent by a given quick reply shortcut. The loaded messages will be sent through updateQuickReplyShortcutMessages +//@shortcut_id Unique identifier of the quick reply shortcut +loadQuickReplyShortcutMessages#fd40aed4 shortcut_id:int32 = Ok; + +//@description Deletes specified quick reply messages +//@shortcut_id Unique identifier of the quick reply shortcut to which the messages belong +//@message_ids Unique identifiers of the messages +deleteQuickReplyShortcutMessages#e859fcbb shortcut_id:int32 message_ids:vector = Ok; + //@description Returns list of custom emojis, which can be used as forum topic icon by all users getForumTopicDefaultIcons#583574dc = Stickers; @@ -8754,6 +8912,10 @@ getChatFolderChatCount#7dd4cbbe folder:chatFolder = Count; //@main_chat_list_position Position of the main chat list among chat folders, 0-based. Can be non-zero only for Premium users reorderChatFolders#59544c32 chat_folder_ids:vector main_chat_list_position:int32 = Ok; +//@description Toggles whether chat folder tags are enabled +//@are_tags_enabled Pass true to enable folder tags; pass false to disable them +toggleChatFolderTags#834b6c44 are_tags_enabled:Bool = Ok; + //@description Returns recommended chat folders for the current user getRecommendedChatFolders#f7533b87 = RecommendedChatFolders; @@ -9967,10 +10129,26 @@ reorderActiveUsernames#c659414f usernames:vector = Ok; //@emoji_status New emoji status; pass null to switch to the default badge setEmojiStatus#92f83e5d emoji_status:emojiStatus = Ok; -//@description Changes the location of the current user. Needs to be called if getOption("is_location_visible") is true and location changes for more than 1 kilometer +//@description Changes the location of the current user. Needs to be called if getOption("is_location_visible") is true and location changes for more than 1 kilometer. Must not be called if the user has a business location //@location The new location of the user setLocation#5993371 location:location = Ok; +//@description Changes the business location of the current user. Requires Telegram Business subscription +//@location The new location of the business; pass null to remove the location +setBusinessLocation#eb740715 location:businessLocation = Ok; + +//@description Changes the business opening hours of the current user. Requires Telegram Business subscription +//@opening_hours The new opening hours of the business; pass null to remove the opening hours +setBusinessOpeningHours#e470a472 opening_hours:businessOpeningHours = Ok; + +//@description Changes the business greeting message settings of the current user. Requires Telegram Business subscription +//@greeting_message_settings The new settings for the greeting message of the business; pass null to disable the greeting message +setBusinessGreetingMessageSettings#cbf53c3d greeting_message_settings:businessGreetingMessageSettings = Ok; + +//@description Changes the business away message settings of the current user. Requires Telegram Business subscription +//@away_message_settings The new settings for the away message of the business; pass null to disable the away message +setBusinessAwayMessageSettings#4974486c away_message_settings:businessAwayMessageSettings = Ok; + //@description Changes the phone number of the user and sends an authentication code to the user's new phone number; for official Android and iOS applications only. On success, returns information about the sent code //@phone_number The new phone number of the user in international format //@settings Settings for the authentication of the user's phone number; pass null to use default settings @@ -9983,6 +10161,17 @@ resendChangePhoneNumberCode#d11acfa4 = AuthenticationCodeInfo; //@code Authentication code to check checkChangePhoneNumberCode#9976a263 code:string = Ok; +//@description Returns the business bot that is connected to the current user account. Returns a 404 error if there is no connected bot +getBusinessConnectedBot#364da7c3 = BusinessConnectedBot; + +//@description Adds or changes business bot that is connected to the current user account +//@bot Connection settings for the bot +setBusinessConnectedBot#acf17ef0 bot:businessConnectedBot = Ok; + +//@description Deletes the business bot that is connected to the current user account +//@bot_user_id Unique user identifier for the bot +deleteBusinessConnectedBot#9e9b7e55 bot_user_id:int53 = Ok; + //@description Returns an HTTPS link, which can be used to get information about the current user getUserLink#492014e6 = UserLink; @@ -10228,6 +10417,9 @@ closeSecretChat#e3ed044b secret_chat_id:int32 = Ok; //@user_ids User identifiers by which to filter events. By default, events relating to all users will be returned getChatEventLog#f47b0a9b chat_id:int53 query:string from_event_id:int64 limit:int32 filters:chatEventLogFilters user_ids:vector = ChatEvents; +//@description Returns the list of supported time zones +getTimeZones#4fe2e058 = TimeZones; + //@description Returns an invoice payment form. This method must be called when the user presses inline button of the type inlineKeyboardButtonTypeBuy //@input_invoice The invoice //@theme Preferred payment form theme; pass null to use the default theme diff --git a/tdapi/tl_business_away_message_schedule_gen.go b/tdapi/tl_business_away_message_schedule_gen.go new file mode 100644 index 0000000000..b1b5aa6d87 --- /dev/null +++ b/tdapi/tl_business_away_message_schedule_gen.go @@ -0,0 +1,648 @@ +// 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{} +) + +// BusinessAwayMessageScheduleAlways represents TL type `businessAwayMessageScheduleAlways#c9b9e2b9`. +type BusinessAwayMessageScheduleAlways struct { +} + +// BusinessAwayMessageScheduleAlwaysTypeID is TL type id of BusinessAwayMessageScheduleAlways. +const BusinessAwayMessageScheduleAlwaysTypeID = 0xc9b9e2b9 + +// construct implements constructor of BusinessAwayMessageScheduleClass. +func (b BusinessAwayMessageScheduleAlways) construct() BusinessAwayMessageScheduleClass { return &b } + +// Ensuring interfaces in compile-time for BusinessAwayMessageScheduleAlways. +var ( + _ bin.Encoder = &BusinessAwayMessageScheduleAlways{} + _ bin.Decoder = &BusinessAwayMessageScheduleAlways{} + _ bin.BareEncoder = &BusinessAwayMessageScheduleAlways{} + _ bin.BareDecoder = &BusinessAwayMessageScheduleAlways{} + + _ BusinessAwayMessageScheduleClass = &BusinessAwayMessageScheduleAlways{} +) + +func (b *BusinessAwayMessageScheduleAlways) Zero() bool { + if b == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (b *BusinessAwayMessageScheduleAlways) String() string { + if b == nil { + return "BusinessAwayMessageScheduleAlways(nil)" + } + type Alias BusinessAwayMessageScheduleAlways + return fmt.Sprintf("BusinessAwayMessageScheduleAlways%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BusinessAwayMessageScheduleAlways) TypeID() uint32 { + return BusinessAwayMessageScheduleAlwaysTypeID +} + +// TypeName returns name of type in TL schema. +func (*BusinessAwayMessageScheduleAlways) TypeName() string { + return "businessAwayMessageScheduleAlways" +} + +// TypeInfo returns info about TL type. +func (b *BusinessAwayMessageScheduleAlways) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "businessAwayMessageScheduleAlways", + ID: BusinessAwayMessageScheduleAlwaysTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (b *BusinessAwayMessageScheduleAlways) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessAwayMessageScheduleAlways#c9b9e2b9 as nil") + } + buf.PutID(BusinessAwayMessageScheduleAlwaysTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BusinessAwayMessageScheduleAlways) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessAwayMessageScheduleAlways#c9b9e2b9 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (b *BusinessAwayMessageScheduleAlways) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessAwayMessageScheduleAlways#c9b9e2b9 to nil") + } + if err := buf.ConsumeID(BusinessAwayMessageScheduleAlwaysTypeID); err != nil { + return fmt.Errorf("unable to decode businessAwayMessageScheduleAlways#c9b9e2b9: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BusinessAwayMessageScheduleAlways) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessAwayMessageScheduleAlways#c9b9e2b9 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BusinessAwayMessageScheduleAlways) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode businessAwayMessageScheduleAlways#c9b9e2b9 as nil") + } + buf.ObjStart() + buf.PutID("businessAwayMessageScheduleAlways") + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BusinessAwayMessageScheduleAlways) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode businessAwayMessageScheduleAlways#c9b9e2b9 to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("businessAwayMessageScheduleAlways"); err != nil { + return fmt.Errorf("unable to decode businessAwayMessageScheduleAlways#c9b9e2b9: %w", err) + } + default: + return buf.Skip() + } + return nil + }) +} + +// BusinessAwayMessageScheduleOutsideOfOpeningHours represents TL type `businessAwayMessageScheduleOutsideOfOpeningHours#c643df16`. +type BusinessAwayMessageScheduleOutsideOfOpeningHours struct { +} + +// BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID is TL type id of BusinessAwayMessageScheduleOutsideOfOpeningHours. +const BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID = 0xc643df16 + +// construct implements constructor of BusinessAwayMessageScheduleClass. +func (b BusinessAwayMessageScheduleOutsideOfOpeningHours) construct() BusinessAwayMessageScheduleClass { + return &b +} + +// Ensuring interfaces in compile-time for BusinessAwayMessageScheduleOutsideOfOpeningHours. +var ( + _ bin.Encoder = &BusinessAwayMessageScheduleOutsideOfOpeningHours{} + _ bin.Decoder = &BusinessAwayMessageScheduleOutsideOfOpeningHours{} + _ bin.BareEncoder = &BusinessAwayMessageScheduleOutsideOfOpeningHours{} + _ bin.BareDecoder = &BusinessAwayMessageScheduleOutsideOfOpeningHours{} + + _ BusinessAwayMessageScheduleClass = &BusinessAwayMessageScheduleOutsideOfOpeningHours{} +) + +func (b *BusinessAwayMessageScheduleOutsideOfOpeningHours) Zero() bool { + if b == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (b *BusinessAwayMessageScheduleOutsideOfOpeningHours) String() string { + if b == nil { + return "BusinessAwayMessageScheduleOutsideOfOpeningHours(nil)" + } + type Alias BusinessAwayMessageScheduleOutsideOfOpeningHours + return fmt.Sprintf("BusinessAwayMessageScheduleOutsideOfOpeningHours%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BusinessAwayMessageScheduleOutsideOfOpeningHours) TypeID() uint32 { + return BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID +} + +// TypeName returns name of type in TL schema. +func (*BusinessAwayMessageScheduleOutsideOfOpeningHours) TypeName() string { + return "businessAwayMessageScheduleOutsideOfOpeningHours" +} + +// TypeInfo returns info about TL type. +func (b *BusinessAwayMessageScheduleOutsideOfOpeningHours) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "businessAwayMessageScheduleOutsideOfOpeningHours", + ID: BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (b *BusinessAwayMessageScheduleOutsideOfOpeningHours) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessAwayMessageScheduleOutsideOfOpeningHours#c643df16 as nil") + } + buf.PutID(BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BusinessAwayMessageScheduleOutsideOfOpeningHours) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessAwayMessageScheduleOutsideOfOpeningHours#c643df16 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (b *BusinessAwayMessageScheduleOutsideOfOpeningHours) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessAwayMessageScheduleOutsideOfOpeningHours#c643df16 to nil") + } + if err := buf.ConsumeID(BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID); err != nil { + return fmt.Errorf("unable to decode businessAwayMessageScheduleOutsideOfOpeningHours#c643df16: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BusinessAwayMessageScheduleOutsideOfOpeningHours) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessAwayMessageScheduleOutsideOfOpeningHours#c643df16 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BusinessAwayMessageScheduleOutsideOfOpeningHours) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode businessAwayMessageScheduleOutsideOfOpeningHours#c643df16 as nil") + } + buf.ObjStart() + buf.PutID("businessAwayMessageScheduleOutsideOfOpeningHours") + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BusinessAwayMessageScheduleOutsideOfOpeningHours) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode businessAwayMessageScheduleOutsideOfOpeningHours#c643df16 to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("businessAwayMessageScheduleOutsideOfOpeningHours"); err != nil { + return fmt.Errorf("unable to decode businessAwayMessageScheduleOutsideOfOpeningHours#c643df16: %w", err) + } + default: + return buf.Skip() + } + return nil + }) +} + +// BusinessAwayMessageScheduleCustom represents TL type `businessAwayMessageScheduleCustom#8ac04dd2`. +type BusinessAwayMessageScheduleCustom struct { + // Point in time (Unix timestamp) when the away messages will start to be sent + StartDate int32 + // Point in time (Unix timestamp) when the away messages will stop to be sent + EndDate int32 +} + +// BusinessAwayMessageScheduleCustomTypeID is TL type id of BusinessAwayMessageScheduleCustom. +const BusinessAwayMessageScheduleCustomTypeID = 0x8ac04dd2 + +// construct implements constructor of BusinessAwayMessageScheduleClass. +func (b BusinessAwayMessageScheduleCustom) construct() BusinessAwayMessageScheduleClass { return &b } + +// Ensuring interfaces in compile-time for BusinessAwayMessageScheduleCustom. +var ( + _ bin.Encoder = &BusinessAwayMessageScheduleCustom{} + _ bin.Decoder = &BusinessAwayMessageScheduleCustom{} + _ bin.BareEncoder = &BusinessAwayMessageScheduleCustom{} + _ bin.BareDecoder = &BusinessAwayMessageScheduleCustom{} + + _ BusinessAwayMessageScheduleClass = &BusinessAwayMessageScheduleCustom{} +) + +func (b *BusinessAwayMessageScheduleCustom) Zero() bool { + if b == nil { + return true + } + if !(b.StartDate == 0) { + return false + } + if !(b.EndDate == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BusinessAwayMessageScheduleCustom) String() string { + if b == nil { + return "BusinessAwayMessageScheduleCustom(nil)" + } + type Alias BusinessAwayMessageScheduleCustom + return fmt.Sprintf("BusinessAwayMessageScheduleCustom%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BusinessAwayMessageScheduleCustom) TypeID() uint32 { + return BusinessAwayMessageScheduleCustomTypeID +} + +// TypeName returns name of type in TL schema. +func (*BusinessAwayMessageScheduleCustom) TypeName() string { + return "businessAwayMessageScheduleCustom" +} + +// TypeInfo returns info about TL type. +func (b *BusinessAwayMessageScheduleCustom) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "businessAwayMessageScheduleCustom", + ID: BusinessAwayMessageScheduleCustomTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "StartDate", + SchemaName: "start_date", + }, + { + Name: "EndDate", + SchemaName: "end_date", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BusinessAwayMessageScheduleCustom) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessAwayMessageScheduleCustom#8ac04dd2 as nil") + } + buf.PutID(BusinessAwayMessageScheduleCustomTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BusinessAwayMessageScheduleCustom) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessAwayMessageScheduleCustom#8ac04dd2 as nil") + } + buf.PutInt32(b.StartDate) + buf.PutInt32(b.EndDate) + return nil +} + +// Decode implements bin.Decoder. +func (b *BusinessAwayMessageScheduleCustom) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessAwayMessageScheduleCustom#8ac04dd2 to nil") + } + if err := buf.ConsumeID(BusinessAwayMessageScheduleCustomTypeID); err != nil { + return fmt.Errorf("unable to decode businessAwayMessageScheduleCustom#8ac04dd2: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BusinessAwayMessageScheduleCustom) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessAwayMessageScheduleCustom#8ac04dd2 to nil") + } + { + value, err := buf.Int32() + if err != nil { + return fmt.Errorf("unable to decode businessAwayMessageScheduleCustom#8ac04dd2: field start_date: %w", err) + } + b.StartDate = value + } + { + value, err := buf.Int32() + if err != nil { + return fmt.Errorf("unable to decode businessAwayMessageScheduleCustom#8ac04dd2: field end_date: %w", err) + } + b.EndDate = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BusinessAwayMessageScheduleCustom) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode businessAwayMessageScheduleCustom#8ac04dd2 as nil") + } + buf.ObjStart() + buf.PutID("businessAwayMessageScheduleCustom") + buf.Comma() + buf.FieldStart("start_date") + buf.PutInt32(b.StartDate) + buf.Comma() + buf.FieldStart("end_date") + buf.PutInt32(b.EndDate) + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BusinessAwayMessageScheduleCustom) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode businessAwayMessageScheduleCustom#8ac04dd2 to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("businessAwayMessageScheduleCustom"); err != nil { + return fmt.Errorf("unable to decode businessAwayMessageScheduleCustom#8ac04dd2: %w", err) + } + case "start_date": + value, err := buf.Int32() + if err != nil { + return fmt.Errorf("unable to decode businessAwayMessageScheduleCustom#8ac04dd2: field start_date: %w", err) + } + b.StartDate = value + case "end_date": + value, err := buf.Int32() + if err != nil { + return fmt.Errorf("unable to decode businessAwayMessageScheduleCustom#8ac04dd2: field end_date: %w", err) + } + b.EndDate = value + default: + return buf.Skip() + } + return nil + }) +} + +// GetStartDate returns value of StartDate field. +func (b *BusinessAwayMessageScheduleCustom) GetStartDate() (value int32) { + if b == nil { + return + } + return b.StartDate +} + +// GetEndDate returns value of EndDate field. +func (b *BusinessAwayMessageScheduleCustom) GetEndDate() (value int32) { + if b == nil { + return + } + return b.EndDate +} + +// BusinessAwayMessageScheduleClassName is schema name of BusinessAwayMessageScheduleClass. +const BusinessAwayMessageScheduleClassName = "BusinessAwayMessageSchedule" + +// BusinessAwayMessageScheduleClass represents BusinessAwayMessageSchedule generic type. +// +// Example: +// +// g, err := tdapi.DecodeBusinessAwayMessageSchedule(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tdapi.BusinessAwayMessageScheduleAlways: // businessAwayMessageScheduleAlways#c9b9e2b9 +// case *tdapi.BusinessAwayMessageScheduleOutsideOfOpeningHours: // businessAwayMessageScheduleOutsideOfOpeningHours#c643df16 +// case *tdapi.BusinessAwayMessageScheduleCustom: // businessAwayMessageScheduleCustom#8ac04dd2 +// default: panic(v) +// } +type BusinessAwayMessageScheduleClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() BusinessAwayMessageScheduleClass + + // 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 +} + +// DecodeBusinessAwayMessageSchedule implements binary de-serialization for BusinessAwayMessageScheduleClass. +func DecodeBusinessAwayMessageSchedule(buf *bin.Buffer) (BusinessAwayMessageScheduleClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case BusinessAwayMessageScheduleAlwaysTypeID: + // Decoding businessAwayMessageScheduleAlways#c9b9e2b9. + v := BusinessAwayMessageScheduleAlways{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode BusinessAwayMessageScheduleClass: %w", err) + } + return &v, nil + case BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID: + // Decoding businessAwayMessageScheduleOutsideOfOpeningHours#c643df16. + v := BusinessAwayMessageScheduleOutsideOfOpeningHours{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode BusinessAwayMessageScheduleClass: %w", err) + } + return &v, nil + case BusinessAwayMessageScheduleCustomTypeID: + // Decoding businessAwayMessageScheduleCustom#8ac04dd2. + v := BusinessAwayMessageScheduleCustom{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode BusinessAwayMessageScheduleClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode BusinessAwayMessageScheduleClass: %w", bin.NewUnexpectedID(id)) + } +} + +// DecodeTDLibJSONBusinessAwayMessageSchedule implements binary de-serialization for BusinessAwayMessageScheduleClass. +func DecodeTDLibJSONBusinessAwayMessageSchedule(buf tdjson.Decoder) (BusinessAwayMessageScheduleClass, error) { + id, err := buf.FindTypeID() + if err != nil { + return nil, err + } + switch id { + case "businessAwayMessageScheduleAlways": + // Decoding businessAwayMessageScheduleAlways#c9b9e2b9. + v := BusinessAwayMessageScheduleAlways{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode BusinessAwayMessageScheduleClass: %w", err) + } + return &v, nil + case "businessAwayMessageScheduleOutsideOfOpeningHours": + // Decoding businessAwayMessageScheduleOutsideOfOpeningHours#c643df16. + v := BusinessAwayMessageScheduleOutsideOfOpeningHours{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode BusinessAwayMessageScheduleClass: %w", err) + } + return &v, nil + case "businessAwayMessageScheduleCustom": + // Decoding businessAwayMessageScheduleCustom#8ac04dd2. + v := BusinessAwayMessageScheduleCustom{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode BusinessAwayMessageScheduleClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode BusinessAwayMessageScheduleClass: %w", tdjson.NewUnexpectedID(id)) + } +} + +// BusinessAwayMessageSchedule boxes the BusinessAwayMessageScheduleClass providing a helper. +type BusinessAwayMessageScheduleBox struct { + BusinessAwayMessageSchedule BusinessAwayMessageScheduleClass +} + +// Decode implements bin.Decoder for BusinessAwayMessageScheduleBox. +func (b *BusinessAwayMessageScheduleBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode BusinessAwayMessageScheduleBox to nil") + } + v, err := DecodeBusinessAwayMessageSchedule(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.BusinessAwayMessageSchedule = v + return nil +} + +// Encode implements bin.Encode for BusinessAwayMessageScheduleBox. +func (b *BusinessAwayMessageScheduleBox) Encode(buf *bin.Buffer) error { + if b == nil || b.BusinessAwayMessageSchedule == nil { + return fmt.Errorf("unable to encode BusinessAwayMessageScheduleClass as nil") + } + return b.BusinessAwayMessageSchedule.Encode(buf) +} + +// DecodeTDLibJSON implements bin.Decoder for BusinessAwayMessageScheduleBox. +func (b *BusinessAwayMessageScheduleBox) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("unable to decode BusinessAwayMessageScheduleBox to nil") + } + v, err := DecodeTDLibJSONBusinessAwayMessageSchedule(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.BusinessAwayMessageSchedule = v + return nil +} + +// EncodeTDLibJSON implements bin.Encode for BusinessAwayMessageScheduleBox. +func (b *BusinessAwayMessageScheduleBox) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil || b.BusinessAwayMessageSchedule == nil { + return fmt.Errorf("unable to encode BusinessAwayMessageScheduleClass as nil") + } + return b.BusinessAwayMessageSchedule.EncodeTDLibJSON(buf) +} diff --git a/tdapi/tl_business_away_message_settings_gen.go b/tdapi/tl_business_away_message_settings_gen.go new file mode 100644 index 0000000000..8e78f86e11 --- /dev/null +++ b/tdapi/tl_business_away_message_settings_gen.go @@ -0,0 +1,306 @@ +// 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{} +) + +// BusinessAwayMessageSettings represents TL type `businessAwayMessageSettings#150ba2e9`. +type BusinessAwayMessageSettings struct { + // Unique quick reply shortcut identifier for the away messages + ShortcutID int32 + // Chosen recipients of the away messages + Recipients BusinessRecipients + // Settings used to check whether the current user is away + Schedule BusinessAwayMessageScheduleClass + // True, if the messages must not be sent if the account was online in the last 10 + // minutes + OfflineOnly bool +} + +// BusinessAwayMessageSettingsTypeID is TL type id of BusinessAwayMessageSettings. +const BusinessAwayMessageSettingsTypeID = 0x150ba2e9 + +// Ensuring interfaces in compile-time for BusinessAwayMessageSettings. +var ( + _ bin.Encoder = &BusinessAwayMessageSettings{} + _ bin.Decoder = &BusinessAwayMessageSettings{} + _ bin.BareEncoder = &BusinessAwayMessageSettings{} + _ bin.BareDecoder = &BusinessAwayMessageSettings{} +) + +func (b *BusinessAwayMessageSettings) Zero() bool { + if b == nil { + return true + } + if !(b.ShortcutID == 0) { + return false + } + if !(b.Recipients.Zero()) { + return false + } + if !(b.Schedule == nil) { + return false + } + if !(b.OfflineOnly == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BusinessAwayMessageSettings) String() string { + if b == nil { + return "BusinessAwayMessageSettings(nil)" + } + type Alias BusinessAwayMessageSettings + return fmt.Sprintf("BusinessAwayMessageSettings%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BusinessAwayMessageSettings) TypeID() uint32 { + return BusinessAwayMessageSettingsTypeID +} + +// TypeName returns name of type in TL schema. +func (*BusinessAwayMessageSettings) TypeName() string { + return "businessAwayMessageSettings" +} + +// TypeInfo returns info about TL type. +func (b *BusinessAwayMessageSettings) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "businessAwayMessageSettings", + ID: BusinessAwayMessageSettingsTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + { + Name: "Recipients", + SchemaName: "recipients", + }, + { + Name: "Schedule", + SchemaName: "schedule", + }, + { + Name: "OfflineOnly", + SchemaName: "offline_only", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BusinessAwayMessageSettings) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessAwayMessageSettings#150ba2e9 as nil") + } + buf.PutID(BusinessAwayMessageSettingsTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BusinessAwayMessageSettings) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessAwayMessageSettings#150ba2e9 as nil") + } + buf.PutInt32(b.ShortcutID) + if err := b.Recipients.Encode(buf); err != nil { + return fmt.Errorf("unable to encode businessAwayMessageSettings#150ba2e9: field recipients: %w", err) + } + if b.Schedule == nil { + return fmt.Errorf("unable to encode businessAwayMessageSettings#150ba2e9: field schedule is nil") + } + if err := b.Schedule.Encode(buf); err != nil { + return fmt.Errorf("unable to encode businessAwayMessageSettings#150ba2e9: field schedule: %w", err) + } + buf.PutBool(b.OfflineOnly) + return nil +} + +// Decode implements bin.Decoder. +func (b *BusinessAwayMessageSettings) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessAwayMessageSettings#150ba2e9 to nil") + } + if err := buf.ConsumeID(BusinessAwayMessageSettingsTypeID); err != nil { + return fmt.Errorf("unable to decode businessAwayMessageSettings#150ba2e9: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BusinessAwayMessageSettings) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessAwayMessageSettings#150ba2e9 to nil") + } + { + value, err := buf.Int32() + if err != nil { + return fmt.Errorf("unable to decode businessAwayMessageSettings#150ba2e9: field shortcut_id: %w", err) + } + b.ShortcutID = value + } + { + if err := b.Recipients.Decode(buf); err != nil { + return fmt.Errorf("unable to decode businessAwayMessageSettings#150ba2e9: field recipients: %w", err) + } + } + { + value, err := DecodeBusinessAwayMessageSchedule(buf) + if err != nil { + return fmt.Errorf("unable to decode businessAwayMessageSettings#150ba2e9: field schedule: %w", err) + } + b.Schedule = value + } + { + value, err := buf.Bool() + if err != nil { + return fmt.Errorf("unable to decode businessAwayMessageSettings#150ba2e9: field offline_only: %w", err) + } + b.OfflineOnly = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BusinessAwayMessageSettings) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode businessAwayMessageSettings#150ba2e9 as nil") + } + buf.ObjStart() + buf.PutID("businessAwayMessageSettings") + buf.Comma() + buf.FieldStart("shortcut_id") + buf.PutInt32(b.ShortcutID) + buf.Comma() + buf.FieldStart("recipients") + if err := b.Recipients.EncodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to encode businessAwayMessageSettings#150ba2e9: field recipients: %w", err) + } + buf.Comma() + buf.FieldStart("schedule") + if b.Schedule == nil { + return fmt.Errorf("unable to encode businessAwayMessageSettings#150ba2e9: field schedule is nil") + } + if err := b.Schedule.EncodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to encode businessAwayMessageSettings#150ba2e9: field schedule: %w", err) + } + buf.Comma() + buf.FieldStart("offline_only") + buf.PutBool(b.OfflineOnly) + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BusinessAwayMessageSettings) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode businessAwayMessageSettings#150ba2e9 to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("businessAwayMessageSettings"); err != nil { + return fmt.Errorf("unable to decode businessAwayMessageSettings#150ba2e9: %w", err) + } + case "shortcut_id": + value, err := buf.Int32() + if err != nil { + return fmt.Errorf("unable to decode businessAwayMessageSettings#150ba2e9: field shortcut_id: %w", err) + } + b.ShortcutID = value + case "recipients": + if err := b.Recipients.DecodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to decode businessAwayMessageSettings#150ba2e9: field recipients: %w", err) + } + case "schedule": + value, err := DecodeTDLibJSONBusinessAwayMessageSchedule(buf) + if err != nil { + return fmt.Errorf("unable to decode businessAwayMessageSettings#150ba2e9: field schedule: %w", err) + } + b.Schedule = value + case "offline_only": + value, err := buf.Bool() + if err != nil { + return fmt.Errorf("unable to decode businessAwayMessageSettings#150ba2e9: field offline_only: %w", err) + } + b.OfflineOnly = value + default: + return buf.Skip() + } + return nil + }) +} + +// GetShortcutID returns value of ShortcutID field. +func (b *BusinessAwayMessageSettings) GetShortcutID() (value int32) { + if b == nil { + return + } + return b.ShortcutID +} + +// GetRecipients returns value of Recipients field. +func (b *BusinessAwayMessageSettings) GetRecipients() (value BusinessRecipients) { + if b == nil { + return + } + return b.Recipients +} + +// GetSchedule returns value of Schedule field. +func (b *BusinessAwayMessageSettings) GetSchedule() (value BusinessAwayMessageScheduleClass) { + if b == nil { + return + } + return b.Schedule +} + +// GetOfflineOnly returns value of OfflineOnly field. +func (b *BusinessAwayMessageSettings) GetOfflineOnly() (value bool) { + if b == nil { + return + } + return b.OfflineOnly +} diff --git a/tdapi/tl_business_connected_bot_gen.go b/tdapi/tl_business_connected_bot_gen.go new file mode 100644 index 0000000000..b0a8721b93 --- /dev/null +++ b/tdapi/tl_business_connected_bot_gen.go @@ -0,0 +1,261 @@ +// 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{} +) + +// BusinessConnectedBot represents TL type `businessConnectedBot#ec50ead7`. +type BusinessConnectedBot struct { + // User identifier of the bot + BotUserID int64 + // Private chats that will be accessible to the bot + Recipients BusinessRecipients + // True, if the bot can send messages to the private chats; false otherwise + CanReply bool +} + +// BusinessConnectedBotTypeID is TL type id of BusinessConnectedBot. +const BusinessConnectedBotTypeID = 0xec50ead7 + +// Ensuring interfaces in compile-time for BusinessConnectedBot. +var ( + _ bin.Encoder = &BusinessConnectedBot{} + _ bin.Decoder = &BusinessConnectedBot{} + _ bin.BareEncoder = &BusinessConnectedBot{} + _ bin.BareDecoder = &BusinessConnectedBot{} +) + +func (b *BusinessConnectedBot) Zero() bool { + if b == nil { + return true + } + if !(b.BotUserID == 0) { + return false + } + if !(b.Recipients.Zero()) { + return false + } + if !(b.CanReply == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BusinessConnectedBot) String() string { + if b == nil { + return "BusinessConnectedBot(nil)" + } + type Alias BusinessConnectedBot + return fmt.Sprintf("BusinessConnectedBot%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BusinessConnectedBot) TypeID() uint32 { + return BusinessConnectedBotTypeID +} + +// TypeName returns name of type in TL schema. +func (*BusinessConnectedBot) TypeName() string { + return "businessConnectedBot" +} + +// TypeInfo returns info about TL type. +func (b *BusinessConnectedBot) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "businessConnectedBot", + ID: BusinessConnectedBotTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "BotUserID", + SchemaName: "bot_user_id", + }, + { + Name: "Recipients", + SchemaName: "recipients", + }, + { + Name: "CanReply", + SchemaName: "can_reply", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BusinessConnectedBot) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessConnectedBot#ec50ead7 as nil") + } + buf.PutID(BusinessConnectedBotTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BusinessConnectedBot) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessConnectedBot#ec50ead7 as nil") + } + buf.PutInt53(b.BotUserID) + if err := b.Recipients.Encode(buf); err != nil { + return fmt.Errorf("unable to encode businessConnectedBot#ec50ead7: field recipients: %w", err) + } + buf.PutBool(b.CanReply) + return nil +} + +// Decode implements bin.Decoder. +func (b *BusinessConnectedBot) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessConnectedBot#ec50ead7 to nil") + } + if err := buf.ConsumeID(BusinessConnectedBotTypeID); err != nil { + return fmt.Errorf("unable to decode businessConnectedBot#ec50ead7: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BusinessConnectedBot) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessConnectedBot#ec50ead7 to nil") + } + { + value, err := buf.Int53() + if err != nil { + return fmt.Errorf("unable to decode businessConnectedBot#ec50ead7: field bot_user_id: %w", err) + } + b.BotUserID = value + } + { + if err := b.Recipients.Decode(buf); err != nil { + return fmt.Errorf("unable to decode businessConnectedBot#ec50ead7: field recipients: %w", err) + } + } + { + value, err := buf.Bool() + if err != nil { + return fmt.Errorf("unable to decode businessConnectedBot#ec50ead7: field can_reply: %w", err) + } + b.CanReply = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BusinessConnectedBot) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode businessConnectedBot#ec50ead7 as nil") + } + buf.ObjStart() + buf.PutID("businessConnectedBot") + buf.Comma() + buf.FieldStart("bot_user_id") + buf.PutInt53(b.BotUserID) + buf.Comma() + buf.FieldStart("recipients") + if err := b.Recipients.EncodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to encode businessConnectedBot#ec50ead7: field recipients: %w", err) + } + buf.Comma() + buf.FieldStart("can_reply") + buf.PutBool(b.CanReply) + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BusinessConnectedBot) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode businessConnectedBot#ec50ead7 to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("businessConnectedBot"); err != nil { + return fmt.Errorf("unable to decode businessConnectedBot#ec50ead7: %w", err) + } + case "bot_user_id": + value, err := buf.Int53() + if err != nil { + return fmt.Errorf("unable to decode businessConnectedBot#ec50ead7: field bot_user_id: %w", err) + } + b.BotUserID = value + case "recipients": + if err := b.Recipients.DecodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to decode businessConnectedBot#ec50ead7: field recipients: %w", err) + } + case "can_reply": + value, err := buf.Bool() + if err != nil { + return fmt.Errorf("unable to decode businessConnectedBot#ec50ead7: field can_reply: %w", err) + } + b.CanReply = value + default: + return buf.Skip() + } + return nil + }) +} + +// GetBotUserID returns value of BotUserID field. +func (b *BusinessConnectedBot) GetBotUserID() (value int64) { + if b == nil { + return + } + return b.BotUserID +} + +// GetRecipients returns value of Recipients field. +func (b *BusinessConnectedBot) GetRecipients() (value BusinessRecipients) { + if b == nil { + return + } + return b.Recipients +} + +// GetCanReply returns value of CanReply field. +func (b *BusinessConnectedBot) GetCanReply() (value bool) { + if b == nil { + return + } + return b.CanReply +} diff --git a/tdapi/tl_business_greeting_message_settings_gen.go b/tdapi/tl_business_greeting_message_settings_gen.go new file mode 100644 index 0000000000..5dd79860b4 --- /dev/null +++ b/tdapi/tl_business_greeting_message_settings_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{} +) + +// BusinessGreetingMessageSettings represents TL type `businessGreetingMessageSettings#64ae3e12`. +type BusinessGreetingMessageSettings struct { + // Unique quick reply shortcut identifier for the greeting messages + ShortcutID int32 + // Chosen recipients of the greeting messages + Recipients BusinessRecipients + // The number of days after which a chat will be considered as inactive; currently, must + // be on of 7, 14, 21, or 28 + InactivityDays int32 +} + +// BusinessGreetingMessageSettingsTypeID is TL type id of BusinessGreetingMessageSettings. +const BusinessGreetingMessageSettingsTypeID = 0x64ae3e12 + +// Ensuring interfaces in compile-time for BusinessGreetingMessageSettings. +var ( + _ bin.Encoder = &BusinessGreetingMessageSettings{} + _ bin.Decoder = &BusinessGreetingMessageSettings{} + _ bin.BareEncoder = &BusinessGreetingMessageSettings{} + _ bin.BareDecoder = &BusinessGreetingMessageSettings{} +) + +func (b *BusinessGreetingMessageSettings) Zero() bool { + if b == nil { + return true + } + if !(b.ShortcutID == 0) { + return false + } + if !(b.Recipients.Zero()) { + return false + } + if !(b.InactivityDays == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BusinessGreetingMessageSettings) String() string { + if b == nil { + return "BusinessGreetingMessageSettings(nil)" + } + type Alias BusinessGreetingMessageSettings + return fmt.Sprintf("BusinessGreetingMessageSettings%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BusinessGreetingMessageSettings) TypeID() uint32 { + return BusinessGreetingMessageSettingsTypeID +} + +// TypeName returns name of type in TL schema. +func (*BusinessGreetingMessageSettings) TypeName() string { + return "businessGreetingMessageSettings" +} + +// TypeInfo returns info about TL type. +func (b *BusinessGreetingMessageSettings) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "businessGreetingMessageSettings", + ID: BusinessGreetingMessageSettingsTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + { + Name: "Recipients", + SchemaName: "recipients", + }, + { + Name: "InactivityDays", + SchemaName: "inactivity_days", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BusinessGreetingMessageSettings) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessGreetingMessageSettings#64ae3e12 as nil") + } + buf.PutID(BusinessGreetingMessageSettingsTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BusinessGreetingMessageSettings) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessGreetingMessageSettings#64ae3e12 as nil") + } + buf.PutInt32(b.ShortcutID) + if err := b.Recipients.Encode(buf); err != nil { + return fmt.Errorf("unable to encode businessGreetingMessageSettings#64ae3e12: field recipients: %w", err) + } + buf.PutInt32(b.InactivityDays) + return nil +} + +// Decode implements bin.Decoder. +func (b *BusinessGreetingMessageSettings) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessGreetingMessageSettings#64ae3e12 to nil") + } + if err := buf.ConsumeID(BusinessGreetingMessageSettingsTypeID); err != nil { + return fmt.Errorf("unable to decode businessGreetingMessageSettings#64ae3e12: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BusinessGreetingMessageSettings) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessGreetingMessageSettings#64ae3e12 to nil") + } + { + value, err := buf.Int32() + if err != nil { + return fmt.Errorf("unable to decode businessGreetingMessageSettings#64ae3e12: field shortcut_id: %w", err) + } + b.ShortcutID = value + } + { + if err := b.Recipients.Decode(buf); err != nil { + return fmt.Errorf("unable to decode businessGreetingMessageSettings#64ae3e12: field recipients: %w", err) + } + } + { + value, err := buf.Int32() + if err != nil { + return fmt.Errorf("unable to decode businessGreetingMessageSettings#64ae3e12: field inactivity_days: %w", err) + } + b.InactivityDays = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BusinessGreetingMessageSettings) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode businessGreetingMessageSettings#64ae3e12 as nil") + } + buf.ObjStart() + buf.PutID("businessGreetingMessageSettings") + buf.Comma() + buf.FieldStart("shortcut_id") + buf.PutInt32(b.ShortcutID) + buf.Comma() + buf.FieldStart("recipients") + if err := b.Recipients.EncodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to encode businessGreetingMessageSettings#64ae3e12: field recipients: %w", err) + } + buf.Comma() + buf.FieldStart("inactivity_days") + buf.PutInt32(b.InactivityDays) + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BusinessGreetingMessageSettings) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode businessGreetingMessageSettings#64ae3e12 to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("businessGreetingMessageSettings"); err != nil { + return fmt.Errorf("unable to decode businessGreetingMessageSettings#64ae3e12: %w", err) + } + case "shortcut_id": + value, err := buf.Int32() + if err != nil { + return fmt.Errorf("unable to decode businessGreetingMessageSettings#64ae3e12: field shortcut_id: %w", err) + } + b.ShortcutID = value + case "recipients": + if err := b.Recipients.DecodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to decode businessGreetingMessageSettings#64ae3e12: field recipients: %w", err) + } + case "inactivity_days": + value, err := buf.Int32() + if err != nil { + return fmt.Errorf("unable to decode businessGreetingMessageSettings#64ae3e12: field inactivity_days: %w", err) + } + b.InactivityDays = value + default: + return buf.Skip() + } + return nil + }) +} + +// GetShortcutID returns value of ShortcutID field. +func (b *BusinessGreetingMessageSettings) GetShortcutID() (value int32) { + if b == nil { + return + } + return b.ShortcutID +} + +// GetRecipients returns value of Recipients field. +func (b *BusinessGreetingMessageSettings) GetRecipients() (value BusinessRecipients) { + if b == nil { + return + } + return b.Recipients +} + +// GetInactivityDays returns value of InactivityDays field. +func (b *BusinessGreetingMessageSettings) GetInactivityDays() (value int32) { + if b == nil { + return + } + return b.InactivityDays +} diff --git a/tdapi/tl_business_info_gen.go b/tdapi/tl_business_info_gen.go new file mode 100644 index 0000000000..b927cc1588 --- /dev/null +++ b/tdapi/tl_business_info_gen.go @@ -0,0 +1,298 @@ +// 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{} +) + +// BusinessInfo represents TL type `businessInfo#773c5066`. +type BusinessInfo struct { + // Location of the business; may be null if none + Location BusinessLocation + // Opening hours of the business; may be null if none. The hours are guaranteed to be + // valid and has already been split by week days + OpeningHours BusinessOpeningHours + // The greeting message; may be null if none or the Business account is not of the + // current user + GreetingMessageSettings BusinessGreetingMessageSettings + // The away message; may be null if none or the Business account is not of the current + // user + AwayMessageSettings BusinessAwayMessageSettings +} + +// BusinessInfoTypeID is TL type id of BusinessInfo. +const BusinessInfoTypeID = 0x773c5066 + +// Ensuring interfaces in compile-time for BusinessInfo. +var ( + _ bin.Encoder = &BusinessInfo{} + _ bin.Decoder = &BusinessInfo{} + _ bin.BareEncoder = &BusinessInfo{} + _ bin.BareDecoder = &BusinessInfo{} +) + +func (b *BusinessInfo) Zero() bool { + if b == nil { + return true + } + if !(b.Location.Zero()) { + return false + } + if !(b.OpeningHours.Zero()) { + return false + } + if !(b.GreetingMessageSettings.Zero()) { + return false + } + if !(b.AwayMessageSettings.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BusinessInfo) String() string { + if b == nil { + return "BusinessInfo(nil)" + } + type Alias BusinessInfo + return fmt.Sprintf("BusinessInfo%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BusinessInfo) TypeID() uint32 { + return BusinessInfoTypeID +} + +// TypeName returns name of type in TL schema. +func (*BusinessInfo) TypeName() string { + return "businessInfo" +} + +// TypeInfo returns info about TL type. +func (b *BusinessInfo) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "businessInfo", + ID: BusinessInfoTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Location", + SchemaName: "location", + }, + { + Name: "OpeningHours", + SchemaName: "opening_hours", + }, + { + Name: "GreetingMessageSettings", + SchemaName: "greeting_message_settings", + }, + { + Name: "AwayMessageSettings", + SchemaName: "away_message_settings", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BusinessInfo) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessInfo#773c5066 as nil") + } + buf.PutID(BusinessInfoTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BusinessInfo) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessInfo#773c5066 as nil") + } + if err := b.Location.Encode(buf); err != nil { + return fmt.Errorf("unable to encode businessInfo#773c5066: field location: %w", err) + } + if err := b.OpeningHours.Encode(buf); err != nil { + return fmt.Errorf("unable to encode businessInfo#773c5066: field opening_hours: %w", err) + } + if err := b.GreetingMessageSettings.Encode(buf); err != nil { + return fmt.Errorf("unable to encode businessInfo#773c5066: field greeting_message_settings: %w", err) + } + if err := b.AwayMessageSettings.Encode(buf); err != nil { + return fmt.Errorf("unable to encode businessInfo#773c5066: field away_message_settings: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (b *BusinessInfo) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessInfo#773c5066 to nil") + } + if err := buf.ConsumeID(BusinessInfoTypeID); err != nil { + return fmt.Errorf("unable to decode businessInfo#773c5066: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BusinessInfo) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessInfo#773c5066 to nil") + } + { + if err := b.Location.Decode(buf); err != nil { + return fmt.Errorf("unable to decode businessInfo#773c5066: field location: %w", err) + } + } + { + if err := b.OpeningHours.Decode(buf); err != nil { + return fmt.Errorf("unable to decode businessInfo#773c5066: field opening_hours: %w", err) + } + } + { + if err := b.GreetingMessageSettings.Decode(buf); err != nil { + return fmt.Errorf("unable to decode businessInfo#773c5066: field greeting_message_settings: %w", err) + } + } + { + if err := b.AwayMessageSettings.Decode(buf); err != nil { + return fmt.Errorf("unable to decode businessInfo#773c5066: field away_message_settings: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BusinessInfo) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode businessInfo#773c5066 as nil") + } + buf.ObjStart() + buf.PutID("businessInfo") + buf.Comma() + buf.FieldStart("location") + if err := b.Location.EncodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to encode businessInfo#773c5066: field location: %w", err) + } + buf.Comma() + buf.FieldStart("opening_hours") + if err := b.OpeningHours.EncodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to encode businessInfo#773c5066: field opening_hours: %w", err) + } + buf.Comma() + buf.FieldStart("greeting_message_settings") + if err := b.GreetingMessageSettings.EncodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to encode businessInfo#773c5066: field greeting_message_settings: %w", err) + } + buf.Comma() + buf.FieldStart("away_message_settings") + if err := b.AwayMessageSettings.EncodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to encode businessInfo#773c5066: field away_message_settings: %w", err) + } + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BusinessInfo) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode businessInfo#773c5066 to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("businessInfo"); err != nil { + return fmt.Errorf("unable to decode businessInfo#773c5066: %w", err) + } + case "location": + if err := b.Location.DecodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to decode businessInfo#773c5066: field location: %w", err) + } + case "opening_hours": + if err := b.OpeningHours.DecodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to decode businessInfo#773c5066: field opening_hours: %w", err) + } + case "greeting_message_settings": + if err := b.GreetingMessageSettings.DecodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to decode businessInfo#773c5066: field greeting_message_settings: %w", err) + } + case "away_message_settings": + if err := b.AwayMessageSettings.DecodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to decode businessInfo#773c5066: field away_message_settings: %w", err) + } + default: + return buf.Skip() + } + return nil + }) +} + +// GetLocation returns value of Location field. +func (b *BusinessInfo) GetLocation() (value BusinessLocation) { + if b == nil { + return + } + return b.Location +} + +// GetOpeningHours returns value of OpeningHours field. +func (b *BusinessInfo) GetOpeningHours() (value BusinessOpeningHours) { + if b == nil { + return + } + return b.OpeningHours +} + +// GetGreetingMessageSettings returns value of GreetingMessageSettings field. +func (b *BusinessInfo) GetGreetingMessageSettings() (value BusinessGreetingMessageSettings) { + if b == nil { + return + } + return b.GreetingMessageSettings +} + +// GetAwayMessageSettings returns value of AwayMessageSettings field. +func (b *BusinessInfo) GetAwayMessageSettings() (value BusinessAwayMessageSettings) { + if b == nil { + return + } + return b.AwayMessageSettings +} diff --git a/tdapi/tl_business_location_gen.go b/tdapi/tl_business_location_gen.go new file mode 100644 index 0000000000..0807773e3a --- /dev/null +++ b/tdapi/tl_business_location_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{} +) + +// BusinessLocation represents TL type `businessLocation#bf54af5a`. +type BusinessLocation struct { + // The location; may be null if not specified + Location Location + // Location address; 1-96 characters + Address string +} + +// BusinessLocationTypeID is TL type id of BusinessLocation. +const BusinessLocationTypeID = 0xbf54af5a + +// Ensuring interfaces in compile-time for BusinessLocation. +var ( + _ bin.Encoder = &BusinessLocation{} + _ bin.Decoder = &BusinessLocation{} + _ bin.BareEncoder = &BusinessLocation{} + _ bin.BareDecoder = &BusinessLocation{} +) + +func (b *BusinessLocation) Zero() bool { + if b == nil { + return true + } + if !(b.Location.Zero()) { + return false + } + if !(b.Address == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BusinessLocation) String() string { + if b == nil { + return "BusinessLocation(nil)" + } + type Alias BusinessLocation + return fmt.Sprintf("BusinessLocation%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BusinessLocation) TypeID() uint32 { + return BusinessLocationTypeID +} + +// TypeName returns name of type in TL schema. +func (*BusinessLocation) TypeName() string { + return "businessLocation" +} + +// TypeInfo returns info about TL type. +func (b *BusinessLocation) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "businessLocation", + ID: BusinessLocationTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Location", + SchemaName: "location", + }, + { + Name: "Address", + SchemaName: "address", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BusinessLocation) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessLocation#bf54af5a as nil") + } + buf.PutID(BusinessLocationTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BusinessLocation) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessLocation#bf54af5a as nil") + } + if err := b.Location.Encode(buf); err != nil { + return fmt.Errorf("unable to encode businessLocation#bf54af5a: field location: %w", err) + } + buf.PutString(b.Address) + return nil +} + +// Decode implements bin.Decoder. +func (b *BusinessLocation) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessLocation#bf54af5a to nil") + } + if err := buf.ConsumeID(BusinessLocationTypeID); err != nil { + return fmt.Errorf("unable to decode businessLocation#bf54af5a: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BusinessLocation) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessLocation#bf54af5a to nil") + } + { + if err := b.Location.Decode(buf); err != nil { + return fmt.Errorf("unable to decode businessLocation#bf54af5a: field location: %w", err) + } + } + { + value, err := buf.String() + if err != nil { + return fmt.Errorf("unable to decode businessLocation#bf54af5a: field address: %w", err) + } + b.Address = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BusinessLocation) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode businessLocation#bf54af5a as nil") + } + buf.ObjStart() + buf.PutID("businessLocation") + buf.Comma() + buf.FieldStart("location") + if err := b.Location.EncodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to encode businessLocation#bf54af5a: field location: %w", err) + } + buf.Comma() + buf.FieldStart("address") + buf.PutString(b.Address) + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BusinessLocation) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode businessLocation#bf54af5a to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("businessLocation"); err != nil { + return fmt.Errorf("unable to decode businessLocation#bf54af5a: %w", err) + } + case "location": + if err := b.Location.DecodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to decode businessLocation#bf54af5a: field location: %w", err) + } + case "address": + value, err := buf.String() + if err != nil { + return fmt.Errorf("unable to decode businessLocation#bf54af5a: field address: %w", err) + } + b.Address = value + default: + return buf.Skip() + } + return nil + }) +} + +// GetLocation returns value of Location field. +func (b *BusinessLocation) GetLocation() (value Location) { + if b == nil { + return + } + return b.Location +} + +// GetAddress returns value of Address field. +func (b *BusinessLocation) GetAddress() (value string) { + if b == nil { + return + } + return b.Address +} diff --git a/tdapi/tl_business_opening_hours_gen.go b/tdapi/tl_business_opening_hours_gen.go new file mode 100644 index 0000000000..807adf984c --- /dev/null +++ b/tdapi/tl_business_opening_hours_gen.go @@ -0,0 +1,255 @@ +// 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{} +) + +// BusinessOpeningHours represents TL type `businessOpeningHours#a623e64a`. +type BusinessOpeningHours struct { + // Unique time zone identifier + TimeZoneID string + // Intervals of the time when the business is open + OpeningHours []BusinessOpeningHoursInterval +} + +// BusinessOpeningHoursTypeID is TL type id of BusinessOpeningHours. +const BusinessOpeningHoursTypeID = 0xa623e64a + +// Ensuring interfaces in compile-time for BusinessOpeningHours. +var ( + _ bin.Encoder = &BusinessOpeningHours{} + _ bin.Decoder = &BusinessOpeningHours{} + _ bin.BareEncoder = &BusinessOpeningHours{} + _ bin.BareDecoder = &BusinessOpeningHours{} +) + +func (b *BusinessOpeningHours) Zero() bool { + if b == nil { + return true + } + if !(b.TimeZoneID == "") { + return false + } + if !(b.OpeningHours == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BusinessOpeningHours) String() string { + if b == nil { + return "BusinessOpeningHours(nil)" + } + type Alias BusinessOpeningHours + return fmt.Sprintf("BusinessOpeningHours%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BusinessOpeningHours) TypeID() uint32 { + return BusinessOpeningHoursTypeID +} + +// TypeName returns name of type in TL schema. +func (*BusinessOpeningHours) TypeName() string { + return "businessOpeningHours" +} + +// TypeInfo returns info about TL type. +func (b *BusinessOpeningHours) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "businessOpeningHours", + ID: BusinessOpeningHoursTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "TimeZoneID", + SchemaName: "time_zone_id", + }, + { + Name: "OpeningHours", + SchemaName: "opening_hours", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BusinessOpeningHours) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessOpeningHours#a623e64a as nil") + } + buf.PutID(BusinessOpeningHoursTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BusinessOpeningHours) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessOpeningHours#a623e64a as nil") + } + buf.PutString(b.TimeZoneID) + buf.PutInt(len(b.OpeningHours)) + for idx, v := range b.OpeningHours { + if err := v.EncodeBare(buf); err != nil { + return fmt.Errorf("unable to encode bare businessOpeningHours#a623e64a: field opening_hours element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (b *BusinessOpeningHours) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessOpeningHours#a623e64a to nil") + } + if err := buf.ConsumeID(BusinessOpeningHoursTypeID); err != nil { + return fmt.Errorf("unable to decode businessOpeningHours#a623e64a: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BusinessOpeningHours) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessOpeningHours#a623e64a to nil") + } + { + value, err := buf.String() + if err != nil { + return fmt.Errorf("unable to decode businessOpeningHours#a623e64a: field time_zone_id: %w", err) + } + b.TimeZoneID = value + } + { + headerLen, err := buf.Int() + if err != nil { + return fmt.Errorf("unable to decode businessOpeningHours#a623e64a: field opening_hours: %w", err) + } + + if headerLen > 0 { + b.OpeningHours = make([]BusinessOpeningHoursInterval, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value BusinessOpeningHoursInterval + if err := value.DecodeBare(buf); err != nil { + return fmt.Errorf("unable to decode bare businessOpeningHours#a623e64a: field opening_hours: %w", err) + } + b.OpeningHours = append(b.OpeningHours, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BusinessOpeningHours) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode businessOpeningHours#a623e64a as nil") + } + buf.ObjStart() + buf.PutID("businessOpeningHours") + buf.Comma() + buf.FieldStart("time_zone_id") + buf.PutString(b.TimeZoneID) + buf.Comma() + buf.FieldStart("opening_hours") + buf.ArrStart() + for idx, v := range b.OpeningHours { + if err := v.EncodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to encode businessOpeningHours#a623e64a: field opening_hours element with index %d: %w", idx, err) + } + buf.Comma() + } + buf.StripComma() + buf.ArrEnd() + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BusinessOpeningHours) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode businessOpeningHours#a623e64a to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("businessOpeningHours"); err != nil { + return fmt.Errorf("unable to decode businessOpeningHours#a623e64a: %w", err) + } + case "time_zone_id": + value, err := buf.String() + if err != nil { + return fmt.Errorf("unable to decode businessOpeningHours#a623e64a: field time_zone_id: %w", err) + } + b.TimeZoneID = value + case "opening_hours": + if err := buf.Arr(func(buf tdjson.Decoder) error { + var value BusinessOpeningHoursInterval + if err := value.DecodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to decode businessOpeningHours#a623e64a: field opening_hours: %w", err) + } + b.OpeningHours = append(b.OpeningHours, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode businessOpeningHours#a623e64a: field opening_hours: %w", err) + } + default: + return buf.Skip() + } + return nil + }) +} + +// GetTimeZoneID returns value of TimeZoneID field. +func (b *BusinessOpeningHours) GetTimeZoneID() (value string) { + if b == nil { + return + } + return b.TimeZoneID +} + +// GetOpeningHours returns value of OpeningHours field. +func (b *BusinessOpeningHours) GetOpeningHours() (value []BusinessOpeningHoursInterval) { + if b == nil { + return + } + return b.OpeningHours +} diff --git a/tdapi/tl_business_opening_hours_interval_gen.go b/tdapi/tl_business_opening_hours_interval_gen.go new file mode 100644 index 0000000000..2c84fd24d5 --- /dev/null +++ b/tdapi/tl_business_opening_hours_interval_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{} +) + +// BusinessOpeningHoursInterval represents TL type `businessOpeningHoursInterval#bdf05654`. +type BusinessOpeningHoursInterval struct { + // The first minute of the interval since start of the week; 0-7*24*60 + StartMinute int32 + // The first minute after the end of the interval since start of the week; 1-8*24*60 + EndMinute int32 +} + +// BusinessOpeningHoursIntervalTypeID is TL type id of BusinessOpeningHoursInterval. +const BusinessOpeningHoursIntervalTypeID = 0xbdf05654 + +// Ensuring interfaces in compile-time for BusinessOpeningHoursInterval. +var ( + _ bin.Encoder = &BusinessOpeningHoursInterval{} + _ bin.Decoder = &BusinessOpeningHoursInterval{} + _ bin.BareEncoder = &BusinessOpeningHoursInterval{} + _ bin.BareDecoder = &BusinessOpeningHoursInterval{} +) + +func (b *BusinessOpeningHoursInterval) Zero() bool { + if b == nil { + return true + } + if !(b.StartMinute == 0) { + return false + } + if !(b.EndMinute == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BusinessOpeningHoursInterval) String() string { + if b == nil { + return "BusinessOpeningHoursInterval(nil)" + } + type Alias BusinessOpeningHoursInterval + return fmt.Sprintf("BusinessOpeningHoursInterval%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BusinessOpeningHoursInterval) TypeID() uint32 { + return BusinessOpeningHoursIntervalTypeID +} + +// TypeName returns name of type in TL schema. +func (*BusinessOpeningHoursInterval) TypeName() string { + return "businessOpeningHoursInterval" +} + +// TypeInfo returns info about TL type. +func (b *BusinessOpeningHoursInterval) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "businessOpeningHoursInterval", + ID: BusinessOpeningHoursIntervalTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "StartMinute", + SchemaName: "start_minute", + }, + { + Name: "EndMinute", + SchemaName: "end_minute", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BusinessOpeningHoursInterval) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessOpeningHoursInterval#bdf05654 as nil") + } + buf.PutID(BusinessOpeningHoursIntervalTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BusinessOpeningHoursInterval) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessOpeningHoursInterval#bdf05654 as nil") + } + buf.PutInt32(b.StartMinute) + buf.PutInt32(b.EndMinute) + return nil +} + +// Decode implements bin.Decoder. +func (b *BusinessOpeningHoursInterval) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessOpeningHoursInterval#bdf05654 to nil") + } + if err := buf.ConsumeID(BusinessOpeningHoursIntervalTypeID); err != nil { + return fmt.Errorf("unable to decode businessOpeningHoursInterval#bdf05654: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BusinessOpeningHoursInterval) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessOpeningHoursInterval#bdf05654 to nil") + } + { + value, err := buf.Int32() + if err != nil { + return fmt.Errorf("unable to decode businessOpeningHoursInterval#bdf05654: field start_minute: %w", err) + } + b.StartMinute = value + } + { + value, err := buf.Int32() + if err != nil { + return fmt.Errorf("unable to decode businessOpeningHoursInterval#bdf05654: field end_minute: %w", err) + } + b.EndMinute = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BusinessOpeningHoursInterval) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode businessOpeningHoursInterval#bdf05654 as nil") + } + buf.ObjStart() + buf.PutID("businessOpeningHoursInterval") + buf.Comma() + buf.FieldStart("start_minute") + buf.PutInt32(b.StartMinute) + buf.Comma() + buf.FieldStart("end_minute") + buf.PutInt32(b.EndMinute) + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BusinessOpeningHoursInterval) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode businessOpeningHoursInterval#bdf05654 to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("businessOpeningHoursInterval"); err != nil { + return fmt.Errorf("unable to decode businessOpeningHoursInterval#bdf05654: %w", err) + } + case "start_minute": + value, err := buf.Int32() + if err != nil { + return fmt.Errorf("unable to decode businessOpeningHoursInterval#bdf05654: field start_minute: %w", err) + } + b.StartMinute = value + case "end_minute": + value, err := buf.Int32() + if err != nil { + return fmt.Errorf("unable to decode businessOpeningHoursInterval#bdf05654: field end_minute: %w", err) + } + b.EndMinute = value + default: + return buf.Skip() + } + return nil + }) +} + +// GetStartMinute returns value of StartMinute field. +func (b *BusinessOpeningHoursInterval) GetStartMinute() (value int32) { + if b == nil { + return + } + return b.StartMinute +} + +// GetEndMinute returns value of EndMinute field. +func (b *BusinessOpeningHoursInterval) GetEndMinute() (value int32) { + if b == nil { + return + } + return b.EndMinute +} diff --git a/tdapi/tl_business_recipients_gen.go b/tdapi/tl_business_recipients_gen.go new file mode 100644 index 0000000000..f6abf0624b --- /dev/null +++ b/tdapi/tl_business_recipients_gen.go @@ -0,0 +1,388 @@ +// 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{} +) + +// BusinessRecipients represents TL type `businessRecipients#2f3ca54a`. +type BusinessRecipients struct { + // Identifiers of selected private chats + ChatIDs []int64 + // True, if all existing private chats are selected + SelectExistingChats bool + // True, if all new private chats are selected + SelectNewChats bool + // True, if all private chats with contacts are selected + SelectContacts bool + // True, if all private chats with non-contacts are selected + SelectNonContacts bool + // If true, then all private chats except the selected are chosen. Otherwise, only the + // selected chats are chosen + ExcludeSelected bool +} + +// BusinessRecipientsTypeID is TL type id of BusinessRecipients. +const BusinessRecipientsTypeID = 0x2f3ca54a + +// Ensuring interfaces in compile-time for BusinessRecipients. +var ( + _ bin.Encoder = &BusinessRecipients{} + _ bin.Decoder = &BusinessRecipients{} + _ bin.BareEncoder = &BusinessRecipients{} + _ bin.BareDecoder = &BusinessRecipients{} +) + +func (b *BusinessRecipients) Zero() bool { + if b == nil { + return true + } + if !(b.ChatIDs == nil) { + return false + } + if !(b.SelectExistingChats == false) { + return false + } + if !(b.SelectNewChats == false) { + return false + } + if !(b.SelectContacts == false) { + return false + } + if !(b.SelectNonContacts == false) { + return false + } + if !(b.ExcludeSelected == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BusinessRecipients) String() string { + if b == nil { + return "BusinessRecipients(nil)" + } + type Alias BusinessRecipients + return fmt.Sprintf("BusinessRecipients%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BusinessRecipients) TypeID() uint32 { + return BusinessRecipientsTypeID +} + +// TypeName returns name of type in TL schema. +func (*BusinessRecipients) TypeName() string { + return "businessRecipients" +} + +// TypeInfo returns info about TL type. +func (b *BusinessRecipients) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "businessRecipients", + ID: BusinessRecipientsTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatIDs", + SchemaName: "chat_ids", + }, + { + Name: "SelectExistingChats", + SchemaName: "select_existing_chats", + }, + { + Name: "SelectNewChats", + SchemaName: "select_new_chats", + }, + { + Name: "SelectContacts", + SchemaName: "select_contacts", + }, + { + Name: "SelectNonContacts", + SchemaName: "select_non_contacts", + }, + { + Name: "ExcludeSelected", + SchemaName: "exclude_selected", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BusinessRecipients) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessRecipients#2f3ca54a as nil") + } + buf.PutID(BusinessRecipientsTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BusinessRecipients) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessRecipients#2f3ca54a as nil") + } + buf.PutInt(len(b.ChatIDs)) + for _, v := range b.ChatIDs { + buf.PutInt53(v) + } + buf.PutBool(b.SelectExistingChats) + buf.PutBool(b.SelectNewChats) + buf.PutBool(b.SelectContacts) + buf.PutBool(b.SelectNonContacts) + buf.PutBool(b.ExcludeSelected) + return nil +} + +// Decode implements bin.Decoder. +func (b *BusinessRecipients) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessRecipients#2f3ca54a to nil") + } + if err := buf.ConsumeID(BusinessRecipientsTypeID); err != nil { + return fmt.Errorf("unable to decode businessRecipients#2f3ca54a: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BusinessRecipients) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessRecipients#2f3ca54a to nil") + } + { + headerLen, err := buf.Int() + if err != nil { + return fmt.Errorf("unable to decode businessRecipients#2f3ca54a: field chat_ids: %w", err) + } + + if headerLen > 0 { + b.ChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := buf.Int53() + if err != nil { + return fmt.Errorf("unable to decode businessRecipients#2f3ca54a: field chat_ids: %w", err) + } + b.ChatIDs = append(b.ChatIDs, value) + } + } + { + value, err := buf.Bool() + if err != nil { + return fmt.Errorf("unable to decode businessRecipients#2f3ca54a: field select_existing_chats: %w", err) + } + b.SelectExistingChats = value + } + { + value, err := buf.Bool() + if err != nil { + return fmt.Errorf("unable to decode businessRecipients#2f3ca54a: field select_new_chats: %w", err) + } + b.SelectNewChats = value + } + { + value, err := buf.Bool() + if err != nil { + return fmt.Errorf("unable to decode businessRecipients#2f3ca54a: field select_contacts: %w", err) + } + b.SelectContacts = value + } + { + value, err := buf.Bool() + if err != nil { + return fmt.Errorf("unable to decode businessRecipients#2f3ca54a: field select_non_contacts: %w", err) + } + b.SelectNonContacts = value + } + { + value, err := buf.Bool() + if err != nil { + return fmt.Errorf("unable to decode businessRecipients#2f3ca54a: field exclude_selected: %w", err) + } + b.ExcludeSelected = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BusinessRecipients) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode businessRecipients#2f3ca54a as nil") + } + buf.ObjStart() + buf.PutID("businessRecipients") + buf.Comma() + buf.FieldStart("chat_ids") + buf.ArrStart() + for _, v := range b.ChatIDs { + buf.PutInt53(v) + buf.Comma() + } + buf.StripComma() + buf.ArrEnd() + buf.Comma() + buf.FieldStart("select_existing_chats") + buf.PutBool(b.SelectExistingChats) + buf.Comma() + buf.FieldStart("select_new_chats") + buf.PutBool(b.SelectNewChats) + buf.Comma() + buf.FieldStart("select_contacts") + buf.PutBool(b.SelectContacts) + buf.Comma() + buf.FieldStart("select_non_contacts") + buf.PutBool(b.SelectNonContacts) + buf.Comma() + buf.FieldStart("exclude_selected") + buf.PutBool(b.ExcludeSelected) + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BusinessRecipients) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode businessRecipients#2f3ca54a to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("businessRecipients"); err != nil { + return fmt.Errorf("unable to decode businessRecipients#2f3ca54a: %w", err) + } + case "chat_ids": + if err := buf.Arr(func(buf tdjson.Decoder) error { + value, err := buf.Int53() + if err != nil { + return fmt.Errorf("unable to decode businessRecipients#2f3ca54a: field chat_ids: %w", err) + } + b.ChatIDs = append(b.ChatIDs, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode businessRecipients#2f3ca54a: field chat_ids: %w", err) + } + case "select_existing_chats": + value, err := buf.Bool() + if err != nil { + return fmt.Errorf("unable to decode businessRecipients#2f3ca54a: field select_existing_chats: %w", err) + } + b.SelectExistingChats = value + case "select_new_chats": + value, err := buf.Bool() + if err != nil { + return fmt.Errorf("unable to decode businessRecipients#2f3ca54a: field select_new_chats: %w", err) + } + b.SelectNewChats = value + case "select_contacts": + value, err := buf.Bool() + if err != nil { + return fmt.Errorf("unable to decode businessRecipients#2f3ca54a: field select_contacts: %w", err) + } + b.SelectContacts = value + case "select_non_contacts": + value, err := buf.Bool() + if err != nil { + return fmt.Errorf("unable to decode businessRecipients#2f3ca54a: field select_non_contacts: %w", err) + } + b.SelectNonContacts = value + case "exclude_selected": + value, err := buf.Bool() + if err != nil { + return fmt.Errorf("unable to decode businessRecipients#2f3ca54a: field exclude_selected: %w", err) + } + b.ExcludeSelected = value + default: + return buf.Skip() + } + return nil + }) +} + +// GetChatIDs returns value of ChatIDs field. +func (b *BusinessRecipients) GetChatIDs() (value []int64) { + if b == nil { + return + } + return b.ChatIDs +} + +// GetSelectExistingChats returns value of SelectExistingChats field. +func (b *BusinessRecipients) GetSelectExistingChats() (value bool) { + if b == nil { + return + } + return b.SelectExistingChats +} + +// GetSelectNewChats returns value of SelectNewChats field. +func (b *BusinessRecipients) GetSelectNewChats() (value bool) { + if b == nil { + return + } + return b.SelectNewChats +} + +// GetSelectContacts returns value of SelectContacts field. +func (b *BusinessRecipients) GetSelectContacts() (value bool) { + if b == nil { + return + } + return b.SelectContacts +} + +// GetSelectNonContacts returns value of SelectNonContacts field. +func (b *BusinessRecipients) GetSelectNonContacts() (value bool) { + if b == nil { + return + } + return b.SelectNonContacts +} + +// GetExcludeSelected returns value of ExcludeSelected field. +func (b *BusinessRecipients) GetExcludeSelected() (value bool) { + if b == nil { + return + } + return b.ExcludeSelected +} diff --git a/tdapi/tl_chat_folder_gen.go b/tdapi/tl_chat_folder_gen.go index 924c0c4ef9..aadbeb73d9 100644 --- a/tdapi/tl_chat_folder_gen.go +++ b/tdapi/tl_chat_folder_gen.go @@ -31,13 +31,16 @@ var ( _ = tdjson.Encoder{} ) -// ChatFolder represents TL type `chatFolder#aa7d5740`. +// ChatFolder represents TL type `chatFolder#65805ba5`. type ChatFolder struct { // The title of the folder; 1-12 characters without line feeds Title string // The chosen icon for the chat folder; may be null. If null, use // getChatFolderDefaultIconName to get default icon name for the folder Icon ChatFolderIcon + // The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then + // color is didabled + ColorID int32 // True, if at least one link has been created for the folder IsShareable bool // The chat identifiers of pinned chats in the folder. There can be up to @@ -73,7 +76,7 @@ type ChatFolder struct { } // ChatFolderTypeID is TL type id of ChatFolder. -const ChatFolderTypeID = 0xaa7d5740 +const ChatFolderTypeID = 0x65805ba5 // Ensuring interfaces in compile-time for ChatFolder. var ( @@ -93,6 +96,9 @@ func (c *ChatFolder) Zero() bool { if !(c.Icon.Zero()) { return false } + if !(c.ColorID == 0) { + return false + } if !(c.IsShareable == false) { return false } @@ -173,6 +179,10 @@ func (c *ChatFolder) TypeInfo() tdp.Type { Name: "Icon", SchemaName: "icon", }, + { + Name: "ColorID", + SchemaName: "color_id", + }, { Name: "IsShareable", SchemaName: "is_shareable", @@ -228,7 +238,7 @@ func (c *ChatFolder) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *ChatFolder) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatFolder#aa7d5740 as nil") + return fmt.Errorf("can't encode chatFolder#65805ba5 as nil") } b.PutID(ChatFolderTypeID) return c.EncodeBare(b) @@ -237,12 +247,13 @@ func (c *ChatFolder) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatFolder) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatFolder#aa7d5740 as nil") + return fmt.Errorf("can't encode chatFolder#65805ba5 as nil") } b.PutString(c.Title) if err := c.Icon.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatFolder#aa7d5740: field icon: %w", err) + return fmt.Errorf("unable to encode chatFolder#65805ba5: field icon: %w", err) } + b.PutInt32(c.ColorID) b.PutBool(c.IsShareable) b.PutInt(len(c.PinnedChatIDs)) for _, v := range c.PinnedChatIDs { @@ -270,10 +281,10 @@ func (c *ChatFolder) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (c *ChatFolder) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatFolder#aa7d5740 to nil") + return fmt.Errorf("can't decode chatFolder#65805ba5 to nil") } if err := b.ConsumeID(ChatFolderTypeID); err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: %w", err) } return c.DecodeBare(b) } @@ -281,31 +292,38 @@ func (c *ChatFolder) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatFolder) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatFolder#aa7d5740 to nil") + return fmt.Errorf("can't decode chatFolder#65805ba5 to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field title: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field title: %w", err) } c.Title = value } { if err := c.Icon.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field icon: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field icon: %w", err) + } + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatFolder#65805ba5: field color_id: %w", err) } + c.ColorID = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field is_shareable: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field is_shareable: %w", err) } c.IsShareable = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field pinned_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field pinned_chat_ids: %w", err) } if headerLen > 0 { @@ -314,7 +332,7 @@ func (c *ChatFolder) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field pinned_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field pinned_chat_ids: %w", err) } c.PinnedChatIDs = append(c.PinnedChatIDs, value) } @@ -322,7 +340,7 @@ func (c *ChatFolder) DecodeBare(b *bin.Buffer) error { { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field included_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field included_chat_ids: %w", err) } if headerLen > 0 { @@ -331,7 +349,7 @@ func (c *ChatFolder) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field included_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field included_chat_ids: %w", err) } c.IncludedChatIDs = append(c.IncludedChatIDs, value) } @@ -339,7 +357,7 @@ func (c *ChatFolder) DecodeBare(b *bin.Buffer) error { { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field excluded_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field excluded_chat_ids: %w", err) } if headerLen > 0 { @@ -348,7 +366,7 @@ func (c *ChatFolder) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field excluded_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field excluded_chat_ids: %w", err) } c.ExcludedChatIDs = append(c.ExcludedChatIDs, value) } @@ -356,56 +374,56 @@ func (c *ChatFolder) DecodeBare(b *bin.Buffer) error { { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field exclude_muted: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field exclude_muted: %w", err) } c.ExcludeMuted = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field exclude_read: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field exclude_read: %w", err) } c.ExcludeRead = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field exclude_archived: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field exclude_archived: %w", err) } c.ExcludeArchived = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field include_contacts: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field include_contacts: %w", err) } c.IncludeContacts = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field include_non_contacts: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field include_non_contacts: %w", err) } c.IncludeNonContacts = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field include_bots: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field include_bots: %w", err) } c.IncludeBots = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field include_groups: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field include_groups: %w", err) } c.IncludeGroups = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field include_channels: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field include_channels: %w", err) } c.IncludeChannels = value } @@ -415,7 +433,7 @@ func (c *ChatFolder) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *ChatFolder) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatFolder#aa7d5740 as nil") + return fmt.Errorf("can't encode chatFolder#65805ba5 as nil") } b.ObjStart() b.PutID("chatFolder") @@ -425,9 +443,12 @@ func (c *ChatFolder) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("icon") if err := c.Icon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatFolder#aa7d5740: field icon: %w", err) + return fmt.Errorf("unable to encode chatFolder#65805ba5: field icon: %w", err) } b.Comma() + b.FieldStart("color_id") + b.PutInt32(c.ColorID) + b.Comma() b.FieldStart("is_shareable") b.PutBool(c.IsShareable) b.Comma() @@ -490,110 +511,116 @@ func (c *ChatFolder) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *ChatFolder) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatFolder#aa7d5740 to nil") + return fmt.Errorf("can't decode chatFolder#65805ba5 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("chatFolder"); err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: %w", err) } case "title": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field title: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field title: %w", err) } c.Title = value case "icon": if err := c.Icon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field icon: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field icon: %w", err) + } + case "color_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatFolder#65805ba5: field color_id: %w", err) } + c.ColorID = value case "is_shareable": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field is_shareable: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field is_shareable: %w", err) } c.IsShareable = value case "pinned_chat_ids": if err := b.Arr(func(b tdjson.Decoder) error { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field pinned_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field pinned_chat_ids: %w", err) } c.PinnedChatIDs = append(c.PinnedChatIDs, value) return nil }); err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field pinned_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field pinned_chat_ids: %w", err) } case "included_chat_ids": if err := b.Arr(func(b tdjson.Decoder) error { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field included_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field included_chat_ids: %w", err) } c.IncludedChatIDs = append(c.IncludedChatIDs, value) return nil }); err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field included_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field included_chat_ids: %w", err) } case "excluded_chat_ids": if err := b.Arr(func(b tdjson.Decoder) error { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field excluded_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field excluded_chat_ids: %w", err) } c.ExcludedChatIDs = append(c.ExcludedChatIDs, value) return nil }); err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field excluded_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field excluded_chat_ids: %w", err) } case "exclude_muted": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field exclude_muted: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field exclude_muted: %w", err) } c.ExcludeMuted = value case "exclude_read": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field exclude_read: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field exclude_read: %w", err) } c.ExcludeRead = value case "exclude_archived": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field exclude_archived: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field exclude_archived: %w", err) } c.ExcludeArchived = value case "include_contacts": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field include_contacts: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field include_contacts: %w", err) } c.IncludeContacts = value case "include_non_contacts": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field include_non_contacts: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field include_non_contacts: %w", err) } c.IncludeNonContacts = value case "include_bots": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field include_bots: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field include_bots: %w", err) } c.IncludeBots = value case "include_groups": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field include_groups: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field include_groups: %w", err) } c.IncludeGroups = value case "include_channels": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#aa7d5740: field include_channels: %w", err) + return fmt.Errorf("unable to decode chatFolder#65805ba5: field include_channels: %w", err) } c.IncludeChannels = value default: @@ -619,6 +646,14 @@ func (c *ChatFolder) GetIcon() (value ChatFolderIcon) { return c.Icon } +// GetColorID returns value of ColorID field. +func (c *ChatFolder) GetColorID() (value int32) { + if c == nil { + return + } + return c.ColorID +} + // GetIsShareable returns value of IsShareable field. func (c *ChatFolder) GetIsShareable() (value bool) { if c == nil { diff --git a/tdapi/tl_chat_folder_info_gen.go b/tdapi/tl_chat_folder_info_gen.go index d033d9f698..38e70ab378 100644 --- a/tdapi/tl_chat_folder_info_gen.go +++ b/tdapi/tl_chat_folder_info_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// ChatFolderInfo represents TL type `chatFolderInfo#4c3ee0d4`. +// ChatFolderInfo represents TL type `chatFolderInfo#b61a485`. type ChatFolderInfo struct { // Unique chat folder identifier ID int32 @@ -39,6 +39,9 @@ type ChatFolderInfo struct { Title string // The chosen or default icon for the chat folder Icon ChatFolderIcon + // The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then + // color is didabled + ColorID int32 // True, if at least one link has been created for the folder IsShareable bool // True, if the chat folder has invite links created by the current user @@ -46,7 +49,7 @@ type ChatFolderInfo struct { } // ChatFolderInfoTypeID is TL type id of ChatFolderInfo. -const ChatFolderInfoTypeID = 0x4c3ee0d4 +const ChatFolderInfoTypeID = 0xb61a485 // Ensuring interfaces in compile-time for ChatFolderInfo. var ( @@ -69,6 +72,9 @@ func (c *ChatFolderInfo) Zero() bool { if !(c.Icon.Zero()) { return false } + if !(c.ColorID == 0) { + return false + } if !(c.IsShareable == false) { return false } @@ -123,6 +129,10 @@ func (c *ChatFolderInfo) TypeInfo() tdp.Type { Name: "Icon", SchemaName: "icon", }, + { + Name: "ColorID", + SchemaName: "color_id", + }, { Name: "IsShareable", SchemaName: "is_shareable", @@ -138,7 +148,7 @@ func (c *ChatFolderInfo) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *ChatFolderInfo) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatFolderInfo#4c3ee0d4 as nil") + return fmt.Errorf("can't encode chatFolderInfo#b61a485 as nil") } b.PutID(ChatFolderInfoTypeID) return c.EncodeBare(b) @@ -147,13 +157,14 @@ func (c *ChatFolderInfo) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatFolderInfo) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatFolderInfo#4c3ee0d4 as nil") + return fmt.Errorf("can't encode chatFolderInfo#b61a485 as nil") } b.PutInt32(c.ID) b.PutString(c.Title) if err := c.Icon.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatFolderInfo#4c3ee0d4: field icon: %w", err) + return fmt.Errorf("unable to encode chatFolderInfo#b61a485: field icon: %w", err) } + b.PutInt32(c.ColorID) b.PutBool(c.IsShareable) b.PutBool(c.HasMyInviteLinks) return nil @@ -162,10 +173,10 @@ func (c *ChatFolderInfo) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (c *ChatFolderInfo) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatFolderInfo#4c3ee0d4 to nil") + return fmt.Errorf("can't decode chatFolderInfo#b61a485 to nil") } if err := b.ConsumeID(ChatFolderInfoTypeID); err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#4c3ee0d4: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#b61a485: %w", err) } return c.DecodeBare(b) } @@ -173,38 +184,45 @@ func (c *ChatFolderInfo) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatFolderInfo) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatFolderInfo#4c3ee0d4 to nil") + return fmt.Errorf("can't decode chatFolderInfo#b61a485 to nil") } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#4c3ee0d4: field id: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field id: %w", err) } c.ID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#4c3ee0d4: field title: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field title: %w", err) } c.Title = value } { if err := c.Icon.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#4c3ee0d4: field icon: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field icon: %w", err) + } + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field color_id: %w", err) } + c.ColorID = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#4c3ee0d4: field is_shareable: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field is_shareable: %w", err) } c.IsShareable = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#4c3ee0d4: field has_my_invite_links: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field has_my_invite_links: %w", err) } c.HasMyInviteLinks = value } @@ -214,7 +232,7 @@ func (c *ChatFolderInfo) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *ChatFolderInfo) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatFolderInfo#4c3ee0d4 as nil") + return fmt.Errorf("can't encode chatFolderInfo#b61a485 as nil") } b.ObjStart() b.PutID("chatFolderInfo") @@ -227,9 +245,12 @@ func (c *ChatFolderInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("icon") if err := c.Icon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatFolderInfo#4c3ee0d4: field icon: %w", err) + return fmt.Errorf("unable to encode chatFolderInfo#b61a485: field icon: %w", err) } b.Comma() + b.FieldStart("color_id") + b.PutInt32(c.ColorID) + b.Comma() b.FieldStart("is_shareable") b.PutBool(c.IsShareable) b.Comma() @@ -244,41 +265,47 @@ func (c *ChatFolderInfo) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *ChatFolderInfo) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatFolderInfo#4c3ee0d4 to nil") + return fmt.Errorf("can't decode chatFolderInfo#b61a485 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("chatFolderInfo"); err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#4c3ee0d4: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#b61a485: %w", err) } case "id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#4c3ee0d4: field id: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field id: %w", err) } c.ID = value case "title": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#4c3ee0d4: field title: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field title: %w", err) } c.Title = value case "icon": if err := c.Icon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#4c3ee0d4: field icon: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field icon: %w", err) } + case "color_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field color_id: %w", err) + } + c.ColorID = value case "is_shareable": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#4c3ee0d4: field is_shareable: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field is_shareable: %w", err) } c.IsShareable = value case "has_my_invite_links": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#4c3ee0d4: field has_my_invite_links: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field has_my_invite_links: %w", err) } c.HasMyInviteLinks = value default: @@ -312,6 +339,14 @@ func (c *ChatFolderInfo) GetIcon() (value ChatFolderIcon) { return c.Icon } +// GetColorID returns value of ColorID field. +func (c *ChatFolderInfo) GetColorID() (value int32) { + if c == nil { + return + } + return c.ColorID +} + // GetIsShareable returns value of IsShareable field. func (c *ChatFolderInfo) GetIsShareable() (value bool) { if c == nil { diff --git a/tdapi/tl_chat_gen.go b/tdapi/tl_chat_gen.go index 78d8724a7c..fcd3bb402e 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#70f33afe`. +// Chat represents TL type `chat#57f1ba4`. type Chat struct { // Chat unique identifier ID int64 @@ -58,6 +58,10 @@ type Chat struct { LastMessage Message // Positions of the chat in chat lists Positions []ChatPosition + // Chat lists to which the chat belongs. A chat can have a non-zero position in a chat + // list even it doesn't belong to the chat list and have no position in a chat list even + // it belongs to the chat list + ChatLists []ChatListClass // Identifier of a user or chat that is selected to send messages in the chat; may be // null if the user can't change message sender MessageSenderID MessageSenderClass @@ -128,7 +132,7 @@ type Chat struct { } // ChatTypeID is TL type id of Chat. -const ChatTypeID = 0x70f33afe +const ChatTypeID = 0x57f1ba4 // Ensuring interfaces in compile-time for Chat. var ( @@ -175,6 +179,9 @@ func (c *Chat) Zero() bool { if !(c.Positions == nil) { return false } + if !(c.ChatLists == nil) { + return false + } if !(c.MessageSenderID == nil) { return false } @@ -339,6 +346,10 @@ func (c *Chat) TypeInfo() tdp.Type { Name: "Positions", SchemaName: "positions", }, + { + Name: "ChatLists", + SchemaName: "chat_lists", + }, { Name: "MessageSenderID", SchemaName: "message_sender_id", @@ -458,7 +469,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#70f33afe as nil") + return fmt.Errorf("can't encode chat#57f1ba4 as nil") } b.PutID(ChatTypeID) return c.EncodeBare(b) @@ -467,46 +478,55 @@ 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#70f33afe as nil") + return fmt.Errorf("can't encode chat#57f1ba4 as nil") } b.PutInt53(c.ID) if c.Type == nil { - return fmt.Errorf("unable to encode chat#70f33afe: field type is nil") + return fmt.Errorf("unable to encode chat#57f1ba4: field type is nil") } if err := c.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#70f33afe: field type: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field type: %w", err) } b.PutString(c.Title) if err := c.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#70f33afe: field photo: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field photo: %w", err) } b.PutInt32(c.AccentColorID) b.PutLong(c.BackgroundCustomEmojiID) b.PutInt32(c.ProfileAccentColorID) b.PutLong(c.ProfileBackgroundCustomEmojiID) if err := c.Permissions.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#70f33afe: field permissions: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field permissions: %w", err) } if err := c.LastMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#70f33afe: field last_message: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: 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#70f33afe: field positions element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare chat#57f1ba4: field positions element with index %d: %w", idx, err) + } + } + b.PutInt(len(c.ChatLists)) + for idx, v := range c.ChatLists { + if v == nil { + return fmt.Errorf("unable to encode chat#57f1ba4: field chat_lists element with index %d is nil", idx) + } + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare chat#57f1ba4: field chat_lists element with index %d: %w", idx, err) } } if c.MessageSenderID == nil { - return fmt.Errorf("unable to encode chat#70f33afe: field message_sender_id is nil") + return fmt.Errorf("unable to encode chat#57f1ba4: field message_sender_id is nil") } if err := c.MessageSenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#70f33afe: field message_sender_id: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field message_sender_id: %w", err) } if c.BlockList == nil { - return fmt.Errorf("unable to encode chat#70f33afe: field block_list is nil") + return fmt.Errorf("unable to encode chat#57f1ba4: field block_list is nil") } if err := c.BlockList.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#70f33afe: field block_list: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field block_list: %w", err) } b.PutBool(c.HasProtectedContent) b.PutBool(c.IsTranslatable) @@ -523,37 +543,37 @@ 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#70f33afe: field notification_settings: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field notification_settings: %w", err) } if c.AvailableReactions == nil { - return fmt.Errorf("unable to encode chat#70f33afe: field available_reactions is nil") + return fmt.Errorf("unable to encode chat#57f1ba4: field available_reactions is nil") } if err := c.AvailableReactions.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#70f33afe: field available_reactions: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field available_reactions: %w", err) } b.PutInt32(c.MessageAutoDeleteTime) if err := c.EmojiStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#70f33afe: field emoji_status: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field emoji_status: %w", err) } if err := c.Background.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#70f33afe: field background: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field background: %w", err) } b.PutString(c.ThemeName) if c.ActionBar == nil { - return fmt.Errorf("unable to encode chat#70f33afe: field action_bar is nil") + return fmt.Errorf("unable to encode chat#57f1ba4: field action_bar is nil") } if err := c.ActionBar.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#70f33afe: field action_bar: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field action_bar: %w", err) } if err := c.VideoChat.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#70f33afe: field video_chat: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field video_chat: %w", err) } if err := c.PendingJoinRequests.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#70f33afe: field pending_join_requests: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: 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#70f33afe: field draft_message: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field draft_message: %w", err) } b.PutString(c.ClientData) return nil @@ -562,10 +582,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#70f33afe to nil") + return fmt.Errorf("can't decode chat#57f1ba4 to nil") } if err := b.ConsumeID(ChatTypeID); err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: %w", err) } return c.DecodeBare(b) } @@ -573,76 +593,76 @@ 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#70f33afe to nil") + return fmt.Errorf("can't decode chat#57f1ba4 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field id: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field id: %w", err) } c.ID = value } { value, err := DecodeChatType(b) if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field type: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field type: %w", err) } c.Type = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field title: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field title: %w", err) } c.Title = value } { if err := c.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field photo: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field photo: %w", err) } } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field accent_color_id: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field accent_color_id: %w", err) } c.AccentColorID = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field background_custom_emoji_id: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field background_custom_emoji_id: %w", err) } c.BackgroundCustomEmojiID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field profile_accent_color_id: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field profile_accent_color_id: %w", err) } c.ProfileAccentColorID = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field profile_background_custom_emoji_id: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field profile_background_custom_emoji_id: %w", err) } c.ProfileBackgroundCustomEmojiID = value } { if err := c.Permissions.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field permissions: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field permissions: %w", err) } } { if err := c.LastMessage.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field last_message: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field last_message: %w", err) } } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field positions: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field positions: %w", err) } if headerLen > 0 { @@ -651,192 +671,209 @@ 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#70f33afe: field positions: %w", err) + return fmt.Errorf("unable to decode bare chat#57f1ba4: field positions: %w", err) } c.Positions = append(c.Positions, value) } } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode chat#57f1ba4: field chat_lists: %w", err) + } + + if headerLen > 0 { + c.ChatLists = make([]ChatListClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeChatList(b) + if err != nil { + return fmt.Errorf("unable to decode chat#57f1ba4: field chat_lists: %w", err) + } + c.ChatLists = append(c.ChatLists, value) + } + } { value, err := DecodeMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field message_sender_id: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field message_sender_id: %w", err) } c.MessageSenderID = value } { value, err := DecodeBlockList(b) if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field block_list: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field block_list: %w", err) } c.BlockList = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field has_protected_content: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field has_protected_content: %w", err) } c.HasProtectedContent = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field is_translatable: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field is_translatable: %w", err) } c.IsTranslatable = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field is_marked_as_unread: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field is_marked_as_unread: %w", err) } c.IsMarkedAsUnread = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field view_as_topics: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field view_as_topics: %w", err) } c.ViewAsTopics = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field has_scheduled_messages: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field has_scheduled_messages: %w", err) } c.HasScheduledMessages = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field can_be_deleted_only_for_self: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field can_be_deleted_for_all_users: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field can_be_reported: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field can_be_reported: %w", err) } c.CanBeReported = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field default_disable_notification: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field default_disable_notification: %w", err) } c.DefaultDisableNotification = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field unread_count: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field unread_count: %w", err) } c.UnreadCount = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field last_read_inbox_message_id: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field last_read_outbox_message_id: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field unread_mention_count: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field unread_mention_count: %w", err) } c.UnreadMentionCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field unread_reaction_count: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field unread_reaction_count: %w", err) } c.UnreadReactionCount = value } { if err := c.NotificationSettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field notification_settings: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field notification_settings: %w", err) } } { value, err := DecodeChatAvailableReactions(b) if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field available_reactions: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field available_reactions: %w", err) } c.AvailableReactions = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field message_auto_delete_time: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field message_auto_delete_time: %w", err) } c.MessageAutoDeleteTime = value } { if err := c.EmojiStatus.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field emoji_status: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field emoji_status: %w", err) } } { if err := c.Background.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field background: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field background: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field theme_name: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field theme_name: %w", err) } c.ThemeName = value } { value, err := DecodeChatActionBar(b) if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field action_bar: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field action_bar: %w", err) } c.ActionBar = value } { if err := c.VideoChat.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field video_chat: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field video_chat: %w", err) } } { if err := c.PendingJoinRequests.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field pending_join_requests: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field pending_join_requests: %w", err) } } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field reply_markup_message_id: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field draft_message: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field draft_message: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field client_data: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field client_data: %w", err) } c.ClientData = value } @@ -846,7 +883,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#70f33afe as nil") + return fmt.Errorf("can't encode chat#57f1ba4 as nil") } b.ObjStart() b.PutID("chat") @@ -856,10 +893,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#70f33afe: field type is nil") + return fmt.Errorf("unable to encode chat#57f1ba4: field type is nil") } if err := c.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#70f33afe: field type: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field type: %w", err) } b.Comma() b.FieldStart("title") @@ -867,7 +904,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#70f33afe: field photo: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field photo: %w", err) } b.Comma() b.FieldStart("accent_color_id") @@ -884,19 +921,33 @@ 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#70f33afe: field permissions: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: 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#70f33afe: field last_message: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: 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#70f33afe: field positions element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode chat#57f1ba4: field positions element with index %d: %w", idx, err) + } + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.FieldStart("chat_lists") + b.ArrStart() + for idx, v := range c.ChatLists { + if v == nil { + return fmt.Errorf("unable to encode chat#57f1ba4: field chat_lists element with index %d is nil", idx) + } + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chat#57f1ba4: field chat_lists element with index %d: %w", idx, err) } b.Comma() } @@ -905,18 +956,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#70f33afe: field message_sender_id is nil") + return fmt.Errorf("unable to encode chat#57f1ba4: field message_sender_id is nil") } if err := c.MessageSenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#70f33afe: field message_sender_id: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field message_sender_id: %w", err) } b.Comma() b.FieldStart("block_list") if c.BlockList == nil { - return fmt.Errorf("unable to encode chat#70f33afe: field block_list is nil") + return fmt.Errorf("unable to encode chat#57f1ba4: field block_list is nil") } if err := c.BlockList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#70f33afe: field block_list: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field block_list: %w", err) } b.Comma() b.FieldStart("has_protected_content") @@ -963,15 +1014,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#70f33afe: field notification_settings: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field notification_settings: %w", err) } b.Comma() b.FieldStart("available_reactions") if c.AvailableReactions == nil { - return fmt.Errorf("unable to encode chat#70f33afe: field available_reactions is nil") + return fmt.Errorf("unable to encode chat#57f1ba4: field available_reactions is nil") } if err := c.AvailableReactions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#70f33afe: field available_reactions: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field available_reactions: %w", err) } b.Comma() b.FieldStart("message_auto_delete_time") @@ -979,12 +1030,12 @@ func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("emoji_status") if err := c.EmojiStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#70f33afe: field emoji_status: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field emoji_status: %w", err) } b.Comma() b.FieldStart("background") if err := c.Background.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#70f33afe: field background: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field background: %w", err) } b.Comma() b.FieldStart("theme_name") @@ -992,20 +1043,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#70f33afe: field action_bar is nil") + return fmt.Errorf("unable to encode chat#57f1ba4: field action_bar is nil") } if err := c.ActionBar.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#70f33afe: field action_bar: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: 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#70f33afe: field video_chat: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: 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#70f33afe: field pending_join_requests: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field pending_join_requests: %w", err) } b.Comma() b.FieldStart("reply_markup_message_id") @@ -1013,7 +1064,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#70f33afe: field draft_message: %w", err) + return fmt.Errorf("unable to encode chat#57f1ba4: field draft_message: %w", err) } b.Comma() b.FieldStart("client_data") @@ -1027,234 +1078,245 @@ 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#70f33afe to nil") + return fmt.Errorf("can't decode chat#57f1ba4 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#70f33afe: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: %w", err) } case "id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field id: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field id: %w", err) } c.ID = value case "type": value, err := DecodeTDLibJSONChatType(b) if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field type: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field type: %w", err) } c.Type = value case "title": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field title: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field title: %w", err) } c.Title = value case "photo": if err := c.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field photo: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field photo: %w", err) } case "accent_color_id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field accent_color_id: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field background_custom_emoji_id: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field background_custom_emoji_id: %w", err) } c.BackgroundCustomEmojiID = value case "profile_accent_color_id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field profile_accent_color_id: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field profile_accent_color_id: %w", err) } c.ProfileAccentColorID = value case "profile_background_custom_emoji_id": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field profile_background_custom_emoji_id: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field profile_background_custom_emoji_id: %w", err) } c.ProfileBackgroundCustomEmojiID = value case "permissions": if err := c.Permissions.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field permissions: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field permissions: %w", err) } case "last_message": if err := c.LastMessage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field last_message: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field positions: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field positions: %w", err) } c.Positions = append(c.Positions, value) return nil }); err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field positions: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field positions: %w", err) + } + case "chat_lists": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := DecodeTDLibJSONChatList(b) + if err != nil { + return fmt.Errorf("unable to decode chat#57f1ba4: field chat_lists: %w", err) + } + c.ChatLists = append(c.ChatLists, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode chat#57f1ba4: field chat_lists: %w", err) } case "message_sender_id": value, err := DecodeTDLibJSONMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field message_sender_id: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field block_list: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field has_protected_content: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field is_translatable: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field is_marked_as_unread: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field view_as_topics: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field has_scheduled_messages: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field can_be_deleted_only_for_self: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field can_be_deleted_for_all_users: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field can_be_reported: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field default_disable_notification: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field unread_count: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field last_read_inbox_message_id: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field last_read_outbox_message_id: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field unread_mention_count: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field unread_reaction_count: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field notification_settings: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field notification_settings: %w", err) } case "available_reactions": value, err := DecodeTDLibJSONChatAvailableReactions(b) if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field available_reactions: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field message_auto_delete_time: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field message_auto_delete_time: %w", err) } c.MessageAutoDeleteTime = value case "emoji_status": if err := c.EmojiStatus.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field emoji_status: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field emoji_status: %w", err) } case "background": if err := c.Background.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field background: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field background: %w", err) } case "theme_name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field theme_name: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field action_bar: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field video_chat: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field video_chat: %w", err) } case "pending_join_requests": if err := c.PendingJoinRequests.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field pending_join_requests: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field reply_markup_message_id: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: 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#70f33afe: field draft_message: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field draft_message: %w", err) } case "client_data": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chat#70f33afe: field client_data: %w", err) + return fmt.Errorf("unable to decode chat#57f1ba4: field client_data: %w", err) } c.ClientData = value default: @@ -1352,6 +1414,14 @@ func (c *Chat) GetPositions() (value []ChatPosition) { return c.Positions } +// GetChatLists returns value of ChatLists field. +func (c *Chat) GetChatLists() (value []ChatListClass) { + if c == nil { + return + } + return c.ChatLists +} + // GetMessageSenderID returns value of MessageSenderID field. func (c *Chat) GetMessageSenderID() (value MessageSenderClass) { if c == nil { diff --git a/tdapi/tl_check_quick_reply_shortcut_name_gen.go b/tdapi/tl_check_quick_reply_shortcut_name_gen.go new file mode 100644 index 0000000000..9a4c2923aa --- /dev/null +++ b/tdapi/tl_check_quick_reply_shortcut_name_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{} +) + +// CheckQuickReplyShortcutNameRequest represents TL type `checkQuickReplyShortcutName#7d3dd129`. +type CheckQuickReplyShortcutNameRequest struct { + // The name of the shortcut; 1-32 characters + Name string +} + +// CheckQuickReplyShortcutNameRequestTypeID is TL type id of CheckQuickReplyShortcutNameRequest. +const CheckQuickReplyShortcutNameRequestTypeID = 0x7d3dd129 + +// Ensuring interfaces in compile-time for CheckQuickReplyShortcutNameRequest. +var ( + _ bin.Encoder = &CheckQuickReplyShortcutNameRequest{} + _ bin.Decoder = &CheckQuickReplyShortcutNameRequest{} + _ bin.BareEncoder = &CheckQuickReplyShortcutNameRequest{} + _ bin.BareDecoder = &CheckQuickReplyShortcutNameRequest{} +) + +func (c *CheckQuickReplyShortcutNameRequest) Zero() bool { + if c == nil { + return true + } + if !(c.Name == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *CheckQuickReplyShortcutNameRequest) String() string { + if c == nil { + return "CheckQuickReplyShortcutNameRequest(nil)" + } + type Alias CheckQuickReplyShortcutNameRequest + return fmt.Sprintf("CheckQuickReplyShortcutNameRequest%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*CheckQuickReplyShortcutNameRequest) TypeID() uint32 { + return CheckQuickReplyShortcutNameRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*CheckQuickReplyShortcutNameRequest) TypeName() string { + return "checkQuickReplyShortcutName" +} + +// TypeInfo returns info about TL type. +func (c *CheckQuickReplyShortcutNameRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "checkQuickReplyShortcutName", + ID: CheckQuickReplyShortcutNameRequestTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Name", + SchemaName: "name", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *CheckQuickReplyShortcutNameRequest) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode checkQuickReplyShortcutName#7d3dd129 as nil") + } + b.PutID(CheckQuickReplyShortcutNameRequestTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *CheckQuickReplyShortcutNameRequest) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode checkQuickReplyShortcutName#7d3dd129 as nil") + } + b.PutString(c.Name) + return nil +} + +// Decode implements bin.Decoder. +func (c *CheckQuickReplyShortcutNameRequest) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode checkQuickReplyShortcutName#7d3dd129 to nil") + } + if err := b.ConsumeID(CheckQuickReplyShortcutNameRequestTypeID); err != nil { + return fmt.Errorf("unable to decode checkQuickReplyShortcutName#7d3dd129: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *CheckQuickReplyShortcutNameRequest) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode checkQuickReplyShortcutName#7d3dd129 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode checkQuickReplyShortcutName#7d3dd129: field name: %w", err) + } + c.Name = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *CheckQuickReplyShortcutNameRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode checkQuickReplyShortcutName#7d3dd129 as nil") + } + b.ObjStart() + b.PutID("checkQuickReplyShortcutName") + b.Comma() + b.FieldStart("name") + b.PutString(c.Name) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *CheckQuickReplyShortcutNameRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode checkQuickReplyShortcutName#7d3dd129 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("checkQuickReplyShortcutName"); err != nil { + return fmt.Errorf("unable to decode checkQuickReplyShortcutName#7d3dd129: %w", err) + } + case "name": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode checkQuickReplyShortcutName#7d3dd129: field name: %w", err) + } + c.Name = value + default: + return b.Skip() + } + return nil + }) +} + +// GetName returns value of Name field. +func (c *CheckQuickReplyShortcutNameRequest) GetName() (value string) { + if c == nil { + return + } + return c.Name +} + +// CheckQuickReplyShortcutName invokes method checkQuickReplyShortcutName#7d3dd129 returning error if any. +func (c *Client) CheckQuickReplyShortcutName(ctx context.Context, name string) error { + var ok Ok + + request := &CheckQuickReplyShortcutNameRequest{ + Name: name, + } + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_delete_business_connected_bot_gen.go b/tdapi/tl_delete_business_connected_bot_gen.go new file mode 100644 index 0000000000..3bdde5af18 --- /dev/null +++ b/tdapi/tl_delete_business_connected_bot_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{} +) + +// DeleteBusinessConnectedBotRequest represents TL type `deleteBusinessConnectedBot#9e9b7e55`. +type DeleteBusinessConnectedBotRequest struct { + // Unique user identifier for the bot + BotUserID int64 +} + +// DeleteBusinessConnectedBotRequestTypeID is TL type id of DeleteBusinessConnectedBotRequest. +const DeleteBusinessConnectedBotRequestTypeID = 0x9e9b7e55 + +// Ensuring interfaces in compile-time for DeleteBusinessConnectedBotRequest. +var ( + _ bin.Encoder = &DeleteBusinessConnectedBotRequest{} + _ bin.Decoder = &DeleteBusinessConnectedBotRequest{} + _ bin.BareEncoder = &DeleteBusinessConnectedBotRequest{} + _ bin.BareDecoder = &DeleteBusinessConnectedBotRequest{} +) + +func (d *DeleteBusinessConnectedBotRequest) Zero() bool { + if d == nil { + return true + } + if !(d.BotUserID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (d *DeleteBusinessConnectedBotRequest) String() string { + if d == nil { + return "DeleteBusinessConnectedBotRequest(nil)" + } + type Alias DeleteBusinessConnectedBotRequest + return fmt.Sprintf("DeleteBusinessConnectedBotRequest%+v", Alias(*d)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*DeleteBusinessConnectedBotRequest) TypeID() uint32 { + return DeleteBusinessConnectedBotRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*DeleteBusinessConnectedBotRequest) TypeName() string { + return "deleteBusinessConnectedBot" +} + +// TypeInfo returns info about TL type. +func (d *DeleteBusinessConnectedBotRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "deleteBusinessConnectedBot", + ID: DeleteBusinessConnectedBotRequestTypeID, + } + if d == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "BotUserID", + SchemaName: "bot_user_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (d *DeleteBusinessConnectedBotRequest) Encode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode deleteBusinessConnectedBot#9e9b7e55 as nil") + } + b.PutID(DeleteBusinessConnectedBotRequestTypeID) + return d.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (d *DeleteBusinessConnectedBotRequest) EncodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode deleteBusinessConnectedBot#9e9b7e55 as nil") + } + b.PutInt53(d.BotUserID) + return nil +} + +// Decode implements bin.Decoder. +func (d *DeleteBusinessConnectedBotRequest) Decode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode deleteBusinessConnectedBot#9e9b7e55 to nil") + } + if err := b.ConsumeID(DeleteBusinessConnectedBotRequestTypeID); err != nil { + return fmt.Errorf("unable to decode deleteBusinessConnectedBot#9e9b7e55: %w", err) + } + return d.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (d *DeleteBusinessConnectedBotRequest) DecodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode deleteBusinessConnectedBot#9e9b7e55 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode deleteBusinessConnectedBot#9e9b7e55: field bot_user_id: %w", err) + } + d.BotUserID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (d *DeleteBusinessConnectedBotRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if d == nil { + return fmt.Errorf("can't encode deleteBusinessConnectedBot#9e9b7e55 as nil") + } + b.ObjStart() + b.PutID("deleteBusinessConnectedBot") + b.Comma() + b.FieldStart("bot_user_id") + b.PutInt53(d.BotUserID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (d *DeleteBusinessConnectedBotRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if d == nil { + return fmt.Errorf("can't decode deleteBusinessConnectedBot#9e9b7e55 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("deleteBusinessConnectedBot"); err != nil { + return fmt.Errorf("unable to decode deleteBusinessConnectedBot#9e9b7e55: %w", err) + } + case "bot_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode deleteBusinessConnectedBot#9e9b7e55: field bot_user_id: %w", err) + } + d.BotUserID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetBotUserID returns value of BotUserID field. +func (d *DeleteBusinessConnectedBotRequest) GetBotUserID() (value int64) { + if d == nil { + return + } + return d.BotUserID +} + +// DeleteBusinessConnectedBot invokes method deleteBusinessConnectedBot#9e9b7e55 returning error if any. +func (c *Client) DeleteBusinessConnectedBot(ctx context.Context, botuserid int64) error { + var ok Ok + + request := &DeleteBusinessConnectedBotRequest{ + BotUserID: botuserid, + } + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_delete_quick_reply_shortcut_gen.go b/tdapi/tl_delete_quick_reply_shortcut_gen.go new file mode 100644 index 0000000000..60752c2209 --- /dev/null +++ b/tdapi/tl_delete_quick_reply_shortcut_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{} +) + +// DeleteQuickReplyShortcutRequest represents TL type `deleteQuickReplyShortcut#f1486c16`. +type DeleteQuickReplyShortcutRequest struct { + // Unique identifier of the quick reply shortcut + ShortcutID int32 +} + +// DeleteQuickReplyShortcutRequestTypeID is TL type id of DeleteQuickReplyShortcutRequest. +const DeleteQuickReplyShortcutRequestTypeID = 0xf1486c16 + +// Ensuring interfaces in compile-time for DeleteQuickReplyShortcutRequest. +var ( + _ bin.Encoder = &DeleteQuickReplyShortcutRequest{} + _ bin.Decoder = &DeleteQuickReplyShortcutRequest{} + _ bin.BareEncoder = &DeleteQuickReplyShortcutRequest{} + _ bin.BareDecoder = &DeleteQuickReplyShortcutRequest{} +) + +func (d *DeleteQuickReplyShortcutRequest) Zero() bool { + if d == nil { + return true + } + if !(d.ShortcutID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (d *DeleteQuickReplyShortcutRequest) String() string { + if d == nil { + return "DeleteQuickReplyShortcutRequest(nil)" + } + type Alias DeleteQuickReplyShortcutRequest + return fmt.Sprintf("DeleteQuickReplyShortcutRequest%+v", Alias(*d)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*DeleteQuickReplyShortcutRequest) TypeID() uint32 { + return DeleteQuickReplyShortcutRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*DeleteQuickReplyShortcutRequest) TypeName() string { + return "deleteQuickReplyShortcut" +} + +// TypeInfo returns info about TL type. +func (d *DeleteQuickReplyShortcutRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "deleteQuickReplyShortcut", + ID: DeleteQuickReplyShortcutRequestTypeID, + } + if d == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (d *DeleteQuickReplyShortcutRequest) Encode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode deleteQuickReplyShortcut#f1486c16 as nil") + } + b.PutID(DeleteQuickReplyShortcutRequestTypeID) + return d.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (d *DeleteQuickReplyShortcutRequest) EncodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode deleteQuickReplyShortcut#f1486c16 as nil") + } + b.PutInt32(d.ShortcutID) + return nil +} + +// Decode implements bin.Decoder. +func (d *DeleteQuickReplyShortcutRequest) Decode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode deleteQuickReplyShortcut#f1486c16 to nil") + } + if err := b.ConsumeID(DeleteQuickReplyShortcutRequestTypeID); err != nil { + return fmt.Errorf("unable to decode deleteQuickReplyShortcut#f1486c16: %w", err) + } + return d.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (d *DeleteQuickReplyShortcutRequest) DecodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode deleteQuickReplyShortcut#f1486c16 to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode deleteQuickReplyShortcut#f1486c16: field shortcut_id: %w", err) + } + d.ShortcutID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (d *DeleteQuickReplyShortcutRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if d == nil { + return fmt.Errorf("can't encode deleteQuickReplyShortcut#f1486c16 as nil") + } + b.ObjStart() + b.PutID("deleteQuickReplyShortcut") + b.Comma() + b.FieldStart("shortcut_id") + b.PutInt32(d.ShortcutID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (d *DeleteQuickReplyShortcutRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if d == nil { + return fmt.Errorf("can't decode deleteQuickReplyShortcut#f1486c16 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("deleteQuickReplyShortcut"); err != nil { + return fmt.Errorf("unable to decode deleteQuickReplyShortcut#f1486c16: %w", err) + } + case "shortcut_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode deleteQuickReplyShortcut#f1486c16: field shortcut_id: %w", err) + } + d.ShortcutID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetShortcutID returns value of ShortcutID field. +func (d *DeleteQuickReplyShortcutRequest) GetShortcutID() (value int32) { + if d == nil { + return + } + return d.ShortcutID +} + +// DeleteQuickReplyShortcut invokes method deleteQuickReplyShortcut#f1486c16 returning error if any. +func (c *Client) DeleteQuickReplyShortcut(ctx context.Context, shortcutid int32) error { + var ok Ok + + request := &DeleteQuickReplyShortcutRequest{ + ShortcutID: shortcutid, + } + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_delete_quick_reply_shortcut_messages_gen.go b/tdapi/tl_delete_quick_reply_shortcut_messages_gen.go new file mode 100644 index 0000000000..f858b698e6 --- /dev/null +++ b/tdapi/tl_delete_quick_reply_shortcut_messages_gen.go @@ -0,0 +1,261 @@ +// 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{} +) + +// DeleteQuickReplyShortcutMessagesRequest represents TL type `deleteQuickReplyShortcutMessages#e859fcbb`. +type DeleteQuickReplyShortcutMessagesRequest struct { + // Unique identifier of the quick reply shortcut to which the messages belong + ShortcutID int32 + // Unique identifiers of the messages + MessageIDs []int64 +} + +// DeleteQuickReplyShortcutMessagesRequestTypeID is TL type id of DeleteQuickReplyShortcutMessagesRequest. +const DeleteQuickReplyShortcutMessagesRequestTypeID = 0xe859fcbb + +// Ensuring interfaces in compile-time for DeleteQuickReplyShortcutMessagesRequest. +var ( + _ bin.Encoder = &DeleteQuickReplyShortcutMessagesRequest{} + _ bin.Decoder = &DeleteQuickReplyShortcutMessagesRequest{} + _ bin.BareEncoder = &DeleteQuickReplyShortcutMessagesRequest{} + _ bin.BareDecoder = &DeleteQuickReplyShortcutMessagesRequest{} +) + +func (d *DeleteQuickReplyShortcutMessagesRequest) Zero() bool { + if d == nil { + return true + } + if !(d.ShortcutID == 0) { + return false + } + if !(d.MessageIDs == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (d *DeleteQuickReplyShortcutMessagesRequest) String() string { + if d == nil { + return "DeleteQuickReplyShortcutMessagesRequest(nil)" + } + type Alias DeleteQuickReplyShortcutMessagesRequest + return fmt.Sprintf("DeleteQuickReplyShortcutMessagesRequest%+v", Alias(*d)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*DeleteQuickReplyShortcutMessagesRequest) TypeID() uint32 { + return DeleteQuickReplyShortcutMessagesRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*DeleteQuickReplyShortcutMessagesRequest) TypeName() string { + return "deleteQuickReplyShortcutMessages" +} + +// TypeInfo returns info about TL type. +func (d *DeleteQuickReplyShortcutMessagesRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "deleteQuickReplyShortcutMessages", + ID: DeleteQuickReplyShortcutMessagesRequestTypeID, + } + if d == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + { + Name: "MessageIDs", + SchemaName: "message_ids", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (d *DeleteQuickReplyShortcutMessagesRequest) Encode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode deleteQuickReplyShortcutMessages#e859fcbb as nil") + } + b.PutID(DeleteQuickReplyShortcutMessagesRequestTypeID) + return d.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (d *DeleteQuickReplyShortcutMessagesRequest) EncodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode deleteQuickReplyShortcutMessages#e859fcbb as nil") + } + b.PutInt32(d.ShortcutID) + b.PutInt(len(d.MessageIDs)) + for _, v := range d.MessageIDs { + b.PutInt53(v) + } + return nil +} + +// Decode implements bin.Decoder. +func (d *DeleteQuickReplyShortcutMessagesRequest) Decode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode deleteQuickReplyShortcutMessages#e859fcbb to nil") + } + if err := b.ConsumeID(DeleteQuickReplyShortcutMessagesRequestTypeID); err != nil { + return fmt.Errorf("unable to decode deleteQuickReplyShortcutMessages#e859fcbb: %w", err) + } + return d.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (d *DeleteQuickReplyShortcutMessagesRequest) DecodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode deleteQuickReplyShortcutMessages#e859fcbb to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode deleteQuickReplyShortcutMessages#e859fcbb: field shortcut_id: %w", err) + } + d.ShortcutID = value + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode deleteQuickReplyShortcutMessages#e859fcbb: field message_ids: %w", err) + } + + if headerLen > 0 { + d.MessageIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode deleteQuickReplyShortcutMessages#e859fcbb: field message_ids: %w", err) + } + d.MessageIDs = append(d.MessageIDs, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (d *DeleteQuickReplyShortcutMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if d == nil { + return fmt.Errorf("can't encode deleteQuickReplyShortcutMessages#e859fcbb as nil") + } + b.ObjStart() + b.PutID("deleteQuickReplyShortcutMessages") + b.Comma() + b.FieldStart("shortcut_id") + b.PutInt32(d.ShortcutID) + b.Comma() + b.FieldStart("message_ids") + b.ArrStart() + for _, v := range d.MessageIDs { + b.PutInt53(v) + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (d *DeleteQuickReplyShortcutMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if d == nil { + return fmt.Errorf("can't decode deleteQuickReplyShortcutMessages#e859fcbb to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("deleteQuickReplyShortcutMessages"); err != nil { + return fmt.Errorf("unable to decode deleteQuickReplyShortcutMessages#e859fcbb: %w", err) + } + case "shortcut_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode deleteQuickReplyShortcutMessages#e859fcbb: field shortcut_id: %w", err) + } + d.ShortcutID = 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 deleteQuickReplyShortcutMessages#e859fcbb: field message_ids: %w", err) + } + d.MessageIDs = append(d.MessageIDs, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode deleteQuickReplyShortcutMessages#e859fcbb: field message_ids: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetShortcutID returns value of ShortcutID field. +func (d *DeleteQuickReplyShortcutMessagesRequest) GetShortcutID() (value int32) { + if d == nil { + return + } + return d.ShortcutID +} + +// GetMessageIDs returns value of MessageIDs field. +func (d *DeleteQuickReplyShortcutMessagesRequest) GetMessageIDs() (value []int64) { + if d == nil { + return + } + return d.MessageIDs +} + +// DeleteQuickReplyShortcutMessages invokes method deleteQuickReplyShortcutMessages#e859fcbb returning error if any. +func (c *Client) DeleteQuickReplyShortcutMessages(ctx context.Context, request *DeleteQuickReplyShortcutMessagesRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_get_business_connected_bot_gen.go b/tdapi/tl_get_business_connected_bot_gen.go new file mode 100644 index 0000000000..f219c98420 --- /dev/null +++ b/tdapi/tl_get_business_connected_bot_gen.go @@ -0,0 +1,169 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// GetBusinessConnectedBotRequest represents TL type `getBusinessConnectedBot#364da7c3`. +type GetBusinessConnectedBotRequest struct { +} + +// GetBusinessConnectedBotRequestTypeID is TL type id of GetBusinessConnectedBotRequest. +const GetBusinessConnectedBotRequestTypeID = 0x364da7c3 + +// Ensuring interfaces in compile-time for GetBusinessConnectedBotRequest. +var ( + _ bin.Encoder = &GetBusinessConnectedBotRequest{} + _ bin.Decoder = &GetBusinessConnectedBotRequest{} + _ bin.BareEncoder = &GetBusinessConnectedBotRequest{} + _ bin.BareDecoder = &GetBusinessConnectedBotRequest{} +) + +func (g *GetBusinessConnectedBotRequest) Zero() bool { + if g == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetBusinessConnectedBotRequest) String() string { + if g == nil { + return "GetBusinessConnectedBotRequest(nil)" + } + type Alias GetBusinessConnectedBotRequest + return fmt.Sprintf("GetBusinessConnectedBotRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetBusinessConnectedBotRequest) TypeID() uint32 { + return GetBusinessConnectedBotRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetBusinessConnectedBotRequest) TypeName() string { + return "getBusinessConnectedBot" +} + +// TypeInfo returns info about TL type. +func (g *GetBusinessConnectedBotRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getBusinessConnectedBot", + ID: GetBusinessConnectedBotRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (g *GetBusinessConnectedBotRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getBusinessConnectedBot#364da7c3 as nil") + } + b.PutID(GetBusinessConnectedBotRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetBusinessConnectedBotRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getBusinessConnectedBot#364da7c3 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (g *GetBusinessConnectedBotRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getBusinessConnectedBot#364da7c3 to nil") + } + if err := b.ConsumeID(GetBusinessConnectedBotRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getBusinessConnectedBot#364da7c3: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetBusinessConnectedBotRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getBusinessConnectedBot#364da7c3 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetBusinessConnectedBotRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getBusinessConnectedBot#364da7c3 as nil") + } + b.ObjStart() + b.PutID("getBusinessConnectedBot") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetBusinessConnectedBotRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getBusinessConnectedBot#364da7c3 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getBusinessConnectedBot"); err != nil { + return fmt.Errorf("unable to decode getBusinessConnectedBot#364da7c3: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetBusinessConnectedBot invokes method getBusinessConnectedBot#364da7c3 returning error if any. +func (c *Client) GetBusinessConnectedBot(ctx context.Context) (*BusinessConnectedBot, error) { + var result BusinessConnectedBot + + request := &GetBusinessConnectedBotRequest{} + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_time_zones_gen.go b/tdapi/tl_get_time_zones_gen.go new file mode 100644 index 0000000000..e8b0b69c00 --- /dev/null +++ b/tdapi/tl_get_time_zones_gen.go @@ -0,0 +1,169 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// GetTimeZonesRequest represents TL type `getTimeZones#4fe2e058`. +type GetTimeZonesRequest struct { +} + +// GetTimeZonesRequestTypeID is TL type id of GetTimeZonesRequest. +const GetTimeZonesRequestTypeID = 0x4fe2e058 + +// Ensuring interfaces in compile-time for GetTimeZonesRequest. +var ( + _ bin.Encoder = &GetTimeZonesRequest{} + _ bin.Decoder = &GetTimeZonesRequest{} + _ bin.BareEncoder = &GetTimeZonesRequest{} + _ bin.BareDecoder = &GetTimeZonesRequest{} +) + +func (g *GetTimeZonesRequest) Zero() bool { + if g == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetTimeZonesRequest) String() string { + if g == nil { + return "GetTimeZonesRequest(nil)" + } + type Alias GetTimeZonesRequest + return fmt.Sprintf("GetTimeZonesRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetTimeZonesRequest) TypeID() uint32 { + return GetTimeZonesRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetTimeZonesRequest) TypeName() string { + return "getTimeZones" +} + +// TypeInfo returns info about TL type. +func (g *GetTimeZonesRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getTimeZones", + ID: GetTimeZonesRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (g *GetTimeZonesRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getTimeZones#4fe2e058 as nil") + } + b.PutID(GetTimeZonesRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetTimeZonesRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getTimeZones#4fe2e058 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (g *GetTimeZonesRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getTimeZones#4fe2e058 to nil") + } + if err := b.ConsumeID(GetTimeZonesRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getTimeZones#4fe2e058: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetTimeZonesRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getTimeZones#4fe2e058 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetTimeZonesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getTimeZones#4fe2e058 as nil") + } + b.ObjStart() + b.PutID("getTimeZones") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetTimeZonesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getTimeZones#4fe2e058 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getTimeZones"); err != nil { + return fmt.Errorf("unable to decode getTimeZones#4fe2e058: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetTimeZones invokes method getTimeZones#4fe2e058 returning error if any. +func (c *Client) GetTimeZones(ctx context.Context) (*TimeZones, error) { + var result TimeZones + + request := &GetTimeZonesRequest{} + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_load_quick_reply_shortcut_messages_gen.go b/tdapi/tl_load_quick_reply_shortcut_messages_gen.go new file mode 100644 index 0000000000..2a61a12cf8 --- /dev/null +++ b/tdapi/tl_load_quick_reply_shortcut_messages_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{} +) + +// LoadQuickReplyShortcutMessagesRequest represents TL type `loadQuickReplyShortcutMessages#fd40aed4`. +type LoadQuickReplyShortcutMessagesRequest struct { + // Unique identifier of the quick reply shortcut + ShortcutID int32 +} + +// LoadQuickReplyShortcutMessagesRequestTypeID is TL type id of LoadQuickReplyShortcutMessagesRequest. +const LoadQuickReplyShortcutMessagesRequestTypeID = 0xfd40aed4 + +// Ensuring interfaces in compile-time for LoadQuickReplyShortcutMessagesRequest. +var ( + _ bin.Encoder = &LoadQuickReplyShortcutMessagesRequest{} + _ bin.Decoder = &LoadQuickReplyShortcutMessagesRequest{} + _ bin.BareEncoder = &LoadQuickReplyShortcutMessagesRequest{} + _ bin.BareDecoder = &LoadQuickReplyShortcutMessagesRequest{} +) + +func (l *LoadQuickReplyShortcutMessagesRequest) Zero() bool { + if l == nil { + return true + } + if !(l.ShortcutID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (l *LoadQuickReplyShortcutMessagesRequest) String() string { + if l == nil { + return "LoadQuickReplyShortcutMessagesRequest(nil)" + } + type Alias LoadQuickReplyShortcutMessagesRequest + return fmt.Sprintf("LoadQuickReplyShortcutMessagesRequest%+v", Alias(*l)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*LoadQuickReplyShortcutMessagesRequest) TypeID() uint32 { + return LoadQuickReplyShortcutMessagesRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*LoadQuickReplyShortcutMessagesRequest) TypeName() string { + return "loadQuickReplyShortcutMessages" +} + +// TypeInfo returns info about TL type. +func (l *LoadQuickReplyShortcutMessagesRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "loadQuickReplyShortcutMessages", + ID: LoadQuickReplyShortcutMessagesRequestTypeID, + } + if l == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (l *LoadQuickReplyShortcutMessagesRequest) Encode(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't encode loadQuickReplyShortcutMessages#fd40aed4 as nil") + } + b.PutID(LoadQuickReplyShortcutMessagesRequestTypeID) + return l.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (l *LoadQuickReplyShortcutMessagesRequest) EncodeBare(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't encode loadQuickReplyShortcutMessages#fd40aed4 as nil") + } + b.PutInt32(l.ShortcutID) + return nil +} + +// Decode implements bin.Decoder. +func (l *LoadQuickReplyShortcutMessagesRequest) Decode(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't decode loadQuickReplyShortcutMessages#fd40aed4 to nil") + } + if err := b.ConsumeID(LoadQuickReplyShortcutMessagesRequestTypeID); err != nil { + return fmt.Errorf("unable to decode loadQuickReplyShortcutMessages#fd40aed4: %w", err) + } + return l.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (l *LoadQuickReplyShortcutMessagesRequest) DecodeBare(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't decode loadQuickReplyShortcutMessages#fd40aed4 to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode loadQuickReplyShortcutMessages#fd40aed4: field shortcut_id: %w", err) + } + l.ShortcutID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (l *LoadQuickReplyShortcutMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if l == nil { + return fmt.Errorf("can't encode loadQuickReplyShortcutMessages#fd40aed4 as nil") + } + b.ObjStart() + b.PutID("loadQuickReplyShortcutMessages") + b.Comma() + b.FieldStart("shortcut_id") + b.PutInt32(l.ShortcutID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (l *LoadQuickReplyShortcutMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if l == nil { + return fmt.Errorf("can't decode loadQuickReplyShortcutMessages#fd40aed4 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("loadQuickReplyShortcutMessages"); err != nil { + return fmt.Errorf("unable to decode loadQuickReplyShortcutMessages#fd40aed4: %w", err) + } + case "shortcut_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode loadQuickReplyShortcutMessages#fd40aed4: field shortcut_id: %w", err) + } + l.ShortcutID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetShortcutID returns value of ShortcutID field. +func (l *LoadQuickReplyShortcutMessagesRequest) GetShortcutID() (value int32) { + if l == nil { + return + } + return l.ShortcutID +} + +// LoadQuickReplyShortcutMessages invokes method loadQuickReplyShortcutMessages#fd40aed4 returning error if any. +func (c *Client) LoadQuickReplyShortcutMessages(ctx context.Context, shortcutid int32) error { + var ok Ok + + request := &LoadQuickReplyShortcutMessagesRequest{ + ShortcutID: shortcutid, + } + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_load_quick_reply_shortcuts_gen.go b/tdapi/tl_load_quick_reply_shortcuts_gen.go new file mode 100644 index 0000000000..231de0cea5 --- /dev/null +++ b/tdapi/tl_load_quick_reply_shortcuts_gen.go @@ -0,0 +1,169 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// LoadQuickReplyShortcutsRequest represents TL type `loadQuickReplyShortcuts#c367b29d`. +type LoadQuickReplyShortcutsRequest struct { +} + +// LoadQuickReplyShortcutsRequestTypeID is TL type id of LoadQuickReplyShortcutsRequest. +const LoadQuickReplyShortcutsRequestTypeID = 0xc367b29d + +// Ensuring interfaces in compile-time for LoadQuickReplyShortcutsRequest. +var ( + _ bin.Encoder = &LoadQuickReplyShortcutsRequest{} + _ bin.Decoder = &LoadQuickReplyShortcutsRequest{} + _ bin.BareEncoder = &LoadQuickReplyShortcutsRequest{} + _ bin.BareDecoder = &LoadQuickReplyShortcutsRequest{} +) + +func (l *LoadQuickReplyShortcutsRequest) Zero() bool { + if l == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (l *LoadQuickReplyShortcutsRequest) String() string { + if l == nil { + return "LoadQuickReplyShortcutsRequest(nil)" + } + type Alias LoadQuickReplyShortcutsRequest + return fmt.Sprintf("LoadQuickReplyShortcutsRequest%+v", Alias(*l)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*LoadQuickReplyShortcutsRequest) TypeID() uint32 { + return LoadQuickReplyShortcutsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*LoadQuickReplyShortcutsRequest) TypeName() string { + return "loadQuickReplyShortcuts" +} + +// TypeInfo returns info about TL type. +func (l *LoadQuickReplyShortcutsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "loadQuickReplyShortcuts", + ID: LoadQuickReplyShortcutsRequestTypeID, + } + if l == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (l *LoadQuickReplyShortcutsRequest) Encode(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't encode loadQuickReplyShortcuts#c367b29d as nil") + } + b.PutID(LoadQuickReplyShortcutsRequestTypeID) + return l.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (l *LoadQuickReplyShortcutsRequest) EncodeBare(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't encode loadQuickReplyShortcuts#c367b29d as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (l *LoadQuickReplyShortcutsRequest) Decode(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't decode loadQuickReplyShortcuts#c367b29d to nil") + } + if err := b.ConsumeID(LoadQuickReplyShortcutsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode loadQuickReplyShortcuts#c367b29d: %w", err) + } + return l.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (l *LoadQuickReplyShortcutsRequest) DecodeBare(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't decode loadQuickReplyShortcuts#c367b29d to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (l *LoadQuickReplyShortcutsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if l == nil { + return fmt.Errorf("can't encode loadQuickReplyShortcuts#c367b29d as nil") + } + b.ObjStart() + b.PutID("loadQuickReplyShortcuts") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (l *LoadQuickReplyShortcutsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if l == nil { + return fmt.Errorf("can't decode loadQuickReplyShortcuts#c367b29d to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("loadQuickReplyShortcuts"); err != nil { + return fmt.Errorf("unable to decode loadQuickReplyShortcuts#c367b29d: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// LoadQuickReplyShortcuts invokes method loadQuickReplyShortcuts#c367b29d returning error if any. +func (c *Client) LoadQuickReplyShortcuts(ctx context.Context) error { + var ok Ok + + request := &LoadQuickReplyShortcutsRequest{} + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_quick_reply_message_gen.go b/tdapi/tl_quick_reply_message_gen.go new file mode 100644 index 0000000000..fde7ef727f --- /dev/null +++ b/tdapi/tl_quick_reply_message_gen.go @@ -0,0 +1,464 @@ +// 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{} +) + +// QuickReplyMessage represents TL type `quickReplyMessage#bef92f03`. +type QuickReplyMessage struct { + // Unique message identifier among all quick replies + ID int64 + // The sending state of the message; may be null if the message isn't being sent and + // didn't fail to be sent + SendingState MessageSendingStateClass + // True, if the message can be edited + CanBeEdited bool + // Information about the identifier of the quick reply message to which the message + // replies + ReplyToMessageID int64 + // If non-zero, the user identifier of the bot through which this message was sent + ViaBotUserID int64 + // Unique identifier of an album this message belongs to. Only audios, documents, photos + // and videos can be grouped together in albums + MediaAlbumID int64 + // Content of the message + Content MessageContentClass + // Inline keyboard reply markup for the message; may be null if none + ReplyMarkup ReplyMarkupClass +} + +// QuickReplyMessageTypeID is TL type id of QuickReplyMessage. +const QuickReplyMessageTypeID = 0xbef92f03 + +// Ensuring interfaces in compile-time for QuickReplyMessage. +var ( + _ bin.Encoder = &QuickReplyMessage{} + _ bin.Decoder = &QuickReplyMessage{} + _ bin.BareEncoder = &QuickReplyMessage{} + _ bin.BareDecoder = &QuickReplyMessage{} +) + +func (q *QuickReplyMessage) Zero() bool { + if q == nil { + return true + } + if !(q.ID == 0) { + return false + } + if !(q.SendingState == nil) { + return false + } + if !(q.CanBeEdited == false) { + return false + } + if !(q.ReplyToMessageID == 0) { + return false + } + if !(q.ViaBotUserID == 0) { + return false + } + if !(q.MediaAlbumID == 0) { + return false + } + if !(q.Content == nil) { + return false + } + if !(q.ReplyMarkup == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (q *QuickReplyMessage) String() string { + if q == nil { + return "QuickReplyMessage(nil)" + } + type Alias QuickReplyMessage + return fmt.Sprintf("QuickReplyMessage%+v", Alias(*q)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*QuickReplyMessage) TypeID() uint32 { + return QuickReplyMessageTypeID +} + +// TypeName returns name of type in TL schema. +func (*QuickReplyMessage) TypeName() string { + return "quickReplyMessage" +} + +// TypeInfo returns info about TL type. +func (q *QuickReplyMessage) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "quickReplyMessage", + ID: QuickReplyMessageTypeID, + } + if q == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ID", + SchemaName: "id", + }, + { + Name: "SendingState", + SchemaName: "sending_state", + }, + { + Name: "CanBeEdited", + SchemaName: "can_be_edited", + }, + { + Name: "ReplyToMessageID", + SchemaName: "reply_to_message_id", + }, + { + Name: "ViaBotUserID", + SchemaName: "via_bot_user_id", + }, + { + Name: "MediaAlbumID", + SchemaName: "media_album_id", + }, + { + Name: "Content", + SchemaName: "content", + }, + { + Name: "ReplyMarkup", + SchemaName: "reply_markup", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (q *QuickReplyMessage) Encode(b *bin.Buffer) error { + if q == nil { + return fmt.Errorf("can't encode quickReplyMessage#bef92f03 as nil") + } + b.PutID(QuickReplyMessageTypeID) + return q.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (q *QuickReplyMessage) EncodeBare(b *bin.Buffer) error { + if q == nil { + return fmt.Errorf("can't encode quickReplyMessage#bef92f03 as nil") + } + b.PutInt53(q.ID) + if q.SendingState == nil { + return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field sending_state is nil") + } + if err := q.SendingState.Encode(b); err != nil { + return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field sending_state: %w", err) + } + b.PutBool(q.CanBeEdited) + b.PutInt53(q.ReplyToMessageID) + b.PutInt53(q.ViaBotUserID) + b.PutLong(q.MediaAlbumID) + if q.Content == nil { + return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field content is nil") + } + if err := q.Content.Encode(b); err != nil { + return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field content: %w", err) + } + if q.ReplyMarkup == nil { + return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field reply_markup is nil") + } + if err := q.ReplyMarkup.Encode(b); err != nil { + return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field reply_markup: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (q *QuickReplyMessage) Decode(b *bin.Buffer) error { + if q == nil { + return fmt.Errorf("can't decode quickReplyMessage#bef92f03 to nil") + } + if err := b.ConsumeID(QuickReplyMessageTypeID); err != nil { + return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: %w", err) + } + return q.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (q *QuickReplyMessage) DecodeBare(b *bin.Buffer) error { + if q == nil { + return fmt.Errorf("can't decode quickReplyMessage#bef92f03 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field id: %w", err) + } + q.ID = value + } + { + value, err := DecodeMessageSendingState(b) + if err != nil { + return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field sending_state: %w", err) + } + q.SendingState = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field can_be_edited: %w", err) + } + q.CanBeEdited = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field reply_to_message_id: %w", err) + } + q.ReplyToMessageID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field via_bot_user_id: %w", err) + } + q.ViaBotUserID = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field media_album_id: %w", err) + } + q.MediaAlbumID = value + } + { + value, err := DecodeMessageContent(b) + if err != nil { + return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field content: %w", err) + } + q.Content = value + } + { + value, err := DecodeReplyMarkup(b) + if err != nil { + return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field reply_markup: %w", err) + } + q.ReplyMarkup = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (q *QuickReplyMessage) EncodeTDLibJSON(b tdjson.Encoder) error { + if q == nil { + return fmt.Errorf("can't encode quickReplyMessage#bef92f03 as nil") + } + b.ObjStart() + b.PutID("quickReplyMessage") + b.Comma() + b.FieldStart("id") + b.PutInt53(q.ID) + b.Comma() + b.FieldStart("sending_state") + if q.SendingState == nil { + return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field sending_state is nil") + } + if err := q.SendingState.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field sending_state: %w", err) + } + b.Comma() + b.FieldStart("can_be_edited") + b.PutBool(q.CanBeEdited) + b.Comma() + b.FieldStart("reply_to_message_id") + b.PutInt53(q.ReplyToMessageID) + b.Comma() + b.FieldStart("via_bot_user_id") + b.PutInt53(q.ViaBotUserID) + b.Comma() + b.FieldStart("media_album_id") + b.PutLong(q.MediaAlbumID) + b.Comma() + b.FieldStart("content") + if q.Content == nil { + return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field content is nil") + } + if err := q.Content.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field content: %w", err) + } + b.Comma() + b.FieldStart("reply_markup") + if q.ReplyMarkup == nil { + return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field reply_markup is nil") + } + if err := q.ReplyMarkup.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field reply_markup: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (q *QuickReplyMessage) DecodeTDLibJSON(b tdjson.Decoder) error { + if q == nil { + return fmt.Errorf("can't decode quickReplyMessage#bef92f03 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("quickReplyMessage"); err != nil { + return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: %w", err) + } + case "id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field id: %w", err) + } + q.ID = value + case "sending_state": + value, err := DecodeTDLibJSONMessageSendingState(b) + if err != nil { + return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field sending_state: %w", err) + } + q.SendingState = value + case "can_be_edited": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field can_be_edited: %w", err) + } + q.CanBeEdited = value + case "reply_to_message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field reply_to_message_id: %w", err) + } + q.ReplyToMessageID = value + case "via_bot_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field via_bot_user_id: %w", err) + } + q.ViaBotUserID = value + case "media_album_id": + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field media_album_id: %w", err) + } + q.MediaAlbumID = value + case "content": + value, err := DecodeTDLibJSONMessageContent(b) + if err != nil { + return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field content: %w", err) + } + q.Content = value + case "reply_markup": + value, err := DecodeTDLibJSONReplyMarkup(b) + if err != nil { + return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field reply_markup: %w", err) + } + q.ReplyMarkup = value + default: + return b.Skip() + } + return nil + }) +} + +// GetID returns value of ID field. +func (q *QuickReplyMessage) GetID() (value int64) { + if q == nil { + return + } + return q.ID +} + +// GetSendingState returns value of SendingState field. +func (q *QuickReplyMessage) GetSendingState() (value MessageSendingStateClass) { + if q == nil { + return + } + return q.SendingState +} + +// GetCanBeEdited returns value of CanBeEdited field. +func (q *QuickReplyMessage) GetCanBeEdited() (value bool) { + if q == nil { + return + } + return q.CanBeEdited +} + +// GetReplyToMessageID returns value of ReplyToMessageID field. +func (q *QuickReplyMessage) GetReplyToMessageID() (value int64) { + if q == nil { + return + } + return q.ReplyToMessageID +} + +// GetViaBotUserID returns value of ViaBotUserID field. +func (q *QuickReplyMessage) GetViaBotUserID() (value int64) { + if q == nil { + return + } + return q.ViaBotUserID +} + +// GetMediaAlbumID returns value of MediaAlbumID field. +func (q *QuickReplyMessage) GetMediaAlbumID() (value int64) { + if q == nil { + return + } + return q.MediaAlbumID +} + +// GetContent returns value of Content field. +func (q *QuickReplyMessage) GetContent() (value MessageContentClass) { + if q == nil { + return + } + return q.Content +} + +// GetReplyMarkup returns value of ReplyMarkup field. +func (q *QuickReplyMessage) GetReplyMarkup() (value ReplyMarkupClass) { + if q == nil { + return + } + return q.ReplyMarkup +} diff --git a/tdapi/tl_quick_reply_shortcut_gen.go b/tdapi/tl_quick_reply_shortcut_gen.go new file mode 100644 index 0000000000..30268c92f8 --- /dev/null +++ b/tdapi/tl_quick_reply_shortcut_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{} +) + +// QuickReplyShortcut represents TL type `quickReplyShortcut#bdfd9a95`. +type QuickReplyShortcut struct { + // Unique shortcut identifier + ID int32 + // The name of the shortcut that can be used to use the shortcut + Name string + // The first shortcut message + FirstMessage QuickReplyMessage + // The total number of messages in the shortcut + MessageCount int32 +} + +// QuickReplyShortcutTypeID is TL type id of QuickReplyShortcut. +const QuickReplyShortcutTypeID = 0xbdfd9a95 + +// Ensuring interfaces in compile-time for QuickReplyShortcut. +var ( + _ bin.Encoder = &QuickReplyShortcut{} + _ bin.Decoder = &QuickReplyShortcut{} + _ bin.BareEncoder = &QuickReplyShortcut{} + _ bin.BareDecoder = &QuickReplyShortcut{} +) + +func (q *QuickReplyShortcut) Zero() bool { + if q == nil { + return true + } + if !(q.ID == 0) { + return false + } + if !(q.Name == "") { + return false + } + if !(q.FirstMessage.Zero()) { + return false + } + if !(q.MessageCount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (q *QuickReplyShortcut) String() string { + if q == nil { + return "QuickReplyShortcut(nil)" + } + type Alias QuickReplyShortcut + return fmt.Sprintf("QuickReplyShortcut%+v", Alias(*q)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*QuickReplyShortcut) TypeID() uint32 { + return QuickReplyShortcutTypeID +} + +// TypeName returns name of type in TL schema. +func (*QuickReplyShortcut) TypeName() string { + return "quickReplyShortcut" +} + +// TypeInfo returns info about TL type. +func (q *QuickReplyShortcut) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "quickReplyShortcut", + ID: QuickReplyShortcutTypeID, + } + if q == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ID", + SchemaName: "id", + }, + { + Name: "Name", + SchemaName: "name", + }, + { + Name: "FirstMessage", + SchemaName: "first_message", + }, + { + Name: "MessageCount", + SchemaName: "message_count", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (q *QuickReplyShortcut) Encode(b *bin.Buffer) error { + if q == nil { + return fmt.Errorf("can't encode quickReplyShortcut#bdfd9a95 as nil") + } + b.PutID(QuickReplyShortcutTypeID) + return q.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (q *QuickReplyShortcut) EncodeBare(b *bin.Buffer) error { + if q == nil { + return fmt.Errorf("can't encode quickReplyShortcut#bdfd9a95 as nil") + } + b.PutInt32(q.ID) + b.PutString(q.Name) + if err := q.FirstMessage.Encode(b); err != nil { + return fmt.Errorf("unable to encode quickReplyShortcut#bdfd9a95: field first_message: %w", err) + } + b.PutInt32(q.MessageCount) + return nil +} + +// Decode implements bin.Decoder. +func (q *QuickReplyShortcut) Decode(b *bin.Buffer) error { + if q == nil { + return fmt.Errorf("can't decode quickReplyShortcut#bdfd9a95 to nil") + } + if err := b.ConsumeID(QuickReplyShortcutTypeID); err != nil { + return fmt.Errorf("unable to decode quickReplyShortcut#bdfd9a95: %w", err) + } + return q.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (q *QuickReplyShortcut) DecodeBare(b *bin.Buffer) error { + if q == nil { + return fmt.Errorf("can't decode quickReplyShortcut#bdfd9a95 to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode quickReplyShortcut#bdfd9a95: field id: %w", err) + } + q.ID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode quickReplyShortcut#bdfd9a95: field name: %w", err) + } + q.Name = value + } + { + if err := q.FirstMessage.Decode(b); err != nil { + return fmt.Errorf("unable to decode quickReplyShortcut#bdfd9a95: field first_message: %w", err) + } + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode quickReplyShortcut#bdfd9a95: field message_count: %w", err) + } + q.MessageCount = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (q *QuickReplyShortcut) EncodeTDLibJSON(b tdjson.Encoder) error { + if q == nil { + return fmt.Errorf("can't encode quickReplyShortcut#bdfd9a95 as nil") + } + b.ObjStart() + b.PutID("quickReplyShortcut") + b.Comma() + b.FieldStart("id") + b.PutInt32(q.ID) + b.Comma() + b.FieldStart("name") + b.PutString(q.Name) + b.Comma() + b.FieldStart("first_message") + if err := q.FirstMessage.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode quickReplyShortcut#bdfd9a95: field first_message: %w", err) + } + b.Comma() + b.FieldStart("message_count") + b.PutInt32(q.MessageCount) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (q *QuickReplyShortcut) DecodeTDLibJSON(b tdjson.Decoder) error { + if q == nil { + return fmt.Errorf("can't decode quickReplyShortcut#bdfd9a95 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("quickReplyShortcut"); err != nil { + return fmt.Errorf("unable to decode quickReplyShortcut#bdfd9a95: %w", err) + } + case "id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode quickReplyShortcut#bdfd9a95: field id: %w", err) + } + q.ID = value + case "name": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode quickReplyShortcut#bdfd9a95: field name: %w", err) + } + q.Name = value + case "first_message": + if err := q.FirstMessage.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode quickReplyShortcut#bdfd9a95: field first_message: %w", err) + } + case "message_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode quickReplyShortcut#bdfd9a95: field message_count: %w", err) + } + q.MessageCount = value + default: + return b.Skip() + } + return nil + }) +} + +// GetID returns value of ID field. +func (q *QuickReplyShortcut) GetID() (value int32) { + if q == nil { + return + } + return q.ID +} + +// GetName returns value of Name field. +func (q *QuickReplyShortcut) GetName() (value string) { + if q == nil { + return + } + return q.Name +} + +// GetFirstMessage returns value of FirstMessage field. +func (q *QuickReplyShortcut) GetFirstMessage() (value QuickReplyMessage) { + if q == nil { + return + } + return q.FirstMessage +} + +// GetMessageCount returns value of MessageCount field. +func (q *QuickReplyShortcut) GetMessageCount() (value int32) { + if q == nil { + return + } + return q.MessageCount +} diff --git a/tdapi/tl_registry_gen.go b/tdapi/tl_registry_gen.go index a25bb3c643..04b7c6e4c7 100644 --- a/tdapi/tl_registry_gen.go +++ b/tdapi/tl_registry_gen.go @@ -141,6 +141,17 @@ func TypesMap() map[uint32]string { BotCommandsTypeID: "botCommands#4f9aa2c5", BotMenuButtonTypeID: "botMenuButton#c7b57ce6", ChatLocationTypeID: "chatLocation#a29b8f21", + BusinessAwayMessageScheduleAlwaysTypeID: "businessAwayMessageScheduleAlways#c9b9e2b9", + BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID: "businessAwayMessageScheduleOutsideOfOpeningHours#c643df16", + BusinessAwayMessageScheduleCustomTypeID: "businessAwayMessageScheduleCustom#8ac04dd2", + BusinessLocationTypeID: "businessLocation#bf54af5a", + BusinessRecipientsTypeID: "businessRecipients#2f3ca54a", + BusinessAwayMessageSettingsTypeID: "businessAwayMessageSettings#150ba2e9", + BusinessGreetingMessageSettingsTypeID: "businessGreetingMessageSettings#64ae3e12", + BusinessConnectedBotTypeID: "businessConnectedBot#ec50ead7", + BusinessOpeningHoursIntervalTypeID: "businessOpeningHoursInterval#bdf05654", + BusinessOpeningHoursTypeID: "businessOpeningHours#a623e64a", + BusinessInfoTypeID: "businessInfo#773c5066", ChatPhotoStickerTypeRegularOrMaskTypeID: "chatPhotoStickerTypeRegularOrMask#e741599c", ChatPhotoStickerTypeCustomEmojiTypeID: "chatPhotoStickerTypeCustomEmoji#f021bad1", ChatPhotoStickerTypeID: "chatPhotoSticker#a90383a3", @@ -173,7 +184,7 @@ func TypesMap() map[uint32]string { UsernamesTypeID: "usernames#bf343063", UserTypeID: "user#18552c62", BotInfoTypeID: "botInfo#bfdb89a", - UserFullInfoTypeID: "userFullInfo#cc594e6f", + UserFullInfoTypeID: "userFullInfo#760faed8", UsersTypeID: "users#9d955a12", ChatAdministratorTypeID: "chatAdministrator#7277bd2c", ChatAdministratorsTypeID: "chatAdministrators#5141ca21", @@ -295,8 +306,8 @@ func TypesMap() map[uint32]string { ChatTypeSupergroupTypeID: "chatTypeSupergroup#a83a5a6a", ChatTypeSecretTypeID: "chatTypeSecret#3366ab31", ChatFolderIconTypeID: "chatFolderIcon#f74aa0e6", - ChatFolderTypeID: "chatFolder#aa7d5740", - ChatFolderInfoTypeID: "chatFolderInfo#4c3ee0d4", + ChatFolderTypeID: "chatFolder#65805ba5", + ChatFolderInfoTypeID: "chatFolderInfo#b61a485", ChatFolderInviteLinkTypeID: "chatFolderInviteLink#d33caf97", ChatFolderInviteLinksTypeID: "chatFolderInviteLinks#6c135313", ChatFolderInviteLinkInfoTypeID: "chatFolderInviteLinkInfo#776fe405", @@ -315,7 +326,7 @@ func TypesMap() map[uint32]string { SavedMessagesTagTypeID: "savedMessagesTag#6a67bc61", SavedMessagesTagsTypeID: "savedMessagesTags#ca94a1b3", VideoChatTypeID: "videoChat#ae158d28", - ChatTypeID: "chat#70f33afe", + ChatTypeID: "chat#57f1ba4", ChatsTypeID: "chats#9b93e3eb", ChatNearbyTypeID: "chatNearby#2de4255", ChatsNearbyTypeID: "chatsNearby#cc744cff", @@ -728,6 +739,8 @@ func TypesMap() map[uint32]string { StoryInteractionTypeRepostTypeID: "storyInteractionTypeRepost#c32279c4", StoryInteractionTypeID: "storyInteraction#d624d222", StoryInteractionsTypeID: "storyInteractions#f9f5d50f", + QuickReplyMessageTypeID: "quickReplyMessage#bef92f03", + QuickReplyShortcutTypeID: "quickReplyShortcut#bdfd9a95", PublicForwardMessageTypeID: "publicForwardMessage#317b3d2", PublicForwardStoryTypeID: "publicForwardStory#7fdf26af", PublicForwardsTypeID: "publicForwards#3ed29447", @@ -988,6 +1001,8 @@ func TypesMap() map[uint32]string { InputBackgroundPreviousTypeID: "inputBackgroundPrevious#eb06575e", ThemeSettingsTypeID: "themeSettings#fc4c1c12", ChatThemeTypeID: "chatTheme#f9406c39", + TimeZoneTypeID: "timeZone#b919f2dd", + TimeZonesTypeID: "timeZones#7c4881b9", HashtagsTypeID: "hashtags#6c2c0ae1", CanSendStoryResultOkTypeID: "canSendStoryResultOk#503cf0fd", CanSendStoryResultPremiumNeededTypeID: "canSendStoryResultPremiumNeeded#567fde69", @@ -1315,6 +1330,8 @@ func TypesMap() map[uint32]string { UpdateChatPermissionsTypeID: "updateChatPermissions#9f52176d", UpdateChatLastMessageTypeID: "updateChatLastMessage#f10cab1d", UpdateChatPositionTypeID: "updateChatPosition#ff76fa77", + UpdateChatAddedToListTypeID: "updateChatAddedToList#ab7004ec", + UpdateChatRemovedFromListTypeID: "updateChatRemovedFromList#4d2ac21c", UpdateChatReadInboxTypeID: "updateChatReadInbox#d07036e7", UpdateChatReadOutboxTypeID: "updateChatReadOutbox#2a385285", UpdateChatActionBarTypeID: "updateChatActionBar#d9a258c2", @@ -1338,10 +1355,14 @@ func TypesMap() map[uint32]string { UpdateChatViewAsTopicsTypeID: "updateChatViewAsTopics#5bff163d", UpdateChatBlockListTypeID: "updateChatBlockList#872af48e", UpdateChatHasScheduledMessagesTypeID: "updateChatHasScheduledMessages#7b14c2d7", - UpdateChatFoldersTypeID: "updateChatFolders#71a4b3a", + UpdateChatFoldersTypeID: "updateChatFolders#e110242a", UpdateChatOnlineMemberCountTypeID: "updateChatOnlineMemberCount#1d0caa9d", UpdateSavedMessagesTopicTypeID: "updateSavedMessagesTopic#9f823b30", UpdateSavedMessagesTopicCountTypeID: "updateSavedMessagesTopicCount#fbd279d1", + UpdateQuickReplyShortcutTypeID: "updateQuickReplyShortcut#c69338cf", + UpdateQuickReplyShortcutDeletedTypeID: "updateQuickReplyShortcutDeleted#e8b9bc3a", + UpdateQuickReplyShortcutsTypeID: "updateQuickReplyShortcuts#77d31a6a", + UpdateQuickReplyShortcutMessagesTypeID: "updateQuickReplyShortcutMessages#8bb36b72", UpdateForumTopicInfoTypeID: "updateForumTopicInfo#6b6f2cc9", UpdateScopeNotificationSettingsTypeID: "updateScopeNotificationSettings#b83ccb73", UpdateNotificationTypeID: "updateNotification#8ee67ed4", @@ -1564,6 +1585,7 @@ func TypesMap() map[uint32]string { SendBotStartMessageRequestTypeID: "sendBotStartMessage#aa6a3eee", SendInlineQueryResultMessageRequestTypeID: "sendInlineQueryResultMessage#467c5478", ForwardMessagesRequestTypeID: "forwardMessages#34de5b20", + SendQuickReplyShortcutMessagesRequestTypeID: "sendQuickReplyShortcutMessages#dd5169d", ResendMessagesRequestTypeID: "resendMessages#90e36776", AddLocalMessageRequestTypeID: "addLocalMessage#f617b7a1", DeleteMessagesRequestTypeID: "deleteMessages#c3ed9de2", @@ -1580,6 +1602,13 @@ func TypesMap() map[uint32]string { EditInlineMessageCaptionRequestTypeID: "editInlineMessageCaption#d2a446b7", EditInlineMessageReplyMarkupRequestTypeID: "editInlineMessageReplyMarkup#fbf906de", EditMessageSchedulingStateRequestTypeID: "editMessageSchedulingState#ae2a0bc0", + CheckQuickReplyShortcutNameRequestTypeID: "checkQuickReplyShortcutName#7d3dd129", + LoadQuickReplyShortcutsRequestTypeID: "loadQuickReplyShortcuts#c367b29d", + SetQuickReplyShortcutNameRequestTypeID: "setQuickReplyShortcutName#b20f471", + DeleteQuickReplyShortcutRequestTypeID: "deleteQuickReplyShortcut#f1486c16", + ReorderQuickReplyShortcutsRequestTypeID: "reorderQuickReplyShortcuts#b04981c4", + LoadQuickReplyShortcutMessagesRequestTypeID: "loadQuickReplyShortcutMessages#fd40aed4", + DeleteQuickReplyShortcutMessagesRequestTypeID: "deleteQuickReplyShortcutMessages#e859fcbb", GetForumTopicDefaultIconsRequestTypeID: "getForumTopicDefaultIcons#583574dc", CreateForumTopicRequestTypeID: "createForumTopic#c1fa28e4", EditForumTopicRequestTypeID: "editForumTopic#a7769060", @@ -1673,6 +1702,7 @@ func TypesMap() map[uint32]string { GetChatFolderChatsToLeaveRequestTypeID: "getChatFolderChatsToLeave#8dc1e6af", GetChatFolderChatCountRequestTypeID: "getChatFolderChatCount#7dd4cbbe", ReorderChatFoldersRequestTypeID: "reorderChatFolders#59544c32", + ToggleChatFolderTagsRequestTypeID: "toggleChatFolderTags#834b6c44", GetRecommendedChatFoldersRequestTypeID: "getRecommendedChatFolders#f7533b87", GetChatFolderDefaultIconNameRequestTypeID: "getChatFolderDefaultIconName#2cf7a067", GetChatsForChatFolderInviteLinkRequestTypeID: "getChatsForChatFolderInviteLink#6fac4949", @@ -1918,9 +1948,16 @@ func TypesMap() map[uint32]string { ReorderActiveUsernamesRequestTypeID: "reorderActiveUsernames#c659414f", SetEmojiStatusRequestTypeID: "setEmojiStatus#92f83e5d", SetLocationRequestTypeID: "setLocation#5993371", + SetBusinessLocationRequestTypeID: "setBusinessLocation#eb740715", + SetBusinessOpeningHoursRequestTypeID: "setBusinessOpeningHours#e470a472", + SetBusinessGreetingMessageSettingsRequestTypeID: "setBusinessGreetingMessageSettings#cbf53c3d", + SetBusinessAwayMessageSettingsRequestTypeID: "setBusinessAwayMessageSettings#4974486c", ChangePhoneNumberRequestTypeID: "changePhoneNumber#f891bba3", ResendChangePhoneNumberCodeRequestTypeID: "resendChangePhoneNumberCode#d11acfa4", CheckChangePhoneNumberCodeRequestTypeID: "checkChangePhoneNumberCode#9976a263", + GetBusinessConnectedBotRequestTypeID: "getBusinessConnectedBot#364da7c3", + SetBusinessConnectedBotRequestTypeID: "setBusinessConnectedBot#acf17ef0", + DeleteBusinessConnectedBotRequestTypeID: "deleteBusinessConnectedBot#9e9b7e55", GetUserLinkRequestTypeID: "getUserLink#492014e6", SearchUserByTokenRequestTypeID: "searchUserByToken#d841f436", SetCommandsRequestTypeID: "setCommands#b0e0217a", @@ -1972,6 +2009,7 @@ func TypesMap() map[uint32]string { GetSupergroupMembersRequestTypeID: "getSupergroupMembers#ddf821c8", CloseSecretChatRequestTypeID: "closeSecretChat#e3ed044b", GetChatEventLogRequestTypeID: "getChatEventLog#f47b0a9b", + GetTimeZonesRequestTypeID: "getTimeZones#4fe2e058", GetPaymentFormRequestTypeID: "getPaymentForm#8d4f76d4", ValidateOrderInfoRequestTypeID: "validateOrderInfo#b5985fcf", SendPaymentFormRequestTypeID: "sendPaymentForm#c66e388a", @@ -2244,24 +2282,35 @@ func NamesMap() map[string]uint32 { "botCommands": BotCommandsTypeID, "botMenuButton": BotMenuButtonTypeID, "chatLocation": ChatLocationTypeID, - "chatPhotoStickerTypeRegularOrMask": ChatPhotoStickerTypeRegularOrMaskTypeID, - "chatPhotoStickerTypeCustomEmoji": ChatPhotoStickerTypeCustomEmojiTypeID, - "chatPhotoSticker": ChatPhotoStickerTypeID, - "animatedChatPhoto": AnimatedChatPhotoTypeID, - "chatPhoto": ChatPhotoTypeID, - "chatPhotos": ChatPhotosTypeID, - "inputChatPhotoPrevious": InputChatPhotoPreviousTypeID, - "inputChatPhotoStatic": InputChatPhotoStaticTypeID, - "inputChatPhotoAnimation": InputChatPhotoAnimationTypeID, - "inputChatPhotoSticker": InputChatPhotoStickerTypeID, - "chatPermissions": ChatPermissionsTypeID, - "chatAdministratorRights": ChatAdministratorRightsTypeID, - "premiumPaymentOption": PremiumPaymentOptionTypeID, - "premiumStatePaymentOption": PremiumStatePaymentOptionTypeID, - "premiumGiftCodePaymentOption": PremiumGiftCodePaymentOptionTypeID, - "premiumGiftCodePaymentOptions": PremiumGiftCodePaymentOptionsTypeID, - "premiumGiftCodeInfo": PremiumGiftCodeInfoTypeID, - "premiumGiveawayParticipantStatusEligible": PremiumGiveawayParticipantStatusEligibleTypeID, + "businessAwayMessageScheduleAlways": BusinessAwayMessageScheduleAlwaysTypeID, + "businessAwayMessageScheduleOutsideOfOpeningHours": BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID, + "businessAwayMessageScheduleCustom": BusinessAwayMessageScheduleCustomTypeID, + "businessLocation": BusinessLocationTypeID, + "businessRecipients": BusinessRecipientsTypeID, + "businessAwayMessageSettings": BusinessAwayMessageSettingsTypeID, + "businessGreetingMessageSettings": BusinessGreetingMessageSettingsTypeID, + "businessConnectedBot": BusinessConnectedBotTypeID, + "businessOpeningHoursInterval": BusinessOpeningHoursIntervalTypeID, + "businessOpeningHours": BusinessOpeningHoursTypeID, + "businessInfo": BusinessInfoTypeID, + "chatPhotoStickerTypeRegularOrMask": ChatPhotoStickerTypeRegularOrMaskTypeID, + "chatPhotoStickerTypeCustomEmoji": ChatPhotoStickerTypeCustomEmojiTypeID, + "chatPhotoSticker": ChatPhotoStickerTypeID, + "animatedChatPhoto": AnimatedChatPhotoTypeID, + "chatPhoto": ChatPhotoTypeID, + "chatPhotos": ChatPhotosTypeID, + "inputChatPhotoPrevious": InputChatPhotoPreviousTypeID, + "inputChatPhotoStatic": InputChatPhotoStaticTypeID, + "inputChatPhotoAnimation": InputChatPhotoAnimationTypeID, + "inputChatPhotoSticker": InputChatPhotoStickerTypeID, + "chatPermissions": ChatPermissionsTypeID, + "chatAdministratorRights": ChatAdministratorRightsTypeID, + "premiumPaymentOption": PremiumPaymentOptionTypeID, + "premiumStatePaymentOption": PremiumStatePaymentOptionTypeID, + "premiumGiftCodePaymentOption": PremiumGiftCodePaymentOptionTypeID, + "premiumGiftCodePaymentOptions": PremiumGiftCodePaymentOptionsTypeID, + "premiumGiftCodeInfo": PremiumGiftCodeInfoTypeID, + "premiumGiveawayParticipantStatusEligible": PremiumGiveawayParticipantStatusEligibleTypeID, "premiumGiveawayParticipantStatusParticipating": PremiumGiveawayParticipantStatusParticipatingTypeID, "premiumGiveawayParticipantStatusAlreadyWasMember": PremiumGiveawayParticipantStatusAlreadyWasMemberTypeID, "premiumGiveawayParticipantStatusAdministrator": PremiumGiveawayParticipantStatusAdministratorTypeID, @@ -2831,6 +2880,8 @@ func NamesMap() map[string]uint32 { "storyInteractionTypeRepost": StoryInteractionTypeRepostTypeID, "storyInteraction": StoryInteractionTypeID, "storyInteractions": StoryInteractionsTypeID, + "quickReplyMessage": QuickReplyMessageTypeID, + "quickReplyShortcut": QuickReplyShortcutTypeID, "publicForwardMessage": PublicForwardMessageTypeID, "publicForwardStory": PublicForwardStoryTypeID, "publicForwards": PublicForwardsTypeID, @@ -3091,6 +3142,8 @@ func NamesMap() map[string]uint32 { "inputBackgroundPrevious": InputBackgroundPreviousTypeID, "themeSettings": ThemeSettingsTypeID, "chatTheme": ChatThemeTypeID, + "timeZone": TimeZoneTypeID, + "timeZones": TimeZonesTypeID, "hashtags": HashtagsTypeID, "canSendStoryResultOk": CanSendStoryResultOkTypeID, "canSendStoryResultPremiumNeeded": CanSendStoryResultPremiumNeededTypeID, @@ -3418,6 +3471,8 @@ func NamesMap() map[string]uint32 { "updateChatPermissions": UpdateChatPermissionsTypeID, "updateChatLastMessage": UpdateChatLastMessageTypeID, "updateChatPosition": UpdateChatPositionTypeID, + "updateChatAddedToList": UpdateChatAddedToListTypeID, + "updateChatRemovedFromList": UpdateChatRemovedFromListTypeID, "updateChatReadInbox": UpdateChatReadInboxTypeID, "updateChatReadOutbox": UpdateChatReadOutboxTypeID, "updateChatActionBar": UpdateChatActionBarTypeID, @@ -3445,6 +3500,10 @@ func NamesMap() map[string]uint32 { "updateChatOnlineMemberCount": UpdateChatOnlineMemberCountTypeID, "updateSavedMessagesTopic": UpdateSavedMessagesTopicTypeID, "updateSavedMessagesTopicCount": UpdateSavedMessagesTopicCountTypeID, + "updateQuickReplyShortcut": UpdateQuickReplyShortcutTypeID, + "updateQuickReplyShortcutDeleted": UpdateQuickReplyShortcutDeletedTypeID, + "updateQuickReplyShortcuts": UpdateQuickReplyShortcutsTypeID, + "updateQuickReplyShortcutMessages": UpdateQuickReplyShortcutMessagesTypeID, "updateForumTopicInfo": UpdateForumTopicInfoTypeID, "updateScopeNotificationSettings": UpdateScopeNotificationSettingsTypeID, "updateNotification": UpdateNotificationTypeID, @@ -3667,6 +3726,7 @@ func NamesMap() map[string]uint32 { "sendBotStartMessage": SendBotStartMessageRequestTypeID, "sendInlineQueryResultMessage": SendInlineQueryResultMessageRequestTypeID, "forwardMessages": ForwardMessagesRequestTypeID, + "sendQuickReplyShortcutMessages": SendQuickReplyShortcutMessagesRequestTypeID, "resendMessages": ResendMessagesRequestTypeID, "addLocalMessage": AddLocalMessageRequestTypeID, "deleteMessages": DeleteMessagesRequestTypeID, @@ -3683,6 +3743,13 @@ func NamesMap() map[string]uint32 { "editInlineMessageCaption": EditInlineMessageCaptionRequestTypeID, "editInlineMessageReplyMarkup": EditInlineMessageReplyMarkupRequestTypeID, "editMessageSchedulingState": EditMessageSchedulingStateRequestTypeID, + "checkQuickReplyShortcutName": CheckQuickReplyShortcutNameRequestTypeID, + "loadQuickReplyShortcuts": LoadQuickReplyShortcutsRequestTypeID, + "setQuickReplyShortcutName": SetQuickReplyShortcutNameRequestTypeID, + "deleteQuickReplyShortcut": DeleteQuickReplyShortcutRequestTypeID, + "reorderQuickReplyShortcuts": ReorderQuickReplyShortcutsRequestTypeID, + "loadQuickReplyShortcutMessages": LoadQuickReplyShortcutMessagesRequestTypeID, + "deleteQuickReplyShortcutMessages": DeleteQuickReplyShortcutMessagesRequestTypeID, "getForumTopicDefaultIcons": GetForumTopicDefaultIconsRequestTypeID, "createForumTopic": CreateForumTopicRequestTypeID, "editForumTopic": EditForumTopicRequestTypeID, @@ -3776,6 +3843,7 @@ func NamesMap() map[string]uint32 { "getChatFolderChatsToLeave": GetChatFolderChatsToLeaveRequestTypeID, "getChatFolderChatCount": GetChatFolderChatCountRequestTypeID, "reorderChatFolders": ReorderChatFoldersRequestTypeID, + "toggleChatFolderTags": ToggleChatFolderTagsRequestTypeID, "getRecommendedChatFolders": GetRecommendedChatFoldersRequestTypeID, "getChatFolderDefaultIconName": GetChatFolderDefaultIconNameRequestTypeID, "getChatsForChatFolderInviteLink": GetChatsForChatFolderInviteLinkRequestTypeID, @@ -4021,9 +4089,16 @@ func NamesMap() map[string]uint32 { "reorderActiveUsernames": ReorderActiveUsernamesRequestTypeID, "setEmojiStatus": SetEmojiStatusRequestTypeID, "setLocation": SetLocationRequestTypeID, + "setBusinessLocation": SetBusinessLocationRequestTypeID, + "setBusinessOpeningHours": SetBusinessOpeningHoursRequestTypeID, + "setBusinessGreetingMessageSettings": SetBusinessGreetingMessageSettingsRequestTypeID, + "setBusinessAwayMessageSettings": SetBusinessAwayMessageSettingsRequestTypeID, "changePhoneNumber": ChangePhoneNumberRequestTypeID, "resendChangePhoneNumberCode": ResendChangePhoneNumberCodeRequestTypeID, "checkChangePhoneNumberCode": CheckChangePhoneNumberCodeRequestTypeID, + "getBusinessConnectedBot": GetBusinessConnectedBotRequestTypeID, + "setBusinessConnectedBot": SetBusinessConnectedBotRequestTypeID, + "deleteBusinessConnectedBot": DeleteBusinessConnectedBotRequestTypeID, "getUserLink": GetUserLinkRequestTypeID, "searchUserByToken": SearchUserByTokenRequestTypeID, "setCommands": SetCommandsRequestTypeID, @@ -4075,6 +4150,7 @@ func NamesMap() map[string]uint32 { "getSupergroupMembers": GetSupergroupMembersRequestTypeID, "closeSecretChat": CloseSecretChatRequestTypeID, "getChatEventLog": GetChatEventLogRequestTypeID, + "getTimeZones": GetTimeZonesRequestTypeID, "getPaymentForm": GetPaymentFormRequestTypeID, "validateOrderInfo": ValidateOrderInfoRequestTypeID, "sendPaymentForm": SendPaymentFormRequestTypeID, @@ -4347,6 +4423,17 @@ func TypesConstructorMap() map[uint32]func() bin.Object { BotCommandsTypeID: func() bin.Object { return &BotCommands{} }, BotMenuButtonTypeID: func() bin.Object { return &BotMenuButton{} }, ChatLocationTypeID: func() bin.Object { return &ChatLocation{} }, + BusinessAwayMessageScheduleAlwaysTypeID: func() bin.Object { return &BusinessAwayMessageScheduleAlways{} }, + BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID: func() bin.Object { return &BusinessAwayMessageScheduleOutsideOfOpeningHours{} }, + BusinessAwayMessageScheduleCustomTypeID: func() bin.Object { return &BusinessAwayMessageScheduleCustom{} }, + BusinessLocationTypeID: func() bin.Object { return &BusinessLocation{} }, + BusinessRecipientsTypeID: func() bin.Object { return &BusinessRecipients{} }, + BusinessAwayMessageSettingsTypeID: func() bin.Object { return &BusinessAwayMessageSettings{} }, + BusinessGreetingMessageSettingsTypeID: func() bin.Object { return &BusinessGreetingMessageSettings{} }, + BusinessConnectedBotTypeID: func() bin.Object { return &BusinessConnectedBot{} }, + BusinessOpeningHoursIntervalTypeID: func() bin.Object { return &BusinessOpeningHoursInterval{} }, + BusinessOpeningHoursTypeID: func() bin.Object { return &BusinessOpeningHours{} }, + BusinessInfoTypeID: func() bin.Object { return &BusinessInfo{} }, ChatPhotoStickerTypeRegularOrMaskTypeID: func() bin.Object { return &ChatPhotoStickerTypeRegularOrMask{} }, ChatPhotoStickerTypeCustomEmojiTypeID: func() bin.Object { return &ChatPhotoStickerTypeCustomEmoji{} }, ChatPhotoStickerTypeID: func() bin.Object { return &ChatPhotoSticker{} }, @@ -4934,6 +5021,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { StoryInteractionTypeRepostTypeID: func() bin.Object { return &StoryInteractionTypeRepost{} }, StoryInteractionTypeID: func() bin.Object { return &StoryInteraction{} }, StoryInteractionsTypeID: func() bin.Object { return &StoryInteractions{} }, + QuickReplyMessageTypeID: func() bin.Object { return &QuickReplyMessage{} }, + QuickReplyShortcutTypeID: func() bin.Object { return &QuickReplyShortcut{} }, PublicForwardMessageTypeID: func() bin.Object { return &PublicForwardMessage{} }, PublicForwardStoryTypeID: func() bin.Object { return &PublicForwardStory{} }, PublicForwardsTypeID: func() bin.Object { return &PublicForwards{} }, @@ -5194,6 +5283,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { InputBackgroundPreviousTypeID: func() bin.Object { return &InputBackgroundPrevious{} }, ThemeSettingsTypeID: func() bin.Object { return &ThemeSettings{} }, ChatThemeTypeID: func() bin.Object { return &ChatTheme{} }, + TimeZoneTypeID: func() bin.Object { return &TimeZone{} }, + TimeZonesTypeID: func() bin.Object { return &TimeZones{} }, HashtagsTypeID: func() bin.Object { return &Hashtags{} }, CanSendStoryResultOkTypeID: func() bin.Object { return &CanSendStoryResultOk{} }, CanSendStoryResultPremiumNeededTypeID: func() bin.Object { return &CanSendStoryResultPremiumNeeded{} }, @@ -5521,6 +5612,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UpdateChatPermissionsTypeID: func() bin.Object { return &UpdateChatPermissions{} }, UpdateChatLastMessageTypeID: func() bin.Object { return &UpdateChatLastMessage{} }, UpdateChatPositionTypeID: func() bin.Object { return &UpdateChatPosition{} }, + UpdateChatAddedToListTypeID: func() bin.Object { return &UpdateChatAddedToList{} }, + UpdateChatRemovedFromListTypeID: func() bin.Object { return &UpdateChatRemovedFromList{} }, UpdateChatReadInboxTypeID: func() bin.Object { return &UpdateChatReadInbox{} }, UpdateChatReadOutboxTypeID: func() bin.Object { return &UpdateChatReadOutbox{} }, UpdateChatActionBarTypeID: func() bin.Object { return &UpdateChatActionBar{} }, @@ -5548,6 +5641,10 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UpdateChatOnlineMemberCountTypeID: func() bin.Object { return &UpdateChatOnlineMemberCount{} }, UpdateSavedMessagesTopicTypeID: func() bin.Object { return &UpdateSavedMessagesTopic{} }, UpdateSavedMessagesTopicCountTypeID: func() bin.Object { return &UpdateSavedMessagesTopicCount{} }, + UpdateQuickReplyShortcutTypeID: func() bin.Object { return &UpdateQuickReplyShortcut{} }, + UpdateQuickReplyShortcutDeletedTypeID: func() bin.Object { return &UpdateQuickReplyShortcutDeleted{} }, + UpdateQuickReplyShortcutsTypeID: func() bin.Object { return &UpdateQuickReplyShortcuts{} }, + UpdateQuickReplyShortcutMessagesTypeID: func() bin.Object { return &UpdateQuickReplyShortcutMessages{} }, UpdateForumTopicInfoTypeID: func() bin.Object { return &UpdateForumTopicInfo{} }, UpdateScopeNotificationSettingsTypeID: func() bin.Object { return &UpdateScopeNotificationSettings{} }, UpdateNotificationTypeID: func() bin.Object { return &UpdateNotification{} }, @@ -5770,6 +5867,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { SendBotStartMessageRequestTypeID: func() bin.Object { return &SendBotStartMessageRequest{} }, SendInlineQueryResultMessageRequestTypeID: func() bin.Object { return &SendInlineQueryResultMessageRequest{} }, ForwardMessagesRequestTypeID: func() bin.Object { return &ForwardMessagesRequest{} }, + SendQuickReplyShortcutMessagesRequestTypeID: func() bin.Object { return &SendQuickReplyShortcutMessagesRequest{} }, ResendMessagesRequestTypeID: func() bin.Object { return &ResendMessagesRequest{} }, AddLocalMessageRequestTypeID: func() bin.Object { return &AddLocalMessageRequest{} }, DeleteMessagesRequestTypeID: func() bin.Object { return &DeleteMessagesRequest{} }, @@ -5786,6 +5884,13 @@ func TypesConstructorMap() map[uint32]func() bin.Object { EditInlineMessageCaptionRequestTypeID: func() bin.Object { return &EditInlineMessageCaptionRequest{} }, EditInlineMessageReplyMarkupRequestTypeID: func() bin.Object { return &EditInlineMessageReplyMarkupRequest{} }, EditMessageSchedulingStateRequestTypeID: func() bin.Object { return &EditMessageSchedulingStateRequest{} }, + CheckQuickReplyShortcutNameRequestTypeID: func() bin.Object { return &CheckQuickReplyShortcutNameRequest{} }, + LoadQuickReplyShortcutsRequestTypeID: func() bin.Object { return &LoadQuickReplyShortcutsRequest{} }, + SetQuickReplyShortcutNameRequestTypeID: func() bin.Object { return &SetQuickReplyShortcutNameRequest{} }, + DeleteQuickReplyShortcutRequestTypeID: func() bin.Object { return &DeleteQuickReplyShortcutRequest{} }, + ReorderQuickReplyShortcutsRequestTypeID: func() bin.Object { return &ReorderQuickReplyShortcutsRequest{} }, + LoadQuickReplyShortcutMessagesRequestTypeID: func() bin.Object { return &LoadQuickReplyShortcutMessagesRequest{} }, + DeleteQuickReplyShortcutMessagesRequestTypeID: func() bin.Object { return &DeleteQuickReplyShortcutMessagesRequest{} }, GetForumTopicDefaultIconsRequestTypeID: func() bin.Object { return &GetForumTopicDefaultIconsRequest{} }, CreateForumTopicRequestTypeID: func() bin.Object { return &CreateForumTopicRequest{} }, EditForumTopicRequestTypeID: func() bin.Object { return &EditForumTopicRequest{} }, @@ -5879,6 +5984,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { GetChatFolderChatsToLeaveRequestTypeID: func() bin.Object { return &GetChatFolderChatsToLeaveRequest{} }, GetChatFolderChatCountRequestTypeID: func() bin.Object { return &GetChatFolderChatCountRequest{} }, ReorderChatFoldersRequestTypeID: func() bin.Object { return &ReorderChatFoldersRequest{} }, + ToggleChatFolderTagsRequestTypeID: func() bin.Object { return &ToggleChatFolderTagsRequest{} }, GetRecommendedChatFoldersRequestTypeID: func() bin.Object { return &GetRecommendedChatFoldersRequest{} }, GetChatFolderDefaultIconNameRequestTypeID: func() bin.Object { return &GetChatFolderDefaultIconNameRequest{} }, GetChatsForChatFolderInviteLinkRequestTypeID: func() bin.Object { return &GetChatsForChatFolderInviteLinkRequest{} }, @@ -6124,9 +6230,16 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ReorderActiveUsernamesRequestTypeID: func() bin.Object { return &ReorderActiveUsernamesRequest{} }, SetEmojiStatusRequestTypeID: func() bin.Object { return &SetEmojiStatusRequest{} }, SetLocationRequestTypeID: func() bin.Object { return &SetLocationRequest{} }, + SetBusinessLocationRequestTypeID: func() bin.Object { return &SetBusinessLocationRequest{} }, + SetBusinessOpeningHoursRequestTypeID: func() bin.Object { return &SetBusinessOpeningHoursRequest{} }, + SetBusinessGreetingMessageSettingsRequestTypeID: func() bin.Object { return &SetBusinessGreetingMessageSettingsRequest{} }, + SetBusinessAwayMessageSettingsRequestTypeID: func() bin.Object { return &SetBusinessAwayMessageSettingsRequest{} }, ChangePhoneNumberRequestTypeID: func() bin.Object { return &ChangePhoneNumberRequest{} }, ResendChangePhoneNumberCodeRequestTypeID: func() bin.Object { return &ResendChangePhoneNumberCodeRequest{} }, CheckChangePhoneNumberCodeRequestTypeID: func() bin.Object { return &CheckChangePhoneNumberCodeRequest{} }, + GetBusinessConnectedBotRequestTypeID: func() bin.Object { return &GetBusinessConnectedBotRequest{} }, + SetBusinessConnectedBotRequestTypeID: func() bin.Object { return &SetBusinessConnectedBotRequest{} }, + DeleteBusinessConnectedBotRequestTypeID: func() bin.Object { return &DeleteBusinessConnectedBotRequest{} }, GetUserLinkRequestTypeID: func() bin.Object { return &GetUserLinkRequest{} }, SearchUserByTokenRequestTypeID: func() bin.Object { return &SearchUserByTokenRequest{} }, SetCommandsRequestTypeID: func() bin.Object { return &SetCommandsRequest{} }, @@ -6178,6 +6291,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { GetSupergroupMembersRequestTypeID: func() bin.Object { return &GetSupergroupMembersRequest{} }, CloseSecretChatRequestTypeID: func() bin.Object { return &CloseSecretChatRequest{} }, GetChatEventLogRequestTypeID: func() bin.Object { return &GetChatEventLogRequest{} }, + GetTimeZonesRequestTypeID: func() bin.Object { return &GetTimeZonesRequest{} }, GetPaymentFormRequestTypeID: func() bin.Object { return &GetPaymentFormRequest{} }, ValidateOrderInfoRequestTypeID: func() bin.Object { return &ValidateOrderInfoRequest{} }, SendPaymentFormRequestTypeID: func() bin.Object { return &SendPaymentFormRequest{} }, @@ -6407,6 +6521,11 @@ func ClassConstructorsMap() map[string][]uint32 { BotWriteAccessAllowReasonLaunchedWebAppTypeID, BotWriteAccessAllowReasonAcceptedRequestTypeID, }, + BusinessAwayMessageScheduleClassName: { + BusinessAwayMessageScheduleAlwaysTypeID, + BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID, + BusinessAwayMessageScheduleCustomTypeID, + }, CallDiscardReasonClassName: { CallDiscardReasonEmptyTypeID, CallDiscardReasonMissedTypeID, @@ -7534,6 +7653,8 @@ func ClassConstructorsMap() map[string][]uint32 { UpdateChatPermissionsTypeID, UpdateChatLastMessageTypeID, UpdateChatPositionTypeID, + UpdateChatAddedToListTypeID, + UpdateChatRemovedFromListTypeID, UpdateChatReadInboxTypeID, UpdateChatReadOutboxTypeID, UpdateChatActionBarTypeID, @@ -7561,6 +7682,10 @@ func ClassConstructorsMap() map[string][]uint32 { UpdateChatOnlineMemberCountTypeID, UpdateSavedMessagesTopicTypeID, UpdateSavedMessagesTopicCountTypeID, + UpdateQuickReplyShortcutTypeID, + UpdateQuickReplyShortcutDeletedTypeID, + UpdateQuickReplyShortcutsTypeID, + UpdateQuickReplyShortcutMessagesTypeID, UpdateForumTopicInfoTypeID, UpdateScopeNotificationSettingsTypeID, UpdateNotificationTypeID, diff --git a/tdapi/tl_reorder_quick_reply_shortcuts_gen.go b/tdapi/tl_reorder_quick_reply_shortcuts_gen.go new file mode 100644 index 0000000000..38f71b23a6 --- /dev/null +++ b/tdapi/tl_reorder_quick_reply_shortcuts_gen.go @@ -0,0 +1,230 @@ +// 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{} +) + +// ReorderQuickReplyShortcutsRequest represents TL type `reorderQuickReplyShortcuts#b04981c4`. +type ReorderQuickReplyShortcutsRequest struct { + // The new order of quick reply shortcuts + ShortcutIDs []int32 +} + +// ReorderQuickReplyShortcutsRequestTypeID is TL type id of ReorderQuickReplyShortcutsRequest. +const ReorderQuickReplyShortcutsRequestTypeID = 0xb04981c4 + +// Ensuring interfaces in compile-time for ReorderQuickReplyShortcutsRequest. +var ( + _ bin.Encoder = &ReorderQuickReplyShortcutsRequest{} + _ bin.Decoder = &ReorderQuickReplyShortcutsRequest{} + _ bin.BareEncoder = &ReorderQuickReplyShortcutsRequest{} + _ bin.BareDecoder = &ReorderQuickReplyShortcutsRequest{} +) + +func (r *ReorderQuickReplyShortcutsRequest) Zero() bool { + if r == nil { + return true + } + if !(r.ShortcutIDs == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (r *ReorderQuickReplyShortcutsRequest) String() string { + if r == nil { + return "ReorderQuickReplyShortcutsRequest(nil)" + } + type Alias ReorderQuickReplyShortcutsRequest + return fmt.Sprintf("ReorderQuickReplyShortcutsRequest%+v", Alias(*r)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ReorderQuickReplyShortcutsRequest) TypeID() uint32 { + return ReorderQuickReplyShortcutsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ReorderQuickReplyShortcutsRequest) TypeName() string { + return "reorderQuickReplyShortcuts" +} + +// TypeInfo returns info about TL type. +func (r *ReorderQuickReplyShortcutsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "reorderQuickReplyShortcuts", + ID: ReorderQuickReplyShortcutsRequestTypeID, + } + if r == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ShortcutIDs", + SchemaName: "shortcut_ids", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (r *ReorderQuickReplyShortcutsRequest) Encode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reorderQuickReplyShortcuts#b04981c4 as nil") + } + b.PutID(ReorderQuickReplyShortcutsRequestTypeID) + return r.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (r *ReorderQuickReplyShortcutsRequest) EncodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reorderQuickReplyShortcuts#b04981c4 as nil") + } + b.PutInt(len(r.ShortcutIDs)) + for _, v := range r.ShortcutIDs { + b.PutInt32(v) + } + return nil +} + +// Decode implements bin.Decoder. +func (r *ReorderQuickReplyShortcutsRequest) Decode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reorderQuickReplyShortcuts#b04981c4 to nil") + } + if err := b.ConsumeID(ReorderQuickReplyShortcutsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode reorderQuickReplyShortcuts#b04981c4: %w", err) + } + return r.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (r *ReorderQuickReplyShortcutsRequest) DecodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reorderQuickReplyShortcuts#b04981c4 to nil") + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode reorderQuickReplyShortcuts#b04981c4: field shortcut_ids: %w", err) + } + + if headerLen > 0 { + r.ShortcutIDs = 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 reorderQuickReplyShortcuts#b04981c4: field shortcut_ids: %w", err) + } + r.ShortcutIDs = append(r.ShortcutIDs, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (r *ReorderQuickReplyShortcutsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if r == nil { + return fmt.Errorf("can't encode reorderQuickReplyShortcuts#b04981c4 as nil") + } + b.ObjStart() + b.PutID("reorderQuickReplyShortcuts") + b.Comma() + b.FieldStart("shortcut_ids") + b.ArrStart() + for _, v := range r.ShortcutIDs { + b.PutInt32(v) + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (r *ReorderQuickReplyShortcutsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if r == nil { + return fmt.Errorf("can't decode reorderQuickReplyShortcuts#b04981c4 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("reorderQuickReplyShortcuts"); err != nil { + return fmt.Errorf("unable to decode reorderQuickReplyShortcuts#b04981c4: %w", err) + } + case "shortcut_ids": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode reorderQuickReplyShortcuts#b04981c4: field shortcut_ids: %w", err) + } + r.ShortcutIDs = append(r.ShortcutIDs, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode reorderQuickReplyShortcuts#b04981c4: field shortcut_ids: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetShortcutIDs returns value of ShortcutIDs field. +func (r *ReorderQuickReplyShortcutsRequest) GetShortcutIDs() (value []int32) { + if r == nil { + return + } + return r.ShortcutIDs +} + +// ReorderQuickReplyShortcuts invokes method reorderQuickReplyShortcuts#b04981c4 returning error if any. +func (c *Client) ReorderQuickReplyShortcuts(ctx context.Context, shortcutids []int32) error { + var ok Ok + + request := &ReorderQuickReplyShortcutsRequest{ + ShortcutIDs: shortcutids, + } + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_send_quick_reply_shortcut_messages_gen.go b/tdapi/tl_send_quick_reply_shortcut_messages_gen.go new file mode 100644 index 0000000000..1702a4ed6d --- /dev/null +++ b/tdapi/tl_send_quick_reply_shortcut_messages_gen.go @@ -0,0 +1,274 @@ +// 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{} +) + +// SendQuickReplyShortcutMessagesRequest represents TL type `sendQuickReplyShortcutMessages#dd5169d`. +type SendQuickReplyShortcutMessagesRequest struct { + // Identifier of the chat to which to send messages. The chat must be a private chat with + // a regular user + ChatID int64 + // Unique identifier of the quick reply shortcut + ShortcutID int32 + // Non-persistent identifier, which will be returned back in messageSendingStatePending + // object and can be used to match sent messages and corresponding updateNewMessage + // updates + SendingID int32 +} + +// SendQuickReplyShortcutMessagesRequestTypeID is TL type id of SendQuickReplyShortcutMessagesRequest. +const SendQuickReplyShortcutMessagesRequestTypeID = 0xdd5169d + +// Ensuring interfaces in compile-time for SendQuickReplyShortcutMessagesRequest. +var ( + _ bin.Encoder = &SendQuickReplyShortcutMessagesRequest{} + _ bin.Decoder = &SendQuickReplyShortcutMessagesRequest{} + _ bin.BareEncoder = &SendQuickReplyShortcutMessagesRequest{} + _ bin.BareDecoder = &SendQuickReplyShortcutMessagesRequest{} +) + +func (s *SendQuickReplyShortcutMessagesRequest) Zero() bool { + if s == nil { + return true + } + if !(s.ChatID == 0) { + return false + } + if !(s.ShortcutID == 0) { + return false + } + if !(s.SendingID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SendQuickReplyShortcutMessagesRequest) String() string { + if s == nil { + return "SendQuickReplyShortcutMessagesRequest(nil)" + } + type Alias SendQuickReplyShortcutMessagesRequest + return fmt.Sprintf("SendQuickReplyShortcutMessagesRequest%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SendQuickReplyShortcutMessagesRequest) TypeID() uint32 { + return SendQuickReplyShortcutMessagesRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SendQuickReplyShortcutMessagesRequest) TypeName() string { + return "sendQuickReplyShortcutMessages" +} + +// TypeInfo returns info about TL type. +func (s *SendQuickReplyShortcutMessagesRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "sendQuickReplyShortcutMessages", + ID: SendQuickReplyShortcutMessagesRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + { + Name: "SendingID", + SchemaName: "sending_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SendQuickReplyShortcutMessagesRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode sendQuickReplyShortcutMessages#dd5169d as nil") + } + b.PutID(SendQuickReplyShortcutMessagesRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SendQuickReplyShortcutMessagesRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode sendQuickReplyShortcutMessages#dd5169d as nil") + } + b.PutInt53(s.ChatID) + b.PutInt32(s.ShortcutID) + b.PutInt32(s.SendingID) + return nil +} + +// Decode implements bin.Decoder. +func (s *SendQuickReplyShortcutMessagesRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode sendQuickReplyShortcutMessages#dd5169d to nil") + } + if err := b.ConsumeID(SendQuickReplyShortcutMessagesRequestTypeID); err != nil { + return fmt.Errorf("unable to decode sendQuickReplyShortcutMessages#dd5169d: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SendQuickReplyShortcutMessagesRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode sendQuickReplyShortcutMessages#dd5169d to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode sendQuickReplyShortcutMessages#dd5169d: field chat_id: %w", err) + } + s.ChatID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode sendQuickReplyShortcutMessages#dd5169d: field shortcut_id: %w", err) + } + s.ShortcutID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode sendQuickReplyShortcutMessages#dd5169d: field sending_id: %w", err) + } + s.SendingID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SendQuickReplyShortcutMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode sendQuickReplyShortcutMessages#dd5169d as nil") + } + b.ObjStart() + b.PutID("sendQuickReplyShortcutMessages") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(s.ChatID) + b.Comma() + b.FieldStart("shortcut_id") + b.PutInt32(s.ShortcutID) + b.Comma() + b.FieldStart("sending_id") + b.PutInt32(s.SendingID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SendQuickReplyShortcutMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode sendQuickReplyShortcutMessages#dd5169d to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("sendQuickReplyShortcutMessages"); err != nil { + return fmt.Errorf("unable to decode sendQuickReplyShortcutMessages#dd5169d: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode sendQuickReplyShortcutMessages#dd5169d: field chat_id: %w", err) + } + s.ChatID = value + case "shortcut_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode sendQuickReplyShortcutMessages#dd5169d: field shortcut_id: %w", err) + } + s.ShortcutID = value + case "sending_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode sendQuickReplyShortcutMessages#dd5169d: field sending_id: %w", err) + } + s.SendingID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (s *SendQuickReplyShortcutMessagesRequest) GetChatID() (value int64) { + if s == nil { + return + } + return s.ChatID +} + +// GetShortcutID returns value of ShortcutID field. +func (s *SendQuickReplyShortcutMessagesRequest) GetShortcutID() (value int32) { + if s == nil { + return + } + return s.ShortcutID +} + +// GetSendingID returns value of SendingID field. +func (s *SendQuickReplyShortcutMessagesRequest) GetSendingID() (value int32) { + if s == nil { + return + } + return s.SendingID +} + +// SendQuickReplyShortcutMessages invokes method sendQuickReplyShortcutMessages#dd5169d returning error if any. +func (c *Client) SendQuickReplyShortcutMessages(ctx context.Context, request *SendQuickReplyShortcutMessagesRequest) (*Messages, error) { + var result Messages + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_set_business_away_message_settings_gen.go b/tdapi/tl_set_business_away_message_settings_gen.go new file mode 100644 index 0000000000..56935fe07a --- /dev/null +++ b/tdapi/tl_set_business_away_message_settings_gen.go @@ -0,0 +1,207 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// SetBusinessAwayMessageSettingsRequest represents TL type `setBusinessAwayMessageSettings#4974486c`. +type SetBusinessAwayMessageSettingsRequest struct { + // The new settings for the away message of the business; pass null to disable the away + // message + AwayMessageSettings BusinessAwayMessageSettings +} + +// SetBusinessAwayMessageSettingsRequestTypeID is TL type id of SetBusinessAwayMessageSettingsRequest. +const SetBusinessAwayMessageSettingsRequestTypeID = 0x4974486c + +// Ensuring interfaces in compile-time for SetBusinessAwayMessageSettingsRequest. +var ( + _ bin.Encoder = &SetBusinessAwayMessageSettingsRequest{} + _ bin.Decoder = &SetBusinessAwayMessageSettingsRequest{} + _ bin.BareEncoder = &SetBusinessAwayMessageSettingsRequest{} + _ bin.BareDecoder = &SetBusinessAwayMessageSettingsRequest{} +) + +func (s *SetBusinessAwayMessageSettingsRequest) Zero() bool { + if s == nil { + return true + } + if !(s.AwayMessageSettings.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SetBusinessAwayMessageSettingsRequest) String() string { + if s == nil { + return "SetBusinessAwayMessageSettingsRequest(nil)" + } + type Alias SetBusinessAwayMessageSettingsRequest + return fmt.Sprintf("SetBusinessAwayMessageSettingsRequest%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SetBusinessAwayMessageSettingsRequest) TypeID() uint32 { + return SetBusinessAwayMessageSettingsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SetBusinessAwayMessageSettingsRequest) TypeName() string { + return "setBusinessAwayMessageSettings" +} + +// TypeInfo returns info about TL type. +func (s *SetBusinessAwayMessageSettingsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "setBusinessAwayMessageSettings", + ID: SetBusinessAwayMessageSettingsRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "AwayMessageSettings", + SchemaName: "away_message_settings", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SetBusinessAwayMessageSettingsRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setBusinessAwayMessageSettings#4974486c as nil") + } + b.PutID(SetBusinessAwayMessageSettingsRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SetBusinessAwayMessageSettingsRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setBusinessAwayMessageSettings#4974486c as nil") + } + if err := s.AwayMessageSettings.Encode(b); err != nil { + return fmt.Errorf("unable to encode setBusinessAwayMessageSettings#4974486c: field away_message_settings: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *SetBusinessAwayMessageSettingsRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setBusinessAwayMessageSettings#4974486c to nil") + } + if err := b.ConsumeID(SetBusinessAwayMessageSettingsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode setBusinessAwayMessageSettings#4974486c: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SetBusinessAwayMessageSettingsRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setBusinessAwayMessageSettings#4974486c to nil") + } + { + if err := s.AwayMessageSettings.Decode(b); err != nil { + return fmt.Errorf("unable to decode setBusinessAwayMessageSettings#4974486c: field away_message_settings: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SetBusinessAwayMessageSettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode setBusinessAwayMessageSettings#4974486c as nil") + } + b.ObjStart() + b.PutID("setBusinessAwayMessageSettings") + b.Comma() + b.FieldStart("away_message_settings") + if err := s.AwayMessageSettings.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode setBusinessAwayMessageSettings#4974486c: field away_message_settings: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SetBusinessAwayMessageSettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode setBusinessAwayMessageSettings#4974486c to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("setBusinessAwayMessageSettings"); err != nil { + return fmt.Errorf("unable to decode setBusinessAwayMessageSettings#4974486c: %w", err) + } + case "away_message_settings": + if err := s.AwayMessageSettings.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode setBusinessAwayMessageSettings#4974486c: field away_message_settings: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetAwayMessageSettings returns value of AwayMessageSettings field. +func (s *SetBusinessAwayMessageSettingsRequest) GetAwayMessageSettings() (value BusinessAwayMessageSettings) { + if s == nil { + return + } + return s.AwayMessageSettings +} + +// SetBusinessAwayMessageSettings invokes method setBusinessAwayMessageSettings#4974486c returning error if any. +func (c *Client) SetBusinessAwayMessageSettings(ctx context.Context, awaymessagesettings BusinessAwayMessageSettings) error { + var ok Ok + + request := &SetBusinessAwayMessageSettingsRequest{ + AwayMessageSettings: awaymessagesettings, + } + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_set_business_connected_bot_gen.go b/tdapi/tl_set_business_connected_bot_gen.go new file mode 100644 index 0000000000..160a81c820 --- /dev/null +++ b/tdapi/tl_set_business_connected_bot_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{} +) + +// SetBusinessConnectedBotRequest represents TL type `setBusinessConnectedBot#acf17ef0`. +type SetBusinessConnectedBotRequest struct { + // Connection settings for the bot + Bot BusinessConnectedBot +} + +// SetBusinessConnectedBotRequestTypeID is TL type id of SetBusinessConnectedBotRequest. +const SetBusinessConnectedBotRequestTypeID = 0xacf17ef0 + +// Ensuring interfaces in compile-time for SetBusinessConnectedBotRequest. +var ( + _ bin.Encoder = &SetBusinessConnectedBotRequest{} + _ bin.Decoder = &SetBusinessConnectedBotRequest{} + _ bin.BareEncoder = &SetBusinessConnectedBotRequest{} + _ bin.BareDecoder = &SetBusinessConnectedBotRequest{} +) + +func (s *SetBusinessConnectedBotRequest) Zero() bool { + if s == nil { + return true + } + if !(s.Bot.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SetBusinessConnectedBotRequest) String() string { + if s == nil { + return "SetBusinessConnectedBotRequest(nil)" + } + type Alias SetBusinessConnectedBotRequest + return fmt.Sprintf("SetBusinessConnectedBotRequest%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SetBusinessConnectedBotRequest) TypeID() uint32 { + return SetBusinessConnectedBotRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SetBusinessConnectedBotRequest) TypeName() string { + return "setBusinessConnectedBot" +} + +// TypeInfo returns info about TL type. +func (s *SetBusinessConnectedBotRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "setBusinessConnectedBot", + ID: SetBusinessConnectedBotRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Bot", + SchemaName: "bot", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SetBusinessConnectedBotRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setBusinessConnectedBot#acf17ef0 as nil") + } + b.PutID(SetBusinessConnectedBotRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SetBusinessConnectedBotRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setBusinessConnectedBot#acf17ef0 as nil") + } + if err := s.Bot.Encode(b); err != nil { + return fmt.Errorf("unable to encode setBusinessConnectedBot#acf17ef0: field bot: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *SetBusinessConnectedBotRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setBusinessConnectedBot#acf17ef0 to nil") + } + if err := b.ConsumeID(SetBusinessConnectedBotRequestTypeID); err != nil { + return fmt.Errorf("unable to decode setBusinessConnectedBot#acf17ef0: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SetBusinessConnectedBotRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setBusinessConnectedBot#acf17ef0 to nil") + } + { + if err := s.Bot.Decode(b); err != nil { + return fmt.Errorf("unable to decode setBusinessConnectedBot#acf17ef0: field bot: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SetBusinessConnectedBotRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode setBusinessConnectedBot#acf17ef0 as nil") + } + b.ObjStart() + b.PutID("setBusinessConnectedBot") + b.Comma() + b.FieldStart("bot") + if err := s.Bot.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode setBusinessConnectedBot#acf17ef0: field bot: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SetBusinessConnectedBotRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode setBusinessConnectedBot#acf17ef0 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("setBusinessConnectedBot"); err != nil { + return fmt.Errorf("unable to decode setBusinessConnectedBot#acf17ef0: %w", err) + } + case "bot": + if err := s.Bot.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode setBusinessConnectedBot#acf17ef0: field bot: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetBot returns value of Bot field. +func (s *SetBusinessConnectedBotRequest) GetBot() (value BusinessConnectedBot) { + if s == nil { + return + } + return s.Bot +} + +// SetBusinessConnectedBot invokes method setBusinessConnectedBot#acf17ef0 returning error if any. +func (c *Client) SetBusinessConnectedBot(ctx context.Context, bot BusinessConnectedBot) error { + var ok Ok + + request := &SetBusinessConnectedBotRequest{ + Bot: bot, + } + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_set_business_greeting_message_settings_gen.go b/tdapi/tl_set_business_greeting_message_settings_gen.go new file mode 100644 index 0000000000..6a62003b97 --- /dev/null +++ b/tdapi/tl_set_business_greeting_message_settings_gen.go @@ -0,0 +1,207 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// SetBusinessGreetingMessageSettingsRequest represents TL type `setBusinessGreetingMessageSettings#cbf53c3d`. +type SetBusinessGreetingMessageSettingsRequest struct { + // The new settings for the greeting message of the business; pass null to disable the + // greeting message + GreetingMessageSettings BusinessGreetingMessageSettings +} + +// SetBusinessGreetingMessageSettingsRequestTypeID is TL type id of SetBusinessGreetingMessageSettingsRequest. +const SetBusinessGreetingMessageSettingsRequestTypeID = 0xcbf53c3d + +// Ensuring interfaces in compile-time for SetBusinessGreetingMessageSettingsRequest. +var ( + _ bin.Encoder = &SetBusinessGreetingMessageSettingsRequest{} + _ bin.Decoder = &SetBusinessGreetingMessageSettingsRequest{} + _ bin.BareEncoder = &SetBusinessGreetingMessageSettingsRequest{} + _ bin.BareDecoder = &SetBusinessGreetingMessageSettingsRequest{} +) + +func (s *SetBusinessGreetingMessageSettingsRequest) Zero() bool { + if s == nil { + return true + } + if !(s.GreetingMessageSettings.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SetBusinessGreetingMessageSettingsRequest) String() string { + if s == nil { + return "SetBusinessGreetingMessageSettingsRequest(nil)" + } + type Alias SetBusinessGreetingMessageSettingsRequest + return fmt.Sprintf("SetBusinessGreetingMessageSettingsRequest%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SetBusinessGreetingMessageSettingsRequest) TypeID() uint32 { + return SetBusinessGreetingMessageSettingsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SetBusinessGreetingMessageSettingsRequest) TypeName() string { + return "setBusinessGreetingMessageSettings" +} + +// TypeInfo returns info about TL type. +func (s *SetBusinessGreetingMessageSettingsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "setBusinessGreetingMessageSettings", + ID: SetBusinessGreetingMessageSettingsRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "GreetingMessageSettings", + SchemaName: "greeting_message_settings", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SetBusinessGreetingMessageSettingsRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setBusinessGreetingMessageSettings#cbf53c3d as nil") + } + b.PutID(SetBusinessGreetingMessageSettingsRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SetBusinessGreetingMessageSettingsRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setBusinessGreetingMessageSettings#cbf53c3d as nil") + } + if err := s.GreetingMessageSettings.Encode(b); err != nil { + return fmt.Errorf("unable to encode setBusinessGreetingMessageSettings#cbf53c3d: field greeting_message_settings: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *SetBusinessGreetingMessageSettingsRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setBusinessGreetingMessageSettings#cbf53c3d to nil") + } + if err := b.ConsumeID(SetBusinessGreetingMessageSettingsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode setBusinessGreetingMessageSettings#cbf53c3d: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SetBusinessGreetingMessageSettingsRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setBusinessGreetingMessageSettings#cbf53c3d to nil") + } + { + if err := s.GreetingMessageSettings.Decode(b); err != nil { + return fmt.Errorf("unable to decode setBusinessGreetingMessageSettings#cbf53c3d: field greeting_message_settings: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SetBusinessGreetingMessageSettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode setBusinessGreetingMessageSettings#cbf53c3d as nil") + } + b.ObjStart() + b.PutID("setBusinessGreetingMessageSettings") + b.Comma() + b.FieldStart("greeting_message_settings") + if err := s.GreetingMessageSettings.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode setBusinessGreetingMessageSettings#cbf53c3d: field greeting_message_settings: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SetBusinessGreetingMessageSettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode setBusinessGreetingMessageSettings#cbf53c3d to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("setBusinessGreetingMessageSettings"); err != nil { + return fmt.Errorf("unable to decode setBusinessGreetingMessageSettings#cbf53c3d: %w", err) + } + case "greeting_message_settings": + if err := s.GreetingMessageSettings.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode setBusinessGreetingMessageSettings#cbf53c3d: field greeting_message_settings: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetGreetingMessageSettings returns value of GreetingMessageSettings field. +func (s *SetBusinessGreetingMessageSettingsRequest) GetGreetingMessageSettings() (value BusinessGreetingMessageSettings) { + if s == nil { + return + } + return s.GreetingMessageSettings +} + +// SetBusinessGreetingMessageSettings invokes method setBusinessGreetingMessageSettings#cbf53c3d returning error if any. +func (c *Client) SetBusinessGreetingMessageSettings(ctx context.Context, greetingmessagesettings BusinessGreetingMessageSettings) error { + var ok Ok + + request := &SetBusinessGreetingMessageSettingsRequest{ + GreetingMessageSettings: greetingmessagesettings, + } + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_set_business_location_gen.go b/tdapi/tl_set_business_location_gen.go new file mode 100644 index 0000000000..8ead2b27ca --- /dev/null +++ b/tdapi/tl_set_business_location_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{} +) + +// SetBusinessLocationRequest represents TL type `setBusinessLocation#eb740715`. +type SetBusinessLocationRequest struct { + // The new location of the business; pass null to remove the location + Location BusinessLocation +} + +// SetBusinessLocationRequestTypeID is TL type id of SetBusinessLocationRequest. +const SetBusinessLocationRequestTypeID = 0xeb740715 + +// Ensuring interfaces in compile-time for SetBusinessLocationRequest. +var ( + _ bin.Encoder = &SetBusinessLocationRequest{} + _ bin.Decoder = &SetBusinessLocationRequest{} + _ bin.BareEncoder = &SetBusinessLocationRequest{} + _ bin.BareDecoder = &SetBusinessLocationRequest{} +) + +func (s *SetBusinessLocationRequest) Zero() bool { + if s == nil { + return true + } + if !(s.Location.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SetBusinessLocationRequest) String() string { + if s == nil { + return "SetBusinessLocationRequest(nil)" + } + type Alias SetBusinessLocationRequest + return fmt.Sprintf("SetBusinessLocationRequest%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SetBusinessLocationRequest) TypeID() uint32 { + return SetBusinessLocationRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SetBusinessLocationRequest) TypeName() string { + return "setBusinessLocation" +} + +// TypeInfo returns info about TL type. +func (s *SetBusinessLocationRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "setBusinessLocation", + ID: SetBusinessLocationRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Location", + SchemaName: "location", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SetBusinessLocationRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setBusinessLocation#eb740715 as nil") + } + b.PutID(SetBusinessLocationRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SetBusinessLocationRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setBusinessLocation#eb740715 as nil") + } + if err := s.Location.Encode(b); err != nil { + return fmt.Errorf("unable to encode setBusinessLocation#eb740715: field location: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *SetBusinessLocationRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setBusinessLocation#eb740715 to nil") + } + if err := b.ConsumeID(SetBusinessLocationRequestTypeID); err != nil { + return fmt.Errorf("unable to decode setBusinessLocation#eb740715: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SetBusinessLocationRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setBusinessLocation#eb740715 to nil") + } + { + if err := s.Location.Decode(b); err != nil { + return fmt.Errorf("unable to decode setBusinessLocation#eb740715: field location: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SetBusinessLocationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode setBusinessLocation#eb740715 as nil") + } + b.ObjStart() + b.PutID("setBusinessLocation") + b.Comma() + b.FieldStart("location") + if err := s.Location.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode setBusinessLocation#eb740715: field location: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SetBusinessLocationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode setBusinessLocation#eb740715 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("setBusinessLocation"); err != nil { + return fmt.Errorf("unable to decode setBusinessLocation#eb740715: %w", err) + } + case "location": + if err := s.Location.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode setBusinessLocation#eb740715: field location: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetLocation returns value of Location field. +func (s *SetBusinessLocationRequest) GetLocation() (value BusinessLocation) { + if s == nil { + return + } + return s.Location +} + +// SetBusinessLocation invokes method setBusinessLocation#eb740715 returning error if any. +func (c *Client) SetBusinessLocation(ctx context.Context, location BusinessLocation) error { + var ok Ok + + request := &SetBusinessLocationRequest{ + Location: location, + } + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_set_business_opening_hours_gen.go b/tdapi/tl_set_business_opening_hours_gen.go new file mode 100644 index 0000000000..0b671e6612 --- /dev/null +++ b/tdapi/tl_set_business_opening_hours_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{} +) + +// SetBusinessOpeningHoursRequest represents TL type `setBusinessOpeningHours#e470a472`. +type SetBusinessOpeningHoursRequest struct { + // The new opening hours of the business; pass null to remove the opening hours + OpeningHours BusinessOpeningHours +} + +// SetBusinessOpeningHoursRequestTypeID is TL type id of SetBusinessOpeningHoursRequest. +const SetBusinessOpeningHoursRequestTypeID = 0xe470a472 + +// Ensuring interfaces in compile-time for SetBusinessOpeningHoursRequest. +var ( + _ bin.Encoder = &SetBusinessOpeningHoursRequest{} + _ bin.Decoder = &SetBusinessOpeningHoursRequest{} + _ bin.BareEncoder = &SetBusinessOpeningHoursRequest{} + _ bin.BareDecoder = &SetBusinessOpeningHoursRequest{} +) + +func (s *SetBusinessOpeningHoursRequest) Zero() bool { + if s == nil { + return true + } + if !(s.OpeningHours.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SetBusinessOpeningHoursRequest) String() string { + if s == nil { + return "SetBusinessOpeningHoursRequest(nil)" + } + type Alias SetBusinessOpeningHoursRequest + return fmt.Sprintf("SetBusinessOpeningHoursRequest%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SetBusinessOpeningHoursRequest) TypeID() uint32 { + return SetBusinessOpeningHoursRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SetBusinessOpeningHoursRequest) TypeName() string { + return "setBusinessOpeningHours" +} + +// TypeInfo returns info about TL type. +func (s *SetBusinessOpeningHoursRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "setBusinessOpeningHours", + ID: SetBusinessOpeningHoursRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "OpeningHours", + SchemaName: "opening_hours", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SetBusinessOpeningHoursRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setBusinessOpeningHours#e470a472 as nil") + } + b.PutID(SetBusinessOpeningHoursRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SetBusinessOpeningHoursRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setBusinessOpeningHours#e470a472 as nil") + } + if err := s.OpeningHours.Encode(b); err != nil { + return fmt.Errorf("unable to encode setBusinessOpeningHours#e470a472: field opening_hours: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *SetBusinessOpeningHoursRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setBusinessOpeningHours#e470a472 to nil") + } + if err := b.ConsumeID(SetBusinessOpeningHoursRequestTypeID); err != nil { + return fmt.Errorf("unable to decode setBusinessOpeningHours#e470a472: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SetBusinessOpeningHoursRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setBusinessOpeningHours#e470a472 to nil") + } + { + if err := s.OpeningHours.Decode(b); err != nil { + return fmt.Errorf("unable to decode setBusinessOpeningHours#e470a472: field opening_hours: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SetBusinessOpeningHoursRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode setBusinessOpeningHours#e470a472 as nil") + } + b.ObjStart() + b.PutID("setBusinessOpeningHours") + b.Comma() + b.FieldStart("opening_hours") + if err := s.OpeningHours.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode setBusinessOpeningHours#e470a472: field opening_hours: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SetBusinessOpeningHoursRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode setBusinessOpeningHours#e470a472 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("setBusinessOpeningHours"); err != nil { + return fmt.Errorf("unable to decode setBusinessOpeningHours#e470a472: %w", err) + } + case "opening_hours": + if err := s.OpeningHours.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode setBusinessOpeningHours#e470a472: field opening_hours: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetOpeningHours returns value of OpeningHours field. +func (s *SetBusinessOpeningHoursRequest) GetOpeningHours() (value BusinessOpeningHours) { + if s == nil { + return + } + return s.OpeningHours +} + +// SetBusinessOpeningHours invokes method setBusinessOpeningHours#e470a472 returning error if any. +func (c *Client) SetBusinessOpeningHours(ctx context.Context, openinghours BusinessOpeningHours) error { + var ok Ok + + request := &SetBusinessOpeningHoursRequest{ + OpeningHours: openinghours, + } + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_set_quick_reply_shortcut_name_gen.go b/tdapi/tl_set_quick_reply_shortcut_name_gen.go new file mode 100644 index 0000000000..803fc5fbef --- /dev/null +++ b/tdapi/tl_set_quick_reply_shortcut_name_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{} +) + +// SetQuickReplyShortcutNameRequest represents TL type `setQuickReplyShortcutName#b20f471`. +type SetQuickReplyShortcutNameRequest struct { + // Unique identifier of the quick reply shortcut + ShortcutID int32 + // New name for the shortcut. Use checkQuickReplyShortcutName to check its validness + Name string +} + +// SetQuickReplyShortcutNameRequestTypeID is TL type id of SetQuickReplyShortcutNameRequest. +const SetQuickReplyShortcutNameRequestTypeID = 0xb20f471 + +// Ensuring interfaces in compile-time for SetQuickReplyShortcutNameRequest. +var ( + _ bin.Encoder = &SetQuickReplyShortcutNameRequest{} + _ bin.Decoder = &SetQuickReplyShortcutNameRequest{} + _ bin.BareEncoder = &SetQuickReplyShortcutNameRequest{} + _ bin.BareDecoder = &SetQuickReplyShortcutNameRequest{} +) + +func (s *SetQuickReplyShortcutNameRequest) Zero() bool { + if s == nil { + return true + } + if !(s.ShortcutID == 0) { + return false + } + if !(s.Name == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SetQuickReplyShortcutNameRequest) String() string { + if s == nil { + return "SetQuickReplyShortcutNameRequest(nil)" + } + type Alias SetQuickReplyShortcutNameRequest + return fmt.Sprintf("SetQuickReplyShortcutNameRequest%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SetQuickReplyShortcutNameRequest) TypeID() uint32 { + return SetQuickReplyShortcutNameRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SetQuickReplyShortcutNameRequest) TypeName() string { + return "setQuickReplyShortcutName" +} + +// TypeInfo returns info about TL type. +func (s *SetQuickReplyShortcutNameRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "setQuickReplyShortcutName", + ID: SetQuickReplyShortcutNameRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + { + Name: "Name", + SchemaName: "name", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SetQuickReplyShortcutNameRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setQuickReplyShortcutName#b20f471 as nil") + } + b.PutID(SetQuickReplyShortcutNameRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SetQuickReplyShortcutNameRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setQuickReplyShortcutName#b20f471 as nil") + } + b.PutInt32(s.ShortcutID) + b.PutString(s.Name) + return nil +} + +// Decode implements bin.Decoder. +func (s *SetQuickReplyShortcutNameRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setQuickReplyShortcutName#b20f471 to nil") + } + if err := b.ConsumeID(SetQuickReplyShortcutNameRequestTypeID); err != nil { + return fmt.Errorf("unable to decode setQuickReplyShortcutName#b20f471: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SetQuickReplyShortcutNameRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setQuickReplyShortcutName#b20f471 to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode setQuickReplyShortcutName#b20f471: field shortcut_id: %w", err) + } + s.ShortcutID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode setQuickReplyShortcutName#b20f471: field name: %w", err) + } + s.Name = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SetQuickReplyShortcutNameRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode setQuickReplyShortcutName#b20f471 as nil") + } + b.ObjStart() + b.PutID("setQuickReplyShortcutName") + b.Comma() + b.FieldStart("shortcut_id") + b.PutInt32(s.ShortcutID) + b.Comma() + b.FieldStart("name") + b.PutString(s.Name) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SetQuickReplyShortcutNameRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode setQuickReplyShortcutName#b20f471 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("setQuickReplyShortcutName"); err != nil { + return fmt.Errorf("unable to decode setQuickReplyShortcutName#b20f471: %w", err) + } + case "shortcut_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode setQuickReplyShortcutName#b20f471: field shortcut_id: %w", err) + } + s.ShortcutID = value + case "name": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode setQuickReplyShortcutName#b20f471: field name: %w", err) + } + s.Name = value + default: + return b.Skip() + } + return nil + }) +} + +// GetShortcutID returns value of ShortcutID field. +func (s *SetQuickReplyShortcutNameRequest) GetShortcutID() (value int32) { + if s == nil { + return + } + return s.ShortcutID +} + +// GetName returns value of Name field. +func (s *SetQuickReplyShortcutNameRequest) GetName() (value string) { + if s == nil { + return + } + return s.Name +} + +// SetQuickReplyShortcutName invokes method setQuickReplyShortcutName#b20f471 returning error if any. +func (c *Client) SetQuickReplyShortcutName(ctx context.Context, request *SetQuickReplyShortcutNameRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_time_zone_gen.go b/tdapi/tl_time_zone_gen.go new file mode 100644 index 0000000000..50442d6c19 --- /dev/null +++ b/tdapi/tl_time_zone_gen.go @@ -0,0 +1,261 @@ +// 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{} +) + +// TimeZone represents TL type `timeZone#b919f2dd`. +type TimeZone struct { + // Unique time zone identifier + ID string + // Time zone name + Name string + // Current UTC time offset for the time zone + UtcTimeOffset int32 +} + +// TimeZoneTypeID is TL type id of TimeZone. +const TimeZoneTypeID = 0xb919f2dd + +// Ensuring interfaces in compile-time for TimeZone. +var ( + _ bin.Encoder = &TimeZone{} + _ bin.Decoder = &TimeZone{} + _ bin.BareEncoder = &TimeZone{} + _ bin.BareDecoder = &TimeZone{} +) + +func (t *TimeZone) Zero() bool { + if t == nil { + return true + } + if !(t.ID == "") { + return false + } + if !(t.Name == "") { + return false + } + if !(t.UtcTimeOffset == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *TimeZone) String() string { + if t == nil { + return "TimeZone(nil)" + } + type Alias TimeZone + return fmt.Sprintf("TimeZone%+v", Alias(*t)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*TimeZone) TypeID() uint32 { + return TimeZoneTypeID +} + +// TypeName returns name of type in TL schema. +func (*TimeZone) TypeName() string { + return "timeZone" +} + +// TypeInfo returns info about TL type. +func (t *TimeZone) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "timeZone", + ID: TimeZoneTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ID", + SchemaName: "id", + }, + { + Name: "Name", + SchemaName: "name", + }, + { + Name: "UtcTimeOffset", + SchemaName: "utc_time_offset", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *TimeZone) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode timeZone#b919f2dd as nil") + } + b.PutID(TimeZoneTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *TimeZone) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode timeZone#b919f2dd as nil") + } + b.PutString(t.ID) + b.PutString(t.Name) + b.PutInt32(t.UtcTimeOffset) + return nil +} + +// Decode implements bin.Decoder. +func (t *TimeZone) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode timeZone#b919f2dd to nil") + } + if err := b.ConsumeID(TimeZoneTypeID); err != nil { + return fmt.Errorf("unable to decode timeZone#b919f2dd: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *TimeZone) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode timeZone#b919f2dd to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode timeZone#b919f2dd: field id: %w", err) + } + t.ID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode timeZone#b919f2dd: field name: %w", err) + } + t.Name = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode timeZone#b919f2dd: field utc_time_offset: %w", err) + } + t.UtcTimeOffset = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (t *TimeZone) EncodeTDLibJSON(b tdjson.Encoder) error { + if t == nil { + return fmt.Errorf("can't encode timeZone#b919f2dd as nil") + } + b.ObjStart() + b.PutID("timeZone") + b.Comma() + b.FieldStart("id") + b.PutString(t.ID) + b.Comma() + b.FieldStart("name") + b.PutString(t.Name) + b.Comma() + b.FieldStart("utc_time_offset") + b.PutInt32(t.UtcTimeOffset) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (t *TimeZone) DecodeTDLibJSON(b tdjson.Decoder) error { + if t == nil { + return fmt.Errorf("can't decode timeZone#b919f2dd to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("timeZone"); err != nil { + return fmt.Errorf("unable to decode timeZone#b919f2dd: %w", err) + } + case "id": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode timeZone#b919f2dd: field id: %w", err) + } + t.ID = value + case "name": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode timeZone#b919f2dd: field name: %w", err) + } + t.Name = value + case "utc_time_offset": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode timeZone#b919f2dd: field utc_time_offset: %w", err) + } + t.UtcTimeOffset = value + default: + return b.Skip() + } + return nil + }) +} + +// GetID returns value of ID field. +func (t *TimeZone) GetID() (value string) { + if t == nil { + return + } + return t.ID +} + +// GetName returns value of Name field. +func (t *TimeZone) GetName() (value string) { + if t == nil { + return + } + return t.Name +} + +// GetUtcTimeOffset returns value of UtcTimeOffset field. +func (t *TimeZone) GetUtcTimeOffset() (value int32) { + if t == nil { + return + } + return t.UtcTimeOffset +} diff --git a/tdapi/tl_time_zones_gen.go b/tdapi/tl_time_zones_gen.go new file mode 100644 index 0000000000..e7ce81187c --- /dev/null +++ b/tdapi/tl_time_zones_gen.go @@ -0,0 +1,221 @@ +// 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{} +) + +// TimeZones represents TL type `timeZones#7c4881b9`. +type TimeZones struct { + // A list of time zones + TimeZones []TimeZone +} + +// TimeZonesTypeID is TL type id of TimeZones. +const TimeZonesTypeID = 0x7c4881b9 + +// Ensuring interfaces in compile-time for TimeZones. +var ( + _ bin.Encoder = &TimeZones{} + _ bin.Decoder = &TimeZones{} + _ bin.BareEncoder = &TimeZones{} + _ bin.BareDecoder = &TimeZones{} +) + +func (t *TimeZones) Zero() bool { + if t == nil { + return true + } + if !(t.TimeZones == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *TimeZones) String() string { + if t == nil { + return "TimeZones(nil)" + } + type Alias TimeZones + return fmt.Sprintf("TimeZones%+v", Alias(*t)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*TimeZones) TypeID() uint32 { + return TimeZonesTypeID +} + +// TypeName returns name of type in TL schema. +func (*TimeZones) TypeName() string { + return "timeZones" +} + +// TypeInfo returns info about TL type. +func (t *TimeZones) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "timeZones", + ID: TimeZonesTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "TimeZones", + SchemaName: "time_zones", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *TimeZones) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode timeZones#7c4881b9 as nil") + } + b.PutID(TimeZonesTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *TimeZones) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode timeZones#7c4881b9 as nil") + } + b.PutInt(len(t.TimeZones)) + for idx, v := range t.TimeZones { + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare timeZones#7c4881b9: field time_zones element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (t *TimeZones) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode timeZones#7c4881b9 to nil") + } + if err := b.ConsumeID(TimeZonesTypeID); err != nil { + return fmt.Errorf("unable to decode timeZones#7c4881b9: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *TimeZones) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode timeZones#7c4881b9 to nil") + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode timeZones#7c4881b9: field time_zones: %w", err) + } + + if headerLen > 0 { + t.TimeZones = make([]TimeZone, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value TimeZone + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare timeZones#7c4881b9: field time_zones: %w", err) + } + t.TimeZones = append(t.TimeZones, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (t *TimeZones) EncodeTDLibJSON(b tdjson.Encoder) error { + if t == nil { + return fmt.Errorf("can't encode timeZones#7c4881b9 as nil") + } + b.ObjStart() + b.PutID("timeZones") + b.Comma() + b.FieldStart("time_zones") + b.ArrStart() + for idx, v := range t.TimeZones { + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode timeZones#7c4881b9: field time_zones 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 (t *TimeZones) DecodeTDLibJSON(b tdjson.Decoder) error { + if t == nil { + return fmt.Errorf("can't decode timeZones#7c4881b9 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("timeZones"); err != nil { + return fmt.Errorf("unable to decode timeZones#7c4881b9: %w", err) + } + case "time_zones": + if err := b.Arr(func(b tdjson.Decoder) error { + var value TimeZone + if err := value.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode timeZones#7c4881b9: field time_zones: %w", err) + } + t.TimeZones = append(t.TimeZones, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode timeZones#7c4881b9: field time_zones: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetTimeZones returns value of TimeZones field. +func (t *TimeZones) GetTimeZones() (value []TimeZone) { + if t == nil { + return + } + return t.TimeZones +} diff --git a/tdapi/tl_toggle_chat_folder_tags_gen.go b/tdapi/tl_toggle_chat_folder_tags_gen.go new file mode 100644 index 0000000000..e61278359d --- /dev/null +++ b/tdapi/tl_toggle_chat_folder_tags_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{} +) + +// ToggleChatFolderTagsRequest represents TL type `toggleChatFolderTags#834b6c44`. +type ToggleChatFolderTagsRequest struct { + // Pass true to enable folder tags; pass false to disable them + AreTagsEnabled bool +} + +// ToggleChatFolderTagsRequestTypeID is TL type id of ToggleChatFolderTagsRequest. +const ToggleChatFolderTagsRequestTypeID = 0x834b6c44 + +// Ensuring interfaces in compile-time for ToggleChatFolderTagsRequest. +var ( + _ bin.Encoder = &ToggleChatFolderTagsRequest{} + _ bin.Decoder = &ToggleChatFolderTagsRequest{} + _ bin.BareEncoder = &ToggleChatFolderTagsRequest{} + _ bin.BareDecoder = &ToggleChatFolderTagsRequest{} +) + +func (t *ToggleChatFolderTagsRequest) Zero() bool { + if t == nil { + return true + } + if !(t.AreTagsEnabled == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *ToggleChatFolderTagsRequest) String() string { + if t == nil { + return "ToggleChatFolderTagsRequest(nil)" + } + type Alias ToggleChatFolderTagsRequest + return fmt.Sprintf("ToggleChatFolderTagsRequest%+v", Alias(*t)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ToggleChatFolderTagsRequest) TypeID() uint32 { + return ToggleChatFolderTagsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ToggleChatFolderTagsRequest) TypeName() string { + return "toggleChatFolderTags" +} + +// TypeInfo returns info about TL type. +func (t *ToggleChatFolderTagsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "toggleChatFolderTags", + ID: ToggleChatFolderTagsRequestTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "AreTagsEnabled", + SchemaName: "are_tags_enabled", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *ToggleChatFolderTagsRequest) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode toggleChatFolderTags#834b6c44 as nil") + } + b.PutID(ToggleChatFolderTagsRequestTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *ToggleChatFolderTagsRequest) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode toggleChatFolderTags#834b6c44 as nil") + } + b.PutBool(t.AreTagsEnabled) + return nil +} + +// Decode implements bin.Decoder. +func (t *ToggleChatFolderTagsRequest) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode toggleChatFolderTags#834b6c44 to nil") + } + if err := b.ConsumeID(ToggleChatFolderTagsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode toggleChatFolderTags#834b6c44: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *ToggleChatFolderTagsRequest) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode toggleChatFolderTags#834b6c44 to nil") + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode toggleChatFolderTags#834b6c44: field are_tags_enabled: %w", err) + } + t.AreTagsEnabled = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (t *ToggleChatFolderTagsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if t == nil { + return fmt.Errorf("can't encode toggleChatFolderTags#834b6c44 as nil") + } + b.ObjStart() + b.PutID("toggleChatFolderTags") + b.Comma() + b.FieldStart("are_tags_enabled") + b.PutBool(t.AreTagsEnabled) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (t *ToggleChatFolderTagsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if t == nil { + return fmt.Errorf("can't decode toggleChatFolderTags#834b6c44 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("toggleChatFolderTags"); err != nil { + return fmt.Errorf("unable to decode toggleChatFolderTags#834b6c44: %w", err) + } + case "are_tags_enabled": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode toggleChatFolderTags#834b6c44: field are_tags_enabled: %w", err) + } + t.AreTagsEnabled = value + default: + return b.Skip() + } + return nil + }) +} + +// GetAreTagsEnabled returns value of AreTagsEnabled field. +func (t *ToggleChatFolderTagsRequest) GetAreTagsEnabled() (value bool) { + if t == nil { + return + } + return t.AreTagsEnabled +} + +// ToggleChatFolderTags invokes method toggleChatFolderTags#834b6c44 returning error if any. +func (c *Client) ToggleChatFolderTags(ctx context.Context, aretagsenabled bool) error { + var ok Ok + + request := &ToggleChatFolderTagsRequest{ + AreTagsEnabled: aretagsenabled, + } + 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 66a6e617ff..c10453478a 100644 --- a/tdapi/tl_update_gen.go +++ b/tdapi/tl_update_gen.go @@ -4461,43 +4461,38 @@ func (u *UpdateChatPosition) GetPosition() (value ChatPosition) { return u.Position } -// UpdateChatReadInbox represents TL type `updateChatReadInbox#d07036e7`. -type UpdateChatReadInbox struct { +// UpdateChatAddedToList represents TL type `updateChatAddedToList#ab7004ec`. +type UpdateChatAddedToList struct { // Chat identifier ChatID int64 - // Identifier of the last read incoming message - LastReadInboxMessageID int64 - // The number of unread messages left in the chat - UnreadCount int32 + // The chat list to which the chat was added + ChatList ChatListClass } -// UpdateChatReadInboxTypeID is TL type id of UpdateChatReadInbox. -const UpdateChatReadInboxTypeID = 0xd07036e7 +// UpdateChatAddedToListTypeID is TL type id of UpdateChatAddedToList. +const UpdateChatAddedToListTypeID = 0xab7004ec // construct implements constructor of UpdateClass. -func (u UpdateChatReadInbox) construct() UpdateClass { return &u } +func (u UpdateChatAddedToList) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatReadInbox. +// Ensuring interfaces in compile-time for UpdateChatAddedToList. var ( - _ bin.Encoder = &UpdateChatReadInbox{} - _ bin.Decoder = &UpdateChatReadInbox{} - _ bin.BareEncoder = &UpdateChatReadInbox{} - _ bin.BareDecoder = &UpdateChatReadInbox{} + _ bin.Encoder = &UpdateChatAddedToList{} + _ bin.Decoder = &UpdateChatAddedToList{} + _ bin.BareEncoder = &UpdateChatAddedToList{} + _ bin.BareDecoder = &UpdateChatAddedToList{} - _ UpdateClass = &UpdateChatReadInbox{} + _ UpdateClass = &UpdateChatAddedToList{} ) -func (u *UpdateChatReadInbox) Zero() bool { +func (u *UpdateChatAddedToList) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.LastReadInboxMessageID == 0) { - return false - } - if !(u.UnreadCount == 0) { + if !(u.ChatList == nil) { return false } @@ -4505,31 +4500,31 @@ func (u *UpdateChatReadInbox) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatReadInbox) String() string { +func (u *UpdateChatAddedToList) String() string { if u == nil { - return "UpdateChatReadInbox(nil)" + return "UpdateChatAddedToList(nil)" } - type Alias UpdateChatReadInbox - return fmt.Sprintf("UpdateChatReadInbox%+v", Alias(*u)) + type Alias UpdateChatAddedToList + return fmt.Sprintf("UpdateChatAddedToList%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatReadInbox) TypeID() uint32 { - return UpdateChatReadInboxTypeID +func (*UpdateChatAddedToList) TypeID() uint32 { + return UpdateChatAddedToListTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatReadInbox) TypeName() string { - return "updateChatReadInbox" +func (*UpdateChatAddedToList) TypeName() string { + return "updateChatAddedToList" } // TypeInfo returns info about TL type. -func (u *UpdateChatReadInbox) TypeInfo() tdp.Type { +func (u *UpdateChatAddedToList) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatReadInbox", - ID: UpdateChatReadInboxTypeID, + Name: "updateChatAddedToList", + ID: UpdateChatAddedToListTypeID, } if u == nil { typ.Null = true @@ -4541,93 +4536,88 @@ func (u *UpdateChatReadInbox) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "LastReadInboxMessageID", - SchemaName: "last_read_inbox_message_id", - }, - { - Name: "UnreadCount", - SchemaName: "unread_count", + Name: "ChatList", + SchemaName: "chat_list", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatReadInbox) Encode(b *bin.Buffer) error { +func (u *UpdateChatAddedToList) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatReadInbox#d07036e7 as nil") + return fmt.Errorf("can't encode updateChatAddedToList#ab7004ec as nil") } - b.PutID(UpdateChatReadInboxTypeID) + b.PutID(UpdateChatAddedToListTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatReadInbox) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatAddedToList) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatReadInbox#d07036e7 as nil") + return fmt.Errorf("can't encode updateChatAddedToList#ab7004ec as nil") } b.PutInt53(u.ChatID) - b.PutInt53(u.LastReadInboxMessageID) - b.PutInt32(u.UnreadCount) + if u.ChatList == nil { + return fmt.Errorf("unable to encode updateChatAddedToList#ab7004ec: field chat_list is nil") + } + if err := u.ChatList.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateChatAddedToList#ab7004ec: field chat_list: %w", err) + } return nil } // Decode implements bin.Decoder. -func (u *UpdateChatReadInbox) Decode(b *bin.Buffer) error { +func (u *UpdateChatAddedToList) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatReadInbox#d07036e7 to nil") + return fmt.Errorf("can't decode updateChatAddedToList#ab7004ec to nil") } - if err := b.ConsumeID(UpdateChatReadInboxTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: %w", err) + if err := b.ConsumeID(UpdateChatAddedToListTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatAddedToList#ab7004ec: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatReadInbox) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatAddedToList) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatReadInbox#d07036e7 to nil") + return fmt.Errorf("can't decode updateChatAddedToList#ab7004ec to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatAddedToList#ab7004ec: field chat_id: %w", err) } u.ChatID = value } { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: field last_read_inbox_message_id: %w", err) - } - u.LastReadInboxMessageID = value - } - { - value, err := b.Int32() + value, err := DecodeChatList(b) if err != nil { - return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: field unread_count: %w", err) + return fmt.Errorf("unable to decode updateChatAddedToList#ab7004ec: field chat_list: %w", err) } - u.UnreadCount = value + u.ChatList = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatReadInbox) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatAddedToList) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatReadInbox#d07036e7 as nil") + return fmt.Errorf("can't encode updateChatAddedToList#ab7004ec as nil") } b.ObjStart() - b.PutID("updateChatReadInbox") + b.PutID("updateChatAddedToList") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("last_read_inbox_message_id") - b.PutInt53(u.LastReadInboxMessageID) - b.Comma() - b.FieldStart("unread_count") - b.PutInt32(u.UnreadCount) + b.FieldStart("chat_list") + if u.ChatList == nil { + return fmt.Errorf("unable to encode updateChatAddedToList#ab7004ec: field chat_list is nil") + } + if err := u.ChatList.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateChatAddedToList#ab7004ec: field chat_list: %w", err) + } b.Comma() b.StripComma() b.ObjEnd() @@ -4635,35 +4625,29 @@ func (u *UpdateChatReadInbox) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatReadInbox) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatAddedToList) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatReadInbox#d07036e7 to nil") + return fmt.Errorf("can't decode updateChatAddedToList#ab7004ec to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatReadInbox"); err != nil { - return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: %w", err) + if err := b.ConsumeID("updateChatAddedToList"); err != nil { + return fmt.Errorf("unable to decode updateChatAddedToList#ab7004ec: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatAddedToList#ab7004ec: field chat_id: %w", err) } u.ChatID = value - case "last_read_inbox_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: field last_read_inbox_message_id: %w", err) - } - u.LastReadInboxMessageID = value - case "unread_count": - value, err := b.Int32() + case "chat_list": + value, err := DecodeTDLibJSONChatList(b) if err != nil { - return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: field unread_count: %w", err) + return fmt.Errorf("unable to decode updateChatAddedToList#ab7004ec: field chat_list: %w", err) } - u.UnreadCount = value + u.ChatList = value default: return b.Skip() } @@ -4672,61 +4656,53 @@ func (u *UpdateChatReadInbox) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetChatID returns value of ChatID field. -func (u *UpdateChatReadInbox) GetChatID() (value int64) { +func (u *UpdateChatAddedToList) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetLastReadInboxMessageID returns value of LastReadInboxMessageID field. -func (u *UpdateChatReadInbox) GetLastReadInboxMessageID() (value int64) { - if u == nil { - return - } - return u.LastReadInboxMessageID -} - -// GetUnreadCount returns value of UnreadCount field. -func (u *UpdateChatReadInbox) GetUnreadCount() (value int32) { +// GetChatList returns value of ChatList field. +func (u *UpdateChatAddedToList) GetChatList() (value ChatListClass) { if u == nil { return } - return u.UnreadCount + return u.ChatList } -// UpdateChatReadOutbox represents TL type `updateChatReadOutbox#2a385285`. -type UpdateChatReadOutbox struct { +// UpdateChatRemovedFromList represents TL type `updateChatRemovedFromList#4d2ac21c`. +type UpdateChatRemovedFromList struct { // Chat identifier ChatID int64 - // Identifier of last read outgoing message - LastReadOutboxMessageID int64 + // The chat list from which the chat was removed + ChatList ChatListClass } -// UpdateChatReadOutboxTypeID is TL type id of UpdateChatReadOutbox. -const UpdateChatReadOutboxTypeID = 0x2a385285 +// UpdateChatRemovedFromListTypeID is TL type id of UpdateChatRemovedFromList. +const UpdateChatRemovedFromListTypeID = 0x4d2ac21c // construct implements constructor of UpdateClass. -func (u UpdateChatReadOutbox) construct() UpdateClass { return &u } +func (u UpdateChatRemovedFromList) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatReadOutbox. +// Ensuring interfaces in compile-time for UpdateChatRemovedFromList. var ( - _ bin.Encoder = &UpdateChatReadOutbox{} - _ bin.Decoder = &UpdateChatReadOutbox{} - _ bin.BareEncoder = &UpdateChatReadOutbox{} - _ bin.BareDecoder = &UpdateChatReadOutbox{} + _ bin.Encoder = &UpdateChatRemovedFromList{} + _ bin.Decoder = &UpdateChatRemovedFromList{} + _ bin.BareEncoder = &UpdateChatRemovedFromList{} + _ bin.BareDecoder = &UpdateChatRemovedFromList{} - _ UpdateClass = &UpdateChatReadOutbox{} + _ UpdateClass = &UpdateChatRemovedFromList{} ) -func (u *UpdateChatReadOutbox) Zero() bool { +func (u *UpdateChatRemovedFromList) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.LastReadOutboxMessageID == 0) { + if !(u.ChatList == nil) { return false } @@ -4734,31 +4710,31 @@ func (u *UpdateChatReadOutbox) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatReadOutbox) String() string { +func (u *UpdateChatRemovedFromList) String() string { if u == nil { - return "UpdateChatReadOutbox(nil)" + return "UpdateChatRemovedFromList(nil)" } - type Alias UpdateChatReadOutbox - return fmt.Sprintf("UpdateChatReadOutbox%+v", Alias(*u)) + type Alias UpdateChatRemovedFromList + return fmt.Sprintf("UpdateChatRemovedFromList%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatReadOutbox) TypeID() uint32 { - return UpdateChatReadOutboxTypeID +func (*UpdateChatRemovedFromList) TypeID() uint32 { + return UpdateChatRemovedFromListTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatReadOutbox) TypeName() string { - return "updateChatReadOutbox" +func (*UpdateChatRemovedFromList) TypeName() string { + return "updateChatRemovedFromList" } // TypeInfo returns info about TL type. -func (u *UpdateChatReadOutbox) TypeInfo() tdp.Type { +func (u *UpdateChatRemovedFromList) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatReadOutbox", - ID: UpdateChatReadOutboxTypeID, + Name: "updateChatRemovedFromList", + ID: UpdateChatRemovedFromListTypeID, } if u == nil { typ.Null = true @@ -4770,78 +4746,88 @@ func (u *UpdateChatReadOutbox) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "LastReadOutboxMessageID", - SchemaName: "last_read_outbox_message_id", + Name: "ChatList", + SchemaName: "chat_list", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatReadOutbox) Encode(b *bin.Buffer) error { +func (u *UpdateChatRemovedFromList) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatReadOutbox#2a385285 as nil") + return fmt.Errorf("can't encode updateChatRemovedFromList#4d2ac21c as nil") } - b.PutID(UpdateChatReadOutboxTypeID) + b.PutID(UpdateChatRemovedFromListTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatReadOutbox) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatRemovedFromList) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatReadOutbox#2a385285 as nil") + return fmt.Errorf("can't encode updateChatRemovedFromList#4d2ac21c as nil") } b.PutInt53(u.ChatID) - b.PutInt53(u.LastReadOutboxMessageID) + if u.ChatList == nil { + return fmt.Errorf("unable to encode updateChatRemovedFromList#4d2ac21c: field chat_list is nil") + } + if err := u.ChatList.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateChatRemovedFromList#4d2ac21c: field chat_list: %w", err) + } return nil } // Decode implements bin.Decoder. -func (u *UpdateChatReadOutbox) Decode(b *bin.Buffer) error { +func (u *UpdateChatRemovedFromList) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatReadOutbox#2a385285 to nil") + return fmt.Errorf("can't decode updateChatRemovedFromList#4d2ac21c to nil") } - if err := b.ConsumeID(UpdateChatReadOutboxTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatReadOutbox#2a385285: %w", err) + if err := b.ConsumeID(UpdateChatRemovedFromListTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatRemovedFromList#4d2ac21c: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatReadOutbox) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatRemovedFromList) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatReadOutbox#2a385285 to nil") + return fmt.Errorf("can't decode updateChatRemovedFromList#4d2ac21c to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatReadOutbox#2a385285: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatRemovedFromList#4d2ac21c: field chat_id: %w", err) } u.ChatID = value } { - value, err := b.Int53() + value, err := DecodeChatList(b) if err != nil { - return fmt.Errorf("unable to decode updateChatReadOutbox#2a385285: field last_read_outbox_message_id: %w", err) + return fmt.Errorf("unable to decode updateChatRemovedFromList#4d2ac21c: field chat_list: %w", err) } - u.LastReadOutboxMessageID = value + u.ChatList = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatReadOutbox) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatRemovedFromList) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatReadOutbox#2a385285 as nil") + return fmt.Errorf("can't encode updateChatRemovedFromList#4d2ac21c as nil") } b.ObjStart() - b.PutID("updateChatReadOutbox") + b.PutID("updateChatRemovedFromList") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("last_read_outbox_message_id") - b.PutInt53(u.LastReadOutboxMessageID) + b.FieldStart("chat_list") + if u.ChatList == nil { + return fmt.Errorf("unable to encode updateChatRemovedFromList#4d2ac21c: field chat_list is nil") + } + if err := u.ChatList.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateChatRemovedFromList#4d2ac21c: field chat_list: %w", err) + } b.Comma() b.StripComma() b.ObjEnd() @@ -4849,29 +4835,29 @@ func (u *UpdateChatReadOutbox) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatReadOutbox) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatRemovedFromList) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatReadOutbox#2a385285 to nil") + return fmt.Errorf("can't decode updateChatRemovedFromList#4d2ac21c to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatReadOutbox"); err != nil { - return fmt.Errorf("unable to decode updateChatReadOutbox#2a385285: %w", err) + if err := b.ConsumeID("updateChatRemovedFromList"); err != nil { + return fmt.Errorf("unable to decode updateChatRemovedFromList#4d2ac21c: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatReadOutbox#2a385285: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatRemovedFromList#4d2ac21c: field chat_id: %w", err) } u.ChatID = value - case "last_read_outbox_message_id": - value, err := b.Int53() + case "chat_list": + value, err := DecodeTDLibJSONChatList(b) if err != nil { - return fmt.Errorf("unable to decode updateChatReadOutbox#2a385285: field last_read_outbox_message_id: %w", err) + return fmt.Errorf("unable to decode updateChatRemovedFromList#4d2ac21c: field chat_list: %w", err) } - u.LastReadOutboxMessageID = value + u.ChatList = value default: return b.Skip() } @@ -4880,53 +4866,58 @@ func (u *UpdateChatReadOutbox) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetChatID returns value of ChatID field. -func (u *UpdateChatReadOutbox) GetChatID() (value int64) { +func (u *UpdateChatRemovedFromList) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetLastReadOutboxMessageID returns value of LastReadOutboxMessageID field. -func (u *UpdateChatReadOutbox) GetLastReadOutboxMessageID() (value int64) { +// GetChatList returns value of ChatList field. +func (u *UpdateChatRemovedFromList) GetChatList() (value ChatListClass) { if u == nil { return } - return u.LastReadOutboxMessageID + return u.ChatList } -// UpdateChatActionBar represents TL type `updateChatActionBar#d9a258c2`. -type UpdateChatActionBar struct { +// UpdateChatReadInbox represents TL type `updateChatReadInbox#d07036e7`. +type UpdateChatReadInbox struct { // Chat identifier ChatID int64 - // The new value of the action bar; may be null - ActionBar ChatActionBarClass + // Identifier of the last read incoming message + LastReadInboxMessageID int64 + // The number of unread messages left in the chat + UnreadCount int32 } -// UpdateChatActionBarTypeID is TL type id of UpdateChatActionBar. -const UpdateChatActionBarTypeID = 0xd9a258c2 +// UpdateChatReadInboxTypeID is TL type id of UpdateChatReadInbox. +const UpdateChatReadInboxTypeID = 0xd07036e7 // construct implements constructor of UpdateClass. -func (u UpdateChatActionBar) construct() UpdateClass { return &u } +func (u UpdateChatReadInbox) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatActionBar. +// Ensuring interfaces in compile-time for UpdateChatReadInbox. var ( - _ bin.Encoder = &UpdateChatActionBar{} - _ bin.Decoder = &UpdateChatActionBar{} - _ bin.BareEncoder = &UpdateChatActionBar{} - _ bin.BareDecoder = &UpdateChatActionBar{} + _ bin.Encoder = &UpdateChatReadInbox{} + _ bin.Decoder = &UpdateChatReadInbox{} + _ bin.BareEncoder = &UpdateChatReadInbox{} + _ bin.BareDecoder = &UpdateChatReadInbox{} - _ UpdateClass = &UpdateChatActionBar{} + _ UpdateClass = &UpdateChatReadInbox{} ) -func (u *UpdateChatActionBar) Zero() bool { +func (u *UpdateChatReadInbox) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.ActionBar == nil) { + if !(u.LastReadInboxMessageID == 0) { + return false + } + if !(u.UnreadCount == 0) { return false } @@ -4934,31 +4925,31 @@ func (u *UpdateChatActionBar) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatActionBar) String() string { +func (u *UpdateChatReadInbox) String() string { if u == nil { - return "UpdateChatActionBar(nil)" + return "UpdateChatReadInbox(nil)" } - type Alias UpdateChatActionBar - return fmt.Sprintf("UpdateChatActionBar%+v", Alias(*u)) + type Alias UpdateChatReadInbox + return fmt.Sprintf("UpdateChatReadInbox%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatActionBar) TypeID() uint32 { - return UpdateChatActionBarTypeID +func (*UpdateChatReadInbox) TypeID() uint32 { + return UpdateChatReadInboxTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatActionBar) TypeName() string { - return "updateChatActionBar" +func (*UpdateChatReadInbox) TypeName() string { + return "updateChatReadInbox" } // TypeInfo returns info about TL type. -func (u *UpdateChatActionBar) TypeInfo() tdp.Type { +func (u *UpdateChatReadInbox) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatActionBar", - ID: UpdateChatActionBarTypeID, + Name: "updateChatReadInbox", + ID: UpdateChatReadInboxTypeID, } if u == nil { typ.Null = true @@ -4970,88 +4961,93 @@ func (u *UpdateChatActionBar) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "ActionBar", - SchemaName: "action_bar", + Name: "LastReadInboxMessageID", + SchemaName: "last_read_inbox_message_id", + }, + { + Name: "UnreadCount", + SchemaName: "unread_count", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatActionBar) Encode(b *bin.Buffer) error { +func (u *UpdateChatReadInbox) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatActionBar#d9a258c2 as nil") + return fmt.Errorf("can't encode updateChatReadInbox#d07036e7 as nil") } - b.PutID(UpdateChatActionBarTypeID) + b.PutID(UpdateChatReadInboxTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatActionBar) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatReadInbox) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatActionBar#d9a258c2 as nil") + return fmt.Errorf("can't encode updateChatReadInbox#d07036e7 as nil") } b.PutInt53(u.ChatID) - if u.ActionBar == nil { - return fmt.Errorf("unable to encode updateChatActionBar#d9a258c2: field action_bar is nil") - } - if err := u.ActionBar.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatActionBar#d9a258c2: field action_bar: %w", err) - } + b.PutInt53(u.LastReadInboxMessageID) + b.PutInt32(u.UnreadCount) return nil } // Decode implements bin.Decoder. -func (u *UpdateChatActionBar) Decode(b *bin.Buffer) error { +func (u *UpdateChatReadInbox) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatActionBar#d9a258c2 to nil") + return fmt.Errorf("can't decode updateChatReadInbox#d07036e7 to nil") } - if err := b.ConsumeID(UpdateChatActionBarTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatActionBar#d9a258c2: %w", err) + if err := b.ConsumeID(UpdateChatReadInboxTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatActionBar) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatReadInbox) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatActionBar#d9a258c2 to nil") + return fmt.Errorf("can't decode updateChatReadInbox#d07036e7 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatActionBar#d9a258c2: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: field chat_id: %w", err) } u.ChatID = value } { - value, err := DecodeChatActionBar(b) + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatActionBar#d9a258c2: field action_bar: %w", err) + return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: field last_read_inbox_message_id: %w", err) } - u.ActionBar = value + u.LastReadInboxMessageID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: field unread_count: %w", err) + } + u.UnreadCount = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatActionBar) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatReadInbox) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatActionBar#d9a258c2 as nil") + return fmt.Errorf("can't encode updateChatReadInbox#d07036e7 as nil") } b.ObjStart() - b.PutID("updateChatActionBar") + b.PutID("updateChatReadInbox") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("action_bar") - if u.ActionBar == nil { - return fmt.Errorf("unable to encode updateChatActionBar#d9a258c2: field action_bar is nil") - } - if err := u.ActionBar.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatActionBar#d9a258c2: field action_bar: %w", err) - } + b.FieldStart("last_read_inbox_message_id") + b.PutInt53(u.LastReadInboxMessageID) + b.Comma() + b.FieldStart("unread_count") + b.PutInt32(u.UnreadCount) b.Comma() b.StripComma() b.ObjEnd() @@ -5059,29 +5055,35 @@ func (u *UpdateChatActionBar) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatActionBar) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatReadInbox) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatActionBar#d9a258c2 to nil") + return fmt.Errorf("can't decode updateChatReadInbox#d07036e7 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatActionBar"); err != nil { - return fmt.Errorf("unable to decode updateChatActionBar#d9a258c2: %w", err) + if err := b.ConsumeID("updateChatReadInbox"); err != nil { + return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatActionBar#d9a258c2: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: field chat_id: %w", err) } u.ChatID = value - case "action_bar": - value, err := DecodeTDLibJSONChatActionBar(b) + case "last_read_inbox_message_id": + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatActionBar#d9a258c2: field action_bar: %w", err) + return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: field last_read_inbox_message_id: %w", err) } - u.ActionBar = value + u.LastReadInboxMessageID = value + case "unread_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: field unread_count: %w", err) + } + u.UnreadCount = value default: return b.Skip() } @@ -5090,53 +5092,61 @@ func (u *UpdateChatActionBar) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetChatID returns value of ChatID field. -func (u *UpdateChatActionBar) GetChatID() (value int64) { +func (u *UpdateChatReadInbox) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetActionBar returns value of ActionBar field. -func (u *UpdateChatActionBar) GetActionBar() (value ChatActionBarClass) { +// GetLastReadInboxMessageID returns value of LastReadInboxMessageID field. +func (u *UpdateChatReadInbox) GetLastReadInboxMessageID() (value int64) { if u == nil { return } - return u.ActionBar + return u.LastReadInboxMessageID } -// UpdateChatAvailableReactions represents TL type `updateChatAvailableReactions#8ab413f9`. -type UpdateChatAvailableReactions struct { +// GetUnreadCount returns value of UnreadCount field. +func (u *UpdateChatReadInbox) GetUnreadCount() (value int32) { + if u == nil { + return + } + return u.UnreadCount +} + +// UpdateChatReadOutbox represents TL type `updateChatReadOutbox#2a385285`. +type UpdateChatReadOutbox struct { // Chat identifier ChatID int64 - // The new reactions, available in the chat - AvailableReactions ChatAvailableReactionsClass + // Identifier of last read outgoing message + LastReadOutboxMessageID int64 } -// UpdateChatAvailableReactionsTypeID is TL type id of UpdateChatAvailableReactions. -const UpdateChatAvailableReactionsTypeID = 0x8ab413f9 +// UpdateChatReadOutboxTypeID is TL type id of UpdateChatReadOutbox. +const UpdateChatReadOutboxTypeID = 0x2a385285 // construct implements constructor of UpdateClass. -func (u UpdateChatAvailableReactions) construct() UpdateClass { return &u } +func (u UpdateChatReadOutbox) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatAvailableReactions. +// Ensuring interfaces in compile-time for UpdateChatReadOutbox. var ( - _ bin.Encoder = &UpdateChatAvailableReactions{} - _ bin.Decoder = &UpdateChatAvailableReactions{} - _ bin.BareEncoder = &UpdateChatAvailableReactions{} - _ bin.BareDecoder = &UpdateChatAvailableReactions{} + _ bin.Encoder = &UpdateChatReadOutbox{} + _ bin.Decoder = &UpdateChatReadOutbox{} + _ bin.BareEncoder = &UpdateChatReadOutbox{} + _ bin.BareDecoder = &UpdateChatReadOutbox{} - _ UpdateClass = &UpdateChatAvailableReactions{} + _ UpdateClass = &UpdateChatReadOutbox{} ) -func (u *UpdateChatAvailableReactions) Zero() bool { +func (u *UpdateChatReadOutbox) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.AvailableReactions == nil) { + if !(u.LastReadOutboxMessageID == 0) { return false } @@ -5144,31 +5154,31 @@ func (u *UpdateChatAvailableReactions) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatAvailableReactions) String() string { +func (u *UpdateChatReadOutbox) String() string { if u == nil { - return "UpdateChatAvailableReactions(nil)" + return "UpdateChatReadOutbox(nil)" } - type Alias UpdateChatAvailableReactions - return fmt.Sprintf("UpdateChatAvailableReactions%+v", Alias(*u)) + type Alias UpdateChatReadOutbox + return fmt.Sprintf("UpdateChatReadOutbox%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatAvailableReactions) TypeID() uint32 { - return UpdateChatAvailableReactionsTypeID +func (*UpdateChatReadOutbox) TypeID() uint32 { + return UpdateChatReadOutboxTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatAvailableReactions) TypeName() string { - return "updateChatAvailableReactions" +func (*UpdateChatReadOutbox) TypeName() string { + return "updateChatReadOutbox" } // TypeInfo returns info about TL type. -func (u *UpdateChatAvailableReactions) TypeInfo() tdp.Type { +func (u *UpdateChatReadOutbox) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatAvailableReactions", - ID: UpdateChatAvailableReactionsTypeID, + Name: "updateChatReadOutbox", + ID: UpdateChatReadOutboxTypeID, } if u == nil { typ.Null = true @@ -5180,88 +5190,78 @@ func (u *UpdateChatAvailableReactions) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "AvailableReactions", - SchemaName: "available_reactions", + Name: "LastReadOutboxMessageID", + SchemaName: "last_read_outbox_message_id", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatAvailableReactions) Encode(b *bin.Buffer) error { +func (u *UpdateChatReadOutbox) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatAvailableReactions#8ab413f9 as nil") + return fmt.Errorf("can't encode updateChatReadOutbox#2a385285 as nil") } - b.PutID(UpdateChatAvailableReactionsTypeID) + b.PutID(UpdateChatReadOutboxTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatAvailableReactions) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatReadOutbox) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatAvailableReactions#8ab413f9 as nil") + return fmt.Errorf("can't encode updateChatReadOutbox#2a385285 as nil") } b.PutInt53(u.ChatID) - if u.AvailableReactions == nil { - return fmt.Errorf("unable to encode updateChatAvailableReactions#8ab413f9: field available_reactions is nil") - } - if err := u.AvailableReactions.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatAvailableReactions#8ab413f9: field available_reactions: %w", err) - } + b.PutInt53(u.LastReadOutboxMessageID) return nil } // Decode implements bin.Decoder. -func (u *UpdateChatAvailableReactions) Decode(b *bin.Buffer) error { +func (u *UpdateChatReadOutbox) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatAvailableReactions#8ab413f9 to nil") + return fmt.Errorf("can't decode updateChatReadOutbox#2a385285 to nil") } - if err := b.ConsumeID(UpdateChatAvailableReactionsTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatAvailableReactions#8ab413f9: %w", err) + if err := b.ConsumeID(UpdateChatReadOutboxTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatReadOutbox#2a385285: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatAvailableReactions) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatReadOutbox) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatAvailableReactions#8ab413f9 to nil") + return fmt.Errorf("can't decode updateChatReadOutbox#2a385285 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatAvailableReactions#8ab413f9: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatReadOutbox#2a385285: field chat_id: %w", err) } u.ChatID = value } { - value, err := DecodeChatAvailableReactions(b) + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatAvailableReactions#8ab413f9: field available_reactions: %w", err) + return fmt.Errorf("unable to decode updateChatReadOutbox#2a385285: field last_read_outbox_message_id: %w", err) } - u.AvailableReactions = value + u.LastReadOutboxMessageID = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatAvailableReactions) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatReadOutbox) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatAvailableReactions#8ab413f9 as nil") + return fmt.Errorf("can't encode updateChatReadOutbox#2a385285 as nil") } b.ObjStart() - b.PutID("updateChatAvailableReactions") + b.PutID("updateChatReadOutbox") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("available_reactions") - if u.AvailableReactions == nil { - return fmt.Errorf("unable to encode updateChatAvailableReactions#8ab413f9: field available_reactions is nil") - } - if err := u.AvailableReactions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatAvailableReactions#8ab413f9: field available_reactions: %w", err) - } + b.FieldStart("last_read_outbox_message_id") + b.PutInt53(u.LastReadOutboxMessageID) b.Comma() b.StripComma() b.ObjEnd() @@ -5269,29 +5269,29 @@ func (u *UpdateChatAvailableReactions) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatAvailableReactions) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatReadOutbox) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatAvailableReactions#8ab413f9 to nil") + return fmt.Errorf("can't decode updateChatReadOutbox#2a385285 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatAvailableReactions"); err != nil { - return fmt.Errorf("unable to decode updateChatAvailableReactions#8ab413f9: %w", err) + if err := b.ConsumeID("updateChatReadOutbox"); err != nil { + return fmt.Errorf("unable to decode updateChatReadOutbox#2a385285: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatAvailableReactions#8ab413f9: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatReadOutbox#2a385285: field chat_id: %w", err) } u.ChatID = value - case "available_reactions": - value, err := DecodeTDLibJSONChatAvailableReactions(b) + case "last_read_outbox_message_id": + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatAvailableReactions#8ab413f9: field available_reactions: %w", err) + return fmt.Errorf("unable to decode updateChatReadOutbox#2a385285: field last_read_outbox_message_id: %w", err) } - u.AvailableReactions = value + u.LastReadOutboxMessageID = value default: return b.Skip() } @@ -5300,58 +5300,53 @@ func (u *UpdateChatAvailableReactions) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetChatID returns value of ChatID field. -func (u *UpdateChatAvailableReactions) GetChatID() (value int64) { +func (u *UpdateChatReadOutbox) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetAvailableReactions returns value of AvailableReactions field. -func (u *UpdateChatAvailableReactions) GetAvailableReactions() (value ChatAvailableReactionsClass) { +// GetLastReadOutboxMessageID returns value of LastReadOutboxMessageID field. +func (u *UpdateChatReadOutbox) GetLastReadOutboxMessageID() (value int64) { if u == nil { return } - return u.AvailableReactions + return u.LastReadOutboxMessageID } -// UpdateChatDraftMessage represents TL type `updateChatDraftMessage#2bf257d4`. -type UpdateChatDraftMessage struct { +// UpdateChatActionBar represents TL type `updateChatActionBar#d9a258c2`. +type UpdateChatActionBar struct { // Chat identifier ChatID int64 - // The new draft message; may be null if none - DraftMessage DraftMessage - // The new chat positions in the chat lists - Positions []ChatPosition + // The new value of the action bar; may be null + ActionBar ChatActionBarClass } -// UpdateChatDraftMessageTypeID is TL type id of UpdateChatDraftMessage. -const UpdateChatDraftMessageTypeID = 0x2bf257d4 +// UpdateChatActionBarTypeID is TL type id of UpdateChatActionBar. +const UpdateChatActionBarTypeID = 0xd9a258c2 // construct implements constructor of UpdateClass. -func (u UpdateChatDraftMessage) construct() UpdateClass { return &u } +func (u UpdateChatActionBar) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatDraftMessage. +// Ensuring interfaces in compile-time for UpdateChatActionBar. var ( - _ bin.Encoder = &UpdateChatDraftMessage{} - _ bin.Decoder = &UpdateChatDraftMessage{} - _ bin.BareEncoder = &UpdateChatDraftMessage{} - _ bin.BareDecoder = &UpdateChatDraftMessage{} + _ bin.Encoder = &UpdateChatActionBar{} + _ bin.Decoder = &UpdateChatActionBar{} + _ bin.BareEncoder = &UpdateChatActionBar{} + _ bin.BareDecoder = &UpdateChatActionBar{} - _ UpdateClass = &UpdateChatDraftMessage{} + _ UpdateClass = &UpdateChatActionBar{} ) -func (u *UpdateChatDraftMessage) Zero() bool { +func (u *UpdateChatActionBar) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.DraftMessage.Zero()) { - return false - } - if !(u.Positions == nil) { + if !(u.ActionBar == nil) { return false } @@ -5359,31 +5354,31 @@ func (u *UpdateChatDraftMessage) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatDraftMessage) String() string { +func (u *UpdateChatActionBar) String() string { if u == nil { - return "UpdateChatDraftMessage(nil)" + return "UpdateChatActionBar(nil)" } - type Alias UpdateChatDraftMessage - return fmt.Sprintf("UpdateChatDraftMessage%+v", Alias(*u)) + type Alias UpdateChatActionBar + return fmt.Sprintf("UpdateChatActionBar%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatDraftMessage) TypeID() uint32 { - return UpdateChatDraftMessageTypeID +func (*UpdateChatActionBar) TypeID() uint32 { + return UpdateChatActionBarTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatDraftMessage) TypeName() string { - return "updateChatDraftMessage" +func (*UpdateChatActionBar) TypeName() string { + return "updateChatActionBar" } // TypeInfo returns info about TL type. -func (u *UpdateChatDraftMessage) TypeInfo() tdp.Type { +func (u *UpdateChatActionBar) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatDraftMessage", - ID: UpdateChatDraftMessageTypeID, + Name: "updateChatActionBar", + ID: UpdateChatActionBarTypeID, } if u == nil { typ.Null = true @@ -5395,118 +5390,88 @@ func (u *UpdateChatDraftMessage) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "DraftMessage", - SchemaName: "draft_message", - }, - { - Name: "Positions", - SchemaName: "positions", + Name: "ActionBar", + SchemaName: "action_bar", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatDraftMessage) Encode(b *bin.Buffer) error { +func (u *UpdateChatActionBar) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatDraftMessage#2bf257d4 as nil") + return fmt.Errorf("can't encode updateChatActionBar#d9a258c2 as nil") } - b.PutID(UpdateChatDraftMessageTypeID) + b.PutID(UpdateChatActionBarTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatDraftMessage) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatActionBar) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatDraftMessage#2bf257d4 as nil") + return fmt.Errorf("can't encode updateChatActionBar#d9a258c2 as nil") } b.PutInt53(u.ChatID) - if err := u.DraftMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatDraftMessage#2bf257d4: field draft_message: %w", err) + if u.ActionBar == nil { + return fmt.Errorf("unable to encode updateChatActionBar#d9a258c2: field action_bar is nil") } - b.PutInt(len(u.Positions)) - for idx, v := range u.Positions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateChatDraftMessage#2bf257d4: field positions element with index %d: %w", idx, err) - } + if err := u.ActionBar.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateChatActionBar#d9a258c2: field action_bar: %w", err) } return nil } // Decode implements bin.Decoder. -func (u *UpdateChatDraftMessage) Decode(b *bin.Buffer) error { +func (u *UpdateChatActionBar) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatDraftMessage#2bf257d4 to nil") + return fmt.Errorf("can't decode updateChatActionBar#d9a258c2 to nil") } - if err := b.ConsumeID(UpdateChatDraftMessageTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: %w", err) + if err := b.ConsumeID(UpdateChatActionBarTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatActionBar#d9a258c2: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatDraftMessage) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatActionBar) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatDraftMessage#2bf257d4 to nil") + return fmt.Errorf("can't decode updateChatActionBar#d9a258c2 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatActionBar#d9a258c2: field chat_id: %w", err) } u.ChatID = value } { - if err := u.DraftMessage.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: field draft_message: %w", err) - } - } - { - headerLen, err := b.Int() + value, err := DecodeChatActionBar(b) if err != nil { - return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: field positions: %w", err) - } - - if headerLen > 0 { - u.Positions = make([]ChatPosition, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatPosition - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare updateChatDraftMessage#2bf257d4: field positions: %w", err) - } - u.Positions = append(u.Positions, value) + return fmt.Errorf("unable to decode updateChatActionBar#d9a258c2: field action_bar: %w", err) } + u.ActionBar = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatDraftMessage) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatActionBar) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatDraftMessage#2bf257d4 as nil") + return fmt.Errorf("can't encode updateChatActionBar#d9a258c2 as nil") } b.ObjStart() - b.PutID("updateChatDraftMessage") + b.PutID("updateChatActionBar") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("draft_message") - if err := u.DraftMessage.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatDraftMessage#2bf257d4: field draft_message: %w", err) + b.FieldStart("action_bar") + if u.ActionBar == nil { + return fmt.Errorf("unable to encode updateChatActionBar#d9a258c2: field action_bar is nil") } - b.Comma() - b.FieldStart("positions") - b.ArrStart() - for idx, v := range u.Positions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatDraftMessage#2bf257d4: field positions element with index %d: %w", idx, err) - } - b.Comma() + if err := u.ActionBar.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateChatActionBar#d9a258c2: field action_bar: %w", err) } - b.StripComma() - b.ArrEnd() b.Comma() b.StripComma() b.ObjEnd() @@ -5514,38 +5479,29 @@ func (u *UpdateChatDraftMessage) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatDraftMessage) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatActionBar) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatDraftMessage#2bf257d4 to nil") + return fmt.Errorf("can't decode updateChatActionBar#d9a258c2 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatDraftMessage"); err != nil { - return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: %w", err) + if err := b.ConsumeID("updateChatActionBar"); err != nil { + return fmt.Errorf("unable to decode updateChatActionBar#d9a258c2: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatActionBar#d9a258c2: field chat_id: %w", err) } u.ChatID = value - case "draft_message": - if err := u.DraftMessage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: field draft_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 updateChatDraftMessage#2bf257d4: field positions: %w", err) - } - u.Positions = append(u.Positions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: field positions: %w", err) + case "action_bar": + value, err := DecodeTDLibJSONChatActionBar(b) + if err != nil { + return fmt.Errorf("unable to decode updateChatActionBar#d9a258c2: field action_bar: %w", err) } + u.ActionBar = value default: return b.Skip() } @@ -5554,61 +5510,53 @@ func (u *UpdateChatDraftMessage) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetChatID returns value of ChatID field. -func (u *UpdateChatDraftMessage) GetChatID() (value int64) { +func (u *UpdateChatActionBar) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetDraftMessage returns value of DraftMessage field. -func (u *UpdateChatDraftMessage) GetDraftMessage() (value DraftMessage) { - if u == nil { - return - } - return u.DraftMessage -} - -// GetPositions returns value of Positions field. -func (u *UpdateChatDraftMessage) GetPositions() (value []ChatPosition) { +// GetActionBar returns value of ActionBar field. +func (u *UpdateChatActionBar) GetActionBar() (value ChatActionBarClass) { if u == nil { return } - return u.Positions + return u.ActionBar } -// UpdateChatEmojiStatus represents TL type `updateChatEmojiStatus#77796510`. -type UpdateChatEmojiStatus struct { +// UpdateChatAvailableReactions represents TL type `updateChatAvailableReactions#8ab413f9`. +type UpdateChatAvailableReactions struct { // Chat identifier ChatID int64 - // The new chat emoji status; may be null - EmojiStatus EmojiStatus + // The new reactions, available in the chat + AvailableReactions ChatAvailableReactionsClass } -// UpdateChatEmojiStatusTypeID is TL type id of UpdateChatEmojiStatus. -const UpdateChatEmojiStatusTypeID = 0x77796510 +// UpdateChatAvailableReactionsTypeID is TL type id of UpdateChatAvailableReactions. +const UpdateChatAvailableReactionsTypeID = 0x8ab413f9 // construct implements constructor of UpdateClass. -func (u UpdateChatEmojiStatus) construct() UpdateClass { return &u } +func (u UpdateChatAvailableReactions) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatEmojiStatus. +// Ensuring interfaces in compile-time for UpdateChatAvailableReactions. var ( - _ bin.Encoder = &UpdateChatEmojiStatus{} - _ bin.Decoder = &UpdateChatEmojiStatus{} - _ bin.BareEncoder = &UpdateChatEmojiStatus{} - _ bin.BareDecoder = &UpdateChatEmojiStatus{} + _ bin.Encoder = &UpdateChatAvailableReactions{} + _ bin.Decoder = &UpdateChatAvailableReactions{} + _ bin.BareEncoder = &UpdateChatAvailableReactions{} + _ bin.BareDecoder = &UpdateChatAvailableReactions{} - _ UpdateClass = &UpdateChatEmojiStatus{} + _ UpdateClass = &UpdateChatAvailableReactions{} ) -func (u *UpdateChatEmojiStatus) Zero() bool { +func (u *UpdateChatAvailableReactions) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.EmojiStatus.Zero()) { + if !(u.AvailableReactions == nil) { return false } @@ -5616,31 +5564,31 @@ func (u *UpdateChatEmojiStatus) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatEmojiStatus) String() string { +func (u *UpdateChatAvailableReactions) String() string { if u == nil { - return "UpdateChatEmojiStatus(nil)" + return "UpdateChatAvailableReactions(nil)" } - type Alias UpdateChatEmojiStatus - return fmt.Sprintf("UpdateChatEmojiStatus%+v", Alias(*u)) + type Alias UpdateChatAvailableReactions + return fmt.Sprintf("UpdateChatAvailableReactions%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatEmojiStatus) TypeID() uint32 { - return UpdateChatEmojiStatusTypeID +func (*UpdateChatAvailableReactions) TypeID() uint32 { + return UpdateChatAvailableReactionsTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatEmojiStatus) TypeName() string { - return "updateChatEmojiStatus" +func (*UpdateChatAvailableReactions) TypeName() string { + return "updateChatAvailableReactions" } // TypeInfo returns info about TL type. -func (u *UpdateChatEmojiStatus) TypeInfo() tdp.Type { +func (u *UpdateChatAvailableReactions) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatEmojiStatus", - ID: UpdateChatEmojiStatusTypeID, + Name: "updateChatAvailableReactions", + ID: UpdateChatAvailableReactionsTypeID, } if u == nil { typ.Null = true @@ -5652,79 +5600,87 @@ func (u *UpdateChatEmojiStatus) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "EmojiStatus", - SchemaName: "emoji_status", + Name: "AvailableReactions", + SchemaName: "available_reactions", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatEmojiStatus) Encode(b *bin.Buffer) error { +func (u *UpdateChatAvailableReactions) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatEmojiStatus#77796510 as nil") + return fmt.Errorf("can't encode updateChatAvailableReactions#8ab413f9 as nil") } - b.PutID(UpdateChatEmojiStatusTypeID) + b.PutID(UpdateChatAvailableReactionsTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatEmojiStatus) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatAvailableReactions) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatEmojiStatus#77796510 as nil") + return fmt.Errorf("can't encode updateChatAvailableReactions#8ab413f9 as nil") } b.PutInt53(u.ChatID) - if err := u.EmojiStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatEmojiStatus#77796510: field emoji_status: %w", err) + if u.AvailableReactions == nil { + return fmt.Errorf("unable to encode updateChatAvailableReactions#8ab413f9: field available_reactions is nil") + } + if err := u.AvailableReactions.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateChatAvailableReactions#8ab413f9: field available_reactions: %w", err) } return nil } // Decode implements bin.Decoder. -func (u *UpdateChatEmojiStatus) Decode(b *bin.Buffer) error { +func (u *UpdateChatAvailableReactions) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatEmojiStatus#77796510 to nil") + return fmt.Errorf("can't decode updateChatAvailableReactions#8ab413f9 to nil") } - if err := b.ConsumeID(UpdateChatEmojiStatusTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatEmojiStatus#77796510: %w", err) + if err := b.ConsumeID(UpdateChatAvailableReactionsTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatAvailableReactions#8ab413f9: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatEmojiStatus) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatAvailableReactions) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatEmojiStatus#77796510 to nil") + return fmt.Errorf("can't decode updateChatAvailableReactions#8ab413f9 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatEmojiStatus#77796510: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatAvailableReactions#8ab413f9: field chat_id: %w", err) } u.ChatID = value } { - if err := u.EmojiStatus.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatEmojiStatus#77796510: field emoji_status: %w", err) + value, err := DecodeChatAvailableReactions(b) + if err != nil { + return fmt.Errorf("unable to decode updateChatAvailableReactions#8ab413f9: field available_reactions: %w", err) } + u.AvailableReactions = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatEmojiStatus) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatAvailableReactions) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatEmojiStatus#77796510 as nil") + return fmt.Errorf("can't encode updateChatAvailableReactions#8ab413f9 as nil") } b.ObjStart() - b.PutID("updateChatEmojiStatus") + b.PutID("updateChatAvailableReactions") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("emoji_status") - if err := u.EmojiStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatEmojiStatus#77796510: field emoji_status: %w", err) + b.FieldStart("available_reactions") + if u.AvailableReactions == nil { + return fmt.Errorf("unable to encode updateChatAvailableReactions#8ab413f9: field available_reactions is nil") + } + if err := u.AvailableReactions.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateChatAvailableReactions#8ab413f9: field available_reactions: %w", err) } b.Comma() b.StripComma() @@ -5733,27 +5689,29 @@ func (u *UpdateChatEmojiStatus) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatEmojiStatus) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatAvailableReactions) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatEmojiStatus#77796510 to nil") + return fmt.Errorf("can't decode updateChatAvailableReactions#8ab413f9 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatEmojiStatus"); err != nil { - return fmt.Errorf("unable to decode updateChatEmojiStatus#77796510: %w", err) + if err := b.ConsumeID("updateChatAvailableReactions"); err != nil { + return fmt.Errorf("unable to decode updateChatAvailableReactions#8ab413f9: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatEmojiStatus#77796510: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatAvailableReactions#8ab413f9: field chat_id: %w", err) } u.ChatID = value - case "emoji_status": - if err := u.EmojiStatus.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatEmojiStatus#77796510: field emoji_status: %w", err) + case "available_reactions": + value, err := DecodeTDLibJSONChatAvailableReactions(b) + if err != nil { + return fmt.Errorf("unable to decode updateChatAvailableReactions#8ab413f9: field available_reactions: %w", err) } + u.AvailableReactions = value default: return b.Skip() } @@ -5762,53 +5720,58 @@ func (u *UpdateChatEmojiStatus) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetChatID returns value of ChatID field. -func (u *UpdateChatEmojiStatus) GetChatID() (value int64) { +func (u *UpdateChatAvailableReactions) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetEmojiStatus returns value of EmojiStatus field. -func (u *UpdateChatEmojiStatus) GetEmojiStatus() (value EmojiStatus) { +// GetAvailableReactions returns value of AvailableReactions field. +func (u *UpdateChatAvailableReactions) GetAvailableReactions() (value ChatAvailableReactionsClass) { if u == nil { return } - return u.EmojiStatus + return u.AvailableReactions } -// UpdateChatMessageSender represents TL type `updateChatMessageSender#77705241`. -type UpdateChatMessageSender struct { +// UpdateChatDraftMessage represents TL type `updateChatDraftMessage#2bf257d4`. +type UpdateChatDraftMessage struct { // Chat identifier ChatID int64 - // New value of message_sender_id; may be null if the user can't change message sender - MessageSenderID MessageSenderClass + // The new draft message; may be null if none + DraftMessage DraftMessage + // The new chat positions in the chat lists + Positions []ChatPosition } -// UpdateChatMessageSenderTypeID is TL type id of UpdateChatMessageSender. -const UpdateChatMessageSenderTypeID = 0x77705241 +// UpdateChatDraftMessageTypeID is TL type id of UpdateChatDraftMessage. +const UpdateChatDraftMessageTypeID = 0x2bf257d4 // construct implements constructor of UpdateClass. -func (u UpdateChatMessageSender) construct() UpdateClass { return &u } +func (u UpdateChatDraftMessage) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatMessageSender. +// Ensuring interfaces in compile-time for UpdateChatDraftMessage. var ( - _ bin.Encoder = &UpdateChatMessageSender{} - _ bin.Decoder = &UpdateChatMessageSender{} - _ bin.BareEncoder = &UpdateChatMessageSender{} - _ bin.BareDecoder = &UpdateChatMessageSender{} + _ bin.Encoder = &UpdateChatDraftMessage{} + _ bin.Decoder = &UpdateChatDraftMessage{} + _ bin.BareEncoder = &UpdateChatDraftMessage{} + _ bin.BareDecoder = &UpdateChatDraftMessage{} - _ UpdateClass = &UpdateChatMessageSender{} + _ UpdateClass = &UpdateChatDraftMessage{} ) -func (u *UpdateChatMessageSender) Zero() bool { +func (u *UpdateChatDraftMessage) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.MessageSenderID == nil) { + if !(u.DraftMessage.Zero()) { + return false + } + if !(u.Positions == nil) { return false } @@ -5816,31 +5779,31 @@ func (u *UpdateChatMessageSender) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatMessageSender) String() string { +func (u *UpdateChatDraftMessage) String() string { if u == nil { - return "UpdateChatMessageSender(nil)" + return "UpdateChatDraftMessage(nil)" } - type Alias UpdateChatMessageSender - return fmt.Sprintf("UpdateChatMessageSender%+v", Alias(*u)) + type Alias UpdateChatDraftMessage + return fmt.Sprintf("UpdateChatDraftMessage%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatMessageSender) TypeID() uint32 { - return UpdateChatMessageSenderTypeID +func (*UpdateChatDraftMessage) TypeID() uint32 { + return UpdateChatDraftMessageTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatMessageSender) TypeName() string { - return "updateChatMessageSender" +func (*UpdateChatDraftMessage) TypeName() string { + return "updateChatDraftMessage" } // TypeInfo returns info about TL type. -func (u *UpdateChatMessageSender) TypeInfo() tdp.Type { +func (u *UpdateChatDraftMessage) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatMessageSender", - ID: UpdateChatMessageSenderTypeID, + Name: "updateChatDraftMessage", + ID: UpdateChatDraftMessageTypeID, } if u == nil { typ.Null = true @@ -5852,88 +5815,118 @@ func (u *UpdateChatMessageSender) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "MessageSenderID", - SchemaName: "message_sender_id", + Name: "DraftMessage", + SchemaName: "draft_message", + }, + { + Name: "Positions", + SchemaName: "positions", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatMessageSender) Encode(b *bin.Buffer) error { +func (u *UpdateChatDraftMessage) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatMessageSender#77705241 as nil") + return fmt.Errorf("can't encode updateChatDraftMessage#2bf257d4 as nil") } - b.PutID(UpdateChatMessageSenderTypeID) + b.PutID(UpdateChatDraftMessageTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatMessageSender) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatDraftMessage) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatMessageSender#77705241 as nil") + return fmt.Errorf("can't encode updateChatDraftMessage#2bf257d4 as nil") } b.PutInt53(u.ChatID) - if u.MessageSenderID == nil { - return fmt.Errorf("unable to encode updateChatMessageSender#77705241: field message_sender_id is nil") + if err := u.DraftMessage.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateChatDraftMessage#2bf257d4: field draft_message: %w", err) } - if err := u.MessageSenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatMessageSender#77705241: field message_sender_id: %w", err) + b.PutInt(len(u.Positions)) + for idx, v := range u.Positions { + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare updateChatDraftMessage#2bf257d4: field positions element with index %d: %w", idx, err) + } } return nil } // Decode implements bin.Decoder. -func (u *UpdateChatMessageSender) Decode(b *bin.Buffer) error { +func (u *UpdateChatDraftMessage) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatMessageSender#77705241 to nil") + return fmt.Errorf("can't decode updateChatDraftMessage#2bf257d4 to nil") } - if err := b.ConsumeID(UpdateChatMessageSenderTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatMessageSender#77705241: %w", err) + if err := b.ConsumeID(UpdateChatDraftMessageTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatMessageSender) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatDraftMessage) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatMessageSender#77705241 to nil") + return fmt.Errorf("can't decode updateChatDraftMessage#2bf257d4 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatMessageSender#77705241: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: field chat_id: %w", err) } u.ChatID = value } { - value, err := DecodeMessageSender(b) + if err := u.DraftMessage.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: field draft_message: %w", err) + } + } + { + headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode updateChatMessageSender#77705241: field message_sender_id: %w", err) + return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: field positions: %w", err) + } + + if headerLen > 0 { + u.Positions = make([]ChatPosition, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value ChatPosition + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare updateChatDraftMessage#2bf257d4: field positions: %w", err) + } + u.Positions = append(u.Positions, value) } - u.MessageSenderID = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatMessageSender) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatDraftMessage) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatMessageSender#77705241 as nil") + return fmt.Errorf("can't encode updateChatDraftMessage#2bf257d4 as nil") } b.ObjStart() - b.PutID("updateChatMessageSender") + b.PutID("updateChatDraftMessage") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("message_sender_id") - if u.MessageSenderID == nil { - return fmt.Errorf("unable to encode updateChatMessageSender#77705241: field message_sender_id is nil") + b.FieldStart("draft_message") + if err := u.DraftMessage.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateChatDraftMessage#2bf257d4: field draft_message: %w", err) } - if err := u.MessageSenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatMessageSender#77705241: field message_sender_id: %w", err) + b.Comma() + b.FieldStart("positions") + b.ArrStart() + for idx, v := range u.Positions { + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateChatDraftMessage#2bf257d4: field positions element with index %d: %w", idx, err) + } + b.Comma() } + b.StripComma() + b.ArrEnd() b.Comma() b.StripComma() b.ObjEnd() @@ -5941,29 +5934,38 @@ func (u *UpdateChatMessageSender) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatMessageSender) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatDraftMessage) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatMessageSender#77705241 to nil") + return fmt.Errorf("can't decode updateChatDraftMessage#2bf257d4 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatMessageSender"); err != nil { - return fmt.Errorf("unable to decode updateChatMessageSender#77705241: %w", err) + if err := b.ConsumeID("updateChatDraftMessage"); err != nil { + return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatMessageSender#77705241: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: field chat_id: %w", err) } u.ChatID = value - case "message_sender_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode updateChatMessageSender#77705241: field message_sender_id: %w", err) + case "draft_message": + if err := u.DraftMessage.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: field draft_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 updateChatDraftMessage#2bf257d4: field positions: %w", err) + } + u.Positions = append(u.Positions, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: field positions: %w", err) } - u.MessageSenderID = value default: return b.Skip() } @@ -5972,53 +5974,61 @@ func (u *UpdateChatMessageSender) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetChatID returns value of ChatID field. -func (u *UpdateChatMessageSender) GetChatID() (value int64) { +func (u *UpdateChatDraftMessage) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetMessageSenderID returns value of MessageSenderID field. -func (u *UpdateChatMessageSender) GetMessageSenderID() (value MessageSenderClass) { +// GetDraftMessage returns value of DraftMessage field. +func (u *UpdateChatDraftMessage) GetDraftMessage() (value DraftMessage) { if u == nil { return } - return u.MessageSenderID + return u.DraftMessage } -// UpdateChatMessageAutoDeleteTime represents TL type `updateChatMessageAutoDeleteTime#71425de5`. -type UpdateChatMessageAutoDeleteTime struct { +// GetPositions returns value of Positions field. +func (u *UpdateChatDraftMessage) GetPositions() (value []ChatPosition) { + if u == nil { + return + } + return u.Positions +} + +// UpdateChatEmojiStatus represents TL type `updateChatEmojiStatus#77796510`. +type UpdateChatEmojiStatus struct { // Chat identifier ChatID int64 - // New value of message_auto_delete_time - MessageAutoDeleteTime int32 + // The new chat emoji status; may be null + EmojiStatus EmojiStatus } -// UpdateChatMessageAutoDeleteTimeTypeID is TL type id of UpdateChatMessageAutoDeleteTime. -const UpdateChatMessageAutoDeleteTimeTypeID = 0x71425de5 +// UpdateChatEmojiStatusTypeID is TL type id of UpdateChatEmojiStatus. +const UpdateChatEmojiStatusTypeID = 0x77796510 // construct implements constructor of UpdateClass. -func (u UpdateChatMessageAutoDeleteTime) construct() UpdateClass { return &u } +func (u UpdateChatEmojiStatus) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatMessageAutoDeleteTime. +// Ensuring interfaces in compile-time for UpdateChatEmojiStatus. var ( - _ bin.Encoder = &UpdateChatMessageAutoDeleteTime{} - _ bin.Decoder = &UpdateChatMessageAutoDeleteTime{} - _ bin.BareEncoder = &UpdateChatMessageAutoDeleteTime{} - _ bin.BareDecoder = &UpdateChatMessageAutoDeleteTime{} + _ bin.Encoder = &UpdateChatEmojiStatus{} + _ bin.Decoder = &UpdateChatEmojiStatus{} + _ bin.BareEncoder = &UpdateChatEmojiStatus{} + _ bin.BareDecoder = &UpdateChatEmojiStatus{} - _ UpdateClass = &UpdateChatMessageAutoDeleteTime{} + _ UpdateClass = &UpdateChatEmojiStatus{} ) -func (u *UpdateChatMessageAutoDeleteTime) Zero() bool { +func (u *UpdateChatEmojiStatus) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.MessageAutoDeleteTime == 0) { + if !(u.EmojiStatus.Zero()) { return false } @@ -6026,31 +6036,31 @@ func (u *UpdateChatMessageAutoDeleteTime) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatMessageAutoDeleteTime) String() string { +func (u *UpdateChatEmojiStatus) String() string { if u == nil { - return "UpdateChatMessageAutoDeleteTime(nil)" + return "UpdateChatEmojiStatus(nil)" } - type Alias UpdateChatMessageAutoDeleteTime - return fmt.Sprintf("UpdateChatMessageAutoDeleteTime%+v", Alias(*u)) + type Alias UpdateChatEmojiStatus + return fmt.Sprintf("UpdateChatEmojiStatus%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatMessageAutoDeleteTime) TypeID() uint32 { - return UpdateChatMessageAutoDeleteTimeTypeID +func (*UpdateChatEmojiStatus) TypeID() uint32 { + return UpdateChatEmojiStatusTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatMessageAutoDeleteTime) TypeName() string { - return "updateChatMessageAutoDeleteTime" +func (*UpdateChatEmojiStatus) TypeName() string { + return "updateChatEmojiStatus" } // TypeInfo returns info about TL type. -func (u *UpdateChatMessageAutoDeleteTime) TypeInfo() tdp.Type { +func (u *UpdateChatEmojiStatus) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatMessageAutoDeleteTime", - ID: UpdateChatMessageAutoDeleteTimeTypeID, + Name: "updateChatEmojiStatus", + ID: UpdateChatEmojiStatusTypeID, } if u == nil { typ.Null = true @@ -6062,78 +6072,80 @@ func (u *UpdateChatMessageAutoDeleteTime) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "MessageAutoDeleteTime", - SchemaName: "message_auto_delete_time", + Name: "EmojiStatus", + SchemaName: "emoji_status", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatMessageAutoDeleteTime) Encode(b *bin.Buffer) error { +func (u *UpdateChatEmojiStatus) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatMessageAutoDeleteTime#71425de5 as nil") + return fmt.Errorf("can't encode updateChatEmojiStatus#77796510 as nil") } - b.PutID(UpdateChatMessageAutoDeleteTimeTypeID) + b.PutID(UpdateChatEmojiStatusTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatMessageAutoDeleteTime) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatEmojiStatus) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatMessageAutoDeleteTime#71425de5 as nil") + return fmt.Errorf("can't encode updateChatEmojiStatus#77796510 as nil") } b.PutInt53(u.ChatID) - b.PutInt32(u.MessageAutoDeleteTime) + if err := u.EmojiStatus.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateChatEmojiStatus#77796510: field emoji_status: %w", err) + } return nil } // Decode implements bin.Decoder. -func (u *UpdateChatMessageAutoDeleteTime) Decode(b *bin.Buffer) error { +func (u *UpdateChatEmojiStatus) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatMessageAutoDeleteTime#71425de5 to nil") + return fmt.Errorf("can't decode updateChatEmojiStatus#77796510 to nil") } - if err := b.ConsumeID(UpdateChatMessageAutoDeleteTimeTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatMessageAutoDeleteTime#71425de5: %w", err) + if err := b.ConsumeID(UpdateChatEmojiStatusTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatEmojiStatus#77796510: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatMessageAutoDeleteTime) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatEmojiStatus) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatMessageAutoDeleteTime#71425de5 to nil") + return fmt.Errorf("can't decode updateChatEmojiStatus#77796510 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatMessageAutoDeleteTime#71425de5: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatEmojiStatus#77796510: field chat_id: %w", err) } u.ChatID = value } { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatMessageAutoDeleteTime#71425de5: field message_auto_delete_time: %w", err) + if err := u.EmojiStatus.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateChatEmojiStatus#77796510: field emoji_status: %w", err) } - u.MessageAutoDeleteTime = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatMessageAutoDeleteTime) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatEmojiStatus) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatMessageAutoDeleteTime#71425de5 as nil") + return fmt.Errorf("can't encode updateChatEmojiStatus#77796510 as nil") } b.ObjStart() - b.PutID("updateChatMessageAutoDeleteTime") + b.PutID("updateChatEmojiStatus") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("message_auto_delete_time") - b.PutInt32(u.MessageAutoDeleteTime) + b.FieldStart("emoji_status") + if err := u.EmojiStatus.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateChatEmojiStatus#77796510: field emoji_status: %w", err) + } b.Comma() b.StripComma() b.ObjEnd() @@ -6141,29 +6153,27 @@ func (u *UpdateChatMessageAutoDeleteTime) EncodeTDLibJSON(b tdjson.Encoder) erro } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatMessageAutoDeleteTime) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatEmojiStatus) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatMessageAutoDeleteTime#71425de5 to nil") + return fmt.Errorf("can't decode updateChatEmojiStatus#77796510 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatMessageAutoDeleteTime"); err != nil { - return fmt.Errorf("unable to decode updateChatMessageAutoDeleteTime#71425de5: %w", err) + if err := b.ConsumeID("updateChatEmojiStatus"); err != nil { + return fmt.Errorf("unable to decode updateChatEmojiStatus#77796510: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatMessageAutoDeleteTime#71425de5: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatEmojiStatus#77796510: field chat_id: %w", err) } u.ChatID = value - case "message_auto_delete_time": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatMessageAutoDeleteTime#71425de5: field message_auto_delete_time: %w", err) + case "emoji_status": + if err := u.EmojiStatus.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode updateChatEmojiStatus#77796510: field emoji_status: %w", err) } - u.MessageAutoDeleteTime = value default: return b.Skip() } @@ -6172,53 +6182,53 @@ func (u *UpdateChatMessageAutoDeleteTime) DecodeTDLibJSON(b tdjson.Decoder) erro } // GetChatID returns value of ChatID field. -func (u *UpdateChatMessageAutoDeleteTime) GetChatID() (value int64) { +func (u *UpdateChatEmojiStatus) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetMessageAutoDeleteTime returns value of MessageAutoDeleteTime field. -func (u *UpdateChatMessageAutoDeleteTime) GetMessageAutoDeleteTime() (value int32) { +// GetEmojiStatus returns value of EmojiStatus field. +func (u *UpdateChatEmojiStatus) GetEmojiStatus() (value EmojiStatus) { if u == nil { return } - return u.MessageAutoDeleteTime + return u.EmojiStatus } -// UpdateChatNotificationSettings represents TL type `updateChatNotificationSettings#d020b456`. -type UpdateChatNotificationSettings struct { +// UpdateChatMessageSender represents TL type `updateChatMessageSender#77705241`. +type UpdateChatMessageSender struct { // Chat identifier ChatID int64 - // The new notification settings - NotificationSettings ChatNotificationSettings + // New value of message_sender_id; may be null if the user can't change message sender + MessageSenderID MessageSenderClass } -// UpdateChatNotificationSettingsTypeID is TL type id of UpdateChatNotificationSettings. -const UpdateChatNotificationSettingsTypeID = 0xd020b456 +// UpdateChatMessageSenderTypeID is TL type id of UpdateChatMessageSender. +const UpdateChatMessageSenderTypeID = 0x77705241 // construct implements constructor of UpdateClass. -func (u UpdateChatNotificationSettings) construct() UpdateClass { return &u } +func (u UpdateChatMessageSender) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatNotificationSettings. +// Ensuring interfaces in compile-time for UpdateChatMessageSender. var ( - _ bin.Encoder = &UpdateChatNotificationSettings{} - _ bin.Decoder = &UpdateChatNotificationSettings{} - _ bin.BareEncoder = &UpdateChatNotificationSettings{} - _ bin.BareDecoder = &UpdateChatNotificationSettings{} + _ bin.Encoder = &UpdateChatMessageSender{} + _ bin.Decoder = &UpdateChatMessageSender{} + _ bin.BareEncoder = &UpdateChatMessageSender{} + _ bin.BareDecoder = &UpdateChatMessageSender{} - _ UpdateClass = &UpdateChatNotificationSettings{} + _ UpdateClass = &UpdateChatMessageSender{} ) -func (u *UpdateChatNotificationSettings) Zero() bool { +func (u *UpdateChatMessageSender) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.NotificationSettings.Zero()) { + if !(u.MessageSenderID == nil) { return false } @@ -6226,31 +6236,31 @@ func (u *UpdateChatNotificationSettings) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatNotificationSettings) String() string { +func (u *UpdateChatMessageSender) String() string { if u == nil { - return "UpdateChatNotificationSettings(nil)" + return "UpdateChatMessageSender(nil)" } - type Alias UpdateChatNotificationSettings - return fmt.Sprintf("UpdateChatNotificationSettings%+v", Alias(*u)) + type Alias UpdateChatMessageSender + return fmt.Sprintf("UpdateChatMessageSender%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatNotificationSettings) TypeID() uint32 { - return UpdateChatNotificationSettingsTypeID +func (*UpdateChatMessageSender) TypeID() uint32 { + return UpdateChatMessageSenderTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatNotificationSettings) TypeName() string { - return "updateChatNotificationSettings" +func (*UpdateChatMessageSender) TypeName() string { + return "updateChatMessageSender" } // TypeInfo returns info about TL type. -func (u *UpdateChatNotificationSettings) TypeInfo() tdp.Type { +func (u *UpdateChatMessageSender) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatNotificationSettings", - ID: UpdateChatNotificationSettingsTypeID, + Name: "updateChatMessageSender", + ID: UpdateChatMessageSenderTypeID, } if u == nil { typ.Null = true @@ -6262,79 +6272,87 @@ func (u *UpdateChatNotificationSettings) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "NotificationSettings", - SchemaName: "notification_settings", + Name: "MessageSenderID", + SchemaName: "message_sender_id", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatNotificationSettings) Encode(b *bin.Buffer) error { +func (u *UpdateChatMessageSender) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatNotificationSettings#d020b456 as nil") + return fmt.Errorf("can't encode updateChatMessageSender#77705241 as nil") } - b.PutID(UpdateChatNotificationSettingsTypeID) + b.PutID(UpdateChatMessageSenderTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatNotificationSettings) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatMessageSender) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatNotificationSettings#d020b456 as nil") + return fmt.Errorf("can't encode updateChatMessageSender#77705241 as nil") } b.PutInt53(u.ChatID) - if err := u.NotificationSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatNotificationSettings#d020b456: field notification_settings: %w", err) + if u.MessageSenderID == nil { + return fmt.Errorf("unable to encode updateChatMessageSender#77705241: field message_sender_id is nil") + } + if err := u.MessageSenderID.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateChatMessageSender#77705241: field message_sender_id: %w", err) } return nil } // Decode implements bin.Decoder. -func (u *UpdateChatNotificationSettings) Decode(b *bin.Buffer) error { +func (u *UpdateChatMessageSender) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatNotificationSettings#d020b456 to nil") + return fmt.Errorf("can't decode updateChatMessageSender#77705241 to nil") } - if err := b.ConsumeID(UpdateChatNotificationSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatNotificationSettings#d020b456: %w", err) + if err := b.ConsumeID(UpdateChatMessageSenderTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatMessageSender#77705241: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatNotificationSettings) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatMessageSender) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatNotificationSettings#d020b456 to nil") + return fmt.Errorf("can't decode updateChatMessageSender#77705241 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatNotificationSettings#d020b456: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatMessageSender#77705241: field chat_id: %w", err) } u.ChatID = value } { - if err := u.NotificationSettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatNotificationSettings#d020b456: field notification_settings: %w", err) + value, err := DecodeMessageSender(b) + if err != nil { + return fmt.Errorf("unable to decode updateChatMessageSender#77705241: field message_sender_id: %w", err) } + u.MessageSenderID = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatNotificationSettings) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatMessageSender) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatNotificationSettings#d020b456 as nil") + return fmt.Errorf("can't encode updateChatMessageSender#77705241 as nil") } b.ObjStart() - b.PutID("updateChatNotificationSettings") + b.PutID("updateChatMessageSender") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("notification_settings") - if err := u.NotificationSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatNotificationSettings#d020b456: field notification_settings: %w", err) + b.FieldStart("message_sender_id") + if u.MessageSenderID == nil { + return fmt.Errorf("unable to encode updateChatMessageSender#77705241: field message_sender_id is nil") + } + if err := u.MessageSenderID.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateChatMessageSender#77705241: field message_sender_id: %w", err) } b.Comma() b.StripComma() @@ -6343,27 +6361,29 @@ func (u *UpdateChatNotificationSettings) EncodeTDLibJSON(b tdjson.Encoder) error } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatNotificationSettings) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatMessageSender) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatNotificationSettings#d020b456 to nil") + return fmt.Errorf("can't decode updateChatMessageSender#77705241 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatNotificationSettings"); err != nil { - return fmt.Errorf("unable to decode updateChatNotificationSettings#d020b456: %w", err) + if err := b.ConsumeID("updateChatMessageSender"); err != nil { + return fmt.Errorf("unable to decode updateChatMessageSender#77705241: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatNotificationSettings#d020b456: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatMessageSender#77705241: field chat_id: %w", err) } u.ChatID = value - case "notification_settings": - if err := u.NotificationSettings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatNotificationSettings#d020b456: field notification_settings: %w", err) + case "message_sender_id": + value, err := DecodeTDLibJSONMessageSender(b) + if err != nil { + return fmt.Errorf("unable to decode updateChatMessageSender#77705241: field message_sender_id: %w", err) } + u.MessageSenderID = value default: return b.Skip() } @@ -6372,53 +6392,53 @@ func (u *UpdateChatNotificationSettings) DecodeTDLibJSON(b tdjson.Decoder) error } // GetChatID returns value of ChatID field. -func (u *UpdateChatNotificationSettings) GetChatID() (value int64) { +func (u *UpdateChatMessageSender) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetNotificationSettings returns value of NotificationSettings field. -func (u *UpdateChatNotificationSettings) GetNotificationSettings() (value ChatNotificationSettings) { +// GetMessageSenderID returns value of MessageSenderID field. +func (u *UpdateChatMessageSender) GetMessageSenderID() (value MessageSenderClass) { if u == nil { return } - return u.NotificationSettings + return u.MessageSenderID } -// UpdateChatPendingJoinRequests represents TL type `updateChatPendingJoinRequests#14c6e3e1`. -type UpdateChatPendingJoinRequests struct { +// UpdateChatMessageAutoDeleteTime represents TL type `updateChatMessageAutoDeleteTime#71425de5`. +type UpdateChatMessageAutoDeleteTime struct { // Chat identifier ChatID int64 - // The new data about pending join requests; may be null - PendingJoinRequests ChatJoinRequestsInfo + // New value of message_auto_delete_time + MessageAutoDeleteTime int32 } -// UpdateChatPendingJoinRequestsTypeID is TL type id of UpdateChatPendingJoinRequests. -const UpdateChatPendingJoinRequestsTypeID = 0x14c6e3e1 +// UpdateChatMessageAutoDeleteTimeTypeID is TL type id of UpdateChatMessageAutoDeleteTime. +const UpdateChatMessageAutoDeleteTimeTypeID = 0x71425de5 // construct implements constructor of UpdateClass. -func (u UpdateChatPendingJoinRequests) construct() UpdateClass { return &u } +func (u UpdateChatMessageAutoDeleteTime) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatPendingJoinRequests. +// Ensuring interfaces in compile-time for UpdateChatMessageAutoDeleteTime. var ( - _ bin.Encoder = &UpdateChatPendingJoinRequests{} - _ bin.Decoder = &UpdateChatPendingJoinRequests{} - _ bin.BareEncoder = &UpdateChatPendingJoinRequests{} - _ bin.BareDecoder = &UpdateChatPendingJoinRequests{} + _ bin.Encoder = &UpdateChatMessageAutoDeleteTime{} + _ bin.Decoder = &UpdateChatMessageAutoDeleteTime{} + _ bin.BareEncoder = &UpdateChatMessageAutoDeleteTime{} + _ bin.BareDecoder = &UpdateChatMessageAutoDeleteTime{} - _ UpdateClass = &UpdateChatPendingJoinRequests{} + _ UpdateClass = &UpdateChatMessageAutoDeleteTime{} ) -func (u *UpdateChatPendingJoinRequests) Zero() bool { +func (u *UpdateChatMessageAutoDeleteTime) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.PendingJoinRequests.Zero()) { + if !(u.MessageAutoDeleteTime == 0) { return false } @@ -6426,31 +6446,31 @@ func (u *UpdateChatPendingJoinRequests) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatPendingJoinRequests) String() string { +func (u *UpdateChatMessageAutoDeleteTime) String() string { if u == nil { - return "UpdateChatPendingJoinRequests(nil)" + return "UpdateChatMessageAutoDeleteTime(nil)" } - type Alias UpdateChatPendingJoinRequests - return fmt.Sprintf("UpdateChatPendingJoinRequests%+v", Alias(*u)) + type Alias UpdateChatMessageAutoDeleteTime + return fmt.Sprintf("UpdateChatMessageAutoDeleteTime%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatPendingJoinRequests) TypeID() uint32 { - return UpdateChatPendingJoinRequestsTypeID +func (*UpdateChatMessageAutoDeleteTime) TypeID() uint32 { + return UpdateChatMessageAutoDeleteTimeTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatPendingJoinRequests) TypeName() string { - return "updateChatPendingJoinRequests" +func (*UpdateChatMessageAutoDeleteTime) TypeName() string { + return "updateChatMessageAutoDeleteTime" } // TypeInfo returns info about TL type. -func (u *UpdateChatPendingJoinRequests) TypeInfo() tdp.Type { +func (u *UpdateChatMessageAutoDeleteTime) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatPendingJoinRequests", - ID: UpdateChatPendingJoinRequestsTypeID, + Name: "updateChatMessageAutoDeleteTime", + ID: UpdateChatMessageAutoDeleteTimeTypeID, } if u == nil { typ.Null = true @@ -6462,80 +6482,78 @@ func (u *UpdateChatPendingJoinRequests) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "PendingJoinRequests", - SchemaName: "pending_join_requests", + Name: "MessageAutoDeleteTime", + SchemaName: "message_auto_delete_time", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatPendingJoinRequests) Encode(b *bin.Buffer) error { +func (u *UpdateChatMessageAutoDeleteTime) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatPendingJoinRequests#14c6e3e1 as nil") + return fmt.Errorf("can't encode updateChatMessageAutoDeleteTime#71425de5 as nil") } - b.PutID(UpdateChatPendingJoinRequestsTypeID) + b.PutID(UpdateChatMessageAutoDeleteTimeTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatPendingJoinRequests) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatMessageAutoDeleteTime) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatPendingJoinRequests#14c6e3e1 as nil") + return fmt.Errorf("can't encode updateChatMessageAutoDeleteTime#71425de5 as nil") } b.PutInt53(u.ChatID) - if err := u.PendingJoinRequests.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatPendingJoinRequests#14c6e3e1: field pending_join_requests: %w", err) - } + b.PutInt32(u.MessageAutoDeleteTime) return nil } // Decode implements bin.Decoder. -func (u *UpdateChatPendingJoinRequests) Decode(b *bin.Buffer) error { +func (u *UpdateChatMessageAutoDeleteTime) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatPendingJoinRequests#14c6e3e1 to nil") + return fmt.Errorf("can't decode updateChatMessageAutoDeleteTime#71425de5 to nil") } - if err := b.ConsumeID(UpdateChatPendingJoinRequestsTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatPendingJoinRequests#14c6e3e1: %w", err) + if err := b.ConsumeID(UpdateChatMessageAutoDeleteTimeTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatMessageAutoDeleteTime#71425de5: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatPendingJoinRequests) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatMessageAutoDeleteTime) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatPendingJoinRequests#14c6e3e1 to nil") + return fmt.Errorf("can't decode updateChatMessageAutoDeleteTime#71425de5 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatPendingJoinRequests#14c6e3e1: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatMessageAutoDeleteTime#71425de5: field chat_id: %w", err) } u.ChatID = value } { - if err := u.PendingJoinRequests.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatPendingJoinRequests#14c6e3e1: field pending_join_requests: %w", err) + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateChatMessageAutoDeleteTime#71425de5: field message_auto_delete_time: %w", err) } + u.MessageAutoDeleteTime = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatPendingJoinRequests) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatMessageAutoDeleteTime) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatPendingJoinRequests#14c6e3e1 as nil") + return fmt.Errorf("can't encode updateChatMessageAutoDeleteTime#71425de5 as nil") } b.ObjStart() - b.PutID("updateChatPendingJoinRequests") + b.PutID("updateChatMessageAutoDeleteTime") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("pending_join_requests") - if err := u.PendingJoinRequests.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatPendingJoinRequests#14c6e3e1: field pending_join_requests: %w", err) - } + b.FieldStart("message_auto_delete_time") + b.PutInt32(u.MessageAutoDeleteTime) b.Comma() b.StripComma() b.ObjEnd() @@ -6543,27 +6561,29 @@ func (u *UpdateChatPendingJoinRequests) EncodeTDLibJSON(b tdjson.Encoder) error } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatPendingJoinRequests) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatMessageAutoDeleteTime) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatPendingJoinRequests#14c6e3e1 to nil") + return fmt.Errorf("can't decode updateChatMessageAutoDeleteTime#71425de5 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatPendingJoinRequests"); err != nil { - return fmt.Errorf("unable to decode updateChatPendingJoinRequests#14c6e3e1: %w", err) + if err := b.ConsumeID("updateChatMessageAutoDeleteTime"); err != nil { + return fmt.Errorf("unable to decode updateChatMessageAutoDeleteTime#71425de5: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatPendingJoinRequests#14c6e3e1: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatMessageAutoDeleteTime#71425de5: field chat_id: %w", err) } u.ChatID = value - case "pending_join_requests": - if err := u.PendingJoinRequests.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatPendingJoinRequests#14c6e3e1: field pending_join_requests: %w", err) + case "message_auto_delete_time": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateChatMessageAutoDeleteTime#71425de5: field message_auto_delete_time: %w", err) } + u.MessageAutoDeleteTime = value default: return b.Skip() } @@ -6572,54 +6592,53 @@ func (u *UpdateChatPendingJoinRequests) DecodeTDLibJSON(b tdjson.Decoder) error } // GetChatID returns value of ChatID field. -func (u *UpdateChatPendingJoinRequests) GetChatID() (value int64) { +func (u *UpdateChatMessageAutoDeleteTime) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetPendingJoinRequests returns value of PendingJoinRequests field. -func (u *UpdateChatPendingJoinRequests) GetPendingJoinRequests() (value ChatJoinRequestsInfo) { +// GetMessageAutoDeleteTime returns value of MessageAutoDeleteTime field. +func (u *UpdateChatMessageAutoDeleteTime) GetMessageAutoDeleteTime() (value int32) { if u == nil { return } - return u.PendingJoinRequests + return u.MessageAutoDeleteTime } -// UpdateChatReplyMarkup represents TL type `updateChatReplyMarkup#4e0ba5a0`. -type UpdateChatReplyMarkup struct { +// UpdateChatNotificationSettings represents TL type `updateChatNotificationSettings#d020b456`. +type UpdateChatNotificationSettings struct { // Chat identifier ChatID int64 - // Identifier of the message from which reply markup needs to be used; 0 if there is no - // default custom reply markup in the chat - ReplyMarkupMessageID int64 + // The new notification settings + NotificationSettings ChatNotificationSettings } -// UpdateChatReplyMarkupTypeID is TL type id of UpdateChatReplyMarkup. -const UpdateChatReplyMarkupTypeID = 0x4e0ba5a0 +// UpdateChatNotificationSettingsTypeID is TL type id of UpdateChatNotificationSettings. +const UpdateChatNotificationSettingsTypeID = 0xd020b456 // construct implements constructor of UpdateClass. -func (u UpdateChatReplyMarkup) construct() UpdateClass { return &u } +func (u UpdateChatNotificationSettings) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatReplyMarkup. +// Ensuring interfaces in compile-time for UpdateChatNotificationSettings. var ( - _ bin.Encoder = &UpdateChatReplyMarkup{} - _ bin.Decoder = &UpdateChatReplyMarkup{} - _ bin.BareEncoder = &UpdateChatReplyMarkup{} - _ bin.BareDecoder = &UpdateChatReplyMarkup{} + _ bin.Encoder = &UpdateChatNotificationSettings{} + _ bin.Decoder = &UpdateChatNotificationSettings{} + _ bin.BareEncoder = &UpdateChatNotificationSettings{} + _ bin.BareDecoder = &UpdateChatNotificationSettings{} - _ UpdateClass = &UpdateChatReplyMarkup{} + _ UpdateClass = &UpdateChatNotificationSettings{} ) -func (u *UpdateChatReplyMarkup) Zero() bool { +func (u *UpdateChatNotificationSettings) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.ReplyMarkupMessageID == 0) { + if !(u.NotificationSettings.Zero()) { return false } @@ -6627,31 +6646,31 @@ func (u *UpdateChatReplyMarkup) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatReplyMarkup) String() string { +func (u *UpdateChatNotificationSettings) String() string { if u == nil { - return "UpdateChatReplyMarkup(nil)" + return "UpdateChatNotificationSettings(nil)" } - type Alias UpdateChatReplyMarkup - return fmt.Sprintf("UpdateChatReplyMarkup%+v", Alias(*u)) + type Alias UpdateChatNotificationSettings + return fmt.Sprintf("UpdateChatNotificationSettings%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatReplyMarkup) TypeID() uint32 { - return UpdateChatReplyMarkupTypeID +func (*UpdateChatNotificationSettings) TypeID() uint32 { + return UpdateChatNotificationSettingsTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatReplyMarkup) TypeName() string { - return "updateChatReplyMarkup" +func (*UpdateChatNotificationSettings) TypeName() string { + return "updateChatNotificationSettings" } // TypeInfo returns info about TL type. -func (u *UpdateChatReplyMarkup) TypeInfo() tdp.Type { +func (u *UpdateChatNotificationSettings) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatReplyMarkup", - ID: UpdateChatReplyMarkupTypeID, + Name: "updateChatNotificationSettings", + ID: UpdateChatNotificationSettingsTypeID, } if u == nil { typ.Null = true @@ -6663,78 +6682,80 @@ func (u *UpdateChatReplyMarkup) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "ReplyMarkupMessageID", - SchemaName: "reply_markup_message_id", + Name: "NotificationSettings", + SchemaName: "notification_settings", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatReplyMarkup) Encode(b *bin.Buffer) error { +func (u *UpdateChatNotificationSettings) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatReplyMarkup#4e0ba5a0 as nil") + return fmt.Errorf("can't encode updateChatNotificationSettings#d020b456 as nil") } - b.PutID(UpdateChatReplyMarkupTypeID) + b.PutID(UpdateChatNotificationSettingsTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatReplyMarkup) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatNotificationSettings) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatReplyMarkup#4e0ba5a0 as nil") + return fmt.Errorf("can't encode updateChatNotificationSettings#d020b456 as nil") } b.PutInt53(u.ChatID) - b.PutInt53(u.ReplyMarkupMessageID) + if err := u.NotificationSettings.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateChatNotificationSettings#d020b456: field notification_settings: %w", err) + } return nil } // Decode implements bin.Decoder. -func (u *UpdateChatReplyMarkup) Decode(b *bin.Buffer) error { +func (u *UpdateChatNotificationSettings) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatReplyMarkup#4e0ba5a0 to nil") + return fmt.Errorf("can't decode updateChatNotificationSettings#d020b456 to nil") } - if err := b.ConsumeID(UpdateChatReplyMarkupTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatReplyMarkup#4e0ba5a0: %w", err) + if err := b.ConsumeID(UpdateChatNotificationSettingsTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatNotificationSettings#d020b456: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatReplyMarkup) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatNotificationSettings) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatReplyMarkup#4e0ba5a0 to nil") + return fmt.Errorf("can't decode updateChatNotificationSettings#d020b456 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatReplyMarkup#4e0ba5a0: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatNotificationSettings#d020b456: field chat_id: %w", err) } u.ChatID = value } { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatReplyMarkup#4e0ba5a0: field reply_markup_message_id: %w", err) + if err := u.NotificationSettings.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateChatNotificationSettings#d020b456: field notification_settings: %w", err) } - u.ReplyMarkupMessageID = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatReplyMarkup) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatNotificationSettings) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatReplyMarkup#4e0ba5a0 as nil") + return fmt.Errorf("can't encode updateChatNotificationSettings#d020b456 as nil") } b.ObjStart() - b.PutID("updateChatReplyMarkup") + b.PutID("updateChatNotificationSettings") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("reply_markup_message_id") - b.PutInt53(u.ReplyMarkupMessageID) + b.FieldStart("notification_settings") + if err := u.NotificationSettings.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateChatNotificationSettings#d020b456: field notification_settings: %w", err) + } b.Comma() b.StripComma() b.ObjEnd() @@ -6742,29 +6763,27 @@ func (u *UpdateChatReplyMarkup) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatReplyMarkup) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatNotificationSettings) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatReplyMarkup#4e0ba5a0 to nil") + return fmt.Errorf("can't decode updateChatNotificationSettings#d020b456 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatReplyMarkup"); err != nil { - return fmt.Errorf("unable to decode updateChatReplyMarkup#4e0ba5a0: %w", err) + if err := b.ConsumeID("updateChatNotificationSettings"); err != nil { + return fmt.Errorf("unable to decode updateChatNotificationSettings#d020b456: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatReplyMarkup#4e0ba5a0: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatNotificationSettings#d020b456: field chat_id: %w", err) } u.ChatID = value - case "reply_markup_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatReplyMarkup#4e0ba5a0: field reply_markup_message_id: %w", err) + case "notification_settings": + if err := u.NotificationSettings.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode updateChatNotificationSettings#d020b456: field notification_settings: %w", err) } - u.ReplyMarkupMessageID = value default: return b.Skip() } @@ -6773,53 +6792,53 @@ func (u *UpdateChatReplyMarkup) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetChatID returns value of ChatID field. -func (u *UpdateChatReplyMarkup) GetChatID() (value int64) { +func (u *UpdateChatNotificationSettings) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetReplyMarkupMessageID returns value of ReplyMarkupMessageID field. -func (u *UpdateChatReplyMarkup) GetReplyMarkupMessageID() (value int64) { +// GetNotificationSettings returns value of NotificationSettings field. +func (u *UpdateChatNotificationSettings) GetNotificationSettings() (value ChatNotificationSettings) { if u == nil { return } - return u.ReplyMarkupMessageID + return u.NotificationSettings } -// UpdateChatBackground represents TL type `updateChatBackground#ff9d38b3`. -type UpdateChatBackground struct { - // Chat identifier +// UpdateChatPendingJoinRequests represents TL type `updateChatPendingJoinRequests#14c6e3e1`. +type UpdateChatPendingJoinRequests struct { + // Chat identifier ChatID int64 - // The new chat background; may be null if background was reset to default - Background ChatBackground + // The new data about pending join requests; may be null + PendingJoinRequests ChatJoinRequestsInfo } -// UpdateChatBackgroundTypeID is TL type id of UpdateChatBackground. -const UpdateChatBackgroundTypeID = 0xff9d38b3 +// UpdateChatPendingJoinRequestsTypeID is TL type id of UpdateChatPendingJoinRequests. +const UpdateChatPendingJoinRequestsTypeID = 0x14c6e3e1 // construct implements constructor of UpdateClass. -func (u UpdateChatBackground) construct() UpdateClass { return &u } +func (u UpdateChatPendingJoinRequests) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatBackground. +// Ensuring interfaces in compile-time for UpdateChatPendingJoinRequests. var ( - _ bin.Encoder = &UpdateChatBackground{} - _ bin.Decoder = &UpdateChatBackground{} - _ bin.BareEncoder = &UpdateChatBackground{} - _ bin.BareDecoder = &UpdateChatBackground{} + _ bin.Encoder = &UpdateChatPendingJoinRequests{} + _ bin.Decoder = &UpdateChatPendingJoinRequests{} + _ bin.BareEncoder = &UpdateChatPendingJoinRequests{} + _ bin.BareDecoder = &UpdateChatPendingJoinRequests{} - _ UpdateClass = &UpdateChatBackground{} + _ UpdateClass = &UpdateChatPendingJoinRequests{} ) -func (u *UpdateChatBackground) Zero() bool { +func (u *UpdateChatPendingJoinRequests) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.Background.Zero()) { + if !(u.PendingJoinRequests.Zero()) { return false } @@ -6827,31 +6846,31 @@ func (u *UpdateChatBackground) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatBackground) String() string { +func (u *UpdateChatPendingJoinRequests) String() string { if u == nil { - return "UpdateChatBackground(nil)" + return "UpdateChatPendingJoinRequests(nil)" } - type Alias UpdateChatBackground - return fmt.Sprintf("UpdateChatBackground%+v", Alias(*u)) + type Alias UpdateChatPendingJoinRequests + return fmt.Sprintf("UpdateChatPendingJoinRequests%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatBackground) TypeID() uint32 { - return UpdateChatBackgroundTypeID +func (*UpdateChatPendingJoinRequests) TypeID() uint32 { + return UpdateChatPendingJoinRequestsTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatBackground) TypeName() string { - return "updateChatBackground" +func (*UpdateChatPendingJoinRequests) TypeName() string { + return "updateChatPendingJoinRequests" } // TypeInfo returns info about TL type. -func (u *UpdateChatBackground) TypeInfo() tdp.Type { +func (u *UpdateChatPendingJoinRequests) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatBackground", - ID: UpdateChatBackgroundTypeID, + Name: "updateChatPendingJoinRequests", + ID: UpdateChatPendingJoinRequestsTypeID, } if u == nil { typ.Null = true @@ -6863,79 +6882,79 @@ func (u *UpdateChatBackground) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "Background", - SchemaName: "background", + Name: "PendingJoinRequests", + SchemaName: "pending_join_requests", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatBackground) Encode(b *bin.Buffer) error { +func (u *UpdateChatPendingJoinRequests) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatBackground#ff9d38b3 as nil") + return fmt.Errorf("can't encode updateChatPendingJoinRequests#14c6e3e1 as nil") } - b.PutID(UpdateChatBackgroundTypeID) + b.PutID(UpdateChatPendingJoinRequestsTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatBackground) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatPendingJoinRequests) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatBackground#ff9d38b3 as nil") + return fmt.Errorf("can't encode updateChatPendingJoinRequests#14c6e3e1 as nil") } b.PutInt53(u.ChatID) - if err := u.Background.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatBackground#ff9d38b3: field background: %w", err) + if err := u.PendingJoinRequests.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateChatPendingJoinRequests#14c6e3e1: field pending_join_requests: %w", err) } return nil } // Decode implements bin.Decoder. -func (u *UpdateChatBackground) Decode(b *bin.Buffer) error { +func (u *UpdateChatPendingJoinRequests) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatBackground#ff9d38b3 to nil") + return fmt.Errorf("can't decode updateChatPendingJoinRequests#14c6e3e1 to nil") } - if err := b.ConsumeID(UpdateChatBackgroundTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatBackground#ff9d38b3: %w", err) + if err := b.ConsumeID(UpdateChatPendingJoinRequestsTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatPendingJoinRequests#14c6e3e1: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatBackground) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatPendingJoinRequests) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatBackground#ff9d38b3 to nil") + return fmt.Errorf("can't decode updateChatPendingJoinRequests#14c6e3e1 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatBackground#ff9d38b3: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatPendingJoinRequests#14c6e3e1: field chat_id: %w", err) } u.ChatID = value } { - if err := u.Background.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatBackground#ff9d38b3: field background: %w", err) + if err := u.PendingJoinRequests.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateChatPendingJoinRequests#14c6e3e1: field pending_join_requests: %w", err) } } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatBackground) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatPendingJoinRequests) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatBackground#ff9d38b3 as nil") + return fmt.Errorf("can't encode updateChatPendingJoinRequests#14c6e3e1 as nil") } b.ObjStart() - b.PutID("updateChatBackground") + b.PutID("updateChatPendingJoinRequests") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("background") - if err := u.Background.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatBackground#ff9d38b3: field background: %w", err) + b.FieldStart("pending_join_requests") + if err := u.PendingJoinRequests.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateChatPendingJoinRequests#14c6e3e1: field pending_join_requests: %w", err) } b.Comma() b.StripComma() @@ -6944,26 +6963,26 @@ func (u *UpdateChatBackground) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatBackground) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatPendingJoinRequests) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatBackground#ff9d38b3 to nil") + return fmt.Errorf("can't decode updateChatPendingJoinRequests#14c6e3e1 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatBackground"); err != nil { - return fmt.Errorf("unable to decode updateChatBackground#ff9d38b3: %w", err) + if err := b.ConsumeID("updateChatPendingJoinRequests"); err != nil { + return fmt.Errorf("unable to decode updateChatPendingJoinRequests#14c6e3e1: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatBackground#ff9d38b3: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatPendingJoinRequests#14c6e3e1: field chat_id: %w", err) } u.ChatID = value - case "background": - if err := u.Background.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatBackground#ff9d38b3: field background: %w", err) + case "pending_join_requests": + if err := u.PendingJoinRequests.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode updateChatPendingJoinRequests#14c6e3e1: field pending_join_requests: %w", err) } default: return b.Skip() @@ -6973,53 +6992,54 @@ func (u *UpdateChatBackground) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetChatID returns value of ChatID field. -func (u *UpdateChatBackground) GetChatID() (value int64) { +func (u *UpdateChatPendingJoinRequests) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetBackground returns value of Background field. -func (u *UpdateChatBackground) GetBackground() (value ChatBackground) { +// GetPendingJoinRequests returns value of PendingJoinRequests field. +func (u *UpdateChatPendingJoinRequests) GetPendingJoinRequests() (value ChatJoinRequestsInfo) { if u == nil { return } - return u.Background + return u.PendingJoinRequests } -// UpdateChatTheme represents TL type `updateChatTheme#31f3d465`. -type UpdateChatTheme struct { +// UpdateChatReplyMarkup represents TL type `updateChatReplyMarkup#4e0ba5a0`. +type UpdateChatReplyMarkup struct { // Chat identifier ChatID int64 - // The new name of the chat theme; may be empty if theme was reset to default - ThemeName string + // Identifier of the message from which reply markup needs to be used; 0 if there is no + // default custom reply markup in the chat + ReplyMarkupMessageID int64 } -// UpdateChatThemeTypeID is TL type id of UpdateChatTheme. -const UpdateChatThemeTypeID = 0x31f3d465 +// UpdateChatReplyMarkupTypeID is TL type id of UpdateChatReplyMarkup. +const UpdateChatReplyMarkupTypeID = 0x4e0ba5a0 // construct implements constructor of UpdateClass. -func (u UpdateChatTheme) construct() UpdateClass { return &u } +func (u UpdateChatReplyMarkup) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatTheme. +// Ensuring interfaces in compile-time for UpdateChatReplyMarkup. var ( - _ bin.Encoder = &UpdateChatTheme{} - _ bin.Decoder = &UpdateChatTheme{} - _ bin.BareEncoder = &UpdateChatTheme{} - _ bin.BareDecoder = &UpdateChatTheme{} + _ bin.Encoder = &UpdateChatReplyMarkup{} + _ bin.Decoder = &UpdateChatReplyMarkup{} + _ bin.BareEncoder = &UpdateChatReplyMarkup{} + _ bin.BareDecoder = &UpdateChatReplyMarkup{} - _ UpdateClass = &UpdateChatTheme{} + _ UpdateClass = &UpdateChatReplyMarkup{} ) -func (u *UpdateChatTheme) Zero() bool { +func (u *UpdateChatReplyMarkup) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.ThemeName == "") { + if !(u.ReplyMarkupMessageID == 0) { return false } @@ -7027,31 +7047,31 @@ func (u *UpdateChatTheme) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatTheme) String() string { +func (u *UpdateChatReplyMarkup) String() string { if u == nil { - return "UpdateChatTheme(nil)" + return "UpdateChatReplyMarkup(nil)" } - type Alias UpdateChatTheme - return fmt.Sprintf("UpdateChatTheme%+v", Alias(*u)) + type Alias UpdateChatReplyMarkup + return fmt.Sprintf("UpdateChatReplyMarkup%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatTheme) TypeID() uint32 { - return UpdateChatThemeTypeID +func (*UpdateChatReplyMarkup) TypeID() uint32 { + return UpdateChatReplyMarkupTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatTheme) TypeName() string { - return "updateChatTheme" +func (*UpdateChatReplyMarkup) TypeName() string { + return "updateChatReplyMarkup" } // TypeInfo returns info about TL type. -func (u *UpdateChatTheme) TypeInfo() tdp.Type { +func (u *UpdateChatReplyMarkup) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatTheme", - ID: UpdateChatThemeTypeID, + Name: "updateChatReplyMarkup", + ID: UpdateChatReplyMarkupTypeID, } if u == nil { typ.Null = true @@ -7063,78 +7083,78 @@ func (u *UpdateChatTheme) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "ThemeName", - SchemaName: "theme_name", + Name: "ReplyMarkupMessageID", + SchemaName: "reply_markup_message_id", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatTheme) Encode(b *bin.Buffer) error { +func (u *UpdateChatReplyMarkup) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatTheme#31f3d465 as nil") + return fmt.Errorf("can't encode updateChatReplyMarkup#4e0ba5a0 as nil") } - b.PutID(UpdateChatThemeTypeID) + b.PutID(UpdateChatReplyMarkupTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatTheme) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatReplyMarkup) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatTheme#31f3d465 as nil") + return fmt.Errorf("can't encode updateChatReplyMarkup#4e0ba5a0 as nil") } b.PutInt53(u.ChatID) - b.PutString(u.ThemeName) + b.PutInt53(u.ReplyMarkupMessageID) return nil } // Decode implements bin.Decoder. -func (u *UpdateChatTheme) Decode(b *bin.Buffer) error { +func (u *UpdateChatReplyMarkup) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatTheme#31f3d465 to nil") + return fmt.Errorf("can't decode updateChatReplyMarkup#4e0ba5a0 to nil") } - if err := b.ConsumeID(UpdateChatThemeTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatTheme#31f3d465: %w", err) + if err := b.ConsumeID(UpdateChatReplyMarkupTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatReplyMarkup#4e0ba5a0: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatTheme) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatReplyMarkup) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatTheme#31f3d465 to nil") + return fmt.Errorf("can't decode updateChatReplyMarkup#4e0ba5a0 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatTheme#31f3d465: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatReplyMarkup#4e0ba5a0: field chat_id: %w", err) } u.ChatID = value } { - value, err := b.String() + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatTheme#31f3d465: field theme_name: %w", err) + return fmt.Errorf("unable to decode updateChatReplyMarkup#4e0ba5a0: field reply_markup_message_id: %w", err) } - u.ThemeName = value + u.ReplyMarkupMessageID = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatTheme) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatReplyMarkup) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatTheme#31f3d465 as nil") + return fmt.Errorf("can't encode updateChatReplyMarkup#4e0ba5a0 as nil") } b.ObjStart() - b.PutID("updateChatTheme") + b.PutID("updateChatReplyMarkup") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("theme_name") - b.PutString(u.ThemeName) + b.FieldStart("reply_markup_message_id") + b.PutInt53(u.ReplyMarkupMessageID) b.Comma() b.StripComma() b.ObjEnd() @@ -7142,29 +7162,29 @@ func (u *UpdateChatTheme) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatTheme) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatReplyMarkup) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatTheme#31f3d465 to nil") + return fmt.Errorf("can't decode updateChatReplyMarkup#4e0ba5a0 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatTheme"); err != nil { - return fmt.Errorf("unable to decode updateChatTheme#31f3d465: %w", err) + if err := b.ConsumeID("updateChatReplyMarkup"); err != nil { + return fmt.Errorf("unable to decode updateChatReplyMarkup#4e0ba5a0: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatTheme#31f3d465: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatReplyMarkup#4e0ba5a0: field chat_id: %w", err) } u.ChatID = value - case "theme_name": - value, err := b.String() + case "reply_markup_message_id": + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatTheme#31f3d465: field theme_name: %w", err) + return fmt.Errorf("unable to decode updateChatReplyMarkup#4e0ba5a0: field reply_markup_message_id: %w", err) } - u.ThemeName = value + u.ReplyMarkupMessageID = value default: return b.Skip() } @@ -7173,53 +7193,53 @@ func (u *UpdateChatTheme) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetChatID returns value of ChatID field. -func (u *UpdateChatTheme) GetChatID() (value int64) { +func (u *UpdateChatReplyMarkup) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetThemeName returns value of ThemeName field. -func (u *UpdateChatTheme) GetThemeName() (value string) { +// GetReplyMarkupMessageID returns value of ReplyMarkupMessageID field. +func (u *UpdateChatReplyMarkup) GetReplyMarkupMessageID() (value int64) { if u == nil { return } - return u.ThemeName + return u.ReplyMarkupMessageID } -// UpdateChatUnreadMentionCount represents TL type `updateChatUnreadMentionCount#80f47b1c`. -type UpdateChatUnreadMentionCount struct { +// UpdateChatBackground represents TL type `updateChatBackground#ff9d38b3`. +type UpdateChatBackground struct { // Chat identifier ChatID int64 - // The number of unread mention messages left in the chat - UnreadMentionCount int32 + // The new chat background; may be null if background was reset to default + Background ChatBackground } -// UpdateChatUnreadMentionCountTypeID is TL type id of UpdateChatUnreadMentionCount. -const UpdateChatUnreadMentionCountTypeID = 0x80f47b1c +// UpdateChatBackgroundTypeID is TL type id of UpdateChatBackground. +const UpdateChatBackgroundTypeID = 0xff9d38b3 // construct implements constructor of UpdateClass. -func (u UpdateChatUnreadMentionCount) construct() UpdateClass { return &u } +func (u UpdateChatBackground) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatUnreadMentionCount. +// Ensuring interfaces in compile-time for UpdateChatBackground. var ( - _ bin.Encoder = &UpdateChatUnreadMentionCount{} - _ bin.Decoder = &UpdateChatUnreadMentionCount{} - _ bin.BareEncoder = &UpdateChatUnreadMentionCount{} - _ bin.BareDecoder = &UpdateChatUnreadMentionCount{} + _ bin.Encoder = &UpdateChatBackground{} + _ bin.Decoder = &UpdateChatBackground{} + _ bin.BareEncoder = &UpdateChatBackground{} + _ bin.BareDecoder = &UpdateChatBackground{} - _ UpdateClass = &UpdateChatUnreadMentionCount{} + _ UpdateClass = &UpdateChatBackground{} ) -func (u *UpdateChatUnreadMentionCount) Zero() bool { +func (u *UpdateChatBackground) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.UnreadMentionCount == 0) { + if !(u.Background.Zero()) { return false } @@ -7227,31 +7247,31 @@ func (u *UpdateChatUnreadMentionCount) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatUnreadMentionCount) String() string { +func (u *UpdateChatBackground) String() string { if u == nil { - return "UpdateChatUnreadMentionCount(nil)" + return "UpdateChatBackground(nil)" } - type Alias UpdateChatUnreadMentionCount - return fmt.Sprintf("UpdateChatUnreadMentionCount%+v", Alias(*u)) + type Alias UpdateChatBackground + return fmt.Sprintf("UpdateChatBackground%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatUnreadMentionCount) TypeID() uint32 { - return UpdateChatUnreadMentionCountTypeID +func (*UpdateChatBackground) TypeID() uint32 { + return UpdateChatBackgroundTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatUnreadMentionCount) TypeName() string { - return "updateChatUnreadMentionCount" +func (*UpdateChatBackground) TypeName() string { + return "updateChatBackground" } // TypeInfo returns info about TL type. -func (u *UpdateChatUnreadMentionCount) TypeInfo() tdp.Type { +func (u *UpdateChatBackground) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatUnreadMentionCount", - ID: UpdateChatUnreadMentionCountTypeID, + Name: "updateChatBackground", + ID: UpdateChatBackgroundTypeID, } if u == nil { typ.Null = true @@ -7263,78 +7283,80 @@ func (u *UpdateChatUnreadMentionCount) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "UnreadMentionCount", - SchemaName: "unread_mention_count", + Name: "Background", + SchemaName: "background", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatUnreadMentionCount) Encode(b *bin.Buffer) error { +func (u *UpdateChatBackground) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatUnreadMentionCount#80f47b1c as nil") + return fmt.Errorf("can't encode updateChatBackground#ff9d38b3 as nil") } - b.PutID(UpdateChatUnreadMentionCountTypeID) + b.PutID(UpdateChatBackgroundTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatUnreadMentionCount) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatBackground) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatUnreadMentionCount#80f47b1c as nil") + return fmt.Errorf("can't encode updateChatBackground#ff9d38b3 as nil") } b.PutInt53(u.ChatID) - b.PutInt32(u.UnreadMentionCount) + if err := u.Background.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateChatBackground#ff9d38b3: field background: %w", err) + } return nil } // Decode implements bin.Decoder. -func (u *UpdateChatUnreadMentionCount) Decode(b *bin.Buffer) error { +func (u *UpdateChatBackground) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatUnreadMentionCount#80f47b1c to nil") + return fmt.Errorf("can't decode updateChatBackground#ff9d38b3 to nil") } - if err := b.ConsumeID(UpdateChatUnreadMentionCountTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: %w", err) + if err := b.ConsumeID(UpdateChatBackgroundTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatBackground#ff9d38b3: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatUnreadMentionCount) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatBackground) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatUnreadMentionCount#80f47b1c to nil") + return fmt.Errorf("can't decode updateChatBackground#ff9d38b3 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatBackground#ff9d38b3: field chat_id: %w", err) } u.ChatID = value } { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: field unread_mention_count: %w", err) + if err := u.Background.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateChatBackground#ff9d38b3: field background: %w", err) } - u.UnreadMentionCount = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatUnreadMentionCount) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatBackground) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatUnreadMentionCount#80f47b1c as nil") + return fmt.Errorf("can't encode updateChatBackground#ff9d38b3 as nil") } b.ObjStart() - b.PutID("updateChatUnreadMentionCount") + b.PutID("updateChatBackground") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("unread_mention_count") - b.PutInt32(u.UnreadMentionCount) + b.FieldStart("background") + if err := u.Background.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateChatBackground#ff9d38b3: field background: %w", err) + } b.Comma() b.StripComma() b.ObjEnd() @@ -7342,29 +7364,27 @@ func (u *UpdateChatUnreadMentionCount) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatUnreadMentionCount) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatBackground) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatUnreadMentionCount#80f47b1c to nil") + return fmt.Errorf("can't decode updateChatBackground#ff9d38b3 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatUnreadMentionCount"); err != nil { - return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: %w", err) + if err := b.ConsumeID("updateChatBackground"); err != nil { + return fmt.Errorf("unable to decode updateChatBackground#ff9d38b3: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatBackground#ff9d38b3: field chat_id: %w", err) } u.ChatID = value - case "unread_mention_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: field unread_mention_count: %w", err) + case "background": + if err := u.Background.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode updateChatBackground#ff9d38b3: field background: %w", err) } - u.UnreadMentionCount = value default: return b.Skip() } @@ -7373,53 +7393,53 @@ func (u *UpdateChatUnreadMentionCount) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetChatID returns value of ChatID field. -func (u *UpdateChatUnreadMentionCount) GetChatID() (value int64) { +func (u *UpdateChatBackground) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetUnreadMentionCount returns value of UnreadMentionCount field. -func (u *UpdateChatUnreadMentionCount) GetUnreadMentionCount() (value int32) { +// GetBackground returns value of Background field. +func (u *UpdateChatBackground) GetBackground() (value ChatBackground) { if u == nil { return } - return u.UnreadMentionCount + return u.Background } -// UpdateChatUnreadReactionCount represents TL type `updateChatUnreadReactionCount#81603cdd`. -type UpdateChatUnreadReactionCount struct { +// UpdateChatTheme represents TL type `updateChatTheme#31f3d465`. +type UpdateChatTheme struct { // Chat identifier ChatID int64 - // The number of messages with unread reactions left in the chat - UnreadReactionCount int32 + // The new name of the chat theme; may be empty if theme was reset to default + ThemeName string } -// UpdateChatUnreadReactionCountTypeID is TL type id of UpdateChatUnreadReactionCount. -const UpdateChatUnreadReactionCountTypeID = 0x81603cdd +// UpdateChatThemeTypeID is TL type id of UpdateChatTheme. +const UpdateChatThemeTypeID = 0x31f3d465 // construct implements constructor of UpdateClass. -func (u UpdateChatUnreadReactionCount) construct() UpdateClass { return &u } +func (u UpdateChatTheme) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatUnreadReactionCount. +// Ensuring interfaces in compile-time for UpdateChatTheme. var ( - _ bin.Encoder = &UpdateChatUnreadReactionCount{} - _ bin.Decoder = &UpdateChatUnreadReactionCount{} - _ bin.BareEncoder = &UpdateChatUnreadReactionCount{} - _ bin.BareDecoder = &UpdateChatUnreadReactionCount{} + _ bin.Encoder = &UpdateChatTheme{} + _ bin.Decoder = &UpdateChatTheme{} + _ bin.BareEncoder = &UpdateChatTheme{} + _ bin.BareDecoder = &UpdateChatTheme{} - _ UpdateClass = &UpdateChatUnreadReactionCount{} + _ UpdateClass = &UpdateChatTheme{} ) -func (u *UpdateChatUnreadReactionCount) Zero() bool { +func (u *UpdateChatTheme) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.UnreadReactionCount == 0) { + if !(u.ThemeName == "") { return false } @@ -7427,31 +7447,31 @@ func (u *UpdateChatUnreadReactionCount) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatUnreadReactionCount) String() string { +func (u *UpdateChatTheme) String() string { if u == nil { - return "UpdateChatUnreadReactionCount(nil)" + return "UpdateChatTheme(nil)" } - type Alias UpdateChatUnreadReactionCount - return fmt.Sprintf("UpdateChatUnreadReactionCount%+v", Alias(*u)) + type Alias UpdateChatTheme + return fmt.Sprintf("UpdateChatTheme%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatUnreadReactionCount) TypeID() uint32 { - return UpdateChatUnreadReactionCountTypeID +func (*UpdateChatTheme) TypeID() uint32 { + return UpdateChatThemeTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatUnreadReactionCount) TypeName() string { - return "updateChatUnreadReactionCount" +func (*UpdateChatTheme) TypeName() string { + return "updateChatTheme" } // TypeInfo returns info about TL type. -func (u *UpdateChatUnreadReactionCount) TypeInfo() tdp.Type { +func (u *UpdateChatTheme) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatUnreadReactionCount", - ID: UpdateChatUnreadReactionCountTypeID, + Name: "updateChatTheme", + ID: UpdateChatThemeTypeID, } if u == nil { typ.Null = true @@ -7463,78 +7483,78 @@ func (u *UpdateChatUnreadReactionCount) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "UnreadReactionCount", - SchemaName: "unread_reaction_count", + Name: "ThemeName", + SchemaName: "theme_name", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatUnreadReactionCount) Encode(b *bin.Buffer) error { +func (u *UpdateChatTheme) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatUnreadReactionCount#81603cdd as nil") + return fmt.Errorf("can't encode updateChatTheme#31f3d465 as nil") } - b.PutID(UpdateChatUnreadReactionCountTypeID) + b.PutID(UpdateChatThemeTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatUnreadReactionCount) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatTheme) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatUnreadReactionCount#81603cdd as nil") + return fmt.Errorf("can't encode updateChatTheme#31f3d465 as nil") } b.PutInt53(u.ChatID) - b.PutInt32(u.UnreadReactionCount) + b.PutString(u.ThemeName) return nil } // Decode implements bin.Decoder. -func (u *UpdateChatUnreadReactionCount) Decode(b *bin.Buffer) error { +func (u *UpdateChatTheme) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatUnreadReactionCount#81603cdd to nil") + return fmt.Errorf("can't decode updateChatTheme#31f3d465 to nil") } - if err := b.ConsumeID(UpdateChatUnreadReactionCountTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: %w", err) + if err := b.ConsumeID(UpdateChatThemeTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatTheme#31f3d465: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatUnreadReactionCount) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatTheme) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatUnreadReactionCount#81603cdd to nil") + return fmt.Errorf("can't decode updateChatTheme#31f3d465 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatTheme#31f3d465: field chat_id: %w", err) } u.ChatID = value } { - value, err := b.Int32() + value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: field unread_reaction_count: %w", err) + return fmt.Errorf("unable to decode updateChatTheme#31f3d465: field theme_name: %w", err) } - u.UnreadReactionCount = value + u.ThemeName = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatUnreadReactionCount) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatTheme) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatUnreadReactionCount#81603cdd as nil") + return fmt.Errorf("can't encode updateChatTheme#31f3d465 as nil") } b.ObjStart() - b.PutID("updateChatUnreadReactionCount") + b.PutID("updateChatTheme") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("unread_reaction_count") - b.PutInt32(u.UnreadReactionCount) + b.FieldStart("theme_name") + b.PutString(u.ThemeName) b.Comma() b.StripComma() b.ObjEnd() @@ -7542,29 +7562,29 @@ func (u *UpdateChatUnreadReactionCount) EncodeTDLibJSON(b tdjson.Encoder) error } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatUnreadReactionCount) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatTheme) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatUnreadReactionCount#81603cdd to nil") + return fmt.Errorf("can't decode updateChatTheme#31f3d465 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatUnreadReactionCount"); err != nil { - return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: %w", err) + if err := b.ConsumeID("updateChatTheme"); err != nil { + return fmt.Errorf("unable to decode updateChatTheme#31f3d465: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatTheme#31f3d465: field chat_id: %w", err) } u.ChatID = value - case "unread_reaction_count": - value, err := b.Int32() + case "theme_name": + value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: field unread_reaction_count: %w", err) + return fmt.Errorf("unable to decode updateChatTheme#31f3d465: field theme_name: %w", err) } - u.UnreadReactionCount = value + u.ThemeName = value default: return b.Skip() } @@ -7573,53 +7593,53 @@ func (u *UpdateChatUnreadReactionCount) DecodeTDLibJSON(b tdjson.Decoder) error } // GetChatID returns value of ChatID field. -func (u *UpdateChatUnreadReactionCount) GetChatID() (value int64) { +func (u *UpdateChatTheme) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetUnreadReactionCount returns value of UnreadReactionCount field. -func (u *UpdateChatUnreadReactionCount) GetUnreadReactionCount() (value int32) { +// GetThemeName returns value of ThemeName field. +func (u *UpdateChatTheme) GetThemeName() (value string) { if u == nil { return } - return u.UnreadReactionCount + return u.ThemeName } -// UpdateChatVideoChat represents TL type `updateChatVideoChat#25fb4ca6`. -type UpdateChatVideoChat struct { +// UpdateChatUnreadMentionCount represents TL type `updateChatUnreadMentionCount#80f47b1c`. +type UpdateChatUnreadMentionCount struct { // Chat identifier ChatID int64 - // New value of video_chat - VideoChat VideoChat + // The number of unread mention messages left in the chat + UnreadMentionCount int32 } -// UpdateChatVideoChatTypeID is TL type id of UpdateChatVideoChat. -const UpdateChatVideoChatTypeID = 0x25fb4ca6 +// UpdateChatUnreadMentionCountTypeID is TL type id of UpdateChatUnreadMentionCount. +const UpdateChatUnreadMentionCountTypeID = 0x80f47b1c // construct implements constructor of UpdateClass. -func (u UpdateChatVideoChat) construct() UpdateClass { return &u } +func (u UpdateChatUnreadMentionCount) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatVideoChat. +// Ensuring interfaces in compile-time for UpdateChatUnreadMentionCount. var ( - _ bin.Encoder = &UpdateChatVideoChat{} - _ bin.Decoder = &UpdateChatVideoChat{} - _ bin.BareEncoder = &UpdateChatVideoChat{} - _ bin.BareDecoder = &UpdateChatVideoChat{} + _ bin.Encoder = &UpdateChatUnreadMentionCount{} + _ bin.Decoder = &UpdateChatUnreadMentionCount{} + _ bin.BareEncoder = &UpdateChatUnreadMentionCount{} + _ bin.BareDecoder = &UpdateChatUnreadMentionCount{} - _ UpdateClass = &UpdateChatVideoChat{} + _ UpdateClass = &UpdateChatUnreadMentionCount{} ) -func (u *UpdateChatVideoChat) Zero() bool { +func (u *UpdateChatUnreadMentionCount) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.VideoChat.Zero()) { + if !(u.UnreadMentionCount == 0) { return false } @@ -7627,31 +7647,31 @@ func (u *UpdateChatVideoChat) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatVideoChat) String() string { +func (u *UpdateChatUnreadMentionCount) String() string { if u == nil { - return "UpdateChatVideoChat(nil)" + return "UpdateChatUnreadMentionCount(nil)" } - type Alias UpdateChatVideoChat - return fmt.Sprintf("UpdateChatVideoChat%+v", Alias(*u)) + type Alias UpdateChatUnreadMentionCount + return fmt.Sprintf("UpdateChatUnreadMentionCount%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatVideoChat) TypeID() uint32 { - return UpdateChatVideoChatTypeID +func (*UpdateChatUnreadMentionCount) TypeID() uint32 { + return UpdateChatUnreadMentionCountTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatVideoChat) TypeName() string { - return "updateChatVideoChat" +func (*UpdateChatUnreadMentionCount) TypeName() string { + return "updateChatUnreadMentionCount" } // TypeInfo returns info about TL type. -func (u *UpdateChatVideoChat) TypeInfo() tdp.Type { +func (u *UpdateChatUnreadMentionCount) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatVideoChat", - ID: UpdateChatVideoChatTypeID, + Name: "updateChatUnreadMentionCount", + ID: UpdateChatUnreadMentionCountTypeID, } if u == nil { typ.Null = true @@ -7663,80 +7683,78 @@ func (u *UpdateChatVideoChat) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "VideoChat", - SchemaName: "video_chat", + Name: "UnreadMentionCount", + SchemaName: "unread_mention_count", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatVideoChat) Encode(b *bin.Buffer) error { +func (u *UpdateChatUnreadMentionCount) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatVideoChat#25fb4ca6 as nil") + return fmt.Errorf("can't encode updateChatUnreadMentionCount#80f47b1c as nil") } - b.PutID(UpdateChatVideoChatTypeID) + b.PutID(UpdateChatUnreadMentionCountTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatVideoChat) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatUnreadMentionCount) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatVideoChat#25fb4ca6 as nil") + return fmt.Errorf("can't encode updateChatUnreadMentionCount#80f47b1c as nil") } b.PutInt53(u.ChatID) - if err := u.VideoChat.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatVideoChat#25fb4ca6: field video_chat: %w", err) - } + b.PutInt32(u.UnreadMentionCount) return nil } // Decode implements bin.Decoder. -func (u *UpdateChatVideoChat) Decode(b *bin.Buffer) error { +func (u *UpdateChatUnreadMentionCount) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatVideoChat#25fb4ca6 to nil") + return fmt.Errorf("can't decode updateChatUnreadMentionCount#80f47b1c to nil") } - if err := b.ConsumeID(UpdateChatVideoChatTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatVideoChat#25fb4ca6: %w", err) + if err := b.ConsumeID(UpdateChatUnreadMentionCountTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatVideoChat) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatUnreadMentionCount) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatVideoChat#25fb4ca6 to nil") + return fmt.Errorf("can't decode updateChatUnreadMentionCount#80f47b1c to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatVideoChat#25fb4ca6: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: field chat_id: %w", err) } u.ChatID = value } { - if err := u.VideoChat.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatVideoChat#25fb4ca6: field video_chat: %w", err) + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: field unread_mention_count: %w", err) } + u.UnreadMentionCount = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatVideoChat) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatUnreadMentionCount) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatVideoChat#25fb4ca6 as nil") + return fmt.Errorf("can't encode updateChatUnreadMentionCount#80f47b1c as nil") } b.ObjStart() - b.PutID("updateChatVideoChat") + b.PutID("updateChatUnreadMentionCount") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("video_chat") - if err := u.VideoChat.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatVideoChat#25fb4ca6: field video_chat: %w", err) - } + b.FieldStart("unread_mention_count") + b.PutInt32(u.UnreadMentionCount) b.Comma() b.StripComma() b.ObjEnd() @@ -7744,27 +7762,29 @@ func (u *UpdateChatVideoChat) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatVideoChat) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatUnreadMentionCount) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatVideoChat#25fb4ca6 to nil") + return fmt.Errorf("can't decode updateChatUnreadMentionCount#80f47b1c to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatVideoChat"); err != nil { - return fmt.Errorf("unable to decode updateChatVideoChat#25fb4ca6: %w", err) + if err := b.ConsumeID("updateChatUnreadMentionCount"); err != nil { + return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatVideoChat#25fb4ca6: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: field chat_id: %w", err) } u.ChatID = value - case "video_chat": - if err := u.VideoChat.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatVideoChat#25fb4ca6: field video_chat: %w", err) + case "unread_mention_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: field unread_mention_count: %w", err) } + u.UnreadMentionCount = value default: return b.Skip() } @@ -7773,53 +7793,53 @@ func (u *UpdateChatVideoChat) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetChatID returns value of ChatID field. -func (u *UpdateChatVideoChat) GetChatID() (value int64) { +func (u *UpdateChatUnreadMentionCount) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetVideoChat returns value of VideoChat field. -func (u *UpdateChatVideoChat) GetVideoChat() (value VideoChat) { +// GetUnreadMentionCount returns value of UnreadMentionCount field. +func (u *UpdateChatUnreadMentionCount) GetUnreadMentionCount() (value int32) { if u == nil { return } - return u.VideoChat + return u.UnreadMentionCount } -// UpdateChatDefaultDisableNotification represents TL type `updateChatDefaultDisableNotification#1ba96a9b`. -type UpdateChatDefaultDisableNotification struct { +// UpdateChatUnreadReactionCount represents TL type `updateChatUnreadReactionCount#81603cdd`. +type UpdateChatUnreadReactionCount struct { // Chat identifier ChatID int64 - // The new default_disable_notification value - DefaultDisableNotification bool + // The number of messages with unread reactions left in the chat + UnreadReactionCount int32 } -// UpdateChatDefaultDisableNotificationTypeID is TL type id of UpdateChatDefaultDisableNotification. -const UpdateChatDefaultDisableNotificationTypeID = 0x1ba96a9b +// UpdateChatUnreadReactionCountTypeID is TL type id of UpdateChatUnreadReactionCount. +const UpdateChatUnreadReactionCountTypeID = 0x81603cdd // construct implements constructor of UpdateClass. -func (u UpdateChatDefaultDisableNotification) construct() UpdateClass { return &u } +func (u UpdateChatUnreadReactionCount) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatDefaultDisableNotification. +// Ensuring interfaces in compile-time for UpdateChatUnreadReactionCount. var ( - _ bin.Encoder = &UpdateChatDefaultDisableNotification{} - _ bin.Decoder = &UpdateChatDefaultDisableNotification{} - _ bin.BareEncoder = &UpdateChatDefaultDisableNotification{} - _ bin.BareDecoder = &UpdateChatDefaultDisableNotification{} + _ bin.Encoder = &UpdateChatUnreadReactionCount{} + _ bin.Decoder = &UpdateChatUnreadReactionCount{} + _ bin.BareEncoder = &UpdateChatUnreadReactionCount{} + _ bin.BareDecoder = &UpdateChatUnreadReactionCount{} - _ UpdateClass = &UpdateChatDefaultDisableNotification{} + _ UpdateClass = &UpdateChatUnreadReactionCount{} ) -func (u *UpdateChatDefaultDisableNotification) Zero() bool { +func (u *UpdateChatUnreadReactionCount) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.DefaultDisableNotification == false) { + if !(u.UnreadReactionCount == 0) { return false } @@ -7827,31 +7847,31 @@ func (u *UpdateChatDefaultDisableNotification) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatDefaultDisableNotification) String() string { +func (u *UpdateChatUnreadReactionCount) String() string { if u == nil { - return "UpdateChatDefaultDisableNotification(nil)" + return "UpdateChatUnreadReactionCount(nil)" } - type Alias UpdateChatDefaultDisableNotification - return fmt.Sprintf("UpdateChatDefaultDisableNotification%+v", Alias(*u)) + type Alias UpdateChatUnreadReactionCount + return fmt.Sprintf("UpdateChatUnreadReactionCount%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatDefaultDisableNotification) TypeID() uint32 { - return UpdateChatDefaultDisableNotificationTypeID +func (*UpdateChatUnreadReactionCount) TypeID() uint32 { + return UpdateChatUnreadReactionCountTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatDefaultDisableNotification) TypeName() string { - return "updateChatDefaultDisableNotification" +func (*UpdateChatUnreadReactionCount) TypeName() string { + return "updateChatUnreadReactionCount" } // TypeInfo returns info about TL type. -func (u *UpdateChatDefaultDisableNotification) TypeInfo() tdp.Type { +func (u *UpdateChatUnreadReactionCount) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatDefaultDisableNotification", - ID: UpdateChatDefaultDisableNotificationTypeID, + Name: "updateChatUnreadReactionCount", + ID: UpdateChatUnreadReactionCountTypeID, } if u == nil { typ.Null = true @@ -7863,78 +7883,78 @@ func (u *UpdateChatDefaultDisableNotification) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "DefaultDisableNotification", - SchemaName: "default_disable_notification", + Name: "UnreadReactionCount", + SchemaName: "unread_reaction_count", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatDefaultDisableNotification) Encode(b *bin.Buffer) error { +func (u *UpdateChatUnreadReactionCount) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatDefaultDisableNotification#1ba96a9b as nil") + return fmt.Errorf("can't encode updateChatUnreadReactionCount#81603cdd as nil") } - b.PutID(UpdateChatDefaultDisableNotificationTypeID) + b.PutID(UpdateChatUnreadReactionCountTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatDefaultDisableNotification) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatUnreadReactionCount) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatDefaultDisableNotification#1ba96a9b as nil") + return fmt.Errorf("can't encode updateChatUnreadReactionCount#81603cdd as nil") } b.PutInt53(u.ChatID) - b.PutBool(u.DefaultDisableNotification) + b.PutInt32(u.UnreadReactionCount) return nil } // Decode implements bin.Decoder. -func (u *UpdateChatDefaultDisableNotification) Decode(b *bin.Buffer) error { +func (u *UpdateChatUnreadReactionCount) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatDefaultDisableNotification#1ba96a9b to nil") + return fmt.Errorf("can't decode updateChatUnreadReactionCount#81603cdd to nil") } - if err := b.ConsumeID(UpdateChatDefaultDisableNotificationTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatDefaultDisableNotification#1ba96a9b: %w", err) + if err := b.ConsumeID(UpdateChatUnreadReactionCountTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatDefaultDisableNotification) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatUnreadReactionCount) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatDefaultDisableNotification#1ba96a9b to nil") + return fmt.Errorf("can't decode updateChatUnreadReactionCount#81603cdd to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatDefaultDisableNotification#1ba96a9b: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: field chat_id: %w", err) } u.ChatID = value } { - value, err := b.Bool() + value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode updateChatDefaultDisableNotification#1ba96a9b: field default_disable_notification: %w", err) + return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: field unread_reaction_count: %w", err) } - u.DefaultDisableNotification = value + u.UnreadReactionCount = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatDefaultDisableNotification) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatUnreadReactionCount) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatDefaultDisableNotification#1ba96a9b as nil") + return fmt.Errorf("can't encode updateChatUnreadReactionCount#81603cdd as nil") } b.ObjStart() - b.PutID("updateChatDefaultDisableNotification") + b.PutID("updateChatUnreadReactionCount") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("default_disable_notification") - b.PutBool(u.DefaultDisableNotification) + b.FieldStart("unread_reaction_count") + b.PutInt32(u.UnreadReactionCount) b.Comma() b.StripComma() b.ObjEnd() @@ -7942,29 +7962,29 @@ func (u *UpdateChatDefaultDisableNotification) EncodeTDLibJSON(b tdjson.Encoder) } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatDefaultDisableNotification) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatUnreadReactionCount) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatDefaultDisableNotification#1ba96a9b to nil") + return fmt.Errorf("can't decode updateChatUnreadReactionCount#81603cdd to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatDefaultDisableNotification"); err != nil { - return fmt.Errorf("unable to decode updateChatDefaultDisableNotification#1ba96a9b: %w", err) + if err := b.ConsumeID("updateChatUnreadReactionCount"); err != nil { + return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatDefaultDisableNotification#1ba96a9b: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: field chat_id: %w", err) } u.ChatID = value - case "default_disable_notification": - value, err := b.Bool() + case "unread_reaction_count": + value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode updateChatDefaultDisableNotification#1ba96a9b: field default_disable_notification: %w", err) + return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: field unread_reaction_count: %w", err) } - u.DefaultDisableNotification = value + u.UnreadReactionCount = value default: return b.Skip() } @@ -7973,53 +7993,53 @@ func (u *UpdateChatDefaultDisableNotification) DecodeTDLibJSON(b tdjson.Decoder) } // GetChatID returns value of ChatID field. -func (u *UpdateChatDefaultDisableNotification) GetChatID() (value int64) { +func (u *UpdateChatUnreadReactionCount) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetDefaultDisableNotification returns value of DefaultDisableNotification field. -func (u *UpdateChatDefaultDisableNotification) GetDefaultDisableNotification() (value bool) { +// GetUnreadReactionCount returns value of UnreadReactionCount field. +func (u *UpdateChatUnreadReactionCount) GetUnreadReactionCount() (value int32) { if u == nil { return } - return u.DefaultDisableNotification + return u.UnreadReactionCount } -// UpdateChatHasProtectedContent represents TL type `updateChatHasProtectedContent#6b50071b`. -type UpdateChatHasProtectedContent struct { +// UpdateChatVideoChat represents TL type `updateChatVideoChat#25fb4ca6`. +type UpdateChatVideoChat struct { // Chat identifier ChatID int64 - // New value of has_protected_content - HasProtectedContent bool + // New value of video_chat + VideoChat VideoChat } -// UpdateChatHasProtectedContentTypeID is TL type id of UpdateChatHasProtectedContent. -const UpdateChatHasProtectedContentTypeID = 0x6b50071b +// UpdateChatVideoChatTypeID is TL type id of UpdateChatVideoChat. +const UpdateChatVideoChatTypeID = 0x25fb4ca6 // construct implements constructor of UpdateClass. -func (u UpdateChatHasProtectedContent) construct() UpdateClass { return &u } +func (u UpdateChatVideoChat) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatHasProtectedContent. +// Ensuring interfaces in compile-time for UpdateChatVideoChat. var ( - _ bin.Encoder = &UpdateChatHasProtectedContent{} - _ bin.Decoder = &UpdateChatHasProtectedContent{} - _ bin.BareEncoder = &UpdateChatHasProtectedContent{} - _ bin.BareDecoder = &UpdateChatHasProtectedContent{} + _ bin.Encoder = &UpdateChatVideoChat{} + _ bin.Decoder = &UpdateChatVideoChat{} + _ bin.BareEncoder = &UpdateChatVideoChat{} + _ bin.BareDecoder = &UpdateChatVideoChat{} - _ UpdateClass = &UpdateChatHasProtectedContent{} + _ UpdateClass = &UpdateChatVideoChat{} ) -func (u *UpdateChatHasProtectedContent) Zero() bool { +func (u *UpdateChatVideoChat) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.HasProtectedContent == false) { + if !(u.VideoChat.Zero()) { return false } @@ -8027,31 +8047,31 @@ func (u *UpdateChatHasProtectedContent) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatHasProtectedContent) String() string { +func (u *UpdateChatVideoChat) String() string { if u == nil { - return "UpdateChatHasProtectedContent(nil)" + return "UpdateChatVideoChat(nil)" } - type Alias UpdateChatHasProtectedContent - return fmt.Sprintf("UpdateChatHasProtectedContent%+v", Alias(*u)) + type Alias UpdateChatVideoChat + return fmt.Sprintf("UpdateChatVideoChat%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatHasProtectedContent) TypeID() uint32 { - return UpdateChatHasProtectedContentTypeID +func (*UpdateChatVideoChat) TypeID() uint32 { + return UpdateChatVideoChatTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatHasProtectedContent) TypeName() string { - return "updateChatHasProtectedContent" +func (*UpdateChatVideoChat) TypeName() string { + return "updateChatVideoChat" } // TypeInfo returns info about TL type. -func (u *UpdateChatHasProtectedContent) TypeInfo() tdp.Type { +func (u *UpdateChatVideoChat) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatHasProtectedContent", - ID: UpdateChatHasProtectedContentTypeID, + Name: "updateChatVideoChat", + ID: UpdateChatVideoChatTypeID, } if u == nil { typ.Null = true @@ -8063,78 +8083,80 @@ func (u *UpdateChatHasProtectedContent) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "HasProtectedContent", - SchemaName: "has_protected_content", + Name: "VideoChat", + SchemaName: "video_chat", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatHasProtectedContent) Encode(b *bin.Buffer) error { +func (u *UpdateChatVideoChat) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatHasProtectedContent#6b50071b as nil") + return fmt.Errorf("can't encode updateChatVideoChat#25fb4ca6 as nil") } - b.PutID(UpdateChatHasProtectedContentTypeID) + b.PutID(UpdateChatVideoChatTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatHasProtectedContent) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatVideoChat) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatHasProtectedContent#6b50071b as nil") + return fmt.Errorf("can't encode updateChatVideoChat#25fb4ca6 as nil") } b.PutInt53(u.ChatID) - b.PutBool(u.HasProtectedContent) + if err := u.VideoChat.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateChatVideoChat#25fb4ca6: field video_chat: %w", err) + } return nil } // Decode implements bin.Decoder. -func (u *UpdateChatHasProtectedContent) Decode(b *bin.Buffer) error { +func (u *UpdateChatVideoChat) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatHasProtectedContent#6b50071b to nil") + return fmt.Errorf("can't decode updateChatVideoChat#25fb4ca6 to nil") } - if err := b.ConsumeID(UpdateChatHasProtectedContentTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatHasProtectedContent#6b50071b: %w", err) + if err := b.ConsumeID(UpdateChatVideoChatTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatVideoChat#25fb4ca6: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatHasProtectedContent) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatVideoChat) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatHasProtectedContent#6b50071b to nil") + return fmt.Errorf("can't decode updateChatVideoChat#25fb4ca6 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatHasProtectedContent#6b50071b: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatVideoChat#25fb4ca6: field chat_id: %w", err) } u.ChatID = value } { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateChatHasProtectedContent#6b50071b: field has_protected_content: %w", err) + if err := u.VideoChat.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateChatVideoChat#25fb4ca6: field video_chat: %w", err) } - u.HasProtectedContent = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatHasProtectedContent) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatVideoChat) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatHasProtectedContent#6b50071b as nil") + return fmt.Errorf("can't encode updateChatVideoChat#25fb4ca6 as nil") } b.ObjStart() - b.PutID("updateChatHasProtectedContent") + b.PutID("updateChatVideoChat") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("has_protected_content") - b.PutBool(u.HasProtectedContent) + b.FieldStart("video_chat") + if err := u.VideoChat.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateChatVideoChat#25fb4ca6: field video_chat: %w", err) + } b.Comma() b.StripComma() b.ObjEnd() @@ -8142,29 +8164,27 @@ func (u *UpdateChatHasProtectedContent) EncodeTDLibJSON(b tdjson.Encoder) error } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatHasProtectedContent) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatVideoChat) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatHasProtectedContent#6b50071b to nil") + return fmt.Errorf("can't decode updateChatVideoChat#25fb4ca6 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatHasProtectedContent"); err != nil { - return fmt.Errorf("unable to decode updateChatHasProtectedContent#6b50071b: %w", err) + if err := b.ConsumeID("updateChatVideoChat"); err != nil { + return fmt.Errorf("unable to decode updateChatVideoChat#25fb4ca6: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatHasProtectedContent#6b50071b: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatVideoChat#25fb4ca6: field chat_id: %w", err) } u.ChatID = value - case "has_protected_content": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateChatHasProtectedContent#6b50071b: field has_protected_content: %w", err) + case "video_chat": + if err := u.VideoChat.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode updateChatVideoChat#25fb4ca6: field video_chat: %w", err) } - u.HasProtectedContent = value default: return b.Skip() } @@ -8173,53 +8193,53 @@ func (u *UpdateChatHasProtectedContent) DecodeTDLibJSON(b tdjson.Decoder) error } // GetChatID returns value of ChatID field. -func (u *UpdateChatHasProtectedContent) GetChatID() (value int64) { +func (u *UpdateChatVideoChat) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetHasProtectedContent returns value of HasProtectedContent field. -func (u *UpdateChatHasProtectedContent) GetHasProtectedContent() (value bool) { +// GetVideoChat returns value of VideoChat field. +func (u *UpdateChatVideoChat) GetVideoChat() (value VideoChat) { if u == nil { return } - return u.HasProtectedContent + return u.VideoChat } -// UpdateChatIsTranslatable represents TL type `updateChatIsTranslatable#7b031617`. -type UpdateChatIsTranslatable struct { +// UpdateChatDefaultDisableNotification represents TL type `updateChatDefaultDisableNotification#1ba96a9b`. +type UpdateChatDefaultDisableNotification struct { // Chat identifier ChatID int64 - // New value of is_translatable - IsTranslatable bool + // The new default_disable_notification value + DefaultDisableNotification bool } -// UpdateChatIsTranslatableTypeID is TL type id of UpdateChatIsTranslatable. -const UpdateChatIsTranslatableTypeID = 0x7b031617 +// UpdateChatDefaultDisableNotificationTypeID is TL type id of UpdateChatDefaultDisableNotification. +const UpdateChatDefaultDisableNotificationTypeID = 0x1ba96a9b // construct implements constructor of UpdateClass. -func (u UpdateChatIsTranslatable) construct() UpdateClass { return &u } +func (u UpdateChatDefaultDisableNotification) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatIsTranslatable. +// Ensuring interfaces in compile-time for UpdateChatDefaultDisableNotification. var ( - _ bin.Encoder = &UpdateChatIsTranslatable{} - _ bin.Decoder = &UpdateChatIsTranslatable{} - _ bin.BareEncoder = &UpdateChatIsTranslatable{} - _ bin.BareDecoder = &UpdateChatIsTranslatable{} + _ bin.Encoder = &UpdateChatDefaultDisableNotification{} + _ bin.Decoder = &UpdateChatDefaultDisableNotification{} + _ bin.BareEncoder = &UpdateChatDefaultDisableNotification{} + _ bin.BareDecoder = &UpdateChatDefaultDisableNotification{} - _ UpdateClass = &UpdateChatIsTranslatable{} + _ UpdateClass = &UpdateChatDefaultDisableNotification{} ) -func (u *UpdateChatIsTranslatable) Zero() bool { +func (u *UpdateChatDefaultDisableNotification) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.IsTranslatable == false) { + if !(u.DefaultDisableNotification == false) { return false } @@ -8227,31 +8247,31 @@ func (u *UpdateChatIsTranslatable) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatIsTranslatable) String() string { +func (u *UpdateChatDefaultDisableNotification) String() string { if u == nil { - return "UpdateChatIsTranslatable(nil)" + return "UpdateChatDefaultDisableNotification(nil)" } - type Alias UpdateChatIsTranslatable - return fmt.Sprintf("UpdateChatIsTranslatable%+v", Alias(*u)) + type Alias UpdateChatDefaultDisableNotification + return fmt.Sprintf("UpdateChatDefaultDisableNotification%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatIsTranslatable) TypeID() uint32 { - return UpdateChatIsTranslatableTypeID +func (*UpdateChatDefaultDisableNotification) TypeID() uint32 { + return UpdateChatDefaultDisableNotificationTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatIsTranslatable) TypeName() string { - return "updateChatIsTranslatable" +func (*UpdateChatDefaultDisableNotification) TypeName() string { + return "updateChatDefaultDisableNotification" } // TypeInfo returns info about TL type. -func (u *UpdateChatIsTranslatable) TypeInfo() tdp.Type { +func (u *UpdateChatDefaultDisableNotification) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatIsTranslatable", - ID: UpdateChatIsTranslatableTypeID, + Name: "updateChatDefaultDisableNotification", + ID: UpdateChatDefaultDisableNotificationTypeID, } if u == nil { typ.Null = true @@ -8263,78 +8283,78 @@ func (u *UpdateChatIsTranslatable) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "IsTranslatable", - SchemaName: "is_translatable", + Name: "DefaultDisableNotification", + SchemaName: "default_disable_notification", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatIsTranslatable) Encode(b *bin.Buffer) error { +func (u *UpdateChatDefaultDisableNotification) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatIsTranslatable#7b031617 as nil") + return fmt.Errorf("can't encode updateChatDefaultDisableNotification#1ba96a9b as nil") } - b.PutID(UpdateChatIsTranslatableTypeID) + b.PutID(UpdateChatDefaultDisableNotificationTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatIsTranslatable) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatDefaultDisableNotification) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatIsTranslatable#7b031617 as nil") + return fmt.Errorf("can't encode updateChatDefaultDisableNotification#1ba96a9b as nil") } b.PutInt53(u.ChatID) - b.PutBool(u.IsTranslatable) + b.PutBool(u.DefaultDisableNotification) return nil } // Decode implements bin.Decoder. -func (u *UpdateChatIsTranslatable) Decode(b *bin.Buffer) error { +func (u *UpdateChatDefaultDisableNotification) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatIsTranslatable#7b031617 to nil") + return fmt.Errorf("can't decode updateChatDefaultDisableNotification#1ba96a9b to nil") } - if err := b.ConsumeID(UpdateChatIsTranslatableTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatIsTranslatable#7b031617: %w", err) + if err := b.ConsumeID(UpdateChatDefaultDisableNotificationTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatDefaultDisableNotification#1ba96a9b: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatIsTranslatable) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatDefaultDisableNotification) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatIsTranslatable#7b031617 to nil") + return fmt.Errorf("can't decode updateChatDefaultDisableNotification#1ba96a9b to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatIsTranslatable#7b031617: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatDefaultDisableNotification#1ba96a9b: field chat_id: %w", err) } u.ChatID = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode updateChatIsTranslatable#7b031617: field is_translatable: %w", err) + return fmt.Errorf("unable to decode updateChatDefaultDisableNotification#1ba96a9b: field default_disable_notification: %w", err) } - u.IsTranslatable = value + u.DefaultDisableNotification = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatIsTranslatable) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatDefaultDisableNotification) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatIsTranslatable#7b031617 as nil") + return fmt.Errorf("can't encode updateChatDefaultDisableNotification#1ba96a9b as nil") } b.ObjStart() - b.PutID("updateChatIsTranslatable") + b.PutID("updateChatDefaultDisableNotification") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("is_translatable") - b.PutBool(u.IsTranslatable) + b.FieldStart("default_disable_notification") + b.PutBool(u.DefaultDisableNotification) b.Comma() b.StripComma() b.ObjEnd() @@ -8342,29 +8362,29 @@ func (u *UpdateChatIsTranslatable) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatIsTranslatable) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatDefaultDisableNotification) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatIsTranslatable#7b031617 to nil") + return fmt.Errorf("can't decode updateChatDefaultDisableNotification#1ba96a9b to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatIsTranslatable"); err != nil { - return fmt.Errorf("unable to decode updateChatIsTranslatable#7b031617: %w", err) + if err := b.ConsumeID("updateChatDefaultDisableNotification"); err != nil { + return fmt.Errorf("unable to decode updateChatDefaultDisableNotification#1ba96a9b: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatIsTranslatable#7b031617: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatDefaultDisableNotification#1ba96a9b: field chat_id: %w", err) } u.ChatID = value - case "is_translatable": + case "default_disable_notification": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode updateChatIsTranslatable#7b031617: field is_translatable: %w", err) + return fmt.Errorf("unable to decode updateChatDefaultDisableNotification#1ba96a9b: field default_disable_notification: %w", err) } - u.IsTranslatable = value + u.DefaultDisableNotification = value default: return b.Skip() } @@ -8373,53 +8393,53 @@ func (u *UpdateChatIsTranslatable) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetChatID returns value of ChatID field. -func (u *UpdateChatIsTranslatable) GetChatID() (value int64) { +func (u *UpdateChatDefaultDisableNotification) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetIsTranslatable returns value of IsTranslatable field. -func (u *UpdateChatIsTranslatable) GetIsTranslatable() (value bool) { +// GetDefaultDisableNotification returns value of DefaultDisableNotification field. +func (u *UpdateChatDefaultDisableNotification) GetDefaultDisableNotification() (value bool) { if u == nil { return } - return u.IsTranslatable + return u.DefaultDisableNotification } -// UpdateChatIsMarkedAsUnread represents TL type `updateChatIsMarkedAsUnread#57853334`. -type UpdateChatIsMarkedAsUnread struct { +// UpdateChatHasProtectedContent represents TL type `updateChatHasProtectedContent#6b50071b`. +type UpdateChatHasProtectedContent struct { // Chat identifier ChatID int64 - // New value of is_marked_as_unread - IsMarkedAsUnread bool + // New value of has_protected_content + HasProtectedContent bool } -// UpdateChatIsMarkedAsUnreadTypeID is TL type id of UpdateChatIsMarkedAsUnread. -const UpdateChatIsMarkedAsUnreadTypeID = 0x57853334 +// UpdateChatHasProtectedContentTypeID is TL type id of UpdateChatHasProtectedContent. +const UpdateChatHasProtectedContentTypeID = 0x6b50071b // construct implements constructor of UpdateClass. -func (u UpdateChatIsMarkedAsUnread) construct() UpdateClass { return &u } +func (u UpdateChatHasProtectedContent) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatIsMarkedAsUnread. +// Ensuring interfaces in compile-time for UpdateChatHasProtectedContent. var ( - _ bin.Encoder = &UpdateChatIsMarkedAsUnread{} - _ bin.Decoder = &UpdateChatIsMarkedAsUnread{} - _ bin.BareEncoder = &UpdateChatIsMarkedAsUnread{} - _ bin.BareDecoder = &UpdateChatIsMarkedAsUnread{} + _ bin.Encoder = &UpdateChatHasProtectedContent{} + _ bin.Decoder = &UpdateChatHasProtectedContent{} + _ bin.BareEncoder = &UpdateChatHasProtectedContent{} + _ bin.BareDecoder = &UpdateChatHasProtectedContent{} - _ UpdateClass = &UpdateChatIsMarkedAsUnread{} + _ UpdateClass = &UpdateChatHasProtectedContent{} ) -func (u *UpdateChatIsMarkedAsUnread) Zero() bool { +func (u *UpdateChatHasProtectedContent) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.IsMarkedAsUnread == false) { + if !(u.HasProtectedContent == false) { return false } @@ -8427,31 +8447,31 @@ func (u *UpdateChatIsMarkedAsUnread) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatIsMarkedAsUnread) String() string { +func (u *UpdateChatHasProtectedContent) String() string { if u == nil { - return "UpdateChatIsMarkedAsUnread(nil)" + return "UpdateChatHasProtectedContent(nil)" } - type Alias UpdateChatIsMarkedAsUnread - return fmt.Sprintf("UpdateChatIsMarkedAsUnread%+v", Alias(*u)) + type Alias UpdateChatHasProtectedContent + return fmt.Sprintf("UpdateChatHasProtectedContent%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatIsMarkedAsUnread) TypeID() uint32 { - return UpdateChatIsMarkedAsUnreadTypeID +func (*UpdateChatHasProtectedContent) TypeID() uint32 { + return UpdateChatHasProtectedContentTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatIsMarkedAsUnread) TypeName() string { - return "updateChatIsMarkedAsUnread" +func (*UpdateChatHasProtectedContent) TypeName() string { + return "updateChatHasProtectedContent" } // TypeInfo returns info about TL type. -func (u *UpdateChatIsMarkedAsUnread) TypeInfo() tdp.Type { +func (u *UpdateChatHasProtectedContent) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatIsMarkedAsUnread", - ID: UpdateChatIsMarkedAsUnreadTypeID, + Name: "updateChatHasProtectedContent", + ID: UpdateChatHasProtectedContentTypeID, } if u == nil { typ.Null = true @@ -8463,78 +8483,78 @@ func (u *UpdateChatIsMarkedAsUnread) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "IsMarkedAsUnread", - SchemaName: "is_marked_as_unread", + Name: "HasProtectedContent", + SchemaName: "has_protected_content", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatIsMarkedAsUnread) Encode(b *bin.Buffer) error { +func (u *UpdateChatHasProtectedContent) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatIsMarkedAsUnread#57853334 as nil") + return fmt.Errorf("can't encode updateChatHasProtectedContent#6b50071b as nil") } - b.PutID(UpdateChatIsMarkedAsUnreadTypeID) + b.PutID(UpdateChatHasProtectedContentTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatIsMarkedAsUnread) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatHasProtectedContent) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatIsMarkedAsUnread#57853334 as nil") + return fmt.Errorf("can't encode updateChatHasProtectedContent#6b50071b as nil") } b.PutInt53(u.ChatID) - b.PutBool(u.IsMarkedAsUnread) + b.PutBool(u.HasProtectedContent) return nil } // Decode implements bin.Decoder. -func (u *UpdateChatIsMarkedAsUnread) Decode(b *bin.Buffer) error { +func (u *UpdateChatHasProtectedContent) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatIsMarkedAsUnread#57853334 to nil") + return fmt.Errorf("can't decode updateChatHasProtectedContent#6b50071b to nil") } - if err := b.ConsumeID(UpdateChatIsMarkedAsUnreadTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatIsMarkedAsUnread#57853334: %w", err) + if err := b.ConsumeID(UpdateChatHasProtectedContentTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatHasProtectedContent#6b50071b: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatIsMarkedAsUnread) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatHasProtectedContent) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatIsMarkedAsUnread#57853334 to nil") + return fmt.Errorf("can't decode updateChatHasProtectedContent#6b50071b to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatIsMarkedAsUnread#57853334: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatHasProtectedContent#6b50071b: field chat_id: %w", err) } u.ChatID = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode updateChatIsMarkedAsUnread#57853334: field is_marked_as_unread: %w", err) + return fmt.Errorf("unable to decode updateChatHasProtectedContent#6b50071b: field has_protected_content: %w", err) } - u.IsMarkedAsUnread = value + u.HasProtectedContent = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatIsMarkedAsUnread) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatHasProtectedContent) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatIsMarkedAsUnread#57853334 as nil") + return fmt.Errorf("can't encode updateChatHasProtectedContent#6b50071b as nil") } b.ObjStart() - b.PutID("updateChatIsMarkedAsUnread") + b.PutID("updateChatHasProtectedContent") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("is_marked_as_unread") - b.PutBool(u.IsMarkedAsUnread) + b.FieldStart("has_protected_content") + b.PutBool(u.HasProtectedContent) b.Comma() b.StripComma() b.ObjEnd() @@ -8542,29 +8562,29 @@ func (u *UpdateChatIsMarkedAsUnread) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatIsMarkedAsUnread) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatHasProtectedContent) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatIsMarkedAsUnread#57853334 to nil") + return fmt.Errorf("can't decode updateChatHasProtectedContent#6b50071b to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatIsMarkedAsUnread"); err != nil { - return fmt.Errorf("unable to decode updateChatIsMarkedAsUnread#57853334: %w", err) + if err := b.ConsumeID("updateChatHasProtectedContent"); err != nil { + return fmt.Errorf("unable to decode updateChatHasProtectedContent#6b50071b: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatIsMarkedAsUnread#57853334: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatHasProtectedContent#6b50071b: field chat_id: %w", err) } u.ChatID = value - case "is_marked_as_unread": + case "has_protected_content": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode updateChatIsMarkedAsUnread#57853334: field is_marked_as_unread: %w", err) + return fmt.Errorf("unable to decode updateChatHasProtectedContent#6b50071b: field has_protected_content: %w", err) } - u.IsMarkedAsUnread = value + u.HasProtectedContent = value default: return b.Skip() } @@ -8573,53 +8593,53 @@ func (u *UpdateChatIsMarkedAsUnread) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetChatID returns value of ChatID field. -func (u *UpdateChatIsMarkedAsUnread) GetChatID() (value int64) { +func (u *UpdateChatHasProtectedContent) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetIsMarkedAsUnread returns value of IsMarkedAsUnread field. -func (u *UpdateChatIsMarkedAsUnread) GetIsMarkedAsUnread() (value bool) { +// GetHasProtectedContent returns value of HasProtectedContent field. +func (u *UpdateChatHasProtectedContent) GetHasProtectedContent() (value bool) { if u == nil { return } - return u.IsMarkedAsUnread + return u.HasProtectedContent } -// UpdateChatViewAsTopics represents TL type `updateChatViewAsTopics#5bff163d`. -type UpdateChatViewAsTopics struct { +// UpdateChatIsTranslatable represents TL type `updateChatIsTranslatable#7b031617`. +type UpdateChatIsTranslatable struct { // Chat identifier ChatID int64 - // New value of view_as_topics - ViewAsTopics bool + // New value of is_translatable + IsTranslatable bool } -// UpdateChatViewAsTopicsTypeID is TL type id of UpdateChatViewAsTopics. -const UpdateChatViewAsTopicsTypeID = 0x5bff163d +// UpdateChatIsTranslatableTypeID is TL type id of UpdateChatIsTranslatable. +const UpdateChatIsTranslatableTypeID = 0x7b031617 // construct implements constructor of UpdateClass. -func (u UpdateChatViewAsTopics) construct() UpdateClass { return &u } +func (u UpdateChatIsTranslatable) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatViewAsTopics. +// Ensuring interfaces in compile-time for UpdateChatIsTranslatable. var ( - _ bin.Encoder = &UpdateChatViewAsTopics{} - _ bin.Decoder = &UpdateChatViewAsTopics{} - _ bin.BareEncoder = &UpdateChatViewAsTopics{} - _ bin.BareDecoder = &UpdateChatViewAsTopics{} + _ bin.Encoder = &UpdateChatIsTranslatable{} + _ bin.Decoder = &UpdateChatIsTranslatable{} + _ bin.BareEncoder = &UpdateChatIsTranslatable{} + _ bin.BareDecoder = &UpdateChatIsTranslatable{} - _ UpdateClass = &UpdateChatViewAsTopics{} + _ UpdateClass = &UpdateChatIsTranslatable{} ) -func (u *UpdateChatViewAsTopics) Zero() bool { +func (u *UpdateChatIsTranslatable) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.ViewAsTopics == false) { + if !(u.IsTranslatable == false) { return false } @@ -8627,31 +8647,31 @@ func (u *UpdateChatViewAsTopics) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatViewAsTopics) String() string { +func (u *UpdateChatIsTranslatable) String() string { if u == nil { - return "UpdateChatViewAsTopics(nil)" + return "UpdateChatIsTranslatable(nil)" } - type Alias UpdateChatViewAsTopics - return fmt.Sprintf("UpdateChatViewAsTopics%+v", Alias(*u)) + type Alias UpdateChatIsTranslatable + return fmt.Sprintf("UpdateChatIsTranslatable%+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 +func (*UpdateChatIsTranslatable) TypeID() uint32 { + return UpdateChatIsTranslatableTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatViewAsTopics) TypeName() string { - return "updateChatViewAsTopics" +func (*UpdateChatIsTranslatable) TypeName() string { + return "updateChatIsTranslatable" } // TypeInfo returns info about TL type. -func (u *UpdateChatViewAsTopics) TypeInfo() tdp.Type { +func (u *UpdateChatIsTranslatable) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatViewAsTopics", - ID: UpdateChatViewAsTopicsTypeID, + Name: "updateChatIsTranslatable", + ID: UpdateChatIsTranslatableTypeID, } if u == nil { typ.Null = true @@ -8663,78 +8683,78 @@ func (u *UpdateChatViewAsTopics) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "ViewAsTopics", - SchemaName: "view_as_topics", + Name: "IsTranslatable", + SchemaName: "is_translatable", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatViewAsTopics) Encode(b *bin.Buffer) error { +func (u *UpdateChatIsTranslatable) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatViewAsTopics#5bff163d as nil") + return fmt.Errorf("can't encode updateChatIsTranslatable#7b031617 as nil") } - b.PutID(UpdateChatViewAsTopicsTypeID) + b.PutID(UpdateChatIsTranslatableTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatViewAsTopics) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatIsTranslatable) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatViewAsTopics#5bff163d as nil") + return fmt.Errorf("can't encode updateChatIsTranslatable#7b031617 as nil") } b.PutInt53(u.ChatID) - b.PutBool(u.ViewAsTopics) + b.PutBool(u.IsTranslatable) return nil } // Decode implements bin.Decoder. -func (u *UpdateChatViewAsTopics) Decode(b *bin.Buffer) error { +func (u *UpdateChatIsTranslatable) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatViewAsTopics#5bff163d to nil") + return fmt.Errorf("can't decode updateChatIsTranslatable#7b031617 to nil") } - if err := b.ConsumeID(UpdateChatViewAsTopicsTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatViewAsTopics#5bff163d: %w", err) + if err := b.ConsumeID(UpdateChatIsTranslatableTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatIsTranslatable#7b031617: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatViewAsTopics) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatIsTranslatable) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatViewAsTopics#5bff163d to nil") + return fmt.Errorf("can't decode updateChatIsTranslatable#7b031617 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatViewAsTopics#5bff163d: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatIsTranslatable#7b031617: 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) + return fmt.Errorf("unable to decode updateChatIsTranslatable#7b031617: field is_translatable: %w", err) } - u.ViewAsTopics = value + u.IsTranslatable = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatViewAsTopics) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatIsTranslatable) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatViewAsTopics#5bff163d as nil") + return fmt.Errorf("can't encode updateChatIsTranslatable#7b031617 as nil") } b.ObjStart() - b.PutID("updateChatViewAsTopics") + b.PutID("updateChatIsTranslatable") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("view_as_topics") - b.PutBool(u.ViewAsTopics) + b.FieldStart("is_translatable") + b.PutBool(u.IsTranslatable) b.Comma() b.StripComma() b.ObjEnd() @@ -8742,29 +8762,29 @@ func (u *UpdateChatViewAsTopics) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatViewAsTopics) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatIsTranslatable) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatViewAsTopics#5bff163d to nil") + return fmt.Errorf("can't decode updateChatIsTranslatable#7b031617 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) + if err := b.ConsumeID("updateChatIsTranslatable"); err != nil { + return fmt.Errorf("unable to decode updateChatIsTranslatable#7b031617: %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) + return fmt.Errorf("unable to decode updateChatIsTranslatable#7b031617: field chat_id: %w", err) } u.ChatID = value - case "view_as_topics": + case "is_translatable": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode updateChatViewAsTopics#5bff163d: field view_as_topics: %w", err) + return fmt.Errorf("unable to decode updateChatIsTranslatable#7b031617: field is_translatable: %w", err) } - u.ViewAsTopics = value + u.IsTranslatable = value default: return b.Skip() } @@ -8773,53 +8793,53 @@ func (u *UpdateChatViewAsTopics) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetChatID returns value of ChatID field. -func (u *UpdateChatViewAsTopics) GetChatID() (value int64) { +func (u *UpdateChatIsTranslatable) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetViewAsTopics returns value of ViewAsTopics field. -func (u *UpdateChatViewAsTopics) GetViewAsTopics() (value bool) { +// GetIsTranslatable returns value of IsTranslatable field. +func (u *UpdateChatIsTranslatable) GetIsTranslatable() (value bool) { if u == nil { return } - return u.ViewAsTopics + return u.IsTranslatable } -// UpdateChatBlockList represents TL type `updateChatBlockList#872af48e`. -type UpdateChatBlockList struct { +// UpdateChatIsMarkedAsUnread represents TL type `updateChatIsMarkedAsUnread#57853334`. +type UpdateChatIsMarkedAsUnread struct { // Chat identifier ChatID int64 - // Block list to which the chat is added; may be null if none - BlockList BlockListClass + // New value of is_marked_as_unread + IsMarkedAsUnread bool } -// UpdateChatBlockListTypeID is TL type id of UpdateChatBlockList. -const UpdateChatBlockListTypeID = 0x872af48e +// UpdateChatIsMarkedAsUnreadTypeID is TL type id of UpdateChatIsMarkedAsUnread. +const UpdateChatIsMarkedAsUnreadTypeID = 0x57853334 // construct implements constructor of UpdateClass. -func (u UpdateChatBlockList) construct() UpdateClass { return &u } +func (u UpdateChatIsMarkedAsUnread) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatBlockList. +// Ensuring interfaces in compile-time for UpdateChatIsMarkedAsUnread. var ( - _ bin.Encoder = &UpdateChatBlockList{} - _ bin.Decoder = &UpdateChatBlockList{} - _ bin.BareEncoder = &UpdateChatBlockList{} - _ bin.BareDecoder = &UpdateChatBlockList{} + _ bin.Encoder = &UpdateChatIsMarkedAsUnread{} + _ bin.Decoder = &UpdateChatIsMarkedAsUnread{} + _ bin.BareEncoder = &UpdateChatIsMarkedAsUnread{} + _ bin.BareDecoder = &UpdateChatIsMarkedAsUnread{} - _ UpdateClass = &UpdateChatBlockList{} + _ UpdateClass = &UpdateChatIsMarkedAsUnread{} ) -func (u *UpdateChatBlockList) Zero() bool { +func (u *UpdateChatIsMarkedAsUnread) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.BlockList == nil) { + if !(u.IsMarkedAsUnread == false) { return false } @@ -8827,31 +8847,31 @@ func (u *UpdateChatBlockList) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatBlockList) String() string { +func (u *UpdateChatIsMarkedAsUnread) String() string { if u == nil { - return "UpdateChatBlockList(nil)" + return "UpdateChatIsMarkedAsUnread(nil)" } - type Alias UpdateChatBlockList - return fmt.Sprintf("UpdateChatBlockList%+v", Alias(*u)) + type Alias UpdateChatIsMarkedAsUnread + return fmt.Sprintf("UpdateChatIsMarkedAsUnread%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatBlockList) TypeID() uint32 { - return UpdateChatBlockListTypeID +func (*UpdateChatIsMarkedAsUnread) TypeID() uint32 { + return UpdateChatIsMarkedAsUnreadTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatBlockList) TypeName() string { - return "updateChatBlockList" +func (*UpdateChatIsMarkedAsUnread) TypeName() string { + return "updateChatIsMarkedAsUnread" } // TypeInfo returns info about TL type. -func (u *UpdateChatBlockList) TypeInfo() tdp.Type { +func (u *UpdateChatIsMarkedAsUnread) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatBlockList", - ID: UpdateChatBlockListTypeID, + Name: "updateChatIsMarkedAsUnread", + ID: UpdateChatIsMarkedAsUnreadTypeID, } if u == nil { typ.Null = true @@ -8863,88 +8883,78 @@ func (u *UpdateChatBlockList) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "BlockList", - SchemaName: "block_list", + Name: "IsMarkedAsUnread", + SchemaName: "is_marked_as_unread", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatBlockList) Encode(b *bin.Buffer) error { +func (u *UpdateChatIsMarkedAsUnread) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatBlockList#872af48e as nil") + return fmt.Errorf("can't encode updateChatIsMarkedAsUnread#57853334 as nil") } - b.PutID(UpdateChatBlockListTypeID) + b.PutID(UpdateChatIsMarkedAsUnreadTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatBlockList) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatIsMarkedAsUnread) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatBlockList#872af48e as nil") + return fmt.Errorf("can't encode updateChatIsMarkedAsUnread#57853334 as nil") } b.PutInt53(u.ChatID) - if u.BlockList == nil { - return fmt.Errorf("unable to encode updateChatBlockList#872af48e: field block_list is nil") - } - if err := u.BlockList.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatBlockList#872af48e: field block_list: %w", err) - } + b.PutBool(u.IsMarkedAsUnread) return nil } // Decode implements bin.Decoder. -func (u *UpdateChatBlockList) Decode(b *bin.Buffer) error { +func (u *UpdateChatIsMarkedAsUnread) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatBlockList#872af48e to nil") + return fmt.Errorf("can't decode updateChatIsMarkedAsUnread#57853334 to nil") } - if err := b.ConsumeID(UpdateChatBlockListTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatBlockList#872af48e: %w", err) + if err := b.ConsumeID(UpdateChatIsMarkedAsUnreadTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatIsMarkedAsUnread#57853334: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatBlockList) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatIsMarkedAsUnread) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatBlockList#872af48e to nil") + return fmt.Errorf("can't decode updateChatIsMarkedAsUnread#57853334 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatBlockList#872af48e: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatIsMarkedAsUnread#57853334: field chat_id: %w", err) } u.ChatID = value } { - value, err := DecodeBlockList(b) + value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode updateChatBlockList#872af48e: field block_list: %w", err) + return fmt.Errorf("unable to decode updateChatIsMarkedAsUnread#57853334: field is_marked_as_unread: %w", err) } - u.BlockList = value + u.IsMarkedAsUnread = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatBlockList) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatIsMarkedAsUnread) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatBlockList#872af48e as nil") + return fmt.Errorf("can't encode updateChatIsMarkedAsUnread#57853334 as nil") } b.ObjStart() - b.PutID("updateChatBlockList") + b.PutID("updateChatIsMarkedAsUnread") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("block_list") - if u.BlockList == nil { - return fmt.Errorf("unable to encode updateChatBlockList#872af48e: field block_list is nil") - } - if err := u.BlockList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatBlockList#872af48e: field block_list: %w", err) - } + b.FieldStart("is_marked_as_unread") + b.PutBool(u.IsMarkedAsUnread) b.Comma() b.StripComma() b.ObjEnd() @@ -8952,29 +8962,29 @@ func (u *UpdateChatBlockList) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatBlockList) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatIsMarkedAsUnread) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatBlockList#872af48e to nil") + return fmt.Errorf("can't decode updateChatIsMarkedAsUnread#57853334 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatBlockList"); err != nil { - return fmt.Errorf("unable to decode updateChatBlockList#872af48e: %w", err) + if err := b.ConsumeID("updateChatIsMarkedAsUnread"); err != nil { + return fmt.Errorf("unable to decode updateChatIsMarkedAsUnread#57853334: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatBlockList#872af48e: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatIsMarkedAsUnread#57853334: field chat_id: %w", err) } u.ChatID = value - case "block_list": - value, err := DecodeTDLibJSONBlockList(b) + case "is_marked_as_unread": + value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode updateChatBlockList#872af48e: field block_list: %w", err) + return fmt.Errorf("unable to decode updateChatIsMarkedAsUnread#57853334: field is_marked_as_unread: %w", err) } - u.BlockList = value + u.IsMarkedAsUnread = value default: return b.Skip() } @@ -8983,53 +8993,53 @@ func (u *UpdateChatBlockList) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetChatID returns value of ChatID field. -func (u *UpdateChatBlockList) GetChatID() (value int64) { +func (u *UpdateChatIsMarkedAsUnread) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetBlockList returns value of BlockList field. -func (u *UpdateChatBlockList) GetBlockList() (value BlockListClass) { +// GetIsMarkedAsUnread returns value of IsMarkedAsUnread field. +func (u *UpdateChatIsMarkedAsUnread) GetIsMarkedAsUnread() (value bool) { if u == nil { return } - return u.BlockList + return u.IsMarkedAsUnread } -// UpdateChatHasScheduledMessages represents TL type `updateChatHasScheduledMessages#7b14c2d7`. -type UpdateChatHasScheduledMessages struct { +// UpdateChatViewAsTopics represents TL type `updateChatViewAsTopics#5bff163d`. +type UpdateChatViewAsTopics struct { // Chat identifier ChatID int64 - // New value of has_scheduled_messages - HasScheduledMessages bool + // New value of view_as_topics + ViewAsTopics bool } -// UpdateChatHasScheduledMessagesTypeID is TL type id of UpdateChatHasScheduledMessages. -const UpdateChatHasScheduledMessagesTypeID = 0x7b14c2d7 +// UpdateChatViewAsTopicsTypeID is TL type id of UpdateChatViewAsTopics. +const UpdateChatViewAsTopicsTypeID = 0x5bff163d // construct implements constructor of UpdateClass. -func (u UpdateChatHasScheduledMessages) construct() UpdateClass { return &u } +func (u UpdateChatViewAsTopics) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatHasScheduledMessages. +// Ensuring interfaces in compile-time for UpdateChatViewAsTopics. var ( - _ bin.Encoder = &UpdateChatHasScheduledMessages{} - _ bin.Decoder = &UpdateChatHasScheduledMessages{} - _ bin.BareEncoder = &UpdateChatHasScheduledMessages{} - _ bin.BareDecoder = &UpdateChatHasScheduledMessages{} + _ bin.Encoder = &UpdateChatViewAsTopics{} + _ bin.Decoder = &UpdateChatViewAsTopics{} + _ bin.BareEncoder = &UpdateChatViewAsTopics{} + _ bin.BareDecoder = &UpdateChatViewAsTopics{} - _ UpdateClass = &UpdateChatHasScheduledMessages{} + _ UpdateClass = &UpdateChatViewAsTopics{} ) -func (u *UpdateChatHasScheduledMessages) Zero() bool { +func (u *UpdateChatViewAsTopics) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.HasScheduledMessages == false) { + if !(u.ViewAsTopics == false) { return false } @@ -9037,31 +9047,31 @@ func (u *UpdateChatHasScheduledMessages) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatHasScheduledMessages) String() string { +func (u *UpdateChatViewAsTopics) String() string { if u == nil { - return "UpdateChatHasScheduledMessages(nil)" + return "UpdateChatViewAsTopics(nil)" } - type Alias UpdateChatHasScheduledMessages - return fmt.Sprintf("UpdateChatHasScheduledMessages%+v", Alias(*u)) + 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 (*UpdateChatHasScheduledMessages) TypeID() uint32 { - return UpdateChatHasScheduledMessagesTypeID +func (*UpdateChatViewAsTopics) TypeID() uint32 { + return UpdateChatViewAsTopicsTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatHasScheduledMessages) TypeName() string { - return "updateChatHasScheduledMessages" +func (*UpdateChatViewAsTopics) TypeName() string { + return "updateChatViewAsTopics" } // TypeInfo returns info about TL type. -func (u *UpdateChatHasScheduledMessages) TypeInfo() tdp.Type { +func (u *UpdateChatViewAsTopics) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatHasScheduledMessages", - ID: UpdateChatHasScheduledMessagesTypeID, + Name: "updateChatViewAsTopics", + ID: UpdateChatViewAsTopicsTypeID, } if u == nil { typ.Null = true @@ -9073,78 +9083,1296 @@ func (u *UpdateChatHasScheduledMessages) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "HasScheduledMessages", - SchemaName: "has_scheduled_messages", + 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 + ChatID int64 + // Block list to which the chat is added; may be null if none + BlockList BlockListClass +} + +// UpdateChatBlockListTypeID is TL type id of UpdateChatBlockList. +const UpdateChatBlockListTypeID = 0x872af48e + +// construct implements constructor of UpdateClass. +func (u UpdateChatBlockList) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateChatBlockList. +var ( + _ bin.Encoder = &UpdateChatBlockList{} + _ bin.Decoder = &UpdateChatBlockList{} + _ bin.BareEncoder = &UpdateChatBlockList{} + _ bin.BareDecoder = &UpdateChatBlockList{} + + _ UpdateClass = &UpdateChatBlockList{} +) + +func (u *UpdateChatBlockList) Zero() bool { + if u == nil { + return true + } + if !(u.ChatID == 0) { + return false + } + if !(u.BlockList == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateChatBlockList) String() string { + if u == nil { + return "UpdateChatBlockList(nil)" + } + type Alias UpdateChatBlockList + return fmt.Sprintf("UpdateChatBlockList%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateChatBlockList) TypeID() uint32 { + return UpdateChatBlockListTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateChatBlockList) TypeName() string { + return "updateChatBlockList" +} + +// TypeInfo returns info about TL type. +func (u *UpdateChatBlockList) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateChatBlockList", + ID: UpdateChatBlockListTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "BlockList", + SchemaName: "block_list", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateChatBlockList) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateChatBlockList#872af48e as nil") + } + b.PutID(UpdateChatBlockListTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateChatBlockList) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateChatBlockList#872af48e as nil") + } + b.PutInt53(u.ChatID) + if u.BlockList == nil { + return fmt.Errorf("unable to encode updateChatBlockList#872af48e: field block_list is nil") + } + if err := u.BlockList.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateChatBlockList#872af48e: field block_list: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateChatBlockList) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateChatBlockList#872af48e to nil") + } + if err := b.ConsumeID(UpdateChatBlockListTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatBlockList#872af48e: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateChatBlockList) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateChatBlockList#872af48e to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode updateChatBlockList#872af48e: field chat_id: %w", err) + } + u.ChatID = value + } + { + value, err := DecodeBlockList(b) + if err != nil { + return fmt.Errorf("unable to decode updateChatBlockList#872af48e: field block_list: %w", err) + } + u.BlockList = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpdateChatBlockList) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode updateChatBlockList#872af48e as nil") + } + b.ObjStart() + b.PutID("updateChatBlockList") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(u.ChatID) + b.Comma() + b.FieldStart("block_list") + if u.BlockList == nil { + return fmt.Errorf("unable to encode updateChatBlockList#872af48e: field block_list is nil") + } + if err := u.BlockList.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateChatBlockList#872af48e: field block_list: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpdateChatBlockList) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode updateChatBlockList#872af48e to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("updateChatBlockList"); err != nil { + return fmt.Errorf("unable to decode updateChatBlockList#872af48e: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode updateChatBlockList#872af48e: field chat_id: %w", err) + } + u.ChatID = value + case "block_list": + value, err := DecodeTDLibJSONBlockList(b) + if err != nil { + return fmt.Errorf("unable to decode updateChatBlockList#872af48e: field block_list: %w", err) + } + u.BlockList = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (u *UpdateChatBlockList) GetChatID() (value int64) { + if u == nil { + return + } + return u.ChatID +} + +// GetBlockList returns value of BlockList field. +func (u *UpdateChatBlockList) GetBlockList() (value BlockListClass) { + if u == nil { + return + } + return u.BlockList +} + +// UpdateChatHasScheduledMessages represents TL type `updateChatHasScheduledMessages#7b14c2d7`. +type UpdateChatHasScheduledMessages struct { + // Chat identifier + ChatID int64 + // New value of has_scheduled_messages + HasScheduledMessages bool +} + +// UpdateChatHasScheduledMessagesTypeID is TL type id of UpdateChatHasScheduledMessages. +const UpdateChatHasScheduledMessagesTypeID = 0x7b14c2d7 + +// construct implements constructor of UpdateClass. +func (u UpdateChatHasScheduledMessages) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateChatHasScheduledMessages. +var ( + _ bin.Encoder = &UpdateChatHasScheduledMessages{} + _ bin.Decoder = &UpdateChatHasScheduledMessages{} + _ bin.BareEncoder = &UpdateChatHasScheduledMessages{} + _ bin.BareDecoder = &UpdateChatHasScheduledMessages{} + + _ UpdateClass = &UpdateChatHasScheduledMessages{} +) + +func (u *UpdateChatHasScheduledMessages) Zero() bool { + if u == nil { + return true + } + if !(u.ChatID == 0) { + return false + } + if !(u.HasScheduledMessages == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateChatHasScheduledMessages) String() string { + if u == nil { + return "UpdateChatHasScheduledMessages(nil)" + } + type Alias UpdateChatHasScheduledMessages + return fmt.Sprintf("UpdateChatHasScheduledMessages%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateChatHasScheduledMessages) TypeID() uint32 { + return UpdateChatHasScheduledMessagesTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateChatHasScheduledMessages) TypeName() string { + return "updateChatHasScheduledMessages" +} + +// TypeInfo returns info about TL type. +func (u *UpdateChatHasScheduledMessages) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateChatHasScheduledMessages", + ID: UpdateChatHasScheduledMessagesTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "HasScheduledMessages", + SchemaName: "has_scheduled_messages", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateChatHasScheduledMessages) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateChatHasScheduledMessages#7b14c2d7 as nil") + } + b.PutID(UpdateChatHasScheduledMessagesTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateChatHasScheduledMessages) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateChatHasScheduledMessages#7b14c2d7 as nil") + } + b.PutInt53(u.ChatID) + b.PutBool(u.HasScheduledMessages) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateChatHasScheduledMessages) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateChatHasScheduledMessages#7b14c2d7 to nil") + } + if err := b.ConsumeID(UpdateChatHasScheduledMessagesTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatHasScheduledMessages#7b14c2d7: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateChatHasScheduledMessages) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateChatHasScheduledMessages#7b14c2d7 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode updateChatHasScheduledMessages#7b14c2d7: field chat_id: %w", err) + } + u.ChatID = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode updateChatHasScheduledMessages#7b14c2d7: field has_scheduled_messages: %w", err) + } + u.HasScheduledMessages = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpdateChatHasScheduledMessages) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode updateChatHasScheduledMessages#7b14c2d7 as nil") + } + b.ObjStart() + b.PutID("updateChatHasScheduledMessages") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(u.ChatID) + b.Comma() + b.FieldStart("has_scheduled_messages") + b.PutBool(u.HasScheduledMessages) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpdateChatHasScheduledMessages) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode updateChatHasScheduledMessages#7b14c2d7 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("updateChatHasScheduledMessages"); err != nil { + return fmt.Errorf("unable to decode updateChatHasScheduledMessages#7b14c2d7: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode updateChatHasScheduledMessages#7b14c2d7: field chat_id: %w", err) + } + u.ChatID = value + case "has_scheduled_messages": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode updateChatHasScheduledMessages#7b14c2d7: field has_scheduled_messages: %w", err) + } + u.HasScheduledMessages = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (u *UpdateChatHasScheduledMessages) GetChatID() (value int64) { + if u == nil { + return + } + return u.ChatID +} + +// GetHasScheduledMessages returns value of HasScheduledMessages field. +func (u *UpdateChatHasScheduledMessages) GetHasScheduledMessages() (value bool) { + if u == nil { + return + } + return u.HasScheduledMessages +} + +// UpdateChatFolders represents TL type `updateChatFolders#e110242a`. +type UpdateChatFolders struct { + // The new list of chat folders + ChatFolders []ChatFolderInfo + // Position of the main chat list among chat folders, 0-based + MainChatListPosition int32 + // True, if folder tags are enabled + AreTagsEnabled bool +} + +// UpdateChatFoldersTypeID is TL type id of UpdateChatFolders. +const UpdateChatFoldersTypeID = 0xe110242a + +// construct implements constructor of UpdateClass. +func (u UpdateChatFolders) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateChatFolders. +var ( + _ bin.Encoder = &UpdateChatFolders{} + _ bin.Decoder = &UpdateChatFolders{} + _ bin.BareEncoder = &UpdateChatFolders{} + _ bin.BareDecoder = &UpdateChatFolders{} + + _ UpdateClass = &UpdateChatFolders{} +) + +func (u *UpdateChatFolders) Zero() bool { + if u == nil { + return true + } + if !(u.ChatFolders == nil) { + return false + } + if !(u.MainChatListPosition == 0) { + return false + } + if !(u.AreTagsEnabled == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateChatFolders) String() string { + if u == nil { + return "UpdateChatFolders(nil)" + } + type Alias UpdateChatFolders + return fmt.Sprintf("UpdateChatFolders%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateChatFolders) TypeID() uint32 { + return UpdateChatFoldersTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateChatFolders) TypeName() string { + return "updateChatFolders" +} + +// TypeInfo returns info about TL type. +func (u *UpdateChatFolders) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateChatFolders", + ID: UpdateChatFoldersTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatFolders", + SchemaName: "chat_folders", + }, + { + Name: "MainChatListPosition", + SchemaName: "main_chat_list_position", + }, + { + Name: "AreTagsEnabled", + SchemaName: "are_tags_enabled", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateChatFolders) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateChatFolders#e110242a as nil") + } + b.PutID(UpdateChatFoldersTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateChatFolders) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateChatFolders#e110242a as nil") + } + b.PutInt(len(u.ChatFolders)) + for idx, v := range u.ChatFolders { + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare updateChatFolders#e110242a: field chat_folders element with index %d: %w", idx, err) + } + } + b.PutInt32(u.MainChatListPosition) + b.PutBool(u.AreTagsEnabled) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateChatFolders) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateChatFolders#e110242a to nil") + } + if err := b.ConsumeID(UpdateChatFoldersTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatFolders#e110242a: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateChatFolders) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateChatFolders#e110242a to nil") + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateChatFolders#e110242a: field chat_folders: %w", err) + } + + if headerLen > 0 { + u.ChatFolders = make([]ChatFolderInfo, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value ChatFolderInfo + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare updateChatFolders#e110242a: field chat_folders: %w", err) + } + u.ChatFolders = append(u.ChatFolders, value) + } + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateChatFolders#e110242a: field main_chat_list_position: %w", err) + } + u.MainChatListPosition = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode updateChatFolders#e110242a: field are_tags_enabled: %w", err) + } + u.AreTagsEnabled = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpdateChatFolders) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode updateChatFolders#e110242a as nil") + } + b.ObjStart() + b.PutID("updateChatFolders") + b.Comma() + b.FieldStart("chat_folders") + b.ArrStart() + for idx, v := range u.ChatFolders { + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateChatFolders#e110242a: field chat_folders element with index %d: %w", idx, err) + } + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.FieldStart("main_chat_list_position") + b.PutInt32(u.MainChatListPosition) + b.Comma() + b.FieldStart("are_tags_enabled") + b.PutBool(u.AreTagsEnabled) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpdateChatFolders) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode updateChatFolders#e110242a to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("updateChatFolders"); err != nil { + return fmt.Errorf("unable to decode updateChatFolders#e110242a: %w", err) + } + case "chat_folders": + if err := b.Arr(func(b tdjson.Decoder) error { + var value ChatFolderInfo + if err := value.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode updateChatFolders#e110242a: field chat_folders: %w", err) + } + u.ChatFolders = append(u.ChatFolders, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode updateChatFolders#e110242a: field chat_folders: %w", err) + } + case "main_chat_list_position": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateChatFolders#e110242a: field main_chat_list_position: %w", err) + } + u.MainChatListPosition = value + case "are_tags_enabled": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode updateChatFolders#e110242a: field are_tags_enabled: %w", err) + } + u.AreTagsEnabled = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatFolders returns value of ChatFolders field. +func (u *UpdateChatFolders) GetChatFolders() (value []ChatFolderInfo) { + if u == nil { + return + } + return u.ChatFolders +} + +// GetMainChatListPosition returns value of MainChatListPosition field. +func (u *UpdateChatFolders) GetMainChatListPosition() (value int32) { + if u == nil { + return + } + return u.MainChatListPosition +} + +// GetAreTagsEnabled returns value of AreTagsEnabled field. +func (u *UpdateChatFolders) GetAreTagsEnabled() (value bool) { + if u == nil { + return + } + return u.AreTagsEnabled +} + +// UpdateChatOnlineMemberCount represents TL type `updateChatOnlineMemberCount#1d0caa9d`. +type UpdateChatOnlineMemberCount struct { + // Identifier of the chat + ChatID int64 + // New number of online members in the chat, or 0 if unknown + OnlineMemberCount int32 +} + +// UpdateChatOnlineMemberCountTypeID is TL type id of UpdateChatOnlineMemberCount. +const UpdateChatOnlineMemberCountTypeID = 0x1d0caa9d + +// construct implements constructor of UpdateClass. +func (u UpdateChatOnlineMemberCount) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateChatOnlineMemberCount. +var ( + _ bin.Encoder = &UpdateChatOnlineMemberCount{} + _ bin.Decoder = &UpdateChatOnlineMemberCount{} + _ bin.BareEncoder = &UpdateChatOnlineMemberCount{} + _ bin.BareDecoder = &UpdateChatOnlineMemberCount{} + + _ UpdateClass = &UpdateChatOnlineMemberCount{} +) + +func (u *UpdateChatOnlineMemberCount) Zero() bool { + if u == nil { + return true + } + if !(u.ChatID == 0) { + return false + } + if !(u.OnlineMemberCount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateChatOnlineMemberCount) String() string { + if u == nil { + return "UpdateChatOnlineMemberCount(nil)" + } + type Alias UpdateChatOnlineMemberCount + return fmt.Sprintf("UpdateChatOnlineMemberCount%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateChatOnlineMemberCount) TypeID() uint32 { + return UpdateChatOnlineMemberCountTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateChatOnlineMemberCount) TypeName() string { + return "updateChatOnlineMemberCount" +} + +// TypeInfo returns info about TL type. +func (u *UpdateChatOnlineMemberCount) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateChatOnlineMemberCount", + ID: UpdateChatOnlineMemberCountTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "OnlineMemberCount", + SchemaName: "online_member_count", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateChatOnlineMemberCount) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateChatOnlineMemberCount#1d0caa9d as nil") + } + b.PutID(UpdateChatOnlineMemberCountTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateChatOnlineMemberCount) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateChatOnlineMemberCount#1d0caa9d as nil") + } + b.PutInt53(u.ChatID) + b.PutInt32(u.OnlineMemberCount) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateChatOnlineMemberCount) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateChatOnlineMemberCount#1d0caa9d to nil") + } + if err := b.ConsumeID(UpdateChatOnlineMemberCountTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatOnlineMemberCount#1d0caa9d: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateChatOnlineMemberCount) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateChatOnlineMemberCount#1d0caa9d to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode updateChatOnlineMemberCount#1d0caa9d: field chat_id: %w", err) + } + u.ChatID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateChatOnlineMemberCount#1d0caa9d: field online_member_count: %w", err) + } + u.OnlineMemberCount = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpdateChatOnlineMemberCount) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode updateChatOnlineMemberCount#1d0caa9d as nil") + } + b.ObjStart() + b.PutID("updateChatOnlineMemberCount") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(u.ChatID) + b.Comma() + b.FieldStart("online_member_count") + b.PutInt32(u.OnlineMemberCount) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpdateChatOnlineMemberCount) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode updateChatOnlineMemberCount#1d0caa9d to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("updateChatOnlineMemberCount"); err != nil { + return fmt.Errorf("unable to decode updateChatOnlineMemberCount#1d0caa9d: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode updateChatOnlineMemberCount#1d0caa9d: field chat_id: %w", err) + } + u.ChatID = value + case "online_member_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateChatOnlineMemberCount#1d0caa9d: field online_member_count: %w", err) + } + u.OnlineMemberCount = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (u *UpdateChatOnlineMemberCount) GetChatID() (value int64) { + if u == nil { + return + } + return u.ChatID +} + +// GetOnlineMemberCount returns value of OnlineMemberCount field. +func (u *UpdateChatOnlineMemberCount) GetOnlineMemberCount() (value int32) { + if u == nil { + return + } + return u.OnlineMemberCount +} + +// UpdateSavedMessagesTopic represents TL type `updateSavedMessagesTopic#9f823b30`. +type UpdateSavedMessagesTopic struct { + // New data about the topic + Topic SavedMessagesTopic +} + +// UpdateSavedMessagesTopicTypeID is TL type id of UpdateSavedMessagesTopic. +const UpdateSavedMessagesTopicTypeID = 0x9f823b30 + +// construct implements constructor of UpdateClass. +func (u UpdateSavedMessagesTopic) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateSavedMessagesTopic. +var ( + _ bin.Encoder = &UpdateSavedMessagesTopic{} + _ bin.Decoder = &UpdateSavedMessagesTopic{} + _ bin.BareEncoder = &UpdateSavedMessagesTopic{} + _ bin.BareDecoder = &UpdateSavedMessagesTopic{} + + _ UpdateClass = &UpdateSavedMessagesTopic{} +) + +func (u *UpdateSavedMessagesTopic) Zero() bool { + if u == nil { + return true + } + if !(u.Topic.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateSavedMessagesTopic) String() string { + if u == nil { + return "UpdateSavedMessagesTopic(nil)" + } + type Alias UpdateSavedMessagesTopic + return fmt.Sprintf("UpdateSavedMessagesTopic%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateSavedMessagesTopic) TypeID() uint32 { + return UpdateSavedMessagesTopicTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateSavedMessagesTopic) TypeName() string { + return "updateSavedMessagesTopic" +} + +// TypeInfo returns info about TL type. +func (u *UpdateSavedMessagesTopic) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateSavedMessagesTopic", + ID: UpdateSavedMessagesTopicTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Topic", + SchemaName: "topic", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateSavedMessagesTopic) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateSavedMessagesTopic#9f823b30 as nil") + } + b.PutID(UpdateSavedMessagesTopicTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateSavedMessagesTopic) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateSavedMessagesTopic#9f823b30 as nil") + } + if err := u.Topic.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateSavedMessagesTopic#9f823b30: field topic: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateSavedMessagesTopic) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateSavedMessagesTopic#9f823b30 to nil") + } + if err := b.ConsumeID(UpdateSavedMessagesTopicTypeID); err != nil { + return fmt.Errorf("unable to decode updateSavedMessagesTopic#9f823b30: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateSavedMessagesTopic) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateSavedMessagesTopic#9f823b30 to nil") + } + { + if err := u.Topic.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateSavedMessagesTopic#9f823b30: field topic: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpdateSavedMessagesTopic) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode updateSavedMessagesTopic#9f823b30 as nil") + } + b.ObjStart() + b.PutID("updateSavedMessagesTopic") + b.Comma() + b.FieldStart("topic") + if err := u.Topic.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateSavedMessagesTopic#9f823b30: field topic: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpdateSavedMessagesTopic) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode updateSavedMessagesTopic#9f823b30 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("updateSavedMessagesTopic"); err != nil { + return fmt.Errorf("unable to decode updateSavedMessagesTopic#9f823b30: %w", err) + } + case "topic": + if err := u.Topic.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode updateSavedMessagesTopic#9f823b30: field topic: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetTopic returns value of Topic field. +func (u *UpdateSavedMessagesTopic) GetTopic() (value SavedMessagesTopic) { + if u == nil { + return + } + return u.Topic +} + +// UpdateSavedMessagesTopicCount represents TL type `updateSavedMessagesTopicCount#fbd279d1`. +type UpdateSavedMessagesTopicCount struct { + // Approximate total number of Saved Messages topics + TopicCount int32 +} + +// UpdateSavedMessagesTopicCountTypeID is TL type id of UpdateSavedMessagesTopicCount. +const UpdateSavedMessagesTopicCountTypeID = 0xfbd279d1 + +// construct implements constructor of UpdateClass. +func (u UpdateSavedMessagesTopicCount) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateSavedMessagesTopicCount. +var ( + _ bin.Encoder = &UpdateSavedMessagesTopicCount{} + _ bin.Decoder = &UpdateSavedMessagesTopicCount{} + _ bin.BareEncoder = &UpdateSavedMessagesTopicCount{} + _ bin.BareDecoder = &UpdateSavedMessagesTopicCount{} + + _ UpdateClass = &UpdateSavedMessagesTopicCount{} +) + +func (u *UpdateSavedMessagesTopicCount) Zero() bool { + if u == nil { + return true + } + if !(u.TopicCount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateSavedMessagesTopicCount) String() string { + if u == nil { + return "UpdateSavedMessagesTopicCount(nil)" + } + type Alias UpdateSavedMessagesTopicCount + return fmt.Sprintf("UpdateSavedMessagesTopicCount%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateSavedMessagesTopicCount) TypeID() uint32 { + return UpdateSavedMessagesTopicCountTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateSavedMessagesTopicCount) TypeName() string { + return "updateSavedMessagesTopicCount" +} + +// TypeInfo returns info about TL type. +func (u *UpdateSavedMessagesTopicCount) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateSavedMessagesTopicCount", + ID: UpdateSavedMessagesTopicCountTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "TopicCount", + SchemaName: "topic_count", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatHasScheduledMessages) Encode(b *bin.Buffer) error { +func (u *UpdateSavedMessagesTopicCount) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatHasScheduledMessages#7b14c2d7 as nil") + return fmt.Errorf("can't encode updateSavedMessagesTopicCount#fbd279d1 as nil") } - b.PutID(UpdateChatHasScheduledMessagesTypeID) + b.PutID(UpdateSavedMessagesTopicCountTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatHasScheduledMessages) EncodeBare(b *bin.Buffer) error { +func (u *UpdateSavedMessagesTopicCount) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatHasScheduledMessages#7b14c2d7 as nil") + return fmt.Errorf("can't encode updateSavedMessagesTopicCount#fbd279d1 as nil") } - b.PutInt53(u.ChatID) - b.PutBool(u.HasScheduledMessages) + b.PutInt32(u.TopicCount) return nil } // Decode implements bin.Decoder. -func (u *UpdateChatHasScheduledMessages) Decode(b *bin.Buffer) error { +func (u *UpdateSavedMessagesTopicCount) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatHasScheduledMessages#7b14c2d7 to nil") + return fmt.Errorf("can't decode updateSavedMessagesTopicCount#fbd279d1 to nil") } - if err := b.ConsumeID(UpdateChatHasScheduledMessagesTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatHasScheduledMessages#7b14c2d7: %w", err) + if err := b.ConsumeID(UpdateSavedMessagesTopicCountTypeID); err != nil { + return fmt.Errorf("unable to decode updateSavedMessagesTopicCount#fbd279d1: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatHasScheduledMessages) DecodeBare(b *bin.Buffer) error { +func (u *UpdateSavedMessagesTopicCount) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatHasScheduledMessages#7b14c2d7 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatHasScheduledMessages#7b14c2d7: field chat_id: %w", err) - } - u.ChatID = value + return fmt.Errorf("can't decode updateSavedMessagesTopicCount#fbd279d1 to nil") } { - value, err := b.Bool() + value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode updateChatHasScheduledMessages#7b14c2d7: field has_scheduled_messages: %w", err) + return fmt.Errorf("unable to decode updateSavedMessagesTopicCount#fbd279d1: field topic_count: %w", err) } - u.HasScheduledMessages = value + u.TopicCount = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatHasScheduledMessages) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateSavedMessagesTopicCount) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatHasScheduledMessages#7b14c2d7 as nil") + return fmt.Errorf("can't encode updateSavedMessagesTopicCount#fbd279d1 as nil") } b.ObjStart() - b.PutID("updateChatHasScheduledMessages") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) + b.PutID("updateSavedMessagesTopicCount") b.Comma() - b.FieldStart("has_scheduled_messages") - b.PutBool(u.HasScheduledMessages) + b.FieldStart("topic_count") + b.PutInt32(u.TopicCount) b.Comma() b.StripComma() b.ObjEnd() @@ -9152,29 +10380,23 @@ func (u *UpdateChatHasScheduledMessages) EncodeTDLibJSON(b tdjson.Encoder) error } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatHasScheduledMessages) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateSavedMessagesTopicCount) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatHasScheduledMessages#7b14c2d7 to nil") + return fmt.Errorf("can't decode updateSavedMessagesTopicCount#fbd279d1 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatHasScheduledMessages"); err != nil { - return fmt.Errorf("unable to decode updateChatHasScheduledMessages#7b14c2d7: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatHasScheduledMessages#7b14c2d7: field chat_id: %w", err) + if err := b.ConsumeID("updateSavedMessagesTopicCount"); err != nil { + return fmt.Errorf("unable to decode updateSavedMessagesTopicCount#fbd279d1: %w", err) } - u.ChatID = value - case "has_scheduled_messages": - value, err := b.Bool() + case "topic_count": + value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode updateChatHasScheduledMessages#7b14c2d7: field has_scheduled_messages: %w", err) + return fmt.Errorf("unable to decode updateSavedMessagesTopicCount#fbd279d1: field topic_count: %w", err) } - u.HasScheduledMessages = value + u.TopicCount = value default: return b.Skip() } @@ -9182,54 +10404,41 @@ func (u *UpdateChatHasScheduledMessages) DecodeTDLibJSON(b tdjson.Decoder) error }) } -// GetChatID returns value of ChatID field. -func (u *UpdateChatHasScheduledMessages) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetHasScheduledMessages returns value of HasScheduledMessages field. -func (u *UpdateChatHasScheduledMessages) GetHasScheduledMessages() (value bool) { +// GetTopicCount returns value of TopicCount field. +func (u *UpdateSavedMessagesTopicCount) GetTopicCount() (value int32) { if u == nil { return } - return u.HasScheduledMessages + return u.TopicCount } -// UpdateChatFolders represents TL type `updateChatFolders#71a4b3a`. -type UpdateChatFolders struct { - // The new list of chat folders - ChatFolders []ChatFolderInfo - // Position of the main chat list among chat folders, 0-based - MainChatListPosition int32 +// UpdateQuickReplyShortcut represents TL type `updateQuickReplyShortcut#c69338cf`. +type UpdateQuickReplyShortcut struct { + // New data about the shortcut + Shortcut QuickReplyShortcut } -// UpdateChatFoldersTypeID is TL type id of UpdateChatFolders. -const UpdateChatFoldersTypeID = 0x71a4b3a +// UpdateQuickReplyShortcutTypeID is TL type id of UpdateQuickReplyShortcut. +const UpdateQuickReplyShortcutTypeID = 0xc69338cf // construct implements constructor of UpdateClass. -func (u UpdateChatFolders) construct() UpdateClass { return &u } +func (u UpdateQuickReplyShortcut) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatFolders. +// Ensuring interfaces in compile-time for UpdateQuickReplyShortcut. var ( - _ bin.Encoder = &UpdateChatFolders{} - _ bin.Decoder = &UpdateChatFolders{} - _ bin.BareEncoder = &UpdateChatFolders{} - _ bin.BareDecoder = &UpdateChatFolders{} + _ bin.Encoder = &UpdateQuickReplyShortcut{} + _ bin.Decoder = &UpdateQuickReplyShortcut{} + _ bin.BareEncoder = &UpdateQuickReplyShortcut{} + _ bin.BareDecoder = &UpdateQuickReplyShortcut{} - _ UpdateClass = &UpdateChatFolders{} + _ UpdateClass = &UpdateQuickReplyShortcut{} ) -func (u *UpdateChatFolders) Zero() bool { +func (u *UpdateQuickReplyShortcut) Zero() bool { if u == nil { return true } - if !(u.ChatFolders == nil) { - return false - } - if !(u.MainChatListPosition == 0) { + if !(u.Shortcut.Zero()) { return false } @@ -9237,31 +10446,31 @@ func (u *UpdateChatFolders) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatFolders) String() string { +func (u *UpdateQuickReplyShortcut) String() string { if u == nil { - return "UpdateChatFolders(nil)" + return "UpdateQuickReplyShortcut(nil)" } - type Alias UpdateChatFolders - return fmt.Sprintf("UpdateChatFolders%+v", Alias(*u)) + type Alias UpdateQuickReplyShortcut + return fmt.Sprintf("UpdateQuickReplyShortcut%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatFolders) TypeID() uint32 { - return UpdateChatFoldersTypeID +func (*UpdateQuickReplyShortcut) TypeID() uint32 { + return UpdateQuickReplyShortcutTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatFolders) TypeName() string { - return "updateChatFolders" +func (*UpdateQuickReplyShortcut) TypeName() string { + return "updateQuickReplyShortcut" } // TypeInfo returns info about TL type. -func (u *UpdateChatFolders) TypeInfo() tdp.Type { +func (u *UpdateQuickReplyShortcut) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatFolders", - ID: UpdateChatFoldersTypeID, + Name: "updateQuickReplyShortcut", + ID: UpdateQuickReplyShortcutTypeID, } if u == nil { typ.Null = true @@ -9269,105 +10478,69 @@ func (u *UpdateChatFolders) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "ChatFolders", - SchemaName: "chat_folders", - }, - { - Name: "MainChatListPosition", - SchemaName: "main_chat_list_position", + Name: "Shortcut", + SchemaName: "shortcut", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatFolders) Encode(b *bin.Buffer) error { +func (u *UpdateQuickReplyShortcut) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatFolders#71a4b3a as nil") + return fmt.Errorf("can't encode updateQuickReplyShortcut#c69338cf as nil") } - b.PutID(UpdateChatFoldersTypeID) + b.PutID(UpdateQuickReplyShortcutTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatFolders) EncodeBare(b *bin.Buffer) error { +func (u *UpdateQuickReplyShortcut) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatFolders#71a4b3a as nil") + return fmt.Errorf("can't encode updateQuickReplyShortcut#c69338cf as nil") } - b.PutInt(len(u.ChatFolders)) - for idx, v := range u.ChatFolders { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateChatFolders#71a4b3a: field chat_folders element with index %d: %w", idx, err) - } + if err := u.Shortcut.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateQuickReplyShortcut#c69338cf: field shortcut: %w", err) } - b.PutInt32(u.MainChatListPosition) return nil } // Decode implements bin.Decoder. -func (u *UpdateChatFolders) Decode(b *bin.Buffer) error { +func (u *UpdateQuickReplyShortcut) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatFolders#71a4b3a to nil") + return fmt.Errorf("can't decode updateQuickReplyShortcut#c69338cf to nil") } - if err := b.ConsumeID(UpdateChatFoldersTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatFolders#71a4b3a: %w", err) + if err := b.ConsumeID(UpdateQuickReplyShortcutTypeID); err != nil { + return fmt.Errorf("unable to decode updateQuickReplyShortcut#c69338cf: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatFolders) DecodeBare(b *bin.Buffer) error { +func (u *UpdateQuickReplyShortcut) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatFolders#71a4b3a to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateChatFolders#71a4b3a: field chat_folders: %w", err) - } - - if headerLen > 0 { - u.ChatFolders = make([]ChatFolderInfo, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatFolderInfo - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare updateChatFolders#71a4b3a: field chat_folders: %w", err) - } - u.ChatFolders = append(u.ChatFolders, value) - } + return fmt.Errorf("can't decode updateQuickReplyShortcut#c69338cf to nil") } { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatFolders#71a4b3a: field main_chat_list_position: %w", err) + if err := u.Shortcut.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateQuickReplyShortcut#c69338cf: field shortcut: %w", err) } - u.MainChatListPosition = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatFolders) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateQuickReplyShortcut) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatFolders#71a4b3a as nil") + return fmt.Errorf("can't encode updateQuickReplyShortcut#c69338cf as nil") } b.ObjStart() - b.PutID("updateChatFolders") + b.PutID("updateQuickReplyShortcut") b.Comma() - b.FieldStart("chat_folders") - b.ArrStart() - for idx, v := range u.ChatFolders { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatFolders#71a4b3a: field chat_folders element with index %d: %w", idx, err) - } - b.Comma() + b.FieldStart("shortcut") + if err := u.Shortcut.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateQuickReplyShortcut#c69338cf: field shortcut: %w", err) } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("main_chat_list_position") - b.PutInt32(u.MainChatListPosition) b.Comma() b.StripComma() b.ObjEnd() @@ -9375,34 +10548,21 @@ func (u *UpdateChatFolders) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatFolders) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateQuickReplyShortcut) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatFolders#71a4b3a to nil") + return fmt.Errorf("can't decode updateQuickReplyShortcut#c69338cf to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatFolders"); err != nil { - return fmt.Errorf("unable to decode updateChatFolders#71a4b3a: %w", err) - } - case "chat_folders": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatFolderInfo - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatFolders#71a4b3a: field chat_folders: %w", err) - } - u.ChatFolders = append(u.ChatFolders, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateChatFolders#71a4b3a: field chat_folders: %w", err) + if err := b.ConsumeID("updateQuickReplyShortcut"); err != nil { + return fmt.Errorf("unable to decode updateQuickReplyShortcut#c69338cf: %w", err) } - case "main_chat_list_position": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatFolders#71a4b3a: field main_chat_list_position: %w", err) + case "shortcut": + if err := u.Shortcut.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode updateQuickReplyShortcut#c69338cf: field shortcut: %w", err) } - u.MainChatListPosition = value default: return b.Skip() } @@ -9410,54 +10570,41 @@ func (u *UpdateChatFolders) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetChatFolders returns value of ChatFolders field. -func (u *UpdateChatFolders) GetChatFolders() (value []ChatFolderInfo) { - if u == nil { - return - } - return u.ChatFolders -} - -// GetMainChatListPosition returns value of MainChatListPosition field. -func (u *UpdateChatFolders) GetMainChatListPosition() (value int32) { +// GetShortcut returns value of Shortcut field. +func (u *UpdateQuickReplyShortcut) GetShortcut() (value QuickReplyShortcut) { if u == nil { return } - return u.MainChatListPosition + return u.Shortcut } -// UpdateChatOnlineMemberCount represents TL type `updateChatOnlineMemberCount#1d0caa9d`. -type UpdateChatOnlineMemberCount struct { - // Identifier of the chat - ChatID int64 - // New number of online members in the chat, or 0 if unknown - OnlineMemberCount int32 +// UpdateQuickReplyShortcutDeleted represents TL type `updateQuickReplyShortcutDeleted#e8b9bc3a`. +type UpdateQuickReplyShortcutDeleted struct { + // The identifier of the deleted shortcut + ShortcutID int32 } -// UpdateChatOnlineMemberCountTypeID is TL type id of UpdateChatOnlineMemberCount. -const UpdateChatOnlineMemberCountTypeID = 0x1d0caa9d +// UpdateQuickReplyShortcutDeletedTypeID is TL type id of UpdateQuickReplyShortcutDeleted. +const UpdateQuickReplyShortcutDeletedTypeID = 0xe8b9bc3a // construct implements constructor of UpdateClass. -func (u UpdateChatOnlineMemberCount) construct() UpdateClass { return &u } +func (u UpdateQuickReplyShortcutDeleted) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatOnlineMemberCount. +// Ensuring interfaces in compile-time for UpdateQuickReplyShortcutDeleted. var ( - _ bin.Encoder = &UpdateChatOnlineMemberCount{} - _ bin.Decoder = &UpdateChatOnlineMemberCount{} - _ bin.BareEncoder = &UpdateChatOnlineMemberCount{} - _ bin.BareDecoder = &UpdateChatOnlineMemberCount{} + _ bin.Encoder = &UpdateQuickReplyShortcutDeleted{} + _ bin.Decoder = &UpdateQuickReplyShortcutDeleted{} + _ bin.BareEncoder = &UpdateQuickReplyShortcutDeleted{} + _ bin.BareDecoder = &UpdateQuickReplyShortcutDeleted{} - _ UpdateClass = &UpdateChatOnlineMemberCount{} + _ UpdateClass = &UpdateQuickReplyShortcutDeleted{} ) -func (u *UpdateChatOnlineMemberCount) Zero() bool { +func (u *UpdateQuickReplyShortcutDeleted) Zero() bool { if u == nil { return true } - if !(u.ChatID == 0) { - return false - } - if !(u.OnlineMemberCount == 0) { + if !(u.ShortcutID == 0) { return false } @@ -9465,31 +10612,31 @@ func (u *UpdateChatOnlineMemberCount) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatOnlineMemberCount) String() string { +func (u *UpdateQuickReplyShortcutDeleted) String() string { if u == nil { - return "UpdateChatOnlineMemberCount(nil)" + return "UpdateQuickReplyShortcutDeleted(nil)" } - type Alias UpdateChatOnlineMemberCount - return fmt.Sprintf("UpdateChatOnlineMemberCount%+v", Alias(*u)) + type Alias UpdateQuickReplyShortcutDeleted + return fmt.Sprintf("UpdateQuickReplyShortcutDeleted%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatOnlineMemberCount) TypeID() uint32 { - return UpdateChatOnlineMemberCountTypeID +func (*UpdateQuickReplyShortcutDeleted) TypeID() uint32 { + return UpdateQuickReplyShortcutDeletedTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatOnlineMemberCount) TypeName() string { - return "updateChatOnlineMemberCount" +func (*UpdateQuickReplyShortcutDeleted) TypeName() string { + return "updateQuickReplyShortcutDeleted" } // TypeInfo returns info about TL type. -func (u *UpdateChatOnlineMemberCount) TypeInfo() tdp.Type { +func (u *UpdateQuickReplyShortcutDeleted) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatOnlineMemberCount", - ID: UpdateChatOnlineMemberCountTypeID, + Name: "updateQuickReplyShortcutDeleted", + ID: UpdateQuickReplyShortcutDeletedTypeID, } if u == nil { typ.Null = true @@ -9497,82 +10644,67 @@ func (u *UpdateChatOnlineMemberCount) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "OnlineMemberCount", - SchemaName: "online_member_count", + Name: "ShortcutID", + SchemaName: "shortcut_id", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatOnlineMemberCount) Encode(b *bin.Buffer) error { +func (u *UpdateQuickReplyShortcutDeleted) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatOnlineMemberCount#1d0caa9d as nil") + return fmt.Errorf("can't encode updateQuickReplyShortcutDeleted#e8b9bc3a as nil") } - b.PutID(UpdateChatOnlineMemberCountTypeID) + b.PutID(UpdateQuickReplyShortcutDeletedTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatOnlineMemberCount) EncodeBare(b *bin.Buffer) error { +func (u *UpdateQuickReplyShortcutDeleted) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatOnlineMemberCount#1d0caa9d as nil") + return fmt.Errorf("can't encode updateQuickReplyShortcutDeleted#e8b9bc3a as nil") } - b.PutInt53(u.ChatID) - b.PutInt32(u.OnlineMemberCount) + b.PutInt32(u.ShortcutID) return nil } // Decode implements bin.Decoder. -func (u *UpdateChatOnlineMemberCount) Decode(b *bin.Buffer) error { +func (u *UpdateQuickReplyShortcutDeleted) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatOnlineMemberCount#1d0caa9d to nil") + return fmt.Errorf("can't decode updateQuickReplyShortcutDeleted#e8b9bc3a to nil") } - if err := b.ConsumeID(UpdateChatOnlineMemberCountTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatOnlineMemberCount#1d0caa9d: %w", err) + if err := b.ConsumeID(UpdateQuickReplyShortcutDeletedTypeID); err != nil { + return fmt.Errorf("unable to decode updateQuickReplyShortcutDeleted#e8b9bc3a: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatOnlineMemberCount) DecodeBare(b *bin.Buffer) error { +func (u *UpdateQuickReplyShortcutDeleted) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatOnlineMemberCount#1d0caa9d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatOnlineMemberCount#1d0caa9d: field chat_id: %w", err) - } - u.ChatID = value + return fmt.Errorf("can't decode updateQuickReplyShortcutDeleted#e8b9bc3a to nil") } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode updateChatOnlineMemberCount#1d0caa9d: field online_member_count: %w", err) + return fmt.Errorf("unable to decode updateQuickReplyShortcutDeleted#e8b9bc3a: field shortcut_id: %w", err) } - u.OnlineMemberCount = value + u.ShortcutID = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatOnlineMemberCount) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateQuickReplyShortcutDeleted) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatOnlineMemberCount#1d0caa9d as nil") + return fmt.Errorf("can't encode updateQuickReplyShortcutDeleted#e8b9bc3a as nil") } b.ObjStart() - b.PutID("updateChatOnlineMemberCount") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) + b.PutID("updateQuickReplyShortcutDeleted") b.Comma() - b.FieldStart("online_member_count") - b.PutInt32(u.OnlineMemberCount) + b.FieldStart("shortcut_id") + b.PutInt32(u.ShortcutID) b.Comma() b.StripComma() b.ObjEnd() @@ -9580,29 +10712,23 @@ func (u *UpdateChatOnlineMemberCount) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatOnlineMemberCount) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateQuickReplyShortcutDeleted) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatOnlineMemberCount#1d0caa9d to nil") + return fmt.Errorf("can't decode updateQuickReplyShortcutDeleted#e8b9bc3a to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatOnlineMemberCount"); err != nil { - return fmt.Errorf("unable to decode updateChatOnlineMemberCount#1d0caa9d: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatOnlineMemberCount#1d0caa9d: field chat_id: %w", err) + if err := b.ConsumeID("updateQuickReplyShortcutDeleted"); err != nil { + return fmt.Errorf("unable to decode updateQuickReplyShortcutDeleted#e8b9bc3a: %w", err) } - u.ChatID = value - case "online_member_count": + case "shortcut_id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode updateChatOnlineMemberCount#1d0caa9d: field online_member_count: %w", err) + return fmt.Errorf("unable to decode updateQuickReplyShortcutDeleted#e8b9bc3a: field shortcut_id: %w", err) } - u.OnlineMemberCount = value + u.ShortcutID = value default: return b.Skip() } @@ -9610,49 +10736,41 @@ func (u *UpdateChatOnlineMemberCount) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetChatID returns value of ChatID field. -func (u *UpdateChatOnlineMemberCount) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetOnlineMemberCount returns value of OnlineMemberCount field. -func (u *UpdateChatOnlineMemberCount) GetOnlineMemberCount() (value int32) { +// GetShortcutID returns value of ShortcutID field. +func (u *UpdateQuickReplyShortcutDeleted) GetShortcutID() (value int32) { if u == nil { return } - return u.OnlineMemberCount + return u.ShortcutID } -// UpdateSavedMessagesTopic represents TL type `updateSavedMessagesTopic#9f823b30`. -type UpdateSavedMessagesTopic struct { - // New data about the topic - Topic SavedMessagesTopic +// UpdateQuickReplyShortcuts represents TL type `updateQuickReplyShortcuts#77d31a6a`. +type UpdateQuickReplyShortcuts struct { + // The new list of identifiers of quick reply shortcuts + ShortcutIDs []int32 } -// UpdateSavedMessagesTopicTypeID is TL type id of UpdateSavedMessagesTopic. -const UpdateSavedMessagesTopicTypeID = 0x9f823b30 +// UpdateQuickReplyShortcutsTypeID is TL type id of UpdateQuickReplyShortcuts. +const UpdateQuickReplyShortcutsTypeID = 0x77d31a6a // construct implements constructor of UpdateClass. -func (u UpdateSavedMessagesTopic) construct() UpdateClass { return &u } +func (u UpdateQuickReplyShortcuts) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateSavedMessagesTopic. +// Ensuring interfaces in compile-time for UpdateQuickReplyShortcuts. var ( - _ bin.Encoder = &UpdateSavedMessagesTopic{} - _ bin.Decoder = &UpdateSavedMessagesTopic{} - _ bin.BareEncoder = &UpdateSavedMessagesTopic{} - _ bin.BareDecoder = &UpdateSavedMessagesTopic{} + _ bin.Encoder = &UpdateQuickReplyShortcuts{} + _ bin.Decoder = &UpdateQuickReplyShortcuts{} + _ bin.BareEncoder = &UpdateQuickReplyShortcuts{} + _ bin.BareDecoder = &UpdateQuickReplyShortcuts{} - _ UpdateClass = &UpdateSavedMessagesTopic{} + _ UpdateClass = &UpdateQuickReplyShortcuts{} ) -func (u *UpdateSavedMessagesTopic) Zero() bool { +func (u *UpdateQuickReplyShortcuts) Zero() bool { if u == nil { return true } - if !(u.Topic.Zero()) { + if !(u.ShortcutIDs == nil) { return false } @@ -9660,31 +10778,31 @@ func (u *UpdateSavedMessagesTopic) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateSavedMessagesTopic) String() string { +func (u *UpdateQuickReplyShortcuts) String() string { if u == nil { - return "UpdateSavedMessagesTopic(nil)" + return "UpdateQuickReplyShortcuts(nil)" } - type Alias UpdateSavedMessagesTopic - return fmt.Sprintf("UpdateSavedMessagesTopic%+v", Alias(*u)) + type Alias UpdateQuickReplyShortcuts + return fmt.Sprintf("UpdateQuickReplyShortcuts%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateSavedMessagesTopic) TypeID() uint32 { - return UpdateSavedMessagesTopicTypeID +func (*UpdateQuickReplyShortcuts) TypeID() uint32 { + return UpdateQuickReplyShortcutsTypeID } // TypeName returns name of type in TL schema. -func (*UpdateSavedMessagesTopic) TypeName() string { - return "updateSavedMessagesTopic" +func (*UpdateQuickReplyShortcuts) TypeName() string { + return "updateQuickReplyShortcuts" } // TypeInfo returns info about TL type. -func (u *UpdateSavedMessagesTopic) TypeInfo() tdp.Type { +func (u *UpdateQuickReplyShortcuts) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateSavedMessagesTopic", - ID: UpdateSavedMessagesTopicTypeID, + Name: "updateQuickReplyShortcuts", + ID: UpdateQuickReplyShortcutsTypeID, } if u == nil { typ.Null = true @@ -9692,69 +10810,86 @@ func (u *UpdateSavedMessagesTopic) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "Topic", - SchemaName: "topic", + Name: "ShortcutIDs", + SchemaName: "shortcut_ids", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateSavedMessagesTopic) Encode(b *bin.Buffer) error { +func (u *UpdateQuickReplyShortcuts) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateSavedMessagesTopic#9f823b30 as nil") + return fmt.Errorf("can't encode updateQuickReplyShortcuts#77d31a6a as nil") } - b.PutID(UpdateSavedMessagesTopicTypeID) + b.PutID(UpdateQuickReplyShortcutsTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateSavedMessagesTopic) EncodeBare(b *bin.Buffer) error { +func (u *UpdateQuickReplyShortcuts) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateSavedMessagesTopic#9f823b30 as nil") + return fmt.Errorf("can't encode updateQuickReplyShortcuts#77d31a6a as nil") } - if err := u.Topic.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateSavedMessagesTopic#9f823b30: field topic: %w", err) + b.PutInt(len(u.ShortcutIDs)) + for _, v := range u.ShortcutIDs { + b.PutInt32(v) } return nil } // Decode implements bin.Decoder. -func (u *UpdateSavedMessagesTopic) Decode(b *bin.Buffer) error { +func (u *UpdateQuickReplyShortcuts) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateSavedMessagesTopic#9f823b30 to nil") + return fmt.Errorf("can't decode updateQuickReplyShortcuts#77d31a6a to nil") } - if err := b.ConsumeID(UpdateSavedMessagesTopicTypeID); err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTopic#9f823b30: %w", err) + if err := b.ConsumeID(UpdateQuickReplyShortcutsTypeID); err != nil { + return fmt.Errorf("unable to decode updateQuickReplyShortcuts#77d31a6a: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateSavedMessagesTopic) DecodeBare(b *bin.Buffer) error { +func (u *UpdateQuickReplyShortcuts) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateSavedMessagesTopic#9f823b30 to nil") + return fmt.Errorf("can't decode updateQuickReplyShortcuts#77d31a6a to nil") } { - if err := u.Topic.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTopic#9f823b30: field topic: %w", err) + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateQuickReplyShortcuts#77d31a6a: field shortcut_ids: %w", err) + } + + if headerLen > 0 { + u.ShortcutIDs = 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 updateQuickReplyShortcuts#77d31a6a: field shortcut_ids: %w", err) + } + u.ShortcutIDs = append(u.ShortcutIDs, value) } } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateSavedMessagesTopic) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateQuickReplyShortcuts) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateSavedMessagesTopic#9f823b30 as nil") + return fmt.Errorf("can't encode updateQuickReplyShortcuts#77d31a6a as nil") } b.ObjStart() - b.PutID("updateSavedMessagesTopic") + b.PutID("updateQuickReplyShortcuts") b.Comma() - b.FieldStart("topic") - if err := u.Topic.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateSavedMessagesTopic#9f823b30: field topic: %w", err) + b.FieldStart("shortcut_ids") + b.ArrStart() + for _, v := range u.ShortcutIDs { + b.PutInt32(v) + b.Comma() } + b.StripComma() + b.ArrEnd() b.Comma() b.StripComma() b.ObjEnd() @@ -9762,20 +10897,27 @@ func (u *UpdateSavedMessagesTopic) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateSavedMessagesTopic) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateQuickReplyShortcuts) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateSavedMessagesTopic#9f823b30 to nil") + return fmt.Errorf("can't decode updateQuickReplyShortcuts#77d31a6a to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateSavedMessagesTopic"); err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTopic#9f823b30: %w", err) + if err := b.ConsumeID("updateQuickReplyShortcuts"); err != nil { + return fmt.Errorf("unable to decode updateQuickReplyShortcuts#77d31a6a: %w", err) } - case "topic": - if err := u.Topic.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTopic#9f823b30: field topic: %w", err) + case "shortcut_ids": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateQuickReplyShortcuts#77d31a6a: field shortcut_ids: %w", err) + } + u.ShortcutIDs = append(u.ShortcutIDs, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode updateQuickReplyShortcuts#77d31a6a: field shortcut_ids: %w", err) } default: return b.Skip() @@ -9784,41 +10926,47 @@ func (u *UpdateSavedMessagesTopic) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetTopic returns value of Topic field. -func (u *UpdateSavedMessagesTopic) GetTopic() (value SavedMessagesTopic) { +// GetShortcutIDs returns value of ShortcutIDs field. +func (u *UpdateQuickReplyShortcuts) GetShortcutIDs() (value []int32) { if u == nil { return } - return u.Topic + return u.ShortcutIDs } -// UpdateSavedMessagesTopicCount represents TL type `updateSavedMessagesTopicCount#fbd279d1`. -type UpdateSavedMessagesTopicCount struct { - // Approximate total number of Saved Messages topics - TopicCount int32 +// UpdateQuickReplyShortcutMessages represents TL type `updateQuickReplyShortcutMessages#8bb36b72`. +type UpdateQuickReplyShortcutMessages struct { + // The identifier of the shortcut + ShortcutID int32 + // The new list of quick reply messages for the shortcut in order from the first to the + // last sent + Messages []QuickReplyMessage } -// UpdateSavedMessagesTopicCountTypeID is TL type id of UpdateSavedMessagesTopicCount. -const UpdateSavedMessagesTopicCountTypeID = 0xfbd279d1 +// UpdateQuickReplyShortcutMessagesTypeID is TL type id of UpdateQuickReplyShortcutMessages. +const UpdateQuickReplyShortcutMessagesTypeID = 0x8bb36b72 // construct implements constructor of UpdateClass. -func (u UpdateSavedMessagesTopicCount) construct() UpdateClass { return &u } +func (u UpdateQuickReplyShortcutMessages) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateSavedMessagesTopicCount. +// Ensuring interfaces in compile-time for UpdateQuickReplyShortcutMessages. var ( - _ bin.Encoder = &UpdateSavedMessagesTopicCount{} - _ bin.Decoder = &UpdateSavedMessagesTopicCount{} - _ bin.BareEncoder = &UpdateSavedMessagesTopicCount{} - _ bin.BareDecoder = &UpdateSavedMessagesTopicCount{} + _ bin.Encoder = &UpdateQuickReplyShortcutMessages{} + _ bin.Decoder = &UpdateQuickReplyShortcutMessages{} + _ bin.BareEncoder = &UpdateQuickReplyShortcutMessages{} + _ bin.BareDecoder = &UpdateQuickReplyShortcutMessages{} - _ UpdateClass = &UpdateSavedMessagesTopicCount{} + _ UpdateClass = &UpdateQuickReplyShortcutMessages{} ) -func (u *UpdateSavedMessagesTopicCount) Zero() bool { +func (u *UpdateQuickReplyShortcutMessages) Zero() bool { if u == nil { return true } - if !(u.TopicCount == 0) { + if !(u.ShortcutID == 0) { + return false + } + if !(u.Messages == nil) { return false } @@ -9826,31 +10974,31 @@ func (u *UpdateSavedMessagesTopicCount) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateSavedMessagesTopicCount) String() string { +func (u *UpdateQuickReplyShortcutMessages) String() string { if u == nil { - return "UpdateSavedMessagesTopicCount(nil)" + return "UpdateQuickReplyShortcutMessages(nil)" } - type Alias UpdateSavedMessagesTopicCount - return fmt.Sprintf("UpdateSavedMessagesTopicCount%+v", Alias(*u)) + type Alias UpdateQuickReplyShortcutMessages + return fmt.Sprintf("UpdateQuickReplyShortcutMessages%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateSavedMessagesTopicCount) TypeID() uint32 { - return UpdateSavedMessagesTopicCountTypeID +func (*UpdateQuickReplyShortcutMessages) TypeID() uint32 { + return UpdateQuickReplyShortcutMessagesTypeID } // TypeName returns name of type in TL schema. -func (*UpdateSavedMessagesTopicCount) TypeName() string { - return "updateSavedMessagesTopicCount" +func (*UpdateQuickReplyShortcutMessages) TypeName() string { + return "updateQuickReplyShortcutMessages" } // TypeInfo returns info about TL type. -func (u *UpdateSavedMessagesTopicCount) TypeInfo() tdp.Type { +func (u *UpdateQuickReplyShortcutMessages) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateSavedMessagesTopicCount", - ID: UpdateSavedMessagesTopicCountTypeID, + Name: "updateQuickReplyShortcutMessages", + ID: UpdateQuickReplyShortcutMessagesTypeID, } if u == nil { typ.Null = true @@ -9858,67 +11006,105 @@ func (u *UpdateSavedMessagesTopicCount) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "TopicCount", - SchemaName: "topic_count", + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + { + Name: "Messages", + SchemaName: "messages", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateSavedMessagesTopicCount) Encode(b *bin.Buffer) error { +func (u *UpdateQuickReplyShortcutMessages) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateSavedMessagesTopicCount#fbd279d1 as nil") + return fmt.Errorf("can't encode updateQuickReplyShortcutMessages#8bb36b72 as nil") } - b.PutID(UpdateSavedMessagesTopicCountTypeID) + b.PutID(UpdateQuickReplyShortcutMessagesTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateSavedMessagesTopicCount) EncodeBare(b *bin.Buffer) error { +func (u *UpdateQuickReplyShortcutMessages) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateSavedMessagesTopicCount#fbd279d1 as nil") + return fmt.Errorf("can't encode updateQuickReplyShortcutMessages#8bb36b72 as nil") + } + b.PutInt32(u.ShortcutID) + b.PutInt(len(u.Messages)) + for idx, v := range u.Messages { + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare updateQuickReplyShortcutMessages#8bb36b72: field messages element with index %d: %w", idx, err) + } } - b.PutInt32(u.TopicCount) return nil } // Decode implements bin.Decoder. -func (u *UpdateSavedMessagesTopicCount) Decode(b *bin.Buffer) error { +func (u *UpdateQuickReplyShortcutMessages) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateSavedMessagesTopicCount#fbd279d1 to nil") + return fmt.Errorf("can't decode updateQuickReplyShortcutMessages#8bb36b72 to nil") } - if err := b.ConsumeID(UpdateSavedMessagesTopicCountTypeID); err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTopicCount#fbd279d1: %w", err) + if err := b.ConsumeID(UpdateQuickReplyShortcutMessagesTypeID); err != nil { + return fmt.Errorf("unable to decode updateQuickReplyShortcutMessages#8bb36b72: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateSavedMessagesTopicCount) DecodeBare(b *bin.Buffer) error { +func (u *UpdateQuickReplyShortcutMessages) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateSavedMessagesTopicCount#fbd279d1 to nil") + return fmt.Errorf("can't decode updateQuickReplyShortcutMessages#8bb36b72 to nil") } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTopicCount#fbd279d1: field topic_count: %w", err) + return fmt.Errorf("unable to decode updateQuickReplyShortcutMessages#8bb36b72: field shortcut_id: %w", err) + } + u.ShortcutID = value + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateQuickReplyShortcutMessages#8bb36b72: field messages: %w", err) + } + + if headerLen > 0 { + u.Messages = make([]QuickReplyMessage, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value QuickReplyMessage + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare updateQuickReplyShortcutMessages#8bb36b72: field messages: %w", err) + } + u.Messages = append(u.Messages, value) } - u.TopicCount = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateSavedMessagesTopicCount) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateQuickReplyShortcutMessages) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateSavedMessagesTopicCount#fbd279d1 as nil") + return fmt.Errorf("can't encode updateQuickReplyShortcutMessages#8bb36b72 as nil") } b.ObjStart() - b.PutID("updateSavedMessagesTopicCount") + b.PutID("updateQuickReplyShortcutMessages") b.Comma() - b.FieldStart("topic_count") - b.PutInt32(u.TopicCount) + b.FieldStart("shortcut_id") + b.PutInt32(u.ShortcutID) + b.Comma() + b.FieldStart("messages") + b.ArrStart() + for idx, v := range u.Messages { + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateQuickReplyShortcutMessages#8bb36b72: field messages element with index %d: %w", idx, err) + } + b.Comma() + } + b.StripComma() + b.ArrEnd() b.Comma() b.StripComma() b.ObjEnd() @@ -9926,23 +11112,34 @@ func (u *UpdateSavedMessagesTopicCount) EncodeTDLibJSON(b tdjson.Encoder) error } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateSavedMessagesTopicCount) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateQuickReplyShortcutMessages) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateSavedMessagesTopicCount#fbd279d1 to nil") + return fmt.Errorf("can't decode updateQuickReplyShortcutMessages#8bb36b72 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateSavedMessagesTopicCount"); err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTopicCount#fbd279d1: %w", err) + if err := b.ConsumeID("updateQuickReplyShortcutMessages"); err != nil { + return fmt.Errorf("unable to decode updateQuickReplyShortcutMessages#8bb36b72: %w", err) } - case "topic_count": + case "shortcut_id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTopicCount#fbd279d1: field topic_count: %w", err) + return fmt.Errorf("unable to decode updateQuickReplyShortcutMessages#8bb36b72: field shortcut_id: %w", err) + } + u.ShortcutID = value + case "messages": + if err := b.Arr(func(b tdjson.Decoder) error { + var value QuickReplyMessage + if err := value.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode updateQuickReplyShortcutMessages#8bb36b72: field messages: %w", err) + } + u.Messages = append(u.Messages, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode updateQuickReplyShortcutMessages#8bb36b72: field messages: %w", err) } - u.TopicCount = value default: return b.Skip() } @@ -9950,12 +11147,20 @@ func (u *UpdateSavedMessagesTopicCount) DecodeTDLibJSON(b tdjson.Decoder) error }) } -// GetTopicCount returns value of TopicCount field. -func (u *UpdateSavedMessagesTopicCount) GetTopicCount() (value int32) { +// GetShortcutID returns value of ShortcutID field. +func (u *UpdateQuickReplyShortcutMessages) GetShortcutID() (value int32) { if u == nil { return } - return u.TopicCount + return u.ShortcutID +} + +// GetMessages returns value of Messages field. +func (u *UpdateQuickReplyShortcutMessages) GetMessages() (value []QuickReplyMessage) { + if u == nil { + return + } + return u.Messages } // UpdateForumTopicInfo represents TL type `updateForumTopicInfo#6b6f2cc9`. @@ -28542,6 +29747,8 @@ const UpdateClassName = "Update" // case *tdapi.UpdateChatPermissions: // updateChatPermissions#9f52176d // case *tdapi.UpdateChatLastMessage: // updateChatLastMessage#f10cab1d // case *tdapi.UpdateChatPosition: // updateChatPosition#ff76fa77 +// case *tdapi.UpdateChatAddedToList: // updateChatAddedToList#ab7004ec +// case *tdapi.UpdateChatRemovedFromList: // updateChatRemovedFromList#4d2ac21c // case *tdapi.UpdateChatReadInbox: // updateChatReadInbox#d07036e7 // case *tdapi.UpdateChatReadOutbox: // updateChatReadOutbox#2a385285 // case *tdapi.UpdateChatActionBar: // updateChatActionBar#d9a258c2 @@ -28565,10 +29772,14 @@ const UpdateClassName = "Update" // case *tdapi.UpdateChatViewAsTopics: // updateChatViewAsTopics#5bff163d // case *tdapi.UpdateChatBlockList: // updateChatBlockList#872af48e // case *tdapi.UpdateChatHasScheduledMessages: // updateChatHasScheduledMessages#7b14c2d7 -// case *tdapi.UpdateChatFolders: // updateChatFolders#71a4b3a +// case *tdapi.UpdateChatFolders: // updateChatFolders#e110242a // case *tdapi.UpdateChatOnlineMemberCount: // updateChatOnlineMemberCount#1d0caa9d // case *tdapi.UpdateSavedMessagesTopic: // updateSavedMessagesTopic#9f823b30 // case *tdapi.UpdateSavedMessagesTopicCount: // updateSavedMessagesTopicCount#fbd279d1 +// case *tdapi.UpdateQuickReplyShortcut: // updateQuickReplyShortcut#c69338cf +// case *tdapi.UpdateQuickReplyShortcutDeleted: // updateQuickReplyShortcutDeleted#e8b9bc3a +// case *tdapi.UpdateQuickReplyShortcuts: // updateQuickReplyShortcuts#77d31a6a +// case *tdapi.UpdateQuickReplyShortcutMessages: // updateQuickReplyShortcutMessages#8bb36b72 // case *tdapi.UpdateForumTopicInfo: // updateForumTopicInfo#6b6f2cc9 // case *tdapi.UpdateScopeNotificationSettings: // updateScopeNotificationSettings#b83ccb73 // case *tdapi.UpdateNotification: // updateNotification#8ee67ed4 @@ -28822,6 +30033,20 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case UpdateChatAddedToListTypeID: + // Decoding updateChatAddedToList#ab7004ec. + v := UpdateChatAddedToList{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case UpdateChatRemovedFromListTypeID: + // Decoding updateChatRemovedFromList#4d2ac21c. + v := UpdateChatRemovedFromList{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case UpdateChatReadInboxTypeID: // Decoding updateChatReadInbox#d07036e7. v := UpdateChatReadInbox{} @@ -28984,7 +30209,7 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { } return &v, nil case UpdateChatFoldersTypeID: - // Decoding updateChatFolders#71a4b3a. + // Decoding updateChatFolders#e110242a. v := UpdateChatFolders{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) @@ -29011,6 +30236,34 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case UpdateQuickReplyShortcutTypeID: + // Decoding updateQuickReplyShortcut#c69338cf. + v := UpdateQuickReplyShortcut{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case UpdateQuickReplyShortcutDeletedTypeID: + // Decoding updateQuickReplyShortcutDeleted#e8b9bc3a. + v := UpdateQuickReplyShortcutDeleted{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case UpdateQuickReplyShortcutsTypeID: + // Decoding updateQuickReplyShortcuts#77d31a6a. + v := UpdateQuickReplyShortcuts{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case UpdateQuickReplyShortcutMessagesTypeID: + // Decoding updateQuickReplyShortcutMessages#8bb36b72. + v := UpdateQuickReplyShortcutMessages{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case UpdateForumTopicInfoTypeID: // Decoding updateForumTopicInfo#6b6f2cc9. v := UpdateForumTopicInfo{} @@ -29737,6 +30990,20 @@ func DecodeTDLibJSONUpdate(buf tdjson.Decoder) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case "updateChatAddedToList": + // Decoding updateChatAddedToList#ab7004ec. + v := UpdateChatAddedToList{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case "updateChatRemovedFromList": + // Decoding updateChatRemovedFromList#4d2ac21c. + v := UpdateChatRemovedFromList{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case "updateChatReadInbox": // Decoding updateChatReadInbox#d07036e7. v := UpdateChatReadInbox{} @@ -29899,7 +31166,7 @@ func DecodeTDLibJSONUpdate(buf tdjson.Decoder) (UpdateClass, error) { } return &v, nil case "updateChatFolders": - // Decoding updateChatFolders#71a4b3a. + // Decoding updateChatFolders#e110242a. v := UpdateChatFolders{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) @@ -29926,6 +31193,34 @@ func DecodeTDLibJSONUpdate(buf tdjson.Decoder) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case "updateQuickReplyShortcut": + // Decoding updateQuickReplyShortcut#c69338cf. + v := UpdateQuickReplyShortcut{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case "updateQuickReplyShortcutDeleted": + // Decoding updateQuickReplyShortcutDeleted#e8b9bc3a. + v := UpdateQuickReplyShortcutDeleted{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case "updateQuickReplyShortcuts": + // Decoding updateQuickReplyShortcuts#77d31a6a. + v := UpdateQuickReplyShortcuts{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case "updateQuickReplyShortcutMessages": + // Decoding updateQuickReplyShortcutMessages#8bb36b72. + v := UpdateQuickReplyShortcutMessages{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case "updateForumTopicInfo": // Decoding updateForumTopicInfo#6b6f2cc9. v := UpdateForumTopicInfo{} diff --git a/tdapi/tl_user_full_info_gen.go b/tdapi/tl_user_full_info_gen.go index aa173de521..c34965ed67 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#cc594e6f`. +// UserFullInfo represents TL type `userFullInfo#760faed8`. 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. @@ -69,12 +69,15 @@ type UserFullInfo struct { // Number of group chats where both the other user and the current user are a member; 0 // for the current user GroupInCommonCount int32 + // Information about business settings for Telegram Business accounts; may be null if + // none + BusinessInfo BusinessInfo // For bots, information about the bot; may be null if the user isn't a bot BotInfo BotInfo } // UserFullInfoTypeID is TL type id of UserFullInfo. -const UserFullInfoTypeID = 0xcc594e6f +const UserFullInfoTypeID = 0x760faed8 // Ensuring interfaces in compile-time for UserFullInfo. var ( @@ -133,6 +136,9 @@ func (u *UserFullInfo) Zero() bool { if !(u.GroupInCommonCount == 0) { return false } + if !(u.BusinessInfo.Zero()) { + return false + } if !(u.BotInfo.Zero()) { return false } @@ -232,6 +238,10 @@ func (u *UserFullInfo) TypeInfo() tdp.Type { Name: "GroupInCommonCount", SchemaName: "group_in_common_count", }, + { + Name: "BusinessInfo", + SchemaName: "business_info", + }, { Name: "BotInfo", SchemaName: "bot_info", @@ -243,7 +253,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#cc594e6f as nil") + return fmt.Errorf("can't encode userFullInfo#760faed8 as nil") } b.PutID(UserFullInfoTypeID) return u.EncodeBare(b) @@ -252,22 +262,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#cc594e6f as nil") + return fmt.Errorf("can't encode userFullInfo#760faed8 as nil") } if err := u.PersonalPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field personal_photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#760faed8: field personal_photo: %w", err) } if err := u.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#760faed8: field photo: %w", err) } if err := u.PublicPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field public_photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#760faed8: field public_photo: %w", err) } if u.BlockList == nil { - return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field block_list is nil") + return fmt.Errorf("unable to encode userFullInfo#760faed8: field block_list is nil") } if err := u.BlockList.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field block_list: %w", err) + return fmt.Errorf("unable to encode userFullInfo#760faed8: field block_list: %w", err) } b.PutBool(u.CanBeCalled) b.PutBool(u.SupportsVideoCalls) @@ -278,17 +288,20 @@ func (u *UserFullInfo) EncodeBare(b *bin.Buffer) error { b.PutBool(u.NeedPhoneNumberPrivacyException) b.PutBool(u.SetChatBackground) if err := u.Bio.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field bio: %w", err) + return fmt.Errorf("unable to encode userFullInfo#760faed8: 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#cc594e6f: field premium_gift_options element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare userFullInfo#760faed8: field premium_gift_options element with index %d: %w", idx, err) } } b.PutInt32(u.GroupInCommonCount) + if err := u.BusinessInfo.Encode(b); err != nil { + return fmt.Errorf("unable to encode userFullInfo#760faed8: field business_info: %w", err) + } if err := u.BotInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field bot_info: %w", err) + return fmt.Errorf("unable to encode userFullInfo#760faed8: field bot_info: %w", err) } return nil } @@ -296,10 +309,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#cc594e6f to nil") + return fmt.Errorf("can't decode userFullInfo#760faed8 to nil") } if err := b.ConsumeID(UserFullInfoTypeID); err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: %w", err) } return u.DecodeBare(b) } @@ -307,95 +320,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#cc594e6f to nil") + return fmt.Errorf("can't decode userFullInfo#760faed8 to nil") } { if err := u.PersonalPhoto.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field personal_photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: field personal_photo: %w", err) } } { if err := u.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: field photo: %w", err) } } { if err := u.PublicPhoto.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field public_photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: field public_photo: %w", err) } } { value, err := DecodeBlockList(b) if err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field block_list: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: field block_list: %w", err) } u.BlockList = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field can_be_called: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: field can_be_called: %w", err) } u.CanBeCalled = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field supports_video_calls: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: field supports_video_calls: %w", err) } u.SupportsVideoCalls = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field has_private_calls: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: field has_private_calls: %w", err) } u.HasPrivateCalls = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field has_private_forwards: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: field has_private_forwards: %w", err) } u.HasPrivateForwards = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field has_restricted_voice_and_video_note_messages: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: 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#cc594e6f: field has_pinned_stories: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: field has_pinned_stories: %w", err) } u.HasPinnedStories = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field need_phone_number_privacy_exception: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: 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) + return fmt.Errorf("unable to decode userFullInfo#760faed8: field set_chat_background: %w", err) } u.SetChatBackground = value } { if err := u.Bio.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field bio: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: field bio: %w", err) } } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field premium_gift_options: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: field premium_gift_options: %w", err) } if headerLen > 0 { @@ -404,7 +417,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#cc594e6f: field premium_gift_options: %w", err) + return fmt.Errorf("unable to decode bare userFullInfo#760faed8: field premium_gift_options: %w", err) } u.PremiumGiftOptions = append(u.PremiumGiftOptions, value) } @@ -412,13 +425,18 @@ func (u *UserFullInfo) DecodeBare(b *bin.Buffer) error { { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field group_in_common_count: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: field group_in_common_count: %w", err) } u.GroupInCommonCount = value } + { + if err := u.BusinessInfo.Decode(b); err != nil { + return fmt.Errorf("unable to decode userFullInfo#760faed8: field business_info: %w", err) + } + } { if err := u.BotInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field bot_info: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: field bot_info: %w", err) } } return nil @@ -427,32 +445,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#cc594e6f as nil") + return fmt.Errorf("can't encode userFullInfo#760faed8 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#cc594e6f: field personal_photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#760faed8: 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#cc594e6f: field photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#760faed8: 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#cc594e6f: field public_photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#760faed8: field public_photo: %w", err) } b.Comma() b.FieldStart("block_list") if u.BlockList == nil { - return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field block_list is nil") + return fmt.Errorf("unable to encode userFullInfo#760faed8: field block_list is nil") } if err := u.BlockList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field block_list: %w", err) + return fmt.Errorf("unable to encode userFullInfo#760faed8: field block_list: %w", err) } b.Comma() b.FieldStart("can_be_called") @@ -481,14 +499,14 @@ func (u *UserFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("bio") if err := u.Bio.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field bio: %w", err) + return fmt.Errorf("unable to encode userFullInfo#760faed8: 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#cc594e6f: field premium_gift_options element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode userFullInfo#760faed8: field premium_gift_options element with index %d: %w", idx, err) } b.Comma() } @@ -498,9 +516,14 @@ func (u *UserFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("group_in_common_count") b.PutInt32(u.GroupInCommonCount) b.Comma() + b.FieldStart("business_info") + if err := u.BusinessInfo.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode userFullInfo#760faed8: field business_info: %w", err) + } + b.Comma() b.FieldStart("bot_info") if err := u.BotInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#cc594e6f: field bot_info: %w", err) + return fmt.Errorf("unable to encode userFullInfo#760faed8: field bot_info: %w", err) } b.Comma() b.StripComma() @@ -511,105 +534,109 @@ 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#cc594e6f to nil") + return fmt.Errorf("can't decode userFullInfo#760faed8 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#cc594e6f: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: %w", err) } case "personal_photo": if err := u.PersonalPhoto.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field personal_photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: field personal_photo: %w", err) } case "photo": if err := u.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: field photo: %w", err) } case "public_photo": if err := u.PublicPhoto.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field public_photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: field public_photo: %w", err) } case "block_list": value, err := DecodeTDLibJSONBlockList(b) if err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field block_list: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: 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#cc594e6f: field can_be_called: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: 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#cc594e6f: field supports_video_calls: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: 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#cc594e6f: field has_private_calls: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: 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#cc594e6f: field has_private_forwards: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: 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#cc594e6f: field has_restricted_voice_and_video_note_messages: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: 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#cc594e6f: field has_pinned_stories: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: 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#cc594e6f: field need_phone_number_privacy_exception: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: 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) + return fmt.Errorf("unable to decode userFullInfo#760faed8: 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#cc594e6f: field bio: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: 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#cc594e6f: field premium_gift_options: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: field premium_gift_options: %w", err) } u.PremiumGiftOptions = append(u.PremiumGiftOptions, value) return nil }); err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field premium_gift_options: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: 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#cc594e6f: field group_in_common_count: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: field group_in_common_count: %w", err) } u.GroupInCommonCount = value + case "business_info": + if err := u.BusinessInfo.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode userFullInfo#760faed8: field business_info: %w", err) + } case "bot_info": if err := u.BotInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#cc594e6f: field bot_info: %w", err) + return fmt.Errorf("unable to decode userFullInfo#760faed8: field bot_info: %w", err) } default: return b.Skip() @@ -738,6 +765,14 @@ func (u *UserFullInfo) GetGroupInCommonCount() (value int32) { return u.GroupInCommonCount } +// GetBusinessInfo returns value of BusinessInfo field. +func (u *UserFullInfo) GetBusinessInfo() (value BusinessInfo) { + if u == nil { + return + } + return u.BusinessInfo +} + // GetBotInfo returns value of BotInfo field. func (u *UserFullInfo) GetBotInfo() (value BotInfo) { if u == nil {