From 3a4e97c4671f4bcb8906fca14ad5d3e66ec0abce Mon Sep 17 00:00:00 2001 From: GitHub Date: Tue, 7 May 2024 07:44:57 +0000 Subject: [PATCH] feat(schema): update TDLib to the latest layer --- _schema/tdapi.tl | 296 ++-- ..._quick_reply_shortcut_message_album_gen.go | 305 ++++ tdapi/tl_authentication_code_type_gen.go | 362 +++++ tdapi/tl_background_fill_gen.go | 2 +- tdapi/tl_business_info_gen.go | 165 ++- .../tl_business_opening_hours_interval_gen.go | 6 +- tdapi/tl_chat_administrator_rights_gen.go | 5 +- tdapi/tl_chat_available_reactions_gen.go | 142 +- tdapi/tl_chat_revenue_amount_gen.go | 297 ++++ tdapi/tl_chat_revenue_statistics_gen.go | 194 +-- tdapi/tl_delete_account_gen.go | 5 +- ...l_edit_inline_message_live_location_gen.go | 89 +- tdapi/tl_edit_message_live_location_gen.go | 93 +- tdapi/tl_emoji_category_gen.go | 132 +- tdapi/tl_emoji_category_source_gen.go | 490 +++++++ tdapi/tl_emoji_category_type_gen.go | 146 ++ tdapi/tl_get_chat_pinned_stories_gen.go | 272 ---- ...et_chat_posted_to_chat_page_stories_gen.go | 272 ++++ tdapi/tl_get_recommended_chats_gen.go | 169 +++ tdapi/tl_hide_contact_close_birthdays_gen.go | 169 +++ tdapi/tl_input_message_content_gen.go | 126 +- tdapi/tl_message_content_gen.go | 15 +- tdapi/tl_message_sponsor_gen.go | 82 +- tdapi/tl_message_sponsor_type_gen.go | 1245 ----------------- ...hone_number_authentication_settings_gen.go | 91 +- tdapi/tl_poll_gen.go | 112 +- tdapi/tl_poll_option_gen.go | 64 +- .../tl_reaction_notification_settings_gen.go | 315 +++++ tdapi/tl_reaction_notification_source_gen.go | 577 ++++++++ tdapi/tl_registry_gen.go | 152 +- ..._report_authentication_code_missing_gen.go | 206 +++ ...tl_report_phone_number_code_missing_gen.go | 206 +++ tdapi/tl_search_messages_gen.go | 100 +- tdapi/tl_send_story_gen.go | 112 +- tdapi/tl_set_chat_pinned_stories_gen.go | 262 ++++ ..._set_reaction_notification_settings_gen.go | 206 +++ tdapi/tl_sponsored_message_gen.go | 164 ++- tdapi/tl_stories_gen.go | 95 +- tdapi/tl_story_gen.go | 222 +-- tdapi/tl_suggested_action_gen.go | 181 +++ ...ggle_has_sponsored_messages_enabled_gen.go | 206 +++ tdapi/tl_toggle_story_is_pinned_gen.go | 271 ---- ...toggle_story_is_posted_to_chat_page_gen.go | 271 ++++ tdapi/tl_update_gen.go | 428 +++++- tdapi/tl_user_full_info_gen.go | 202 +-- tdapi/tl_voice_note_gen.go | 3 +- tdapi/tl_web_page_gen.go | 226 +-- 47 files changed, 6795 insertions(+), 2956 deletions(-) create mode 100644 tdapi/tl_add_quick_reply_shortcut_message_album_gen.go create mode 100644 tdapi/tl_chat_revenue_amount_gen.go create mode 100644 tdapi/tl_emoji_category_source_gen.go delete mode 100644 tdapi/tl_get_chat_pinned_stories_gen.go create mode 100644 tdapi/tl_get_chat_posted_to_chat_page_stories_gen.go create mode 100644 tdapi/tl_get_recommended_chats_gen.go create mode 100644 tdapi/tl_hide_contact_close_birthdays_gen.go delete mode 100644 tdapi/tl_message_sponsor_type_gen.go create mode 100644 tdapi/tl_reaction_notification_settings_gen.go create mode 100644 tdapi/tl_reaction_notification_source_gen.go create mode 100644 tdapi/tl_report_authentication_code_missing_gen.go create mode 100644 tdapi/tl_report_phone_number_code_missing_gen.go create mode 100644 tdapi/tl_set_chat_pinned_stories_gen.go create mode 100644 tdapi/tl_set_reaction_notification_settings_gen.go create mode 100644 tdapi/tl_toggle_has_sponsored_messages_enabled_gen.go delete mode 100644 tdapi/tl_toggle_story_is_pinned_gen.go create mode 100644 tdapi/tl_toggle_story_is_posted_to_chat_page_gen.go diff --git a/_schema/tdapi.tl b/_schema/tdapi.tl index b4d30e2d2f..d88513782d 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: 98134ff7102f7b9a5bfbbc5de72332a6fab03916b027e8eb6dc25892a4290676 +// SHA256: 5a9bcc0dc3e580c2f0558b6063133d899bde0c6da9d772c5c23a52a1a2d1e238 double#2210c154 ? = Double; @@ -29,15 +29,23 @@ ok#d4edbe69 = Ok; //@class AuthenticationCodeType @description Provides information about the method by which an authentication code is delivered to the user -//@description An authentication code is delivered via a private Telegram message, which can be viewed from another active session +//@description A digit-only authentication code is delivered via a private Telegram message, which can be viewed from another active session //@length Length of the code authenticationCodeTypeTelegramMessage#7bf49b2a length:int32 = AuthenticationCodeType; -//@description An authentication code is delivered via an SMS message to the specified phone number; applications may not receive this type of code +//@description A digit-only authentication code is delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code //@length Length of the code authenticationCodeTypeSms#3960e288 length:int32 = AuthenticationCodeType; -//@description An authentication code is delivered via a phone call to the specified phone number +//@description An authentication code is a word delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code +//@first_letter The first letters of the word if known +authenticationCodeTypeSmsWord#a6063c63 first_letter:string = AuthenticationCodeType; + +//@description An authentication code is a phrase from multiple words delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code +//@first_word The first word of the phrase if known +authenticationCodeTypeSmsPhrase#2ebc8cd1 first_word:string = AuthenticationCodeType; + +//@description A digit-only authentication code is delivered via a phone call to the specified phone number //@length Length of the code authenticationCodeTypeCall#61876c67 length:int32 = AuthenticationCodeType; @@ -50,17 +58,17 @@ authenticationCodeTypeFlashCall#533379a2 pattern:string = AuthenticationCodeType //@length Number of digits in the code, excluding the prefix authenticationCodeTypeMissedCall#29bb0a87 phone_number_prefix:string length:int32 = AuthenticationCodeType; -//@description An authentication code is delivered to https://fragment.com. The user must be logged in there via a wallet owning the phone number's NFT +//@description A digit-only authentication code is delivered to https://fragment.com. The user must be logged in there via a wallet owning the phone number's NFT //@url URL to open to receive the code //@length Length of the code authenticationCodeTypeFragment#810f74cd url:string length:int32 = AuthenticationCodeType; -//@description An authentication code is delivered via Firebase Authentication to the official Android application +//@description A digit-only authentication code is delivered via Firebase Authentication to the official Android application //@nonce Nonce to pass to the SafetyNet Attestation API //@length Length of the code authenticationCodeTypeFirebaseAndroid#8a118819 nonce:bytes length:int32 = AuthenticationCodeType; -//@description An authentication code is delivered via Firebase Authentication to the official iOS application +//@description A digit-only authentication code is delivered via Firebase Authentication to the official iOS application //@receipt Receipt of successful application token validation to compare with receipt from push notification //@push_timeout Time after the next authentication method is supposed to be used if verification push notification isn't received, in seconds //@length Length of the code @@ -347,12 +355,12 @@ stickerFullTypeCustomEmoji#c37f05ab custom_emoji_id:int64 needs_repainting:Bool closedVectorPath#2f9276b9 commands:vector = ClosedVectorPath; //@description Describes one answer option of a poll -//@text Option text; 1-100 characters +//@text Option text; 1-100 characters. Only custom emoji entities are allowed //@voter_count Number of voters for this option, available only for closed or voted polls //@vote_percentage The percentage of votes for this option; 0-100 //@is_chosen True, if the option was chosen by the user //@is_being_chosen True, if the option is being chosen by a pending setPollAnswer request -pollOption#57d9d5a5 text:string voter_count:int32 vote_percentage:int32 is_chosen:Bool is_being_chosen:Bool = PollOption; +pollOption#63e97090 text:formattedText voter_count:int32 vote_percentage:int32 is_chosen:Bool is_being_chosen:Bool = PollOption; //@class PollType @description Describes the type of poll @@ -439,10 +447,10 @@ video#31a460cc duration:int32 width:int32 height:int32 file_name:string mime_typ //@video File containing the video videoNote#7ae918c5 duration:int32 waveform:bytes length:int32 minithumbnail:minithumbnail thumbnail:thumbnail speech_recognition_result:SpeechRecognitionResult video:file = VideoNote; -//@description Describes a voice note. The voice note must be encoded with the Opus codec, and stored inside an OGG container. Voice notes can have only a single audio channel +//@description Describes a voice note //@duration Duration of the voice note, in seconds; as defined by the sender //@waveform A waveform representation of the voice note in 5-bit format -//@mime_type MIME type of the file; as defined by the sender +//@mime_type MIME type of the file; as defined by the sender. Usually, one of "audio/ogg" for Opus in an OGG container, "audio/mpeg" for an MP3 audio, or "audio/mp4" for an M4A audio //@speech_recognition_result Result of speech recognition in the voice note; may be null //@voice File containing the voice note voiceNote#b9f24cf5 duration:int32 waveform:bytes mime_type:string speech_recognition_result:SpeechRecognitionResult voice:file = VoiceNote; @@ -498,7 +506,7 @@ webApp#605ba8f3 short_name:string title:string description:string photo:photo an //@description Describes a poll //@id Unique poll identifier -//@question Poll question; 1-300 characters +//@question Poll question; 1-300 characters. Only custom emoji entities are allowed //@options List of poll answer options //@total_voter_count Total number of voters, participating in the poll //@recent_voter_ids Identifiers of recent voters, if the poll is non-anonymous @@ -507,7 +515,7 @@ webApp#605ba8f3 short_name:string title:string description:string photo:photo an //@open_period Amount of time the poll will be active after creation, in seconds //@close_date Point in time (Unix timestamp) when the poll will automatically be closed //@is_closed True, if the poll is closed -poll#8c34a82a id:int64 question:string options:vector total_voter_count:int32 recent_voter_ids:vector is_anonymous:Bool type:PollType open_period:int32 close_date:int32 is_closed:Bool = Poll; +poll#71d4870c id:int64 question:formattedText options:vector total_voter_count:int32 recent_voter_ids:vector is_anonymous:Bool type:PollType open_period:int32 close_date:int32 is_closed:Bool = Poll; //@description Describes a chat background //@id Unique background identifier @@ -657,8 +665,8 @@ businessStartPage#9fa2f7cf title:string message:string sticker:sticker = Busines inputBusinessStartPage#ec7c87e0 title:string message:string sticker:InputFile = InputBusinessStartPage; //@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 +//@start_minute The minute's sequence number in a week, starting on Monday, marking the start of the time interval during which the business is open; 0-7*24*60 +//@end_minute The minute's sequence number in a week, starting on Monday, marking the end of the time interval during which the business is open; 1-8*24*60 businessOpeningHoursInterval#bdf05654 start_minute:int32 end_minute:int32 = BusinessOpeningHoursInterval; //@description Describes opening hours of a business @@ -669,10 +677,13 @@ businessOpeningHours#a623e64a time_zone_id:string opening_hours:vector group_in_common_count:int32 business_info:businessInfo bot_info:botInfo = UserFullInfo; +userFullInfo#b61c9c5 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_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 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 @@ -1581,38 +1593,11 @@ messageSourceScreenshot#1c035d0a = MessageSource; //@description The message is from some other source messageSourceOther#35c0a702 = MessageSource; -//@class MessageSponsorType @description Describes type of message sponsor - -//@description The sponsor is a bot -//@bot_user_id User identifier of the bot -//@link An internal link to be opened when the sponsored message is clicked -messageSponsorTypeBot#700d2304 bot_user_id:int53 link:InternalLinkType = MessageSponsorType; - -//@description The sponsor is a web app -//@web_app_title Web App title -//@link An internal link to be opened when the sponsored message is clicked -messageSponsorTypeWebApp#25b74fb8 web_app_title:string link:InternalLinkType = MessageSponsorType; - -//@description The sponsor is a public channel chat -//@chat_id Sponsor chat identifier -//@link An internal link to be opened when the sponsored message is clicked; may be null if the sponsor chat needs to be opened instead -messageSponsorTypePublicChannel#ed645a47 chat_id:int53 link:InternalLinkType = MessageSponsorType; - -//@description The sponsor is a private channel chat -//@title Title of the chat -//@invite_link Invite link for the channel -messageSponsorTypePrivateChannel#74d245a8 title:string invite_link:string = MessageSponsorType; - -//@description The sponsor is a website -//@url URL of the website -//@name Name of the website -messageSponsorTypeWebsite#a4e45f9b url:string name:string = MessageSponsorType; - //@description Information about the sponsor of a message -//@type Type of the sponsor +//@url URL of the sponsor to be opened when the message is clicked //@photo Photo of the sponsor; may be null if must not be shown //@info Additional optional information about the sponsor to be shown along with the message -messageSponsor#a0b25071 type:MessageSponsorType photo:chatPhotoInfo info:string = MessageSponsor; +messageSponsor#77c251de url:string photo:photo info:string = MessageSponsor; //@description Describes a sponsored message //@message_id Message identifier; unique for the chat to which the sponsored message belongs among both ordinary and sponsored messages @@ -1620,9 +1605,12 @@ messageSponsor#a0b25071 type:MessageSponsorType photo:chatPhotoInfo info:string //@can_be_reported True, if the message can be reported to Telegram moderators through reportChatSponsoredMessage //@content Content of the message. Currently, can be only of the type messageText //@sponsor Information about the sponsor of the message -//@button_text If non-empty, text for the message action button +//@title Title of the sponsored message +//@button_text Text for the message action button +//@accent_color_id Identifier of the accent color for title, button text and message background +//@background_custom_emoji_id Identifier of a custom emoji to be shown on the message background; 0 if none //@additional_info If non-empty, additional information about the sponsored message to be shown along with the message -sponsoredMessage#3748e46f message_id:int53 is_recommended:Bool can_be_reported:Bool content:MessageContent sponsor:messageSponsor button_text:string additional_info:string = SponsoredMessage; +sponsoredMessage#b78d4c25 message_id:int53 is_recommended:Bool can_be_reported:Bool content:MessageContent sponsor:messageSponsor title:string button_text:string accent_color_id:int32 background_custom_emoji_id:int64 additional_info:string = SponsoredMessage; //@description Contains a list of sponsored messages //@messages List of sponsored messages @@ -1715,6 +1703,24 @@ chatNotificationSettings#dddc12cf use_default_mute_for:Bool mute_for:int32 use_d //@disable_mention_notifications True, if notifications for messages with mentions will be created as for an ordinary unread message scopeNotificationSettings#dc4a615f mute_for:int32 sound_id:int64 show_preview:Bool use_default_mute_stories:Bool mute_stories:Bool story_sound_id:int64 show_story_sender:Bool disable_pinned_message_notifications:Bool disable_mention_notifications:Bool = ScopeNotificationSettings; +//@class ReactionNotificationSource @description Describes sources of reactions for which notifications will be shown + +//@description Notifications for reactions are disabled +reactionNotificationSourceNone#15d6701c = ReactionNotificationSource; + +//@description Notifications for reactions are shown only for reactions from contacts +reactionNotificationSourceContacts#211c4835 = ReactionNotificationSource; + +//@description Notifications for reactions are shown for all reactions +reactionNotificationSourceAll#4a02ac92 = ReactionNotificationSource; + +//@description Contains information about notification settings for reactions +//@message_reaction_source Source of message reactions for which notifications are shown +//@story_reaction_source Source of story reactions for which notifications are shown +//@sound_id Identifier of the notification sound to be played; 0 if sound is disabled +//@show_preview True, if reaction sender and emoji must be displayed in notifications +reactionNotificationSettings#2bb0f654 message_reaction_source:ReactionNotificationSource story_reaction_source:ReactionNotificationSource sound_id:int64 show_preview:Bool = ReactionNotificationSettings; + //@description Contains information about a message draft //@reply_to Information about the message to be replied; must be of the type inputMessageReplyToMessage; may be null if none //@date Point in time (Unix timestamp) when the draft was created @@ -1839,11 +1845,13 @@ chatPosition#dae48755 list:ChatList order:int64 is_pinned:Bool source:ChatSource //@class ChatAvailableReactions @description Describes reactions available in the chat //@description All reactions are available in the chat -chatAvailableReactionsAll#dff07c4e = ChatAvailableReactions; +//@max_reaction_count The maximum allowed number of reactions per message; 1-11 +chatAvailableReactionsAll#29600b97 max_reaction_count:int32 = ChatAvailableReactions; //@description Only specific reactions are available in the chat //@reactions The list of reactions -chatAvailableReactionsSome#d3cc0a6b reactions:vector = ChatAvailableReactions; +//@max_reaction_count The maximum allowed number of reactions per message; 1-11 +chatAvailableReactionsSome#36b46b7d reactions:vector max_reaction_count:int32 = ChatAvailableReactions; //@description Represents a tag used in Saved Messages or a Saved Messages topic //@tag The tag @@ -2539,8 +2547,9 @@ webPageInstantView#2c0ec99c page_blocks:vector view_count:int32 versi //@voice_note Preview of the content as a voice note, if available; may be null //@story_sender_chat_id The identifier of the sender of the previewed story; 0 if none //@story_id The identifier of the previewed story; 0 if none +//@stickers Up to 4 stickers from the sticker set available via the link //@instant_view_version Version of web page instant view (currently, can be 1 or 2); 0 if none -webPage#dafbc3a4 url:string display_url:string type:string site_name:string title:string description:formattedText photo:photo embed_url:string embed_type:string embed_width:int32 embed_height:int32 duration:int32 author:string has_large_media:Bool show_large_media:Bool skip_confirmation:Bool show_above_text:Bool animation:animation audio:audio document:document sticker:sticker video:video video_note:videoNote voice_note:voiceNote story_sender_chat_id:int53 story_id:int32 instant_view_version:int32 = WebPage; +webPage#23088efb url:string display_url:string type:string site_name:string title:string description:formattedText photo:photo embed_url:string embed_type:string embed_width:int32 embed_height:int32 duration:int32 author:string has_large_media:Bool show_large_media:Bool skip_confirmation:Bool show_above_text:Bool animation:animation audio:audio document:document sticker:sticker video:video video_note:videoNote voice_note:voiceNote story_sender_chat_id:int53 story_id:int32 stickers:vector instant_view_version:int32 = WebPage; //@description Contains information about a country //@country_code A two-letter ISO 3166-1 alpha-2 country code @@ -3184,8 +3193,8 @@ messageExpiredVoiceNote#890757d = MessageContent; //@description A message with a location //@location The location description -//@live_period Time relative to the message send date, for which the location can be updated, in seconds -//@expires_in Left time for which the location can be updated, in seconds. updateMessageContent is not sent when this field changes +//@live_period Time relative to the message send date, for which the location can be updated, in seconds; if 0x7FFFFFFF, then location can be updated forever +//@expires_in Left time for which the location can be updated, in seconds. If 0, then the location can't be updated anymore. The update updateMessageContent is not sent when this field changes //@heading For live locations, a direction in which the location moves, in degrees; 1-360. If 0 the direction is unknown //@proximity_alert_radius For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). 0 if the notification is disabled. Available only to the message sender messageLocation#121e4474 location:location live_period:int32 expires_in:int32 heading:int32 proximity_alert_radius:int32 = MessageContent; @@ -3204,8 +3213,8 @@ messageContact#e1710c5a contact:contact = MessageContent; messageAnimatedEmoji#3621f5e2 animated_emoji:animatedEmoji emoji:string = MessageContent; //@description A dice message. The dice value is randomly generated by the server -//@initial_state The animated stickers with the initial dice animation; may be null if unknown. updateMessageContent will be sent when the sticker became known -//@final_state The animated stickers with the final dice animation; may be null if unknown. updateMessageContent will be sent when the sticker became known +//@initial_state The animated stickers with the initial dice animation; may be null if unknown. The update updateMessageContent will be sent when the sticker became known +//@final_state The animated stickers with the final dice animation; may be null if unknown. The update updateMessageContent will be sent when the sticker became known //@emoji Emoji on which the dice throw animation is based //@value The dice value. If the value is 0, the dice don't have final state yet //@success_animation_frame_number Number of frame after which a success animation like a shower of confetti needs to be shown on updateMessageSendSucceeded @@ -3669,7 +3678,7 @@ inputMessageVideo#f17014da video:InputFile thumbnail:inputThumbnail added_sticke inputMessageVideoNote#d56816dd video_note:InputFile thumbnail:inputThumbnail duration:int32 length:int32 self_destruct_type:MessageSelfDestructType = InputMessageContent; //@description A voice note message -//@voice_note Voice note to be sent +//@voice_note Voice note to be sent. The voice note must be encoded with the Opus codec and stored inside an OGG container with a single audio channel, or be in MP3 or M4A format as regular audio //@duration Duration of the voice note, in seconds //@waveform Waveform representation of the voice note in 5-bit format //@caption Voice note caption; may be null if empty; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters @@ -3678,7 +3687,7 @@ inputMessageVoiceNote#5723ffac voice_note:InputFile duration:int32 waveform:byte //@description A message with a location //@location Location to be sent -//@live_period Period for which the location can be updated, in seconds; must be between 60 and 86400 for a live location and 0 otherwise +//@live_period Period for which the location can be updated, in seconds; must be between 60 and 86400 for a temporary live location, 0x7FFFFFFF for permanent live location, and 0 otherwise //@heading For live locations, a direction in which the location moves, in degrees; 1-360. Pass 0 if unknown //@proximity_alert_radius For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled. Can't be enabled in channels and Saved Messages inputMessageLocation#26aae970 location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = InputMessageContent; @@ -3717,14 +3726,14 @@ inputMessageGame#4aae6ae2 bot_user_id:int53 game_short_name:string = InputMessag inputMessageInvoice#34cd1d60 invoice:invoice title:string description:string photo_url:string photo_size:int32 photo_width:int32 photo_height:int32 payload:bytes provider_token:string provider_data:string start_parameter:string extended_media_content:InputMessageContent = InputMessageContent; //@description A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot -//@question Poll question; 1-255 characters (up to 300 characters for bots) -//@options List of poll answer options, 2-10 strings 1-100 characters each +//@question Poll question; 1-255 characters (up to 300 characters for bots). Only custom emoji entities are allowed to be added and only by Premium users +//@options List of poll answer options, 2-10 strings 1-100 characters each. Only custom emoji entities are allowed to be added and only by Premium users //@is_anonymous True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels //@type Type of the poll //@open_period Amount of time the poll will be active after creation, in seconds; for bots only //@close_date Point in time (Unix timestamp) when the poll will automatically be closed; for bots only //@is_closed True, if the poll needs to be sent already closed; for bots only -inputMessagePoll#fe79770 question:string options:vector is_anonymous:Bool type:PollType open_period:int32 close_date:int32 is_closed:Bool = InputMessageContent; +inputMessagePoll#9046c716 question:formattedText options:vector is_anonymous:Bool type:PollType open_period:int32 close_date:int32 is_closed:Bool = InputMessageContent; //@description A message with a forwarded story. Stories can't be sent to secret chats. A story can be forwarded only if story.can_be_forwarded //@story_sender_chat_id Identifier of the chat that posted the story @@ -3933,11 +3942,21 @@ stickerSets#b8a6490d total_count:int32 sets:vector = StickerSets //@is_premium True, if the list contains sticker sets with premium stickers trendingStickerSets#298f12cc total_count:int32 sets:vector is_premium:Bool = TrendingStickerSets; -//@description Contains a list of similar emoji to search for in getStickers and searchStickers +//@class EmojiCategorySource @description Describes source of stickers for an emoji category + +//@description The category contains a list of similar emoji to search for in getStickers and searchStickers for stickers, +//@emojis List of emojis for search for +emojiCategorySourceSearch#5e126d32 emojis:vector = EmojiCategorySource; + +//@description The category contains Premium stickers that must be found by getPremiumStickers +emojiCategorySourcePremium#8cd28d0c = EmojiCategorySource; + +//@description Describes an emoji category //@name Name of the category //@icon Custom emoji sticker, which represents icon of the category -//@emojis List of emojis in the category -emojiCategory#c6e9e5a4 name:string icon:sticker emojis:vector = EmojiCategory; +//@source Source of stickers for the emoji category +//@is_greeting True, if the category must be shown first when choosing a sticker for the start page +emojiCategory#220de4ef name:string icon:sticker source:EmojiCategorySource is_greeting:Bool = EmojiCategory; //@description Represents a list of emoji categories //@categories List of categories @@ -3945,9 +3964,12 @@ emojiCategories#c680f27a categories:vector = EmojiCategories; //@class EmojiCategoryType @description Describes type of emoji category -//@description The category must be used by default +//@description The category must be used by default (e.g., for custom emoji or animation search) emojiCategoryTypeDefault#46db626b = EmojiCategoryType; +//@description The category must be used by default for regular sticker selection. It may contain greeting emoji category and Premium stickers +emojiCategoryTypeRegularStickers#b04799d2 = EmojiCategoryType; + //@description The category must be used for emoji status selection emojiCategoryTypeEmojiStatus#5254b347 = EmojiCategoryType; @@ -4104,13 +4126,13 @@ storyInteractionInfo#e1557fc7 view_count:int32 forward_count:int32 reaction_coun //@is_being_sent True, if the story is being sent by the current user //@is_being_edited True, if the story is being edited by the current user //@is_edited True, if the story was edited -//@is_pinned True, if the story is saved in the sender's profile and will be available there after expiration +//@is_posted_to_chat_page True, if the story is saved in the sender's profile and will be available there after expiration //@is_visible_only_for_self True, if the story is visible only for the current user //@can_be_deleted True, if the story can be deleted //@can_be_edited True, if the story can be edited //@can_be_forwarded True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden //@can_be_replied True, if the story can be replied in the chat with the story sender -//@can_toggle_is_pinned True, if the story's is_pinned value can be changed +//@can_toggle_is_posted_to_chat_page True, if the story's is_posted_to_chat_page value can be changed //@can_get_statistics True, if the story statistics are available through getStoryStatistics //@can_get_interactions True, if interactions with the story can be received through getStoryInteractions //@has_expired_viewers True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago @@ -4121,12 +4143,13 @@ storyInteractionInfo#e1557fc7 view_count:int32 forward_count:int32 reaction_coun //@content Content of the story //@areas Clickable areas to be shown on the story content //@caption Caption of the story -story#27f4e5b1 id:int32 sender_chat_id:int53 sender_id:MessageSender date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_pinned:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; +story#84cdc9d1 id:int32 sender_chat_id:int53 sender_id:MessageSender date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_posted_to_chat_page:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_posted_to_chat_page:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; //@description Represents a list of stories //@total_count Approximate total number of stories found //@stories The list of stories -stories#5a860711 total_count:int32 stories:vector = Stories; +//@pinned_story_ids Identifiers of the pinned stories; returned only in getChatPostedToChatPageStories with from_story_id == 0 +stories#b88ff8ff total_count:int32 stories:vector pinned_story_ids:vector = Stories; //@description Contains identifier of a story along with identifier of its sender //@sender_chat_id Identifier of the chat that posted the story @@ -4534,10 +4557,11 @@ firebaseAuthenticationSettingsIos#d49a4c4 device_token:string is_app_sandbox:Boo //@allow_flash_call Pass true if the authentication code may be sent via a flash call to the specified phone number //@allow_missed_call Pass true if the authentication code may be sent via a missed call to the specified phone number //@is_current_phone_number Pass true if the authenticated phone number is used on the current device +//@has_unknown_phone_number Pass true if there is a SIM card in the current device, but it is not possible to check whether phone number matches //@allow_sms_retriever_api For official applications only. True, if the application can use Android SMS Retriever API (requires Google Play Services >= 10.2) to automatically receive the authentication code from the SMS. See https://developers.google.com/identity/sms-retriever/ for more details //@firebase_authentication_settings For official Android and iOS applications only; pass null otherwise. Settings for Firebase Authentication //@authentication_tokens List of up to 20 authentication tokens, recently received in updateOption("authentication_token") in previously logged out sessions -phoneNumberAuthenticationSettings#c6e19fa1 allow_flash_call:Bool allow_missed_call:Bool is_current_phone_number:Bool allow_sms_retriever_api:Bool firebase_authentication_settings:FirebaseAuthenticationSettings authentication_tokens:vector = PhoneNumberAuthenticationSettings; +phoneNumberAuthenticationSettings#3e1183db allow_flash_call:Bool allow_missed_call:Bool is_current_phone_number:Bool has_unknown_phone_number:Bool allow_sms_retriever_api:Bool firebase_authentication_settings:FirebaseAuthenticationSettings authentication_tokens:vector = PhoneNumberAuthenticationSettings; //@description Represents a reaction applied to a message //@type Type of the reaction @@ -5632,7 +5656,7 @@ backgroundFillSolid#3c3dbc1d color:int32 = BackgroundFill; backgroundFillGradient#925ff17f top_color:int32 bottom_color:int32 rotation_angle:int32 = BackgroundFill; //@description Describes a freeform gradient fill of a background -//@colors A list of 3 or 4 colors of the freeform gradients in the RGB24 format +//@colors A list of 3 or 4 colors of the freeform gradient in the RGB24 format backgroundFillFreeformGradient#fa31756a colors:vector = BackgroundFill; //@class BackgroundType @description Describes the type of background @@ -6855,6 +6879,10 @@ suggestedActionGiftPremiumForChristmas#93b3ee6f = SuggestedAction; //@description Suggests the user to set birthdate suggestedActionSetBirthdate#eabd9b02 = SuggestedAction; +//@description Suggests the user to extend their expiring Telegram Premium subscription +//@manage_premium_subscription_url A URL for managing Telegram Premium subscription +suggestedActionExtendPremium#de405cca manage_premium_subscription_url:string = SuggestedAction; + //@description Contains a counter //@count Count count#4d38f104 count:int32 = Count; @@ -7030,15 +7058,19 @@ chatStatisticsSupergroup#c67549ef period:dateRange member_count:statisticalValue //@recent_interactions Detailed statistics about number of views and shares of recently sent messages and stories chatStatisticsChannel#b8e95b4 period:dateRange member_count:statisticalValue mean_message_view_count:statisticalValue mean_message_share_count:statisticalValue mean_message_reaction_count:statisticalValue mean_story_view_count:statisticalValue mean_story_share_count:statisticalValue mean_story_reaction_count:statisticalValue enabled_notifications_percentage:double member_count_graph:StatisticalGraph join_graph:StatisticalGraph mute_graph:StatisticalGraph view_count_by_hour_graph:StatisticalGraph view_count_by_source_graph:StatisticalGraph join_by_source_graph:StatisticalGraph language_graph:StatisticalGraph message_interaction_graph:StatisticalGraph message_reaction_graph:StatisticalGraph story_interaction_graph:StatisticalGraph story_reaction_graph:StatisticalGraph instant_view_interaction_graph:StatisticalGraph recent_interactions:vector = ChatStatistics; +//@description Contains information about revenue earned from sponsored messages in a chat +//@cryptocurrency Cryptocurrency in which revenue is calculated +//@total_amount Total amount of the cryptocurrency earned, in the smallest units of the cryptocurrency +//@balance_amount Amount of the cryptocurrency that isn't withdrawn yet, in the smallest units of the cryptocurrency +//@available_amount Amount of the cryptocurrency available for withdrawal, in the smallest units of the cryptocurrency +chatRevenueAmount#4f3bb29f cryptocurrency:string total_amount:int64 balance_amount:int64 available_amount:int64 = ChatRevenueAmount; + //@description A detailed statistics about revenue earned from sponsored messages in a chat //@revenue_by_hour_graph A graph containing amount of revenue in a given hour //@revenue_graph A graph containing amount of revenue -//@cryptocurrency Cryptocurrency in which revenue is calculated -//@cryptocurrency_total_amount Total amount of the cryptocurrency earned, in the smallest units of the cryptocurrency -//@cryptocurrency_balance_amount Amount of the cryptocurrency that isn't withdrawn yet, in the smallest units of the cryptocurrency -//@cryptocurrency_available_amount Amount of the cryptocurrency available for withdrawal, in the smallest units of the cryptocurrency -//@usd_rate Current conversion rate of the cryptocurrency to USD -chatRevenueStatistics#a5504cd4 revenue_by_hour_graph:StatisticalGraph revenue_graph:StatisticalGraph cryptocurrency:string cryptocurrency_total_amount:int64 cryptocurrency_balance_amount:int64 cryptocurrency_available_amount:int64 usd_rate:double = ChatRevenueStatistics; +//@revenue_amount Amount of earned revenue +//@usd_rate Current conversion rate of the cryptocurrency in which revenue is calculated to USD +chatRevenueStatistics#636318bb revenue_by_hour_graph:StatisticalGraph revenue_graph:StatisticalGraph revenue_amount:chatRevenueAmount usd_rate:double = ChatRevenueStatistics; //@description A detailed statistics about a message //@message_interaction_graph A graph containing number of message views and shares @@ -7438,6 +7470,10 @@ updateForumTopicInfo#6b6f2cc9 chat_id:int53 info:forumTopicInfo = Update; //@notification_settings The new notification settings updateScopeNotificationSettings#b83ccb73 scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Update; +//@description Notification settings for reactions were updated +//@notification_settings The new notification settings +updateReactionNotificationSettings#e54d17ec notification_settings:reactionNotificationSettings = Update; + //@description A notification was changed //@notification_group_id Unique notification group identifier //@notification Changed notification @@ -7727,6 +7763,9 @@ updateDefaultReactionType#4b615105 reaction_type:ReactionType = Update; //@tags The new tags updateSavedMessagesTags#7386424a saved_messages_topic_id:int53 tags:savedMessagesTags = Update; +//@description The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions +updateChatRevenueAmount#32f4a5e1 = Update; + //@description The parameters of speech recognition without Telegram Premium subscription has changed //@max_media_duration The maximum allowed duration of media for speech recognition without Telegram Premium subscription, in seconds //@weekly_count The total number of allowed speech recognitions per week; 0 if none @@ -7863,10 +7902,11 @@ updatePollAnswer#b67ac547 poll_id:int64 voter_id:MessageSender option_ids:vector //@actor_user_id Identifier of the user, changing the rights //@date Point in time (Unix timestamp) when the user rights were changed //@invite_link If user has joined the chat using an invite link, the invite link; may be null +//@via_join_request True, if the user has joined the chat after sending a join request and being approved by an administrator //@via_chat_folder_invite_link True, if the user has joined the chat using an invite link for a chat folder //@old_chat_member Previous chat member //@new_chat_member New chat member -updateChatMember#6000e29c chat_id:int53 actor_user_id:int53 date:int32 invite_link:chatInviteLink via_chat_folder_invite_link:Bool old_chat_member:chatMember new_chat_member:chatMember = Update; +updateChatMember#98865bc7 chat_id:int53 actor_user_id:int53 date:int32 invite_link:chatInviteLink via_join_request:Bool via_chat_folder_invite_link:Bool old_chat_member:chatMember new_chat_member:chatMember = Update; //@description A user sent a join request to a chat; for bots only //@chat_id Chat identifier @@ -8033,6 +8073,10 @@ recoverAuthenticationPassword#f8311523 recovery_code:string new_password:string //@token SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application sendAuthenticationFirebaseSms#15c15e3f token:string = Ok; +//@description Reports that authentication code wasn't delivered via SMS; for official mobile apps only. Works only when the current authorization state is authorizationStateWaitCode +//@mobile_network_code Current mobile network code +reportAuthenticationCodeMissing#91efce48 mobile_network_code:string = Ok; + //@description Checks the authentication token of a bot; to log in as a bot. Works only when the current authorization state is authorizationStateWaitPhoneNumber. Can be used instead of setAuthenticationPhoneNumber and checkAuthenticationCode to log in //@token The bot token checkAuthenticationBotToken#261b4476 token:string = Ok; @@ -8246,6 +8290,9 @@ searchChatsOnServer#baf42f74 query:string limit:int32 = Chats; //@location Current user location searchChatsNearby#f445c81f location:location = ChatsNearby; +//@description Returns a list of channel chats recommended to the current user +getRecommendedChats#d9438d71 = Chats; + //@description Returns a list of chats similar to the given chat //@chat_id Identifier of the target chat; must be an identifier of a channel chat getChatSimilarChats#bb508f83 chat_id:int53 = Chats; @@ -8393,13 +8440,14 @@ searchChatMessages#dfdeb5c6 chat_id:int53 query:string sender_id:MessageSender f //@description Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). //@chat_list Chat list in which to search messages; pass null to search in all chats regardless of their chat list. Only Main and Archive chat lists are supported +//@only_in_channels Pass true to search only for messages in channels //@query Query to search for //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@filter Additional filter for messages to search; pass null to search for all messages. Filters searchMessagesFilterMention, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, searchMessagesFilterFailedToSend, and searchMessagesFilterPinned are unsupported in this function //@min_date If not 0, the minimum date of the messages to return //@max_date If not 0, the maximum date of the messages to return -searchMessages#2a8f08a7 chat_list:ChatList query:string offset:string limit:int32 filter:SearchMessagesFilter min_date:int32 max_date:int32 = FoundMessages; +searchMessages#31f9c3c9 chat_list:ChatList only_in_channels:Bool query:string offset:string limit:int32 filter:SearchMessagesFilter min_date:int32 max_date:int32 = FoundMessages; //@description Searches for messages in secret chats. Returns the results in reverse chronological order. For optimal performance, the number of returned messages is chosen by TDLib //@chat_id Identifier of the chat in which to search. Specify 0 to search in all secret chats @@ -8545,7 +8593,7 @@ recognizeSpeech#67d402b9 chat_id:int53 message_id:int53 = Ok; //@is_good Pass true if the speech recognition is good rateSpeechRecognition#eedcc3b5 chat_id:int53 message_id:int53 is_good:Bool = Ok; -//@description Returns list of message sender identifiers, which can be used to send messages in a chat +//@description Returns the list of message sender identifiers, which can be used to send messages in a chat //@chat_id Chat identifier getChatAvailableMessageSenders#450fe92b chat_id:int53 = ChatMessageSenders; @@ -8647,9 +8695,10 @@ editMessageText#bb2e1b7 chat_id:int53 message_id:int53 reply_markup:ReplyMarkup //@message_id Identifier of the message //@reply_markup The new message reply markup; pass null if none; for bots only //@location New location content of the message; pass null to stop sharing the live location +//@live_period New time relative to the message send date, for which the location can be updated, in seconds. If 0x7FFFFFFF specified, then the location can be updated forever. //@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown //@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled -editMessageLiveLocation#ff29a512 chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location heading:int32 proximity_alert_radius:int32 = Message; +editMessageLiveLocation#8f511394 chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = Message; //@description Edits the content of a message with an animation, an audio, a document, a photo or a video, including message caption. If only the caption needs to be edited, use editMessageCaption instead. //@chat_id The chat the message belongs to @@ -8681,9 +8730,10 @@ editInlineMessageText#cd02c1e5 inline_message_id:string reply_markup:ReplyMarkup //@inline_message_id Inline message identifier //@reply_markup The new message reply markup; pass null if none //@location New location content of the message; pass null to stop sharing the live location +//@live_period New time relative to the message send date, for which the location can be updated, in seconds. If 0x7FFFFFFF specified, then the location can be updated forever. //@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown //@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled -editInlineMessageLiveLocation#f6a5da00 inline_message_id:string reply_markup:ReplyMarkup location:location heading:int32 proximity_alert_radius:int32 = Ok; +editInlineMessageLiveLocation#7f37a0ac inline_message_id:string reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = Ok; //@description Edits the content of a message with an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only //@inline_message_id Inline message identifier @@ -8770,6 +8820,12 @@ addQuickReplyShortcutMessage#3f188b2a shortcut_name:string reply_to_message_id:i //@hide_via_bot Pass true to hide the bot, via which the message is sent. Can be used only for bots getOption("animation_search_bot_username"), getOption("photo_search_bot_username"), and getOption("venue_search_bot_username") addQuickReplyShortcutInlineQueryResultMessage#87c02a04 shortcut_name:string reply_to_message_id:int53 query_id:int64 result_id:string hide_via_bot:Bool = QuickReplyMessage; +//@description Adds 2-10 messages grouped together into an album to a quick reply shortcut. Currently, only audio, document, photo and video messages can be grouped into an album. +//@shortcut_name Name of the target shortcut +//@reply_to_message_id Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none +//@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album +addQuickReplyShortcutMessageAlbum#9647a3fd shortcut_name:string reply_to_message_id:int53 input_message_contents:vector = QuickReplyMessages; + //@description Readds quick reply messages which failed to add. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. //@shortcut_name Name of the target shortcut //@message_ids Identifiers of the quick reply messages to readd. Message identifiers must be in a strictly increasing order @@ -8781,7 +8837,7 @@ readdQuickReplyShortcutMessages#652518f7 shortcut_name:string message_ids:vector //@input_message_content New content of the message. Must be one of the following types: inputMessageText, inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo editQuickReplyMessage#4cc978e shortcut_id:int32 message_id:int53 input_message_content:InputMessageContent = Ok; -//@description Returns list of custom emojis, which can be used as forum topic icon by all users +//@description Returns the list of custom emojis, which can be used as forum topic icon by all users getForumTopicDefaultIcons#583574dc = Stickers; //@description Creates a topic in a forum supergroup chat; requires can_manage_topics administrator or can_create_topics member right in the supergroup @@ -8990,6 +9046,9 @@ stopPoll#62e80aad chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = Ok; //@action Suggested action to hide hideSuggestedAction#a2ef2b7f action:SuggestedAction = Ok; +//@description Hides the list of contacts that have close birthdays for 24 hours +hideContactCloseBirthdays#baad087b = Ok; + //@description Returns information about a business connection by its identifier; for bots only //@connection_id Identifier of the business connection to return getBusinessConnection#81f42420 connection_id:string = BusinessConnection; @@ -9565,7 +9624,7 @@ clearAllDraftMessages#fd3c74db exclude_secret_chats:Bool = Ok; //@notification_sound_id Identifier of the notification sound getSavedNotificationSound#1b647917 notification_sound_id:int64 = NotificationSounds; -//@description Returns list of saved notification sounds. If a sound isn't in the list, then default sound needs to be used +//@description Returns the list of saved notification sounds. If a sound isn't in the list, then default sound needs to be used getSavedNotificationSounds#c0346fa8 = NotificationSounds; //@description Adds a new notification sound to the list of saved notification sounds. The new notification sound is added to the top of the list. If it is already in the list, its position isn't changed @@ -9576,7 +9635,7 @@ addSavedNotificationSound#3e3984ef sound:InputFile = NotificationSound; //@notification_sound_id Identifier of the notification sound removeSavedNotificationSound#e363474e notification_sound_id:int64 = Ok; -//@description Returns list of chats with non-default notification settings for new messages +//@description Returns the list of chats with non-default notification settings for new messages //@scope If specified, only chats from the scope will be returned; pass null to return chats from all scopes //@compare_sound Pass true to include in the response chats with only non-default sound getChatNotificationSettingsExceptions#bfe0e11 scope:NotificationSettingsScope compare_sound:Bool = Chats; @@ -9590,7 +9649,11 @@ getScopeNotificationSettings#c4a8254f scope:NotificationSettingsScope = ScopeNot //@notification_settings The new notification settings for the given scope setScopeNotificationSettings#85cfb63a scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Ok; -//@description Resets all notification settings to their default values. By default, all chats are unmuted and message previews are shown +//@description Changes notification settings for reactions +//@notification_settings The new notification settings for reactions +setReactionNotificationSettings#46b2d495 notification_settings:reactionNotificationSettings = Ok; + +//@description Resets all chat and scope notification settings to their default values. By default, all chats are unmuted and message previews are shown resetAllNotificationSettings#f5a0a8f9 = Ok; //@description Changes the pinned state of a chat. There can be up to getOption("pinned_chat_count_max")/getOption("pinned_archived_chat_count_max") pinned non-secret chats and the same number of secret chats in the main/archive chat list. The limit can be increased with Telegram Premium @@ -9629,9 +9692,9 @@ canSendStory#b6e0216b chat_id:int53 = CanSendStoryResult; //@privacy_settings The privacy settings for the story; ignored for stories sent to supergroup and channel chats //@active_period Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise //@from_story_full_id Full identifier of the original story, which content was used to create the story -//@is_pinned Pass true to keep the story accessible after expiration +//@is_posted_to_chat_page Pass true to keep the story accessible after expiration //@protect_content Pass true if the content of the story must be protected from forwarding and screenshotting -sendStory#736858bb chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 from_story_full_id:storyFullId is_pinned:Bool protect_content:Bool = Story; +sendStory#e6ab3302 chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 from_story_full_id:storyFullId is_posted_to_chat_page:Bool protect_content:Bool = Story; //@description Changes content and caption of a story. Can be called only if story.can_be_edited == true //@story_sender_chat_id Identifier of the chat that posted the story @@ -9646,18 +9709,18 @@ editStory#5e6a21b1 story_sender_chat_id:int53 story_id:int32 content:InputStoryC //@privacy_settings The new privacy settigs for the story setStoryPrivacySettings#d8e94332 story_id:int32 privacy_settings:StoryPrivacySettings = Ok; -//@description Toggles whether a story is accessible after expiration. Can be called only if story.can_toggle_is_pinned == true +//@description Toggles whether a story is accessible after expiration. Can be called only if story.can_toggle_is_posted_to_chat_page == true //@story_sender_chat_id Identifier of the chat that posted the story //@story_id Identifier of the story -//@is_pinned Pass true to make the story accessible after expiration; pass false to make it private -toggleStoryIsPinned#b493b30e story_sender_chat_id:int53 story_id:int32 is_pinned:Bool = Ok; +//@is_posted_to_chat_page Pass true to make the story accessible after expiration; pass false to make it private +toggleStoryIsPostedToChatPage#ee0f4aff story_sender_chat_id:int53 story_id:int32 is_posted_to_chat_page:Bool = Ok; //@description Deletes a previously sent story. Can be called only if story.can_be_deleted == true //@story_sender_chat_id Identifier of the chat that posted the story //@story_id Identifier of the story to delete deleteStory#9f35af16 story_sender_chat_id:int53 story_id:int32 = Ok; -//@description Returns list of chats with non-default notification settings for stories +//@description Returns the list of chats with non-default notification settings for stories getStoryNotificationSettingsExceptions#256a2eb0 = Chats; //@description Loads more active stories from a story list. The loaded stories will be sent through updates. Active stories are sorted by @@ -9673,11 +9736,11 @@ setChatActiveStoriesList#e0e35d11 chat_id:int53 story_list:StoryList = Ok; //@chat_id Chat identifier getChatActiveStories#2e4ffbf5 chat_id:int53 = ChatActiveStories; -//@description Returns the list of pinned stories posted by the given chat. The stories are returned in a reverse chronological order (i.e., in order of decreasing story_id). +//@description Returns the list of stories that posted by the given chat to its chat page. If from_story_id == 0, then pinned stories are returned first. //@chat_id Chat identifier -//@from_story_id Identifier of the story starting from which stories must be returned; use 0 to get results from the last story +//@from_story_id Identifier of the story starting from which stories must be returned; use 0 to get results from pinned and the newest story //@limit The maximum number of stories to be returned -getChatPinnedStories#53c82a1 chat_id:int53 from_story_id:int32 limit:int32 = Stories; +getChatPostedToChatPageStories#fd3bc72b chat_id:int53 from_story_id:int32 limit:int32 = Stories; //@description Returns the list of all stories posted by the given chat; requires can_edit_stories right in the chat. //@chat_id Chat identifier @@ -9685,6 +9748,11 @@ getChatPinnedStories#53c82a1 chat_id:int53 from_story_id:int32 limit:int32 = Sto //@limit The maximum number of stories to be returned getChatArchivedStories#af1e9488 chat_id:int53 from_story_id:int32 limit:int32 = Stories; +//@description Changes the list of pinned stories on a chat page; requires can_edit_stories right in the chat +//@chat_id Identifier of the chat that posted the stories +//@story_ids New list of pinned stories. All stories must be posted to the chat page first. There can be up to getOption("pinned_story_count_max") pinned stories on a chat page +setChatPinnedStories#f5cb679f chat_id:int53 story_ids:vector = Ok; + //@description Informs TDLib that a story is opened and is being viewed by the user //@story_sender_chat_id The identifier of the sender of the opened story //@story_id The identifier of the story @@ -9742,12 +9810,12 @@ activateStoryStealthMode#c3db8491 = Ok; //@limit The maximum number of messages and stories to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit getStoryPublicForwards#68f7dcbb story_sender_chat_id:int53 story_id:int32 offset:string limit:int32 = PublicForwards; -//@description Returns list of features available on the specific chat boost level; this is an offline request +//@description Returns the list of features available on the specific chat boost level; this is an offline request //@is_channel Pass true to get the list of features for channels; pass false to get the list of features for supergroups //@level Chat boost level getChatBoostLevelFeatures#45e63e8b is_channel:Bool level:int32 = ChatBoostLevelFeatures; -//@description Returns list of features available for different chat boost levels; this is an offline request +//@description Returns the list of features available for different chat boost levels; this is an offline request //@is_channel Pass true to get the list of features for channels; pass false to get the list of features for supergroups getChatBoostFeatures#e8c128a0 is_channel:Bool = ChatBoostFeatures; @@ -9771,14 +9839,14 @@ getChatBoostLink#56f16c85 chat_id:int53 = ChatBoostLink; //@url The link to boost a chat getChatBoostLinkInfo#26fc4b5c url:string = ChatBoostLinkInfo; -//@description Returns list of boosts applied to a chat; requires administrator rights in the chat +//@description Returns the list of boosts applied to a chat; requires administrator rights in the chat //@chat_id Identifier of the chat //@only_gift_codes Pass true to receive only boosts received from gift codes and giveaways created by the chat //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of boosts to be returned; up to 100. For optimal performance, the number of returned boosts can be smaller than the specified limit getChatBoosts#ab5eaa38 chat_id:int53 only_gift_codes:Bool offset:string limit:int32 = FoundChatBoosts; -//@description Returns list of boosts applied to a chat by a given user; requires administrator rights in the chat; for bots only +//@description Returns the list of boosts applied to a chat by a given user; requires administrator rights in the chat; for bots only //@chat_id Identifier of the chat //@user_id Identifier of the user getUserChatBoosts#b90ee799 chat_id:int53 user_id:int53 = FoundChatBoosts; @@ -9837,7 +9905,7 @@ cancelDownloadFile#8b8052de file_id:int32 only_if_pending:Bool = Ok; //@directory Directory in which the file is supposed to be saved getSuggestedFileName#85d8a486 file_id:int32 directory:string = Text; -//@description Preliminary uploads a file to the cloud before sending it in a message, which can be useful for uploading of being recorded voice and video notes. Updates updateFile will be used +//@description Preliminary uploads a file to the cloud before sending it in a message, which can be useful for uploading of being recorded voice and video notes. //@file File to upload //@file_type File type; pass null if unknown //@priority Priority of the upload (1-32). The higher the priority, the earlier the file will be uploaded. If the priorities of two files are equal, then the first one for which preliminaryUploadFile was called will be uploaded first @@ -9949,7 +10017,7 @@ editChatInviteLink#4eb23d7c chat_id:int53 invite_link:string name:string expirat //@invite_link Invite link to get getChatInviteLink#e36a41fd chat_id:int53 invite_link:string = ChatInviteLink; -//@description Returns list of chat administrators with number of their invite links. Requires owner privileges in the chat +//@description Returns the list of chat administrators with number of their invite links. Requires owner privileges in the chat //@chat_id Chat identifier getChatInviteLinkCounts#3510e291 chat_id:int53 = ChatInviteLinkCounts; @@ -10053,7 +10121,7 @@ sendCallDebugInformation#785b373f call_id:int32 debug_information:string = Ok; //@log_file Call log file. Only inputFileLocal and inputFileGenerated are supported sendCallLog#3f0a47d1 call_id:int32 log_file:InputFile = Ok; -//@description Returns list of participant identifiers, on whose behalf a video chat in the chat can be joined +//@description Returns the list of participant identifiers, on whose behalf a video chat in the chat can be joined //@chat_id Chat identifier getVideoChatAvailableParticipants#c45da305 chat_id:int53 = MessageSenders; @@ -10425,7 +10493,7 @@ getAnimatedEmoji#3f844f76 emoji:string = AnimatedEmoji; //@language_code Language code for which the emoji replacements will be suggested getEmojiSuggestionsUrl#ac4f1b2f language_code:string = HttpUrl; -//@description Returns list of custom emoji stickers by their identifiers. Stickers are returned in arbitrary order. Only found stickers are returned +//@description Returns the list of custom emoji stickers by their identifiers. Stickers are returned in arbitrary order. Only found stickers are returned //@custom_emoji_ids Identifiers of custom emoji stickers. At most 200 custom emoji stickers can be received simultaneously getCustomEmojiStickers#a5156885 custom_emoji_ids:vector = Stickers; @@ -10441,7 +10509,7 @@ getDefaultBackgroundCustomEmojiStickers#1cf6680e = Stickers; //@description Returns saved animations getSavedAnimations#6b9718 = Animations; -//@description Manually adds a new animation to the list of saved animations. The new animation is added to the beginning of the list. If the animation was already in the list, it is removed first. Only non-secret video animations with MIME type "video/mp4" can be added to the list +//@description Manually adds a new animation to the list of saved animations. The new animation is added to the beginning of the list. If the animation was already in the list, it is removed first. //@animation The animation file to be added. Only animations known to the server (i.e., successfully sent via a message) can be added to the list addSavedAnimation#a44bf860 animation:InputFile = Ok; @@ -10528,6 +10596,10 @@ setEmojiStatus#92f83e5d emoji_status:emojiStatus = Ok; //@location The new location of the user setLocation#5993371 location:location = Ok; +//@description Toggles whether the current user has sponsored messages enabled. The setting has no effect for users without Telegram Premium for which sponsored messages are always enabled +//@has_sponsored_messages_enabled Pass true to enable sponsored messages for the current user; false to disable them +toggleHasSponsoredMessagesEnabled#75055cec has_sponsored_messages_enabled:Bool = 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; @@ -10558,6 +10630,10 @@ sendPhoneNumberCode#409e3d10 phone_number:string settings:phoneNumberAuthenticat //@token SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application sendPhoneNumberFirebaseSms#f9c7084 token:string = Ok; +//@description Reports that authentication code wasn't delivered via SMS to the specified phone number; for official mobile apps only +//@mobile_network_code Current mobile network code +reportPhoneNumberCodeMissing#caa4b553 mobile_network_code:string = Ok; + //@description Resends the authentication code sent to a phone number. Works only if the previously received authenticationCodeInfo next_code_type was not null and the server-specified timeout has passed resendPhoneNumberCode#2dc1f7c8 = AuthenticationCodeInfo; @@ -10623,7 +10699,7 @@ setCommands#b0e0217a scope:BotCommandScope language_code:string commands:vector< //@language_code A two-letter ISO 639-1 language code or an empty string deleteCommands#3bc47c2a scope:BotCommandScope language_code:string = Ok; -//@description Returns list of commands supported by the bot for the given user scope and language; for bots only +//@description Returns the list of commands supported by the bot for the given user scope and language; for bots only //@scope The scope to which the commands are relevant; pass null to get commands in the default bot command scope //@language_code A two-letter ISO 639-1 language code or an empty string getCommands#58ba8ff7 scope:BotCommandScope language_code:string = BotCommands; @@ -11031,7 +11107,7 @@ getAccountTtl#e58a8b77 = AccountTtl; //@description Deletes the account of the current user, deleting all information associated with the user from the server. The phone number of the account can be used to create a new account. //@reason The reason why the account was deleted; optional -//@password The 2-step verification password of the current user. If not specified, account deletion can be canceled within one week +//@password The 2-step verification password of the current user. If the current user isn't authorized, then an empty string can be passed and account deletion can be canceled within one week deleteAccount#533276c6 reason:string password:string = Ok; //@description Changes the default message auto-delete time for new chats @@ -11075,7 +11151,7 @@ getChatRevenueStatistics#29d79b3c chat_id:int53 is_dark:Bool = ChatRevenueStatis //@password The 2-step verification password of the current user getChatRevenueWithdrawalUrl#1e320720 chat_id:int53 password:string = HttpUrl; -//@description Returns list of revenue transactions for a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true +//@description Returns the list of revenue transactions for a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true //@chat_id Chat identifier //@offset Number of transactions to skip //@limit The maximum number of transactions to be returned; up to 200 @@ -11476,7 +11552,7 @@ disableProxy#82d31782 = Ok; //@proxy_id Proxy identifier removeProxy#519ca307 proxy_id:int32 = Ok; -//@description Returns list of proxies that are currently set up. Can be called before authorization +//@description Returns the list of proxies that are currently set up. Can be called before authorization getProxies#fa560333 = Proxies; //@description Returns an HTTPS link, which can be used to add a proxy. Available only for SOCKS5 and MTProto proxies. Can be called before authorization @@ -11501,7 +11577,7 @@ setLogVerbosityLevel#edea07d2 new_verbosity_level:int32 = Ok; //@description Returns current verbosity level of the internal logging of TDLib. Can be called synchronously getLogVerbosityLevel#23689ae4 = LogVerbosityLevel; -//@description Returns list of available TDLib internal log tags, for example, ["actor", "binlog", "connections", "notifications", "proxy"]. Can be called synchronously +//@description Returns the list of available TDLib internal log tags, for example, ["actor", "binlog", "connections", "notifications", "proxy"]. Can be called synchronously getLogTags#f0d569da = LogTags; //@description Sets the verbosity level for a specified TDLib internal log tag. Can be called synchronously diff --git a/tdapi/tl_add_quick_reply_shortcut_message_album_gen.go b/tdapi/tl_add_quick_reply_shortcut_message_album_gen.go new file mode 100644 index 0000000000..e03463e91a --- /dev/null +++ b/tdapi/tl_add_quick_reply_shortcut_message_album_gen.go @@ -0,0 +1,305 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// AddQuickReplyShortcutMessageAlbumRequest represents TL type `addQuickReplyShortcutMessageAlbum#9647a3fd`. +type AddQuickReplyShortcutMessageAlbumRequest struct { + // Name of the target shortcut + ShortcutName string + // Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none + ReplyToMessageID int64 + // Contents of messages to be sent. At most 10 messages can be added to an album + InputMessageContents []InputMessageContentClass +} + +// AddQuickReplyShortcutMessageAlbumRequestTypeID is TL type id of AddQuickReplyShortcutMessageAlbumRequest. +const AddQuickReplyShortcutMessageAlbumRequestTypeID = 0x9647a3fd + +// Ensuring interfaces in compile-time for AddQuickReplyShortcutMessageAlbumRequest. +var ( + _ bin.Encoder = &AddQuickReplyShortcutMessageAlbumRequest{} + _ bin.Decoder = &AddQuickReplyShortcutMessageAlbumRequest{} + _ bin.BareEncoder = &AddQuickReplyShortcutMessageAlbumRequest{} + _ bin.BareDecoder = &AddQuickReplyShortcutMessageAlbumRequest{} +) + +func (a *AddQuickReplyShortcutMessageAlbumRequest) Zero() bool { + if a == nil { + return true + } + if !(a.ShortcutName == "") { + return false + } + if !(a.ReplyToMessageID == 0) { + return false + } + if !(a.InputMessageContents == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (a *AddQuickReplyShortcutMessageAlbumRequest) String() string { + if a == nil { + return "AddQuickReplyShortcutMessageAlbumRequest(nil)" + } + type Alias AddQuickReplyShortcutMessageAlbumRequest + return fmt.Sprintf("AddQuickReplyShortcutMessageAlbumRequest%+v", Alias(*a)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AddQuickReplyShortcutMessageAlbumRequest) TypeID() uint32 { + return AddQuickReplyShortcutMessageAlbumRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*AddQuickReplyShortcutMessageAlbumRequest) TypeName() string { + return "addQuickReplyShortcutMessageAlbum" +} + +// TypeInfo returns info about TL type. +func (a *AddQuickReplyShortcutMessageAlbumRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "addQuickReplyShortcutMessageAlbum", + ID: AddQuickReplyShortcutMessageAlbumRequestTypeID, + } + if a == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ShortcutName", + SchemaName: "shortcut_name", + }, + { + Name: "ReplyToMessageID", + SchemaName: "reply_to_message_id", + }, + { + Name: "InputMessageContents", + SchemaName: "input_message_contents", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (a *AddQuickReplyShortcutMessageAlbumRequest) Encode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode addQuickReplyShortcutMessageAlbum#9647a3fd as nil") + } + b.PutID(AddQuickReplyShortcutMessageAlbumRequestTypeID) + return a.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (a *AddQuickReplyShortcutMessageAlbumRequest) EncodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode addQuickReplyShortcutMessageAlbum#9647a3fd as nil") + } + b.PutString(a.ShortcutName) + b.PutInt53(a.ReplyToMessageID) + b.PutInt(len(a.InputMessageContents)) + for idx, v := range a.InputMessageContents { + if v == nil { + return fmt.Errorf("unable to encode addQuickReplyShortcutMessageAlbum#9647a3fd: field input_message_contents element with index %d is nil", idx) + } + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare addQuickReplyShortcutMessageAlbum#9647a3fd: field input_message_contents element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (a *AddQuickReplyShortcutMessageAlbumRequest) Decode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode addQuickReplyShortcutMessageAlbum#9647a3fd to nil") + } + if err := b.ConsumeID(AddQuickReplyShortcutMessageAlbumRequestTypeID); err != nil { + return fmt.Errorf("unable to decode addQuickReplyShortcutMessageAlbum#9647a3fd: %w", err) + } + return a.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (a *AddQuickReplyShortcutMessageAlbumRequest) DecodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode addQuickReplyShortcutMessageAlbum#9647a3fd to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode addQuickReplyShortcutMessageAlbum#9647a3fd: field shortcut_name: %w", err) + } + a.ShortcutName = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode addQuickReplyShortcutMessageAlbum#9647a3fd: field reply_to_message_id: %w", err) + } + a.ReplyToMessageID = value + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode addQuickReplyShortcutMessageAlbum#9647a3fd: field input_message_contents: %w", err) + } + + if headerLen > 0 { + a.InputMessageContents = make([]InputMessageContentClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeInputMessageContent(b) + if err != nil { + return fmt.Errorf("unable to decode addQuickReplyShortcutMessageAlbum#9647a3fd: field input_message_contents: %w", err) + } + a.InputMessageContents = append(a.InputMessageContents, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (a *AddQuickReplyShortcutMessageAlbumRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if a == nil { + return fmt.Errorf("can't encode addQuickReplyShortcutMessageAlbum#9647a3fd as nil") + } + b.ObjStart() + b.PutID("addQuickReplyShortcutMessageAlbum") + b.Comma() + b.FieldStart("shortcut_name") + b.PutString(a.ShortcutName) + b.Comma() + b.FieldStart("reply_to_message_id") + b.PutInt53(a.ReplyToMessageID) + b.Comma() + b.FieldStart("input_message_contents") + b.ArrStart() + for idx, v := range a.InputMessageContents { + if v == nil { + return fmt.Errorf("unable to encode addQuickReplyShortcutMessageAlbum#9647a3fd: field input_message_contents element with index %d is nil", idx) + } + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode addQuickReplyShortcutMessageAlbum#9647a3fd: field input_message_contents 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 (a *AddQuickReplyShortcutMessageAlbumRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if a == nil { + return fmt.Errorf("can't decode addQuickReplyShortcutMessageAlbum#9647a3fd to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("addQuickReplyShortcutMessageAlbum"); err != nil { + return fmt.Errorf("unable to decode addQuickReplyShortcutMessageAlbum#9647a3fd: %w", err) + } + case "shortcut_name": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode addQuickReplyShortcutMessageAlbum#9647a3fd: field shortcut_name: %w", err) + } + a.ShortcutName = value + case "reply_to_message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode addQuickReplyShortcutMessageAlbum#9647a3fd: field reply_to_message_id: %w", err) + } + a.ReplyToMessageID = value + case "input_message_contents": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := DecodeTDLibJSONInputMessageContent(b) + if err != nil { + return fmt.Errorf("unable to decode addQuickReplyShortcutMessageAlbum#9647a3fd: field input_message_contents: %w", err) + } + a.InputMessageContents = append(a.InputMessageContents, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode addQuickReplyShortcutMessageAlbum#9647a3fd: field input_message_contents: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetShortcutName returns value of ShortcutName field. +func (a *AddQuickReplyShortcutMessageAlbumRequest) GetShortcutName() (value string) { + if a == nil { + return + } + return a.ShortcutName +} + +// GetReplyToMessageID returns value of ReplyToMessageID field. +func (a *AddQuickReplyShortcutMessageAlbumRequest) GetReplyToMessageID() (value int64) { + if a == nil { + return + } + return a.ReplyToMessageID +} + +// GetInputMessageContents returns value of InputMessageContents field. +func (a *AddQuickReplyShortcutMessageAlbumRequest) GetInputMessageContents() (value []InputMessageContentClass) { + if a == nil { + return + } + return a.InputMessageContents +} + +// AddQuickReplyShortcutMessageAlbum invokes method addQuickReplyShortcutMessageAlbum#9647a3fd returning error if any. +func (c *Client) AddQuickReplyShortcutMessageAlbum(ctx context.Context, request *AddQuickReplyShortcutMessageAlbumRequest) (*QuickReplyMessages, error) { + var result QuickReplyMessages + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_authentication_code_type_gen.go b/tdapi/tl_authentication_code_type_gen.go index d5bd8f9cb2..126ce33c93 100644 --- a/tdapi/tl_authentication_code_type_gen.go +++ b/tdapi/tl_authentication_code_type_gen.go @@ -363,6 +363,338 @@ func (a *AuthenticationCodeTypeSMS) GetLength() (value int32) { return a.Length } +// AuthenticationCodeTypeSMSWord represents TL type `authenticationCodeTypeSmsWord#a6063c63`. +type AuthenticationCodeTypeSMSWord struct { + // The first letters of the word if known + FirstLetter string +} + +// AuthenticationCodeTypeSMSWordTypeID is TL type id of AuthenticationCodeTypeSMSWord. +const AuthenticationCodeTypeSMSWordTypeID = 0xa6063c63 + +// construct implements constructor of AuthenticationCodeTypeClass. +func (a AuthenticationCodeTypeSMSWord) construct() AuthenticationCodeTypeClass { return &a } + +// Ensuring interfaces in compile-time for AuthenticationCodeTypeSMSWord. +var ( + _ bin.Encoder = &AuthenticationCodeTypeSMSWord{} + _ bin.Decoder = &AuthenticationCodeTypeSMSWord{} + _ bin.BareEncoder = &AuthenticationCodeTypeSMSWord{} + _ bin.BareDecoder = &AuthenticationCodeTypeSMSWord{} + + _ AuthenticationCodeTypeClass = &AuthenticationCodeTypeSMSWord{} +) + +func (a *AuthenticationCodeTypeSMSWord) Zero() bool { + if a == nil { + return true + } + if !(a.FirstLetter == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (a *AuthenticationCodeTypeSMSWord) String() string { + if a == nil { + return "AuthenticationCodeTypeSMSWord(nil)" + } + type Alias AuthenticationCodeTypeSMSWord + return fmt.Sprintf("AuthenticationCodeTypeSMSWord%+v", Alias(*a)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AuthenticationCodeTypeSMSWord) TypeID() uint32 { + return AuthenticationCodeTypeSMSWordTypeID +} + +// TypeName returns name of type in TL schema. +func (*AuthenticationCodeTypeSMSWord) TypeName() string { + return "authenticationCodeTypeSmsWord" +} + +// TypeInfo returns info about TL type. +func (a *AuthenticationCodeTypeSMSWord) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "authenticationCodeTypeSmsWord", + ID: AuthenticationCodeTypeSMSWordTypeID, + } + if a == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "FirstLetter", + SchemaName: "first_letter", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (a *AuthenticationCodeTypeSMSWord) Encode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode authenticationCodeTypeSmsWord#a6063c63 as nil") + } + b.PutID(AuthenticationCodeTypeSMSWordTypeID) + return a.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (a *AuthenticationCodeTypeSMSWord) EncodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode authenticationCodeTypeSmsWord#a6063c63 as nil") + } + b.PutString(a.FirstLetter) + return nil +} + +// Decode implements bin.Decoder. +func (a *AuthenticationCodeTypeSMSWord) Decode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode authenticationCodeTypeSmsWord#a6063c63 to nil") + } + if err := b.ConsumeID(AuthenticationCodeTypeSMSWordTypeID); err != nil { + return fmt.Errorf("unable to decode authenticationCodeTypeSmsWord#a6063c63: %w", err) + } + return a.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (a *AuthenticationCodeTypeSMSWord) DecodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode authenticationCodeTypeSmsWord#a6063c63 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode authenticationCodeTypeSmsWord#a6063c63: field first_letter: %w", err) + } + a.FirstLetter = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (a *AuthenticationCodeTypeSMSWord) EncodeTDLibJSON(b tdjson.Encoder) error { + if a == nil { + return fmt.Errorf("can't encode authenticationCodeTypeSmsWord#a6063c63 as nil") + } + b.ObjStart() + b.PutID("authenticationCodeTypeSmsWord") + b.Comma() + b.FieldStart("first_letter") + b.PutString(a.FirstLetter) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (a *AuthenticationCodeTypeSMSWord) DecodeTDLibJSON(b tdjson.Decoder) error { + if a == nil { + return fmt.Errorf("can't decode authenticationCodeTypeSmsWord#a6063c63 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("authenticationCodeTypeSmsWord"); err != nil { + return fmt.Errorf("unable to decode authenticationCodeTypeSmsWord#a6063c63: %w", err) + } + case "first_letter": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode authenticationCodeTypeSmsWord#a6063c63: field first_letter: %w", err) + } + a.FirstLetter = value + default: + return b.Skip() + } + return nil + }) +} + +// GetFirstLetter returns value of FirstLetter field. +func (a *AuthenticationCodeTypeSMSWord) GetFirstLetter() (value string) { + if a == nil { + return + } + return a.FirstLetter +} + +// AuthenticationCodeTypeSMSPhrase represents TL type `authenticationCodeTypeSmsPhrase#2ebc8cd1`. +type AuthenticationCodeTypeSMSPhrase struct { + // The first word of the phrase if known + FirstWord string +} + +// AuthenticationCodeTypeSMSPhraseTypeID is TL type id of AuthenticationCodeTypeSMSPhrase. +const AuthenticationCodeTypeSMSPhraseTypeID = 0x2ebc8cd1 + +// construct implements constructor of AuthenticationCodeTypeClass. +func (a AuthenticationCodeTypeSMSPhrase) construct() AuthenticationCodeTypeClass { return &a } + +// Ensuring interfaces in compile-time for AuthenticationCodeTypeSMSPhrase. +var ( + _ bin.Encoder = &AuthenticationCodeTypeSMSPhrase{} + _ bin.Decoder = &AuthenticationCodeTypeSMSPhrase{} + _ bin.BareEncoder = &AuthenticationCodeTypeSMSPhrase{} + _ bin.BareDecoder = &AuthenticationCodeTypeSMSPhrase{} + + _ AuthenticationCodeTypeClass = &AuthenticationCodeTypeSMSPhrase{} +) + +func (a *AuthenticationCodeTypeSMSPhrase) Zero() bool { + if a == nil { + return true + } + if !(a.FirstWord == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (a *AuthenticationCodeTypeSMSPhrase) String() string { + if a == nil { + return "AuthenticationCodeTypeSMSPhrase(nil)" + } + type Alias AuthenticationCodeTypeSMSPhrase + return fmt.Sprintf("AuthenticationCodeTypeSMSPhrase%+v", Alias(*a)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AuthenticationCodeTypeSMSPhrase) TypeID() uint32 { + return AuthenticationCodeTypeSMSPhraseTypeID +} + +// TypeName returns name of type in TL schema. +func (*AuthenticationCodeTypeSMSPhrase) TypeName() string { + return "authenticationCodeTypeSmsPhrase" +} + +// TypeInfo returns info about TL type. +func (a *AuthenticationCodeTypeSMSPhrase) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "authenticationCodeTypeSmsPhrase", + ID: AuthenticationCodeTypeSMSPhraseTypeID, + } + if a == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "FirstWord", + SchemaName: "first_word", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (a *AuthenticationCodeTypeSMSPhrase) Encode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode authenticationCodeTypeSmsPhrase#2ebc8cd1 as nil") + } + b.PutID(AuthenticationCodeTypeSMSPhraseTypeID) + return a.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (a *AuthenticationCodeTypeSMSPhrase) EncodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode authenticationCodeTypeSmsPhrase#2ebc8cd1 as nil") + } + b.PutString(a.FirstWord) + return nil +} + +// Decode implements bin.Decoder. +func (a *AuthenticationCodeTypeSMSPhrase) Decode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode authenticationCodeTypeSmsPhrase#2ebc8cd1 to nil") + } + if err := b.ConsumeID(AuthenticationCodeTypeSMSPhraseTypeID); err != nil { + return fmt.Errorf("unable to decode authenticationCodeTypeSmsPhrase#2ebc8cd1: %w", err) + } + return a.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (a *AuthenticationCodeTypeSMSPhrase) DecodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode authenticationCodeTypeSmsPhrase#2ebc8cd1 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode authenticationCodeTypeSmsPhrase#2ebc8cd1: field first_word: %w", err) + } + a.FirstWord = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (a *AuthenticationCodeTypeSMSPhrase) EncodeTDLibJSON(b tdjson.Encoder) error { + if a == nil { + return fmt.Errorf("can't encode authenticationCodeTypeSmsPhrase#2ebc8cd1 as nil") + } + b.ObjStart() + b.PutID("authenticationCodeTypeSmsPhrase") + b.Comma() + b.FieldStart("first_word") + b.PutString(a.FirstWord) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (a *AuthenticationCodeTypeSMSPhrase) DecodeTDLibJSON(b tdjson.Decoder) error { + if a == nil { + return fmt.Errorf("can't decode authenticationCodeTypeSmsPhrase#2ebc8cd1 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("authenticationCodeTypeSmsPhrase"); err != nil { + return fmt.Errorf("unable to decode authenticationCodeTypeSmsPhrase#2ebc8cd1: %w", err) + } + case "first_word": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode authenticationCodeTypeSmsPhrase#2ebc8cd1: field first_word: %w", err) + } + a.FirstWord = value + default: + return b.Skip() + } + return nil + }) +} + +// GetFirstWord returns value of FirstWord field. +func (a *AuthenticationCodeTypeSMSPhrase) GetFirstWord() (value string) { + if a == nil { + return + } + return a.FirstWord +} + // AuthenticationCodeTypeCall represents TL type `authenticationCodeTypeCall#61876c67`. type AuthenticationCodeTypeCall struct { // Length of the code @@ -1545,6 +1877,8 @@ const AuthenticationCodeTypeClassName = "AuthenticationCodeType" // switch v := g.(type) { // case *tdapi.AuthenticationCodeTypeTelegramMessage: // authenticationCodeTypeTelegramMessage#7bf49b2a // case *tdapi.AuthenticationCodeTypeSMS: // authenticationCodeTypeSms#3960e288 +// case *tdapi.AuthenticationCodeTypeSMSWord: // authenticationCodeTypeSmsWord#a6063c63 +// case *tdapi.AuthenticationCodeTypeSMSPhrase: // authenticationCodeTypeSmsPhrase#2ebc8cd1 // case *tdapi.AuthenticationCodeTypeCall: // authenticationCodeTypeCall#61876c67 // case *tdapi.AuthenticationCodeTypeFlashCall: // authenticationCodeTypeFlashCall#533379a2 // case *tdapi.AuthenticationCodeTypeMissedCall: // authenticationCodeTypeMissedCall#29bb0a87 @@ -1596,6 +1930,20 @@ func DecodeAuthenticationCodeType(buf *bin.Buffer) (AuthenticationCodeTypeClass, return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) } return &v, nil + case AuthenticationCodeTypeSMSWordTypeID: + // Decoding authenticationCodeTypeSmsWord#a6063c63. + v := AuthenticationCodeTypeSMSWord{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) + } + return &v, nil + case AuthenticationCodeTypeSMSPhraseTypeID: + // Decoding authenticationCodeTypeSmsPhrase#2ebc8cd1. + v := AuthenticationCodeTypeSMSPhrase{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) + } + return &v, nil case AuthenticationCodeTypeCallTypeID: // Decoding authenticationCodeTypeCall#61876c67. v := AuthenticationCodeTypeCall{} @@ -1664,6 +2012,20 @@ func DecodeTDLibJSONAuthenticationCodeType(buf tdjson.Decoder) (AuthenticationCo return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) } return &v, nil + case "authenticationCodeTypeSmsWord": + // Decoding authenticationCodeTypeSmsWord#a6063c63. + v := AuthenticationCodeTypeSMSWord{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) + } + return &v, nil + case "authenticationCodeTypeSmsPhrase": + // Decoding authenticationCodeTypeSmsPhrase#2ebc8cd1. + v := AuthenticationCodeTypeSMSPhrase{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) + } + return &v, nil case "authenticationCodeTypeCall": // Decoding authenticationCodeTypeCall#61876c67. v := AuthenticationCodeTypeCall{} diff --git a/tdapi/tl_background_fill_gen.go b/tdapi/tl_background_fill_gen.go index f6a02a9bd9..4584dcd423 100644 --- a/tdapi/tl_background_fill_gen.go +++ b/tdapi/tl_background_fill_gen.go @@ -434,7 +434,7 @@ func (b *BackgroundFillGradient) GetRotationAngle() (value int32) { // BackgroundFillFreeformGradient represents TL type `backgroundFillFreeformGradient#fa31756a`. type BackgroundFillFreeformGradient struct { - // A list of 3 or 4 colors of the freeform gradients in the RGB24 format + // A list of 3 or 4 colors of the freeform gradient in the RGB24 format Colors []int32 } diff --git a/tdapi/tl_business_info_gen.go b/tdapi/tl_business_info_gen.go index 46550d4e1b..dfbeb2fd13 100644 --- a/tdapi/tl_business_info_gen.go +++ b/tdapi/tl_business_info_gen.go @@ -31,13 +31,22 @@ var ( _ = tdjson.Encoder{} ) -// BusinessInfo represents TL type `businessInfo#4212a956`. +// BusinessInfo represents TL type `businessInfo#5520498e`. 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 + // Opening hours of the business in the local time; may be null if none. The hours are + // guaranteed to be valid and has already been split by week days. + LocalOpeningHours BusinessOpeningHours + // Time left before the business will open the next time, in seconds; 0 if unknown. An + // updateUserFullInfo update is not triggered when value of this field changes + NextOpenIn int32 + // Time left before the business will close the next time, in seconds; 0 if unknown. An + // updateUserFullInfo update is not triggered when value of this field changes + NextCloseIn int32 // The greeting message; may be null if none or the Business account is not of the // current user GreetingMessageSettings BusinessGreetingMessageSettings @@ -49,7 +58,7 @@ type BusinessInfo struct { } // BusinessInfoTypeID is TL type id of BusinessInfo. -const BusinessInfoTypeID = 0x4212a956 +const BusinessInfoTypeID = 0x5520498e // Ensuring interfaces in compile-time for BusinessInfo. var ( @@ -69,6 +78,15 @@ func (b *BusinessInfo) Zero() bool { if !(b.OpeningHours.Zero()) { return false } + if !(b.LocalOpeningHours.Zero()) { + return false + } + if !(b.NextOpenIn == 0) { + return false + } + if !(b.NextCloseIn == 0) { + return false + } if !(b.GreetingMessageSettings.Zero()) { return false } @@ -122,6 +140,18 @@ func (b *BusinessInfo) TypeInfo() tdp.Type { Name: "OpeningHours", SchemaName: "opening_hours", }, + { + Name: "LocalOpeningHours", + SchemaName: "local_opening_hours", + }, + { + Name: "NextOpenIn", + SchemaName: "next_open_in", + }, + { + Name: "NextCloseIn", + SchemaName: "next_close_in", + }, { Name: "GreetingMessageSettings", SchemaName: "greeting_message_settings", @@ -141,7 +171,7 @@ func (b *BusinessInfo) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (b *BusinessInfo) Encode(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't encode businessInfo#4212a956 as nil") + return fmt.Errorf("can't encode businessInfo#5520498e as nil") } buf.PutID(BusinessInfoTypeID) return b.EncodeBare(buf) @@ -150,22 +180,27 @@ func (b *BusinessInfo) Encode(buf *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (b *BusinessInfo) EncodeBare(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't encode businessInfo#4212a956 as nil") + return fmt.Errorf("can't encode businessInfo#5520498e as nil") } if err := b.Location.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessInfo#4212a956: field location: %w", err) + return fmt.Errorf("unable to encode businessInfo#5520498e: field location: %w", err) } if err := b.OpeningHours.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessInfo#4212a956: field opening_hours: %w", err) + return fmt.Errorf("unable to encode businessInfo#5520498e: field opening_hours: %w", err) + } + if err := b.LocalOpeningHours.Encode(buf); err != nil { + return fmt.Errorf("unable to encode businessInfo#5520498e: field local_opening_hours: %w", err) } + buf.PutInt32(b.NextOpenIn) + buf.PutInt32(b.NextCloseIn) if err := b.GreetingMessageSettings.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessInfo#4212a956: field greeting_message_settings: %w", err) + return fmt.Errorf("unable to encode businessInfo#5520498e: field greeting_message_settings: %w", err) } if err := b.AwayMessageSettings.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessInfo#4212a956: field away_message_settings: %w", err) + return fmt.Errorf("unable to encode businessInfo#5520498e: field away_message_settings: %w", err) } if err := b.StartPage.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessInfo#4212a956: field start_page: %w", err) + return fmt.Errorf("unable to encode businessInfo#5520498e: field start_page: %w", err) } return nil } @@ -173,10 +208,10 @@ func (b *BusinessInfo) EncodeBare(buf *bin.Buffer) error { // Decode implements bin.Decoder. func (b *BusinessInfo) Decode(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't decode businessInfo#4212a956 to nil") + return fmt.Errorf("can't decode businessInfo#5520498e to nil") } if err := buf.ConsumeID(BusinessInfoTypeID); err != nil { - return fmt.Errorf("unable to decode businessInfo#4212a956: %w", err) + return fmt.Errorf("unable to decode businessInfo#5520498e: %w", err) } return b.DecodeBare(buf) } @@ -184,31 +219,50 @@ func (b *BusinessInfo) Decode(buf *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (b *BusinessInfo) DecodeBare(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't decode businessInfo#4212a956 to nil") + return fmt.Errorf("can't decode businessInfo#5520498e to nil") } { if err := b.Location.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#4212a956: field location: %w", err) + return fmt.Errorf("unable to decode businessInfo#5520498e: field location: %w", err) } } { if err := b.OpeningHours.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#4212a956: field opening_hours: %w", err) + return fmt.Errorf("unable to decode businessInfo#5520498e: field opening_hours: %w", err) + } + } + { + if err := b.LocalOpeningHours.Decode(buf); err != nil { + return fmt.Errorf("unable to decode businessInfo#5520498e: field local_opening_hours: %w", err) + } + } + { + value, err := buf.Int32() + if err != nil { + return fmt.Errorf("unable to decode businessInfo#5520498e: field next_open_in: %w", err) + } + b.NextOpenIn = value + } + { + value, err := buf.Int32() + if err != nil { + return fmt.Errorf("unable to decode businessInfo#5520498e: field next_close_in: %w", err) } + b.NextCloseIn = value } { if err := b.GreetingMessageSettings.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#4212a956: field greeting_message_settings: %w", err) + return fmt.Errorf("unable to decode businessInfo#5520498e: field greeting_message_settings: %w", err) } } { if err := b.AwayMessageSettings.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#4212a956: field away_message_settings: %w", err) + return fmt.Errorf("unable to decode businessInfo#5520498e: field away_message_settings: %w", err) } } { if err := b.StartPage.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#4212a956: field start_page: %w", err) + return fmt.Errorf("unable to decode businessInfo#5520498e: field start_page: %w", err) } } return nil @@ -217,34 +271,45 @@ func (b *BusinessInfo) DecodeBare(buf *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (b *BusinessInfo) EncodeTDLibJSON(buf tdjson.Encoder) error { if b == nil { - return fmt.Errorf("can't encode businessInfo#4212a956 as nil") + return fmt.Errorf("can't encode businessInfo#5520498e 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#4212a956: field location: %w", err) + return fmt.Errorf("unable to encode businessInfo#5520498e: 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#4212a956: field opening_hours: %w", err) + return fmt.Errorf("unable to encode businessInfo#5520498e: field opening_hours: %w", err) } buf.Comma() + buf.FieldStart("local_opening_hours") + if err := b.LocalOpeningHours.EncodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to encode businessInfo#5520498e: field local_opening_hours: %w", err) + } + buf.Comma() + buf.FieldStart("next_open_in") + buf.PutInt32(b.NextOpenIn) + buf.Comma() + buf.FieldStart("next_close_in") + buf.PutInt32(b.NextCloseIn) + buf.Comma() buf.FieldStart("greeting_message_settings") if err := b.GreetingMessageSettings.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessInfo#4212a956: field greeting_message_settings: %w", err) + return fmt.Errorf("unable to encode businessInfo#5520498e: 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#4212a956: field away_message_settings: %w", err) + return fmt.Errorf("unable to encode businessInfo#5520498e: field away_message_settings: %w", err) } buf.Comma() buf.FieldStart("start_page") if err := b.StartPage.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessInfo#4212a956: field start_page: %w", err) + return fmt.Errorf("unable to encode businessInfo#5520498e: field start_page: %w", err) } buf.Comma() buf.StripComma() @@ -255,34 +320,50 @@ func (b *BusinessInfo) EncodeTDLibJSON(buf tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (b *BusinessInfo) DecodeTDLibJSON(buf tdjson.Decoder) error { if b == nil { - return fmt.Errorf("can't decode businessInfo#4212a956 to nil") + return fmt.Errorf("can't decode businessInfo#5520498e 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#4212a956: %w", err) + return fmt.Errorf("unable to decode businessInfo#5520498e: %w", err) } case "location": if err := b.Location.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#4212a956: field location: %w", err) + return fmt.Errorf("unable to decode businessInfo#5520498e: field location: %w", err) } case "opening_hours": if err := b.OpeningHours.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#4212a956: field opening_hours: %w", err) + return fmt.Errorf("unable to decode businessInfo#5520498e: field opening_hours: %w", err) + } + case "local_opening_hours": + if err := b.LocalOpeningHours.DecodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to decode businessInfo#5520498e: field local_opening_hours: %w", err) + } + case "next_open_in": + value, err := buf.Int32() + if err != nil { + return fmt.Errorf("unable to decode businessInfo#5520498e: field next_open_in: %w", err) } + b.NextOpenIn = value + case "next_close_in": + value, err := buf.Int32() + if err != nil { + return fmt.Errorf("unable to decode businessInfo#5520498e: field next_close_in: %w", err) + } + b.NextCloseIn = value case "greeting_message_settings": if err := b.GreetingMessageSettings.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#4212a956: field greeting_message_settings: %w", err) + return fmt.Errorf("unable to decode businessInfo#5520498e: 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#4212a956: field away_message_settings: %w", err) + return fmt.Errorf("unable to decode businessInfo#5520498e: field away_message_settings: %w", err) } case "start_page": if err := b.StartPage.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#4212a956: field start_page: %w", err) + return fmt.Errorf("unable to decode businessInfo#5520498e: field start_page: %w", err) } default: return buf.Skip() @@ -307,6 +388,30 @@ func (b *BusinessInfo) GetOpeningHours() (value BusinessOpeningHours) { return b.OpeningHours } +// GetLocalOpeningHours returns value of LocalOpeningHours field. +func (b *BusinessInfo) GetLocalOpeningHours() (value BusinessOpeningHours) { + if b == nil { + return + } + return b.LocalOpeningHours +} + +// GetNextOpenIn returns value of NextOpenIn field. +func (b *BusinessInfo) GetNextOpenIn() (value int32) { + if b == nil { + return + } + return b.NextOpenIn +} + +// GetNextCloseIn returns value of NextCloseIn field. +func (b *BusinessInfo) GetNextCloseIn() (value int32) { + if b == nil { + return + } + return b.NextCloseIn +} + // GetGreetingMessageSettings returns value of GreetingMessageSettings field. func (b *BusinessInfo) GetGreetingMessageSettings() (value BusinessGreetingMessageSettings) { if b == nil { diff --git a/tdapi/tl_business_opening_hours_interval_gen.go b/tdapi/tl_business_opening_hours_interval_gen.go index 2c84fd24d5..8170138a57 100644 --- a/tdapi/tl_business_opening_hours_interval_gen.go +++ b/tdapi/tl_business_opening_hours_interval_gen.go @@ -33,9 +33,11 @@ var ( // BusinessOpeningHoursInterval represents TL type `businessOpeningHoursInterval#bdf05654`. type BusinessOpeningHoursInterval struct { - // The first minute of the interval since start of the week; 0-7*24*60 + // The minute's sequence number in a week, starting on Monday, marking the start of the + // time interval during which the business is open; 0-7*24*60 StartMinute int32 - // The first minute after the end of the interval since start of the week; 1-8*24*60 + // The minute's sequence number in a week, starting on Monday, marking the end of the + // time interval during which the business is open; 1-8*24*60 EndMinute int32 } diff --git a/tdapi/tl_chat_administrator_rights_gen.go b/tdapi/tl_chat_administrator_rights_gen.go index fa3a7f0fa6..d95960eed1 100644 --- a/tdapi/tl_chat_administrator_rights_gen.go +++ b/tdapi/tl_chat_administrator_rights_gen.go @@ -66,8 +66,9 @@ type ChatAdministratorRights struct { // True, if the administrator can create new chat stories, or edit and delete posted // stories; applicable to supergroups and channels only CanPostStories bool - // True, if the administrator can edit stories posted by other users, pin stories and - // access story archive; applicable to supergroups and channels only + // True, if the administrator can edit stories posted by other users, post stories to the + // chat page, pin chat stories, and access story archive; applicable to supergroups and + // channels only CanEditStories bool // True, if the administrator can delete stories posted by other users; applicable to // supergroups and channels only diff --git a/tdapi/tl_chat_available_reactions_gen.go b/tdapi/tl_chat_available_reactions_gen.go index dade8e2e4e..86e6b4edb5 100644 --- a/tdapi/tl_chat_available_reactions_gen.go +++ b/tdapi/tl_chat_available_reactions_gen.go @@ -31,12 +31,14 @@ var ( _ = tdjson.Encoder{} ) -// ChatAvailableReactionsAll represents TL type `chatAvailableReactionsAll#dff07c4e`. +// ChatAvailableReactionsAll represents TL type `chatAvailableReactionsAll#29600b97`. type ChatAvailableReactionsAll struct { + // The maximum allowed number of reactions per message; 1-11 + MaxReactionCount int32 } // ChatAvailableReactionsAllTypeID is TL type id of ChatAvailableReactionsAll. -const ChatAvailableReactionsAllTypeID = 0xdff07c4e +const ChatAvailableReactionsAllTypeID = 0x29600b97 // construct implements constructor of ChatAvailableReactionsClass. func (c ChatAvailableReactionsAll) construct() ChatAvailableReactionsClass { return &c } @@ -55,6 +57,9 @@ func (c *ChatAvailableReactionsAll) Zero() bool { if c == nil { return true } + if !(c.MaxReactionCount == 0) { + return false + } return true } @@ -90,14 +95,19 @@ func (c *ChatAvailableReactionsAll) TypeInfo() tdp.Type { typ.Null = true return typ } - typ.Fields = []tdp.Field{} + typ.Fields = []tdp.Field{ + { + Name: "MaxReactionCount", + SchemaName: "max_reaction_count", + }, + } return typ } // Encode implements bin.Encoder. func (c *ChatAvailableReactionsAll) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatAvailableReactionsAll#dff07c4e as nil") + return fmt.Errorf("can't encode chatAvailableReactionsAll#29600b97 as nil") } b.PutID(ChatAvailableReactionsAllTypeID) return c.EncodeBare(b) @@ -106,18 +116,19 @@ func (c *ChatAvailableReactionsAll) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatAvailableReactionsAll) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatAvailableReactionsAll#dff07c4e as nil") + return fmt.Errorf("can't encode chatAvailableReactionsAll#29600b97 as nil") } + b.PutInt32(c.MaxReactionCount) return nil } // Decode implements bin.Decoder. func (c *ChatAvailableReactionsAll) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatAvailableReactionsAll#dff07c4e to nil") + return fmt.Errorf("can't decode chatAvailableReactionsAll#29600b97 to nil") } if err := b.ConsumeID(ChatAvailableReactionsAllTypeID); err != nil { - return fmt.Errorf("unable to decode chatAvailableReactionsAll#dff07c4e: %w", err) + return fmt.Errorf("unable to decode chatAvailableReactionsAll#29600b97: %w", err) } return c.DecodeBare(b) } @@ -125,7 +136,14 @@ func (c *ChatAvailableReactionsAll) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatAvailableReactionsAll) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatAvailableReactionsAll#dff07c4e to nil") + return fmt.Errorf("can't decode chatAvailableReactionsAll#29600b97 to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatAvailableReactionsAll#29600b97: field max_reaction_count: %w", err) + } + c.MaxReactionCount = value } return nil } @@ -133,11 +151,14 @@ func (c *ChatAvailableReactionsAll) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *ChatAvailableReactionsAll) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatAvailableReactionsAll#dff07c4e as nil") + return fmt.Errorf("can't encode chatAvailableReactionsAll#29600b97 as nil") } b.ObjStart() b.PutID("chatAvailableReactionsAll") b.Comma() + b.FieldStart("max_reaction_count") + b.PutInt32(c.MaxReactionCount) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -146,15 +167,21 @@ func (c *ChatAvailableReactionsAll) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *ChatAvailableReactionsAll) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatAvailableReactionsAll#dff07c4e to nil") + return fmt.Errorf("can't decode chatAvailableReactionsAll#29600b97 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("chatAvailableReactionsAll"); err != nil { - return fmt.Errorf("unable to decode chatAvailableReactionsAll#dff07c4e: %w", err) + return fmt.Errorf("unable to decode chatAvailableReactionsAll#29600b97: %w", err) } + case "max_reaction_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatAvailableReactionsAll#29600b97: field max_reaction_count: %w", err) + } + c.MaxReactionCount = value default: return b.Skip() } @@ -162,14 +189,24 @@ func (c *ChatAvailableReactionsAll) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// ChatAvailableReactionsSome represents TL type `chatAvailableReactionsSome#d3cc0a6b`. +// GetMaxReactionCount returns value of MaxReactionCount field. +func (c *ChatAvailableReactionsAll) GetMaxReactionCount() (value int32) { + if c == nil { + return + } + return c.MaxReactionCount +} + +// ChatAvailableReactionsSome represents TL type `chatAvailableReactionsSome#36b46b7d`. type ChatAvailableReactionsSome struct { // The list of reactions Reactions []ReactionTypeClass + // The maximum allowed number of reactions per message; 1-11 + MaxReactionCount int32 } // ChatAvailableReactionsSomeTypeID is TL type id of ChatAvailableReactionsSome. -const ChatAvailableReactionsSomeTypeID = 0xd3cc0a6b +const ChatAvailableReactionsSomeTypeID = 0x36b46b7d // construct implements constructor of ChatAvailableReactionsClass. func (c ChatAvailableReactionsSome) construct() ChatAvailableReactionsClass { return &c } @@ -191,6 +228,9 @@ func (c *ChatAvailableReactionsSome) Zero() bool { if !(c.Reactions == nil) { return false } + if !(c.MaxReactionCount == 0) { + return false + } return true } @@ -231,6 +271,10 @@ func (c *ChatAvailableReactionsSome) TypeInfo() tdp.Type { Name: "Reactions", SchemaName: "reactions", }, + { + Name: "MaxReactionCount", + SchemaName: "max_reaction_count", + }, } return typ } @@ -238,7 +282,7 @@ func (c *ChatAvailableReactionsSome) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *ChatAvailableReactionsSome) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatAvailableReactionsSome#d3cc0a6b as nil") + return fmt.Errorf("can't encode chatAvailableReactionsSome#36b46b7d as nil") } b.PutID(ChatAvailableReactionsSomeTypeID) return c.EncodeBare(b) @@ -247,27 +291,28 @@ func (c *ChatAvailableReactionsSome) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatAvailableReactionsSome) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatAvailableReactionsSome#d3cc0a6b as nil") + return fmt.Errorf("can't encode chatAvailableReactionsSome#36b46b7d as nil") } b.PutInt(len(c.Reactions)) for idx, v := range c.Reactions { if v == nil { - return fmt.Errorf("unable to encode chatAvailableReactionsSome#d3cc0a6b: field reactions element with index %d is nil", idx) + return fmt.Errorf("unable to encode chatAvailableReactionsSome#36b46b7d: field reactions element with index %d is nil", idx) } if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatAvailableReactionsSome#d3cc0a6b: field reactions element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare chatAvailableReactionsSome#36b46b7d: field reactions element with index %d: %w", idx, err) } } + b.PutInt32(c.MaxReactionCount) return nil } // Decode implements bin.Decoder. func (c *ChatAvailableReactionsSome) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatAvailableReactionsSome#d3cc0a6b to nil") + return fmt.Errorf("can't decode chatAvailableReactionsSome#36b46b7d to nil") } if err := b.ConsumeID(ChatAvailableReactionsSomeTypeID); err != nil { - return fmt.Errorf("unable to decode chatAvailableReactionsSome#d3cc0a6b: %w", err) + return fmt.Errorf("unable to decode chatAvailableReactionsSome#36b46b7d: %w", err) } return c.DecodeBare(b) } @@ -275,12 +320,12 @@ func (c *ChatAvailableReactionsSome) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatAvailableReactionsSome) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatAvailableReactionsSome#d3cc0a6b to nil") + return fmt.Errorf("can't decode chatAvailableReactionsSome#36b46b7d to nil") } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatAvailableReactionsSome#d3cc0a6b: field reactions: %w", err) + return fmt.Errorf("unable to decode chatAvailableReactionsSome#36b46b7d: field reactions: %w", err) } if headerLen > 0 { @@ -289,18 +334,25 @@ func (c *ChatAvailableReactionsSome) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeReactionType(b) if err != nil { - return fmt.Errorf("unable to decode chatAvailableReactionsSome#d3cc0a6b: field reactions: %w", err) + return fmt.Errorf("unable to decode chatAvailableReactionsSome#36b46b7d: field reactions: %w", err) } c.Reactions = append(c.Reactions, value) } } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatAvailableReactionsSome#36b46b7d: field max_reaction_count: %w", err) + } + c.MaxReactionCount = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *ChatAvailableReactionsSome) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatAvailableReactionsSome#d3cc0a6b as nil") + return fmt.Errorf("can't encode chatAvailableReactionsSome#36b46b7d as nil") } b.ObjStart() b.PutID("chatAvailableReactionsSome") @@ -309,16 +361,19 @@ func (c *ChatAvailableReactionsSome) EncodeTDLibJSON(b tdjson.Encoder) error { b.ArrStart() for idx, v := range c.Reactions { if v == nil { - return fmt.Errorf("unable to encode chatAvailableReactionsSome#d3cc0a6b: field reactions element with index %d is nil", idx) + return fmt.Errorf("unable to encode chatAvailableReactionsSome#36b46b7d: field reactions element with index %d is nil", idx) } if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatAvailableReactionsSome#d3cc0a6b: field reactions element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode chatAvailableReactionsSome#36b46b7d: field reactions element with index %d: %w", idx, err) } b.Comma() } b.StripComma() b.ArrEnd() b.Comma() + b.FieldStart("max_reaction_count") + b.PutInt32(c.MaxReactionCount) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -327,26 +382,32 @@ func (c *ChatAvailableReactionsSome) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *ChatAvailableReactionsSome) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatAvailableReactionsSome#d3cc0a6b to nil") + return fmt.Errorf("can't decode chatAvailableReactionsSome#36b46b7d to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("chatAvailableReactionsSome"); err != nil { - return fmt.Errorf("unable to decode chatAvailableReactionsSome#d3cc0a6b: %w", err) + return fmt.Errorf("unable to decode chatAvailableReactionsSome#36b46b7d: %w", err) } case "reactions": if err := b.Arr(func(b tdjson.Decoder) error { value, err := DecodeTDLibJSONReactionType(b) if err != nil { - return fmt.Errorf("unable to decode chatAvailableReactionsSome#d3cc0a6b: field reactions: %w", err) + return fmt.Errorf("unable to decode chatAvailableReactionsSome#36b46b7d: field reactions: %w", err) } c.Reactions = append(c.Reactions, value) return nil }); err != nil { - return fmt.Errorf("unable to decode chatAvailableReactionsSome#d3cc0a6b: field reactions: %w", err) + return fmt.Errorf("unable to decode chatAvailableReactionsSome#36b46b7d: field reactions: %w", err) } + case "max_reaction_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatAvailableReactionsSome#36b46b7d: field max_reaction_count: %w", err) + } + c.MaxReactionCount = value default: return b.Skip() } @@ -362,6 +423,14 @@ func (c *ChatAvailableReactionsSome) GetReactions() (value []ReactionTypeClass) return c.Reactions } +// GetMaxReactionCount returns value of MaxReactionCount field. +func (c *ChatAvailableReactionsSome) GetMaxReactionCount() (value int32) { + if c == nil { + return + } + return c.MaxReactionCount +} + // ChatAvailableReactionsClassName is schema name of ChatAvailableReactionsClass. const ChatAvailableReactionsClassName = "ChatAvailableReactions" @@ -374,8 +443,8 @@ const ChatAvailableReactionsClassName = "ChatAvailableReactions" // panic(err) // } // switch v := g.(type) { -// case *tdapi.ChatAvailableReactionsAll: // chatAvailableReactionsAll#dff07c4e -// case *tdapi.ChatAvailableReactionsSome: // chatAvailableReactionsSome#d3cc0a6b +// case *tdapi.ChatAvailableReactionsAll: // chatAvailableReactionsAll#29600b97 +// case *tdapi.ChatAvailableReactionsSome: // chatAvailableReactionsSome#36b46b7d // default: panic(v) // } type ChatAvailableReactionsClass interface { @@ -398,6 +467,9 @@ type ChatAvailableReactionsClass interface { EncodeTDLibJSON(b tdjson.Encoder) error DecodeTDLibJSON(b tdjson.Decoder) error + + // The maximum allowed number of reactions per message; 1-11 + GetMaxReactionCount() (value int32) } // DecodeChatAvailableReactions implements binary de-serialization for ChatAvailableReactionsClass. @@ -408,14 +480,14 @@ func DecodeChatAvailableReactions(buf *bin.Buffer) (ChatAvailableReactionsClass, } switch id { case ChatAvailableReactionsAllTypeID: - // Decoding chatAvailableReactionsAll#dff07c4e. + // Decoding chatAvailableReactionsAll#29600b97. v := ChatAvailableReactionsAll{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatAvailableReactionsClass: %w", err) } return &v, nil case ChatAvailableReactionsSomeTypeID: - // Decoding chatAvailableReactionsSome#d3cc0a6b. + // Decoding chatAvailableReactionsSome#36b46b7d. v := ChatAvailableReactionsSome{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatAvailableReactionsClass: %w", err) @@ -434,14 +506,14 @@ func DecodeTDLibJSONChatAvailableReactions(buf tdjson.Decoder) (ChatAvailableRea } switch id { case "chatAvailableReactionsAll": - // Decoding chatAvailableReactionsAll#dff07c4e. + // Decoding chatAvailableReactionsAll#29600b97. v := ChatAvailableReactionsAll{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatAvailableReactionsClass: %w", err) } return &v, nil case "chatAvailableReactionsSome": - // Decoding chatAvailableReactionsSome#d3cc0a6b. + // Decoding chatAvailableReactionsSome#36b46b7d. v := ChatAvailableReactionsSome{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatAvailableReactionsClass: %w", err) diff --git a/tdapi/tl_chat_revenue_amount_gen.go b/tdapi/tl_chat_revenue_amount_gen.go new file mode 100644 index 0000000000..2a52c9ebcb --- /dev/null +++ b/tdapi/tl_chat_revenue_amount_gen.go @@ -0,0 +1,297 @@ +// 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{} +) + +// ChatRevenueAmount represents TL type `chatRevenueAmount#4f3bb29f`. +type ChatRevenueAmount struct { + // Cryptocurrency in which revenue is calculated + Cryptocurrency string + // Total amount of the cryptocurrency earned, in the smallest units of the cryptocurrency + TotalAmount int64 + // Amount of the cryptocurrency that isn't withdrawn yet, in the smallest units of the + // cryptocurrency + BalanceAmount int64 + // Amount of the cryptocurrency available for withdrawal, in the smallest units of the + // cryptocurrency + AvailableAmount int64 +} + +// ChatRevenueAmountTypeID is TL type id of ChatRevenueAmount. +const ChatRevenueAmountTypeID = 0x4f3bb29f + +// Ensuring interfaces in compile-time for ChatRevenueAmount. +var ( + _ bin.Encoder = &ChatRevenueAmount{} + _ bin.Decoder = &ChatRevenueAmount{} + _ bin.BareEncoder = &ChatRevenueAmount{} + _ bin.BareDecoder = &ChatRevenueAmount{} +) + +func (c *ChatRevenueAmount) Zero() bool { + if c == nil { + return true + } + if !(c.Cryptocurrency == "") { + return false + } + if !(c.TotalAmount == 0) { + return false + } + if !(c.BalanceAmount == 0) { + return false + } + if !(c.AvailableAmount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChatRevenueAmount) String() string { + if c == nil { + return "ChatRevenueAmount(nil)" + } + type Alias ChatRevenueAmount + return fmt.Sprintf("ChatRevenueAmount%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChatRevenueAmount) TypeID() uint32 { + return ChatRevenueAmountTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChatRevenueAmount) TypeName() string { + return "chatRevenueAmount" +} + +// TypeInfo returns info about TL type. +func (c *ChatRevenueAmount) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "chatRevenueAmount", + ID: ChatRevenueAmountTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Cryptocurrency", + SchemaName: "cryptocurrency", + }, + { + Name: "TotalAmount", + SchemaName: "total_amount", + }, + { + Name: "BalanceAmount", + SchemaName: "balance_amount", + }, + { + Name: "AvailableAmount", + SchemaName: "available_amount", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChatRevenueAmount) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatRevenueAmount#4f3bb29f as nil") + } + b.PutID(ChatRevenueAmountTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChatRevenueAmount) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatRevenueAmount#4f3bb29f as nil") + } + b.PutString(c.Cryptocurrency) + b.PutLong(c.TotalAmount) + b.PutLong(c.BalanceAmount) + b.PutLong(c.AvailableAmount) + return nil +} + +// Decode implements bin.Decoder. +func (c *ChatRevenueAmount) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatRevenueAmount#4f3bb29f to nil") + } + if err := b.ConsumeID(ChatRevenueAmountTypeID); err != nil { + return fmt.Errorf("unable to decode chatRevenueAmount#4f3bb29f: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChatRevenueAmount) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatRevenueAmount#4f3bb29f to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatRevenueAmount#4f3bb29f: field cryptocurrency: %w", err) + } + c.Cryptocurrency = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode chatRevenueAmount#4f3bb29f: field total_amount: %w", err) + } + c.TotalAmount = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode chatRevenueAmount#4f3bb29f: field balance_amount: %w", err) + } + c.BalanceAmount = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode chatRevenueAmount#4f3bb29f: field available_amount: %w", err) + } + c.AvailableAmount = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatRevenueAmount) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatRevenueAmount#4f3bb29f as nil") + } + b.ObjStart() + b.PutID("chatRevenueAmount") + b.Comma() + b.FieldStart("cryptocurrency") + b.PutString(c.Cryptocurrency) + b.Comma() + b.FieldStart("total_amount") + b.PutLong(c.TotalAmount) + b.Comma() + b.FieldStart("balance_amount") + b.PutLong(c.BalanceAmount) + b.Comma() + b.FieldStart("available_amount") + b.PutLong(c.AvailableAmount) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ChatRevenueAmount) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode chatRevenueAmount#4f3bb29f to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("chatRevenueAmount"); err != nil { + return fmt.Errorf("unable to decode chatRevenueAmount#4f3bb29f: %w", err) + } + case "cryptocurrency": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatRevenueAmount#4f3bb29f: field cryptocurrency: %w", err) + } + c.Cryptocurrency = value + case "total_amount": + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode chatRevenueAmount#4f3bb29f: field total_amount: %w", err) + } + c.TotalAmount = value + case "balance_amount": + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode chatRevenueAmount#4f3bb29f: field balance_amount: %w", err) + } + c.BalanceAmount = value + case "available_amount": + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode chatRevenueAmount#4f3bb29f: field available_amount: %w", err) + } + c.AvailableAmount = value + default: + return b.Skip() + } + return nil + }) +} + +// GetCryptocurrency returns value of Cryptocurrency field. +func (c *ChatRevenueAmount) GetCryptocurrency() (value string) { + if c == nil { + return + } + return c.Cryptocurrency +} + +// GetTotalAmount returns value of TotalAmount field. +func (c *ChatRevenueAmount) GetTotalAmount() (value int64) { + if c == nil { + return + } + return c.TotalAmount +} + +// GetBalanceAmount returns value of BalanceAmount field. +func (c *ChatRevenueAmount) GetBalanceAmount() (value int64) { + if c == nil { + return + } + return c.BalanceAmount +} + +// GetAvailableAmount returns value of AvailableAmount field. +func (c *ChatRevenueAmount) GetAvailableAmount() (value int64) { + if c == nil { + return + } + return c.AvailableAmount +} diff --git a/tdapi/tl_chat_revenue_statistics_gen.go b/tdapi/tl_chat_revenue_statistics_gen.go index d7c3aaa6bf..c49480301a 100644 --- a/tdapi/tl_chat_revenue_statistics_gen.go +++ b/tdapi/tl_chat_revenue_statistics_gen.go @@ -31,28 +31,20 @@ var ( _ = tdjson.Encoder{} ) -// ChatRevenueStatistics represents TL type `chatRevenueStatistics#a5504cd4`. +// ChatRevenueStatistics represents TL type `chatRevenueStatistics#636318bb`. type ChatRevenueStatistics struct { // A graph containing amount of revenue in a given hour RevenueByHourGraph StatisticalGraphClass // A graph containing amount of revenue RevenueGraph StatisticalGraphClass - // Cryptocurrency in which revenue is calculated - Cryptocurrency string - // Total amount of the cryptocurrency earned, in the smallest units of the cryptocurrency - CryptocurrencyTotalAmount int64 - // Amount of the cryptocurrency that isn't withdrawn yet, in the smallest units of the - // cryptocurrency - CryptocurrencyBalanceAmount int64 - // Amount of the cryptocurrency available for withdrawal, in the smallest units of the - // cryptocurrency - CryptocurrencyAvailableAmount int64 - // Current conversion rate of the cryptocurrency to USD + // Amount of earned revenue + RevenueAmount ChatRevenueAmount + // Current conversion rate of the cryptocurrency in which revenue is calculated to USD UsdRate float64 } // ChatRevenueStatisticsTypeID is TL type id of ChatRevenueStatistics. -const ChatRevenueStatisticsTypeID = 0xa5504cd4 +const ChatRevenueStatisticsTypeID = 0x636318bb // Ensuring interfaces in compile-time for ChatRevenueStatistics. var ( @@ -72,16 +64,7 @@ func (c *ChatRevenueStatistics) Zero() bool { if !(c.RevenueGraph == nil) { return false } - if !(c.Cryptocurrency == "") { - return false - } - if !(c.CryptocurrencyTotalAmount == 0) { - return false - } - if !(c.CryptocurrencyBalanceAmount == 0) { - return false - } - if !(c.CryptocurrencyAvailableAmount == 0) { + if !(c.RevenueAmount.Zero()) { return false } if !(c.UsdRate == 0) { @@ -132,20 +115,8 @@ func (c *ChatRevenueStatistics) TypeInfo() tdp.Type { SchemaName: "revenue_graph", }, { - Name: "Cryptocurrency", - SchemaName: "cryptocurrency", - }, - { - Name: "CryptocurrencyTotalAmount", - SchemaName: "cryptocurrency_total_amount", - }, - { - Name: "CryptocurrencyBalanceAmount", - SchemaName: "cryptocurrency_balance_amount", - }, - { - Name: "CryptocurrencyAvailableAmount", - SchemaName: "cryptocurrency_available_amount", + Name: "RevenueAmount", + SchemaName: "revenue_amount", }, { Name: "UsdRate", @@ -158,7 +129,7 @@ func (c *ChatRevenueStatistics) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *ChatRevenueStatistics) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatRevenueStatistics#a5504cd4 as nil") + return fmt.Errorf("can't encode chatRevenueStatistics#636318bb as nil") } b.PutID(ChatRevenueStatisticsTypeID) return c.EncodeBare(b) @@ -167,24 +138,23 @@ func (c *ChatRevenueStatistics) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatRevenueStatistics) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatRevenueStatistics#a5504cd4 as nil") + return fmt.Errorf("can't encode chatRevenueStatistics#636318bb as nil") } if c.RevenueByHourGraph == nil { - return fmt.Errorf("unable to encode chatRevenueStatistics#a5504cd4: field revenue_by_hour_graph is nil") + return fmt.Errorf("unable to encode chatRevenueStatistics#636318bb: field revenue_by_hour_graph is nil") } if err := c.RevenueByHourGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatRevenueStatistics#a5504cd4: field revenue_by_hour_graph: %w", err) + return fmt.Errorf("unable to encode chatRevenueStatistics#636318bb: field revenue_by_hour_graph: %w", err) } if c.RevenueGraph == nil { - return fmt.Errorf("unable to encode chatRevenueStatistics#a5504cd4: field revenue_graph is nil") + return fmt.Errorf("unable to encode chatRevenueStatistics#636318bb: field revenue_graph is nil") } if err := c.RevenueGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatRevenueStatistics#a5504cd4: field revenue_graph: %w", err) + return fmt.Errorf("unable to encode chatRevenueStatistics#636318bb: field revenue_graph: %w", err) + } + if err := c.RevenueAmount.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatRevenueStatistics#636318bb: field revenue_amount: %w", err) } - b.PutString(c.Cryptocurrency) - b.PutLong(c.CryptocurrencyTotalAmount) - b.PutLong(c.CryptocurrencyBalanceAmount) - b.PutLong(c.CryptocurrencyAvailableAmount) b.PutDouble(c.UsdRate) return nil } @@ -192,10 +162,10 @@ func (c *ChatRevenueStatistics) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (c *ChatRevenueStatistics) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatRevenueStatistics#a5504cd4 to nil") + return fmt.Errorf("can't decode chatRevenueStatistics#636318bb to nil") } if err := b.ConsumeID(ChatRevenueStatisticsTypeID); err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#a5504cd4: %w", err) + return fmt.Errorf("unable to decode chatRevenueStatistics#636318bb: %w", err) } return c.DecodeBare(b) } @@ -203,54 +173,31 @@ func (c *ChatRevenueStatistics) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatRevenueStatistics) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatRevenueStatistics#a5504cd4 to nil") + return fmt.Errorf("can't decode chatRevenueStatistics#636318bb to nil") } { value, err := DecodeStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#a5504cd4: field revenue_by_hour_graph: %w", err) + return fmt.Errorf("unable to decode chatRevenueStatistics#636318bb: field revenue_by_hour_graph: %w", err) } c.RevenueByHourGraph = value } { value, err := DecodeStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#a5504cd4: field revenue_graph: %w", err) + return fmt.Errorf("unable to decode chatRevenueStatistics#636318bb: field revenue_graph: %w", err) } c.RevenueGraph = value } { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#a5504cd4: field cryptocurrency: %w", err) - } - c.Cryptocurrency = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#a5504cd4: field cryptocurrency_total_amount: %w", err) - } - c.CryptocurrencyTotalAmount = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#a5504cd4: field cryptocurrency_balance_amount: %w", err) - } - c.CryptocurrencyBalanceAmount = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#a5504cd4: field cryptocurrency_available_amount: %w", err) + if err := c.RevenueAmount.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatRevenueStatistics#636318bb: field revenue_amount: %w", err) } - c.CryptocurrencyAvailableAmount = value } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#a5504cd4: field usd_rate: %w", err) + return fmt.Errorf("unable to decode chatRevenueStatistics#636318bb: field usd_rate: %w", err) } c.UsdRate = value } @@ -260,38 +207,31 @@ func (c *ChatRevenueStatistics) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *ChatRevenueStatistics) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatRevenueStatistics#a5504cd4 as nil") + return fmt.Errorf("can't encode chatRevenueStatistics#636318bb as nil") } b.ObjStart() b.PutID("chatRevenueStatistics") b.Comma() b.FieldStart("revenue_by_hour_graph") if c.RevenueByHourGraph == nil { - return fmt.Errorf("unable to encode chatRevenueStatistics#a5504cd4: field revenue_by_hour_graph is nil") + return fmt.Errorf("unable to encode chatRevenueStatistics#636318bb: field revenue_by_hour_graph is nil") } if err := c.RevenueByHourGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatRevenueStatistics#a5504cd4: field revenue_by_hour_graph: %w", err) + return fmt.Errorf("unable to encode chatRevenueStatistics#636318bb: field revenue_by_hour_graph: %w", err) } b.Comma() b.FieldStart("revenue_graph") if c.RevenueGraph == nil { - return fmt.Errorf("unable to encode chatRevenueStatistics#a5504cd4: field revenue_graph is nil") + return fmt.Errorf("unable to encode chatRevenueStatistics#636318bb: field revenue_graph is nil") } if err := c.RevenueGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatRevenueStatistics#a5504cd4: field revenue_graph: %w", err) + return fmt.Errorf("unable to encode chatRevenueStatistics#636318bb: field revenue_graph: %w", err) } b.Comma() - b.FieldStart("cryptocurrency") - b.PutString(c.Cryptocurrency) - b.Comma() - b.FieldStart("cryptocurrency_total_amount") - b.PutLong(c.CryptocurrencyTotalAmount) - b.Comma() - b.FieldStart("cryptocurrency_balance_amount") - b.PutLong(c.CryptocurrencyBalanceAmount) - b.Comma() - b.FieldStart("cryptocurrency_available_amount") - b.PutLong(c.CryptocurrencyAvailableAmount) + b.FieldStart("revenue_amount") + if err := c.RevenueAmount.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatRevenueStatistics#636318bb: field revenue_amount: %w", err) + } b.Comma() b.FieldStart("usd_rate") b.PutDouble(c.UsdRate) @@ -304,55 +244,35 @@ func (c *ChatRevenueStatistics) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *ChatRevenueStatistics) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatRevenueStatistics#a5504cd4 to nil") + return fmt.Errorf("can't decode chatRevenueStatistics#636318bb to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("chatRevenueStatistics"); err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#a5504cd4: %w", err) + return fmt.Errorf("unable to decode chatRevenueStatistics#636318bb: %w", err) } case "revenue_by_hour_graph": value, err := DecodeTDLibJSONStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#a5504cd4: field revenue_by_hour_graph: %w", err) + return fmt.Errorf("unable to decode chatRevenueStatistics#636318bb: field revenue_by_hour_graph: %w", err) } c.RevenueByHourGraph = value case "revenue_graph": value, err := DecodeTDLibJSONStatisticalGraph(b) if err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#a5504cd4: field revenue_graph: %w", err) + return fmt.Errorf("unable to decode chatRevenueStatistics#636318bb: field revenue_graph: %w", err) } c.RevenueGraph = value - case "cryptocurrency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#a5504cd4: field cryptocurrency: %w", err) - } - c.Cryptocurrency = value - case "cryptocurrency_total_amount": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#a5504cd4: field cryptocurrency_total_amount: %w", err) + case "revenue_amount": + if err := c.RevenueAmount.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode chatRevenueStatistics#636318bb: field revenue_amount: %w", err) } - c.CryptocurrencyTotalAmount = value - case "cryptocurrency_balance_amount": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#a5504cd4: field cryptocurrency_balance_amount: %w", err) - } - c.CryptocurrencyBalanceAmount = value - case "cryptocurrency_available_amount": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#a5504cd4: field cryptocurrency_available_amount: %w", err) - } - c.CryptocurrencyAvailableAmount = value case "usd_rate": value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#a5504cd4: field usd_rate: %w", err) + return fmt.Errorf("unable to decode chatRevenueStatistics#636318bb: field usd_rate: %w", err) } c.UsdRate = value default: @@ -378,36 +298,12 @@ func (c *ChatRevenueStatistics) GetRevenueGraph() (value StatisticalGraphClass) return c.RevenueGraph } -// GetCryptocurrency returns value of Cryptocurrency field. -func (c *ChatRevenueStatistics) GetCryptocurrency() (value string) { - if c == nil { - return - } - return c.Cryptocurrency -} - -// GetCryptocurrencyTotalAmount returns value of CryptocurrencyTotalAmount field. -func (c *ChatRevenueStatistics) GetCryptocurrencyTotalAmount() (value int64) { - if c == nil { - return - } - return c.CryptocurrencyTotalAmount -} - -// GetCryptocurrencyBalanceAmount returns value of CryptocurrencyBalanceAmount field. -func (c *ChatRevenueStatistics) GetCryptocurrencyBalanceAmount() (value int64) { - if c == nil { - return - } - return c.CryptocurrencyBalanceAmount -} - -// GetCryptocurrencyAvailableAmount returns value of CryptocurrencyAvailableAmount field. -func (c *ChatRevenueStatistics) GetCryptocurrencyAvailableAmount() (value int64) { +// GetRevenueAmount returns value of RevenueAmount field. +func (c *ChatRevenueStatistics) GetRevenueAmount() (value ChatRevenueAmount) { if c == nil { return } - return c.CryptocurrencyAvailableAmount + return c.RevenueAmount } // GetUsdRate returns value of UsdRate field. diff --git a/tdapi/tl_delete_account_gen.go b/tdapi/tl_delete_account_gen.go index 0c690cc8fb..485d354031 100644 --- a/tdapi/tl_delete_account_gen.go +++ b/tdapi/tl_delete_account_gen.go @@ -35,8 +35,9 @@ var ( type DeleteAccountRequest struct { // The reason why the account was deleted; optional Reason string - // The 2-step verification password of the current user. If not specified, account - // deletion can be canceled within one week + // The 2-step verification password of the current user. If the current user isn't + // authorized, then an empty string can be passed and account deletion can be canceled + // within one week Password string } diff --git a/tdapi/tl_edit_inline_message_live_location_gen.go b/tdapi/tl_edit_inline_message_live_location_gen.go index 2b8e9f7534..e2344cd8ea 100644 --- a/tdapi/tl_edit_inline_message_live_location_gen.go +++ b/tdapi/tl_edit_inline_message_live_location_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// EditInlineMessageLiveLocationRequest represents TL type `editInlineMessageLiveLocation#f6a5da00`. +// EditInlineMessageLiveLocationRequest represents TL type `editInlineMessageLiveLocation#7f37a0ac`. type EditInlineMessageLiveLocationRequest struct { // Inline message identifier InlineMessageID string @@ -39,6 +39,9 @@ type EditInlineMessageLiveLocationRequest struct { ReplyMarkup ReplyMarkupClass // New location content of the message; pass null to stop sharing the live location Location Location + // New time relative to the message send date, for which the location can be updated, in + // seconds. If 0x7FFFFFFF specified, then the location can be updated forever. + LivePeriod int32 // The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown Heading int32 // The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the @@ -47,7 +50,7 @@ type EditInlineMessageLiveLocationRequest struct { } // EditInlineMessageLiveLocationRequestTypeID is TL type id of EditInlineMessageLiveLocationRequest. -const EditInlineMessageLiveLocationRequestTypeID = 0xf6a5da00 +const EditInlineMessageLiveLocationRequestTypeID = 0x7f37a0ac // Ensuring interfaces in compile-time for EditInlineMessageLiveLocationRequest. var ( @@ -70,6 +73,9 @@ func (e *EditInlineMessageLiveLocationRequest) Zero() bool { if !(e.Location.Zero()) { return false } + if !(e.LivePeriod == 0) { + return false + } if !(e.Heading == 0) { return false } @@ -124,6 +130,10 @@ func (e *EditInlineMessageLiveLocationRequest) TypeInfo() tdp.Type { Name: "Location", SchemaName: "location", }, + { + Name: "LivePeriod", + SchemaName: "live_period", + }, { Name: "Heading", SchemaName: "heading", @@ -139,7 +149,7 @@ func (e *EditInlineMessageLiveLocationRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (e *EditInlineMessageLiveLocationRequest) Encode(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't encode editInlineMessageLiveLocation#f6a5da00 as nil") + return fmt.Errorf("can't encode editInlineMessageLiveLocation#7f37a0ac as nil") } b.PutID(EditInlineMessageLiveLocationRequestTypeID) return e.EncodeBare(b) @@ -148,18 +158,19 @@ func (e *EditInlineMessageLiveLocationRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (e *EditInlineMessageLiveLocationRequest) EncodeBare(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't encode editInlineMessageLiveLocation#f6a5da00 as nil") + return fmt.Errorf("can't encode editInlineMessageLiveLocation#7f37a0ac as nil") } b.PutString(e.InlineMessageID) if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editInlineMessageLiveLocation#f6a5da00: field reply_markup is nil") + return fmt.Errorf("unable to encode editInlineMessageLiveLocation#7f37a0ac: field reply_markup is nil") } if err := e.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageLiveLocation#f6a5da00: field reply_markup: %w", err) + return fmt.Errorf("unable to encode editInlineMessageLiveLocation#7f37a0ac: field reply_markup: %w", err) } if err := e.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageLiveLocation#f6a5da00: field location: %w", err) + return fmt.Errorf("unable to encode editInlineMessageLiveLocation#7f37a0ac: field location: %w", err) } + b.PutInt32(e.LivePeriod) b.PutInt32(e.Heading) b.PutInt32(e.ProximityAlertRadius) return nil @@ -168,10 +179,10 @@ func (e *EditInlineMessageLiveLocationRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (e *EditInlineMessageLiveLocationRequest) Decode(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't decode editInlineMessageLiveLocation#f6a5da00 to nil") + return fmt.Errorf("can't decode editInlineMessageLiveLocation#7f37a0ac to nil") } if err := b.ConsumeID(EditInlineMessageLiveLocationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#f6a5da00: %w", err) + return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: %w", err) } return e.DecodeBare(b) } @@ -179,38 +190,45 @@ func (e *EditInlineMessageLiveLocationRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (e *EditInlineMessageLiveLocationRequest) DecodeBare(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't decode editInlineMessageLiveLocation#f6a5da00 to nil") + return fmt.Errorf("can't decode editInlineMessageLiveLocation#7f37a0ac to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#f6a5da00: field inline_message_id: %w", err) + return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field inline_message_id: %w", err) } e.InlineMessageID = value } { value, err := DecodeReplyMarkup(b) if err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#f6a5da00: field reply_markup: %w", err) + return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field reply_markup: %w", err) } e.ReplyMarkup = value } { if err := e.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#f6a5da00: field location: %w", err) + return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field location: %w", err) + } + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field live_period: %w", err) } + e.LivePeriod = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#f6a5da00: field heading: %w", err) + return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field heading: %w", err) } e.Heading = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#f6a5da00: field proximity_alert_radius: %w", err) + return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field proximity_alert_radius: %w", err) } e.ProximityAlertRadius = value } @@ -220,7 +238,7 @@ func (e *EditInlineMessageLiveLocationRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (e *EditInlineMessageLiveLocationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if e == nil { - return fmt.Errorf("can't encode editInlineMessageLiveLocation#f6a5da00 as nil") + return fmt.Errorf("can't encode editInlineMessageLiveLocation#7f37a0ac as nil") } b.ObjStart() b.PutID("editInlineMessageLiveLocation") @@ -230,17 +248,20 @@ func (e *EditInlineMessageLiveLocationRequest) EncodeTDLibJSON(b tdjson.Encoder) b.Comma() b.FieldStart("reply_markup") if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editInlineMessageLiveLocation#f6a5da00: field reply_markup is nil") + return fmt.Errorf("unable to encode editInlineMessageLiveLocation#7f37a0ac: field reply_markup is nil") } if err := e.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageLiveLocation#f6a5da00: field reply_markup: %w", err) + return fmt.Errorf("unable to encode editInlineMessageLiveLocation#7f37a0ac: field reply_markup: %w", err) } b.Comma() b.FieldStart("location") if err := e.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageLiveLocation#f6a5da00: field location: %w", err) + return fmt.Errorf("unable to encode editInlineMessageLiveLocation#7f37a0ac: field location: %w", err) } b.Comma() + b.FieldStart("live_period") + b.PutInt32(e.LivePeriod) + b.Comma() b.FieldStart("heading") b.PutInt32(e.Heading) b.Comma() @@ -255,41 +276,47 @@ func (e *EditInlineMessageLiveLocationRequest) EncodeTDLibJSON(b tdjson.Encoder) // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (e *EditInlineMessageLiveLocationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if e == nil { - return fmt.Errorf("can't decode editInlineMessageLiveLocation#f6a5da00 to nil") + return fmt.Errorf("can't decode editInlineMessageLiveLocation#7f37a0ac to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("editInlineMessageLiveLocation"); err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#f6a5da00: %w", err) + return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: %w", err) } case "inline_message_id": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#f6a5da00: field inline_message_id: %w", err) + return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field inline_message_id: %w", err) } e.InlineMessageID = value case "reply_markup": value, err := DecodeTDLibJSONReplyMarkup(b) if err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#f6a5da00: field reply_markup: %w", err) + return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field reply_markup: %w", err) } e.ReplyMarkup = value case "location": if err := e.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#f6a5da00: field location: %w", err) + return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field location: %w", err) } + case "live_period": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field live_period: %w", err) + } + e.LivePeriod = value case "heading": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#f6a5da00: field heading: %w", err) + return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field heading: %w", err) } e.Heading = value case "proximity_alert_radius": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#f6a5da00: field proximity_alert_radius: %w", err) + return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field proximity_alert_radius: %w", err) } e.ProximityAlertRadius = value default: @@ -323,6 +350,14 @@ func (e *EditInlineMessageLiveLocationRequest) GetLocation() (value Location) { return e.Location } +// GetLivePeriod returns value of LivePeriod field. +func (e *EditInlineMessageLiveLocationRequest) GetLivePeriod() (value int32) { + if e == nil { + return + } + return e.LivePeriod +} + // GetHeading returns value of Heading field. func (e *EditInlineMessageLiveLocationRequest) GetHeading() (value int32) { if e == nil { @@ -339,7 +374,7 @@ func (e *EditInlineMessageLiveLocationRequest) GetProximityAlertRadius() (value return e.ProximityAlertRadius } -// EditInlineMessageLiveLocation invokes method editInlineMessageLiveLocation#f6a5da00 returning error if any. +// EditInlineMessageLiveLocation invokes method editInlineMessageLiveLocation#7f37a0ac returning error if any. func (c *Client) EditInlineMessageLiveLocation(ctx context.Context, request *EditInlineMessageLiveLocationRequest) error { var ok Ok diff --git a/tdapi/tl_edit_message_live_location_gen.go b/tdapi/tl_edit_message_live_location_gen.go index dc3b32ba43..93351e826b 100644 --- a/tdapi/tl_edit_message_live_location_gen.go +++ b/tdapi/tl_edit_message_live_location_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// EditMessageLiveLocationRequest represents TL type `editMessageLiveLocation#ff29a512`. +// EditMessageLiveLocationRequest represents TL type `editMessageLiveLocation#8f511394`. type EditMessageLiveLocationRequest struct { // The chat the message belongs to ChatID int64 @@ -41,6 +41,9 @@ type EditMessageLiveLocationRequest struct { ReplyMarkup ReplyMarkupClass // New location content of the message; pass null to stop sharing the live location Location Location + // New time relative to the message send date, for which the location can be updated, in + // seconds. If 0x7FFFFFFF specified, then the location can be updated forever. + LivePeriod int32 // The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown Heading int32 // The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the @@ -49,7 +52,7 @@ type EditMessageLiveLocationRequest struct { } // EditMessageLiveLocationRequestTypeID is TL type id of EditMessageLiveLocationRequest. -const EditMessageLiveLocationRequestTypeID = 0xff29a512 +const EditMessageLiveLocationRequestTypeID = 0x8f511394 // Ensuring interfaces in compile-time for EditMessageLiveLocationRequest. var ( @@ -75,6 +78,9 @@ func (e *EditMessageLiveLocationRequest) Zero() bool { if !(e.Location.Zero()) { return false } + if !(e.LivePeriod == 0) { + return false + } if !(e.Heading == 0) { return false } @@ -133,6 +139,10 @@ func (e *EditMessageLiveLocationRequest) TypeInfo() tdp.Type { Name: "Location", SchemaName: "location", }, + { + Name: "LivePeriod", + SchemaName: "live_period", + }, { Name: "Heading", SchemaName: "heading", @@ -148,7 +158,7 @@ func (e *EditMessageLiveLocationRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (e *EditMessageLiveLocationRequest) Encode(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't encode editMessageLiveLocation#ff29a512 as nil") + return fmt.Errorf("can't encode editMessageLiveLocation#8f511394 as nil") } b.PutID(EditMessageLiveLocationRequestTypeID) return e.EncodeBare(b) @@ -157,19 +167,20 @@ func (e *EditMessageLiveLocationRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (e *EditMessageLiveLocationRequest) EncodeBare(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't encode editMessageLiveLocation#ff29a512 as nil") + return fmt.Errorf("can't encode editMessageLiveLocation#8f511394 as nil") } b.PutInt53(e.ChatID) b.PutInt53(e.MessageID) if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editMessageLiveLocation#ff29a512: field reply_markup is nil") + return fmt.Errorf("unable to encode editMessageLiveLocation#8f511394: field reply_markup is nil") } if err := e.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode editMessageLiveLocation#ff29a512: field reply_markup: %w", err) + return fmt.Errorf("unable to encode editMessageLiveLocation#8f511394: field reply_markup: %w", err) } if err := e.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode editMessageLiveLocation#ff29a512: field location: %w", err) + return fmt.Errorf("unable to encode editMessageLiveLocation#8f511394: field location: %w", err) } + b.PutInt32(e.LivePeriod) b.PutInt32(e.Heading) b.PutInt32(e.ProximityAlertRadius) return nil @@ -178,10 +189,10 @@ func (e *EditMessageLiveLocationRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (e *EditMessageLiveLocationRequest) Decode(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't decode editMessageLiveLocation#ff29a512 to nil") + return fmt.Errorf("can't decode editMessageLiveLocation#8f511394 to nil") } if err := b.ConsumeID(EditMessageLiveLocationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#ff29a512: %w", err) + return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: %w", err) } return e.DecodeBare(b) } @@ -189,45 +200,52 @@ func (e *EditMessageLiveLocationRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (e *EditMessageLiveLocationRequest) DecodeBare(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't decode editMessageLiveLocation#ff29a512 to nil") + return fmt.Errorf("can't decode editMessageLiveLocation#8f511394 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#ff29a512: field chat_id: %w", err) + return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field chat_id: %w", err) } e.ChatID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#ff29a512: field message_id: %w", err) + return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field message_id: %w", err) } e.MessageID = value } { value, err := DecodeReplyMarkup(b) if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#ff29a512: field reply_markup: %w", err) + return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field reply_markup: %w", err) } e.ReplyMarkup = value } { if err := e.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#ff29a512: field location: %w", err) + return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field location: %w", err) + } + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field live_period: %w", err) } + e.LivePeriod = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#ff29a512: field heading: %w", err) + return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field heading: %w", err) } e.Heading = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#ff29a512: field proximity_alert_radius: %w", err) + return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field proximity_alert_radius: %w", err) } e.ProximityAlertRadius = value } @@ -237,7 +255,7 @@ func (e *EditMessageLiveLocationRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (e *EditMessageLiveLocationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if e == nil { - return fmt.Errorf("can't encode editMessageLiveLocation#ff29a512 as nil") + return fmt.Errorf("can't encode editMessageLiveLocation#8f511394 as nil") } b.ObjStart() b.PutID("editMessageLiveLocation") @@ -250,17 +268,20 @@ func (e *EditMessageLiveLocationRequest) EncodeTDLibJSON(b tdjson.Encoder) error b.Comma() b.FieldStart("reply_markup") if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editMessageLiveLocation#ff29a512: field reply_markup is nil") + return fmt.Errorf("unable to encode editMessageLiveLocation#8f511394: field reply_markup is nil") } if err := e.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editMessageLiveLocation#ff29a512: field reply_markup: %w", err) + return fmt.Errorf("unable to encode editMessageLiveLocation#8f511394: field reply_markup: %w", err) } b.Comma() b.FieldStart("location") if err := e.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editMessageLiveLocation#ff29a512: field location: %w", err) + return fmt.Errorf("unable to encode editMessageLiveLocation#8f511394: field location: %w", err) } b.Comma() + b.FieldStart("live_period") + b.PutInt32(e.LivePeriod) + b.Comma() b.FieldStart("heading") b.PutInt32(e.Heading) b.Comma() @@ -275,47 +296,53 @@ func (e *EditMessageLiveLocationRequest) EncodeTDLibJSON(b tdjson.Encoder) error // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (e *EditMessageLiveLocationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if e == nil { - return fmt.Errorf("can't decode editMessageLiveLocation#ff29a512 to nil") + return fmt.Errorf("can't decode editMessageLiveLocation#8f511394 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("editMessageLiveLocation"); err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#ff29a512: %w", err) + return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#ff29a512: field chat_id: %w", err) + return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field chat_id: %w", err) } e.ChatID = value case "message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#ff29a512: field message_id: %w", err) + return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field message_id: %w", err) } e.MessageID = value case "reply_markup": value, err := DecodeTDLibJSONReplyMarkup(b) if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#ff29a512: field reply_markup: %w", err) + return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field reply_markup: %w", err) } e.ReplyMarkup = value case "location": if err := e.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#ff29a512: field location: %w", err) + return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field location: %w", err) } + case "live_period": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field live_period: %w", err) + } + e.LivePeriod = value case "heading": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#ff29a512: field heading: %w", err) + return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field heading: %w", err) } e.Heading = value case "proximity_alert_radius": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#ff29a512: field proximity_alert_radius: %w", err) + return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field proximity_alert_radius: %w", err) } e.ProximityAlertRadius = value default: @@ -357,6 +384,14 @@ func (e *EditMessageLiveLocationRequest) GetLocation() (value Location) { return e.Location } +// GetLivePeriod returns value of LivePeriod field. +func (e *EditMessageLiveLocationRequest) GetLivePeriod() (value int32) { + if e == nil { + return + } + return e.LivePeriod +} + // GetHeading returns value of Heading field. func (e *EditMessageLiveLocationRequest) GetHeading() (value int32) { if e == nil { @@ -373,7 +408,7 @@ func (e *EditMessageLiveLocationRequest) GetProximityAlertRadius() (value int32) return e.ProximityAlertRadius } -// EditMessageLiveLocation invokes method editMessageLiveLocation#ff29a512 returning error if any. +// EditMessageLiveLocation invokes method editMessageLiveLocation#8f511394 returning error if any. func (c *Client) EditMessageLiveLocation(ctx context.Context, request *EditMessageLiveLocationRequest) (*Message, error) { var result Message diff --git a/tdapi/tl_emoji_category_gen.go b/tdapi/tl_emoji_category_gen.go index 2e9696bf87..1ecdd3bbdc 100644 --- a/tdapi/tl_emoji_category_gen.go +++ b/tdapi/tl_emoji_category_gen.go @@ -31,18 +31,20 @@ var ( _ = tdjson.Encoder{} ) -// EmojiCategory represents TL type `emojiCategory#c6e9e5a4`. +// EmojiCategory represents TL type `emojiCategory#220de4ef`. type EmojiCategory struct { // Name of the category Name string // Custom emoji sticker, which represents icon of the category Icon Sticker - // List of emojis in the category - Emojis []string + // Source of stickers for the emoji category + Source EmojiCategorySourceClass + // True, if the category must be shown first when choosing a sticker for the start page + IsGreeting bool } // EmojiCategoryTypeID is TL type id of EmojiCategory. -const EmojiCategoryTypeID = 0xc6e9e5a4 +const EmojiCategoryTypeID = 0x220de4ef // Ensuring interfaces in compile-time for EmojiCategory. var ( @@ -62,7 +64,10 @@ func (e *EmojiCategory) Zero() bool { if !(e.Icon.Zero()) { return false } - if !(e.Emojis == nil) { + if !(e.Source == nil) { + return false + } + if !(e.IsGreeting == false) { return false } @@ -110,8 +115,12 @@ func (e *EmojiCategory) TypeInfo() tdp.Type { SchemaName: "icon", }, { - Name: "Emojis", - SchemaName: "emojis", + Name: "Source", + SchemaName: "source", + }, + { + Name: "IsGreeting", + SchemaName: "is_greeting", }, } return typ @@ -120,7 +129,7 @@ func (e *EmojiCategory) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (e *EmojiCategory) Encode(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't encode emojiCategory#c6e9e5a4 as nil") + return fmt.Errorf("can't encode emojiCategory#220de4ef as nil") } b.PutID(EmojiCategoryTypeID) return e.EncodeBare(b) @@ -129,26 +138,29 @@ func (e *EmojiCategory) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (e *EmojiCategory) EncodeBare(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't encode emojiCategory#c6e9e5a4 as nil") + return fmt.Errorf("can't encode emojiCategory#220de4ef as nil") } b.PutString(e.Name) if err := e.Icon.Encode(b); err != nil { - return fmt.Errorf("unable to encode emojiCategory#c6e9e5a4: field icon: %w", err) + return fmt.Errorf("unable to encode emojiCategory#220de4ef: field icon: %w", err) + } + if e.Source == nil { + return fmt.Errorf("unable to encode emojiCategory#220de4ef: field source is nil") } - b.PutInt(len(e.Emojis)) - for _, v := range e.Emojis { - b.PutString(v) + if err := e.Source.Encode(b); err != nil { + return fmt.Errorf("unable to encode emojiCategory#220de4ef: field source: %w", err) } + b.PutBool(e.IsGreeting) return nil } // Decode implements bin.Decoder. func (e *EmojiCategory) Decode(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't decode emojiCategory#c6e9e5a4 to nil") + return fmt.Errorf("can't decode emojiCategory#220de4ef to nil") } if err := b.ConsumeID(EmojiCategoryTypeID); err != nil { - return fmt.Errorf("unable to decode emojiCategory#c6e9e5a4: %w", err) + return fmt.Errorf("unable to decode emojiCategory#220de4ef: %w", err) } return e.DecodeBare(b) } @@ -156,36 +168,33 @@ func (e *EmojiCategory) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (e *EmojiCategory) DecodeBare(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't decode emojiCategory#c6e9e5a4 to nil") + return fmt.Errorf("can't decode emojiCategory#220de4ef to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode emojiCategory#c6e9e5a4: field name: %w", err) + return fmt.Errorf("unable to decode emojiCategory#220de4ef: field name: %w", err) } e.Name = value } { if err := e.Icon.Decode(b); err != nil { - return fmt.Errorf("unable to decode emojiCategory#c6e9e5a4: field icon: %w", err) + return fmt.Errorf("unable to decode emojiCategory#220de4ef: field icon: %w", err) } } { - headerLen, err := b.Int() + value, err := DecodeEmojiCategorySource(b) if err != nil { - return fmt.Errorf("unable to decode emojiCategory#c6e9e5a4: field emojis: %w", err) - } - - if headerLen > 0 { - e.Emojis = make([]string, 0, headerLen%bin.PreallocateLimit) + return fmt.Errorf("unable to decode emojiCategory#220de4ef: field source: %w", err) } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emojiCategory#c6e9e5a4: field emojis: %w", err) - } - e.Emojis = append(e.Emojis, value) + e.Source = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode emojiCategory#220de4ef: field is_greeting: %w", err) } + e.IsGreeting = value } return nil } @@ -193,7 +202,7 @@ func (e *EmojiCategory) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (e *EmojiCategory) EncodeTDLibJSON(b tdjson.Encoder) error { if e == nil { - return fmt.Errorf("can't encode emojiCategory#c6e9e5a4 as nil") + return fmt.Errorf("can't encode emojiCategory#220de4ef as nil") } b.ObjStart() b.PutID("emojiCategory") @@ -203,17 +212,19 @@ func (e *EmojiCategory) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("icon") if err := e.Icon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode emojiCategory#c6e9e5a4: field icon: %w", err) + return fmt.Errorf("unable to encode emojiCategory#220de4ef: field icon: %w", err) } b.Comma() - b.FieldStart("emojis") - b.ArrStart() - for _, v := range e.Emojis { - b.PutString(v) - b.Comma() + b.FieldStart("source") + if e.Source == nil { + return fmt.Errorf("unable to encode emojiCategory#220de4ef: field source is nil") + } + if err := e.Source.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode emojiCategory#220de4ef: field source: %w", err) } - b.StripComma() - b.ArrEnd() + b.Comma() + b.FieldStart("is_greeting") + b.PutBool(e.IsGreeting) b.Comma() b.StripComma() b.ObjEnd() @@ -223,36 +234,37 @@ func (e *EmojiCategory) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (e *EmojiCategory) DecodeTDLibJSON(b tdjson.Decoder) error { if e == nil { - return fmt.Errorf("can't decode emojiCategory#c6e9e5a4 to nil") + return fmt.Errorf("can't decode emojiCategory#220de4ef to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("emojiCategory"); err != nil { - return fmt.Errorf("unable to decode emojiCategory#c6e9e5a4: %w", err) + return fmt.Errorf("unable to decode emojiCategory#220de4ef: %w", err) } case "name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode emojiCategory#c6e9e5a4: field name: %w", err) + return fmt.Errorf("unable to decode emojiCategory#220de4ef: field name: %w", err) } e.Name = value case "icon": if err := e.Icon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode emojiCategory#c6e9e5a4: field icon: %w", err) + return fmt.Errorf("unable to decode emojiCategory#220de4ef: field icon: %w", err) + } + case "source": + value, err := DecodeTDLibJSONEmojiCategorySource(b) + if err != nil { + return fmt.Errorf("unable to decode emojiCategory#220de4ef: field source: %w", err) } - case "emojis": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emojiCategory#c6e9e5a4: field emojis: %w", err) - } - e.Emojis = append(e.Emojis, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode emojiCategory#c6e9e5a4: field emojis: %w", err) + e.Source = value + case "is_greeting": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode emojiCategory#220de4ef: field is_greeting: %w", err) } + e.IsGreeting = value default: return b.Skip() } @@ -276,10 +288,18 @@ func (e *EmojiCategory) GetIcon() (value Sticker) { return e.Icon } -// GetEmojis returns value of Emojis field. -func (e *EmojiCategory) GetEmojis() (value []string) { +// GetSource returns value of Source field. +func (e *EmojiCategory) GetSource() (value EmojiCategorySourceClass) { + if e == nil { + return + } + return e.Source +} + +// GetIsGreeting returns value of IsGreeting field. +func (e *EmojiCategory) GetIsGreeting() (value bool) { if e == nil { return } - return e.Emojis + return e.IsGreeting } diff --git a/tdapi/tl_emoji_category_source_gen.go b/tdapi/tl_emoji_category_source_gen.go new file mode 100644 index 0000000000..315bd47749 --- /dev/null +++ b/tdapi/tl_emoji_category_source_gen.go @@ -0,0 +1,490 @@ +// 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{} +) + +// EmojiCategorySourceSearch represents TL type `emojiCategorySourceSearch#5e126d32`. +type EmojiCategorySourceSearch struct { + // List of emojis for search for + Emojis []string +} + +// EmojiCategorySourceSearchTypeID is TL type id of EmojiCategorySourceSearch. +const EmojiCategorySourceSearchTypeID = 0x5e126d32 + +// construct implements constructor of EmojiCategorySourceClass. +func (e EmojiCategorySourceSearch) construct() EmojiCategorySourceClass { return &e } + +// Ensuring interfaces in compile-time for EmojiCategorySourceSearch. +var ( + _ bin.Encoder = &EmojiCategorySourceSearch{} + _ bin.Decoder = &EmojiCategorySourceSearch{} + _ bin.BareEncoder = &EmojiCategorySourceSearch{} + _ bin.BareDecoder = &EmojiCategorySourceSearch{} + + _ EmojiCategorySourceClass = &EmojiCategorySourceSearch{} +) + +func (e *EmojiCategorySourceSearch) Zero() bool { + if e == nil { + return true + } + if !(e.Emojis == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (e *EmojiCategorySourceSearch) String() string { + if e == nil { + return "EmojiCategorySourceSearch(nil)" + } + type Alias EmojiCategorySourceSearch + return fmt.Sprintf("EmojiCategorySourceSearch%+v", Alias(*e)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*EmojiCategorySourceSearch) TypeID() uint32 { + return EmojiCategorySourceSearchTypeID +} + +// TypeName returns name of type in TL schema. +func (*EmojiCategorySourceSearch) TypeName() string { + return "emojiCategorySourceSearch" +} + +// TypeInfo returns info about TL type. +func (e *EmojiCategorySourceSearch) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "emojiCategorySourceSearch", + ID: EmojiCategorySourceSearchTypeID, + } + if e == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Emojis", + SchemaName: "emojis", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (e *EmojiCategorySourceSearch) Encode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode emojiCategorySourceSearch#5e126d32 as nil") + } + b.PutID(EmojiCategorySourceSearchTypeID) + return e.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (e *EmojiCategorySourceSearch) EncodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode emojiCategorySourceSearch#5e126d32 as nil") + } + b.PutInt(len(e.Emojis)) + for _, v := range e.Emojis { + b.PutString(v) + } + return nil +} + +// Decode implements bin.Decoder. +func (e *EmojiCategorySourceSearch) Decode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode emojiCategorySourceSearch#5e126d32 to nil") + } + if err := b.ConsumeID(EmojiCategorySourceSearchTypeID); err != nil { + return fmt.Errorf("unable to decode emojiCategorySourceSearch#5e126d32: %w", err) + } + return e.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (e *EmojiCategorySourceSearch) DecodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode emojiCategorySourceSearch#5e126d32 to nil") + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode emojiCategorySourceSearch#5e126d32: field emojis: %w", err) + } + + if headerLen > 0 { + e.Emojis = make([]string, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode emojiCategorySourceSearch#5e126d32: field emojis: %w", err) + } + e.Emojis = append(e.Emojis, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (e *EmojiCategorySourceSearch) EncodeTDLibJSON(b tdjson.Encoder) error { + if e == nil { + return fmt.Errorf("can't encode emojiCategorySourceSearch#5e126d32 as nil") + } + b.ObjStart() + b.PutID("emojiCategorySourceSearch") + b.Comma() + b.FieldStart("emojis") + b.ArrStart() + for _, v := range e.Emojis { + b.PutString(v) + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (e *EmojiCategorySourceSearch) DecodeTDLibJSON(b tdjson.Decoder) error { + if e == nil { + return fmt.Errorf("can't decode emojiCategorySourceSearch#5e126d32 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("emojiCategorySourceSearch"); err != nil { + return fmt.Errorf("unable to decode emojiCategorySourceSearch#5e126d32: %w", err) + } + case "emojis": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode emojiCategorySourceSearch#5e126d32: field emojis: %w", err) + } + e.Emojis = append(e.Emojis, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode emojiCategorySourceSearch#5e126d32: field emojis: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetEmojis returns value of Emojis field. +func (e *EmojiCategorySourceSearch) GetEmojis() (value []string) { + if e == nil { + return + } + return e.Emojis +} + +// EmojiCategorySourcePremium represents TL type `emojiCategorySourcePremium#8cd28d0c`. +type EmojiCategorySourcePremium struct { +} + +// EmojiCategorySourcePremiumTypeID is TL type id of EmojiCategorySourcePremium. +const EmojiCategorySourcePremiumTypeID = 0x8cd28d0c + +// construct implements constructor of EmojiCategorySourceClass. +func (e EmojiCategorySourcePremium) construct() EmojiCategorySourceClass { return &e } + +// Ensuring interfaces in compile-time for EmojiCategorySourcePremium. +var ( + _ bin.Encoder = &EmojiCategorySourcePremium{} + _ bin.Decoder = &EmojiCategorySourcePremium{} + _ bin.BareEncoder = &EmojiCategorySourcePremium{} + _ bin.BareDecoder = &EmojiCategorySourcePremium{} + + _ EmojiCategorySourceClass = &EmojiCategorySourcePremium{} +) + +func (e *EmojiCategorySourcePremium) Zero() bool { + if e == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (e *EmojiCategorySourcePremium) String() string { + if e == nil { + return "EmojiCategorySourcePremium(nil)" + } + type Alias EmojiCategorySourcePremium + return fmt.Sprintf("EmojiCategorySourcePremium%+v", Alias(*e)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*EmojiCategorySourcePremium) TypeID() uint32 { + return EmojiCategorySourcePremiumTypeID +} + +// TypeName returns name of type in TL schema. +func (*EmojiCategorySourcePremium) TypeName() string { + return "emojiCategorySourcePremium" +} + +// TypeInfo returns info about TL type. +func (e *EmojiCategorySourcePremium) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "emojiCategorySourcePremium", + ID: EmojiCategorySourcePremiumTypeID, + } + if e == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (e *EmojiCategorySourcePremium) Encode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode emojiCategorySourcePremium#8cd28d0c as nil") + } + b.PutID(EmojiCategorySourcePremiumTypeID) + return e.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (e *EmojiCategorySourcePremium) EncodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode emojiCategorySourcePremium#8cd28d0c as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (e *EmojiCategorySourcePremium) Decode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode emojiCategorySourcePremium#8cd28d0c to nil") + } + if err := b.ConsumeID(EmojiCategorySourcePremiumTypeID); err != nil { + return fmt.Errorf("unable to decode emojiCategorySourcePremium#8cd28d0c: %w", err) + } + return e.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (e *EmojiCategorySourcePremium) DecodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode emojiCategorySourcePremium#8cd28d0c to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (e *EmojiCategorySourcePremium) EncodeTDLibJSON(b tdjson.Encoder) error { + if e == nil { + return fmt.Errorf("can't encode emojiCategorySourcePremium#8cd28d0c as nil") + } + b.ObjStart() + b.PutID("emojiCategorySourcePremium") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (e *EmojiCategorySourcePremium) DecodeTDLibJSON(b tdjson.Decoder) error { + if e == nil { + return fmt.Errorf("can't decode emojiCategorySourcePremium#8cd28d0c to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("emojiCategorySourcePremium"); err != nil { + return fmt.Errorf("unable to decode emojiCategorySourcePremium#8cd28d0c: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// EmojiCategorySourceClassName is schema name of EmojiCategorySourceClass. +const EmojiCategorySourceClassName = "EmojiCategorySource" + +// EmojiCategorySourceClass represents EmojiCategorySource generic type. +// +// Example: +// +// g, err := tdapi.DecodeEmojiCategorySource(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tdapi.EmojiCategorySourceSearch: // emojiCategorySourceSearch#5e126d32 +// case *tdapi.EmojiCategorySourcePremium: // emojiCategorySourcePremium#8cd28d0c +// default: panic(v) +// } +type EmojiCategorySourceClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() EmojiCategorySourceClass + + // 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 +} + +// DecodeEmojiCategorySource implements binary de-serialization for EmojiCategorySourceClass. +func DecodeEmojiCategorySource(buf *bin.Buffer) (EmojiCategorySourceClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case EmojiCategorySourceSearchTypeID: + // Decoding emojiCategorySourceSearch#5e126d32. + v := EmojiCategorySourceSearch{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode EmojiCategorySourceClass: %w", err) + } + return &v, nil + case EmojiCategorySourcePremiumTypeID: + // Decoding emojiCategorySourcePremium#8cd28d0c. + v := EmojiCategorySourcePremium{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode EmojiCategorySourceClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode EmojiCategorySourceClass: %w", bin.NewUnexpectedID(id)) + } +} + +// DecodeTDLibJSONEmojiCategorySource implements binary de-serialization for EmojiCategorySourceClass. +func DecodeTDLibJSONEmojiCategorySource(buf tdjson.Decoder) (EmojiCategorySourceClass, error) { + id, err := buf.FindTypeID() + if err != nil { + return nil, err + } + switch id { + case "emojiCategorySourceSearch": + // Decoding emojiCategorySourceSearch#5e126d32. + v := EmojiCategorySourceSearch{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode EmojiCategorySourceClass: %w", err) + } + return &v, nil + case "emojiCategorySourcePremium": + // Decoding emojiCategorySourcePremium#8cd28d0c. + v := EmojiCategorySourcePremium{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode EmojiCategorySourceClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode EmojiCategorySourceClass: %w", tdjson.NewUnexpectedID(id)) + } +} + +// EmojiCategorySource boxes the EmojiCategorySourceClass providing a helper. +type EmojiCategorySourceBox struct { + EmojiCategorySource EmojiCategorySourceClass +} + +// Decode implements bin.Decoder for EmojiCategorySourceBox. +func (b *EmojiCategorySourceBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode EmojiCategorySourceBox to nil") + } + v, err := DecodeEmojiCategorySource(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.EmojiCategorySource = v + return nil +} + +// Encode implements bin.Encode for EmojiCategorySourceBox. +func (b *EmojiCategorySourceBox) Encode(buf *bin.Buffer) error { + if b == nil || b.EmojiCategorySource == nil { + return fmt.Errorf("unable to encode EmojiCategorySourceClass as nil") + } + return b.EmojiCategorySource.Encode(buf) +} + +// DecodeTDLibJSON implements bin.Decoder for EmojiCategorySourceBox. +func (b *EmojiCategorySourceBox) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("unable to decode EmojiCategorySourceBox to nil") + } + v, err := DecodeTDLibJSONEmojiCategorySource(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.EmojiCategorySource = v + return nil +} + +// EncodeTDLibJSON implements bin.Encode for EmojiCategorySourceBox. +func (b *EmojiCategorySourceBox) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil || b.EmojiCategorySource == nil { + return fmt.Errorf("unable to encode EmojiCategorySourceClass as nil") + } + return b.EmojiCategorySource.EncodeTDLibJSON(buf) +} diff --git a/tdapi/tl_emoji_category_type_gen.go b/tdapi/tl_emoji_category_type_gen.go index 1ac4fb7283..2510c6ce8d 100644 --- a/tdapi/tl_emoji_category_type_gen.go +++ b/tdapi/tl_emoji_category_type_gen.go @@ -162,6 +162,137 @@ func (e *EmojiCategoryTypeDefault) DecodeTDLibJSON(b tdjson.Decoder) error { }) } +// EmojiCategoryTypeRegularStickers represents TL type `emojiCategoryTypeRegularStickers#b04799d2`. +type EmojiCategoryTypeRegularStickers struct { +} + +// EmojiCategoryTypeRegularStickersTypeID is TL type id of EmojiCategoryTypeRegularStickers. +const EmojiCategoryTypeRegularStickersTypeID = 0xb04799d2 + +// construct implements constructor of EmojiCategoryTypeClass. +func (e EmojiCategoryTypeRegularStickers) construct() EmojiCategoryTypeClass { return &e } + +// Ensuring interfaces in compile-time for EmojiCategoryTypeRegularStickers. +var ( + _ bin.Encoder = &EmojiCategoryTypeRegularStickers{} + _ bin.Decoder = &EmojiCategoryTypeRegularStickers{} + _ bin.BareEncoder = &EmojiCategoryTypeRegularStickers{} + _ bin.BareDecoder = &EmojiCategoryTypeRegularStickers{} + + _ EmojiCategoryTypeClass = &EmojiCategoryTypeRegularStickers{} +) + +func (e *EmojiCategoryTypeRegularStickers) Zero() bool { + if e == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (e *EmojiCategoryTypeRegularStickers) String() string { + if e == nil { + return "EmojiCategoryTypeRegularStickers(nil)" + } + type Alias EmojiCategoryTypeRegularStickers + return fmt.Sprintf("EmojiCategoryTypeRegularStickers%+v", Alias(*e)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*EmojiCategoryTypeRegularStickers) TypeID() uint32 { + return EmojiCategoryTypeRegularStickersTypeID +} + +// TypeName returns name of type in TL schema. +func (*EmojiCategoryTypeRegularStickers) TypeName() string { + return "emojiCategoryTypeRegularStickers" +} + +// TypeInfo returns info about TL type. +func (e *EmojiCategoryTypeRegularStickers) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "emojiCategoryTypeRegularStickers", + ID: EmojiCategoryTypeRegularStickersTypeID, + } + if e == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (e *EmojiCategoryTypeRegularStickers) Encode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode emojiCategoryTypeRegularStickers#b04799d2 as nil") + } + b.PutID(EmojiCategoryTypeRegularStickersTypeID) + return e.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (e *EmojiCategoryTypeRegularStickers) EncodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode emojiCategoryTypeRegularStickers#b04799d2 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (e *EmojiCategoryTypeRegularStickers) Decode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode emojiCategoryTypeRegularStickers#b04799d2 to nil") + } + if err := b.ConsumeID(EmojiCategoryTypeRegularStickersTypeID); err != nil { + return fmt.Errorf("unable to decode emojiCategoryTypeRegularStickers#b04799d2: %w", err) + } + return e.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (e *EmojiCategoryTypeRegularStickers) DecodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode emojiCategoryTypeRegularStickers#b04799d2 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (e *EmojiCategoryTypeRegularStickers) EncodeTDLibJSON(b tdjson.Encoder) error { + if e == nil { + return fmt.Errorf("can't encode emojiCategoryTypeRegularStickers#b04799d2 as nil") + } + b.ObjStart() + b.PutID("emojiCategoryTypeRegularStickers") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (e *EmojiCategoryTypeRegularStickers) DecodeTDLibJSON(b tdjson.Decoder) error { + if e == nil { + return fmt.Errorf("can't decode emojiCategoryTypeRegularStickers#b04799d2 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("emojiCategoryTypeRegularStickers"); err != nil { + return fmt.Errorf("unable to decode emojiCategoryTypeRegularStickers#b04799d2: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + // EmojiCategoryTypeEmojiStatus represents TL type `emojiCategoryTypeEmojiStatus#5254b347`. type EmojiCategoryTypeEmojiStatus struct { } @@ -437,6 +568,7 @@ const EmojiCategoryTypeClassName = "EmojiCategoryType" // } // switch v := g.(type) { // case *tdapi.EmojiCategoryTypeDefault: // emojiCategoryTypeDefault#46db626b +// case *tdapi.EmojiCategoryTypeRegularStickers: // emojiCategoryTypeRegularStickers#b04799d2 // case *tdapi.EmojiCategoryTypeEmojiStatus: // emojiCategoryTypeEmojiStatus#5254b347 // case *tdapi.EmojiCategoryTypeChatPhoto: // emojiCategoryTypeChatPhoto#3f200529 // default: panic(v) @@ -477,6 +609,13 @@ func DecodeEmojiCategoryType(buf *bin.Buffer) (EmojiCategoryTypeClass, error) { return nil, fmt.Errorf("unable to decode EmojiCategoryTypeClass: %w", err) } return &v, nil + case EmojiCategoryTypeRegularStickersTypeID: + // Decoding emojiCategoryTypeRegularStickers#b04799d2. + v := EmojiCategoryTypeRegularStickers{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode EmojiCategoryTypeClass: %w", err) + } + return &v, nil case EmojiCategoryTypeEmojiStatusTypeID: // Decoding emojiCategoryTypeEmojiStatus#5254b347. v := EmojiCategoryTypeEmojiStatus{} @@ -510,6 +649,13 @@ func DecodeTDLibJSONEmojiCategoryType(buf tdjson.Decoder) (EmojiCategoryTypeClas return nil, fmt.Errorf("unable to decode EmojiCategoryTypeClass: %w", err) } return &v, nil + case "emojiCategoryTypeRegularStickers": + // Decoding emojiCategoryTypeRegularStickers#b04799d2. + v := EmojiCategoryTypeRegularStickers{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode EmojiCategoryTypeClass: %w", err) + } + return &v, nil case "emojiCategoryTypeEmojiStatus": // Decoding emojiCategoryTypeEmojiStatus#5254b347. v := EmojiCategoryTypeEmojiStatus{} diff --git a/tdapi/tl_get_chat_pinned_stories_gen.go b/tdapi/tl_get_chat_pinned_stories_gen.go deleted file mode 100644 index 7d1b4af47a..0000000000 --- a/tdapi/tl_get_chat_pinned_stories_gen.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -import ( - "context" - "errors" - "fmt" - "sort" - "strings" - - "go.uber.org/multierr" - - "github.com/gotd/td/bin" - "github.com/gotd/td/tdjson" - "github.com/gotd/td/tdp" - "github.com/gotd/td/tgerr" -) - -// No-op definition for keeping imports. -var ( - _ = bin.Buffer{} - _ = context.Background() - _ = fmt.Stringer(nil) - _ = strings.Builder{} - _ = errors.Is - _ = multierr.AppendInto - _ = sort.Ints - _ = tdp.Format - _ = tgerr.Error{} - _ = tdjson.Encoder{} -) - -// GetChatPinnedStoriesRequest represents TL type `getChatPinnedStories#53c82a1`. -type GetChatPinnedStoriesRequest struct { - // Chat identifier - ChatID int64 - // Identifier of the story starting from which stories must be returned; use 0 to get - // results from the last story - FromStoryID int32 - // The maximum number of stories to be returned - Limit int32 -} - -// GetChatPinnedStoriesRequestTypeID is TL type id of GetChatPinnedStoriesRequest. -const GetChatPinnedStoriesRequestTypeID = 0x53c82a1 - -// Ensuring interfaces in compile-time for GetChatPinnedStoriesRequest. -var ( - _ bin.Encoder = &GetChatPinnedStoriesRequest{} - _ bin.Decoder = &GetChatPinnedStoriesRequest{} - _ bin.BareEncoder = &GetChatPinnedStoriesRequest{} - _ bin.BareDecoder = &GetChatPinnedStoriesRequest{} -) - -func (g *GetChatPinnedStoriesRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.FromStoryID == 0) { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatPinnedStoriesRequest) String() string { - if g == nil { - return "GetChatPinnedStoriesRequest(nil)" - } - type Alias GetChatPinnedStoriesRequest - return fmt.Sprintf("GetChatPinnedStoriesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatPinnedStoriesRequest) TypeID() uint32 { - return GetChatPinnedStoriesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatPinnedStoriesRequest) TypeName() string { - return "getChatPinnedStories" -} - -// TypeInfo returns info about TL type. -func (g *GetChatPinnedStoriesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatPinnedStories", - ID: GetChatPinnedStoriesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "FromStoryID", - SchemaName: "from_story_id", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatPinnedStoriesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatPinnedStories#53c82a1 as nil") - } - b.PutID(GetChatPinnedStoriesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatPinnedStoriesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatPinnedStories#53c82a1 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt32(g.FromStoryID) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatPinnedStoriesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatPinnedStories#53c82a1 to nil") - } - if err := b.ConsumeID(GetChatPinnedStoriesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatPinnedStories#53c82a1: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatPinnedStoriesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatPinnedStories#53c82a1 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatPinnedStories#53c82a1: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatPinnedStories#53c82a1: field from_story_id: %w", err) - } - g.FromStoryID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatPinnedStories#53c82a1: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatPinnedStoriesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatPinnedStories#53c82a1 as nil") - } - b.ObjStart() - b.PutID("getChatPinnedStories") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("from_story_id") - b.PutInt32(g.FromStoryID) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatPinnedStoriesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatPinnedStories#53c82a1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatPinnedStories"); err != nil { - return fmt.Errorf("unable to decode getChatPinnedStories#53c82a1: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatPinnedStories#53c82a1: field chat_id: %w", err) - } - g.ChatID = value - case "from_story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatPinnedStories#53c82a1: field from_story_id: %w", err) - } - g.FromStoryID = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatPinnedStories#53c82a1: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatPinnedStoriesRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetFromStoryID returns value of FromStoryID field. -func (g *GetChatPinnedStoriesRequest) GetFromStoryID() (value int32) { - if g == nil { - return - } - return g.FromStoryID -} - -// GetLimit returns value of Limit field. -func (g *GetChatPinnedStoriesRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetChatPinnedStories invokes method getChatPinnedStories#53c82a1 returning error if any. -func (c *Client) GetChatPinnedStories(ctx context.Context, request *GetChatPinnedStoriesRequest) (*Stories, error) { - var result Stories - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_posted_to_chat_page_stories_gen.go b/tdapi/tl_get_chat_posted_to_chat_page_stories_gen.go new file mode 100644 index 0000000000..e9b4152bf9 --- /dev/null +++ b/tdapi/tl_get_chat_posted_to_chat_page_stories_gen.go @@ -0,0 +1,272 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// GetChatPostedToChatPageStoriesRequest represents TL type `getChatPostedToChatPageStories#fd3bc72b`. +type GetChatPostedToChatPageStoriesRequest struct { + // Chat identifier + ChatID int64 + // Identifier of the story starting from which stories must be returned; use 0 to get + // results from pinned and the newest story + FromStoryID int32 + // The maximum number of stories to be returned + Limit int32 +} + +// GetChatPostedToChatPageStoriesRequestTypeID is TL type id of GetChatPostedToChatPageStoriesRequest. +const GetChatPostedToChatPageStoriesRequestTypeID = 0xfd3bc72b + +// Ensuring interfaces in compile-time for GetChatPostedToChatPageStoriesRequest. +var ( + _ bin.Encoder = &GetChatPostedToChatPageStoriesRequest{} + _ bin.Decoder = &GetChatPostedToChatPageStoriesRequest{} + _ bin.BareEncoder = &GetChatPostedToChatPageStoriesRequest{} + _ bin.BareDecoder = &GetChatPostedToChatPageStoriesRequest{} +) + +func (g *GetChatPostedToChatPageStoriesRequest) Zero() bool { + if g == nil { + return true + } + if !(g.ChatID == 0) { + return false + } + if !(g.FromStoryID == 0) { + return false + } + if !(g.Limit == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetChatPostedToChatPageStoriesRequest) String() string { + if g == nil { + return "GetChatPostedToChatPageStoriesRequest(nil)" + } + type Alias GetChatPostedToChatPageStoriesRequest + return fmt.Sprintf("GetChatPostedToChatPageStoriesRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetChatPostedToChatPageStoriesRequest) TypeID() uint32 { + return GetChatPostedToChatPageStoriesRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetChatPostedToChatPageStoriesRequest) TypeName() string { + return "getChatPostedToChatPageStories" +} + +// TypeInfo returns info about TL type. +func (g *GetChatPostedToChatPageStoriesRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getChatPostedToChatPageStories", + ID: GetChatPostedToChatPageStoriesRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "FromStoryID", + SchemaName: "from_story_id", + }, + { + Name: "Limit", + SchemaName: "limit", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetChatPostedToChatPageStoriesRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getChatPostedToChatPageStories#fd3bc72b as nil") + } + b.PutID(GetChatPostedToChatPageStoriesRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetChatPostedToChatPageStoriesRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getChatPostedToChatPageStories#fd3bc72b as nil") + } + b.PutInt53(g.ChatID) + b.PutInt32(g.FromStoryID) + b.PutInt32(g.Limit) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetChatPostedToChatPageStoriesRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getChatPostedToChatPageStories#fd3bc72b to nil") + } + if err := b.ConsumeID(GetChatPostedToChatPageStoriesRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getChatPostedToChatPageStories#fd3bc72b: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetChatPostedToChatPageStoriesRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getChatPostedToChatPageStories#fd3bc72b to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getChatPostedToChatPageStories#fd3bc72b: field chat_id: %w", err) + } + g.ChatID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getChatPostedToChatPageStories#fd3bc72b: field from_story_id: %w", err) + } + g.FromStoryID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getChatPostedToChatPageStories#fd3bc72b: field limit: %w", err) + } + g.Limit = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetChatPostedToChatPageStoriesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getChatPostedToChatPageStories#fd3bc72b as nil") + } + b.ObjStart() + b.PutID("getChatPostedToChatPageStories") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(g.ChatID) + b.Comma() + b.FieldStart("from_story_id") + b.PutInt32(g.FromStoryID) + b.Comma() + b.FieldStart("limit") + b.PutInt32(g.Limit) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetChatPostedToChatPageStoriesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getChatPostedToChatPageStories#fd3bc72b to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getChatPostedToChatPageStories"); err != nil { + return fmt.Errorf("unable to decode getChatPostedToChatPageStories#fd3bc72b: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getChatPostedToChatPageStories#fd3bc72b: field chat_id: %w", err) + } + g.ChatID = value + case "from_story_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getChatPostedToChatPageStories#fd3bc72b: field from_story_id: %w", err) + } + g.FromStoryID = value + case "limit": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getChatPostedToChatPageStories#fd3bc72b: field limit: %w", err) + } + g.Limit = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (g *GetChatPostedToChatPageStoriesRequest) GetChatID() (value int64) { + if g == nil { + return + } + return g.ChatID +} + +// GetFromStoryID returns value of FromStoryID field. +func (g *GetChatPostedToChatPageStoriesRequest) GetFromStoryID() (value int32) { + if g == nil { + return + } + return g.FromStoryID +} + +// GetLimit returns value of Limit field. +func (g *GetChatPostedToChatPageStoriesRequest) GetLimit() (value int32) { + if g == nil { + return + } + return g.Limit +} + +// GetChatPostedToChatPageStories invokes method getChatPostedToChatPageStories#fd3bc72b returning error if any. +func (c *Client) GetChatPostedToChatPageStories(ctx context.Context, request *GetChatPostedToChatPageStoriesRequest) (*Stories, error) { + var result Stories + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_recommended_chats_gen.go b/tdapi/tl_get_recommended_chats_gen.go new file mode 100644 index 0000000000..d5ce8ac70d --- /dev/null +++ b/tdapi/tl_get_recommended_chats_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{} +) + +// GetRecommendedChatsRequest represents TL type `getRecommendedChats#d9438d71`. +type GetRecommendedChatsRequest struct { +} + +// GetRecommendedChatsRequestTypeID is TL type id of GetRecommendedChatsRequest. +const GetRecommendedChatsRequestTypeID = 0xd9438d71 + +// Ensuring interfaces in compile-time for GetRecommendedChatsRequest. +var ( + _ bin.Encoder = &GetRecommendedChatsRequest{} + _ bin.Decoder = &GetRecommendedChatsRequest{} + _ bin.BareEncoder = &GetRecommendedChatsRequest{} + _ bin.BareDecoder = &GetRecommendedChatsRequest{} +) + +func (g *GetRecommendedChatsRequest) Zero() bool { + if g == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetRecommendedChatsRequest) String() string { + if g == nil { + return "GetRecommendedChatsRequest(nil)" + } + type Alias GetRecommendedChatsRequest + return fmt.Sprintf("GetRecommendedChatsRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetRecommendedChatsRequest) TypeID() uint32 { + return GetRecommendedChatsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetRecommendedChatsRequest) TypeName() string { + return "getRecommendedChats" +} + +// TypeInfo returns info about TL type. +func (g *GetRecommendedChatsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getRecommendedChats", + ID: GetRecommendedChatsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (g *GetRecommendedChatsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getRecommendedChats#d9438d71 as nil") + } + b.PutID(GetRecommendedChatsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetRecommendedChatsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getRecommendedChats#d9438d71 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (g *GetRecommendedChatsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getRecommendedChats#d9438d71 to nil") + } + if err := b.ConsumeID(GetRecommendedChatsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getRecommendedChats#d9438d71: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetRecommendedChatsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getRecommendedChats#d9438d71 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetRecommendedChatsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getRecommendedChats#d9438d71 as nil") + } + b.ObjStart() + b.PutID("getRecommendedChats") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetRecommendedChatsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getRecommendedChats#d9438d71 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getRecommendedChats"); err != nil { + return fmt.Errorf("unable to decode getRecommendedChats#d9438d71: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetRecommendedChats invokes method getRecommendedChats#d9438d71 returning error if any. +func (c *Client) GetRecommendedChats(ctx context.Context) (*Chats, error) { + var result Chats + + request := &GetRecommendedChatsRequest{} + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_hide_contact_close_birthdays_gen.go b/tdapi/tl_hide_contact_close_birthdays_gen.go new file mode 100644 index 0000000000..9cc98cff02 --- /dev/null +++ b/tdapi/tl_hide_contact_close_birthdays_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{} +) + +// HideContactCloseBirthdaysRequest represents TL type `hideContactCloseBirthdays#baad087b`. +type HideContactCloseBirthdaysRequest struct { +} + +// HideContactCloseBirthdaysRequestTypeID is TL type id of HideContactCloseBirthdaysRequest. +const HideContactCloseBirthdaysRequestTypeID = 0xbaad087b + +// Ensuring interfaces in compile-time for HideContactCloseBirthdaysRequest. +var ( + _ bin.Encoder = &HideContactCloseBirthdaysRequest{} + _ bin.Decoder = &HideContactCloseBirthdaysRequest{} + _ bin.BareEncoder = &HideContactCloseBirthdaysRequest{} + _ bin.BareDecoder = &HideContactCloseBirthdaysRequest{} +) + +func (h *HideContactCloseBirthdaysRequest) Zero() bool { + if h == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (h *HideContactCloseBirthdaysRequest) String() string { + if h == nil { + return "HideContactCloseBirthdaysRequest(nil)" + } + type Alias HideContactCloseBirthdaysRequest + return fmt.Sprintf("HideContactCloseBirthdaysRequest%+v", Alias(*h)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*HideContactCloseBirthdaysRequest) TypeID() uint32 { + return HideContactCloseBirthdaysRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*HideContactCloseBirthdaysRequest) TypeName() string { + return "hideContactCloseBirthdays" +} + +// TypeInfo returns info about TL type. +func (h *HideContactCloseBirthdaysRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "hideContactCloseBirthdays", + ID: HideContactCloseBirthdaysRequestTypeID, + } + if h == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (h *HideContactCloseBirthdaysRequest) Encode(b *bin.Buffer) error { + if h == nil { + return fmt.Errorf("can't encode hideContactCloseBirthdays#baad087b as nil") + } + b.PutID(HideContactCloseBirthdaysRequestTypeID) + return h.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (h *HideContactCloseBirthdaysRequest) EncodeBare(b *bin.Buffer) error { + if h == nil { + return fmt.Errorf("can't encode hideContactCloseBirthdays#baad087b as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (h *HideContactCloseBirthdaysRequest) Decode(b *bin.Buffer) error { + if h == nil { + return fmt.Errorf("can't decode hideContactCloseBirthdays#baad087b to nil") + } + if err := b.ConsumeID(HideContactCloseBirthdaysRequestTypeID); err != nil { + return fmt.Errorf("unable to decode hideContactCloseBirthdays#baad087b: %w", err) + } + return h.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (h *HideContactCloseBirthdaysRequest) DecodeBare(b *bin.Buffer) error { + if h == nil { + return fmt.Errorf("can't decode hideContactCloseBirthdays#baad087b to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (h *HideContactCloseBirthdaysRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if h == nil { + return fmt.Errorf("can't encode hideContactCloseBirthdays#baad087b as nil") + } + b.ObjStart() + b.PutID("hideContactCloseBirthdays") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (h *HideContactCloseBirthdaysRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if h == nil { + return fmt.Errorf("can't decode hideContactCloseBirthdays#baad087b to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("hideContactCloseBirthdays"); err != nil { + return fmt.Errorf("unable to decode hideContactCloseBirthdays#baad087b: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// HideContactCloseBirthdays invokes method hideContactCloseBirthdays#baad087b returning error if any. +func (c *Client) HideContactCloseBirthdays(ctx context.Context) error { + var ok Ok + + request := &HideContactCloseBirthdaysRequest{} + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_input_message_content_gen.go b/tdapi/tl_input_message_content_gen.go index d4306cd8c2..1f843dd62e 100644 --- a/tdapi/tl_input_message_content_gen.go +++ b/tdapi/tl_input_message_content_gen.go @@ -2942,7 +2942,9 @@ func (i *InputMessageVideoNote) GetSelfDestructType() (value MessageSelfDestruct // InputMessageVoiceNote represents TL type `inputMessageVoiceNote#5723ffac`. type InputMessageVoiceNote struct { - // Voice note to be sent + // Voice note to be sent. The voice note must be encoded with the Opus codec and stored + // inside an OGG container with a single audio channel, or be in MP3 or M4A format as + // regular audio VoiceNote InputFileClass // Duration of the voice note, in seconds Duration int32 @@ -3269,7 +3271,7 @@ type InputMessageLocation struct { // Location to be sent Location Location // Period for which the location can be updated, in seconds; must be between 60 and 86400 - // for a live location and 0 otherwise + // for a temporary live location, 0x7FFFFFFF for permanent live location, and 0 otherwise LivePeriod int32 // For live locations, a direction in which the location moves, in degrees; 1-360. Pass 0 // if unknown @@ -4820,12 +4822,14 @@ func (i *InputMessageInvoice) GetExtendedMediaContent() (value InputMessageConte return i.ExtendedMediaContent } -// InputMessagePoll represents TL type `inputMessagePoll#fe79770`. +// InputMessagePoll represents TL type `inputMessagePoll#9046c716`. type InputMessagePoll struct { - // Poll question; 1-255 characters (up to 300 characters for bots) - Question string - // List of poll answer options, 2-10 strings 1-100 characters each - Options []string + // Poll question; 1-255 characters (up to 300 characters for bots). Only custom emoji + // entities are allowed to be added and only by Premium users + Question FormattedText + // List of poll answer options, 2-10 strings 1-100 characters each. Only custom emoji + // entities are allowed to be added and only by Premium users + Options []FormattedText // True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded // to channels IsAnonymous bool @@ -4841,7 +4845,7 @@ type InputMessagePoll struct { } // InputMessagePollTypeID is TL type id of InputMessagePoll. -const InputMessagePollTypeID = 0xfe79770 +const InputMessagePollTypeID = 0x9046c716 // construct implements constructor of InputMessageContentClass. func (i InputMessagePoll) construct() InputMessageContentClass { return &i } @@ -4860,7 +4864,7 @@ func (i *InputMessagePoll) Zero() bool { if i == nil { return true } - if !(i.Question == "") { + if !(i.Question.Zero()) { return false } if !(i.Options == nil) { @@ -4952,7 +4956,7 @@ func (i *InputMessagePoll) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (i *InputMessagePoll) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputMessagePoll#fe79770 as nil") + return fmt.Errorf("can't encode inputMessagePoll#9046c716 as nil") } b.PutID(InputMessagePollTypeID) return i.EncodeBare(b) @@ -4961,19 +4965,23 @@ func (i *InputMessagePoll) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (i *InputMessagePoll) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputMessagePoll#fe79770 as nil") + return fmt.Errorf("can't encode inputMessagePoll#9046c716 as nil") + } + if err := i.Question.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputMessagePoll#9046c716: field question: %w", err) } - b.PutString(i.Question) b.PutInt(len(i.Options)) - for _, v := range i.Options { - b.PutString(v) + for idx, v := range i.Options { + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare inputMessagePoll#9046c716: field options element with index %d: %w", idx, err) + } } b.PutBool(i.IsAnonymous) if i.Type == nil { - return fmt.Errorf("unable to encode inputMessagePoll#fe79770: field type is nil") + return fmt.Errorf("unable to encode inputMessagePoll#9046c716: field type is nil") } if err := i.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePoll#fe79770: field type: %w", err) + return fmt.Errorf("unable to encode inputMessagePoll#9046c716: field type: %w", err) } b.PutInt32(i.OpenPeriod) b.PutInt32(i.CloseDate) @@ -4984,10 +4992,10 @@ func (i *InputMessagePoll) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (i *InputMessagePoll) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputMessagePoll#fe79770 to nil") + return fmt.Errorf("can't decode inputMessagePoll#9046c716 to nil") } if err := b.ConsumeID(InputMessagePollTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#fe79770: %w", err) + return fmt.Errorf("unable to decode inputMessagePoll#9046c716: %w", err) } return i.DecodeBare(b) } @@ -4995,28 +5003,26 @@ func (i *InputMessagePoll) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (i *InputMessagePoll) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputMessagePoll#fe79770 to nil") + return fmt.Errorf("can't decode inputMessagePoll#9046c716 to nil") } { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#fe79770: field question: %w", err) + if err := i.Question.Decode(b); err != nil { + return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field question: %w", err) } - i.Question = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#fe79770: field options: %w", err) + return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field options: %w", err) } if headerLen > 0 { - i.Options = make([]string, 0, headerLen%bin.PreallocateLimit) + i.Options = make([]FormattedText, 0, headerLen%bin.PreallocateLimit) } for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#fe79770: field options: %w", err) + var value FormattedText + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare inputMessagePoll#9046c716: field options: %w", err) } i.Options = append(i.Options, value) } @@ -5024,35 +5030,35 @@ func (i *InputMessagePoll) DecodeBare(b *bin.Buffer) error { { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#fe79770: field is_anonymous: %w", err) + return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field is_anonymous: %w", err) } i.IsAnonymous = value } { value, err := DecodePollType(b) if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#fe79770: field type: %w", err) + return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field type: %w", err) } i.Type = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#fe79770: field open_period: %w", err) + return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field open_period: %w", err) } i.OpenPeriod = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#fe79770: field close_date: %w", err) + return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field close_date: %w", err) } i.CloseDate = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#fe79770: field is_closed: %w", err) + return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field is_closed: %w", err) } i.IsClosed = value } @@ -5062,18 +5068,22 @@ func (i *InputMessagePoll) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (i *InputMessagePoll) EncodeTDLibJSON(b tdjson.Encoder) error { if i == nil { - return fmt.Errorf("can't encode inputMessagePoll#fe79770 as nil") + return fmt.Errorf("can't encode inputMessagePoll#9046c716 as nil") } b.ObjStart() b.PutID("inputMessagePoll") b.Comma() b.FieldStart("question") - b.PutString(i.Question) + if err := i.Question.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode inputMessagePoll#9046c716: field question: %w", err) + } b.Comma() b.FieldStart("options") b.ArrStart() - for _, v := range i.Options { - b.PutString(v) + for idx, v := range i.Options { + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode inputMessagePoll#9046c716: field options element with index %d: %w", idx, err) + } b.Comma() } b.StripComma() @@ -5084,10 +5094,10 @@ func (i *InputMessagePoll) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("type") if i.Type == nil { - return fmt.Errorf("unable to encode inputMessagePoll#fe79770: field type is nil") + return fmt.Errorf("unable to encode inputMessagePoll#9046c716: field type is nil") } if err := i.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePoll#fe79770: field type: %w", err) + return fmt.Errorf("unable to encode inputMessagePoll#9046c716: field type: %w", err) } b.Comma() b.FieldStart("open_period") @@ -5107,60 +5117,58 @@ func (i *InputMessagePoll) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (i *InputMessagePoll) DecodeTDLibJSON(b tdjson.Decoder) error { if i == nil { - return fmt.Errorf("can't decode inputMessagePoll#fe79770 to nil") + return fmt.Errorf("can't decode inputMessagePoll#9046c716 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("inputMessagePoll"); err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#fe79770: %w", err) + return fmt.Errorf("unable to decode inputMessagePoll#9046c716: %w", err) } case "question": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#fe79770: field question: %w", err) + if err := i.Question.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field question: %w", err) } - i.Question = value case "options": if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#fe79770: field options: %w", err) + var value FormattedText + if err := value.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field options: %w", err) } i.Options = append(i.Options, value) return nil }); err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#fe79770: field options: %w", err) + return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field options: %w", err) } case "is_anonymous": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#fe79770: field is_anonymous: %w", err) + return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field is_anonymous: %w", err) } i.IsAnonymous = value case "type": value, err := DecodeTDLibJSONPollType(b) if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#fe79770: field type: %w", err) + return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field type: %w", err) } i.Type = value case "open_period": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#fe79770: field open_period: %w", err) + return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field open_period: %w", err) } i.OpenPeriod = value case "close_date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#fe79770: field close_date: %w", err) + return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field close_date: %w", err) } i.CloseDate = value case "is_closed": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#fe79770: field is_closed: %w", err) + return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field is_closed: %w", err) } i.IsClosed = value default: @@ -5171,7 +5179,7 @@ func (i *InputMessagePoll) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetQuestion returns value of Question field. -func (i *InputMessagePoll) GetQuestion() (value string) { +func (i *InputMessagePoll) GetQuestion() (value FormattedText) { if i == nil { return } @@ -5179,7 +5187,7 @@ func (i *InputMessagePoll) GetQuestion() (value string) { } // GetOptions returns value of Options field. -func (i *InputMessagePoll) GetOptions() (value []string) { +func (i *InputMessagePoll) GetOptions() (value []FormattedText) { if i == nil { return } @@ -5724,7 +5732,7 @@ const InputMessageContentClassName = "InputMessageContent" // case *tdapi.InputMessageDice: // inputMessageDice#322967a9 // case *tdapi.InputMessageGame: // inputMessageGame#4aae6ae2 // case *tdapi.InputMessageInvoice: // inputMessageInvoice#34cd1d60 -// case *tdapi.InputMessagePoll: // inputMessagePoll#fe79770 +// case *tdapi.InputMessagePoll: // inputMessagePoll#9046c716 // case *tdapi.InputMessageStory: // inputMessageStory#21099d63 // case *tdapi.InputMessageForwarded: // inputMessageForwarded#651a73f8 // default: panic(v) @@ -5864,7 +5872,7 @@ func DecodeInputMessageContent(buf *bin.Buffer) (InputMessageContentClass, error } return &v, nil case InputMessagePollTypeID: - // Decoding inputMessagePoll#fe79770. + // Decoding inputMessagePoll#9046c716. v := InputMessagePoll{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) @@ -6002,7 +6010,7 @@ func DecodeTDLibJSONInputMessageContent(buf tdjson.Decoder) (InputMessageContent } return &v, nil case "inputMessagePoll": - // Decoding inputMessagePoll#fe79770. + // Decoding inputMessagePoll#9046c716. v := InputMessagePoll{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) diff --git a/tdapi/tl_message_content_gen.go b/tdapi/tl_message_content_gen.go index c6318247bb..80105fd352 100644 --- a/tdapi/tl_message_content_gen.go +++ b/tdapi/tl_message_content_gen.go @@ -2670,10 +2670,11 @@ type MessageLocation struct { // The location description Location Location // Time relative to the message send date, for which the location can be updated, in - // seconds + // seconds; if 0x7FFFFFFF, then location can be updated forever LivePeriod int32 - // Left time for which the location can be updated, in seconds. updateMessageContent is - // not sent when this field changes + // Left time for which the location can be updated, in seconds. If 0, then the location + // can't be updated anymore. The update updateMessageContent is not sent when this field + // changes ExpiresIn int32 // For live locations, a direction in which the location moves, in degrees; 1-360. If 0 // the direction is unknown @@ -3506,11 +3507,11 @@ func (m *MessageAnimatedEmoji) GetEmoji() (value string) { // MessageDice represents TL type `messageDice#42817239`. type MessageDice struct { - // The animated stickers with the initial dice animation; may be null if unknown. - // updateMessageContent will be sent when the sticker became known + // The animated stickers with the initial dice animation; may be null if unknown. The + // update updateMessageContent will be sent when the sticker became known InitialState DiceStickersClass - // The animated stickers with the final dice animation; may be null if unknown. - // updateMessageContent will be sent when the sticker became known + // The animated stickers with the final dice animation; may be null if unknown. The + // update updateMessageContent will be sent when the sticker became known FinalState DiceStickersClass // Emoji on which the dice throw animation is based Emoji string diff --git a/tdapi/tl_message_sponsor_gen.go b/tdapi/tl_message_sponsor_gen.go index 53f9a2342d..6390aa9f58 100644 --- a/tdapi/tl_message_sponsor_gen.go +++ b/tdapi/tl_message_sponsor_gen.go @@ -31,18 +31,18 @@ var ( _ = tdjson.Encoder{} ) -// MessageSponsor represents TL type `messageSponsor#a0b25071`. +// MessageSponsor represents TL type `messageSponsor#77c251de`. type MessageSponsor struct { - // Type of the sponsor - Type MessageSponsorTypeClass + // URL of the sponsor to be opened when the message is clicked + URL string // Photo of the sponsor; may be null if must not be shown - Photo ChatPhotoInfo + Photo Photo // Additional optional information about the sponsor to be shown along with the message Info string } // MessageSponsorTypeID is TL type id of MessageSponsor. -const MessageSponsorTypeID = 0xa0b25071 +const MessageSponsorTypeID = 0x77c251de // Ensuring interfaces in compile-time for MessageSponsor. var ( @@ -56,7 +56,7 @@ func (m *MessageSponsor) Zero() bool { if m == nil { return true } - if !(m.Type == nil) { + if !(m.URL == "") { return false } if !(m.Photo.Zero()) { @@ -102,8 +102,8 @@ func (m *MessageSponsor) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "Type", - SchemaName: "type", + Name: "URL", + SchemaName: "url", }, { Name: "Photo", @@ -120,7 +120,7 @@ func (m *MessageSponsor) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (m *MessageSponsor) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageSponsor#a0b25071 as nil") + return fmt.Errorf("can't encode messageSponsor#77c251de as nil") } b.PutID(MessageSponsorTypeID) return m.EncodeBare(b) @@ -129,16 +129,11 @@ func (m *MessageSponsor) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageSponsor) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageSponsor#a0b25071 as nil") - } - if m.Type == nil { - return fmt.Errorf("unable to encode messageSponsor#a0b25071: field type is nil") - } - if err := m.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageSponsor#a0b25071: field type: %w", err) + return fmt.Errorf("can't encode messageSponsor#77c251de as nil") } + b.PutString(m.URL) if err := m.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageSponsor#a0b25071: field photo: %w", err) + return fmt.Errorf("unable to encode messageSponsor#77c251de: field photo: %w", err) } b.PutString(m.Info) return nil @@ -147,10 +142,10 @@ func (m *MessageSponsor) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *MessageSponsor) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageSponsor#a0b25071 to nil") + return fmt.Errorf("can't decode messageSponsor#77c251de to nil") } if err := b.ConsumeID(MessageSponsorTypeID); err != nil { - return fmt.Errorf("unable to decode messageSponsor#a0b25071: %w", err) + return fmt.Errorf("unable to decode messageSponsor#77c251de: %w", err) } return m.DecodeBare(b) } @@ -158,24 +153,24 @@ func (m *MessageSponsor) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageSponsor) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageSponsor#a0b25071 to nil") + return fmt.Errorf("can't decode messageSponsor#77c251de to nil") } { - value, err := DecodeMessageSponsorType(b) + value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageSponsor#a0b25071: field type: %w", err) + return fmt.Errorf("unable to decode messageSponsor#77c251de: field url: %w", err) } - m.Type = value + m.URL = value } { if err := m.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageSponsor#a0b25071: field photo: %w", err) + return fmt.Errorf("unable to decode messageSponsor#77c251de: field photo: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageSponsor#a0b25071: field info: %w", err) + return fmt.Errorf("unable to decode messageSponsor#77c251de: field info: %w", err) } m.Info = value } @@ -185,22 +180,17 @@ func (m *MessageSponsor) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (m *MessageSponsor) EncodeTDLibJSON(b tdjson.Encoder) error { if m == nil { - return fmt.Errorf("can't encode messageSponsor#a0b25071 as nil") + return fmt.Errorf("can't encode messageSponsor#77c251de as nil") } b.ObjStart() b.PutID("messageSponsor") b.Comma() - b.FieldStart("type") - if m.Type == nil { - return fmt.Errorf("unable to encode messageSponsor#a0b25071: field type is nil") - } - if err := m.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageSponsor#a0b25071: field type: %w", err) - } + b.FieldStart("url") + b.PutString(m.URL) b.Comma() b.FieldStart("photo") if err := m.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageSponsor#a0b25071: field photo: %w", err) + return fmt.Errorf("unable to encode messageSponsor#77c251de: field photo: %w", err) } b.Comma() b.FieldStart("info") @@ -214,29 +204,29 @@ func (m *MessageSponsor) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (m *MessageSponsor) DecodeTDLibJSON(b tdjson.Decoder) error { if m == nil { - return fmt.Errorf("can't decode messageSponsor#a0b25071 to nil") + return fmt.Errorf("can't decode messageSponsor#77c251de to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("messageSponsor"); err != nil { - return fmt.Errorf("unable to decode messageSponsor#a0b25071: %w", err) + return fmt.Errorf("unable to decode messageSponsor#77c251de: %w", err) } - case "type": - value, err := DecodeTDLibJSONMessageSponsorType(b) + case "url": + value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageSponsor#a0b25071: field type: %w", err) + return fmt.Errorf("unable to decode messageSponsor#77c251de: field url: %w", err) } - m.Type = value + m.URL = value case "photo": if err := m.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageSponsor#a0b25071: field photo: %w", err) + return fmt.Errorf("unable to decode messageSponsor#77c251de: field photo: %w", err) } case "info": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageSponsor#a0b25071: field info: %w", err) + return fmt.Errorf("unable to decode messageSponsor#77c251de: field info: %w", err) } m.Info = value default: @@ -246,16 +236,16 @@ func (m *MessageSponsor) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetType returns value of Type field. -func (m *MessageSponsor) GetType() (value MessageSponsorTypeClass) { +// GetURL returns value of URL field. +func (m *MessageSponsor) GetURL() (value string) { if m == nil { return } - return m.Type + return m.URL } // GetPhoto returns value of Photo field. -func (m *MessageSponsor) GetPhoto() (value ChatPhotoInfo) { +func (m *MessageSponsor) GetPhoto() (value Photo) { if m == nil { return } diff --git a/tdapi/tl_message_sponsor_type_gen.go b/tdapi/tl_message_sponsor_type_gen.go deleted file mode 100644 index 62af0ec923..0000000000 --- a/tdapi/tl_message_sponsor_type_gen.go +++ /dev/null @@ -1,1245 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -import ( - "context" - "errors" - "fmt" - "sort" - "strings" - - "go.uber.org/multierr" - - "github.com/gotd/td/bin" - "github.com/gotd/td/tdjson" - "github.com/gotd/td/tdp" - "github.com/gotd/td/tgerr" -) - -// No-op definition for keeping imports. -var ( - _ = bin.Buffer{} - _ = context.Background() - _ = fmt.Stringer(nil) - _ = strings.Builder{} - _ = errors.Is - _ = multierr.AppendInto - _ = sort.Ints - _ = tdp.Format - _ = tgerr.Error{} - _ = tdjson.Encoder{} -) - -// MessageSponsorTypeBot represents TL type `messageSponsorTypeBot#700d2304`. -type MessageSponsorTypeBot struct { - // User identifier of the bot - BotUserID int64 - // An internal link to be opened when the sponsored message is clicked - Link InternalLinkTypeClass -} - -// MessageSponsorTypeBotTypeID is TL type id of MessageSponsorTypeBot. -const MessageSponsorTypeBotTypeID = 0x700d2304 - -// construct implements constructor of MessageSponsorTypeClass. -func (m MessageSponsorTypeBot) construct() MessageSponsorTypeClass { return &m } - -// Ensuring interfaces in compile-time for MessageSponsorTypeBot. -var ( - _ bin.Encoder = &MessageSponsorTypeBot{} - _ bin.Decoder = &MessageSponsorTypeBot{} - _ bin.BareEncoder = &MessageSponsorTypeBot{} - _ bin.BareDecoder = &MessageSponsorTypeBot{} - - _ MessageSponsorTypeClass = &MessageSponsorTypeBot{} -) - -func (m *MessageSponsorTypeBot) Zero() bool { - if m == nil { - return true - } - if !(m.BotUserID == 0) { - return false - } - if !(m.Link == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSponsorTypeBot) String() string { - if m == nil { - return "MessageSponsorTypeBot(nil)" - } - type Alias MessageSponsorTypeBot - return fmt.Sprintf("MessageSponsorTypeBot%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSponsorTypeBot) TypeID() uint32 { - return MessageSponsorTypeBotTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSponsorTypeBot) TypeName() string { - return "messageSponsorTypeBot" -} - -// TypeInfo returns info about TL type. -func (m *MessageSponsorTypeBot) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSponsorTypeBot", - ID: MessageSponsorTypeBotTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "Link", - SchemaName: "link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSponsorTypeBot) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSponsorTypeBot#700d2304 as nil") - } - b.PutID(MessageSponsorTypeBotTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSponsorTypeBot) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSponsorTypeBot#700d2304 as nil") - } - b.PutInt53(m.BotUserID) - if m.Link == nil { - return fmt.Errorf("unable to encode messageSponsorTypeBot#700d2304: field link is nil") - } - if err := m.Link.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageSponsorTypeBot#700d2304: field link: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSponsorTypeBot) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSponsorTypeBot#700d2304 to nil") - } - if err := b.ConsumeID(MessageSponsorTypeBotTypeID); err != nil { - return fmt.Errorf("unable to decode messageSponsorTypeBot#700d2304: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSponsorTypeBot) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSponsorTypeBot#700d2304 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageSponsorTypeBot#700d2304: field bot_user_id: %w", err) - } - m.BotUserID = value - } - { - value, err := DecodeInternalLinkType(b) - if err != nil { - return fmt.Errorf("unable to decode messageSponsorTypeBot#700d2304: field link: %w", err) - } - m.Link = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSponsorTypeBot) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSponsorTypeBot#700d2304 as nil") - } - b.ObjStart() - b.PutID("messageSponsorTypeBot") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(m.BotUserID) - b.Comma() - b.FieldStart("link") - if m.Link == nil { - return fmt.Errorf("unable to encode messageSponsorTypeBot#700d2304: field link is nil") - } - if err := m.Link.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageSponsorTypeBot#700d2304: field link: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSponsorTypeBot) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSponsorTypeBot#700d2304 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSponsorTypeBot"); err != nil { - return fmt.Errorf("unable to decode messageSponsorTypeBot#700d2304: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageSponsorTypeBot#700d2304: field bot_user_id: %w", err) - } - m.BotUserID = value - case "link": - value, err := DecodeTDLibJSONInternalLinkType(b) - if err != nil { - return fmt.Errorf("unable to decode messageSponsorTypeBot#700d2304: field link: %w", err) - } - m.Link = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (m *MessageSponsorTypeBot) GetBotUserID() (value int64) { - if m == nil { - return - } - return m.BotUserID -} - -// GetLink returns value of Link field. -func (m *MessageSponsorTypeBot) GetLink() (value InternalLinkTypeClass) { - if m == nil { - return - } - return m.Link -} - -// MessageSponsorTypeWebApp represents TL type `messageSponsorTypeWebApp#25b74fb8`. -type MessageSponsorTypeWebApp struct { - // Web App title - WebAppTitle string - // An internal link to be opened when the sponsored message is clicked - Link InternalLinkTypeClass -} - -// MessageSponsorTypeWebAppTypeID is TL type id of MessageSponsorTypeWebApp. -const MessageSponsorTypeWebAppTypeID = 0x25b74fb8 - -// construct implements constructor of MessageSponsorTypeClass. -func (m MessageSponsorTypeWebApp) construct() MessageSponsorTypeClass { return &m } - -// Ensuring interfaces in compile-time for MessageSponsorTypeWebApp. -var ( - _ bin.Encoder = &MessageSponsorTypeWebApp{} - _ bin.Decoder = &MessageSponsorTypeWebApp{} - _ bin.BareEncoder = &MessageSponsorTypeWebApp{} - _ bin.BareDecoder = &MessageSponsorTypeWebApp{} - - _ MessageSponsorTypeClass = &MessageSponsorTypeWebApp{} -) - -func (m *MessageSponsorTypeWebApp) Zero() bool { - if m == nil { - return true - } - if !(m.WebAppTitle == "") { - return false - } - if !(m.Link == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSponsorTypeWebApp) String() string { - if m == nil { - return "MessageSponsorTypeWebApp(nil)" - } - type Alias MessageSponsorTypeWebApp - return fmt.Sprintf("MessageSponsorTypeWebApp%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSponsorTypeWebApp) TypeID() uint32 { - return MessageSponsorTypeWebAppTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSponsorTypeWebApp) TypeName() string { - return "messageSponsorTypeWebApp" -} - -// TypeInfo returns info about TL type. -func (m *MessageSponsorTypeWebApp) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSponsorTypeWebApp", - ID: MessageSponsorTypeWebAppTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "WebAppTitle", - SchemaName: "web_app_title", - }, - { - Name: "Link", - SchemaName: "link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSponsorTypeWebApp) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSponsorTypeWebApp#25b74fb8 as nil") - } - b.PutID(MessageSponsorTypeWebAppTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSponsorTypeWebApp) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSponsorTypeWebApp#25b74fb8 as nil") - } - b.PutString(m.WebAppTitle) - if m.Link == nil { - return fmt.Errorf("unable to encode messageSponsorTypeWebApp#25b74fb8: field link is nil") - } - if err := m.Link.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageSponsorTypeWebApp#25b74fb8: field link: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSponsorTypeWebApp) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSponsorTypeWebApp#25b74fb8 to nil") - } - if err := b.ConsumeID(MessageSponsorTypeWebAppTypeID); err != nil { - return fmt.Errorf("unable to decode messageSponsorTypeWebApp#25b74fb8: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSponsorTypeWebApp) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSponsorTypeWebApp#25b74fb8 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageSponsorTypeWebApp#25b74fb8: field web_app_title: %w", err) - } - m.WebAppTitle = value - } - { - value, err := DecodeInternalLinkType(b) - if err != nil { - return fmt.Errorf("unable to decode messageSponsorTypeWebApp#25b74fb8: field link: %w", err) - } - m.Link = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSponsorTypeWebApp) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSponsorTypeWebApp#25b74fb8 as nil") - } - b.ObjStart() - b.PutID("messageSponsorTypeWebApp") - b.Comma() - b.FieldStart("web_app_title") - b.PutString(m.WebAppTitle) - b.Comma() - b.FieldStart("link") - if m.Link == nil { - return fmt.Errorf("unable to encode messageSponsorTypeWebApp#25b74fb8: field link is nil") - } - if err := m.Link.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageSponsorTypeWebApp#25b74fb8: field link: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSponsorTypeWebApp) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSponsorTypeWebApp#25b74fb8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSponsorTypeWebApp"); err != nil { - return fmt.Errorf("unable to decode messageSponsorTypeWebApp#25b74fb8: %w", err) - } - case "web_app_title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageSponsorTypeWebApp#25b74fb8: field web_app_title: %w", err) - } - m.WebAppTitle = value - case "link": - value, err := DecodeTDLibJSONInternalLinkType(b) - if err != nil { - return fmt.Errorf("unable to decode messageSponsorTypeWebApp#25b74fb8: field link: %w", err) - } - m.Link = value - default: - return b.Skip() - } - return nil - }) -} - -// GetWebAppTitle returns value of WebAppTitle field. -func (m *MessageSponsorTypeWebApp) GetWebAppTitle() (value string) { - if m == nil { - return - } - return m.WebAppTitle -} - -// GetLink returns value of Link field. -func (m *MessageSponsorTypeWebApp) GetLink() (value InternalLinkTypeClass) { - if m == nil { - return - } - return m.Link -} - -// MessageSponsorTypePublicChannel represents TL type `messageSponsorTypePublicChannel#ed645a47`. -type MessageSponsorTypePublicChannel struct { - // Sponsor chat identifier - ChatID int64 - // An internal link to be opened when the sponsored message is clicked; may be null if - // the sponsor chat needs to be opened instead - Link InternalLinkTypeClass -} - -// MessageSponsorTypePublicChannelTypeID is TL type id of MessageSponsorTypePublicChannel. -const MessageSponsorTypePublicChannelTypeID = 0xed645a47 - -// construct implements constructor of MessageSponsorTypeClass. -func (m MessageSponsorTypePublicChannel) construct() MessageSponsorTypeClass { return &m } - -// Ensuring interfaces in compile-time for MessageSponsorTypePublicChannel. -var ( - _ bin.Encoder = &MessageSponsorTypePublicChannel{} - _ bin.Decoder = &MessageSponsorTypePublicChannel{} - _ bin.BareEncoder = &MessageSponsorTypePublicChannel{} - _ bin.BareDecoder = &MessageSponsorTypePublicChannel{} - - _ MessageSponsorTypeClass = &MessageSponsorTypePublicChannel{} -) - -func (m *MessageSponsorTypePublicChannel) Zero() bool { - if m == nil { - return true - } - if !(m.ChatID == 0) { - return false - } - if !(m.Link == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSponsorTypePublicChannel) String() string { - if m == nil { - return "MessageSponsorTypePublicChannel(nil)" - } - type Alias MessageSponsorTypePublicChannel - return fmt.Sprintf("MessageSponsorTypePublicChannel%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSponsorTypePublicChannel) TypeID() uint32 { - return MessageSponsorTypePublicChannelTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSponsorTypePublicChannel) TypeName() string { - return "messageSponsorTypePublicChannel" -} - -// TypeInfo returns info about TL type. -func (m *MessageSponsorTypePublicChannel) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSponsorTypePublicChannel", - ID: MessageSponsorTypePublicChannelTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Link", - SchemaName: "link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSponsorTypePublicChannel) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSponsorTypePublicChannel#ed645a47 as nil") - } - b.PutID(MessageSponsorTypePublicChannelTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSponsorTypePublicChannel) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSponsorTypePublicChannel#ed645a47 as nil") - } - b.PutInt53(m.ChatID) - if m.Link == nil { - return fmt.Errorf("unable to encode messageSponsorTypePublicChannel#ed645a47: field link is nil") - } - if err := m.Link.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageSponsorTypePublicChannel#ed645a47: field link: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSponsorTypePublicChannel) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSponsorTypePublicChannel#ed645a47 to nil") - } - if err := b.ConsumeID(MessageSponsorTypePublicChannelTypeID); err != nil { - return fmt.Errorf("unable to decode messageSponsorTypePublicChannel#ed645a47: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSponsorTypePublicChannel) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSponsorTypePublicChannel#ed645a47 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageSponsorTypePublicChannel#ed645a47: field chat_id: %w", err) - } - m.ChatID = value - } - { - value, err := DecodeInternalLinkType(b) - if err != nil { - return fmt.Errorf("unable to decode messageSponsorTypePublicChannel#ed645a47: field link: %w", err) - } - m.Link = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSponsorTypePublicChannel) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSponsorTypePublicChannel#ed645a47 as nil") - } - b.ObjStart() - b.PutID("messageSponsorTypePublicChannel") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(m.ChatID) - b.Comma() - b.FieldStart("link") - if m.Link == nil { - return fmt.Errorf("unable to encode messageSponsorTypePublicChannel#ed645a47: field link is nil") - } - if err := m.Link.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageSponsorTypePublicChannel#ed645a47: field link: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSponsorTypePublicChannel) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSponsorTypePublicChannel#ed645a47 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSponsorTypePublicChannel"); err != nil { - return fmt.Errorf("unable to decode messageSponsorTypePublicChannel#ed645a47: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageSponsorTypePublicChannel#ed645a47: field chat_id: %w", err) - } - m.ChatID = value - case "link": - value, err := DecodeTDLibJSONInternalLinkType(b) - if err != nil { - return fmt.Errorf("unable to decode messageSponsorTypePublicChannel#ed645a47: field link: %w", err) - } - m.Link = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (m *MessageSponsorTypePublicChannel) GetChatID() (value int64) { - if m == nil { - return - } - return m.ChatID -} - -// GetLink returns value of Link field. -func (m *MessageSponsorTypePublicChannel) GetLink() (value InternalLinkTypeClass) { - if m == nil { - return - } - return m.Link -} - -// MessageSponsorTypePrivateChannel represents TL type `messageSponsorTypePrivateChannel#74d245a8`. -type MessageSponsorTypePrivateChannel struct { - // Title of the chat - Title string - // Invite link for the channel - InviteLink string -} - -// MessageSponsorTypePrivateChannelTypeID is TL type id of MessageSponsorTypePrivateChannel. -const MessageSponsorTypePrivateChannelTypeID = 0x74d245a8 - -// construct implements constructor of MessageSponsorTypeClass. -func (m MessageSponsorTypePrivateChannel) construct() MessageSponsorTypeClass { return &m } - -// Ensuring interfaces in compile-time for MessageSponsorTypePrivateChannel. -var ( - _ bin.Encoder = &MessageSponsorTypePrivateChannel{} - _ bin.Decoder = &MessageSponsorTypePrivateChannel{} - _ bin.BareEncoder = &MessageSponsorTypePrivateChannel{} - _ bin.BareDecoder = &MessageSponsorTypePrivateChannel{} - - _ MessageSponsorTypeClass = &MessageSponsorTypePrivateChannel{} -) - -func (m *MessageSponsorTypePrivateChannel) Zero() bool { - if m == nil { - return true - } - if !(m.Title == "") { - return false - } - if !(m.InviteLink == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSponsorTypePrivateChannel) String() string { - if m == nil { - return "MessageSponsorTypePrivateChannel(nil)" - } - type Alias MessageSponsorTypePrivateChannel - return fmt.Sprintf("MessageSponsorTypePrivateChannel%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSponsorTypePrivateChannel) TypeID() uint32 { - return MessageSponsorTypePrivateChannelTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSponsorTypePrivateChannel) TypeName() string { - return "messageSponsorTypePrivateChannel" -} - -// TypeInfo returns info about TL type. -func (m *MessageSponsorTypePrivateChannel) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSponsorTypePrivateChannel", - ID: MessageSponsorTypePrivateChannelTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSponsorTypePrivateChannel) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSponsorTypePrivateChannel#74d245a8 as nil") - } - b.PutID(MessageSponsorTypePrivateChannelTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSponsorTypePrivateChannel) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSponsorTypePrivateChannel#74d245a8 as nil") - } - b.PutString(m.Title) - b.PutString(m.InviteLink) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSponsorTypePrivateChannel) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSponsorTypePrivateChannel#74d245a8 to nil") - } - if err := b.ConsumeID(MessageSponsorTypePrivateChannelTypeID); err != nil { - return fmt.Errorf("unable to decode messageSponsorTypePrivateChannel#74d245a8: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSponsorTypePrivateChannel) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSponsorTypePrivateChannel#74d245a8 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageSponsorTypePrivateChannel#74d245a8: field title: %w", err) - } - m.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageSponsorTypePrivateChannel#74d245a8: field invite_link: %w", err) - } - m.InviteLink = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSponsorTypePrivateChannel) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSponsorTypePrivateChannel#74d245a8 as nil") - } - b.ObjStart() - b.PutID("messageSponsorTypePrivateChannel") - b.Comma() - b.FieldStart("title") - b.PutString(m.Title) - b.Comma() - b.FieldStart("invite_link") - b.PutString(m.InviteLink) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSponsorTypePrivateChannel) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSponsorTypePrivateChannel#74d245a8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSponsorTypePrivateChannel"); err != nil { - return fmt.Errorf("unable to decode messageSponsorTypePrivateChannel#74d245a8: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageSponsorTypePrivateChannel#74d245a8: field title: %w", err) - } - m.Title = value - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageSponsorTypePrivateChannel#74d245a8: field invite_link: %w", err) - } - m.InviteLink = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (m *MessageSponsorTypePrivateChannel) GetTitle() (value string) { - if m == nil { - return - } - return m.Title -} - -// GetInviteLink returns value of InviteLink field. -func (m *MessageSponsorTypePrivateChannel) GetInviteLink() (value string) { - if m == nil { - return - } - return m.InviteLink -} - -// MessageSponsorTypeWebsite represents TL type `messageSponsorTypeWebsite#a4e45f9b`. -type MessageSponsorTypeWebsite struct { - // URL of the website - URL string - // Name of the website - Name string -} - -// MessageSponsorTypeWebsiteTypeID is TL type id of MessageSponsorTypeWebsite. -const MessageSponsorTypeWebsiteTypeID = 0xa4e45f9b - -// construct implements constructor of MessageSponsorTypeClass. -func (m MessageSponsorTypeWebsite) construct() MessageSponsorTypeClass { return &m } - -// Ensuring interfaces in compile-time for MessageSponsorTypeWebsite. -var ( - _ bin.Encoder = &MessageSponsorTypeWebsite{} - _ bin.Decoder = &MessageSponsorTypeWebsite{} - _ bin.BareEncoder = &MessageSponsorTypeWebsite{} - _ bin.BareDecoder = &MessageSponsorTypeWebsite{} - - _ MessageSponsorTypeClass = &MessageSponsorTypeWebsite{} -) - -func (m *MessageSponsorTypeWebsite) Zero() bool { - if m == nil { - return true - } - if !(m.URL == "") { - return false - } - if !(m.Name == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSponsorTypeWebsite) String() string { - if m == nil { - return "MessageSponsorTypeWebsite(nil)" - } - type Alias MessageSponsorTypeWebsite - return fmt.Sprintf("MessageSponsorTypeWebsite%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSponsorTypeWebsite) TypeID() uint32 { - return MessageSponsorTypeWebsiteTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSponsorTypeWebsite) TypeName() string { - return "messageSponsorTypeWebsite" -} - -// TypeInfo returns info about TL type. -func (m *MessageSponsorTypeWebsite) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSponsorTypeWebsite", - ID: MessageSponsorTypeWebsiteTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "Name", - SchemaName: "name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSponsorTypeWebsite) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSponsorTypeWebsite#a4e45f9b as nil") - } - b.PutID(MessageSponsorTypeWebsiteTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSponsorTypeWebsite) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSponsorTypeWebsite#a4e45f9b as nil") - } - b.PutString(m.URL) - b.PutString(m.Name) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSponsorTypeWebsite) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSponsorTypeWebsite#a4e45f9b to nil") - } - if err := b.ConsumeID(MessageSponsorTypeWebsiteTypeID); err != nil { - return fmt.Errorf("unable to decode messageSponsorTypeWebsite#a4e45f9b: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSponsorTypeWebsite) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSponsorTypeWebsite#a4e45f9b to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageSponsorTypeWebsite#a4e45f9b: field url: %w", err) - } - m.URL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageSponsorTypeWebsite#a4e45f9b: field name: %w", err) - } - m.Name = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSponsorTypeWebsite) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSponsorTypeWebsite#a4e45f9b as nil") - } - b.ObjStart() - b.PutID("messageSponsorTypeWebsite") - b.Comma() - b.FieldStart("url") - b.PutString(m.URL) - b.Comma() - b.FieldStart("name") - b.PutString(m.Name) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSponsorTypeWebsite) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSponsorTypeWebsite#a4e45f9b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSponsorTypeWebsite"); err != nil { - return fmt.Errorf("unable to decode messageSponsorTypeWebsite#a4e45f9b: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageSponsorTypeWebsite#a4e45f9b: field url: %w", err) - } - m.URL = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageSponsorTypeWebsite#a4e45f9b: field name: %w", err) - } - m.Name = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (m *MessageSponsorTypeWebsite) GetURL() (value string) { - if m == nil { - return - } - return m.URL -} - -// GetName returns value of Name field. -func (m *MessageSponsorTypeWebsite) GetName() (value string) { - if m == nil { - return - } - return m.Name -} - -// MessageSponsorTypeClassName is schema name of MessageSponsorTypeClass. -const MessageSponsorTypeClassName = "MessageSponsorType" - -// MessageSponsorTypeClass represents MessageSponsorType generic type. -// -// Example: -// -// g, err := tdapi.DecodeMessageSponsorType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.MessageSponsorTypeBot: // messageSponsorTypeBot#700d2304 -// case *tdapi.MessageSponsorTypeWebApp: // messageSponsorTypeWebApp#25b74fb8 -// case *tdapi.MessageSponsorTypePublicChannel: // messageSponsorTypePublicChannel#ed645a47 -// case *tdapi.MessageSponsorTypePrivateChannel: // messageSponsorTypePrivateChannel#74d245a8 -// case *tdapi.MessageSponsorTypeWebsite: // messageSponsorTypeWebsite#a4e45f9b -// default: panic(v) -// } -type MessageSponsorTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() MessageSponsorTypeClass - - // 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 -} - -// DecodeMessageSponsorType implements binary de-serialization for MessageSponsorTypeClass. -func DecodeMessageSponsorType(buf *bin.Buffer) (MessageSponsorTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case MessageSponsorTypeBotTypeID: - // Decoding messageSponsorTypeBot#700d2304. - v := MessageSponsorTypeBot{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSponsorTypeClass: %w", err) - } - return &v, nil - case MessageSponsorTypeWebAppTypeID: - // Decoding messageSponsorTypeWebApp#25b74fb8. - v := MessageSponsorTypeWebApp{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSponsorTypeClass: %w", err) - } - return &v, nil - case MessageSponsorTypePublicChannelTypeID: - // Decoding messageSponsorTypePublicChannel#ed645a47. - v := MessageSponsorTypePublicChannel{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSponsorTypeClass: %w", err) - } - return &v, nil - case MessageSponsorTypePrivateChannelTypeID: - // Decoding messageSponsorTypePrivateChannel#74d245a8. - v := MessageSponsorTypePrivateChannel{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSponsorTypeClass: %w", err) - } - return &v, nil - case MessageSponsorTypeWebsiteTypeID: - // Decoding messageSponsorTypeWebsite#a4e45f9b. - v := MessageSponsorTypeWebsite{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSponsorTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageSponsorTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONMessageSponsorType implements binary de-serialization for MessageSponsorTypeClass. -func DecodeTDLibJSONMessageSponsorType(buf tdjson.Decoder) (MessageSponsorTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "messageSponsorTypeBot": - // Decoding messageSponsorTypeBot#700d2304. - v := MessageSponsorTypeBot{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSponsorTypeClass: %w", err) - } - return &v, nil - case "messageSponsorTypeWebApp": - // Decoding messageSponsorTypeWebApp#25b74fb8. - v := MessageSponsorTypeWebApp{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSponsorTypeClass: %w", err) - } - return &v, nil - case "messageSponsorTypePublicChannel": - // Decoding messageSponsorTypePublicChannel#ed645a47. - v := MessageSponsorTypePublicChannel{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSponsorTypeClass: %w", err) - } - return &v, nil - case "messageSponsorTypePrivateChannel": - // Decoding messageSponsorTypePrivateChannel#74d245a8. - v := MessageSponsorTypePrivateChannel{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSponsorTypeClass: %w", err) - } - return &v, nil - case "messageSponsorTypeWebsite": - // Decoding messageSponsorTypeWebsite#a4e45f9b. - v := MessageSponsorTypeWebsite{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSponsorTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageSponsorTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// MessageSponsorType boxes the MessageSponsorTypeClass providing a helper. -type MessageSponsorTypeBox struct { - MessageSponsorType MessageSponsorTypeClass -} - -// Decode implements bin.Decoder for MessageSponsorTypeBox. -func (b *MessageSponsorTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode MessageSponsorTypeBox to nil") - } - v, err := DecodeMessageSponsorType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageSponsorType = v - return nil -} - -// Encode implements bin.Encode for MessageSponsorTypeBox. -func (b *MessageSponsorTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.MessageSponsorType == nil { - return fmt.Errorf("unable to encode MessageSponsorTypeClass as nil") - } - return b.MessageSponsorType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for MessageSponsorTypeBox. -func (b *MessageSponsorTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode MessageSponsorTypeBox to nil") - } - v, err := DecodeTDLibJSONMessageSponsorType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageSponsorType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for MessageSponsorTypeBox. -func (b *MessageSponsorTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.MessageSponsorType == nil { - return fmt.Errorf("unable to encode MessageSponsorTypeClass as nil") - } - return b.MessageSponsorType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_phone_number_authentication_settings_gen.go b/tdapi/tl_phone_number_authentication_settings_gen.go index 80654e4977..a478f2eba6 100644 --- a/tdapi/tl_phone_number_authentication_settings_gen.go +++ b/tdapi/tl_phone_number_authentication_settings_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// PhoneNumberAuthenticationSettings represents TL type `phoneNumberAuthenticationSettings#c6e19fa1`. +// PhoneNumberAuthenticationSettings represents TL type `phoneNumberAuthenticationSettings#3e1183db`. type PhoneNumberAuthenticationSettings struct { // Pass true if the authentication code may be sent via a flash call to the specified // phone number @@ -41,6 +41,9 @@ type PhoneNumberAuthenticationSettings struct { AllowMissedCall bool // Pass true if the authenticated phone number is used on the current device IsCurrentPhoneNumber bool + // Pass true if there is a SIM card in the current device, but it is not possible to + // check whether phone number matches + HasUnknownPhoneNumber bool // For official applications only. True, if the application can use Android SMS Retriever // API (requires Google Play Services >= 10.2) to automatically receive the // authentication code from the SMS. See https://developers.google @@ -55,7 +58,7 @@ type PhoneNumberAuthenticationSettings struct { } // PhoneNumberAuthenticationSettingsTypeID is TL type id of PhoneNumberAuthenticationSettings. -const PhoneNumberAuthenticationSettingsTypeID = 0xc6e19fa1 +const PhoneNumberAuthenticationSettingsTypeID = 0x3e1183db // Ensuring interfaces in compile-time for PhoneNumberAuthenticationSettings. var ( @@ -78,6 +81,9 @@ func (p *PhoneNumberAuthenticationSettings) Zero() bool { if !(p.IsCurrentPhoneNumber == false) { return false } + if !(p.HasUnknownPhoneNumber == false) { + return false + } if !(p.AllowSMSRetrieverAPI == false) { return false } @@ -135,6 +141,10 @@ func (p *PhoneNumberAuthenticationSettings) TypeInfo() tdp.Type { Name: "IsCurrentPhoneNumber", SchemaName: "is_current_phone_number", }, + { + Name: "HasUnknownPhoneNumber", + SchemaName: "has_unknown_phone_number", + }, { Name: "AllowSMSRetrieverAPI", SchemaName: "allow_sms_retriever_api", @@ -154,7 +164,7 @@ func (p *PhoneNumberAuthenticationSettings) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (p *PhoneNumberAuthenticationSettings) Encode(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't encode phoneNumberAuthenticationSettings#c6e19fa1 as nil") + return fmt.Errorf("can't encode phoneNumberAuthenticationSettings#3e1183db as nil") } b.PutID(PhoneNumberAuthenticationSettingsTypeID) return p.EncodeBare(b) @@ -163,17 +173,18 @@ func (p *PhoneNumberAuthenticationSettings) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (p *PhoneNumberAuthenticationSettings) EncodeBare(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't encode phoneNumberAuthenticationSettings#c6e19fa1 as nil") + return fmt.Errorf("can't encode phoneNumberAuthenticationSettings#3e1183db as nil") } b.PutBool(p.AllowFlashCall) b.PutBool(p.AllowMissedCall) b.PutBool(p.IsCurrentPhoneNumber) + b.PutBool(p.HasUnknownPhoneNumber) b.PutBool(p.AllowSMSRetrieverAPI) if p.FirebaseAuthenticationSettings == nil { - return fmt.Errorf("unable to encode phoneNumberAuthenticationSettings#c6e19fa1: field firebase_authentication_settings is nil") + return fmt.Errorf("unable to encode phoneNumberAuthenticationSettings#3e1183db: field firebase_authentication_settings is nil") } if err := p.FirebaseAuthenticationSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode phoneNumberAuthenticationSettings#c6e19fa1: field firebase_authentication_settings: %w", err) + return fmt.Errorf("unable to encode phoneNumberAuthenticationSettings#3e1183db: field firebase_authentication_settings: %w", err) } b.PutInt(len(p.AuthenticationTokens)) for _, v := range p.AuthenticationTokens { @@ -185,10 +196,10 @@ func (p *PhoneNumberAuthenticationSettings) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (p *PhoneNumberAuthenticationSettings) Decode(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't decode phoneNumberAuthenticationSettings#c6e19fa1 to nil") + return fmt.Errorf("can't decode phoneNumberAuthenticationSettings#3e1183db to nil") } if err := b.ConsumeID(PhoneNumberAuthenticationSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#c6e19fa1: %w", err) + return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: %w", err) } return p.DecodeBare(b) } @@ -196,47 +207,54 @@ func (p *PhoneNumberAuthenticationSettings) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (p *PhoneNumberAuthenticationSettings) DecodeBare(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't decode phoneNumberAuthenticationSettings#c6e19fa1 to nil") + return fmt.Errorf("can't decode phoneNumberAuthenticationSettings#3e1183db to nil") } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#c6e19fa1: field allow_flash_call: %w", err) + return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field allow_flash_call: %w", err) } p.AllowFlashCall = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#c6e19fa1: field allow_missed_call: %w", err) + return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field allow_missed_call: %w", err) } p.AllowMissedCall = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#c6e19fa1: field is_current_phone_number: %w", err) + return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field is_current_phone_number: %w", err) } p.IsCurrentPhoneNumber = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#c6e19fa1: field allow_sms_retriever_api: %w", err) + return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field has_unknown_phone_number: %w", err) + } + p.HasUnknownPhoneNumber = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field allow_sms_retriever_api: %w", err) } p.AllowSMSRetrieverAPI = value } { value, err := DecodeFirebaseAuthenticationSettings(b) if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#c6e19fa1: field firebase_authentication_settings: %w", err) + return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field firebase_authentication_settings: %w", err) } p.FirebaseAuthenticationSettings = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#c6e19fa1: field authentication_tokens: %w", err) + return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field authentication_tokens: %w", err) } if headerLen > 0 { @@ -245,7 +263,7 @@ func (p *PhoneNumberAuthenticationSettings) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#c6e19fa1: field authentication_tokens: %w", err) + return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field authentication_tokens: %w", err) } p.AuthenticationTokens = append(p.AuthenticationTokens, value) } @@ -256,7 +274,7 @@ func (p *PhoneNumberAuthenticationSettings) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (p *PhoneNumberAuthenticationSettings) EncodeTDLibJSON(b tdjson.Encoder) error { if p == nil { - return fmt.Errorf("can't encode phoneNumberAuthenticationSettings#c6e19fa1 as nil") + return fmt.Errorf("can't encode phoneNumberAuthenticationSettings#3e1183db as nil") } b.ObjStart() b.PutID("phoneNumberAuthenticationSettings") @@ -270,15 +288,18 @@ func (p *PhoneNumberAuthenticationSettings) EncodeTDLibJSON(b tdjson.Encoder) er b.FieldStart("is_current_phone_number") b.PutBool(p.IsCurrentPhoneNumber) b.Comma() + b.FieldStart("has_unknown_phone_number") + b.PutBool(p.HasUnknownPhoneNumber) + b.Comma() b.FieldStart("allow_sms_retriever_api") b.PutBool(p.AllowSMSRetrieverAPI) b.Comma() b.FieldStart("firebase_authentication_settings") if p.FirebaseAuthenticationSettings == nil { - return fmt.Errorf("unable to encode phoneNumberAuthenticationSettings#c6e19fa1: field firebase_authentication_settings is nil") + return fmt.Errorf("unable to encode phoneNumberAuthenticationSettings#3e1183db: field firebase_authentication_settings is nil") } if err := p.FirebaseAuthenticationSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode phoneNumberAuthenticationSettings#c6e19fa1: field firebase_authentication_settings: %w", err) + return fmt.Errorf("unable to encode phoneNumberAuthenticationSettings#3e1183db: field firebase_authentication_settings: %w", err) } b.Comma() b.FieldStart("authentication_tokens") @@ -298,55 +319,61 @@ func (p *PhoneNumberAuthenticationSettings) EncodeTDLibJSON(b tdjson.Encoder) er // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (p *PhoneNumberAuthenticationSettings) DecodeTDLibJSON(b tdjson.Decoder) error { if p == nil { - return fmt.Errorf("can't decode phoneNumberAuthenticationSettings#c6e19fa1 to nil") + return fmt.Errorf("can't decode phoneNumberAuthenticationSettings#3e1183db to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("phoneNumberAuthenticationSettings"); err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#c6e19fa1: %w", err) + return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: %w", err) } case "allow_flash_call": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#c6e19fa1: field allow_flash_call: %w", err) + return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field allow_flash_call: %w", err) } p.AllowFlashCall = value case "allow_missed_call": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#c6e19fa1: field allow_missed_call: %w", err) + return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field allow_missed_call: %w", err) } p.AllowMissedCall = value case "is_current_phone_number": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#c6e19fa1: field is_current_phone_number: %w", err) + return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field is_current_phone_number: %w", err) } p.IsCurrentPhoneNumber = value + case "has_unknown_phone_number": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field has_unknown_phone_number: %w", err) + } + p.HasUnknownPhoneNumber = value case "allow_sms_retriever_api": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#c6e19fa1: field allow_sms_retriever_api: %w", err) + return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field allow_sms_retriever_api: %w", err) } p.AllowSMSRetrieverAPI = value case "firebase_authentication_settings": value, err := DecodeTDLibJSONFirebaseAuthenticationSettings(b) if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#c6e19fa1: field firebase_authentication_settings: %w", err) + return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field firebase_authentication_settings: %w", err) } p.FirebaseAuthenticationSettings = value case "authentication_tokens": if err := b.Arr(func(b tdjson.Decoder) error { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#c6e19fa1: field authentication_tokens: %w", err) + return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field authentication_tokens: %w", err) } p.AuthenticationTokens = append(p.AuthenticationTokens, value) return nil }); err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#c6e19fa1: field authentication_tokens: %w", err) + return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field authentication_tokens: %w", err) } default: return b.Skip() @@ -379,6 +406,14 @@ func (p *PhoneNumberAuthenticationSettings) GetIsCurrentPhoneNumber() (value boo return p.IsCurrentPhoneNumber } +// GetHasUnknownPhoneNumber returns value of HasUnknownPhoneNumber field. +func (p *PhoneNumberAuthenticationSettings) GetHasUnknownPhoneNumber() (value bool) { + if p == nil { + return + } + return p.HasUnknownPhoneNumber +} + // GetAllowSMSRetrieverAPI returns value of AllowSMSRetrieverAPI field. func (p *PhoneNumberAuthenticationSettings) GetAllowSMSRetrieverAPI() (value bool) { if p == nil { diff --git a/tdapi/tl_poll_gen.go b/tdapi/tl_poll_gen.go index b19de791cb..5ba43f40a5 100644 --- a/tdapi/tl_poll_gen.go +++ b/tdapi/tl_poll_gen.go @@ -31,12 +31,12 @@ var ( _ = tdjson.Encoder{} ) -// Poll represents TL type `poll#8c34a82a`. +// Poll represents TL type `poll#71d4870c`. type Poll struct { // Unique poll identifier ID int64 - // Poll question; 1-300 characters - Question string + // Poll question; 1-300 characters. Only custom emoji entities are allowed + Question FormattedText // List of poll answer options Options []PollOption // Total number of voters, participating in the poll @@ -56,7 +56,7 @@ type Poll struct { } // PollTypeID is TL type id of Poll. -const PollTypeID = 0x8c34a82a +const PollTypeID = 0x71d4870c // Ensuring interfaces in compile-time for Poll. var ( @@ -73,7 +73,7 @@ func (p *Poll) Zero() bool { if !(p.ID == 0) { return false } - if !(p.Question == "") { + if !(p.Question.Zero()) { return false } if !(p.Options == nil) { @@ -183,7 +183,7 @@ func (p *Poll) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (p *Poll) Encode(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't encode poll#8c34a82a as nil") + return fmt.Errorf("can't encode poll#71d4870c as nil") } b.PutID(PollTypeID) return p.EncodeBare(b) @@ -192,32 +192,34 @@ func (p *Poll) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (p *Poll) EncodeBare(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't encode poll#8c34a82a as nil") + return fmt.Errorf("can't encode poll#71d4870c as nil") } b.PutLong(p.ID) - b.PutString(p.Question) + if err := p.Question.Encode(b); err != nil { + return fmt.Errorf("unable to encode poll#71d4870c: field question: %w", err) + } b.PutInt(len(p.Options)) for idx, v := range p.Options { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare poll#8c34a82a: field options element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare poll#71d4870c: field options element with index %d: %w", idx, err) } } b.PutInt32(p.TotalVoterCount) b.PutInt(len(p.RecentVoterIDs)) for idx, v := range p.RecentVoterIDs { if v == nil { - return fmt.Errorf("unable to encode poll#8c34a82a: field recent_voter_ids element with index %d is nil", idx) + return fmt.Errorf("unable to encode poll#71d4870c: field recent_voter_ids element with index %d is nil", idx) } if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare poll#8c34a82a: field recent_voter_ids element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare poll#71d4870c: field recent_voter_ids element with index %d: %w", idx, err) } } b.PutBool(p.IsAnonymous) if p.Type == nil { - return fmt.Errorf("unable to encode poll#8c34a82a: field type is nil") + return fmt.Errorf("unable to encode poll#71d4870c: field type is nil") } if err := p.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode poll#8c34a82a: field type: %w", err) + return fmt.Errorf("unable to encode poll#71d4870c: field type: %w", err) } b.PutInt32(p.OpenPeriod) b.PutInt32(p.CloseDate) @@ -228,10 +230,10 @@ func (p *Poll) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (p *Poll) Decode(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't decode poll#8c34a82a to nil") + return fmt.Errorf("can't decode poll#71d4870c to nil") } if err := b.ConsumeID(PollTypeID); err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: %w", err) } return p.DecodeBare(b) } @@ -239,26 +241,24 @@ func (p *Poll) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (p *Poll) DecodeBare(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't decode poll#8c34a82a to nil") + return fmt.Errorf("can't decode poll#71d4870c to nil") } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field id: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field id: %w", err) } p.ID = value } { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field question: %w", err) + if err := p.Question.Decode(b); err != nil { + return fmt.Errorf("unable to decode poll#71d4870c: field question: %w", err) } - p.Question = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field options: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field options: %w", err) } if headerLen > 0 { @@ -267,7 +267,7 @@ func (p *Poll) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value PollOption if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare poll#8c34a82a: field options: %w", err) + return fmt.Errorf("unable to decode bare poll#71d4870c: field options: %w", err) } p.Options = append(p.Options, value) } @@ -275,14 +275,14 @@ func (p *Poll) DecodeBare(b *bin.Buffer) error { { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field total_voter_count: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field total_voter_count: %w", err) } p.TotalVoterCount = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field recent_voter_ids: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field recent_voter_ids: %w", err) } if headerLen > 0 { @@ -291,7 +291,7 @@ func (p *Poll) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field recent_voter_ids: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field recent_voter_ids: %w", err) } p.RecentVoterIDs = append(p.RecentVoterIDs, value) } @@ -299,35 +299,35 @@ func (p *Poll) DecodeBare(b *bin.Buffer) error { { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field is_anonymous: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field is_anonymous: %w", err) } p.IsAnonymous = value } { value, err := DecodePollType(b) if err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field type: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field type: %w", err) } p.Type = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field open_period: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field open_period: %w", err) } p.OpenPeriod = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field close_date: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field close_date: %w", err) } p.CloseDate = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field is_closed: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field is_closed: %w", err) } p.IsClosed = value } @@ -337,7 +337,7 @@ func (p *Poll) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (p *Poll) EncodeTDLibJSON(b tdjson.Encoder) error { if p == nil { - return fmt.Errorf("can't encode poll#8c34a82a as nil") + return fmt.Errorf("can't encode poll#71d4870c as nil") } b.ObjStart() b.PutID("poll") @@ -346,13 +346,15 @@ func (p *Poll) EncodeTDLibJSON(b tdjson.Encoder) error { b.PutLong(p.ID) b.Comma() b.FieldStart("question") - b.PutString(p.Question) + if err := p.Question.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode poll#71d4870c: field question: %w", err) + } b.Comma() b.FieldStart("options") b.ArrStart() for idx, v := range p.Options { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode poll#8c34a82a: field options element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode poll#71d4870c: field options element with index %d: %w", idx, err) } b.Comma() } @@ -366,10 +368,10 @@ func (p *Poll) EncodeTDLibJSON(b tdjson.Encoder) error { b.ArrStart() for idx, v := range p.RecentVoterIDs { if v == nil { - return fmt.Errorf("unable to encode poll#8c34a82a: field recent_voter_ids element with index %d is nil", idx) + return fmt.Errorf("unable to encode poll#71d4870c: field recent_voter_ids element with index %d is nil", idx) } if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode poll#8c34a82a: field recent_voter_ids element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode poll#71d4870c: field recent_voter_ids element with index %d: %w", idx, err) } b.Comma() } @@ -381,10 +383,10 @@ func (p *Poll) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("type") if p.Type == nil { - return fmt.Errorf("unable to encode poll#8c34a82a: field type is nil") + return fmt.Errorf("unable to encode poll#71d4870c: field type is nil") } if err := p.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode poll#8c34a82a: field type: %w", err) + return fmt.Errorf("unable to encode poll#71d4870c: field type: %w", err) } b.Comma() b.FieldStart("open_period") @@ -404,83 +406,81 @@ func (p *Poll) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (p *Poll) DecodeTDLibJSON(b tdjson.Decoder) error { if p == nil { - return fmt.Errorf("can't decode poll#8c34a82a to nil") + return fmt.Errorf("can't decode poll#71d4870c to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("poll"); err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: %w", err) } case "id": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field id: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field id: %w", err) } p.ID = value case "question": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field question: %w", err) + if err := p.Question.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode poll#71d4870c: field question: %w", err) } - p.Question = value case "options": if err := b.Arr(func(b tdjson.Decoder) error { var value PollOption if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field options: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field options: %w", err) } p.Options = append(p.Options, value) return nil }); err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field options: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field options: %w", err) } case "total_voter_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field total_voter_count: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field total_voter_count: %w", err) } p.TotalVoterCount = value case "recent_voter_ids": if err := b.Arr(func(b tdjson.Decoder) error { value, err := DecodeTDLibJSONMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field recent_voter_ids: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field recent_voter_ids: %w", err) } p.RecentVoterIDs = append(p.RecentVoterIDs, value) return nil }); err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field recent_voter_ids: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field recent_voter_ids: %w", err) } case "is_anonymous": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field is_anonymous: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field is_anonymous: %w", err) } p.IsAnonymous = value case "type": value, err := DecodeTDLibJSONPollType(b) if err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field type: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field type: %w", err) } p.Type = value case "open_period": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field open_period: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field open_period: %w", err) } p.OpenPeriod = value case "close_date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field close_date: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field close_date: %w", err) } p.CloseDate = value case "is_closed": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode poll#8c34a82a: field is_closed: %w", err) + return fmt.Errorf("unable to decode poll#71d4870c: field is_closed: %w", err) } p.IsClosed = value default: @@ -499,7 +499,7 @@ func (p *Poll) GetID() (value int64) { } // GetQuestion returns value of Question field. -func (p *Poll) GetQuestion() (value string) { +func (p *Poll) GetQuestion() (value FormattedText) { if p == nil { return } diff --git a/tdapi/tl_poll_option_gen.go b/tdapi/tl_poll_option_gen.go index 44e75bccbe..f80dc58681 100644 --- a/tdapi/tl_poll_option_gen.go +++ b/tdapi/tl_poll_option_gen.go @@ -31,10 +31,10 @@ var ( _ = tdjson.Encoder{} ) -// PollOption represents TL type `pollOption#57d9d5a5`. +// PollOption represents TL type `pollOption#63e97090`. type PollOption struct { - // Option text; 1-100 characters - Text string + // Option text; 1-100 characters. Only custom emoji entities are allowed + Text FormattedText // Number of voters for this option, available only for closed or voted polls VoterCount int32 // The percentage of votes for this option; 0-100 @@ -46,7 +46,7 @@ type PollOption struct { } // PollOptionTypeID is TL type id of PollOption. -const PollOptionTypeID = 0x57d9d5a5 +const PollOptionTypeID = 0x63e97090 // Ensuring interfaces in compile-time for PollOption. var ( @@ -60,7 +60,7 @@ func (p *PollOption) Zero() bool { if p == nil { return true } - if !(p.Text == "") { + if !(p.Text.Zero()) { return false } if !(p.VoterCount == 0) { @@ -138,7 +138,7 @@ func (p *PollOption) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (p *PollOption) Encode(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't encode pollOption#57d9d5a5 as nil") + return fmt.Errorf("can't encode pollOption#63e97090 as nil") } b.PutID(PollOptionTypeID) return p.EncodeBare(b) @@ -147,9 +147,11 @@ func (p *PollOption) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (p *PollOption) EncodeBare(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't encode pollOption#57d9d5a5 as nil") + return fmt.Errorf("can't encode pollOption#63e97090 as nil") + } + if err := p.Text.Encode(b); err != nil { + return fmt.Errorf("unable to encode pollOption#63e97090: field text: %w", err) } - b.PutString(p.Text) b.PutInt32(p.VoterCount) b.PutInt32(p.VotePercentage) b.PutBool(p.IsChosen) @@ -160,10 +162,10 @@ func (p *PollOption) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (p *PollOption) Decode(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't decode pollOption#57d9d5a5 to nil") + return fmt.Errorf("can't decode pollOption#63e97090 to nil") } if err := b.ConsumeID(PollOptionTypeID); err != nil { - return fmt.Errorf("unable to decode pollOption#57d9d5a5: %w", err) + return fmt.Errorf("unable to decode pollOption#63e97090: %w", err) } return p.DecodeBare(b) } @@ -171,40 +173,38 @@ func (p *PollOption) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (p *PollOption) DecodeBare(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't decode pollOption#57d9d5a5 to nil") + return fmt.Errorf("can't decode pollOption#63e97090 to nil") } { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pollOption#57d9d5a5: field text: %w", err) + if err := p.Text.Decode(b); err != nil { + return fmt.Errorf("unable to decode pollOption#63e97090: field text: %w", err) } - p.Text = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode pollOption#57d9d5a5: field voter_count: %w", err) + return fmt.Errorf("unable to decode pollOption#63e97090: field voter_count: %w", err) } p.VoterCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode pollOption#57d9d5a5: field vote_percentage: %w", err) + return fmt.Errorf("unable to decode pollOption#63e97090: field vote_percentage: %w", err) } p.VotePercentage = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode pollOption#57d9d5a5: field is_chosen: %w", err) + return fmt.Errorf("unable to decode pollOption#63e97090: field is_chosen: %w", err) } p.IsChosen = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode pollOption#57d9d5a5: field is_being_chosen: %w", err) + return fmt.Errorf("unable to decode pollOption#63e97090: field is_being_chosen: %w", err) } p.IsBeingChosen = value } @@ -214,13 +214,15 @@ func (p *PollOption) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (p *PollOption) EncodeTDLibJSON(b tdjson.Encoder) error { if p == nil { - return fmt.Errorf("can't encode pollOption#57d9d5a5 as nil") + return fmt.Errorf("can't encode pollOption#63e97090 as nil") } b.ObjStart() b.PutID("pollOption") b.Comma() b.FieldStart("text") - b.PutString(p.Text) + if err := p.Text.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode pollOption#63e97090: field text: %w", err) + } b.Comma() b.FieldStart("voter_count") b.PutInt32(p.VoterCount) @@ -242,43 +244,41 @@ func (p *PollOption) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (p *PollOption) DecodeTDLibJSON(b tdjson.Decoder) error { if p == nil { - return fmt.Errorf("can't decode pollOption#57d9d5a5 to nil") + return fmt.Errorf("can't decode pollOption#63e97090 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("pollOption"); err != nil { - return fmt.Errorf("unable to decode pollOption#57d9d5a5: %w", err) + return fmt.Errorf("unable to decode pollOption#63e97090: %w", err) } case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pollOption#57d9d5a5: field text: %w", err) + if err := p.Text.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode pollOption#63e97090: field text: %w", err) } - p.Text = value case "voter_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode pollOption#57d9d5a5: field voter_count: %w", err) + return fmt.Errorf("unable to decode pollOption#63e97090: field voter_count: %w", err) } p.VoterCount = value case "vote_percentage": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode pollOption#57d9d5a5: field vote_percentage: %w", err) + return fmt.Errorf("unable to decode pollOption#63e97090: field vote_percentage: %w", err) } p.VotePercentage = value case "is_chosen": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode pollOption#57d9d5a5: field is_chosen: %w", err) + return fmt.Errorf("unable to decode pollOption#63e97090: field is_chosen: %w", err) } p.IsChosen = value case "is_being_chosen": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode pollOption#57d9d5a5: field is_being_chosen: %w", err) + return fmt.Errorf("unable to decode pollOption#63e97090: field is_being_chosen: %w", err) } p.IsBeingChosen = value default: @@ -289,7 +289,7 @@ func (p *PollOption) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetText returns value of Text field. -func (p *PollOption) GetText() (value string) { +func (p *PollOption) GetText() (value FormattedText) { if p == nil { return } diff --git a/tdapi/tl_reaction_notification_settings_gen.go b/tdapi/tl_reaction_notification_settings_gen.go new file mode 100644 index 0000000000..e9f58498f8 --- /dev/null +++ b/tdapi/tl_reaction_notification_settings_gen.go @@ -0,0 +1,315 @@ +// 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{} +) + +// ReactionNotificationSettings represents TL type `reactionNotificationSettings#2bb0f654`. +type ReactionNotificationSettings struct { + // Source of message reactions for which notifications are shown + MessageReactionSource ReactionNotificationSourceClass + // Source of story reactions for which notifications are shown + StoryReactionSource ReactionNotificationSourceClass + // Identifier of the notification sound to be played; 0 if sound is disabled + SoundID int64 + // True, if reaction sender and emoji must be displayed in notifications + ShowPreview bool +} + +// ReactionNotificationSettingsTypeID is TL type id of ReactionNotificationSettings. +const ReactionNotificationSettingsTypeID = 0x2bb0f654 + +// Ensuring interfaces in compile-time for ReactionNotificationSettings. +var ( + _ bin.Encoder = &ReactionNotificationSettings{} + _ bin.Decoder = &ReactionNotificationSettings{} + _ bin.BareEncoder = &ReactionNotificationSettings{} + _ bin.BareDecoder = &ReactionNotificationSettings{} +) + +func (r *ReactionNotificationSettings) Zero() bool { + if r == nil { + return true + } + if !(r.MessageReactionSource == nil) { + return false + } + if !(r.StoryReactionSource == nil) { + return false + } + if !(r.SoundID == 0) { + return false + } + if !(r.ShowPreview == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (r *ReactionNotificationSettings) String() string { + if r == nil { + return "ReactionNotificationSettings(nil)" + } + type Alias ReactionNotificationSettings + return fmt.Sprintf("ReactionNotificationSettings%+v", Alias(*r)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ReactionNotificationSettings) TypeID() uint32 { + return ReactionNotificationSettingsTypeID +} + +// TypeName returns name of type in TL schema. +func (*ReactionNotificationSettings) TypeName() string { + return "reactionNotificationSettings" +} + +// TypeInfo returns info about TL type. +func (r *ReactionNotificationSettings) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "reactionNotificationSettings", + ID: ReactionNotificationSettingsTypeID, + } + if r == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "MessageReactionSource", + SchemaName: "message_reaction_source", + }, + { + Name: "StoryReactionSource", + SchemaName: "story_reaction_source", + }, + { + Name: "SoundID", + SchemaName: "sound_id", + }, + { + Name: "ShowPreview", + SchemaName: "show_preview", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (r *ReactionNotificationSettings) Encode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reactionNotificationSettings#2bb0f654 as nil") + } + b.PutID(ReactionNotificationSettingsTypeID) + return r.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (r *ReactionNotificationSettings) EncodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reactionNotificationSettings#2bb0f654 as nil") + } + if r.MessageReactionSource == nil { + return fmt.Errorf("unable to encode reactionNotificationSettings#2bb0f654: field message_reaction_source is nil") + } + if err := r.MessageReactionSource.Encode(b); err != nil { + return fmt.Errorf("unable to encode reactionNotificationSettings#2bb0f654: field message_reaction_source: %w", err) + } + if r.StoryReactionSource == nil { + return fmt.Errorf("unable to encode reactionNotificationSettings#2bb0f654: field story_reaction_source is nil") + } + if err := r.StoryReactionSource.Encode(b); err != nil { + return fmt.Errorf("unable to encode reactionNotificationSettings#2bb0f654: field story_reaction_source: %w", err) + } + b.PutLong(r.SoundID) + b.PutBool(r.ShowPreview) + return nil +} + +// Decode implements bin.Decoder. +func (r *ReactionNotificationSettings) Decode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reactionNotificationSettings#2bb0f654 to nil") + } + if err := b.ConsumeID(ReactionNotificationSettingsTypeID); err != nil { + return fmt.Errorf("unable to decode reactionNotificationSettings#2bb0f654: %w", err) + } + return r.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (r *ReactionNotificationSettings) DecodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reactionNotificationSettings#2bb0f654 to nil") + } + { + value, err := DecodeReactionNotificationSource(b) + if err != nil { + return fmt.Errorf("unable to decode reactionNotificationSettings#2bb0f654: field message_reaction_source: %w", err) + } + r.MessageReactionSource = value + } + { + value, err := DecodeReactionNotificationSource(b) + if err != nil { + return fmt.Errorf("unable to decode reactionNotificationSettings#2bb0f654: field story_reaction_source: %w", err) + } + r.StoryReactionSource = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode reactionNotificationSettings#2bb0f654: field sound_id: %w", err) + } + r.SoundID = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode reactionNotificationSettings#2bb0f654: field show_preview: %w", err) + } + r.ShowPreview = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (r *ReactionNotificationSettings) EncodeTDLibJSON(b tdjson.Encoder) error { + if r == nil { + return fmt.Errorf("can't encode reactionNotificationSettings#2bb0f654 as nil") + } + b.ObjStart() + b.PutID("reactionNotificationSettings") + b.Comma() + b.FieldStart("message_reaction_source") + if r.MessageReactionSource == nil { + return fmt.Errorf("unable to encode reactionNotificationSettings#2bb0f654: field message_reaction_source is nil") + } + if err := r.MessageReactionSource.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode reactionNotificationSettings#2bb0f654: field message_reaction_source: %w", err) + } + b.Comma() + b.FieldStart("story_reaction_source") + if r.StoryReactionSource == nil { + return fmt.Errorf("unable to encode reactionNotificationSettings#2bb0f654: field story_reaction_source is nil") + } + if err := r.StoryReactionSource.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode reactionNotificationSettings#2bb0f654: field story_reaction_source: %w", err) + } + b.Comma() + b.FieldStart("sound_id") + b.PutLong(r.SoundID) + b.Comma() + b.FieldStart("show_preview") + b.PutBool(r.ShowPreview) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (r *ReactionNotificationSettings) DecodeTDLibJSON(b tdjson.Decoder) error { + if r == nil { + return fmt.Errorf("can't decode reactionNotificationSettings#2bb0f654 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("reactionNotificationSettings"); err != nil { + return fmt.Errorf("unable to decode reactionNotificationSettings#2bb0f654: %w", err) + } + case "message_reaction_source": + value, err := DecodeTDLibJSONReactionNotificationSource(b) + if err != nil { + return fmt.Errorf("unable to decode reactionNotificationSettings#2bb0f654: field message_reaction_source: %w", err) + } + r.MessageReactionSource = value + case "story_reaction_source": + value, err := DecodeTDLibJSONReactionNotificationSource(b) + if err != nil { + return fmt.Errorf("unable to decode reactionNotificationSettings#2bb0f654: field story_reaction_source: %w", err) + } + r.StoryReactionSource = value + case "sound_id": + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode reactionNotificationSettings#2bb0f654: field sound_id: %w", err) + } + r.SoundID = value + case "show_preview": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode reactionNotificationSettings#2bb0f654: field show_preview: %w", err) + } + r.ShowPreview = value + default: + return b.Skip() + } + return nil + }) +} + +// GetMessageReactionSource returns value of MessageReactionSource field. +func (r *ReactionNotificationSettings) GetMessageReactionSource() (value ReactionNotificationSourceClass) { + if r == nil { + return + } + return r.MessageReactionSource +} + +// GetStoryReactionSource returns value of StoryReactionSource field. +func (r *ReactionNotificationSettings) GetStoryReactionSource() (value ReactionNotificationSourceClass) { + if r == nil { + return + } + return r.StoryReactionSource +} + +// GetSoundID returns value of SoundID field. +func (r *ReactionNotificationSettings) GetSoundID() (value int64) { + if r == nil { + return + } + return r.SoundID +} + +// GetShowPreview returns value of ShowPreview field. +func (r *ReactionNotificationSettings) GetShowPreview() (value bool) { + if r == nil { + return + } + return r.ShowPreview +} diff --git a/tdapi/tl_reaction_notification_source_gen.go b/tdapi/tl_reaction_notification_source_gen.go new file mode 100644 index 0000000000..b91503c9e9 --- /dev/null +++ b/tdapi/tl_reaction_notification_source_gen.go @@ -0,0 +1,577 @@ +// 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{} +) + +// ReactionNotificationSourceNone represents TL type `reactionNotificationSourceNone#15d6701c`. +type ReactionNotificationSourceNone struct { +} + +// ReactionNotificationSourceNoneTypeID is TL type id of ReactionNotificationSourceNone. +const ReactionNotificationSourceNoneTypeID = 0x15d6701c + +// construct implements constructor of ReactionNotificationSourceClass. +func (r ReactionNotificationSourceNone) construct() ReactionNotificationSourceClass { return &r } + +// Ensuring interfaces in compile-time for ReactionNotificationSourceNone. +var ( + _ bin.Encoder = &ReactionNotificationSourceNone{} + _ bin.Decoder = &ReactionNotificationSourceNone{} + _ bin.BareEncoder = &ReactionNotificationSourceNone{} + _ bin.BareDecoder = &ReactionNotificationSourceNone{} + + _ ReactionNotificationSourceClass = &ReactionNotificationSourceNone{} +) + +func (r *ReactionNotificationSourceNone) Zero() bool { + if r == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (r *ReactionNotificationSourceNone) String() string { + if r == nil { + return "ReactionNotificationSourceNone(nil)" + } + type Alias ReactionNotificationSourceNone + return fmt.Sprintf("ReactionNotificationSourceNone%+v", Alias(*r)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ReactionNotificationSourceNone) TypeID() uint32 { + return ReactionNotificationSourceNoneTypeID +} + +// TypeName returns name of type in TL schema. +func (*ReactionNotificationSourceNone) TypeName() string { + return "reactionNotificationSourceNone" +} + +// TypeInfo returns info about TL type. +func (r *ReactionNotificationSourceNone) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "reactionNotificationSourceNone", + ID: ReactionNotificationSourceNoneTypeID, + } + if r == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (r *ReactionNotificationSourceNone) Encode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reactionNotificationSourceNone#15d6701c as nil") + } + b.PutID(ReactionNotificationSourceNoneTypeID) + return r.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (r *ReactionNotificationSourceNone) EncodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reactionNotificationSourceNone#15d6701c as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (r *ReactionNotificationSourceNone) Decode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reactionNotificationSourceNone#15d6701c to nil") + } + if err := b.ConsumeID(ReactionNotificationSourceNoneTypeID); err != nil { + return fmt.Errorf("unable to decode reactionNotificationSourceNone#15d6701c: %w", err) + } + return r.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (r *ReactionNotificationSourceNone) DecodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reactionNotificationSourceNone#15d6701c to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (r *ReactionNotificationSourceNone) EncodeTDLibJSON(b tdjson.Encoder) error { + if r == nil { + return fmt.Errorf("can't encode reactionNotificationSourceNone#15d6701c as nil") + } + b.ObjStart() + b.PutID("reactionNotificationSourceNone") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (r *ReactionNotificationSourceNone) DecodeTDLibJSON(b tdjson.Decoder) error { + if r == nil { + return fmt.Errorf("can't decode reactionNotificationSourceNone#15d6701c to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("reactionNotificationSourceNone"); err != nil { + return fmt.Errorf("unable to decode reactionNotificationSourceNone#15d6701c: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// ReactionNotificationSourceContacts represents TL type `reactionNotificationSourceContacts#211c4835`. +type ReactionNotificationSourceContacts struct { +} + +// ReactionNotificationSourceContactsTypeID is TL type id of ReactionNotificationSourceContacts. +const ReactionNotificationSourceContactsTypeID = 0x211c4835 + +// construct implements constructor of ReactionNotificationSourceClass. +func (r ReactionNotificationSourceContacts) construct() ReactionNotificationSourceClass { return &r } + +// Ensuring interfaces in compile-time for ReactionNotificationSourceContacts. +var ( + _ bin.Encoder = &ReactionNotificationSourceContacts{} + _ bin.Decoder = &ReactionNotificationSourceContacts{} + _ bin.BareEncoder = &ReactionNotificationSourceContacts{} + _ bin.BareDecoder = &ReactionNotificationSourceContacts{} + + _ ReactionNotificationSourceClass = &ReactionNotificationSourceContacts{} +) + +func (r *ReactionNotificationSourceContacts) Zero() bool { + if r == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (r *ReactionNotificationSourceContacts) String() string { + if r == nil { + return "ReactionNotificationSourceContacts(nil)" + } + type Alias ReactionNotificationSourceContacts + return fmt.Sprintf("ReactionNotificationSourceContacts%+v", Alias(*r)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ReactionNotificationSourceContacts) TypeID() uint32 { + return ReactionNotificationSourceContactsTypeID +} + +// TypeName returns name of type in TL schema. +func (*ReactionNotificationSourceContacts) TypeName() string { + return "reactionNotificationSourceContacts" +} + +// TypeInfo returns info about TL type. +func (r *ReactionNotificationSourceContacts) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "reactionNotificationSourceContacts", + ID: ReactionNotificationSourceContactsTypeID, + } + if r == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (r *ReactionNotificationSourceContacts) Encode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reactionNotificationSourceContacts#211c4835 as nil") + } + b.PutID(ReactionNotificationSourceContactsTypeID) + return r.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (r *ReactionNotificationSourceContacts) EncodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reactionNotificationSourceContacts#211c4835 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (r *ReactionNotificationSourceContacts) Decode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reactionNotificationSourceContacts#211c4835 to nil") + } + if err := b.ConsumeID(ReactionNotificationSourceContactsTypeID); err != nil { + return fmt.Errorf("unable to decode reactionNotificationSourceContacts#211c4835: %w", err) + } + return r.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (r *ReactionNotificationSourceContacts) DecodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reactionNotificationSourceContacts#211c4835 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (r *ReactionNotificationSourceContacts) EncodeTDLibJSON(b tdjson.Encoder) error { + if r == nil { + return fmt.Errorf("can't encode reactionNotificationSourceContacts#211c4835 as nil") + } + b.ObjStart() + b.PutID("reactionNotificationSourceContacts") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (r *ReactionNotificationSourceContacts) DecodeTDLibJSON(b tdjson.Decoder) error { + if r == nil { + return fmt.Errorf("can't decode reactionNotificationSourceContacts#211c4835 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("reactionNotificationSourceContacts"); err != nil { + return fmt.Errorf("unable to decode reactionNotificationSourceContacts#211c4835: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// ReactionNotificationSourceAll represents TL type `reactionNotificationSourceAll#4a02ac92`. +type ReactionNotificationSourceAll struct { +} + +// ReactionNotificationSourceAllTypeID is TL type id of ReactionNotificationSourceAll. +const ReactionNotificationSourceAllTypeID = 0x4a02ac92 + +// construct implements constructor of ReactionNotificationSourceClass. +func (r ReactionNotificationSourceAll) construct() ReactionNotificationSourceClass { return &r } + +// Ensuring interfaces in compile-time for ReactionNotificationSourceAll. +var ( + _ bin.Encoder = &ReactionNotificationSourceAll{} + _ bin.Decoder = &ReactionNotificationSourceAll{} + _ bin.BareEncoder = &ReactionNotificationSourceAll{} + _ bin.BareDecoder = &ReactionNotificationSourceAll{} + + _ ReactionNotificationSourceClass = &ReactionNotificationSourceAll{} +) + +func (r *ReactionNotificationSourceAll) Zero() bool { + if r == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (r *ReactionNotificationSourceAll) String() string { + if r == nil { + return "ReactionNotificationSourceAll(nil)" + } + type Alias ReactionNotificationSourceAll + return fmt.Sprintf("ReactionNotificationSourceAll%+v", Alias(*r)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ReactionNotificationSourceAll) TypeID() uint32 { + return ReactionNotificationSourceAllTypeID +} + +// TypeName returns name of type in TL schema. +func (*ReactionNotificationSourceAll) TypeName() string { + return "reactionNotificationSourceAll" +} + +// TypeInfo returns info about TL type. +func (r *ReactionNotificationSourceAll) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "reactionNotificationSourceAll", + ID: ReactionNotificationSourceAllTypeID, + } + if r == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (r *ReactionNotificationSourceAll) Encode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reactionNotificationSourceAll#4a02ac92 as nil") + } + b.PutID(ReactionNotificationSourceAllTypeID) + return r.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (r *ReactionNotificationSourceAll) EncodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reactionNotificationSourceAll#4a02ac92 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (r *ReactionNotificationSourceAll) Decode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reactionNotificationSourceAll#4a02ac92 to nil") + } + if err := b.ConsumeID(ReactionNotificationSourceAllTypeID); err != nil { + return fmt.Errorf("unable to decode reactionNotificationSourceAll#4a02ac92: %w", err) + } + return r.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (r *ReactionNotificationSourceAll) DecodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reactionNotificationSourceAll#4a02ac92 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (r *ReactionNotificationSourceAll) EncodeTDLibJSON(b tdjson.Encoder) error { + if r == nil { + return fmt.Errorf("can't encode reactionNotificationSourceAll#4a02ac92 as nil") + } + b.ObjStart() + b.PutID("reactionNotificationSourceAll") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (r *ReactionNotificationSourceAll) DecodeTDLibJSON(b tdjson.Decoder) error { + if r == nil { + return fmt.Errorf("can't decode reactionNotificationSourceAll#4a02ac92 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("reactionNotificationSourceAll"); err != nil { + return fmt.Errorf("unable to decode reactionNotificationSourceAll#4a02ac92: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// ReactionNotificationSourceClassName is schema name of ReactionNotificationSourceClass. +const ReactionNotificationSourceClassName = "ReactionNotificationSource" + +// ReactionNotificationSourceClass represents ReactionNotificationSource generic type. +// +// Example: +// +// g, err := tdapi.DecodeReactionNotificationSource(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tdapi.ReactionNotificationSourceNone: // reactionNotificationSourceNone#15d6701c +// case *tdapi.ReactionNotificationSourceContacts: // reactionNotificationSourceContacts#211c4835 +// case *tdapi.ReactionNotificationSourceAll: // reactionNotificationSourceAll#4a02ac92 +// default: panic(v) +// } +type ReactionNotificationSourceClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() ReactionNotificationSourceClass + + // 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 +} + +// DecodeReactionNotificationSource implements binary de-serialization for ReactionNotificationSourceClass. +func DecodeReactionNotificationSource(buf *bin.Buffer) (ReactionNotificationSourceClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case ReactionNotificationSourceNoneTypeID: + // Decoding reactionNotificationSourceNone#15d6701c. + v := ReactionNotificationSourceNone{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ReactionNotificationSourceClass: %w", err) + } + return &v, nil + case ReactionNotificationSourceContactsTypeID: + // Decoding reactionNotificationSourceContacts#211c4835. + v := ReactionNotificationSourceContacts{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ReactionNotificationSourceClass: %w", err) + } + return &v, nil + case ReactionNotificationSourceAllTypeID: + // Decoding reactionNotificationSourceAll#4a02ac92. + v := ReactionNotificationSourceAll{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ReactionNotificationSourceClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode ReactionNotificationSourceClass: %w", bin.NewUnexpectedID(id)) + } +} + +// DecodeTDLibJSONReactionNotificationSource implements binary de-serialization for ReactionNotificationSourceClass. +func DecodeTDLibJSONReactionNotificationSource(buf tdjson.Decoder) (ReactionNotificationSourceClass, error) { + id, err := buf.FindTypeID() + if err != nil { + return nil, err + } + switch id { + case "reactionNotificationSourceNone": + // Decoding reactionNotificationSourceNone#15d6701c. + v := ReactionNotificationSourceNone{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode ReactionNotificationSourceClass: %w", err) + } + return &v, nil + case "reactionNotificationSourceContacts": + // Decoding reactionNotificationSourceContacts#211c4835. + v := ReactionNotificationSourceContacts{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode ReactionNotificationSourceClass: %w", err) + } + return &v, nil + case "reactionNotificationSourceAll": + // Decoding reactionNotificationSourceAll#4a02ac92. + v := ReactionNotificationSourceAll{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode ReactionNotificationSourceClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode ReactionNotificationSourceClass: %w", tdjson.NewUnexpectedID(id)) + } +} + +// ReactionNotificationSource boxes the ReactionNotificationSourceClass providing a helper. +type ReactionNotificationSourceBox struct { + ReactionNotificationSource ReactionNotificationSourceClass +} + +// Decode implements bin.Decoder for ReactionNotificationSourceBox. +func (b *ReactionNotificationSourceBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode ReactionNotificationSourceBox to nil") + } + v, err := DecodeReactionNotificationSource(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.ReactionNotificationSource = v + return nil +} + +// Encode implements bin.Encode for ReactionNotificationSourceBox. +func (b *ReactionNotificationSourceBox) Encode(buf *bin.Buffer) error { + if b == nil || b.ReactionNotificationSource == nil { + return fmt.Errorf("unable to encode ReactionNotificationSourceClass as nil") + } + return b.ReactionNotificationSource.Encode(buf) +} + +// DecodeTDLibJSON implements bin.Decoder for ReactionNotificationSourceBox. +func (b *ReactionNotificationSourceBox) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("unable to decode ReactionNotificationSourceBox to nil") + } + v, err := DecodeTDLibJSONReactionNotificationSource(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.ReactionNotificationSource = v + return nil +} + +// EncodeTDLibJSON implements bin.Encode for ReactionNotificationSourceBox. +func (b *ReactionNotificationSourceBox) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil || b.ReactionNotificationSource == nil { + return fmt.Errorf("unable to encode ReactionNotificationSourceClass as nil") + } + return b.ReactionNotificationSource.EncodeTDLibJSON(buf) +} diff --git a/tdapi/tl_registry_gen.go b/tdapi/tl_registry_gen.go index f32ddf85f3..6fcef0bceb 100644 --- a/tdapi/tl_registry_gen.go +++ b/tdapi/tl_registry_gen.go @@ -46,6 +46,8 @@ func TypesMap() map[uint32]string { OkTypeID: "ok#d4edbe69", AuthenticationCodeTypeTelegramMessageTypeID: "authenticationCodeTypeTelegramMessage#7bf49b2a", AuthenticationCodeTypeSMSTypeID: "authenticationCodeTypeSms#3960e288", + AuthenticationCodeTypeSMSWordTypeID: "authenticationCodeTypeSmsWord#a6063c63", + AuthenticationCodeTypeSMSPhraseTypeID: "authenticationCodeTypeSmsPhrase#2ebc8cd1", AuthenticationCodeTypeCallTypeID: "authenticationCodeTypeCall#61876c67", AuthenticationCodeTypeFlashCallTypeID: "authenticationCodeTypeFlashCall#533379a2", AuthenticationCodeTypeMissedCallTypeID: "authenticationCodeTypeMissedCall#29bb0a87", @@ -110,7 +112,7 @@ func TypesMap() map[uint32]string { StickerFullTypeMaskTypeID: "stickerFullTypeMask#26dfbf37", StickerFullTypeCustomEmojiTypeID: "stickerFullTypeCustomEmoji#c37f05ab", ClosedVectorPathTypeID: "closedVectorPath#2f9276b9", - PollOptionTypeID: "pollOption#57d9d5a5", + PollOptionTypeID: "pollOption#63e97090", PollTypeRegularTypeID: "pollTypeRegular#2638f022", PollTypeQuizTypeID: "pollTypeQuiz#27293c99", AnimationTypeID: "animation#cc00db3e", @@ -127,7 +129,7 @@ func TypesMap() map[uint32]string { VenueTypeID: "venue#3fcd1af9", GameTypeID: "game#a2aedfc8", WebAppTypeID: "webApp#605ba8f3", - PollTypeID: "poll#8c34a82a", + PollTypeID: "poll#71d4870c", BackgroundTypeID: "background#e65f291c", BackgroundsTypeID: "backgrounds#b4671319", ChatBackgroundTypeID: "chatBackground#62891968", @@ -155,7 +157,7 @@ func TypesMap() map[uint32]string { InputBusinessStartPageTypeID: "inputBusinessStartPage#ec7c87e0", BusinessOpeningHoursIntervalTypeID: "businessOpeningHoursInterval#bdf05654", BusinessOpeningHoursTypeID: "businessOpeningHours#a623e64a", - BusinessInfoTypeID: "businessInfo#4212a956", + BusinessInfoTypeID: "businessInfo#5520498e", BusinessChatLinkTypeID: "businessChatLink#8e998b83", BusinessChatLinksTypeID: "businessChatLinks#1569924", InputBusinessChatLinkTypeID: "inputBusinessChatLink#e2d6df8", @@ -192,7 +194,7 @@ func TypesMap() map[uint32]string { UsernamesTypeID: "usernames#bf343063", UserTypeID: "user#18552c62", BotInfoTypeID: "botInfo#bfdb89a", - UserFullInfoTypeID: "userFullInfo#809a3ac2", + UserFullInfoTypeID: "userFullInfo#b61c9c5", UsersTypeID: "users#9d955a12", ChatAdministratorTypeID: "chatAdministrator#7277bd2c", ChatAdministratorsTypeID: "chatAdministrators#5141ca21", @@ -294,13 +296,8 @@ func TypesMap() map[uint32]string { MessageSourceNotificationTypeID: "messageSourceNotification#c1a11bed", MessageSourceScreenshotTypeID: "messageSourceScreenshot#1c035d0a", MessageSourceOtherTypeID: "messageSourceOther#35c0a702", - MessageSponsorTypeBotTypeID: "messageSponsorTypeBot#700d2304", - MessageSponsorTypeWebAppTypeID: "messageSponsorTypeWebApp#25b74fb8", - MessageSponsorTypePublicChannelTypeID: "messageSponsorTypePublicChannel#ed645a47", - MessageSponsorTypePrivateChannelTypeID: "messageSponsorTypePrivateChannel#74d245a8", - MessageSponsorTypeWebsiteTypeID: "messageSponsorTypeWebsite#a4e45f9b", - MessageSponsorTypeID: "messageSponsor#a0b25071", - SponsoredMessageTypeID: "sponsoredMessage#3748e46f", + MessageSponsorTypeID: "messageSponsor#77c251de", + SponsoredMessageTypeID: "sponsoredMessage#b78d4c25", SponsoredMessagesTypeID: "sponsoredMessages#e402a0f", ReportChatSponsoredMessageOptionTypeID: "reportChatSponsoredMessageOption#aabd054a", ReportChatSponsoredMessageResultOkTypeID: "reportChatSponsoredMessageResultOk#754f721f", @@ -316,6 +313,10 @@ func TypesMap() map[uint32]string { NotificationSettingsScopeChannelChatsTypeID: "notificationSettingsScopeChannelChats#20aa0588", ChatNotificationSettingsTypeID: "chatNotificationSettings#dddc12cf", ScopeNotificationSettingsTypeID: "scopeNotificationSettings#dc4a615f", + ReactionNotificationSourceNoneTypeID: "reactionNotificationSourceNone#15d6701c", + ReactionNotificationSourceContactsTypeID: "reactionNotificationSourceContacts#211c4835", + ReactionNotificationSourceAllTypeID: "reactionNotificationSourceAll#4a02ac92", + ReactionNotificationSettingsTypeID: "reactionNotificationSettings#2bb0f654", DraftMessageTypeID: "draftMessage#f67c6a5c", ChatTypePrivateTypeID: "chatTypePrivate#5e1e6374", ChatTypeBasicGroupTypeID: "chatTypeBasicGroup#3a0c4c5c", @@ -337,8 +338,8 @@ func TypesMap() map[uint32]string { ChatSourceMtprotoProxyTypeID: "chatSourceMtprotoProxy#177d1803", ChatSourcePublicServiceAnnouncementTypeID: "chatSourcePublicServiceAnnouncement#ec6a6694", ChatPositionTypeID: "chatPosition#dae48755", - ChatAvailableReactionsAllTypeID: "chatAvailableReactionsAll#dff07c4e", - ChatAvailableReactionsSomeTypeID: "chatAvailableReactionsSome#d3cc0a6b", + ChatAvailableReactionsAllTypeID: "chatAvailableReactionsAll#29600b97", + ChatAvailableReactionsSomeTypeID: "chatAvailableReactionsSome#36b46b7d", SavedMessagesTagTypeID: "savedMessagesTag#6a67bc61", SavedMessagesTagsTypeID: "savedMessagesTags#ca94a1b3", BusinessBotManageBarTypeID: "businessBotManageBar#ed706a82", @@ -454,7 +455,7 @@ func TypesMap() map[uint32]string { PageBlockRelatedArticlesTypeID: "pageBlockRelatedArticles#936d81e6", PageBlockMapTypeID: "pageBlockMap#5a0f7013", WebPageInstantViewTypeID: "webPageInstantView#2c0ec99c", - WebPageTypeID: "webPage#dafbc3a4", + WebPageTypeID: "webPage#23088efb", CountryInfoTypeID: "countryInfo#d9936dff", CountriesTypeID: "countries#94b50e0f", PhoneNumberInfoTypeID: "phoneNumberInfo#d2c398a1", @@ -675,7 +676,7 @@ func TypesMap() map[uint32]string { InputMessageDiceTypeID: "inputMessageDice#322967a9", InputMessageGameTypeID: "inputMessageGame#4aae6ae2", InputMessageInvoiceTypeID: "inputMessageInvoice#34cd1d60", - InputMessagePollTypeID: "inputMessagePoll#fe79770", + InputMessagePollTypeID: "inputMessagePoll#9046c716", InputMessageStoryTypeID: "inputMessageStory#21099d63", InputMessageForwardedTypeID: "inputMessageForwarded#651a73f8", SearchMessagesFilterEmptyTypeID: "searchMessagesFilterEmpty#cc2e1337", @@ -724,9 +725,12 @@ func TypesMap() map[uint32]string { StickerSetInfoTypeID: "stickerSetInfo#3cd2cd82", StickerSetsTypeID: "stickerSets#b8a6490d", TrendingStickerSetsTypeID: "trendingStickerSets#298f12cc", - EmojiCategoryTypeID: "emojiCategory#c6e9e5a4", + EmojiCategorySourceSearchTypeID: "emojiCategorySourceSearch#5e126d32", + EmojiCategorySourcePremiumTypeID: "emojiCategorySourcePremium#8cd28d0c", + EmojiCategoryTypeID: "emojiCategory#220de4ef", EmojiCategoriesTypeID: "emojiCategories#c680f27a", EmojiCategoryTypeDefaultTypeID: "emojiCategoryTypeDefault#46db626b", + EmojiCategoryTypeRegularStickersTypeID: "emojiCategoryTypeRegularStickers#b04799d2", EmojiCategoryTypeEmojiStatusTypeID: "emojiCategoryTypeEmojiStatus#5254b347", EmojiCategoryTypeChatPhotoTypeID: "emojiCategoryTypeChatPhoto#3f200529", StoryAreaPositionTypeID: "storyAreaPosition#6389679", @@ -754,8 +758,8 @@ func TypesMap() map[uint32]string { StoryOriginHiddenUserTypeID: "storyOriginHiddenUser#5a1f89ec", StoryRepostInfoTypeID: "storyRepostInfo#ff7fa440", StoryInteractionInfoTypeID: "storyInteractionInfo#e1557fc7", - StoryTypeID: "story#27f4e5b1", - StoriesTypeID: "stories#5a860711", + StoryTypeID: "story#84cdc9d1", + StoriesTypeID: "stories#b88ff8ff", StoryFullIDTypeID: "storyFullId#701d31f5", StoryInfoTypeID: "storyInfo#8997c352", ChatActiveStoriesTypeID: "chatActiveStories#d923d773", @@ -821,7 +825,7 @@ func TypesMap() map[uint32]string { CallTypeID: "call#36db9764", FirebaseAuthenticationSettingsAndroidTypeID: "firebaseAuthenticationSettingsAndroid#966ef61c", FirebaseAuthenticationSettingsIosTypeID: "firebaseAuthenticationSettingsIos#d49a4c4", - PhoneNumberAuthenticationSettingsTypeID: "phoneNumberAuthenticationSettings#c6e19fa1", + PhoneNumberAuthenticationSettingsTypeID: "phoneNumberAuthenticationSettings#3e1183db", AddedReactionTypeID: "addedReaction#4b04819d", AddedReactionsTypeID: "addedReactions#77bf7590", AvailableReactionTypeID: "availableReaction#f9024387", @@ -1318,6 +1322,7 @@ func TypesMap() map[uint32]string { SuggestedActionSubscribeToAnnualPremiumTypeID: "suggestedActionSubscribeToAnnualPremium#164978bb", SuggestedActionGiftPremiumForChristmasTypeID: "suggestedActionGiftPremiumForChristmas#93b3ee6f", SuggestedActionSetBirthdateTypeID: "suggestedActionSetBirthdate#eabd9b02", + SuggestedActionExtendPremiumTypeID: "suggestedActionExtendPremium#de405cca", CountTypeID: "count#4d38f104", TextTypeID: "text#22765898", SecondsTypeID: "seconds#3936e58e", @@ -1344,7 +1349,8 @@ func TypesMap() map[uint32]string { ChatStatisticsInviterInfoTypeID: "chatStatisticsInviterInfo#2583d48b", ChatStatisticsSupergroupTypeID: "chatStatisticsSupergroup#c67549ef", ChatStatisticsChannelTypeID: "chatStatisticsChannel#b8e95b4", - ChatRevenueStatisticsTypeID: "chatRevenueStatistics#a5504cd4", + ChatRevenueAmountTypeID: "chatRevenueAmount#4f3bb29f", + ChatRevenueStatisticsTypeID: "chatRevenueStatistics#636318bb", MessageStatisticsTypeID: "messageStatistics#a2ce4f07", StoryStatisticsTypeID: "storyStatistics#46448b6b", ChatRevenueWithdrawalStatePendingTypeID: "chatRevenueWithdrawalStatePending#5f5cb5b3", @@ -1424,6 +1430,7 @@ func TypesMap() map[uint32]string { UpdateQuickReplyShortcutMessagesTypeID: "updateQuickReplyShortcutMessages#8bb36b72", UpdateForumTopicInfoTypeID: "updateForumTopicInfo#6b6f2cc9", UpdateScopeNotificationSettingsTypeID: "updateScopeNotificationSettings#b83ccb73", + UpdateReactionNotificationSettingsTypeID: "updateReactionNotificationSettings#e54d17ec", UpdateNotificationTypeID: "updateNotification#8ee67ed4", UpdateNotificationGroupTypeID: "updateNotificationGroup#96cd9e06", UpdateActiveNotificationsTypeID: "updateActiveNotifications#317d80f2", @@ -1482,6 +1489,7 @@ func TypesMap() map[uint32]string { UpdateActiveEmojiReactionsTypeID: "updateActiveEmojiReactions#691ffcb7", UpdateDefaultReactionTypeTypeID: "updateDefaultReactionType#4b615105", UpdateSavedMessagesTagsTypeID: "updateSavedMessagesTags#7386424a", + UpdateChatRevenueAmountTypeID: "updateChatRevenueAmount#32f4a5e1", UpdateSpeechRecognitionTrialTypeID: "updateSpeechRecognitionTrial#ff4efcc1", UpdateDiceEmojisTypeID: "updateDiceEmojis#9d0f91df", UpdateAnimatedEmojiMessageClickedTypeID: "updateAnimatedEmojiMessageClicked#a3167405", @@ -1504,7 +1512,7 @@ func TypesMap() map[uint32]string { UpdateNewCustomQueryTypeID: "updateNewCustomQuery#d702f9a6", UpdatePollTypeID: "updatePoll#966b73ca", UpdatePollAnswerTypeID: "updatePollAnswer#b67ac547", - UpdateChatMemberTypeID: "updateChatMember#6000e29c", + UpdateChatMemberTypeID: "updateChatMember#98865bc7", UpdateNewChatJoinRequestTypeID: "updateNewChatJoinRequest#7e48b843", UpdateChatBoostTypeID: "updateChatBoost#50727e24", UpdateMessageReactionTypeID: "updateMessageReaction#f46c854a", @@ -1538,6 +1546,7 @@ func TypesMap() map[uint32]string { CheckAuthenticationPasswordRecoveryCodeRequestTypeID: "checkAuthenticationPasswordRecoveryCode#dc0a3be5", RecoverAuthenticationPasswordRequestTypeID: "recoverAuthenticationPassword#f8311523", SendAuthenticationFirebaseSMSRequestTypeID: "sendAuthenticationFirebaseSms#15c15e3f", + ReportAuthenticationCodeMissingRequestTypeID: "reportAuthenticationCodeMissing#91efce48", CheckAuthenticationBotTokenRequestTypeID: "checkAuthenticationBotToken#261b4476", LogOutRequestTypeID: "logOut#a1b5c41b", CloseRequestTypeID: "close#b933e17f", @@ -1589,6 +1598,7 @@ func TypesMap() map[uint32]string { SearchChatsRequestTypeID: "searchChats#8ff4b9cc", SearchChatsOnServerRequestTypeID: "searchChatsOnServer#baf42f74", SearchChatsNearbyRequestTypeID: "searchChatsNearby#f445c81f", + GetRecommendedChatsRequestTypeID: "getRecommendedChats#d9438d71", GetChatSimilarChatsRequestTypeID: "getChatSimilarChats#bb508f83", GetChatSimilarChatCountRequestTypeID: "getChatSimilarChatCount#463e968e", OpenChatSimilarChatRequestTypeID: "openChatSimilarChat#8fa6f413", @@ -1618,7 +1628,7 @@ func TypesMap() map[uint32]string { DeleteChatHistoryRequestTypeID: "deleteChatHistory#a841d09f", DeleteChatRequestTypeID: "deleteChat#f5cae05e", SearchChatMessagesRequestTypeID: "searchChatMessages#dfdeb5c6", - SearchMessagesRequestTypeID: "searchMessages#2a8f08a7", + SearchMessagesRequestTypeID: "searchMessages#31f9c3c9", SearchSecretMessagesRequestTypeID: "searchSecretMessages#cd2a4c9c", SearchSavedMessagesRequestTypeID: "searchSavedMessages#8a9b9f96", SearchCallMessagesRequestTypeID: "searchCallMessages#8c3bef1b", @@ -1658,12 +1668,12 @@ func TypesMap() map[uint32]string { DeleteChatMessagesBySenderRequestTypeID: "deleteChatMessagesBySender#ba9b2e67", DeleteChatMessagesByDateRequestTypeID: "deleteChatMessagesByDate#9e44e0bf", EditMessageTextRequestTypeID: "editMessageText#bb2e1b7", - EditMessageLiveLocationRequestTypeID: "editMessageLiveLocation#ff29a512", + EditMessageLiveLocationRequestTypeID: "editMessageLiveLocation#8f511394", EditMessageMediaRequestTypeID: "editMessageMedia#bb4b8713", EditMessageCaptionRequestTypeID: "editMessageCaption#44d2f92e", EditMessageReplyMarkupRequestTypeID: "editMessageReplyMarkup#13cbde89", EditInlineMessageTextRequestTypeID: "editInlineMessageText#cd02c1e5", - EditInlineMessageLiveLocationRequestTypeID: "editInlineMessageLiveLocation#f6a5da00", + EditInlineMessageLiveLocationRequestTypeID: "editInlineMessageLiveLocation#7f37a0ac", EditInlineMessageMediaRequestTypeID: "editInlineMessageMedia#1676781", EditInlineMessageCaptionRequestTypeID: "editInlineMessageCaption#d2a446b7", EditInlineMessageReplyMarkupRequestTypeID: "editInlineMessageReplyMarkup#fbf906de", @@ -1679,6 +1689,7 @@ func TypesMap() map[uint32]string { DeleteQuickReplyShortcutMessagesRequestTypeID: "deleteQuickReplyShortcutMessages#e859fcbb", AddQuickReplyShortcutMessageRequestTypeID: "addQuickReplyShortcutMessage#3f188b2a", AddQuickReplyShortcutInlineQueryResultMessageRequestTypeID: "addQuickReplyShortcutInlineQueryResultMessage#87c02a04", + AddQuickReplyShortcutMessageAlbumRequestTypeID: "addQuickReplyShortcutMessageAlbum#9647a3fd", ReaddQuickReplyShortcutMessagesRequestTypeID: "readdQuickReplyShortcutMessages#652518f7", EditQuickReplyMessageRequestTypeID: "editQuickReplyMessage#4cc978e", GetForumTopicDefaultIconsRequestTypeID: "getForumTopicDefaultIcons#583574dc", @@ -1721,6 +1732,7 @@ func TypesMap() map[uint32]string { GetPollVotersRequestTypeID: "getPollVoters#c45ba9ac", StopPollRequestTypeID: "stopPoll#62e80aad", HideSuggestedActionRequestTypeID: "hideSuggestedAction#a2ef2b7f", + HideContactCloseBirthdaysRequestTypeID: "hideContactCloseBirthdays#baad087b", GetBusinessConnectionRequestTypeID: "getBusinessConnection#81f42420", GetLoginURLInfoRequestTypeID: "getLoginUrlInfo#ccc99db3", GetLoginURLRequestTypeID: "getLoginUrl#2f3295d1", @@ -1835,6 +1847,7 @@ func TypesMap() map[uint32]string { GetChatNotificationSettingsExceptionsRequestTypeID: "getChatNotificationSettingsExceptions#bfe0e11", GetScopeNotificationSettingsRequestTypeID: "getScopeNotificationSettings#c4a8254f", SetScopeNotificationSettingsRequestTypeID: "setScopeNotificationSettings#85cfb63a", + SetReactionNotificationSettingsRequestTypeID: "setReactionNotificationSettings#46b2d495", ResetAllNotificationSettingsRequestTypeID: "resetAllNotificationSettings#f5a0a8f9", ToggleChatIsPinnedRequestTypeID: "toggleChatIsPinned#a776263e", SetPinnedChatsRequestTypeID: "setPinnedChats#c6c6edf1", @@ -1842,17 +1855,18 @@ func TypesMap() map[uint32]string { GetStoryRequestTypeID: "getStory#717b1c78", GetChatsToSendStoriesRequestTypeID: "getChatsToSendStories#22f9e3a4", CanSendStoryRequestTypeID: "canSendStory#b6e0216b", - SendStoryRequestTypeID: "sendStory#736858bb", + SendStoryRequestTypeID: "sendStory#e6ab3302", EditStoryRequestTypeID: "editStory#5e6a21b1", SetStoryPrivacySettingsRequestTypeID: "setStoryPrivacySettings#d8e94332", - ToggleStoryIsPinnedRequestTypeID: "toggleStoryIsPinned#b493b30e", + ToggleStoryIsPostedToChatPageRequestTypeID: "toggleStoryIsPostedToChatPage#ee0f4aff", DeleteStoryRequestTypeID: "deleteStory#9f35af16", GetStoryNotificationSettingsExceptionsRequestTypeID: "getStoryNotificationSettingsExceptions#256a2eb0", LoadActiveStoriesRequestTypeID: "loadActiveStories#7d8cf738", SetChatActiveStoriesListRequestTypeID: "setChatActiveStoriesList#e0e35d11", GetChatActiveStoriesRequestTypeID: "getChatActiveStories#2e4ffbf5", - GetChatPinnedStoriesRequestTypeID: "getChatPinnedStories#53c82a1", + GetChatPostedToChatPageStoriesRequestTypeID: "getChatPostedToChatPageStories#fd3bc72b", GetChatArchivedStoriesRequestTypeID: "getChatArchivedStories#af1e9488", + SetChatPinnedStoriesRequestTypeID: "setChatPinnedStories#f5cb679f", OpenStoryRequestTypeID: "openStory#ceda7c7d", CloseStoryRequestTypeID: "closeStory#443d0f55", GetStoryAvailableReactionsRequestTypeID: "getStoryAvailableReactions#23854d3b", @@ -2024,6 +2038,7 @@ func TypesMap() map[uint32]string { SetPersonalChatRequestTypeID: "setPersonalChat#c04babb4", SetEmojiStatusRequestTypeID: "setEmojiStatus#92f83e5d", SetLocationRequestTypeID: "setLocation#5993371", + ToggleHasSponsoredMessagesEnabledRequestTypeID: "toggleHasSponsoredMessagesEnabled#75055cec", SetBusinessLocationRequestTypeID: "setBusinessLocation#eb740715", SetBusinessOpeningHoursRequestTypeID: "setBusinessOpeningHours#e470a472", SetBusinessGreetingMessageSettingsRequestTypeID: "setBusinessGreetingMessageSettings#cbf53c3d", @@ -2031,6 +2046,7 @@ func TypesMap() map[uint32]string { SetBusinessStartPageRequestTypeID: "setBusinessStartPage#9eed499e", SendPhoneNumberCodeRequestTypeID: "sendPhoneNumberCode#409e3d10", SendPhoneNumberFirebaseSMSRequestTypeID: "sendPhoneNumberFirebaseSms#f9c7084", + ReportPhoneNumberCodeMissingRequestTypeID: "reportPhoneNumberCodeMissing#caa4b553", ResendPhoneNumberCodeRequestTypeID: "resendPhoneNumberCode#2dc1f7c8", CheckPhoneNumberCodeRequestTypeID: "checkPhoneNumberCode#dc0565a1", GetBusinessConnectedBotRequestTypeID: "getBusinessConnectedBot#364da7c3", @@ -2274,6 +2290,8 @@ func NamesMap() map[string]uint32 { "ok": OkTypeID, "authenticationCodeTypeTelegramMessage": AuthenticationCodeTypeTelegramMessageTypeID, "authenticationCodeTypeSms": AuthenticationCodeTypeSMSTypeID, + "authenticationCodeTypeSmsWord": AuthenticationCodeTypeSMSWordTypeID, + "authenticationCodeTypeSmsPhrase": AuthenticationCodeTypeSMSPhraseTypeID, "authenticationCodeTypeCall": AuthenticationCodeTypeCallTypeID, "authenticationCodeTypeFlashCall": AuthenticationCodeTypeFlashCallTypeID, "authenticationCodeTypeMissedCall": AuthenticationCodeTypeMissedCallTypeID, @@ -2522,11 +2540,6 @@ func NamesMap() map[string]uint32 { "messageSourceNotification": MessageSourceNotificationTypeID, "messageSourceScreenshot": MessageSourceScreenshotTypeID, "messageSourceOther": MessageSourceOtherTypeID, - "messageSponsorTypeBot": MessageSponsorTypeBotTypeID, - "messageSponsorTypeWebApp": MessageSponsorTypeWebAppTypeID, - "messageSponsorTypePublicChannel": MessageSponsorTypePublicChannelTypeID, - "messageSponsorTypePrivateChannel": MessageSponsorTypePrivateChannelTypeID, - "messageSponsorTypeWebsite": MessageSponsorTypeWebsiteTypeID, "messageSponsor": MessageSponsorTypeID, "sponsoredMessage": SponsoredMessageTypeID, "sponsoredMessages": SponsoredMessagesTypeID, @@ -2544,6 +2557,10 @@ func NamesMap() map[string]uint32 { "notificationSettingsScopeChannelChats": NotificationSettingsScopeChannelChatsTypeID, "chatNotificationSettings": ChatNotificationSettingsTypeID, "scopeNotificationSettings": ScopeNotificationSettingsTypeID, + "reactionNotificationSourceNone": ReactionNotificationSourceNoneTypeID, + "reactionNotificationSourceContacts": ReactionNotificationSourceContactsTypeID, + "reactionNotificationSourceAll": ReactionNotificationSourceAllTypeID, + "reactionNotificationSettings": ReactionNotificationSettingsTypeID, "draftMessage": DraftMessageTypeID, "chatTypePrivate": ChatTypePrivateTypeID, "chatTypeBasicGroup": ChatTypeBasicGroupTypeID, @@ -2952,9 +2969,12 @@ func NamesMap() map[string]uint32 { "stickerSetInfo": StickerSetInfoTypeID, "stickerSets": StickerSetsTypeID, "trendingStickerSets": TrendingStickerSetsTypeID, + "emojiCategorySourceSearch": EmojiCategorySourceSearchTypeID, + "emojiCategorySourcePremium": EmojiCategorySourcePremiumTypeID, "emojiCategory": EmojiCategoryTypeID, "emojiCategories": EmojiCategoriesTypeID, "emojiCategoryTypeDefault": EmojiCategoryTypeDefaultTypeID, + "emojiCategoryTypeRegularStickers": EmojiCategoryTypeRegularStickersTypeID, "emojiCategoryTypeEmojiStatus": EmojiCategoryTypeEmojiStatusTypeID, "emojiCategoryTypeChatPhoto": EmojiCategoryTypeChatPhotoTypeID, "storyAreaPosition": StoryAreaPositionTypeID, @@ -3546,6 +3566,7 @@ func NamesMap() map[string]uint32 { "suggestedActionSubscribeToAnnualPremium": SuggestedActionSubscribeToAnnualPremiumTypeID, "suggestedActionGiftPremiumForChristmas": SuggestedActionGiftPremiumForChristmasTypeID, "suggestedActionSetBirthdate": SuggestedActionSetBirthdateTypeID, + "suggestedActionExtendPremium": SuggestedActionExtendPremiumTypeID, "count": CountTypeID, "text": TextTypeID, "seconds": SecondsTypeID, @@ -3572,6 +3593,7 @@ func NamesMap() map[string]uint32 { "chatStatisticsInviterInfo": ChatStatisticsInviterInfoTypeID, "chatStatisticsSupergroup": ChatStatisticsSupergroupTypeID, "chatStatisticsChannel": ChatStatisticsChannelTypeID, + "chatRevenueAmount": ChatRevenueAmountTypeID, "chatRevenueStatistics": ChatRevenueStatisticsTypeID, "messageStatistics": MessageStatisticsTypeID, "storyStatistics": StoryStatisticsTypeID, @@ -3652,6 +3674,7 @@ func NamesMap() map[string]uint32 { "updateQuickReplyShortcutMessages": UpdateQuickReplyShortcutMessagesTypeID, "updateForumTopicInfo": UpdateForumTopicInfoTypeID, "updateScopeNotificationSettings": UpdateScopeNotificationSettingsTypeID, + "updateReactionNotificationSettings": UpdateReactionNotificationSettingsTypeID, "updateNotification": UpdateNotificationTypeID, "updateNotificationGroup": UpdateNotificationGroupTypeID, "updateActiveNotifications": UpdateActiveNotificationsTypeID, @@ -3710,6 +3733,7 @@ func NamesMap() map[string]uint32 { "updateActiveEmojiReactions": UpdateActiveEmojiReactionsTypeID, "updateDefaultReactionType": UpdateDefaultReactionTypeTypeID, "updateSavedMessagesTags": UpdateSavedMessagesTagsTypeID, + "updateChatRevenueAmount": UpdateChatRevenueAmountTypeID, "updateSpeechRecognitionTrial": UpdateSpeechRecognitionTrialTypeID, "updateDiceEmojis": UpdateDiceEmojisTypeID, "updateAnimatedEmojiMessageClicked": UpdateAnimatedEmojiMessageClickedTypeID, @@ -3766,6 +3790,7 @@ func NamesMap() map[string]uint32 { "checkAuthenticationPasswordRecoveryCode": CheckAuthenticationPasswordRecoveryCodeRequestTypeID, "recoverAuthenticationPassword": RecoverAuthenticationPasswordRequestTypeID, "sendAuthenticationFirebaseSms": SendAuthenticationFirebaseSMSRequestTypeID, + "reportAuthenticationCodeMissing": ReportAuthenticationCodeMissingRequestTypeID, "checkAuthenticationBotToken": CheckAuthenticationBotTokenRequestTypeID, "logOut": LogOutRequestTypeID, "close": CloseRequestTypeID, @@ -3817,6 +3842,7 @@ func NamesMap() map[string]uint32 { "searchChats": SearchChatsRequestTypeID, "searchChatsOnServer": SearchChatsOnServerRequestTypeID, "searchChatsNearby": SearchChatsNearbyRequestTypeID, + "getRecommendedChats": GetRecommendedChatsRequestTypeID, "getChatSimilarChats": GetChatSimilarChatsRequestTypeID, "getChatSimilarChatCount": GetChatSimilarChatCountRequestTypeID, "openChatSimilarChat": OpenChatSimilarChatRequestTypeID, @@ -3907,6 +3933,7 @@ func NamesMap() map[string]uint32 { "deleteQuickReplyShortcutMessages": DeleteQuickReplyShortcutMessagesRequestTypeID, "addQuickReplyShortcutMessage": AddQuickReplyShortcutMessageRequestTypeID, "addQuickReplyShortcutInlineQueryResultMessage": AddQuickReplyShortcutInlineQueryResultMessageRequestTypeID, + "addQuickReplyShortcutMessageAlbum": AddQuickReplyShortcutMessageAlbumRequestTypeID, "readdQuickReplyShortcutMessages": ReaddQuickReplyShortcutMessagesRequestTypeID, "editQuickReplyMessage": EditQuickReplyMessageRequestTypeID, "getForumTopicDefaultIcons": GetForumTopicDefaultIconsRequestTypeID, @@ -3949,6 +3976,7 @@ func NamesMap() map[string]uint32 { "getPollVoters": GetPollVotersRequestTypeID, "stopPoll": StopPollRequestTypeID, "hideSuggestedAction": HideSuggestedActionRequestTypeID, + "hideContactCloseBirthdays": HideContactCloseBirthdaysRequestTypeID, "getBusinessConnection": GetBusinessConnectionRequestTypeID, "getLoginUrlInfo": GetLoginURLInfoRequestTypeID, "getLoginUrl": GetLoginURLRequestTypeID, @@ -4063,6 +4091,7 @@ func NamesMap() map[string]uint32 { "getChatNotificationSettingsExceptions": GetChatNotificationSettingsExceptionsRequestTypeID, "getScopeNotificationSettings": GetScopeNotificationSettingsRequestTypeID, "setScopeNotificationSettings": SetScopeNotificationSettingsRequestTypeID, + "setReactionNotificationSettings": SetReactionNotificationSettingsRequestTypeID, "resetAllNotificationSettings": ResetAllNotificationSettingsRequestTypeID, "toggleChatIsPinned": ToggleChatIsPinnedRequestTypeID, "setPinnedChats": SetPinnedChatsRequestTypeID, @@ -4073,14 +4102,15 @@ func NamesMap() map[string]uint32 { "sendStory": SendStoryRequestTypeID, "editStory": EditStoryRequestTypeID, "setStoryPrivacySettings": SetStoryPrivacySettingsRequestTypeID, - "toggleStoryIsPinned": ToggleStoryIsPinnedRequestTypeID, + "toggleStoryIsPostedToChatPage": ToggleStoryIsPostedToChatPageRequestTypeID, "deleteStory": DeleteStoryRequestTypeID, "getStoryNotificationSettingsExceptions": GetStoryNotificationSettingsExceptionsRequestTypeID, "loadActiveStories": LoadActiveStoriesRequestTypeID, "setChatActiveStoriesList": SetChatActiveStoriesListRequestTypeID, "getChatActiveStories": GetChatActiveStoriesRequestTypeID, - "getChatPinnedStories": GetChatPinnedStoriesRequestTypeID, + "getChatPostedToChatPageStories": GetChatPostedToChatPageStoriesRequestTypeID, "getChatArchivedStories": GetChatArchivedStoriesRequestTypeID, + "setChatPinnedStories": SetChatPinnedStoriesRequestTypeID, "openStory": OpenStoryRequestTypeID, "closeStory": CloseStoryRequestTypeID, "getStoryAvailableReactions": GetStoryAvailableReactionsRequestTypeID, @@ -4252,6 +4282,7 @@ func NamesMap() map[string]uint32 { "setPersonalChat": SetPersonalChatRequestTypeID, "setEmojiStatus": SetEmojiStatusRequestTypeID, "setLocation": SetLocationRequestTypeID, + "toggleHasSponsoredMessagesEnabled": ToggleHasSponsoredMessagesEnabledRequestTypeID, "setBusinessLocation": SetBusinessLocationRequestTypeID, "setBusinessOpeningHours": SetBusinessOpeningHoursRequestTypeID, "setBusinessGreetingMessageSettings": SetBusinessGreetingMessageSettingsRequestTypeID, @@ -4259,6 +4290,7 @@ func NamesMap() map[string]uint32 { "setBusinessStartPage": SetBusinessStartPageRequestTypeID, "sendPhoneNumberCode": SendPhoneNumberCodeRequestTypeID, "sendPhoneNumberFirebaseSms": SendPhoneNumberFirebaseSMSRequestTypeID, + "reportPhoneNumberCodeMissing": ReportPhoneNumberCodeMissingRequestTypeID, "resendPhoneNumberCode": ResendPhoneNumberCodeRequestTypeID, "checkPhoneNumberCode": CheckPhoneNumberCodeRequestTypeID, "getBusinessConnectedBot": GetBusinessConnectedBotRequestTypeID, @@ -4502,6 +4534,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { OkTypeID: func() bin.Object { return &Ok{} }, AuthenticationCodeTypeTelegramMessageTypeID: func() bin.Object { return &AuthenticationCodeTypeTelegramMessage{} }, AuthenticationCodeTypeSMSTypeID: func() bin.Object { return &AuthenticationCodeTypeSMS{} }, + AuthenticationCodeTypeSMSWordTypeID: func() bin.Object { return &AuthenticationCodeTypeSMSWord{} }, + AuthenticationCodeTypeSMSPhraseTypeID: func() bin.Object { return &AuthenticationCodeTypeSMSPhrase{} }, AuthenticationCodeTypeCallTypeID: func() bin.Object { return &AuthenticationCodeTypeCall{} }, AuthenticationCodeTypeFlashCallTypeID: func() bin.Object { return &AuthenticationCodeTypeFlashCall{} }, AuthenticationCodeTypeMissedCallTypeID: func() bin.Object { return &AuthenticationCodeTypeMissedCall{} }, @@ -4750,11 +4784,6 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessageSourceNotificationTypeID: func() bin.Object { return &MessageSourceNotification{} }, MessageSourceScreenshotTypeID: func() bin.Object { return &MessageSourceScreenshot{} }, MessageSourceOtherTypeID: func() bin.Object { return &MessageSourceOther{} }, - MessageSponsorTypeBotTypeID: func() bin.Object { return &MessageSponsorTypeBot{} }, - MessageSponsorTypeWebAppTypeID: func() bin.Object { return &MessageSponsorTypeWebApp{} }, - MessageSponsorTypePublicChannelTypeID: func() bin.Object { return &MessageSponsorTypePublicChannel{} }, - MessageSponsorTypePrivateChannelTypeID: func() bin.Object { return &MessageSponsorTypePrivateChannel{} }, - MessageSponsorTypeWebsiteTypeID: func() bin.Object { return &MessageSponsorTypeWebsite{} }, MessageSponsorTypeID: func() bin.Object { return &MessageSponsor{} }, SponsoredMessageTypeID: func() bin.Object { return &SponsoredMessage{} }, SponsoredMessagesTypeID: func() bin.Object { return &SponsoredMessages{} }, @@ -4772,6 +4801,10 @@ func TypesConstructorMap() map[uint32]func() bin.Object { NotificationSettingsScopeChannelChatsTypeID: func() bin.Object { return &NotificationSettingsScopeChannelChats{} }, ChatNotificationSettingsTypeID: func() bin.Object { return &ChatNotificationSettings{} }, ScopeNotificationSettingsTypeID: func() bin.Object { return &ScopeNotificationSettings{} }, + ReactionNotificationSourceNoneTypeID: func() bin.Object { return &ReactionNotificationSourceNone{} }, + ReactionNotificationSourceContactsTypeID: func() bin.Object { return &ReactionNotificationSourceContacts{} }, + ReactionNotificationSourceAllTypeID: func() bin.Object { return &ReactionNotificationSourceAll{} }, + ReactionNotificationSettingsTypeID: func() bin.Object { return &ReactionNotificationSettings{} }, DraftMessageTypeID: func() bin.Object { return &DraftMessage{} }, ChatTypePrivateTypeID: func() bin.Object { return &ChatTypePrivate{} }, ChatTypeBasicGroupTypeID: func() bin.Object { return &ChatTypeBasicGroup{} }, @@ -5180,9 +5213,12 @@ func TypesConstructorMap() map[uint32]func() bin.Object { StickerSetInfoTypeID: func() bin.Object { return &StickerSetInfo{} }, StickerSetsTypeID: func() bin.Object { return &StickerSets{} }, TrendingStickerSetsTypeID: func() bin.Object { return &TrendingStickerSets{} }, + EmojiCategorySourceSearchTypeID: func() bin.Object { return &EmojiCategorySourceSearch{} }, + EmojiCategorySourcePremiumTypeID: func() bin.Object { return &EmojiCategorySourcePremium{} }, EmojiCategoryTypeID: func() bin.Object { return &EmojiCategory{} }, EmojiCategoriesTypeID: func() bin.Object { return &EmojiCategories{} }, EmojiCategoryTypeDefaultTypeID: func() bin.Object { return &EmojiCategoryTypeDefault{} }, + EmojiCategoryTypeRegularStickersTypeID: func() bin.Object { return &EmojiCategoryTypeRegularStickers{} }, EmojiCategoryTypeEmojiStatusTypeID: func() bin.Object { return &EmojiCategoryTypeEmojiStatus{} }, EmojiCategoryTypeChatPhotoTypeID: func() bin.Object { return &EmojiCategoryTypeChatPhoto{} }, StoryAreaPositionTypeID: func() bin.Object { return &StoryAreaPosition{} }, @@ -5774,6 +5810,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { SuggestedActionSubscribeToAnnualPremiumTypeID: func() bin.Object { return &SuggestedActionSubscribeToAnnualPremium{} }, SuggestedActionGiftPremiumForChristmasTypeID: func() bin.Object { return &SuggestedActionGiftPremiumForChristmas{} }, SuggestedActionSetBirthdateTypeID: func() bin.Object { return &SuggestedActionSetBirthdate{} }, + SuggestedActionExtendPremiumTypeID: func() bin.Object { return &SuggestedActionExtendPremium{} }, CountTypeID: func() bin.Object { return &Count{} }, TextTypeID: func() bin.Object { return &Text{} }, SecondsTypeID: func() bin.Object { return &Seconds{} }, @@ -5800,6 +5837,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ChatStatisticsInviterInfoTypeID: func() bin.Object { return &ChatStatisticsInviterInfo{} }, ChatStatisticsSupergroupTypeID: func() bin.Object { return &ChatStatisticsSupergroup{} }, ChatStatisticsChannelTypeID: func() bin.Object { return &ChatStatisticsChannel{} }, + ChatRevenueAmountTypeID: func() bin.Object { return &ChatRevenueAmount{} }, ChatRevenueStatisticsTypeID: func() bin.Object { return &ChatRevenueStatistics{} }, MessageStatisticsTypeID: func() bin.Object { return &MessageStatistics{} }, StoryStatisticsTypeID: func() bin.Object { return &StoryStatistics{} }, @@ -5880,6 +5918,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UpdateQuickReplyShortcutMessagesTypeID: func() bin.Object { return &UpdateQuickReplyShortcutMessages{} }, UpdateForumTopicInfoTypeID: func() bin.Object { return &UpdateForumTopicInfo{} }, UpdateScopeNotificationSettingsTypeID: func() bin.Object { return &UpdateScopeNotificationSettings{} }, + UpdateReactionNotificationSettingsTypeID: func() bin.Object { return &UpdateReactionNotificationSettings{} }, UpdateNotificationTypeID: func() bin.Object { return &UpdateNotification{} }, UpdateNotificationGroupTypeID: func() bin.Object { return &UpdateNotificationGroup{} }, UpdateActiveNotificationsTypeID: func() bin.Object { return &UpdateActiveNotifications{} }, @@ -5938,6 +5977,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UpdateActiveEmojiReactionsTypeID: func() bin.Object { return &UpdateActiveEmojiReactions{} }, UpdateDefaultReactionTypeTypeID: func() bin.Object { return &UpdateDefaultReactionType{} }, UpdateSavedMessagesTagsTypeID: func() bin.Object { return &UpdateSavedMessagesTags{} }, + UpdateChatRevenueAmountTypeID: func() bin.Object { return &UpdateChatRevenueAmount{} }, UpdateSpeechRecognitionTrialTypeID: func() bin.Object { return &UpdateSpeechRecognitionTrial{} }, UpdateDiceEmojisTypeID: func() bin.Object { return &UpdateDiceEmojis{} }, UpdateAnimatedEmojiMessageClickedTypeID: func() bin.Object { return &UpdateAnimatedEmojiMessageClicked{} }, @@ -5994,6 +6034,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { CheckAuthenticationPasswordRecoveryCodeRequestTypeID: func() bin.Object { return &CheckAuthenticationPasswordRecoveryCodeRequest{} }, RecoverAuthenticationPasswordRequestTypeID: func() bin.Object { return &RecoverAuthenticationPasswordRequest{} }, SendAuthenticationFirebaseSMSRequestTypeID: func() bin.Object { return &SendAuthenticationFirebaseSMSRequest{} }, + ReportAuthenticationCodeMissingRequestTypeID: func() bin.Object { return &ReportAuthenticationCodeMissingRequest{} }, CheckAuthenticationBotTokenRequestTypeID: func() bin.Object { return &CheckAuthenticationBotTokenRequest{} }, LogOutRequestTypeID: func() bin.Object { return &LogOutRequest{} }, CloseRequestTypeID: func() bin.Object { return &CloseRequest{} }, @@ -6045,6 +6086,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { SearchChatsRequestTypeID: func() bin.Object { return &SearchChatsRequest{} }, SearchChatsOnServerRequestTypeID: func() bin.Object { return &SearchChatsOnServerRequest{} }, SearchChatsNearbyRequestTypeID: func() bin.Object { return &SearchChatsNearbyRequest{} }, + GetRecommendedChatsRequestTypeID: func() bin.Object { return &GetRecommendedChatsRequest{} }, GetChatSimilarChatsRequestTypeID: func() bin.Object { return &GetChatSimilarChatsRequest{} }, GetChatSimilarChatCountRequestTypeID: func() bin.Object { return &GetChatSimilarChatCountRequest{} }, OpenChatSimilarChatRequestTypeID: func() bin.Object { return &OpenChatSimilarChatRequest{} }, @@ -6135,6 +6177,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { DeleteQuickReplyShortcutMessagesRequestTypeID: func() bin.Object { return &DeleteQuickReplyShortcutMessagesRequest{} }, AddQuickReplyShortcutMessageRequestTypeID: func() bin.Object { return &AddQuickReplyShortcutMessageRequest{} }, AddQuickReplyShortcutInlineQueryResultMessageRequestTypeID: func() bin.Object { return &AddQuickReplyShortcutInlineQueryResultMessageRequest{} }, + AddQuickReplyShortcutMessageAlbumRequestTypeID: func() bin.Object { return &AddQuickReplyShortcutMessageAlbumRequest{} }, ReaddQuickReplyShortcutMessagesRequestTypeID: func() bin.Object { return &ReaddQuickReplyShortcutMessagesRequest{} }, EditQuickReplyMessageRequestTypeID: func() bin.Object { return &EditQuickReplyMessageRequest{} }, GetForumTopicDefaultIconsRequestTypeID: func() bin.Object { return &GetForumTopicDefaultIconsRequest{} }, @@ -6177,6 +6220,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { GetPollVotersRequestTypeID: func() bin.Object { return &GetPollVotersRequest{} }, StopPollRequestTypeID: func() bin.Object { return &StopPollRequest{} }, HideSuggestedActionRequestTypeID: func() bin.Object { return &HideSuggestedActionRequest{} }, + HideContactCloseBirthdaysRequestTypeID: func() bin.Object { return &HideContactCloseBirthdaysRequest{} }, GetBusinessConnectionRequestTypeID: func() bin.Object { return &GetBusinessConnectionRequest{} }, GetLoginURLInfoRequestTypeID: func() bin.Object { return &GetLoginURLInfoRequest{} }, GetLoginURLRequestTypeID: func() bin.Object { return &GetLoginURLRequest{} }, @@ -6291,6 +6335,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { GetChatNotificationSettingsExceptionsRequestTypeID: func() bin.Object { return &GetChatNotificationSettingsExceptionsRequest{} }, GetScopeNotificationSettingsRequestTypeID: func() bin.Object { return &GetScopeNotificationSettingsRequest{} }, SetScopeNotificationSettingsRequestTypeID: func() bin.Object { return &SetScopeNotificationSettingsRequest{} }, + SetReactionNotificationSettingsRequestTypeID: func() bin.Object { return &SetReactionNotificationSettingsRequest{} }, ResetAllNotificationSettingsRequestTypeID: func() bin.Object { return &ResetAllNotificationSettingsRequest{} }, ToggleChatIsPinnedRequestTypeID: func() bin.Object { return &ToggleChatIsPinnedRequest{} }, SetPinnedChatsRequestTypeID: func() bin.Object { return &SetPinnedChatsRequest{} }, @@ -6301,14 +6346,15 @@ func TypesConstructorMap() map[uint32]func() bin.Object { SendStoryRequestTypeID: func() bin.Object { return &SendStoryRequest{} }, EditStoryRequestTypeID: func() bin.Object { return &EditStoryRequest{} }, SetStoryPrivacySettingsRequestTypeID: func() bin.Object { return &SetStoryPrivacySettingsRequest{} }, - ToggleStoryIsPinnedRequestTypeID: func() bin.Object { return &ToggleStoryIsPinnedRequest{} }, + ToggleStoryIsPostedToChatPageRequestTypeID: func() bin.Object { return &ToggleStoryIsPostedToChatPageRequest{} }, DeleteStoryRequestTypeID: func() bin.Object { return &DeleteStoryRequest{} }, GetStoryNotificationSettingsExceptionsRequestTypeID: func() bin.Object { return &GetStoryNotificationSettingsExceptionsRequest{} }, LoadActiveStoriesRequestTypeID: func() bin.Object { return &LoadActiveStoriesRequest{} }, SetChatActiveStoriesListRequestTypeID: func() bin.Object { return &SetChatActiveStoriesListRequest{} }, GetChatActiveStoriesRequestTypeID: func() bin.Object { return &GetChatActiveStoriesRequest{} }, - GetChatPinnedStoriesRequestTypeID: func() bin.Object { return &GetChatPinnedStoriesRequest{} }, + GetChatPostedToChatPageStoriesRequestTypeID: func() bin.Object { return &GetChatPostedToChatPageStoriesRequest{} }, GetChatArchivedStoriesRequestTypeID: func() bin.Object { return &GetChatArchivedStoriesRequest{} }, + SetChatPinnedStoriesRequestTypeID: func() bin.Object { return &SetChatPinnedStoriesRequest{} }, OpenStoryRequestTypeID: func() bin.Object { return &OpenStoryRequest{} }, CloseStoryRequestTypeID: func() bin.Object { return &CloseStoryRequest{} }, GetStoryAvailableReactionsRequestTypeID: func() bin.Object { return &GetStoryAvailableReactionsRequest{} }, @@ -6480,6 +6526,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { SetPersonalChatRequestTypeID: func() bin.Object { return &SetPersonalChatRequest{} }, SetEmojiStatusRequestTypeID: func() bin.Object { return &SetEmojiStatusRequest{} }, SetLocationRequestTypeID: func() bin.Object { return &SetLocationRequest{} }, + ToggleHasSponsoredMessagesEnabledRequestTypeID: func() bin.Object { return &ToggleHasSponsoredMessagesEnabledRequest{} }, SetBusinessLocationRequestTypeID: func() bin.Object { return &SetBusinessLocationRequest{} }, SetBusinessOpeningHoursRequestTypeID: func() bin.Object { return &SetBusinessOpeningHoursRequest{} }, SetBusinessGreetingMessageSettingsRequestTypeID: func() bin.Object { return &SetBusinessGreetingMessageSettingsRequest{} }, @@ -6487,6 +6534,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { SetBusinessStartPageRequestTypeID: func() bin.Object { return &SetBusinessStartPageRequest{} }, SendPhoneNumberCodeRequestTypeID: func() bin.Object { return &SendPhoneNumberCodeRequest{} }, SendPhoneNumberFirebaseSMSRequestTypeID: func() bin.Object { return &SendPhoneNumberFirebaseSMSRequest{} }, + ReportPhoneNumberCodeMissingRequestTypeID: func() bin.Object { return &ReportPhoneNumberCodeMissingRequest{} }, ResendPhoneNumberCodeRequestTypeID: func() bin.Object { return &ResendPhoneNumberCodeRequest{} }, CheckPhoneNumberCodeRequestTypeID: func() bin.Object { return &CheckPhoneNumberCodeRequest{} }, GetBusinessConnectedBotRequestTypeID: func() bin.Object { return &GetBusinessConnectedBotRequest{} }, @@ -6721,6 +6769,8 @@ func ClassConstructorsMap() map[string][]uint32 { AuthenticationCodeTypeClassName: { AuthenticationCodeTypeTelegramMessageTypeID, AuthenticationCodeTypeSMSTypeID, + AuthenticationCodeTypeSMSWordTypeID, + AuthenticationCodeTypeSMSPhraseTypeID, AuthenticationCodeTypeCallTypeID, AuthenticationCodeTypeFlashCallTypeID, AuthenticationCodeTypeMissedCallTypeID, @@ -7045,8 +7095,13 @@ func ClassConstructorsMap() map[string][]uint32 { EmailAddressResetStateAvailableTypeID, EmailAddressResetStatePendingTypeID, }, + EmojiCategorySourceClassName: { + EmojiCategorySourceSearchTypeID, + EmojiCategorySourcePremiumTypeID, + }, EmojiCategoryTypeClassName: { EmojiCategoryTypeDefaultTypeID, + EmojiCategoryTypeRegularStickersTypeID, EmojiCategoryTypeEmojiStatusTypeID, EmojiCategoryTypeChatPhotoTypeID, }, @@ -7427,13 +7482,6 @@ func ClassConstructorsMap() map[string][]uint32 { MessageSourceScreenshotTypeID, MessageSourceOtherTypeID, }, - MessageSponsorTypeClassName: { - MessageSponsorTypeBotTypeID, - MessageSponsorTypeWebAppTypeID, - MessageSponsorTypePublicChannelTypeID, - MessageSponsorTypePrivateChannelTypeID, - MessageSponsorTypeWebsiteTypeID, - }, NetworkStatisticsEntryClassName: { NetworkStatisticsEntryFileTypeID, NetworkStatisticsEntryCallTypeID, @@ -7687,6 +7735,11 @@ func ClassConstructorsMap() map[string][]uint32 { PushMessageContentMessageForwardsTypeID, PushMessageContentMediaAlbumTypeID, }, + ReactionNotificationSourceClassName: { + ReactionNotificationSourceNoneTypeID, + ReactionNotificationSourceContactsTypeID, + ReactionNotificationSourceAllTypeID, + }, ReactionTypeClassName: { ReactionTypeEmojiTypeID, ReactionTypeCustomEmojiTypeID, @@ -7865,6 +7918,7 @@ func ClassConstructorsMap() map[string][]uint32 { SuggestedActionSubscribeToAnnualPremiumTypeID, SuggestedActionGiftPremiumForChristmasTypeID, SuggestedActionSetBirthdateTypeID, + SuggestedActionExtendPremiumTypeID, }, SupergroupMembersFilterClassName: { SupergroupMembersFilterRecentTypeID, @@ -7993,6 +8047,7 @@ func ClassConstructorsMap() map[string][]uint32 { UpdateQuickReplyShortcutMessagesTypeID, UpdateForumTopicInfoTypeID, UpdateScopeNotificationSettingsTypeID, + UpdateReactionNotificationSettingsTypeID, UpdateNotificationTypeID, UpdateNotificationGroupTypeID, UpdateActiveNotificationsTypeID, @@ -8051,6 +8106,7 @@ func ClassConstructorsMap() map[string][]uint32 { UpdateActiveEmojiReactionsTypeID, UpdateDefaultReactionTypeTypeID, UpdateSavedMessagesTagsTypeID, + UpdateChatRevenueAmountTypeID, UpdateSpeechRecognitionTrialTypeID, UpdateDiceEmojisTypeID, UpdateAnimatedEmojiMessageClickedTypeID, diff --git a/tdapi/tl_report_authentication_code_missing_gen.go b/tdapi/tl_report_authentication_code_missing_gen.go new file mode 100644 index 0000000000..1da718d81b --- /dev/null +++ b/tdapi/tl_report_authentication_code_missing_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{} +) + +// ReportAuthenticationCodeMissingRequest represents TL type `reportAuthenticationCodeMissing#91efce48`. +type ReportAuthenticationCodeMissingRequest struct { + // Current mobile network code + MobileNetworkCode string +} + +// ReportAuthenticationCodeMissingRequestTypeID is TL type id of ReportAuthenticationCodeMissingRequest. +const ReportAuthenticationCodeMissingRequestTypeID = 0x91efce48 + +// Ensuring interfaces in compile-time for ReportAuthenticationCodeMissingRequest. +var ( + _ bin.Encoder = &ReportAuthenticationCodeMissingRequest{} + _ bin.Decoder = &ReportAuthenticationCodeMissingRequest{} + _ bin.BareEncoder = &ReportAuthenticationCodeMissingRequest{} + _ bin.BareDecoder = &ReportAuthenticationCodeMissingRequest{} +) + +func (r *ReportAuthenticationCodeMissingRequest) Zero() bool { + if r == nil { + return true + } + if !(r.MobileNetworkCode == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (r *ReportAuthenticationCodeMissingRequest) String() string { + if r == nil { + return "ReportAuthenticationCodeMissingRequest(nil)" + } + type Alias ReportAuthenticationCodeMissingRequest + return fmt.Sprintf("ReportAuthenticationCodeMissingRequest%+v", Alias(*r)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ReportAuthenticationCodeMissingRequest) TypeID() uint32 { + return ReportAuthenticationCodeMissingRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ReportAuthenticationCodeMissingRequest) TypeName() string { + return "reportAuthenticationCodeMissing" +} + +// TypeInfo returns info about TL type. +func (r *ReportAuthenticationCodeMissingRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "reportAuthenticationCodeMissing", + ID: ReportAuthenticationCodeMissingRequestTypeID, + } + if r == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "MobileNetworkCode", + SchemaName: "mobile_network_code", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (r *ReportAuthenticationCodeMissingRequest) Encode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reportAuthenticationCodeMissing#91efce48 as nil") + } + b.PutID(ReportAuthenticationCodeMissingRequestTypeID) + return r.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (r *ReportAuthenticationCodeMissingRequest) EncodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reportAuthenticationCodeMissing#91efce48 as nil") + } + b.PutString(r.MobileNetworkCode) + return nil +} + +// Decode implements bin.Decoder. +func (r *ReportAuthenticationCodeMissingRequest) Decode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reportAuthenticationCodeMissing#91efce48 to nil") + } + if err := b.ConsumeID(ReportAuthenticationCodeMissingRequestTypeID); err != nil { + return fmt.Errorf("unable to decode reportAuthenticationCodeMissing#91efce48: %w", err) + } + return r.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (r *ReportAuthenticationCodeMissingRequest) DecodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reportAuthenticationCodeMissing#91efce48 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode reportAuthenticationCodeMissing#91efce48: field mobile_network_code: %w", err) + } + r.MobileNetworkCode = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (r *ReportAuthenticationCodeMissingRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if r == nil { + return fmt.Errorf("can't encode reportAuthenticationCodeMissing#91efce48 as nil") + } + b.ObjStart() + b.PutID("reportAuthenticationCodeMissing") + b.Comma() + b.FieldStart("mobile_network_code") + b.PutString(r.MobileNetworkCode) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (r *ReportAuthenticationCodeMissingRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if r == nil { + return fmt.Errorf("can't decode reportAuthenticationCodeMissing#91efce48 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("reportAuthenticationCodeMissing"); err != nil { + return fmt.Errorf("unable to decode reportAuthenticationCodeMissing#91efce48: %w", err) + } + case "mobile_network_code": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode reportAuthenticationCodeMissing#91efce48: field mobile_network_code: %w", err) + } + r.MobileNetworkCode = value + default: + return b.Skip() + } + return nil + }) +} + +// GetMobileNetworkCode returns value of MobileNetworkCode field. +func (r *ReportAuthenticationCodeMissingRequest) GetMobileNetworkCode() (value string) { + if r == nil { + return + } + return r.MobileNetworkCode +} + +// ReportAuthenticationCodeMissing invokes method reportAuthenticationCodeMissing#91efce48 returning error if any. +func (c *Client) ReportAuthenticationCodeMissing(ctx context.Context, mobilenetworkcode string) error { + var ok Ok + + request := &ReportAuthenticationCodeMissingRequest{ + MobileNetworkCode: mobilenetworkcode, + } + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_report_phone_number_code_missing_gen.go b/tdapi/tl_report_phone_number_code_missing_gen.go new file mode 100644 index 0000000000..1f35dacebf --- /dev/null +++ b/tdapi/tl_report_phone_number_code_missing_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{} +) + +// ReportPhoneNumberCodeMissingRequest represents TL type `reportPhoneNumberCodeMissing#caa4b553`. +type ReportPhoneNumberCodeMissingRequest struct { + // Current mobile network code + MobileNetworkCode string +} + +// ReportPhoneNumberCodeMissingRequestTypeID is TL type id of ReportPhoneNumberCodeMissingRequest. +const ReportPhoneNumberCodeMissingRequestTypeID = 0xcaa4b553 + +// Ensuring interfaces in compile-time for ReportPhoneNumberCodeMissingRequest. +var ( + _ bin.Encoder = &ReportPhoneNumberCodeMissingRequest{} + _ bin.Decoder = &ReportPhoneNumberCodeMissingRequest{} + _ bin.BareEncoder = &ReportPhoneNumberCodeMissingRequest{} + _ bin.BareDecoder = &ReportPhoneNumberCodeMissingRequest{} +) + +func (r *ReportPhoneNumberCodeMissingRequest) Zero() bool { + if r == nil { + return true + } + if !(r.MobileNetworkCode == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (r *ReportPhoneNumberCodeMissingRequest) String() string { + if r == nil { + return "ReportPhoneNumberCodeMissingRequest(nil)" + } + type Alias ReportPhoneNumberCodeMissingRequest + return fmt.Sprintf("ReportPhoneNumberCodeMissingRequest%+v", Alias(*r)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ReportPhoneNumberCodeMissingRequest) TypeID() uint32 { + return ReportPhoneNumberCodeMissingRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ReportPhoneNumberCodeMissingRequest) TypeName() string { + return "reportPhoneNumberCodeMissing" +} + +// TypeInfo returns info about TL type. +func (r *ReportPhoneNumberCodeMissingRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "reportPhoneNumberCodeMissing", + ID: ReportPhoneNumberCodeMissingRequestTypeID, + } + if r == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "MobileNetworkCode", + SchemaName: "mobile_network_code", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (r *ReportPhoneNumberCodeMissingRequest) Encode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reportPhoneNumberCodeMissing#caa4b553 as nil") + } + b.PutID(ReportPhoneNumberCodeMissingRequestTypeID) + return r.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (r *ReportPhoneNumberCodeMissingRequest) EncodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reportPhoneNumberCodeMissing#caa4b553 as nil") + } + b.PutString(r.MobileNetworkCode) + return nil +} + +// Decode implements bin.Decoder. +func (r *ReportPhoneNumberCodeMissingRequest) Decode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reportPhoneNumberCodeMissing#caa4b553 to nil") + } + if err := b.ConsumeID(ReportPhoneNumberCodeMissingRequestTypeID); err != nil { + return fmt.Errorf("unable to decode reportPhoneNumberCodeMissing#caa4b553: %w", err) + } + return r.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (r *ReportPhoneNumberCodeMissingRequest) DecodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reportPhoneNumberCodeMissing#caa4b553 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode reportPhoneNumberCodeMissing#caa4b553: field mobile_network_code: %w", err) + } + r.MobileNetworkCode = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (r *ReportPhoneNumberCodeMissingRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if r == nil { + return fmt.Errorf("can't encode reportPhoneNumberCodeMissing#caa4b553 as nil") + } + b.ObjStart() + b.PutID("reportPhoneNumberCodeMissing") + b.Comma() + b.FieldStart("mobile_network_code") + b.PutString(r.MobileNetworkCode) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (r *ReportPhoneNumberCodeMissingRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if r == nil { + return fmt.Errorf("can't decode reportPhoneNumberCodeMissing#caa4b553 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("reportPhoneNumberCodeMissing"); err != nil { + return fmt.Errorf("unable to decode reportPhoneNumberCodeMissing#caa4b553: %w", err) + } + case "mobile_network_code": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode reportPhoneNumberCodeMissing#caa4b553: field mobile_network_code: %w", err) + } + r.MobileNetworkCode = value + default: + return b.Skip() + } + return nil + }) +} + +// GetMobileNetworkCode returns value of MobileNetworkCode field. +func (r *ReportPhoneNumberCodeMissingRequest) GetMobileNetworkCode() (value string) { + if r == nil { + return + } + return r.MobileNetworkCode +} + +// ReportPhoneNumberCodeMissing invokes method reportPhoneNumberCodeMissing#caa4b553 returning error if any. +func (c *Client) ReportPhoneNumberCodeMissing(ctx context.Context, mobilenetworkcode string) error { + var ok Ok + + request := &ReportPhoneNumberCodeMissingRequest{ + MobileNetworkCode: mobilenetworkcode, + } + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_search_messages_gen.go b/tdapi/tl_search_messages_gen.go index cf8c01e643..a46b2a1e86 100644 --- a/tdapi/tl_search_messages_gen.go +++ b/tdapi/tl_search_messages_gen.go @@ -31,11 +31,13 @@ var ( _ = tdjson.Encoder{} ) -// SearchMessagesRequest represents TL type `searchMessages#2a8f08a7`. +// SearchMessagesRequest represents TL type `searchMessages#31f9c3c9`. type SearchMessagesRequest struct { // Chat list in which to search messages; pass null to search in all chats regardless of // their chat list. Only Main and Archive chat lists are supported ChatList ChatListClass + // Pass true to search only for messages in channels + OnlyInChannels bool // Query to search for Query string // Offset of the first entry to return as received from the previous request; use empty @@ -57,7 +59,7 @@ type SearchMessagesRequest struct { } // SearchMessagesRequestTypeID is TL type id of SearchMessagesRequest. -const SearchMessagesRequestTypeID = 0x2a8f08a7 +const SearchMessagesRequestTypeID = 0x31f9c3c9 // Ensuring interfaces in compile-time for SearchMessagesRequest. var ( @@ -74,6 +76,9 @@ func (s *SearchMessagesRequest) Zero() bool { if !(s.ChatList == nil) { return false } + if !(s.OnlyInChannels == false) { + return false + } if !(s.Query == "") { return false } @@ -132,6 +137,10 @@ func (s *SearchMessagesRequest) TypeInfo() tdp.Type { Name: "ChatList", SchemaName: "chat_list", }, + { + Name: "OnlyInChannels", + SchemaName: "only_in_channels", + }, { Name: "Query", SchemaName: "query", @@ -163,7 +172,7 @@ func (s *SearchMessagesRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *SearchMessagesRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode searchMessages#2a8f08a7 as nil") + return fmt.Errorf("can't encode searchMessages#31f9c3c9 as nil") } b.PutID(SearchMessagesRequestTypeID) return s.EncodeBare(b) @@ -172,22 +181,23 @@ func (s *SearchMessagesRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *SearchMessagesRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode searchMessages#2a8f08a7 as nil") + return fmt.Errorf("can't encode searchMessages#31f9c3c9 as nil") } if s.ChatList == nil { - return fmt.Errorf("unable to encode searchMessages#2a8f08a7: field chat_list is nil") + return fmt.Errorf("unable to encode searchMessages#31f9c3c9: field chat_list is nil") } if err := s.ChatList.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchMessages#2a8f08a7: field chat_list: %w", err) + return fmt.Errorf("unable to encode searchMessages#31f9c3c9: field chat_list: %w", err) } + b.PutBool(s.OnlyInChannels) b.PutString(s.Query) b.PutString(s.Offset) b.PutInt32(s.Limit) if s.Filter == nil { - return fmt.Errorf("unable to encode searchMessages#2a8f08a7: field filter is nil") + return fmt.Errorf("unable to encode searchMessages#31f9c3c9: field filter is nil") } if err := s.Filter.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchMessages#2a8f08a7: field filter: %w", err) + return fmt.Errorf("unable to encode searchMessages#31f9c3c9: field filter: %w", err) } b.PutInt32(s.MinDate) b.PutInt32(s.MaxDate) @@ -197,10 +207,10 @@ func (s *SearchMessagesRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *SearchMessagesRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode searchMessages#2a8f08a7 to nil") + return fmt.Errorf("can't decode searchMessages#31f9c3c9 to nil") } if err := b.ConsumeID(SearchMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessages#2a8f08a7: %w", err) + return fmt.Errorf("unable to decode searchMessages#31f9c3c9: %w", err) } return s.DecodeBare(b) } @@ -208,54 +218,61 @@ func (s *SearchMessagesRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *SearchMessagesRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode searchMessages#2a8f08a7 to nil") + return fmt.Errorf("can't decode searchMessages#31f9c3c9 to nil") } { value, err := DecodeChatList(b) if err != nil { - return fmt.Errorf("unable to decode searchMessages#2a8f08a7: field chat_list: %w", err) + return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field chat_list: %w", err) } s.ChatList = value } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field only_in_channels: %w", err) + } + s.OnlyInChannels = value + } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode searchMessages#2a8f08a7: field query: %w", err) + return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field query: %w", err) } s.Query = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode searchMessages#2a8f08a7: field offset: %w", err) + return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field offset: %w", err) } s.Offset = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchMessages#2a8f08a7: field limit: %w", err) + return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field limit: %w", err) } s.Limit = value } { value, err := DecodeSearchMessagesFilter(b) if err != nil { - return fmt.Errorf("unable to decode searchMessages#2a8f08a7: field filter: %w", err) + return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field filter: %w", err) } s.Filter = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchMessages#2a8f08a7: field min_date: %w", err) + return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field min_date: %w", err) } s.MinDate = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchMessages#2a8f08a7: field max_date: %w", err) + return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field max_date: %w", err) } s.MaxDate = value } @@ -265,19 +282,22 @@ func (s *SearchMessagesRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *SearchMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode searchMessages#2a8f08a7 as nil") + return fmt.Errorf("can't encode searchMessages#31f9c3c9 as nil") } b.ObjStart() b.PutID("searchMessages") b.Comma() b.FieldStart("chat_list") if s.ChatList == nil { - return fmt.Errorf("unable to encode searchMessages#2a8f08a7: field chat_list is nil") + return fmt.Errorf("unable to encode searchMessages#31f9c3c9: field chat_list is nil") } if err := s.ChatList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchMessages#2a8f08a7: field chat_list: %w", err) + return fmt.Errorf("unable to encode searchMessages#31f9c3c9: field chat_list: %w", err) } b.Comma() + b.FieldStart("only_in_channels") + b.PutBool(s.OnlyInChannels) + b.Comma() b.FieldStart("query") b.PutString(s.Query) b.Comma() @@ -289,10 +309,10 @@ func (s *SearchMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("filter") if s.Filter == nil { - return fmt.Errorf("unable to encode searchMessages#2a8f08a7: field filter is nil") + return fmt.Errorf("unable to encode searchMessages#31f9c3c9: field filter is nil") } if err := s.Filter.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchMessages#2a8f08a7: field filter: %w", err) + return fmt.Errorf("unable to encode searchMessages#31f9c3c9: field filter: %w", err) } b.Comma() b.FieldStart("min_date") @@ -309,55 +329,61 @@ func (s *SearchMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *SearchMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode searchMessages#2a8f08a7 to nil") + return fmt.Errorf("can't decode searchMessages#31f9c3c9 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("searchMessages"); err != nil { - return fmt.Errorf("unable to decode searchMessages#2a8f08a7: %w", err) + return fmt.Errorf("unable to decode searchMessages#31f9c3c9: %w", err) } case "chat_list": value, err := DecodeTDLibJSONChatList(b) if err != nil { - return fmt.Errorf("unable to decode searchMessages#2a8f08a7: field chat_list: %w", err) + return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field chat_list: %w", err) } s.ChatList = value + case "only_in_channels": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field only_in_channels: %w", err) + } + s.OnlyInChannels = value case "query": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode searchMessages#2a8f08a7: field query: %w", err) + return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field query: %w", err) } s.Query = value case "offset": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode searchMessages#2a8f08a7: field offset: %w", err) + return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field offset: %w", err) } s.Offset = value case "limit": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchMessages#2a8f08a7: field limit: %w", err) + return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field limit: %w", err) } s.Limit = value case "filter": value, err := DecodeTDLibJSONSearchMessagesFilter(b) if err != nil { - return fmt.Errorf("unable to decode searchMessages#2a8f08a7: field filter: %w", err) + return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field filter: %w", err) } s.Filter = value case "min_date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchMessages#2a8f08a7: field min_date: %w", err) + return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field min_date: %w", err) } s.MinDate = value case "max_date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchMessages#2a8f08a7: field max_date: %w", err) + return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field max_date: %w", err) } s.MaxDate = value default: @@ -375,6 +401,14 @@ func (s *SearchMessagesRequest) GetChatList() (value ChatListClass) { return s.ChatList } +// GetOnlyInChannels returns value of OnlyInChannels field. +func (s *SearchMessagesRequest) GetOnlyInChannels() (value bool) { + if s == nil { + return + } + return s.OnlyInChannels +} + // GetQuery returns value of Query field. func (s *SearchMessagesRequest) GetQuery() (value string) { if s == nil { @@ -423,7 +457,7 @@ func (s *SearchMessagesRequest) GetMaxDate() (value int32) { return s.MaxDate } -// SearchMessages invokes method searchMessages#2a8f08a7 returning error if any. +// SearchMessages invokes method searchMessages#31f9c3c9 returning error if any. func (c *Client) SearchMessages(ctx context.Context, request *SearchMessagesRequest) (*FoundMessages, error) { var result FoundMessages diff --git a/tdapi/tl_send_story_gen.go b/tdapi/tl_send_story_gen.go index d68bbe1c88..e4e93de80d 100644 --- a/tdapi/tl_send_story_gen.go +++ b/tdapi/tl_send_story_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// SendStoryRequest represents TL type `sendStory#736858bb`. +// SendStoryRequest represents TL type `sendStory#e6ab3302`. type SendStoryRequest struct { // Identifier of the chat that will post the story ChatID int64 @@ -52,14 +52,14 @@ type SendStoryRequest struct { // Full identifier of the original story, which content was used to create the story FromStoryFullID StoryFullID // Pass true to keep the story accessible after expiration - IsPinned bool + IsPostedToChatPage bool // Pass true if the content of the story must be protected from forwarding and // screenshotting ProtectContent bool } // SendStoryRequestTypeID is TL type id of SendStoryRequest. -const SendStoryRequestTypeID = 0x736858bb +const SendStoryRequestTypeID = 0xe6ab3302 // Ensuring interfaces in compile-time for SendStoryRequest. var ( @@ -94,7 +94,7 @@ func (s *SendStoryRequest) Zero() bool { if !(s.FromStoryFullID.Zero()) { return false } - if !(s.IsPinned == false) { + if !(s.IsPostedToChatPage == false) { return false } if !(s.ProtectContent == false) { @@ -165,8 +165,8 @@ func (s *SendStoryRequest) TypeInfo() tdp.Type { SchemaName: "from_story_full_id", }, { - Name: "IsPinned", - SchemaName: "is_pinned", + Name: "IsPostedToChatPage", + SchemaName: "is_posted_to_chat_page", }, { Name: "ProtectContent", @@ -179,7 +179,7 @@ func (s *SendStoryRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *SendStoryRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode sendStory#736858bb as nil") + return fmt.Errorf("can't encode sendStory#e6ab3302 as nil") } b.PutID(SendStoryRequestTypeID) return s.EncodeBare(b) @@ -188,32 +188,32 @@ func (s *SendStoryRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *SendStoryRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode sendStory#736858bb as nil") + return fmt.Errorf("can't encode sendStory#e6ab3302 as nil") } b.PutInt53(s.ChatID) if s.Content == nil { - return fmt.Errorf("unable to encode sendStory#736858bb: field content is nil") + return fmt.Errorf("unable to encode sendStory#e6ab3302: field content is nil") } if err := s.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendStory#736858bb: field content: %w", err) + return fmt.Errorf("unable to encode sendStory#e6ab3302: field content: %w", err) } if err := s.Areas.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendStory#736858bb: field areas: %w", err) + return fmt.Errorf("unable to encode sendStory#e6ab3302: field areas: %w", err) } if err := s.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendStory#736858bb: field caption: %w", err) + return fmt.Errorf("unable to encode sendStory#e6ab3302: field caption: %w", err) } if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode sendStory#736858bb: field privacy_settings is nil") + return fmt.Errorf("unable to encode sendStory#e6ab3302: field privacy_settings is nil") } if err := s.PrivacySettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendStory#736858bb: field privacy_settings: %w", err) + return fmt.Errorf("unable to encode sendStory#e6ab3302: field privacy_settings: %w", err) } b.PutInt32(s.ActivePeriod) if err := s.FromStoryFullID.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendStory#736858bb: field from_story_full_id: %w", err) + return fmt.Errorf("unable to encode sendStory#e6ab3302: field from_story_full_id: %w", err) } - b.PutBool(s.IsPinned) + b.PutBool(s.IsPostedToChatPage) b.PutBool(s.ProtectContent) return nil } @@ -221,10 +221,10 @@ func (s *SendStoryRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *SendStoryRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode sendStory#736858bb to nil") + return fmt.Errorf("can't decode sendStory#e6ab3302 to nil") } if err := b.ConsumeID(SendStoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendStory#736858bb: %w", err) + return fmt.Errorf("unable to decode sendStory#e6ab3302: %w", err) } return s.DecodeBare(b) } @@ -232,62 +232,62 @@ func (s *SendStoryRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *SendStoryRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode sendStory#736858bb to nil") + return fmt.Errorf("can't decode sendStory#e6ab3302 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode sendStory#736858bb: field chat_id: %w", err) + return fmt.Errorf("unable to decode sendStory#e6ab3302: field chat_id: %w", err) } s.ChatID = value } { value, err := DecodeInputStoryContent(b) if err != nil { - return fmt.Errorf("unable to decode sendStory#736858bb: field content: %w", err) + return fmt.Errorf("unable to decode sendStory#e6ab3302: field content: %w", err) } s.Content = value } { if err := s.Areas.Decode(b); err != nil { - return fmt.Errorf("unable to decode sendStory#736858bb: field areas: %w", err) + return fmt.Errorf("unable to decode sendStory#e6ab3302: field areas: %w", err) } } { if err := s.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode sendStory#736858bb: field caption: %w", err) + return fmt.Errorf("unable to decode sendStory#e6ab3302: field caption: %w", err) } } { value, err := DecodeStoryPrivacySettings(b) if err != nil { - return fmt.Errorf("unable to decode sendStory#736858bb: field privacy_settings: %w", err) + return fmt.Errorf("unable to decode sendStory#e6ab3302: field privacy_settings: %w", err) } s.PrivacySettings = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode sendStory#736858bb: field active_period: %w", err) + return fmt.Errorf("unable to decode sendStory#e6ab3302: field active_period: %w", err) } s.ActivePeriod = value } { if err := s.FromStoryFullID.Decode(b); err != nil { - return fmt.Errorf("unable to decode sendStory#736858bb: field from_story_full_id: %w", err) + return fmt.Errorf("unable to decode sendStory#e6ab3302: field from_story_full_id: %w", err) } } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode sendStory#736858bb: field is_pinned: %w", err) + return fmt.Errorf("unable to decode sendStory#e6ab3302: field is_posted_to_chat_page: %w", err) } - s.IsPinned = value + s.IsPostedToChatPage = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode sendStory#736858bb: field protect_content: %w", err) + return fmt.Errorf("unable to decode sendStory#e6ab3302: field protect_content: %w", err) } s.ProtectContent = value } @@ -297,7 +297,7 @@ func (s *SendStoryRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *SendStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode sendStory#736858bb as nil") + return fmt.Errorf("can't encode sendStory#e6ab3302 as nil") } b.ObjStart() b.PutID("sendStory") @@ -307,28 +307,28 @@ func (s *SendStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("content") if s.Content == nil { - return fmt.Errorf("unable to encode sendStory#736858bb: field content is nil") + return fmt.Errorf("unable to encode sendStory#e6ab3302: field content is nil") } if err := s.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendStory#736858bb: field content: %w", err) + return fmt.Errorf("unable to encode sendStory#e6ab3302: field content: %w", err) } b.Comma() b.FieldStart("areas") if err := s.Areas.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendStory#736858bb: field areas: %w", err) + return fmt.Errorf("unable to encode sendStory#e6ab3302: field areas: %w", err) } b.Comma() b.FieldStart("caption") if err := s.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendStory#736858bb: field caption: %w", err) + return fmt.Errorf("unable to encode sendStory#e6ab3302: field caption: %w", err) } b.Comma() b.FieldStart("privacy_settings") if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode sendStory#736858bb: field privacy_settings is nil") + return fmt.Errorf("unable to encode sendStory#e6ab3302: field privacy_settings is nil") } if err := s.PrivacySettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendStory#736858bb: field privacy_settings: %w", err) + return fmt.Errorf("unable to encode sendStory#e6ab3302: field privacy_settings: %w", err) } b.Comma() b.FieldStart("active_period") @@ -336,11 +336,11 @@ func (s *SendStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("from_story_full_id") if err := s.FromStoryFullID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendStory#736858bb: field from_story_full_id: %w", err) + return fmt.Errorf("unable to encode sendStory#e6ab3302: field from_story_full_id: %w", err) } b.Comma() - b.FieldStart("is_pinned") - b.PutBool(s.IsPinned) + b.FieldStart("is_posted_to_chat_page") + b.PutBool(s.IsPostedToChatPage) b.Comma() b.FieldStart("protect_content") b.PutBool(s.ProtectContent) @@ -353,61 +353,61 @@ func (s *SendStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *SendStoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode sendStory#736858bb to nil") + return fmt.Errorf("can't decode sendStory#e6ab3302 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("sendStory"); err != nil { - return fmt.Errorf("unable to decode sendStory#736858bb: %w", err) + return fmt.Errorf("unable to decode sendStory#e6ab3302: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode sendStory#736858bb: field chat_id: %w", err) + return fmt.Errorf("unable to decode sendStory#e6ab3302: field chat_id: %w", err) } s.ChatID = value case "content": value, err := DecodeTDLibJSONInputStoryContent(b) if err != nil { - return fmt.Errorf("unable to decode sendStory#736858bb: field content: %w", err) + return fmt.Errorf("unable to decode sendStory#e6ab3302: field content: %w", err) } s.Content = value case "areas": if err := s.Areas.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sendStory#736858bb: field areas: %w", err) + return fmt.Errorf("unable to decode sendStory#e6ab3302: field areas: %w", err) } case "caption": if err := s.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sendStory#736858bb: field caption: %w", err) + return fmt.Errorf("unable to decode sendStory#e6ab3302: field caption: %w", err) } case "privacy_settings": value, err := DecodeTDLibJSONStoryPrivacySettings(b) if err != nil { - return fmt.Errorf("unable to decode sendStory#736858bb: field privacy_settings: %w", err) + return fmt.Errorf("unable to decode sendStory#e6ab3302: field privacy_settings: %w", err) } s.PrivacySettings = value case "active_period": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode sendStory#736858bb: field active_period: %w", err) + return fmt.Errorf("unable to decode sendStory#e6ab3302: field active_period: %w", err) } s.ActivePeriod = value case "from_story_full_id": if err := s.FromStoryFullID.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sendStory#736858bb: field from_story_full_id: %w", err) + return fmt.Errorf("unable to decode sendStory#e6ab3302: field from_story_full_id: %w", err) } - case "is_pinned": + case "is_posted_to_chat_page": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode sendStory#736858bb: field is_pinned: %w", err) + return fmt.Errorf("unable to decode sendStory#e6ab3302: field is_posted_to_chat_page: %w", err) } - s.IsPinned = value + s.IsPostedToChatPage = value case "protect_content": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode sendStory#736858bb: field protect_content: %w", err) + return fmt.Errorf("unable to decode sendStory#e6ab3302: field protect_content: %w", err) } s.ProtectContent = value default: @@ -473,12 +473,12 @@ func (s *SendStoryRequest) GetFromStoryFullID() (value StoryFullID) { return s.FromStoryFullID } -// GetIsPinned returns value of IsPinned field. -func (s *SendStoryRequest) GetIsPinned() (value bool) { +// GetIsPostedToChatPage returns value of IsPostedToChatPage field. +func (s *SendStoryRequest) GetIsPostedToChatPage() (value bool) { if s == nil { return } - return s.IsPinned + return s.IsPostedToChatPage } // GetProtectContent returns value of ProtectContent field. @@ -489,7 +489,7 @@ func (s *SendStoryRequest) GetProtectContent() (value bool) { return s.ProtectContent } -// SendStory invokes method sendStory#736858bb returning error if any. +// SendStory invokes method sendStory#e6ab3302 returning error if any. func (c *Client) SendStory(ctx context.Context, request *SendStoryRequest) (*Story, error) { var result Story diff --git a/tdapi/tl_set_chat_pinned_stories_gen.go b/tdapi/tl_set_chat_pinned_stories_gen.go new file mode 100644 index 0000000000..ae19b5313d --- /dev/null +++ b/tdapi/tl_set_chat_pinned_stories_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{} +) + +// SetChatPinnedStoriesRequest represents TL type `setChatPinnedStories#f5cb679f`. +type SetChatPinnedStoriesRequest struct { + // Identifier of the chat that posted the stories + ChatID int64 + // New list of pinned stories. All stories must be posted to the chat page first. There + // can be up to getOption("pinned_story_count_max") pinned stories on a chat page + StoryIDs []int32 +} + +// SetChatPinnedStoriesRequestTypeID is TL type id of SetChatPinnedStoriesRequest. +const SetChatPinnedStoriesRequestTypeID = 0xf5cb679f + +// Ensuring interfaces in compile-time for SetChatPinnedStoriesRequest. +var ( + _ bin.Encoder = &SetChatPinnedStoriesRequest{} + _ bin.Decoder = &SetChatPinnedStoriesRequest{} + _ bin.BareEncoder = &SetChatPinnedStoriesRequest{} + _ bin.BareDecoder = &SetChatPinnedStoriesRequest{} +) + +func (s *SetChatPinnedStoriesRequest) Zero() bool { + if s == nil { + return true + } + if !(s.ChatID == 0) { + return false + } + if !(s.StoryIDs == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SetChatPinnedStoriesRequest) String() string { + if s == nil { + return "SetChatPinnedStoriesRequest(nil)" + } + type Alias SetChatPinnedStoriesRequest + return fmt.Sprintf("SetChatPinnedStoriesRequest%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SetChatPinnedStoriesRequest) TypeID() uint32 { + return SetChatPinnedStoriesRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SetChatPinnedStoriesRequest) TypeName() string { + return "setChatPinnedStories" +} + +// TypeInfo returns info about TL type. +func (s *SetChatPinnedStoriesRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "setChatPinnedStories", + ID: SetChatPinnedStoriesRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "StoryIDs", + SchemaName: "story_ids", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SetChatPinnedStoriesRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setChatPinnedStories#f5cb679f as nil") + } + b.PutID(SetChatPinnedStoriesRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SetChatPinnedStoriesRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setChatPinnedStories#f5cb679f as nil") + } + b.PutInt53(s.ChatID) + b.PutInt(len(s.StoryIDs)) + for _, v := range s.StoryIDs { + b.PutInt32(v) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *SetChatPinnedStoriesRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setChatPinnedStories#f5cb679f to nil") + } + if err := b.ConsumeID(SetChatPinnedStoriesRequestTypeID); err != nil { + return fmt.Errorf("unable to decode setChatPinnedStories#f5cb679f: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SetChatPinnedStoriesRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setChatPinnedStories#f5cb679f to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setChatPinnedStories#f5cb679f: field chat_id: %w", err) + } + s.ChatID = value + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode setChatPinnedStories#f5cb679f: field story_ids: %w", err) + } + + if headerLen > 0 { + s.StoryIDs = 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 setChatPinnedStories#f5cb679f: field story_ids: %w", err) + } + s.StoryIDs = append(s.StoryIDs, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SetChatPinnedStoriesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode setChatPinnedStories#f5cb679f as nil") + } + b.ObjStart() + b.PutID("setChatPinnedStories") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(s.ChatID) + b.Comma() + b.FieldStart("story_ids") + b.ArrStart() + for _, v := range s.StoryIDs { + b.PutInt32(v) + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SetChatPinnedStoriesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode setChatPinnedStories#f5cb679f to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("setChatPinnedStories"); err != nil { + return fmt.Errorf("unable to decode setChatPinnedStories#f5cb679f: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setChatPinnedStories#f5cb679f: field chat_id: %w", err) + } + s.ChatID = value + case "story_ids": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode setChatPinnedStories#f5cb679f: field story_ids: %w", err) + } + s.StoryIDs = append(s.StoryIDs, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode setChatPinnedStories#f5cb679f: field story_ids: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (s *SetChatPinnedStoriesRequest) GetChatID() (value int64) { + if s == nil { + return + } + return s.ChatID +} + +// GetStoryIDs returns value of StoryIDs field. +func (s *SetChatPinnedStoriesRequest) GetStoryIDs() (value []int32) { + if s == nil { + return + } + return s.StoryIDs +} + +// SetChatPinnedStories invokes method setChatPinnedStories#f5cb679f returning error if any. +func (c *Client) SetChatPinnedStories(ctx context.Context, request *SetChatPinnedStoriesRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_set_reaction_notification_settings_gen.go b/tdapi/tl_set_reaction_notification_settings_gen.go new file mode 100644 index 0000000000..c756196089 --- /dev/null +++ b/tdapi/tl_set_reaction_notification_settings_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{} +) + +// SetReactionNotificationSettingsRequest represents TL type `setReactionNotificationSettings#46b2d495`. +type SetReactionNotificationSettingsRequest struct { + // The new notification settings for reactions + NotificationSettings ReactionNotificationSettings +} + +// SetReactionNotificationSettingsRequestTypeID is TL type id of SetReactionNotificationSettingsRequest. +const SetReactionNotificationSettingsRequestTypeID = 0x46b2d495 + +// Ensuring interfaces in compile-time for SetReactionNotificationSettingsRequest. +var ( + _ bin.Encoder = &SetReactionNotificationSettingsRequest{} + _ bin.Decoder = &SetReactionNotificationSettingsRequest{} + _ bin.BareEncoder = &SetReactionNotificationSettingsRequest{} + _ bin.BareDecoder = &SetReactionNotificationSettingsRequest{} +) + +func (s *SetReactionNotificationSettingsRequest) Zero() bool { + if s == nil { + return true + } + if !(s.NotificationSettings.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SetReactionNotificationSettingsRequest) String() string { + if s == nil { + return "SetReactionNotificationSettingsRequest(nil)" + } + type Alias SetReactionNotificationSettingsRequest + return fmt.Sprintf("SetReactionNotificationSettingsRequest%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SetReactionNotificationSettingsRequest) TypeID() uint32 { + return SetReactionNotificationSettingsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SetReactionNotificationSettingsRequest) TypeName() string { + return "setReactionNotificationSettings" +} + +// TypeInfo returns info about TL type. +func (s *SetReactionNotificationSettingsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "setReactionNotificationSettings", + ID: SetReactionNotificationSettingsRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "NotificationSettings", + SchemaName: "notification_settings", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SetReactionNotificationSettingsRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setReactionNotificationSettings#46b2d495 as nil") + } + b.PutID(SetReactionNotificationSettingsRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SetReactionNotificationSettingsRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setReactionNotificationSettings#46b2d495 as nil") + } + if err := s.NotificationSettings.Encode(b); err != nil { + return fmt.Errorf("unable to encode setReactionNotificationSettings#46b2d495: field notification_settings: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *SetReactionNotificationSettingsRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setReactionNotificationSettings#46b2d495 to nil") + } + if err := b.ConsumeID(SetReactionNotificationSettingsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode setReactionNotificationSettings#46b2d495: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SetReactionNotificationSettingsRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setReactionNotificationSettings#46b2d495 to nil") + } + { + if err := s.NotificationSettings.Decode(b); err != nil { + return fmt.Errorf("unable to decode setReactionNotificationSettings#46b2d495: field notification_settings: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SetReactionNotificationSettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode setReactionNotificationSettings#46b2d495 as nil") + } + b.ObjStart() + b.PutID("setReactionNotificationSettings") + b.Comma() + b.FieldStart("notification_settings") + if err := s.NotificationSettings.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode setReactionNotificationSettings#46b2d495: field notification_settings: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SetReactionNotificationSettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode setReactionNotificationSettings#46b2d495 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("setReactionNotificationSettings"); err != nil { + return fmt.Errorf("unable to decode setReactionNotificationSettings#46b2d495: %w", err) + } + case "notification_settings": + if err := s.NotificationSettings.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode setReactionNotificationSettings#46b2d495: field notification_settings: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetNotificationSettings returns value of NotificationSettings field. +func (s *SetReactionNotificationSettingsRequest) GetNotificationSettings() (value ReactionNotificationSettings) { + if s == nil { + return + } + return s.NotificationSettings +} + +// SetReactionNotificationSettings invokes method setReactionNotificationSettings#46b2d495 returning error if any. +func (c *Client) SetReactionNotificationSettings(ctx context.Context, notificationsettings ReactionNotificationSettings) error { + var ok Ok + + request := &SetReactionNotificationSettingsRequest{ + NotificationSettings: notificationsettings, + } + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_sponsored_message_gen.go b/tdapi/tl_sponsored_message_gen.go index 085d0daf06..e3c2a92aaf 100644 --- a/tdapi/tl_sponsored_message_gen.go +++ b/tdapi/tl_sponsored_message_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// SponsoredMessage represents TL type `sponsoredMessage#3748e46f`. +// SponsoredMessage represents TL type `sponsoredMessage#b78d4c25`. type SponsoredMessage struct { // Message identifier; unique for the chat to which the sponsored message belongs among // both ordinary and sponsored messages @@ -45,15 +45,21 @@ type SponsoredMessage struct { Content MessageContentClass // Information about the sponsor of the message Sponsor MessageSponsor - // If non-empty, text for the message action button + // Title of the sponsored message + Title string + // Text for the message action button ButtonText string + // Identifier of the accent color for title, button text and message background + AccentColorID int32 + // Identifier of a custom emoji to be shown on the message background; 0 if none + BackgroundCustomEmojiID int64 // If non-empty, additional information about the sponsored message to be shown along // with the message AdditionalInfo string } // SponsoredMessageTypeID is TL type id of SponsoredMessage. -const SponsoredMessageTypeID = 0x3748e46f +const SponsoredMessageTypeID = 0xb78d4c25 // Ensuring interfaces in compile-time for SponsoredMessage. var ( @@ -82,9 +88,18 @@ func (s *SponsoredMessage) Zero() bool { if !(s.Sponsor.Zero()) { return false } + if !(s.Title == "") { + return false + } if !(s.ButtonText == "") { return false } + if !(s.AccentColorID == 0) { + return false + } + if !(s.BackgroundCustomEmojiID == 0) { + return false + } if !(s.AdditionalInfo == "") { return false } @@ -144,10 +159,22 @@ func (s *SponsoredMessage) TypeInfo() tdp.Type { Name: "Sponsor", SchemaName: "sponsor", }, + { + Name: "Title", + SchemaName: "title", + }, { Name: "ButtonText", SchemaName: "button_text", }, + { + Name: "AccentColorID", + SchemaName: "accent_color_id", + }, + { + Name: "BackgroundCustomEmojiID", + SchemaName: "background_custom_emoji_id", + }, { Name: "AdditionalInfo", SchemaName: "additional_info", @@ -159,7 +186,7 @@ func (s *SponsoredMessage) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *SponsoredMessage) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode sponsoredMessage#3748e46f as nil") + return fmt.Errorf("can't encode sponsoredMessage#b78d4c25 as nil") } b.PutID(SponsoredMessageTypeID) return s.EncodeBare(b) @@ -168,21 +195,24 @@ func (s *SponsoredMessage) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *SponsoredMessage) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode sponsoredMessage#3748e46f as nil") + return fmt.Errorf("can't encode sponsoredMessage#b78d4c25 as nil") } b.PutInt53(s.MessageID) b.PutBool(s.IsRecommended) b.PutBool(s.CanBeReported) if s.Content == nil { - return fmt.Errorf("unable to encode sponsoredMessage#3748e46f: field content is nil") + return fmt.Errorf("unable to encode sponsoredMessage#b78d4c25: field content is nil") } if err := s.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#3748e46f: field content: %w", err) + return fmt.Errorf("unable to encode sponsoredMessage#b78d4c25: field content: %w", err) } if err := s.Sponsor.Encode(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#3748e46f: field sponsor: %w", err) + return fmt.Errorf("unable to encode sponsoredMessage#b78d4c25: field sponsor: %w", err) } + b.PutString(s.Title) b.PutString(s.ButtonText) + b.PutInt32(s.AccentColorID) + b.PutLong(s.BackgroundCustomEmojiID) b.PutString(s.AdditionalInfo) return nil } @@ -190,10 +220,10 @@ func (s *SponsoredMessage) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *SponsoredMessage) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode sponsoredMessage#3748e46f to nil") + return fmt.Errorf("can't decode sponsoredMessage#b78d4c25 to nil") } if err := b.ConsumeID(SponsoredMessageTypeID); err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#3748e46f: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: %w", err) } return s.DecodeBare(b) } @@ -201,52 +231,73 @@ func (s *SponsoredMessage) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *SponsoredMessage) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode sponsoredMessage#3748e46f to nil") + return fmt.Errorf("can't decode sponsoredMessage#b78d4c25 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#3748e46f: field message_id: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field message_id: %w", err) } s.MessageID = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#3748e46f: field is_recommended: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field is_recommended: %w", err) } s.IsRecommended = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#3748e46f: field can_be_reported: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field can_be_reported: %w", err) } s.CanBeReported = value } { value, err := DecodeMessageContent(b) if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#3748e46f: field content: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field content: %w", err) } s.Content = value } { if err := s.Sponsor.Decode(b); err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#3748e46f: field sponsor: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field sponsor: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#3748e46f: field button_text: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field title: %w", err) + } + s.Title = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field button_text: %w", err) } s.ButtonText = value } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field accent_color_id: %w", err) + } + s.AccentColorID = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field background_custom_emoji_id: %w", err) + } + s.BackgroundCustomEmojiID = value + } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#3748e46f: field additional_info: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field additional_info: %w", err) } s.AdditionalInfo = value } @@ -256,7 +307,7 @@ func (s *SponsoredMessage) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *SponsoredMessage) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode sponsoredMessage#3748e46f as nil") + return fmt.Errorf("can't encode sponsoredMessage#b78d4c25 as nil") } b.ObjStart() b.PutID("sponsoredMessage") @@ -272,20 +323,29 @@ func (s *SponsoredMessage) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("content") if s.Content == nil { - return fmt.Errorf("unable to encode sponsoredMessage#3748e46f: field content is nil") + return fmt.Errorf("unable to encode sponsoredMessage#b78d4c25: field content is nil") } if err := s.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#3748e46f: field content: %w", err) + return fmt.Errorf("unable to encode sponsoredMessage#b78d4c25: field content: %w", err) } b.Comma() b.FieldStart("sponsor") if err := s.Sponsor.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#3748e46f: field sponsor: %w", err) + return fmt.Errorf("unable to encode sponsoredMessage#b78d4c25: field sponsor: %w", err) } b.Comma() + b.FieldStart("title") + b.PutString(s.Title) + b.Comma() b.FieldStart("button_text") b.PutString(s.ButtonText) b.Comma() + b.FieldStart("accent_color_id") + b.PutInt32(s.AccentColorID) + b.Comma() + b.FieldStart("background_custom_emoji_id") + b.PutLong(s.BackgroundCustomEmojiID) + b.Comma() b.FieldStart("additional_info") b.PutString(s.AdditionalInfo) b.Comma() @@ -297,53 +357,71 @@ func (s *SponsoredMessage) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *SponsoredMessage) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode sponsoredMessage#3748e46f to nil") + return fmt.Errorf("can't decode sponsoredMessage#b78d4c25 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("sponsoredMessage"); err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#3748e46f: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: %w", err) } case "message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#3748e46f: field message_id: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field message_id: %w", err) } s.MessageID = value case "is_recommended": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#3748e46f: field is_recommended: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field is_recommended: %w", err) } s.IsRecommended = value case "can_be_reported": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#3748e46f: field can_be_reported: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field can_be_reported: %w", err) } s.CanBeReported = value case "content": value, err := DecodeTDLibJSONMessageContent(b) if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#3748e46f: field content: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field content: %w", err) } s.Content = value case "sponsor": if err := s.Sponsor.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#3748e46f: field sponsor: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field sponsor: %w", err) } + case "title": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field title: %w", err) + } + s.Title = value case "button_text": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#3748e46f: field button_text: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field button_text: %w", err) } s.ButtonText = value + case "accent_color_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field accent_color_id: %w", err) + } + s.AccentColorID = value + case "background_custom_emoji_id": + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field background_custom_emoji_id: %w", err) + } + s.BackgroundCustomEmojiID = value case "additional_info": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#3748e46f: field additional_info: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field additional_info: %w", err) } s.AdditionalInfo = value default: @@ -393,6 +471,14 @@ func (s *SponsoredMessage) GetSponsor() (value MessageSponsor) { return s.Sponsor } +// GetTitle returns value of Title field. +func (s *SponsoredMessage) GetTitle() (value string) { + if s == nil { + return + } + return s.Title +} + // GetButtonText returns value of ButtonText field. func (s *SponsoredMessage) GetButtonText() (value string) { if s == nil { @@ -401,6 +487,22 @@ func (s *SponsoredMessage) GetButtonText() (value string) { return s.ButtonText } +// GetAccentColorID returns value of AccentColorID field. +func (s *SponsoredMessage) GetAccentColorID() (value int32) { + if s == nil { + return + } + return s.AccentColorID +} + +// GetBackgroundCustomEmojiID returns value of BackgroundCustomEmojiID field. +func (s *SponsoredMessage) GetBackgroundCustomEmojiID() (value int64) { + if s == nil { + return + } + return s.BackgroundCustomEmojiID +} + // GetAdditionalInfo returns value of AdditionalInfo field. func (s *SponsoredMessage) GetAdditionalInfo() (value string) { if s == nil { diff --git a/tdapi/tl_stories_gen.go b/tdapi/tl_stories_gen.go index e6cdff90e4..d0b1d71d87 100644 --- a/tdapi/tl_stories_gen.go +++ b/tdapi/tl_stories_gen.go @@ -31,16 +31,19 @@ var ( _ = tdjson.Encoder{} ) -// Stories represents TL type `stories#5a860711`. +// Stories represents TL type `stories#b88ff8ff`. type Stories struct { // Approximate total number of stories found TotalCount int32 // The list of stories Stories []Story + // Identifiers of the pinned stories; returned only in getChatPostedToChatPageStories + // with from_story_id == 0 + PinnedStoryIDs []int32 } // StoriesTypeID is TL type id of Stories. -const StoriesTypeID = 0x5a860711 +const StoriesTypeID = 0xb88ff8ff // Ensuring interfaces in compile-time for Stories. var ( @@ -60,6 +63,9 @@ func (s *Stories) Zero() bool { if !(s.Stories == nil) { return false } + if !(s.PinnedStoryIDs == nil) { + return false + } return true } @@ -104,6 +110,10 @@ func (s *Stories) TypeInfo() tdp.Type { Name: "Stories", SchemaName: "stories", }, + { + Name: "PinnedStoryIDs", + SchemaName: "pinned_story_ids", + }, } return typ } @@ -111,7 +121,7 @@ func (s *Stories) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *Stories) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode stories#5a860711 as nil") + return fmt.Errorf("can't encode stories#b88ff8ff as nil") } b.PutID(StoriesTypeID) return s.EncodeBare(b) @@ -120,25 +130,29 @@ func (s *Stories) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *Stories) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode stories#5a860711 as nil") + return fmt.Errorf("can't encode stories#b88ff8ff as nil") } b.PutInt32(s.TotalCount) b.PutInt(len(s.Stories)) for idx, v := range s.Stories { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare stories#5a860711: field stories element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare stories#b88ff8ff: field stories element with index %d: %w", idx, err) } } + b.PutInt(len(s.PinnedStoryIDs)) + for _, v := range s.PinnedStoryIDs { + b.PutInt32(v) + } return nil } // Decode implements bin.Decoder. func (s *Stories) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode stories#5a860711 to nil") + return fmt.Errorf("can't decode stories#b88ff8ff to nil") } if err := b.ConsumeID(StoriesTypeID); err != nil { - return fmt.Errorf("unable to decode stories#5a860711: %w", err) + return fmt.Errorf("unable to decode stories#b88ff8ff: %w", err) } return s.DecodeBare(b) } @@ -146,19 +160,19 @@ func (s *Stories) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *Stories) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode stories#5a860711 to nil") + return fmt.Errorf("can't decode stories#b88ff8ff to nil") } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode stories#5a860711: field total_count: %w", err) + return fmt.Errorf("unable to decode stories#b88ff8ff: field total_count: %w", err) } s.TotalCount = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode stories#5a860711: field stories: %w", err) + return fmt.Errorf("unable to decode stories#b88ff8ff: field stories: %w", err) } if headerLen > 0 { @@ -167,18 +181,35 @@ func (s *Stories) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value Story if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare stories#5a860711: field stories: %w", err) + return fmt.Errorf("unable to decode bare stories#b88ff8ff: field stories: %w", err) } s.Stories = append(s.Stories, value) } } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode stories#b88ff8ff: field pinned_story_ids: %w", err) + } + + if headerLen > 0 { + s.PinnedStoryIDs = 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 stories#b88ff8ff: field pinned_story_ids: %w", err) + } + s.PinnedStoryIDs = append(s.PinnedStoryIDs, value) + } + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *Stories) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode stories#5a860711 as nil") + return fmt.Errorf("can't encode stories#b88ff8ff as nil") } b.ObjStart() b.PutID("stories") @@ -190,13 +221,22 @@ func (s *Stories) EncodeTDLibJSON(b tdjson.Encoder) error { b.ArrStart() for idx, v := range s.Stories { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stories#5a860711: field stories element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode stories#b88ff8ff: field stories element with index %d: %w", idx, err) } b.Comma() } b.StripComma() b.ArrEnd() b.Comma() + b.FieldStart("pinned_story_ids") + b.ArrStart() + for _, v := range s.PinnedStoryIDs { + b.PutInt32(v) + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -205,31 +245,42 @@ func (s *Stories) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *Stories) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode stories#5a860711 to nil") + return fmt.Errorf("can't decode stories#b88ff8ff to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("stories"); err != nil { - return fmt.Errorf("unable to decode stories#5a860711: %w", err) + return fmt.Errorf("unable to decode stories#b88ff8ff: %w", err) } case "total_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode stories#5a860711: field total_count: %w", err) + return fmt.Errorf("unable to decode stories#b88ff8ff: field total_count: %w", err) } s.TotalCount = value case "stories": if err := b.Arr(func(b tdjson.Decoder) error { var value Story if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode stories#5a860711: field stories: %w", err) + return fmt.Errorf("unable to decode stories#b88ff8ff: field stories: %w", err) } s.Stories = append(s.Stories, value) return nil }); err != nil { - return fmt.Errorf("unable to decode stories#5a860711: field stories: %w", err) + return fmt.Errorf("unable to decode stories#b88ff8ff: field stories: %w", err) + } + case "pinned_story_ids": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode stories#b88ff8ff: field pinned_story_ids: %w", err) + } + s.PinnedStoryIDs = append(s.PinnedStoryIDs, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode stories#b88ff8ff: field pinned_story_ids: %w", err) } default: return b.Skip() @@ -253,3 +304,11 @@ func (s *Stories) GetStories() (value []Story) { } return s.Stories } + +// GetPinnedStoryIDs returns value of PinnedStoryIDs field. +func (s *Stories) GetPinnedStoryIDs() (value []int32) { + if s == nil { + return + } + return s.PinnedStoryIDs +} diff --git a/tdapi/tl_story_gen.go b/tdapi/tl_story_gen.go index 0f95f9eb59..fb01ca5315 100644 --- a/tdapi/tl_story_gen.go +++ b/tdapi/tl_story_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// Story represents TL type `story#27f4e5b1`. +// Story represents TL type `story#84cdc9d1`. type Story struct { // Unique story identifier among stories of the given sender ID int32 @@ -50,7 +50,7 @@ type Story struct { IsEdited bool // True, if the story is saved in the sender's profile and will be available there after // expiration - IsPinned bool + IsPostedToChatPage bool // True, if the story is visible only for the current user IsVisibleOnlyForSelf bool // True, if the story can be deleted @@ -62,8 +62,8 @@ type Story struct { CanBeForwarded bool // True, if the story can be replied in the chat with the story sender CanBeReplied bool - // True, if the story's is_pinned value can be changed - CanToggleIsPinned bool + // True, if the story's is_posted_to_chat_page value can be changed + CanToggleIsPostedToChatPage bool // True, if the story statistics are available through getStoryStatistics CanGetStatistics bool // True, if interactions with the story can be received through getStoryInteractions @@ -89,7 +89,7 @@ type Story struct { } // StoryTypeID is TL type id of Story. -const StoryTypeID = 0x27f4e5b1 +const StoryTypeID = 0x84cdc9d1 // Ensuring interfaces in compile-time for Story. var ( @@ -124,7 +124,7 @@ func (s *Story) Zero() bool { if !(s.IsEdited == false) { return false } - if !(s.IsPinned == false) { + if !(s.IsPostedToChatPage == false) { return false } if !(s.IsVisibleOnlyForSelf == false) { @@ -142,7 +142,7 @@ func (s *Story) Zero() bool { if !(s.CanBeReplied == false) { return false } - if !(s.CanToggleIsPinned == false) { + if !(s.CanToggleIsPostedToChatPage == false) { return false } if !(s.CanGetStatistics == false) { @@ -240,8 +240,8 @@ func (s *Story) TypeInfo() tdp.Type { SchemaName: "is_edited", }, { - Name: "IsPinned", - SchemaName: "is_pinned", + Name: "IsPostedToChatPage", + SchemaName: "is_posted_to_chat_page", }, { Name: "IsVisibleOnlyForSelf", @@ -264,8 +264,8 @@ func (s *Story) TypeInfo() tdp.Type { SchemaName: "can_be_replied", }, { - Name: "CanToggleIsPinned", - SchemaName: "can_toggle_is_pinned", + Name: "CanToggleIsPostedToChatPage", + SchemaName: "can_toggle_is_posted_to_chat_page", }, { Name: "CanGetStatistics", @@ -314,7 +314,7 @@ func (s *Story) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *Story) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode story#27f4e5b1 as nil") + return fmt.Errorf("can't encode story#84cdc9d1 as nil") } b.PutID(StoryTypeID) return s.EncodeBare(b) @@ -323,62 +323,62 @@ func (s *Story) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *Story) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode story#27f4e5b1 as nil") + return fmt.Errorf("can't encode story#84cdc9d1 as nil") } b.PutInt32(s.ID) b.PutInt53(s.SenderChatID) if s.SenderID == nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field sender_id is nil") + return fmt.Errorf("unable to encode story#84cdc9d1: field sender_id is nil") } if err := s.SenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field sender_id: %w", err) + return fmt.Errorf("unable to encode story#84cdc9d1: field sender_id: %w", err) } b.PutInt32(s.Date) b.PutBool(s.IsBeingSent) b.PutBool(s.IsBeingEdited) b.PutBool(s.IsEdited) - b.PutBool(s.IsPinned) + b.PutBool(s.IsPostedToChatPage) b.PutBool(s.IsVisibleOnlyForSelf) b.PutBool(s.CanBeDeleted) b.PutBool(s.CanBeEdited) b.PutBool(s.CanBeForwarded) b.PutBool(s.CanBeReplied) - b.PutBool(s.CanToggleIsPinned) + b.PutBool(s.CanToggleIsPostedToChatPage) b.PutBool(s.CanGetStatistics) b.PutBool(s.CanGetInteractions) b.PutBool(s.HasExpiredViewers) if err := s.RepostInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field repost_info: %w", err) + return fmt.Errorf("unable to encode story#84cdc9d1: field repost_info: %w", err) } if err := s.InteractionInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field interaction_info: %w", err) + return fmt.Errorf("unable to encode story#84cdc9d1: field interaction_info: %w", err) } if s.ChosenReactionType == nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field chosen_reaction_type is nil") + return fmt.Errorf("unable to encode story#84cdc9d1: field chosen_reaction_type is nil") } if err := s.ChosenReactionType.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field chosen_reaction_type: %w", err) + return fmt.Errorf("unable to encode story#84cdc9d1: field chosen_reaction_type: %w", err) } if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field privacy_settings is nil") + return fmt.Errorf("unable to encode story#84cdc9d1: field privacy_settings is nil") } if err := s.PrivacySettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field privacy_settings: %w", err) + return fmt.Errorf("unable to encode story#84cdc9d1: field privacy_settings: %w", err) } if s.Content == nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field content is nil") + return fmt.Errorf("unable to encode story#84cdc9d1: field content is nil") } if err := s.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field content: %w", err) + return fmt.Errorf("unable to encode story#84cdc9d1: field content: %w", err) } b.PutInt(len(s.Areas)) for idx, v := range s.Areas { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare story#27f4e5b1: field areas element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare story#84cdc9d1: field areas element with index %d: %w", idx, err) } } if err := s.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field caption: %w", err) + return fmt.Errorf("unable to encode story#84cdc9d1: field caption: %w", err) } return nil } @@ -386,10 +386,10 @@ func (s *Story) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *Story) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode story#27f4e5b1 to nil") + return fmt.Errorf("can't decode story#84cdc9d1 to nil") } if err := b.ConsumeID(StoryTypeID); err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: %w", err) } return s.DecodeBare(b) } @@ -397,162 +397,162 @@ func (s *Story) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *Story) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode story#27f4e5b1 to nil") + return fmt.Errorf("can't decode story#84cdc9d1 to nil") } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field id: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field id: %w", err) } s.ID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field sender_chat_id: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field sender_chat_id: %w", err) } s.SenderChatID = value } { value, err := DecodeMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field sender_id: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field sender_id: %w", err) } s.SenderID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field date: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field date: %w", err) } s.Date = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field is_being_sent: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field is_being_sent: %w", err) } s.IsBeingSent = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field is_being_edited: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field is_being_edited: %w", err) } s.IsBeingEdited = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field is_edited: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field is_edited: %w", err) } s.IsEdited = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field is_pinned: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field is_posted_to_chat_page: %w", err) } - s.IsPinned = value + s.IsPostedToChatPage = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field is_visible_only_for_self: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field is_visible_only_for_self: %w", err) } s.IsVisibleOnlyForSelf = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field can_be_deleted: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field can_be_deleted: %w", err) } s.CanBeDeleted = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field can_be_edited: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field can_be_edited: %w", err) } s.CanBeEdited = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field can_be_forwarded: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field can_be_forwarded: %w", err) } s.CanBeForwarded = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field can_be_replied: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field can_be_replied: %w", err) } s.CanBeReplied = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field can_toggle_is_pinned: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field can_toggle_is_posted_to_chat_page: %w", err) } - s.CanToggleIsPinned = value + s.CanToggleIsPostedToChatPage = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field can_get_statistics: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field can_get_statistics: %w", err) } s.CanGetStatistics = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field can_get_interactions: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field can_get_interactions: %w", err) } s.CanGetInteractions = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field has_expired_viewers: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field has_expired_viewers: %w", err) } s.HasExpiredViewers = value } { if err := s.RepostInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field repost_info: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field repost_info: %w", err) } } { if err := s.InteractionInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field interaction_info: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field interaction_info: %w", err) } } { value, err := DecodeReactionType(b) if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field chosen_reaction_type: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field chosen_reaction_type: %w", err) } s.ChosenReactionType = value } { value, err := DecodeStoryPrivacySettings(b) if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field privacy_settings: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field privacy_settings: %w", err) } s.PrivacySettings = value } { value, err := DecodeStoryContent(b) if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field content: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field content: %w", err) } s.Content = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field areas: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field areas: %w", err) } if headerLen > 0 { @@ -561,14 +561,14 @@ func (s *Story) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value StoryArea if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare story#27f4e5b1: field areas: %w", err) + return fmt.Errorf("unable to decode bare story#84cdc9d1: field areas: %w", err) } s.Areas = append(s.Areas, value) } } { if err := s.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field caption: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field caption: %w", err) } } return nil @@ -577,7 +577,7 @@ func (s *Story) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *Story) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode story#27f4e5b1 as nil") + return fmt.Errorf("can't encode story#84cdc9d1 as nil") } b.ObjStart() b.PutID("story") @@ -590,10 +590,10 @@ func (s *Story) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("sender_id") if s.SenderID == nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field sender_id is nil") + return fmt.Errorf("unable to encode story#84cdc9d1: field sender_id is nil") } if err := s.SenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field sender_id: %w", err) + return fmt.Errorf("unable to encode story#84cdc9d1: field sender_id: %w", err) } b.Comma() b.FieldStart("date") @@ -608,8 +608,8 @@ func (s *Story) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("is_edited") b.PutBool(s.IsEdited) b.Comma() - b.FieldStart("is_pinned") - b.PutBool(s.IsPinned) + b.FieldStart("is_posted_to_chat_page") + b.PutBool(s.IsPostedToChatPage) b.Comma() b.FieldStart("is_visible_only_for_self") b.PutBool(s.IsVisibleOnlyForSelf) @@ -626,8 +626,8 @@ func (s *Story) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("can_be_replied") b.PutBool(s.CanBeReplied) b.Comma() - b.FieldStart("can_toggle_is_pinned") - b.PutBool(s.CanToggleIsPinned) + b.FieldStart("can_toggle_is_posted_to_chat_page") + b.PutBool(s.CanToggleIsPostedToChatPage) b.Comma() b.FieldStart("can_get_statistics") b.PutBool(s.CanGetStatistics) @@ -640,43 +640,43 @@ func (s *Story) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("repost_info") if err := s.RepostInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field repost_info: %w", err) + return fmt.Errorf("unable to encode story#84cdc9d1: field repost_info: %w", err) } b.Comma() b.FieldStart("interaction_info") if err := s.InteractionInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field interaction_info: %w", err) + return fmt.Errorf("unable to encode story#84cdc9d1: field interaction_info: %w", err) } b.Comma() b.FieldStart("chosen_reaction_type") if s.ChosenReactionType == nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field chosen_reaction_type is nil") + return fmt.Errorf("unable to encode story#84cdc9d1: field chosen_reaction_type is nil") } if err := s.ChosenReactionType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field chosen_reaction_type: %w", err) + return fmt.Errorf("unable to encode story#84cdc9d1: field chosen_reaction_type: %w", err) } b.Comma() b.FieldStart("privacy_settings") if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field privacy_settings is nil") + return fmt.Errorf("unable to encode story#84cdc9d1: field privacy_settings is nil") } if err := s.PrivacySettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field privacy_settings: %w", err) + return fmt.Errorf("unable to encode story#84cdc9d1: field privacy_settings: %w", err) } b.Comma() b.FieldStart("content") if s.Content == nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field content is nil") + return fmt.Errorf("unable to encode story#84cdc9d1: field content is nil") } if err := s.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field content: %w", err) + return fmt.Errorf("unable to encode story#84cdc9d1: field content: %w", err) } b.Comma() b.FieldStart("areas") b.ArrStart() for idx, v := range s.Areas { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field areas element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode story#84cdc9d1: field areas element with index %d: %w", idx, err) } b.Comma() } @@ -685,7 +685,7 @@ func (s *Story) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("caption") if err := s.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#27f4e5b1: field caption: %w", err) + return fmt.Errorf("unable to encode story#84cdc9d1: field caption: %w", err) } b.Comma() b.StripComma() @@ -696,157 +696,157 @@ func (s *Story) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *Story) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode story#27f4e5b1 to nil") + return fmt.Errorf("can't decode story#84cdc9d1 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("story"); err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: %w", err) } case "id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field id: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field id: %w", err) } s.ID = value case "sender_chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field sender_chat_id: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field sender_chat_id: %w", err) } s.SenderChatID = value case "sender_id": value, err := DecodeTDLibJSONMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field sender_id: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field sender_id: %w", err) } s.SenderID = value case "date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field date: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field date: %w", err) } s.Date = value case "is_being_sent": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field is_being_sent: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field is_being_sent: %w", err) } s.IsBeingSent = value case "is_being_edited": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field is_being_edited: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field is_being_edited: %w", err) } s.IsBeingEdited = value case "is_edited": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field is_edited: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field is_edited: %w", err) } s.IsEdited = value - case "is_pinned": + case "is_posted_to_chat_page": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field is_pinned: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field is_posted_to_chat_page: %w", err) } - s.IsPinned = value + s.IsPostedToChatPage = value case "is_visible_only_for_self": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field is_visible_only_for_self: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field is_visible_only_for_self: %w", err) } s.IsVisibleOnlyForSelf = value case "can_be_deleted": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field can_be_deleted: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field can_be_deleted: %w", err) } s.CanBeDeleted = value case "can_be_edited": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field can_be_edited: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field can_be_edited: %w", err) } s.CanBeEdited = value case "can_be_forwarded": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field can_be_forwarded: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field can_be_forwarded: %w", err) } s.CanBeForwarded = value case "can_be_replied": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field can_be_replied: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field can_be_replied: %w", err) } s.CanBeReplied = value - case "can_toggle_is_pinned": + case "can_toggle_is_posted_to_chat_page": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field can_toggle_is_pinned: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field can_toggle_is_posted_to_chat_page: %w", err) } - s.CanToggleIsPinned = value + s.CanToggleIsPostedToChatPage = value case "can_get_statistics": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field can_get_statistics: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field can_get_statistics: %w", err) } s.CanGetStatistics = value case "can_get_interactions": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field can_get_interactions: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field can_get_interactions: %w", err) } s.CanGetInteractions = value case "has_expired_viewers": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field has_expired_viewers: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field has_expired_viewers: %w", err) } s.HasExpiredViewers = value case "repost_info": if err := s.RepostInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field repost_info: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field repost_info: %w", err) } case "interaction_info": if err := s.InteractionInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field interaction_info: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field interaction_info: %w", err) } case "chosen_reaction_type": value, err := DecodeTDLibJSONReactionType(b) if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field chosen_reaction_type: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field chosen_reaction_type: %w", err) } s.ChosenReactionType = value case "privacy_settings": value, err := DecodeTDLibJSONStoryPrivacySettings(b) if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field privacy_settings: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field privacy_settings: %w", err) } s.PrivacySettings = value case "content": value, err := DecodeTDLibJSONStoryContent(b) if err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field content: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field content: %w", err) } s.Content = value case "areas": if err := b.Arr(func(b tdjson.Decoder) error { var value StoryArea if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field areas: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field areas: %w", err) } s.Areas = append(s.Areas, value) return nil }); err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field areas: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field areas: %w", err) } case "caption": if err := s.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode story#27f4e5b1: field caption: %w", err) + return fmt.Errorf("unable to decode story#84cdc9d1: field caption: %w", err) } default: return b.Skip() @@ -911,12 +911,12 @@ func (s *Story) GetIsEdited() (value bool) { return s.IsEdited } -// GetIsPinned returns value of IsPinned field. -func (s *Story) GetIsPinned() (value bool) { +// GetIsPostedToChatPage returns value of IsPostedToChatPage field. +func (s *Story) GetIsPostedToChatPage() (value bool) { if s == nil { return } - return s.IsPinned + return s.IsPostedToChatPage } // GetIsVisibleOnlyForSelf returns value of IsVisibleOnlyForSelf field. @@ -959,12 +959,12 @@ func (s *Story) GetCanBeReplied() (value bool) { return s.CanBeReplied } -// GetCanToggleIsPinned returns value of CanToggleIsPinned field. -func (s *Story) GetCanToggleIsPinned() (value bool) { +// GetCanToggleIsPostedToChatPage returns value of CanToggleIsPostedToChatPage field. +func (s *Story) GetCanToggleIsPostedToChatPage() (value bool) { if s == nil { return } - return s.CanToggleIsPinned + return s.CanToggleIsPostedToChatPage } // GetCanGetStatistics returns value of CanGetStatistics field. diff --git a/tdapi/tl_suggested_action_gen.go b/tdapi/tl_suggested_action_gen.go index 5bd26d6e58..9827308b66 100644 --- a/tdapi/tl_suggested_action_gen.go +++ b/tdapi/tl_suggested_action_gen.go @@ -1543,6 +1543,172 @@ func (s *SuggestedActionSetBirthdate) DecodeTDLibJSON(b tdjson.Decoder) error { }) } +// SuggestedActionExtendPremium represents TL type `suggestedActionExtendPremium#de405cca`. +type SuggestedActionExtendPremium struct { + // A URL for managing Telegram Premium subscription + ManagePremiumSubscriptionURL string +} + +// SuggestedActionExtendPremiumTypeID is TL type id of SuggestedActionExtendPremium. +const SuggestedActionExtendPremiumTypeID = 0xde405cca + +// construct implements constructor of SuggestedActionClass. +func (s SuggestedActionExtendPremium) construct() SuggestedActionClass { return &s } + +// Ensuring interfaces in compile-time for SuggestedActionExtendPremium. +var ( + _ bin.Encoder = &SuggestedActionExtendPremium{} + _ bin.Decoder = &SuggestedActionExtendPremium{} + _ bin.BareEncoder = &SuggestedActionExtendPremium{} + _ bin.BareDecoder = &SuggestedActionExtendPremium{} + + _ SuggestedActionClass = &SuggestedActionExtendPremium{} +) + +func (s *SuggestedActionExtendPremium) Zero() bool { + if s == nil { + return true + } + if !(s.ManagePremiumSubscriptionURL == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SuggestedActionExtendPremium) String() string { + if s == nil { + return "SuggestedActionExtendPremium(nil)" + } + type Alias SuggestedActionExtendPremium + return fmt.Sprintf("SuggestedActionExtendPremium%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SuggestedActionExtendPremium) TypeID() uint32 { + return SuggestedActionExtendPremiumTypeID +} + +// TypeName returns name of type in TL schema. +func (*SuggestedActionExtendPremium) TypeName() string { + return "suggestedActionExtendPremium" +} + +// TypeInfo returns info about TL type. +func (s *SuggestedActionExtendPremium) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "suggestedActionExtendPremium", + ID: SuggestedActionExtendPremiumTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ManagePremiumSubscriptionURL", + SchemaName: "manage_premium_subscription_url", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SuggestedActionExtendPremium) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode suggestedActionExtendPremium#de405cca as nil") + } + b.PutID(SuggestedActionExtendPremiumTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SuggestedActionExtendPremium) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode suggestedActionExtendPremium#de405cca as nil") + } + b.PutString(s.ManagePremiumSubscriptionURL) + return nil +} + +// Decode implements bin.Decoder. +func (s *SuggestedActionExtendPremium) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode suggestedActionExtendPremium#de405cca to nil") + } + if err := b.ConsumeID(SuggestedActionExtendPremiumTypeID); err != nil { + return fmt.Errorf("unable to decode suggestedActionExtendPremium#de405cca: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SuggestedActionExtendPremium) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode suggestedActionExtendPremium#de405cca to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode suggestedActionExtendPremium#de405cca: field manage_premium_subscription_url: %w", err) + } + s.ManagePremiumSubscriptionURL = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SuggestedActionExtendPremium) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode suggestedActionExtendPremium#de405cca as nil") + } + b.ObjStart() + b.PutID("suggestedActionExtendPremium") + b.Comma() + b.FieldStart("manage_premium_subscription_url") + b.PutString(s.ManagePremiumSubscriptionURL) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SuggestedActionExtendPremium) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode suggestedActionExtendPremium#de405cca to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("suggestedActionExtendPremium"); err != nil { + return fmt.Errorf("unable to decode suggestedActionExtendPremium#de405cca: %w", err) + } + case "manage_premium_subscription_url": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode suggestedActionExtendPremium#de405cca: field manage_premium_subscription_url: %w", err) + } + s.ManagePremiumSubscriptionURL = value + default: + return b.Skip() + } + return nil + }) +} + +// GetManagePremiumSubscriptionURL returns value of ManagePremiumSubscriptionURL field. +func (s *SuggestedActionExtendPremium) GetManagePremiumSubscriptionURL() (value string) { + if s == nil { + return + } + return s.ManagePremiumSubscriptionURL +} + // SuggestedActionClassName is schema name of SuggestedActionClass. const SuggestedActionClassName = "SuggestedAction" @@ -1566,6 +1732,7 @@ const SuggestedActionClassName = "SuggestedAction" // case *tdapi.SuggestedActionSubscribeToAnnualPremium: // suggestedActionSubscribeToAnnualPremium#164978bb // case *tdapi.SuggestedActionGiftPremiumForChristmas: // suggestedActionGiftPremiumForChristmas#93b3ee6f // case *tdapi.SuggestedActionSetBirthdate: // suggestedActionSetBirthdate#eabd9b02 +// case *tdapi.SuggestedActionExtendPremium: // suggestedActionExtendPremium#de405cca // default: panic(v) // } type SuggestedActionClass interface { @@ -1674,6 +1841,13 @@ func DecodeSuggestedAction(buf *bin.Buffer) (SuggestedActionClass, error) { return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) } return &v, nil + case SuggestedActionExtendPremiumTypeID: + // Decoding suggestedActionExtendPremium#de405cca. + v := SuggestedActionExtendPremium{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", bin.NewUnexpectedID(id)) } @@ -1763,6 +1937,13 @@ func DecodeTDLibJSONSuggestedAction(buf tdjson.Decoder) (SuggestedActionClass, e return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) } return &v, nil + case "suggestedActionExtendPremium": + // Decoding suggestedActionExtendPremium#de405cca. + v := SuggestedActionExtendPremium{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", tdjson.NewUnexpectedID(id)) } diff --git a/tdapi/tl_toggle_has_sponsored_messages_enabled_gen.go b/tdapi/tl_toggle_has_sponsored_messages_enabled_gen.go new file mode 100644 index 0000000000..5cfe4abb16 --- /dev/null +++ b/tdapi/tl_toggle_has_sponsored_messages_enabled_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{} +) + +// ToggleHasSponsoredMessagesEnabledRequest represents TL type `toggleHasSponsoredMessagesEnabled#75055cec`. +type ToggleHasSponsoredMessagesEnabledRequest struct { + // Pass true to enable sponsored messages for the current user; false to disable them + HasSponsoredMessagesEnabled bool +} + +// ToggleHasSponsoredMessagesEnabledRequestTypeID is TL type id of ToggleHasSponsoredMessagesEnabledRequest. +const ToggleHasSponsoredMessagesEnabledRequestTypeID = 0x75055cec + +// Ensuring interfaces in compile-time for ToggleHasSponsoredMessagesEnabledRequest. +var ( + _ bin.Encoder = &ToggleHasSponsoredMessagesEnabledRequest{} + _ bin.Decoder = &ToggleHasSponsoredMessagesEnabledRequest{} + _ bin.BareEncoder = &ToggleHasSponsoredMessagesEnabledRequest{} + _ bin.BareDecoder = &ToggleHasSponsoredMessagesEnabledRequest{} +) + +func (t *ToggleHasSponsoredMessagesEnabledRequest) Zero() bool { + if t == nil { + return true + } + if !(t.HasSponsoredMessagesEnabled == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *ToggleHasSponsoredMessagesEnabledRequest) String() string { + if t == nil { + return "ToggleHasSponsoredMessagesEnabledRequest(nil)" + } + type Alias ToggleHasSponsoredMessagesEnabledRequest + return fmt.Sprintf("ToggleHasSponsoredMessagesEnabledRequest%+v", Alias(*t)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ToggleHasSponsoredMessagesEnabledRequest) TypeID() uint32 { + return ToggleHasSponsoredMessagesEnabledRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ToggleHasSponsoredMessagesEnabledRequest) TypeName() string { + return "toggleHasSponsoredMessagesEnabled" +} + +// TypeInfo returns info about TL type. +func (t *ToggleHasSponsoredMessagesEnabledRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "toggleHasSponsoredMessagesEnabled", + ID: ToggleHasSponsoredMessagesEnabledRequestTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "HasSponsoredMessagesEnabled", + SchemaName: "has_sponsored_messages_enabled", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *ToggleHasSponsoredMessagesEnabledRequest) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode toggleHasSponsoredMessagesEnabled#75055cec as nil") + } + b.PutID(ToggleHasSponsoredMessagesEnabledRequestTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *ToggleHasSponsoredMessagesEnabledRequest) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode toggleHasSponsoredMessagesEnabled#75055cec as nil") + } + b.PutBool(t.HasSponsoredMessagesEnabled) + return nil +} + +// Decode implements bin.Decoder. +func (t *ToggleHasSponsoredMessagesEnabledRequest) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode toggleHasSponsoredMessagesEnabled#75055cec to nil") + } + if err := b.ConsumeID(ToggleHasSponsoredMessagesEnabledRequestTypeID); err != nil { + return fmt.Errorf("unable to decode toggleHasSponsoredMessagesEnabled#75055cec: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *ToggleHasSponsoredMessagesEnabledRequest) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode toggleHasSponsoredMessagesEnabled#75055cec to nil") + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode toggleHasSponsoredMessagesEnabled#75055cec: field has_sponsored_messages_enabled: %w", err) + } + t.HasSponsoredMessagesEnabled = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (t *ToggleHasSponsoredMessagesEnabledRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if t == nil { + return fmt.Errorf("can't encode toggleHasSponsoredMessagesEnabled#75055cec as nil") + } + b.ObjStart() + b.PutID("toggleHasSponsoredMessagesEnabled") + b.Comma() + b.FieldStart("has_sponsored_messages_enabled") + b.PutBool(t.HasSponsoredMessagesEnabled) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (t *ToggleHasSponsoredMessagesEnabledRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if t == nil { + return fmt.Errorf("can't decode toggleHasSponsoredMessagesEnabled#75055cec to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("toggleHasSponsoredMessagesEnabled"); err != nil { + return fmt.Errorf("unable to decode toggleHasSponsoredMessagesEnabled#75055cec: %w", err) + } + case "has_sponsored_messages_enabled": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode toggleHasSponsoredMessagesEnabled#75055cec: field has_sponsored_messages_enabled: %w", err) + } + t.HasSponsoredMessagesEnabled = value + default: + return b.Skip() + } + return nil + }) +} + +// GetHasSponsoredMessagesEnabled returns value of HasSponsoredMessagesEnabled field. +func (t *ToggleHasSponsoredMessagesEnabledRequest) GetHasSponsoredMessagesEnabled() (value bool) { + if t == nil { + return + } + return t.HasSponsoredMessagesEnabled +} + +// ToggleHasSponsoredMessagesEnabled invokes method toggleHasSponsoredMessagesEnabled#75055cec returning error if any. +func (c *Client) ToggleHasSponsoredMessagesEnabled(ctx context.Context, hassponsoredmessagesenabled bool) error { + var ok Ok + + request := &ToggleHasSponsoredMessagesEnabledRequest{ + HasSponsoredMessagesEnabled: hassponsoredmessagesenabled, + } + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_toggle_story_is_pinned_gen.go b/tdapi/tl_toggle_story_is_pinned_gen.go deleted file mode 100644 index cbb47a62b9..0000000000 --- a/tdapi/tl_toggle_story_is_pinned_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -import ( - "context" - "errors" - "fmt" - "sort" - "strings" - - "go.uber.org/multierr" - - "github.com/gotd/td/bin" - "github.com/gotd/td/tdjson" - "github.com/gotd/td/tdp" - "github.com/gotd/td/tgerr" -) - -// No-op definition for keeping imports. -var ( - _ = bin.Buffer{} - _ = context.Background() - _ = fmt.Stringer(nil) - _ = strings.Builder{} - _ = errors.Is - _ = multierr.AppendInto - _ = sort.Ints - _ = tdp.Format - _ = tgerr.Error{} - _ = tdjson.Encoder{} -) - -// ToggleStoryIsPinnedRequest represents TL type `toggleStoryIsPinned#b493b30e`. -type ToggleStoryIsPinnedRequest struct { - // Identifier of the chat that posted the story - StorySenderChatID int64 - // Identifier of the story - StoryID int32 - // Pass true to make the story accessible after expiration; pass false to make it private - IsPinned bool -} - -// ToggleStoryIsPinnedRequestTypeID is TL type id of ToggleStoryIsPinnedRequest. -const ToggleStoryIsPinnedRequestTypeID = 0xb493b30e - -// Ensuring interfaces in compile-time for ToggleStoryIsPinnedRequest. -var ( - _ bin.Encoder = &ToggleStoryIsPinnedRequest{} - _ bin.Decoder = &ToggleStoryIsPinnedRequest{} - _ bin.BareEncoder = &ToggleStoryIsPinnedRequest{} - _ bin.BareDecoder = &ToggleStoryIsPinnedRequest{} -) - -func (t *ToggleStoryIsPinnedRequest) Zero() bool { - if t == nil { - return true - } - if !(t.StorySenderChatID == 0) { - return false - } - if !(t.StoryID == 0) { - return false - } - if !(t.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleStoryIsPinnedRequest) String() string { - if t == nil { - return "ToggleStoryIsPinnedRequest(nil)" - } - type Alias ToggleStoryIsPinnedRequest - return fmt.Sprintf("ToggleStoryIsPinnedRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleStoryIsPinnedRequest) TypeID() uint32 { - return ToggleStoryIsPinnedRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleStoryIsPinnedRequest) TypeName() string { - return "toggleStoryIsPinned" -} - -// TypeInfo returns info about TL type. -func (t *ToggleStoryIsPinnedRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleStoryIsPinned", - ID: ToggleStoryIsPinnedRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StorySenderChatID", - SchemaName: "story_sender_chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleStoryIsPinnedRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleStoryIsPinned#b493b30e as nil") - } - b.PutID(ToggleStoryIsPinnedRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleStoryIsPinnedRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleStoryIsPinned#b493b30e as nil") - } - b.PutInt53(t.StorySenderChatID) - b.PutInt32(t.StoryID) - b.PutBool(t.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleStoryIsPinnedRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleStoryIsPinned#b493b30e to nil") - } - if err := b.ConsumeID(ToggleStoryIsPinnedRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleStoryIsPinned#b493b30e: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleStoryIsPinnedRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleStoryIsPinned#b493b30e to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleStoryIsPinned#b493b30e: field story_sender_chat_id: %w", err) - } - t.StorySenderChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode toggleStoryIsPinned#b493b30e: field story_id: %w", err) - } - t.StoryID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleStoryIsPinned#b493b30e: field is_pinned: %w", err) - } - t.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleStoryIsPinnedRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleStoryIsPinned#b493b30e as nil") - } - b.ObjStart() - b.PutID("toggleStoryIsPinned") - b.Comma() - b.FieldStart("story_sender_chat_id") - b.PutInt53(t.StorySenderChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(t.StoryID) - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(t.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleStoryIsPinnedRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleStoryIsPinned#b493b30e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleStoryIsPinned"); err != nil { - return fmt.Errorf("unable to decode toggleStoryIsPinned#b493b30e: %w", err) - } - case "story_sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleStoryIsPinned#b493b30e: field story_sender_chat_id: %w", err) - } - t.StorySenderChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode toggleStoryIsPinned#b493b30e: field story_id: %w", err) - } - t.StoryID = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleStoryIsPinned#b493b30e: field is_pinned: %w", err) - } - t.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStorySenderChatID returns value of StorySenderChatID field. -func (t *ToggleStoryIsPinnedRequest) GetStorySenderChatID() (value int64) { - if t == nil { - return - } - return t.StorySenderChatID -} - -// GetStoryID returns value of StoryID field. -func (t *ToggleStoryIsPinnedRequest) GetStoryID() (value int32) { - if t == nil { - return - } - return t.StoryID -} - -// GetIsPinned returns value of IsPinned field. -func (t *ToggleStoryIsPinnedRequest) GetIsPinned() (value bool) { - if t == nil { - return - } - return t.IsPinned -} - -// ToggleStoryIsPinned invokes method toggleStoryIsPinned#b493b30e returning error if any. -func (c *Client) ToggleStoryIsPinned(ctx context.Context, request *ToggleStoryIsPinnedRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_story_is_posted_to_chat_page_gen.go b/tdapi/tl_toggle_story_is_posted_to_chat_page_gen.go new file mode 100644 index 0000000000..e7034ca362 --- /dev/null +++ b/tdapi/tl_toggle_story_is_posted_to_chat_page_gen.go @@ -0,0 +1,271 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// ToggleStoryIsPostedToChatPageRequest represents TL type `toggleStoryIsPostedToChatPage#ee0f4aff`. +type ToggleStoryIsPostedToChatPageRequest struct { + // Identifier of the chat that posted the story + StorySenderChatID int64 + // Identifier of the story + StoryID int32 + // Pass true to make the story accessible after expiration; pass false to make it private + IsPostedToChatPage bool +} + +// ToggleStoryIsPostedToChatPageRequestTypeID is TL type id of ToggleStoryIsPostedToChatPageRequest. +const ToggleStoryIsPostedToChatPageRequestTypeID = 0xee0f4aff + +// Ensuring interfaces in compile-time for ToggleStoryIsPostedToChatPageRequest. +var ( + _ bin.Encoder = &ToggleStoryIsPostedToChatPageRequest{} + _ bin.Decoder = &ToggleStoryIsPostedToChatPageRequest{} + _ bin.BareEncoder = &ToggleStoryIsPostedToChatPageRequest{} + _ bin.BareDecoder = &ToggleStoryIsPostedToChatPageRequest{} +) + +func (t *ToggleStoryIsPostedToChatPageRequest) Zero() bool { + if t == nil { + return true + } + if !(t.StorySenderChatID == 0) { + return false + } + if !(t.StoryID == 0) { + return false + } + if !(t.IsPostedToChatPage == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *ToggleStoryIsPostedToChatPageRequest) String() string { + if t == nil { + return "ToggleStoryIsPostedToChatPageRequest(nil)" + } + type Alias ToggleStoryIsPostedToChatPageRequest + return fmt.Sprintf("ToggleStoryIsPostedToChatPageRequest%+v", Alias(*t)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ToggleStoryIsPostedToChatPageRequest) TypeID() uint32 { + return ToggleStoryIsPostedToChatPageRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ToggleStoryIsPostedToChatPageRequest) TypeName() string { + return "toggleStoryIsPostedToChatPage" +} + +// TypeInfo returns info about TL type. +func (t *ToggleStoryIsPostedToChatPageRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "toggleStoryIsPostedToChatPage", + ID: ToggleStoryIsPostedToChatPageRequestTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "StorySenderChatID", + SchemaName: "story_sender_chat_id", + }, + { + Name: "StoryID", + SchemaName: "story_id", + }, + { + Name: "IsPostedToChatPage", + SchemaName: "is_posted_to_chat_page", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *ToggleStoryIsPostedToChatPageRequest) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode toggleStoryIsPostedToChatPage#ee0f4aff as nil") + } + b.PutID(ToggleStoryIsPostedToChatPageRequestTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *ToggleStoryIsPostedToChatPageRequest) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode toggleStoryIsPostedToChatPage#ee0f4aff as nil") + } + b.PutInt53(t.StorySenderChatID) + b.PutInt32(t.StoryID) + b.PutBool(t.IsPostedToChatPage) + return nil +} + +// Decode implements bin.Decoder. +func (t *ToggleStoryIsPostedToChatPageRequest) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode toggleStoryIsPostedToChatPage#ee0f4aff to nil") + } + if err := b.ConsumeID(ToggleStoryIsPostedToChatPageRequestTypeID); err != nil { + return fmt.Errorf("unable to decode toggleStoryIsPostedToChatPage#ee0f4aff: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *ToggleStoryIsPostedToChatPageRequest) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode toggleStoryIsPostedToChatPage#ee0f4aff to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode toggleStoryIsPostedToChatPage#ee0f4aff: field story_sender_chat_id: %w", err) + } + t.StorySenderChatID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode toggleStoryIsPostedToChatPage#ee0f4aff: field story_id: %w", err) + } + t.StoryID = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode toggleStoryIsPostedToChatPage#ee0f4aff: field is_posted_to_chat_page: %w", err) + } + t.IsPostedToChatPage = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (t *ToggleStoryIsPostedToChatPageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if t == nil { + return fmt.Errorf("can't encode toggleStoryIsPostedToChatPage#ee0f4aff as nil") + } + b.ObjStart() + b.PutID("toggleStoryIsPostedToChatPage") + b.Comma() + b.FieldStart("story_sender_chat_id") + b.PutInt53(t.StorySenderChatID) + b.Comma() + b.FieldStart("story_id") + b.PutInt32(t.StoryID) + b.Comma() + b.FieldStart("is_posted_to_chat_page") + b.PutBool(t.IsPostedToChatPage) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (t *ToggleStoryIsPostedToChatPageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if t == nil { + return fmt.Errorf("can't decode toggleStoryIsPostedToChatPage#ee0f4aff to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("toggleStoryIsPostedToChatPage"); err != nil { + return fmt.Errorf("unable to decode toggleStoryIsPostedToChatPage#ee0f4aff: %w", err) + } + case "story_sender_chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode toggleStoryIsPostedToChatPage#ee0f4aff: field story_sender_chat_id: %w", err) + } + t.StorySenderChatID = value + case "story_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode toggleStoryIsPostedToChatPage#ee0f4aff: field story_id: %w", err) + } + t.StoryID = value + case "is_posted_to_chat_page": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode toggleStoryIsPostedToChatPage#ee0f4aff: field is_posted_to_chat_page: %w", err) + } + t.IsPostedToChatPage = value + default: + return b.Skip() + } + return nil + }) +} + +// GetStorySenderChatID returns value of StorySenderChatID field. +func (t *ToggleStoryIsPostedToChatPageRequest) GetStorySenderChatID() (value int64) { + if t == nil { + return + } + return t.StorySenderChatID +} + +// GetStoryID returns value of StoryID field. +func (t *ToggleStoryIsPostedToChatPageRequest) GetStoryID() (value int32) { + if t == nil { + return + } + return t.StoryID +} + +// GetIsPostedToChatPage returns value of IsPostedToChatPage field. +func (t *ToggleStoryIsPostedToChatPageRequest) GetIsPostedToChatPage() (value bool) { + if t == nil { + return + } + return t.IsPostedToChatPage +} + +// ToggleStoryIsPostedToChatPage invokes method toggleStoryIsPostedToChatPage#ee0f4aff returning error if any. +func (c *Client) ToggleStoryIsPostedToChatPage(ctx context.Context, request *ToggleStoryIsPostedToChatPageRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_update_gen.go b/tdapi/tl_update_gen.go index c5f8b7a8bd..8c6db6e945 100644 --- a/tdapi/tl_update_gen.go +++ b/tdapi/tl_update_gen.go @@ -11773,6 +11773,172 @@ func (u *UpdateScopeNotificationSettings) GetNotificationSettings() (value Scope return u.NotificationSettings } +// UpdateReactionNotificationSettings represents TL type `updateReactionNotificationSettings#e54d17ec`. +type UpdateReactionNotificationSettings struct { + // The new notification settings + NotificationSettings ReactionNotificationSettings +} + +// UpdateReactionNotificationSettingsTypeID is TL type id of UpdateReactionNotificationSettings. +const UpdateReactionNotificationSettingsTypeID = 0xe54d17ec + +// construct implements constructor of UpdateClass. +func (u UpdateReactionNotificationSettings) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateReactionNotificationSettings. +var ( + _ bin.Encoder = &UpdateReactionNotificationSettings{} + _ bin.Decoder = &UpdateReactionNotificationSettings{} + _ bin.BareEncoder = &UpdateReactionNotificationSettings{} + _ bin.BareDecoder = &UpdateReactionNotificationSettings{} + + _ UpdateClass = &UpdateReactionNotificationSettings{} +) + +func (u *UpdateReactionNotificationSettings) Zero() bool { + if u == nil { + return true + } + if !(u.NotificationSettings.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateReactionNotificationSettings) String() string { + if u == nil { + return "UpdateReactionNotificationSettings(nil)" + } + type Alias UpdateReactionNotificationSettings + return fmt.Sprintf("UpdateReactionNotificationSettings%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateReactionNotificationSettings) TypeID() uint32 { + return UpdateReactionNotificationSettingsTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateReactionNotificationSettings) TypeName() string { + return "updateReactionNotificationSettings" +} + +// TypeInfo returns info about TL type. +func (u *UpdateReactionNotificationSettings) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateReactionNotificationSettings", + ID: UpdateReactionNotificationSettingsTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "NotificationSettings", + SchemaName: "notification_settings", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateReactionNotificationSettings) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateReactionNotificationSettings#e54d17ec as nil") + } + b.PutID(UpdateReactionNotificationSettingsTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateReactionNotificationSettings) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateReactionNotificationSettings#e54d17ec as nil") + } + if err := u.NotificationSettings.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateReactionNotificationSettings#e54d17ec: field notification_settings: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateReactionNotificationSettings) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateReactionNotificationSettings#e54d17ec to nil") + } + if err := b.ConsumeID(UpdateReactionNotificationSettingsTypeID); err != nil { + return fmt.Errorf("unable to decode updateReactionNotificationSettings#e54d17ec: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateReactionNotificationSettings) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateReactionNotificationSettings#e54d17ec to nil") + } + { + if err := u.NotificationSettings.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateReactionNotificationSettings#e54d17ec: field notification_settings: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpdateReactionNotificationSettings) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode updateReactionNotificationSettings#e54d17ec as nil") + } + b.ObjStart() + b.PutID("updateReactionNotificationSettings") + b.Comma() + b.FieldStart("notification_settings") + if err := u.NotificationSettings.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateReactionNotificationSettings#e54d17ec: field notification_settings: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpdateReactionNotificationSettings) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode updateReactionNotificationSettings#e54d17ec to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("updateReactionNotificationSettings"); err != nil { + return fmt.Errorf("unable to decode updateReactionNotificationSettings#e54d17ec: %w", err) + } + case "notification_settings": + if err := u.NotificationSettings.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode updateReactionNotificationSettings#e54d17ec: field notification_settings: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetNotificationSettings returns value of NotificationSettings field. +func (u *UpdateReactionNotificationSettings) GetNotificationSettings() (value ReactionNotificationSettings) { + if u == nil { + return + } + return u.NotificationSettings +} + // UpdateNotification represents TL type `updateNotification#8ee67ed4`. type UpdateNotification struct { // Unique notification group identifier @@ -23969,6 +24135,137 @@ func (u *UpdateSavedMessagesTags) GetTags() (value SavedMessagesTags) { return u.Tags } +// UpdateChatRevenueAmount represents TL type `updateChatRevenueAmount#32f4a5e1`. +type UpdateChatRevenueAmount struct { +} + +// UpdateChatRevenueAmountTypeID is TL type id of UpdateChatRevenueAmount. +const UpdateChatRevenueAmountTypeID = 0x32f4a5e1 + +// construct implements constructor of UpdateClass. +func (u UpdateChatRevenueAmount) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateChatRevenueAmount. +var ( + _ bin.Encoder = &UpdateChatRevenueAmount{} + _ bin.Decoder = &UpdateChatRevenueAmount{} + _ bin.BareEncoder = &UpdateChatRevenueAmount{} + _ bin.BareDecoder = &UpdateChatRevenueAmount{} + + _ UpdateClass = &UpdateChatRevenueAmount{} +) + +func (u *UpdateChatRevenueAmount) Zero() bool { + if u == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateChatRevenueAmount) String() string { + if u == nil { + return "UpdateChatRevenueAmount(nil)" + } + type Alias UpdateChatRevenueAmount + return fmt.Sprintf("UpdateChatRevenueAmount%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateChatRevenueAmount) TypeID() uint32 { + return UpdateChatRevenueAmountTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateChatRevenueAmount) TypeName() string { + return "updateChatRevenueAmount" +} + +// TypeInfo returns info about TL type. +func (u *UpdateChatRevenueAmount) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateChatRevenueAmount", + ID: UpdateChatRevenueAmountTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateChatRevenueAmount) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateChatRevenueAmount#32f4a5e1 as nil") + } + b.PutID(UpdateChatRevenueAmountTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateChatRevenueAmount) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateChatRevenueAmount#32f4a5e1 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateChatRevenueAmount) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateChatRevenueAmount#32f4a5e1 to nil") + } + if err := b.ConsumeID(UpdateChatRevenueAmountTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatRevenueAmount#32f4a5e1: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateChatRevenueAmount) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateChatRevenueAmount#32f4a5e1 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpdateChatRevenueAmount) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode updateChatRevenueAmount#32f4a5e1 as nil") + } + b.ObjStart() + b.PutID("updateChatRevenueAmount") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpdateChatRevenueAmount) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode updateChatRevenueAmount#32f4a5e1 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("updateChatRevenueAmount"); err != nil { + return fmt.Errorf("unable to decode updateChatRevenueAmount#32f4a5e1: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + // UpdateSpeechRecognitionTrial represents TL type `updateSpeechRecognitionTrial#ff4efcc1`. type UpdateSpeechRecognitionTrial struct { // The maximum allowed duration of media for speech recognition without Telegram Premium @@ -29327,7 +29624,7 @@ func (u *UpdatePollAnswer) GetOptionIDs() (value []int32) { return u.OptionIDs } -// UpdateChatMember represents TL type `updateChatMember#6000e29c`. +// UpdateChatMember represents TL type `updateChatMember#98865bc7`. type UpdateChatMember struct { // Chat identifier ChatID int64 @@ -29337,6 +29634,9 @@ type UpdateChatMember struct { Date int32 // If user has joined the chat using an invite link, the invite link; may be null InviteLink ChatInviteLink + // True, if the user has joined the chat after sending a join request and being approved + // by an administrator + ViaJoinRequest bool // True, if the user has joined the chat using an invite link for a chat folder ViaChatFolderInviteLink bool // Previous chat member @@ -29346,7 +29646,7 @@ type UpdateChatMember struct { } // UpdateChatMemberTypeID is TL type id of UpdateChatMember. -const UpdateChatMemberTypeID = 0x6000e29c +const UpdateChatMemberTypeID = 0x98865bc7 // construct implements constructor of UpdateClass. func (u UpdateChatMember) construct() UpdateClass { return &u } @@ -29377,6 +29677,9 @@ func (u *UpdateChatMember) Zero() bool { if !(u.InviteLink.Zero()) { return false } + if !(u.ViaJoinRequest == false) { + return false + } if !(u.ViaChatFolderInviteLink == false) { return false } @@ -29438,6 +29741,10 @@ func (u *UpdateChatMember) TypeInfo() tdp.Type { Name: "InviteLink", SchemaName: "invite_link", }, + { + Name: "ViaJoinRequest", + SchemaName: "via_join_request", + }, { Name: "ViaChatFolderInviteLink", SchemaName: "via_chat_folder_invite_link", @@ -29457,7 +29764,7 @@ func (u *UpdateChatMember) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (u *UpdateChatMember) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatMember#6000e29c as nil") + return fmt.Errorf("can't encode updateChatMember#98865bc7 as nil") } b.PutID(UpdateChatMemberTypeID) return u.EncodeBare(b) @@ -29466,20 +29773,21 @@ func (u *UpdateChatMember) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *UpdateChatMember) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatMember#6000e29c as nil") + return fmt.Errorf("can't encode updateChatMember#98865bc7 as nil") } b.PutInt53(u.ChatID) b.PutInt53(u.ActorUserID) b.PutInt32(u.Date) if err := u.InviteLink.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatMember#6000e29c: field invite_link: %w", err) + return fmt.Errorf("unable to encode updateChatMember#98865bc7: field invite_link: %w", err) } + b.PutBool(u.ViaJoinRequest) b.PutBool(u.ViaChatFolderInviteLink) if err := u.OldChatMember.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatMember#6000e29c: field old_chat_member: %w", err) + return fmt.Errorf("unable to encode updateChatMember#98865bc7: field old_chat_member: %w", err) } if err := u.NewChatMember.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatMember#6000e29c: field new_chat_member: %w", err) + return fmt.Errorf("unable to encode updateChatMember#98865bc7: field new_chat_member: %w", err) } return nil } @@ -29487,10 +29795,10 @@ func (u *UpdateChatMember) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (u *UpdateChatMember) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatMember#6000e29c to nil") + return fmt.Errorf("can't decode updateChatMember#98865bc7 to nil") } if err := b.ConsumeID(UpdateChatMemberTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatMember#6000e29c: %w", err) + return fmt.Errorf("unable to decode updateChatMember#98865bc7: %w", err) } return u.DecodeBare(b) } @@ -29498,49 +29806,56 @@ func (u *UpdateChatMember) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *UpdateChatMember) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatMember#6000e29c to nil") + return fmt.Errorf("can't decode updateChatMember#98865bc7 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatMember#6000e29c: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatMember#98865bc7: field chat_id: %w", err) } u.ChatID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatMember#6000e29c: field actor_user_id: %w", err) + return fmt.Errorf("unable to decode updateChatMember#98865bc7: field actor_user_id: %w", err) } u.ActorUserID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode updateChatMember#6000e29c: field date: %w", err) + return fmt.Errorf("unable to decode updateChatMember#98865bc7: field date: %w", err) } u.Date = value } { if err := u.InviteLink.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatMember#6000e29c: field invite_link: %w", err) + return fmt.Errorf("unable to decode updateChatMember#98865bc7: field invite_link: %w", err) } } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode updateChatMember#6000e29c: field via_chat_folder_invite_link: %w", err) + return fmt.Errorf("unable to decode updateChatMember#98865bc7: field via_join_request: %w", err) + } + u.ViaJoinRequest = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode updateChatMember#98865bc7: field via_chat_folder_invite_link: %w", err) } u.ViaChatFolderInviteLink = value } { if err := u.OldChatMember.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatMember#6000e29c: field old_chat_member: %w", err) + return fmt.Errorf("unable to decode updateChatMember#98865bc7: field old_chat_member: %w", err) } } { if err := u.NewChatMember.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatMember#6000e29c: field new_chat_member: %w", err) + return fmt.Errorf("unable to decode updateChatMember#98865bc7: field new_chat_member: %w", err) } } return nil @@ -29549,7 +29864,7 @@ func (u *UpdateChatMember) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UpdateChatMember) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatMember#6000e29c as nil") + return fmt.Errorf("can't encode updateChatMember#98865bc7 as nil") } b.ObjStart() b.PutID("updateChatMember") @@ -29565,20 +29880,23 @@ func (u *UpdateChatMember) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("invite_link") if err := u.InviteLink.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatMember#6000e29c: field invite_link: %w", err) + return fmt.Errorf("unable to encode updateChatMember#98865bc7: field invite_link: %w", err) } b.Comma() + b.FieldStart("via_join_request") + b.PutBool(u.ViaJoinRequest) + b.Comma() b.FieldStart("via_chat_folder_invite_link") b.PutBool(u.ViaChatFolderInviteLink) b.Comma() b.FieldStart("old_chat_member") if err := u.OldChatMember.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatMember#6000e29c: field old_chat_member: %w", err) + return fmt.Errorf("unable to encode updateChatMember#98865bc7: field old_chat_member: %w", err) } b.Comma() b.FieldStart("new_chat_member") if err := u.NewChatMember.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatMember#6000e29c: field new_chat_member: %w", err) + return fmt.Errorf("unable to encode updateChatMember#98865bc7: field new_chat_member: %w", err) } b.Comma() b.StripComma() @@ -29589,50 +29907,56 @@ func (u *UpdateChatMember) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UpdateChatMember) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatMember#6000e29c to nil") + return fmt.Errorf("can't decode updateChatMember#98865bc7 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("updateChatMember"); err != nil { - return fmt.Errorf("unable to decode updateChatMember#6000e29c: %w", err) + return fmt.Errorf("unable to decode updateChatMember#98865bc7: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatMember#6000e29c: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatMember#98865bc7: field chat_id: %w", err) } u.ChatID = value case "actor_user_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatMember#6000e29c: field actor_user_id: %w", err) + return fmt.Errorf("unable to decode updateChatMember#98865bc7: field actor_user_id: %w", err) } u.ActorUserID = value case "date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode updateChatMember#6000e29c: field date: %w", err) + return fmt.Errorf("unable to decode updateChatMember#98865bc7: field date: %w", err) } u.Date = value case "invite_link": if err := u.InviteLink.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatMember#6000e29c: field invite_link: %w", err) + return fmt.Errorf("unable to decode updateChatMember#98865bc7: field invite_link: %w", err) } + case "via_join_request": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode updateChatMember#98865bc7: field via_join_request: %w", err) + } + u.ViaJoinRequest = value case "via_chat_folder_invite_link": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode updateChatMember#6000e29c: field via_chat_folder_invite_link: %w", err) + return fmt.Errorf("unable to decode updateChatMember#98865bc7: field via_chat_folder_invite_link: %w", err) } u.ViaChatFolderInviteLink = value case "old_chat_member": if err := u.OldChatMember.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatMember#6000e29c: field old_chat_member: %w", err) + return fmt.Errorf("unable to decode updateChatMember#98865bc7: field old_chat_member: %w", err) } case "new_chat_member": if err := u.NewChatMember.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatMember#6000e29c: field new_chat_member: %w", err) + return fmt.Errorf("unable to decode updateChatMember#98865bc7: field new_chat_member: %w", err) } default: return b.Skip() @@ -29673,6 +29997,14 @@ func (u *UpdateChatMember) GetInviteLink() (value ChatInviteLink) { return u.InviteLink } +// GetViaJoinRequest returns value of ViaJoinRequest field. +func (u *UpdateChatMember) GetViaJoinRequest() (value bool) { + if u == nil { + return + } + return u.ViaJoinRequest +} + // GetViaChatFolderInviteLink returns value of ViaChatFolderInviteLink field. func (u *UpdateChatMember) GetViaChatFolderInviteLink() (value bool) { if u == nil { @@ -30943,6 +31275,7 @@ const UpdateClassName = "Update" // case *tdapi.UpdateQuickReplyShortcutMessages: // updateQuickReplyShortcutMessages#8bb36b72 // case *tdapi.UpdateForumTopicInfo: // updateForumTopicInfo#6b6f2cc9 // case *tdapi.UpdateScopeNotificationSettings: // updateScopeNotificationSettings#b83ccb73 +// case *tdapi.UpdateReactionNotificationSettings: // updateReactionNotificationSettings#e54d17ec // case *tdapi.UpdateNotification: // updateNotification#8ee67ed4 // case *tdapi.UpdateNotificationGroup: // updateNotificationGroup#96cd9e06 // case *tdapi.UpdateActiveNotifications: // updateActiveNotifications#317d80f2 @@ -31001,6 +31334,7 @@ const UpdateClassName = "Update" // case *tdapi.UpdateActiveEmojiReactions: // updateActiveEmojiReactions#691ffcb7 // case *tdapi.UpdateDefaultReactionType: // updateDefaultReactionType#4b615105 // case *tdapi.UpdateSavedMessagesTags: // updateSavedMessagesTags#7386424a +// case *tdapi.UpdateChatRevenueAmount: // updateChatRevenueAmount#32f4a5e1 // case *tdapi.UpdateSpeechRecognitionTrial: // updateSpeechRecognitionTrial#ff4efcc1 // case *tdapi.UpdateDiceEmojis: // updateDiceEmojis#9d0f91df // case *tdapi.UpdateAnimatedEmojiMessageClicked: // updateAnimatedEmojiMessageClicked#a3167405 @@ -31023,7 +31357,7 @@ const UpdateClassName = "Update" // case *tdapi.UpdateNewCustomQuery: // updateNewCustomQuery#d702f9a6 // case *tdapi.UpdatePoll: // updatePoll#966b73ca // case *tdapi.UpdatePollAnswer: // updatePollAnswer#b67ac547 -// case *tdapi.UpdateChatMember: // updateChatMember#6000e29c +// case *tdapi.UpdateChatMember: // updateChatMember#98865bc7 // case *tdapi.UpdateNewChatJoinRequest: // updateNewChatJoinRequest#7e48b843 // case *tdapi.UpdateChatBoost: // updateChatBoost#50727e24 // case *tdapi.UpdateMessageReaction: // updateMessageReaction#f46c854a @@ -31451,6 +31785,13 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case UpdateReactionNotificationSettingsTypeID: + // Decoding updateReactionNotificationSettings#e54d17ec. + v := UpdateReactionNotificationSettings{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case UpdateNotificationTypeID: // Decoding updateNotification#8ee67ed4. v := UpdateNotification{} @@ -31857,6 +32198,13 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case UpdateChatRevenueAmountTypeID: + // Decoding updateChatRevenueAmount#32f4a5e1. + v := UpdateChatRevenueAmount{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case UpdateSpeechRecognitionTrialTypeID: // Decoding updateSpeechRecognitionTrial#ff4efcc1. v := UpdateSpeechRecognitionTrial{} @@ -32012,7 +32360,7 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { } return &v, nil case UpdateChatMemberTypeID: - // Decoding updateChatMember#6000e29c. + // Decoding updateChatMember#98865bc7. v := UpdateChatMember{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) @@ -32450,6 +32798,13 @@ func DecodeTDLibJSONUpdate(buf tdjson.Decoder) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case "updateReactionNotificationSettings": + // Decoding updateReactionNotificationSettings#e54d17ec. + v := UpdateReactionNotificationSettings{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case "updateNotification": // Decoding updateNotification#8ee67ed4. v := UpdateNotification{} @@ -32856,6 +33211,13 @@ func DecodeTDLibJSONUpdate(buf tdjson.Decoder) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case "updateChatRevenueAmount": + // Decoding updateChatRevenueAmount#32f4a5e1. + v := UpdateChatRevenueAmount{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case "updateSpeechRecognitionTrial": // Decoding updateSpeechRecognitionTrial#ff4efcc1. v := UpdateSpeechRecognitionTrial{} @@ -33011,7 +33373,7 @@ func DecodeTDLibJSONUpdate(buf tdjson.Decoder) (UpdateClass, error) { } return &v, nil case "updateChatMember": - // Decoding updateChatMember#6000e29c. + // Decoding updateChatMember#98865bc7. v := UpdateChatMember{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) diff --git a/tdapi/tl_user_full_info_gen.go b/tdapi/tl_user_full_info_gen.go index f6dcd86e09..be8a1bd85f 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#809a3ac2`. +// UserFullInfo represents TL type `userFullInfo#b61c9c5`. 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. @@ -55,8 +55,10 @@ type UserFullInfo struct { HasPrivateForwards bool // True, if voice and video notes can't be sent or forwarded to the user HasRestrictedVoiceAndVideoNoteMessages bool - // True, if the user has pinned stories - HasPinnedStories bool + // True, if the user has posted to profile stories + HasPostedToProfileStories bool + // True, if the user always enabled sponsored messages; known only for the current user + HasSponsoredMessagesEnabled bool // True, if the current user needs to explicitly allow to share their phone number with // the user when the method addContact is used NeedPhoneNumberPrivacyException bool @@ -81,7 +83,7 @@ type UserFullInfo struct { } // UserFullInfoTypeID is TL type id of UserFullInfo. -const UserFullInfoTypeID = 0x809a3ac2 +const UserFullInfoTypeID = 0xb61c9c5 // Ensuring interfaces in compile-time for UserFullInfo. var ( @@ -122,7 +124,10 @@ func (u *UserFullInfo) Zero() bool { if !(u.HasRestrictedVoiceAndVideoNoteMessages == false) { return false } - if !(u.HasPinnedStories == false) { + if !(u.HasPostedToProfileStories == false) { + return false + } + if !(u.HasSponsoredMessagesEnabled == false) { return false } if !(u.NeedPhoneNumberPrivacyException == false) { @@ -225,8 +230,12 @@ func (u *UserFullInfo) TypeInfo() tdp.Type { SchemaName: "has_restricted_voice_and_video_note_messages", }, { - Name: "HasPinnedStories", - SchemaName: "has_pinned_stories", + Name: "HasPostedToProfileStories", + SchemaName: "has_posted_to_profile_stories", + }, + { + Name: "HasSponsoredMessagesEnabled", + SchemaName: "has_sponsored_messages_enabled", }, { Name: "NeedPhoneNumberPrivacyException", @@ -271,7 +280,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#809a3ac2 as nil") + return fmt.Errorf("can't encode userFullInfo#b61c9c5 as nil") } b.PutID(UserFullInfoTypeID) return u.EncodeBare(b) @@ -280,50 +289,51 @@ 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#809a3ac2 as nil") + return fmt.Errorf("can't encode userFullInfo#b61c9c5 as nil") } if err := u.PersonalPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#809a3ac2: field personal_photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#b61c9c5: field personal_photo: %w", err) } if err := u.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#809a3ac2: field photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#b61c9c5: field photo: %w", err) } if err := u.PublicPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#809a3ac2: field public_photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#b61c9c5: field public_photo: %w", err) } if u.BlockList == nil { - return fmt.Errorf("unable to encode userFullInfo#809a3ac2: field block_list is nil") + return fmt.Errorf("unable to encode userFullInfo#b61c9c5: field block_list is nil") } if err := u.BlockList.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#809a3ac2: field block_list: %w", err) + return fmt.Errorf("unable to encode userFullInfo#b61c9c5: field block_list: %w", err) } b.PutBool(u.CanBeCalled) b.PutBool(u.SupportsVideoCalls) b.PutBool(u.HasPrivateCalls) b.PutBool(u.HasPrivateForwards) b.PutBool(u.HasRestrictedVoiceAndVideoNoteMessages) - b.PutBool(u.HasPinnedStories) + b.PutBool(u.HasPostedToProfileStories) + b.PutBool(u.HasSponsoredMessagesEnabled) b.PutBool(u.NeedPhoneNumberPrivacyException) b.PutBool(u.SetChatBackground) if err := u.Bio.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#809a3ac2: field bio: %w", err) + return fmt.Errorf("unable to encode userFullInfo#b61c9c5: field bio: %w", err) } if err := u.Birthdate.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#809a3ac2: field birthdate: %w", err) + return fmt.Errorf("unable to encode userFullInfo#b61c9c5: field birthdate: %w", err) } b.PutInt53(u.PersonalChatID) 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#809a3ac2: field premium_gift_options element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare userFullInfo#b61c9c5: 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#809a3ac2: field business_info: %w", err) + return fmt.Errorf("unable to encode userFullInfo#b61c9c5: field business_info: %w", err) } if err := u.BotInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#809a3ac2: field bot_info: %w", err) + return fmt.Errorf("unable to encode userFullInfo#b61c9c5: field bot_info: %w", err) } return nil } @@ -331,10 +341,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#809a3ac2 to nil") + return fmt.Errorf("can't decode userFullInfo#b61c9c5 to nil") } if err := b.ConsumeID(UserFullInfoTypeID); err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: %w", err) } return u.DecodeBare(b) } @@ -342,107 +352,114 @@ 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#809a3ac2 to nil") + return fmt.Errorf("can't decode userFullInfo#b61c9c5 to nil") } { if err := u.PersonalPhoto.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field personal_photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field personal_photo: %w", err) } } { if err := u.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field photo: %w", err) } } { if err := u.PublicPhoto.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field public_photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field public_photo: %w", err) } } { value, err := DecodeBlockList(b) if err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field block_list: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field block_list: %w", err) } u.BlockList = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field can_be_called: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field can_be_called: %w", err) } u.CanBeCalled = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field supports_video_calls: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field supports_video_calls: %w", err) } u.SupportsVideoCalls = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field has_private_calls: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field has_private_calls: %w", err) } u.HasPrivateCalls = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field has_private_forwards: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field has_private_forwards: %w", err) } u.HasPrivateForwards = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field has_restricted_voice_and_video_note_messages: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: 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#809a3ac2: field has_pinned_stories: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field has_posted_to_profile_stories: %w", err) + } + u.HasPostedToProfileStories = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field has_sponsored_messages_enabled: %w", err) } - u.HasPinnedStories = value + u.HasSponsoredMessagesEnabled = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field need_phone_number_privacy_exception: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: 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#809a3ac2: field set_chat_background: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field set_chat_background: %w", err) } u.SetChatBackground = value } { if err := u.Bio.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field bio: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field bio: %w", err) } } { if err := u.Birthdate.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field birthdate: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field birthdate: %w", err) } } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field personal_chat_id: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field personal_chat_id: %w", err) } u.PersonalChatID = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field premium_gift_options: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field premium_gift_options: %w", err) } if headerLen > 0 { @@ -451,7 +468,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#809a3ac2: field premium_gift_options: %w", err) + return fmt.Errorf("unable to decode bare userFullInfo#b61c9c5: field premium_gift_options: %w", err) } u.PremiumGiftOptions = append(u.PremiumGiftOptions, value) } @@ -459,18 +476,18 @@ func (u *UserFullInfo) DecodeBare(b *bin.Buffer) error { { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field group_in_common_count: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: 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#809a3ac2: field business_info: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field business_info: %w", err) } } { if err := u.BotInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field bot_info: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field bot_info: %w", err) } } return nil @@ -479,32 +496,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#809a3ac2 as nil") + return fmt.Errorf("can't encode userFullInfo#b61c9c5 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#809a3ac2: field personal_photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#b61c9c5: 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#809a3ac2: field photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#b61c9c5: 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#809a3ac2: field public_photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#b61c9c5: field public_photo: %w", err) } b.Comma() b.FieldStart("block_list") if u.BlockList == nil { - return fmt.Errorf("unable to encode userFullInfo#809a3ac2: field block_list is nil") + return fmt.Errorf("unable to encode userFullInfo#b61c9c5: field block_list is nil") } if err := u.BlockList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#809a3ac2: field block_list: %w", err) + return fmt.Errorf("unable to encode userFullInfo#b61c9c5: field block_list: %w", err) } b.Comma() b.FieldStart("can_be_called") @@ -522,8 +539,11 @@ func (u *UserFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("has_restricted_voice_and_video_note_messages") b.PutBool(u.HasRestrictedVoiceAndVideoNoteMessages) b.Comma() - b.FieldStart("has_pinned_stories") - b.PutBool(u.HasPinnedStories) + b.FieldStart("has_posted_to_profile_stories") + b.PutBool(u.HasPostedToProfileStories) + b.Comma() + b.FieldStart("has_sponsored_messages_enabled") + b.PutBool(u.HasSponsoredMessagesEnabled) b.Comma() b.FieldStart("need_phone_number_privacy_exception") b.PutBool(u.NeedPhoneNumberPrivacyException) @@ -533,12 +553,12 @@ 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#809a3ac2: field bio: %w", err) + return fmt.Errorf("unable to encode userFullInfo#b61c9c5: field bio: %w", err) } b.Comma() b.FieldStart("birthdate") if err := u.Birthdate.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#809a3ac2: field birthdate: %w", err) + return fmt.Errorf("unable to encode userFullInfo#b61c9c5: field birthdate: %w", err) } b.Comma() b.FieldStart("personal_chat_id") @@ -548,7 +568,7 @@ func (u *UserFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.ArrStart() for idx, v := range u.PremiumGiftOptions { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#809a3ac2: field premium_gift_options element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode userFullInfo#b61c9c5: field premium_gift_options element with index %d: %w", idx, err) } b.Comma() } @@ -560,12 +580,12 @@ func (u *UserFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("business_info") if err := u.BusinessInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#809a3ac2: field business_info: %w", err) + return fmt.Errorf("unable to encode userFullInfo#b61c9c5: 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#809a3ac2: field bot_info: %w", err) + return fmt.Errorf("unable to encode userFullInfo#b61c9c5: field bot_info: %w", err) } b.Comma() b.StripComma() @@ -576,119 +596,125 @@ 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#809a3ac2 to nil") + return fmt.Errorf("can't decode userFullInfo#b61c9c5 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#809a3ac2: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: %w", err) } case "personal_photo": if err := u.PersonalPhoto.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field personal_photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field personal_photo: %w", err) } case "photo": if err := u.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field photo: %w", err) } case "public_photo": if err := u.PublicPhoto.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field public_photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field public_photo: %w", err) } case "block_list": value, err := DecodeTDLibJSONBlockList(b) if err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field block_list: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: 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#809a3ac2: field can_be_called: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: 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#809a3ac2: field supports_video_calls: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: 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#809a3ac2: field has_private_calls: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: 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#809a3ac2: field has_private_forwards: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: 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#809a3ac2: field has_restricted_voice_and_video_note_messages: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field has_restricted_voice_and_video_note_messages: %w", err) } u.HasRestrictedVoiceAndVideoNoteMessages = value - case "has_pinned_stories": + case "has_posted_to_profile_stories": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field has_pinned_stories: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field has_posted_to_profile_stories: %w", err) } - u.HasPinnedStories = value + u.HasPostedToProfileStories = value + case "has_sponsored_messages_enabled": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field has_sponsored_messages_enabled: %w", err) + } + u.HasSponsoredMessagesEnabled = value case "need_phone_number_privacy_exception": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field need_phone_number_privacy_exception: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: 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#809a3ac2: field set_chat_background: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: 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#809a3ac2: field bio: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field bio: %w", err) } case "birthdate": if err := u.Birthdate.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field birthdate: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field birthdate: %w", err) } case "personal_chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field personal_chat_id: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field personal_chat_id: %w", err) } u.PersonalChatID = value 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#809a3ac2: field premium_gift_options: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field premium_gift_options: %w", err) } u.PremiumGiftOptions = append(u.PremiumGiftOptions, value) return nil }); err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field premium_gift_options: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: 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#809a3ac2: field group_in_common_count: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: 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#809a3ac2: field business_info: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field business_info: %w", err) } case "bot_info": if err := u.BotInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#809a3ac2: field bot_info: %w", err) + return fmt.Errorf("unable to decode userFullInfo#b61c9c5: field bot_info: %w", err) } default: return b.Skip() @@ -769,12 +795,20 @@ func (u *UserFullInfo) GetHasRestrictedVoiceAndVideoNoteMessages() (value bool) return u.HasRestrictedVoiceAndVideoNoteMessages } -// GetHasPinnedStories returns value of HasPinnedStories field. -func (u *UserFullInfo) GetHasPinnedStories() (value bool) { +// GetHasPostedToProfileStories returns value of HasPostedToProfileStories field. +func (u *UserFullInfo) GetHasPostedToProfileStories() (value bool) { + if u == nil { + return + } + return u.HasPostedToProfileStories +} + +// GetHasSponsoredMessagesEnabled returns value of HasSponsoredMessagesEnabled field. +func (u *UserFullInfo) GetHasSponsoredMessagesEnabled() (value bool) { if u == nil { return } - return u.HasPinnedStories + return u.HasSponsoredMessagesEnabled } // GetNeedPhoneNumberPrivacyException returns value of NeedPhoneNumberPrivacyException field. diff --git a/tdapi/tl_voice_note_gen.go b/tdapi/tl_voice_note_gen.go index 974b01f25a..03b5fccfbc 100644 --- a/tdapi/tl_voice_note_gen.go +++ b/tdapi/tl_voice_note_gen.go @@ -37,7 +37,8 @@ type VoiceNote struct { Duration int32 // A waveform representation of the voice note in 5-bit format Waveform []byte - // MIME type of the file; as defined by the sender + // MIME type of the file; as defined by the sender. Usually, one of "audio/ogg" for Opus + // in an OGG container, "audio/mpeg" for an MP3 audio, or "audio/mp4" for an M4A audio MimeType string // Result of speech recognition in the voice note; may be null SpeechRecognitionResult SpeechRecognitionResultClass diff --git a/tdapi/tl_web_page_gen.go b/tdapi/tl_web_page_gen.go index 8a831560e6..bc29837950 100644 --- a/tdapi/tl_web_page_gen.go +++ b/tdapi/tl_web_page_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// WebPage represents TL type `webPage#dafbc3a4`. +// WebPage represents TL type `webPage#23088efb`. type WebPage struct { // Original URL of the link URL string @@ -89,12 +89,14 @@ type WebPage struct { StorySenderChatID int64 // The identifier of the previewed story; 0 if none StoryID int32 + // Up to 4 stickers from the sticker set available via the link + Stickers []Sticker // Version of web page instant view (currently, can be 1 or 2); 0 if none InstantViewVersion int32 } // WebPageTypeID is TL type id of WebPage. -const WebPageTypeID = 0xdafbc3a4 +const WebPageTypeID = 0x23088efb // Ensuring interfaces in compile-time for WebPage. var ( @@ -186,6 +188,9 @@ func (w *WebPage) Zero() bool { if !(w.StoryID == 0) { return false } + if !(w.Stickers == nil) { + return false + } if !(w.InstantViewVersion == 0) { return false } @@ -329,6 +334,10 @@ func (w *WebPage) TypeInfo() tdp.Type { Name: "StoryID", SchemaName: "story_id", }, + { + Name: "Stickers", + SchemaName: "stickers", + }, { Name: "InstantViewVersion", SchemaName: "instant_view_version", @@ -340,7 +349,7 @@ func (w *WebPage) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (w *WebPage) Encode(b *bin.Buffer) error { if w == nil { - return fmt.Errorf("can't encode webPage#dafbc3a4 as nil") + return fmt.Errorf("can't encode webPage#23088efb as nil") } b.PutID(WebPageTypeID) return w.EncodeBare(b) @@ -349,7 +358,7 @@ func (w *WebPage) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (w *WebPage) EncodeBare(b *bin.Buffer) error { if w == nil { - return fmt.Errorf("can't encode webPage#dafbc3a4 as nil") + return fmt.Errorf("can't encode webPage#23088efb as nil") } b.PutString(w.URL) b.PutString(w.DisplayURL) @@ -357,10 +366,10 @@ func (w *WebPage) EncodeBare(b *bin.Buffer) error { b.PutString(w.SiteName) b.PutString(w.Title) if err := w.Description.Encode(b); err != nil { - return fmt.Errorf("unable to encode webPage#dafbc3a4: field description: %w", err) + return fmt.Errorf("unable to encode webPage#23088efb: field description: %w", err) } if err := w.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode webPage#dafbc3a4: field photo: %w", err) + return fmt.Errorf("unable to encode webPage#23088efb: field photo: %w", err) } b.PutString(w.EmbedURL) b.PutString(w.EmbedType) @@ -373,28 +382,34 @@ func (w *WebPage) EncodeBare(b *bin.Buffer) error { b.PutBool(w.SkipConfirmation) b.PutBool(w.ShowAboveText) if err := w.Animation.Encode(b); err != nil { - return fmt.Errorf("unable to encode webPage#dafbc3a4: field animation: %w", err) + return fmt.Errorf("unable to encode webPage#23088efb: field animation: %w", err) } if err := w.Audio.Encode(b); err != nil { - return fmt.Errorf("unable to encode webPage#dafbc3a4: field audio: %w", err) + return fmt.Errorf("unable to encode webPage#23088efb: field audio: %w", err) } if err := w.Document.Encode(b); err != nil { - return fmt.Errorf("unable to encode webPage#dafbc3a4: field document: %w", err) + return fmt.Errorf("unable to encode webPage#23088efb: field document: %w", err) } if err := w.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode webPage#dafbc3a4: field sticker: %w", err) + return fmt.Errorf("unable to encode webPage#23088efb: field sticker: %w", err) } if err := w.Video.Encode(b); err != nil { - return fmt.Errorf("unable to encode webPage#dafbc3a4: field video: %w", err) + return fmt.Errorf("unable to encode webPage#23088efb: field video: %w", err) } if err := w.VideoNote.Encode(b); err != nil { - return fmt.Errorf("unable to encode webPage#dafbc3a4: field video_note: %w", err) + return fmt.Errorf("unable to encode webPage#23088efb: field video_note: %w", err) } if err := w.VoiceNote.Encode(b); err != nil { - return fmt.Errorf("unable to encode webPage#dafbc3a4: field voice_note: %w", err) + return fmt.Errorf("unable to encode webPage#23088efb: field voice_note: %w", err) } b.PutInt53(w.StorySenderChatID) b.PutInt32(w.StoryID) + b.PutInt(len(w.Stickers)) + for idx, v := range w.Stickers { + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare webPage#23088efb: field stickers element with index %d: %w", idx, err) + } + } b.PutInt32(w.InstantViewVersion) return nil } @@ -402,10 +417,10 @@ func (w *WebPage) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (w *WebPage) Decode(b *bin.Buffer) error { if w == nil { - return fmt.Errorf("can't decode webPage#dafbc3a4 to nil") + return fmt.Errorf("can't decode webPage#23088efb to nil") } if err := b.ConsumeID(WebPageTypeID); err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: %w", err) } return w.DecodeBare(b) } @@ -413,176 +428,193 @@ func (w *WebPage) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (w *WebPage) DecodeBare(b *bin.Buffer) error { if w == nil { - return fmt.Errorf("can't decode webPage#dafbc3a4 to nil") + return fmt.Errorf("can't decode webPage#23088efb to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field url: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field url: %w", err) } w.URL = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field display_url: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field display_url: %w", err) } w.DisplayURL = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field type: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field type: %w", err) } w.Type = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field site_name: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field site_name: %w", err) } w.SiteName = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field title: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field title: %w", err) } w.Title = value } { if err := w.Description.Decode(b); err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field description: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field description: %w", err) } } { if err := w.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field photo: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field photo: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field embed_url: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field embed_url: %w", err) } w.EmbedURL = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field embed_type: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field embed_type: %w", err) } w.EmbedType = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field embed_width: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field embed_width: %w", err) } w.EmbedWidth = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field embed_height: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field embed_height: %w", err) } w.EmbedHeight = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field duration: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field duration: %w", err) } w.Duration = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field author: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field author: %w", err) } w.Author = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field has_large_media: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field has_large_media: %w", err) } w.HasLargeMedia = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field show_large_media: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field show_large_media: %w", err) } w.ShowLargeMedia = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field skip_confirmation: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field skip_confirmation: %w", err) } w.SkipConfirmation = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field show_above_text: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field show_above_text: %w", err) } w.ShowAboveText = value } { if err := w.Animation.Decode(b); err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field animation: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field animation: %w", err) } } { if err := w.Audio.Decode(b); err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field audio: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field audio: %w", err) } } { if err := w.Document.Decode(b); err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field document: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field document: %w", err) } } { if err := w.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field sticker: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field sticker: %w", err) } } { if err := w.Video.Decode(b); err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field video: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field video: %w", err) } } { if err := w.VideoNote.Decode(b); err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field video_note: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field video_note: %w", err) } } { if err := w.VoiceNote.Decode(b); err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field voice_note: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field voice_note: %w", err) } } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field story_sender_chat_id: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field story_sender_chat_id: %w", err) } w.StorySenderChatID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field story_id: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field story_id: %w", err) } w.StoryID = value } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode webPage#23088efb: field stickers: %w", err) + } + + if headerLen > 0 { + w.Stickers = make([]Sticker, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value Sticker + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare webPage#23088efb: field stickers: %w", err) + } + w.Stickers = append(w.Stickers, value) + } + } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field instant_view_version: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field instant_view_version: %w", err) } w.InstantViewVersion = value } @@ -592,7 +624,7 @@ func (w *WebPage) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (w *WebPage) EncodeTDLibJSON(b tdjson.Encoder) error { if w == nil { - return fmt.Errorf("can't encode webPage#dafbc3a4 as nil") + return fmt.Errorf("can't encode webPage#23088efb as nil") } b.ObjStart() b.PutID("webPage") @@ -614,12 +646,12 @@ func (w *WebPage) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("description") if err := w.Description.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode webPage#dafbc3a4: field description: %w", err) + return fmt.Errorf("unable to encode webPage#23088efb: field description: %w", err) } b.Comma() b.FieldStart("photo") if err := w.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode webPage#dafbc3a4: field photo: %w", err) + return fmt.Errorf("unable to encode webPage#23088efb: field photo: %w", err) } b.Comma() b.FieldStart("embed_url") @@ -654,37 +686,37 @@ func (w *WebPage) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("animation") if err := w.Animation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode webPage#dafbc3a4: field animation: %w", err) + return fmt.Errorf("unable to encode webPage#23088efb: field animation: %w", err) } b.Comma() b.FieldStart("audio") if err := w.Audio.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode webPage#dafbc3a4: field audio: %w", err) + return fmt.Errorf("unable to encode webPage#23088efb: field audio: %w", err) } b.Comma() b.FieldStart("document") if err := w.Document.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode webPage#dafbc3a4: field document: %w", err) + return fmt.Errorf("unable to encode webPage#23088efb: field document: %w", err) } b.Comma() b.FieldStart("sticker") if err := w.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode webPage#dafbc3a4: field sticker: %w", err) + return fmt.Errorf("unable to encode webPage#23088efb: field sticker: %w", err) } b.Comma() b.FieldStart("video") if err := w.Video.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode webPage#dafbc3a4: field video: %w", err) + return fmt.Errorf("unable to encode webPage#23088efb: field video: %w", err) } b.Comma() b.FieldStart("video_note") if err := w.VideoNote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode webPage#dafbc3a4: field video_note: %w", err) + return fmt.Errorf("unable to encode webPage#23088efb: field video_note: %w", err) } b.Comma() b.FieldStart("voice_note") if err := w.VoiceNote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode webPage#dafbc3a4: field voice_note: %w", err) + return fmt.Errorf("unable to encode webPage#23088efb: field voice_note: %w", err) } b.Comma() b.FieldStart("story_sender_chat_id") @@ -693,6 +725,17 @@ func (w *WebPage) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("story_id") b.PutInt32(w.StoryID) b.Comma() + b.FieldStart("stickers") + b.ArrStart() + for idx, v := range w.Stickers { + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode webPage#23088efb: field stickers element with index %d: %w", idx, err) + } + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() b.FieldStart("instant_view_version") b.PutInt32(w.InstantViewVersion) b.Comma() @@ -704,157 +747,168 @@ func (w *WebPage) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (w *WebPage) DecodeTDLibJSON(b tdjson.Decoder) error { if w == nil { - return fmt.Errorf("can't decode webPage#dafbc3a4 to nil") + return fmt.Errorf("can't decode webPage#23088efb to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("webPage"); err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: %w", err) } case "url": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field url: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field url: %w", err) } w.URL = value case "display_url": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field display_url: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field display_url: %w", err) } w.DisplayURL = value case "type": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field type: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field type: %w", err) } w.Type = value case "site_name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field site_name: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field site_name: %w", err) } w.SiteName = value case "title": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field title: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field title: %w", err) } w.Title = value case "description": if err := w.Description.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field description: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field description: %w", err) } case "photo": if err := w.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field photo: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field photo: %w", err) } case "embed_url": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field embed_url: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field embed_url: %w", err) } w.EmbedURL = value case "embed_type": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field embed_type: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field embed_type: %w", err) } w.EmbedType = value case "embed_width": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field embed_width: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field embed_width: %w", err) } w.EmbedWidth = value case "embed_height": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field embed_height: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field embed_height: %w", err) } w.EmbedHeight = value case "duration": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field duration: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field duration: %w", err) } w.Duration = value case "author": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field author: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field author: %w", err) } w.Author = value case "has_large_media": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field has_large_media: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field has_large_media: %w", err) } w.HasLargeMedia = value case "show_large_media": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field show_large_media: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field show_large_media: %w", err) } w.ShowLargeMedia = value case "skip_confirmation": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field skip_confirmation: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field skip_confirmation: %w", err) } w.SkipConfirmation = value case "show_above_text": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field show_above_text: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field show_above_text: %w", err) } w.ShowAboveText = value case "animation": if err := w.Animation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field animation: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field animation: %w", err) } case "audio": if err := w.Audio.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field audio: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field audio: %w", err) } case "document": if err := w.Document.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field document: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field document: %w", err) } case "sticker": if err := w.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field sticker: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field sticker: %w", err) } case "video": if err := w.Video.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field video: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field video: %w", err) } case "video_note": if err := w.VideoNote.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field video_note: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field video_note: %w", err) } case "voice_note": if err := w.VoiceNote.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field voice_note: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field voice_note: %w", err) } case "story_sender_chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field story_sender_chat_id: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field story_sender_chat_id: %w", err) } w.StorySenderChatID = value case "story_id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field story_id: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field story_id: %w", err) } w.StoryID = value + case "stickers": + if err := b.Arr(func(b tdjson.Decoder) error { + var value Sticker + if err := value.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode webPage#23088efb: field stickers: %w", err) + } + w.Stickers = append(w.Stickers, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode webPage#23088efb: field stickers: %w", err) + } case "instant_view_version": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode webPage#dafbc3a4: field instant_view_version: %w", err) + return fmt.Errorf("unable to decode webPage#23088efb: field instant_view_version: %w", err) } w.InstantViewVersion = value default: @@ -1072,6 +1126,14 @@ func (w *WebPage) GetStoryID() (value int32) { return w.StoryID } +// GetStickers returns value of Stickers field. +func (w *WebPage) GetStickers() (value []Sticker) { + if w == nil { + return + } + return w.Stickers +} + // GetInstantViewVersion returns value of InstantViewVersion field. func (w *WebPage) GetInstantViewVersion() (value int32) { if w == nil {