diff --git a/_schema/tdapi.tl b/_schema/tdapi.tl index 5c23133c4f..c0219b6021 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: fea76308fdfe16b4523dec5b0c190c5bbf4eeeb8a1ec4f418c90434b5b8aa3a4 +// SHA256: aebc55c771a4ce5ea24cf9f25d4318d1642a491143616ef63fee79affd1b7549 double#2210c154 ? = Double; @@ -659,7 +659,7 @@ inputChatPhotoSticker#4e6e735d sticker:chatPhotoSticker = InputChatPhoto; chatPermissions#af3b61cb can_send_basic_messages:Bool can_send_audios:Bool can_send_documents:Bool can_send_photos:Bool can_send_videos:Bool can_send_video_notes:Bool can_send_voice_notes:Bool can_send_polls:Bool can_send_other_messages:Bool can_add_web_page_previews:Bool can_change_info:Bool can_invite_users:Bool can_pin_messages:Bool can_manage_topics:Bool = ChatPermissions; //@description Describes rights of the administrator -//@can_manage_chat True, if the administrator can get chat event log, get chat statistics, get message statistics in channels, get channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only +//@can_manage_chat True, if the administrator can get chat event log, get chat statistics, get chat boosts in channels, get message statistics in channels, get channel members, //@can_change_info True, if the administrator can change the chat title, photo, and other settings //@can_post_messages True, if the administrator can create channel posts; applicable to channels only //@can_edit_messages True, if the administrator can edit messages of other users and pin messages; applicable to channels only @@ -670,8 +670,11 @@ chatPermissions#af3b61cb can_send_basic_messages:Bool can_send_audios:Bool can_s //@can_manage_topics True, if the administrator can manage topics; applicable to forum supergroups only //@can_promote_members True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that were directly or indirectly promoted by them //@can_manage_video_chats True, if the administrator can manage video chats +//@can_post_stories True, if the administrator can create new channel stories, or edit and delete posted stories; applicable to channels only +//@can_edit_stories True, if the administrator can edit stories posted by other users, pin stories and access story archive; applicable to channels only +//@can_delete_stories True, if the administrator can delete stories posted by other users; applicable to channels only //@is_anonymous True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only -chatAdministratorRights#ad77eac7 can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool is_anonymous:Bool = ChatAdministratorRights; +chatAdministratorRights#5f4f9044 can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool is_anonymous:Bool = ChatAdministratorRights; //@description Describes an option for buying Telegram Premium to a user //@currency ISO 4217 currency code for Telegram Premium subscription payment @@ -999,7 +1002,9 @@ basicGroupFullInfo#d62e521e photo:chatPhoto description:string creator_user_id:i //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted //@is_scam True, if many users reported this supergroup or channel as a scam //@is_fake True, if many users reported this supergroup or channel as a fake account -supergroup#88a83c57 id:int53 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_verified:Bool restriction_reason:string is_scam:Bool is_fake:Bool = Supergroup; +//@has_active_stories True, if the channel has non-expired stories available to the current user +//@has_unread_active_stories True, if the channel has unread non-expired stories available to the current user +supergroup#8b30b3c5 id:int53 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_verified:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; //@description Contains full information about a supergroup or channel //@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo @@ -1020,13 +1025,14 @@ supergroup#88a83c57 id:int53 usernames:usernames date:int32 status:ChatMemberSta //@can_toggle_aggressive_anti_spam True, if aggressive anti-spam checks can be enabled or disabled in the supergroup //@is_all_history_available True, if new chat members will have access to old messages. In public, discussion, of forum groups and all channels, old messages are always available, //@has_aggressive_anti_spam_enabled True, if aggressive anti-spam checks are enabled in the supergroup. The value of this field is only available to chat administrators +//@has_pinned_stories True, if the channel has pinned stories //@sticker_set_id Identifier of the supergroup sticker set; 0 if none //@location Location to which the supergroup is connected; may be null if none //@invite_link Primary invite link for the chat; may be null. For chat administrators with can_invite_users right only //@bot_commands List of commands of bots in the group //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo#8d50b2f9 photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool has_aggressive_anti_spam_enabled:Bool sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo#f2f19203 photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool has_aggressive_anti_spam_enabled:Bool has_pinned_stories:Bool sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -1159,12 +1165,11 @@ unreadReaction#8c5b3b82 type:ReactionType sender_id:MessageSender is_big:Bool = messageSendingStatePending#f32b63b4 sending_id:int32 = MessageSendingState; //@description The message failed to be sent -//@error_code An error code; 0 if unknown -//@error_message Error message +//@error The cause of the message sending failure //@can_retry True, if the message can be re-sent //@need_another_sender True, if the message can be re-sent only on behalf of a different sender //@retry_after Time left before the message can be re-sent, in seconds. No update is sent when this field changes -messageSendingStateFailed#982ce904 error_code:int32 error_message:string can_retry:Bool need_another_sender:Bool retry_after:double = MessageSendingState; +messageSendingStateFailed#fb75b2af error:error can_retry:Bool need_another_sender:Bool retry_after:double = MessageSendingState; //@class MessageReplyTo @description Contains information about the message or the story a message is replying to @@ -2181,6 +2186,7 @@ labeledPricePart#20f2e726 label:string amount:int53 = LabeledPricePart; //@max_tip_amount The maximum allowed amount of tip in the smallest units of the currency //@suggested_tip_amounts Suggested amounts of tip in the smallest units of the currency //@recurring_payment_terms_of_service_url An HTTP URL with terms of service for recurring payments. If non-empty, the invoice payment will result in recurring payments and the user must accept the terms of service before allowed to pay +//@terms_of_service_url An HTTP URL with terms of service for non-recurring payments. If non-empty, then the user must accept the terms of service before allowed to pay //@is_test True, if the payment is a test payment //@need_name True, if the user's name is needed for payment //@need_phone_number True, if the user's phone number is needed for payment @@ -2189,7 +2195,7 @@ labeledPricePart#20f2e726 label:string amount:int53 = LabeledPricePart; //@send_phone_number_to_provider True, if the user's phone number will be sent to the provider //@send_email_address_to_provider True, if the user's email address will be sent to the provider //@is_flexible True, if the total price depends on the shipping method -invoice#43609f28 currency:string price_parts:vector max_tip_amount:int53 suggested_tip_amounts:vector recurring_payment_terms_of_service_url:string is_test:Bool need_name:Bool need_phone_number:Bool need_email_address:Bool need_shipping_address:Bool send_phone_number_to_provider:Bool send_email_address_to_provider:Bool is_flexible:Bool = Invoice; +invoice#c19b2377 currency:string price_parts:vector max_tip_amount:int53 suggested_tip_amounts:vector recurring_payment_terms_of_service_url:string terms_of_service_url:string is_test:Bool need_name:Bool need_phone_number:Bool need_email_address:Bool need_shipping_address:Bool send_phone_number_to_provider:Bool send_email_address_to_provider:Bool is_flexible:Bool = Invoice; //@description Order information //@name Name of the user @@ -3453,6 +3459,13 @@ storyAreaTypeLocation#9ebe1186 location:location = StoryAreaType; //@venue Information about the venue storyAreaTypeVenue#18ae4d06 venue:venue = StoryAreaType; +//@description An area pointing to a suggested reaction. App needs to show a clickable reaction on the area and call setStoryReaction when the are is clicked +//@reaction_type Type of the reaction +//@total_count Number of times the reaction was added +//@is_dark True, if reaction has a dark background +//@is_flipped True, if reaction corner is flipped +storyAreaTypeSuggestedReaction#f95f927c reaction_type:ReactionType total_count:int32 is_dark:Bool is_flipped:Bool = StoryAreaType; + //@description Describes a clickable rectangle area on a story media //@position Position of the area //@type Type of the area @@ -3474,6 +3487,12 @@ inputStoryAreaTypeFoundVenue#accda496 query_id:int64 result_id:string = InputSto //@venue_id Identifier of the venue in the provider database inputStoryAreaTypePreviousVenue#6e124e0c venue_provider:string venue_id:string = InputStoryAreaType; +//@description An area pointing to a suggested reaction +//@reaction_type Type of the reaction +//@is_dark True, if reaction has a dark background +//@is_flipped True, if reaction corner is flipped +inputStoryAreaTypeSuggestedReaction#7d4751d3 reaction_type:ReactionType is_dark:Bool is_flipped:Bool = InputStoryAreaType; + //@description Describes a clickable rectangle area on a story media to be added //@position Position of the area //@type Type of the area @@ -3533,9 +3552,10 @@ storyListArchive#fd80a741 = StoryList; //@description Contains information about interactions with a story //@view_count Number of times the story was viewed -//@reaction_count Number of reactions added to the story +//@forward_count Number of times the story was forwarded; 0 if none or unknown +//@reaction_count Number of reactions added to the story; 0 if none or unknown //@recent_viewer_user_ids Identifiers of at most 3 recent viewers of the story -storyInteractionInfo#e5109256 view_count:int32 reaction_count:int32 recent_viewer_user_ids:vector = StoryInteractionInfo; +storyInteractionInfo#e1557fc7 view_count:int32 forward_count:int32 reaction_count:int32 recent_viewer_user_ids:vector = StoryInteractionInfo; //@description Represents a story //@id Unique story identifier among stories of the given sender @@ -3546,8 +3566,11 @@ storyInteractionInfo#e5109256 view_count:int32 reaction_count:int32 recent_viewe //@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_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_get_viewers True, if users viewed the story can be received through getStoryViewers //@has_expired_viewers True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago //@interaction_info Information about interactions with the story; may be null if the story isn't owned or there were no interactions @@ -3556,7 +3579,7 @@ storyInteractionInfo#e5109256 view_count:int32 reaction_count:int32 recent_viewe //@content Content of the story //@areas Clickable areas to be shown on the story content //@caption Caption of the story -story#3198c7c0 id:int32 sender_chat_id:int53 date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_forwarded:Bool can_be_replied:Bool can_get_viewers:Bool has_expired_viewers:Bool interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; +story#627556b4 id:int32 sender_chat_id:int53 date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_pinned:Bool can_get_viewers:Bool has_expired_viewers:Bool interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; //@description Represents a list of stories //@total_count Approximate total number of stories found @@ -3577,6 +3600,27 @@ storyInfo#8997c352 story_id:int32 date:int32 is_for_close_friends:Bool = StoryIn //@stories Basic information about the stories; use getStory to get full information about the stories. The stories are in a chronological order (i.e., in order of increasing story identifiers) chatActiveStories#d923d773 chat_id:int53 list:StoryList order:int53 max_read_story_id:int32 stories:vector = ChatActiveStories; +//@description Describes current boost status of a chat +//@is_boosted True, if the current user has already boosted the chat +//@level Current boost level of the chat +//@boost_count The number of times the chat was boosted +//@current_level_boost_count The number of boosts added to reach the current level +//@next_level_boost_count The number of boosts needed to reach the next level; 0 if the next level isn't available +//@premium_member_count Approximate number of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat +//@premium_member_percentage A percentage of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat +chatBoostStatus#cd6a3f87 is_boosted:Bool level:int32 boost_count:int32 current_level_boost_count:int32 next_level_boost_count:int32 premium_member_count:int32 premium_member_percentage:double = ChatBoostStatus; + +//@description Describes a boost of a chat +//@user_id Identifier of a user that boosted the chat +//@expiration_date Point in time (Unix timestamp) when the boost will automatically expire if the user will not prolongate their Telegram Premium subscription +chatBoost#8d029d82 user_id:int53 expiration_date:int32 = ChatBoost; + +//@description Contains a list of boosts applied to a chat +//@total_count Total number of boosts applied to the chat +//@boosts List of boosts +//@next_offset The offset for the next request. If empty, there are no more results +foundChatBoosts#dc80d52e total_count:int32 boosts:vector next_offset:string = FoundChatBoosts; + //@class CallDiscardReason @description Describes the reason why a call was discarded //@description The call wasn't discarded, or the reason is unknown @@ -4523,6 +4567,9 @@ premiumLimitTypeMonthlySentStoryCount#30d84b83 = PremiumLimitType; //@description The maximum length of captions of sent stories premiumLimitTypeStoryCaptionLength#bed53302 = PremiumLimitType; +//@description The maximum number of suggested reaction areas on a story +premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807 = PremiumLimitType; + //@class PremiumFeature @description Describes a feature available to Premium users //@description Increased limits @@ -4573,9 +4620,12 @@ premiumFeatureRealTimeChatTranslation#bbd80280 = PremiumFeature; //@description Allowed to use many additional features for stories premiumFeatureUpgradedStories#9008051b = PremiumFeature; +//@description The ability to boost chats +premiumFeatureChatBoost#5df89f1b = PremiumFeature; + //@class PremiumStoryFeature @description Describes a story feature available to Premium users -//@description User stories are displayed before stories of non-premium contacts +//@description User stories are displayed before stories of non-premium contacts and channels premiumStoryFeaturePriorityOrder#8ff172c7 = PremiumStoryFeature; //@description The ability to hide the fact that the user viewed other's stories @@ -4777,7 +4827,7 @@ chatTheme#f9406c39 name:string light_settings:themeSettings dark_settings:themeS //@hashtags A list of hashtags hashtags#6c2c0ae1 hashtags:vector = Hashtags; -//@class CanSendStoryResult @description Represents result of checking whether the current user can send a story +//@class CanSendStoryResult @description Represents result of checking whether the current user can send a story in the specific chat //@description A story can be sent canSendStoryResultOk#503cf0fd = CanSendStoryResult; @@ -4785,6 +4835,9 @@ canSendStoryResultOk#503cf0fd = CanSendStoryResult; //@description The user must subscribe to Telegram Premium to be able to post stories canSendStoryResultPremiumNeeded#567fde69 = CanSendStoryResult; +//@description The channel chat must be boosted first by Telegram Premium subscribers to post more stories. Call getChatBoostStatus to get current boost status of the chat +canSendStoryResultBoostNeeded#9e60e92f = CanSendStoryResult; + //@description The limit for the number of active stories exceeded. The user can buy Telegram Premium, delete an active story, or wait for the oldest story to expire canSendStoryResultActiveStoryLimitExceeded#afd9aad6 = CanSendStoryResult; @@ -4796,6 +4849,28 @@ canSendStoryResultWeeklyLimitExceeded#1341a0b8 retry_after:int32 = CanSendStoryR //@retry_after Time left before the user can send the next story canSendStoryResultMonthlyLimitExceeded#dd8242d5 retry_after:int32 = CanSendStoryResult; +//@class CanBoostChatResult @description Represents result of checking whether the current user can boost the specific chat + +//@description The chat can be boosted +//@currently_boosted_chat_id Identifier of the currently boosted chat from which boost will be removed; 0 if none +canBoostChatResultOk#1da13a8b currently_boosted_chat_id:int53 = CanBoostChatResult; + +//@description The chat can't be boosted +canBoostChatResultInvalidChat#3d4c3668 = CanBoostChatResult; + +//@description The chat is already boosted by the user +canBoostChatResultAlreadyBoosted#3e012a69 = CanBoostChatResult; + +//@description The user must subscribe to Telegram Premium to be able to boost chats +canBoostChatResultPremiumNeeded#d4b4e4f = CanBoostChatResult; + +//@description The user must have Telegram Premium subscription instead of a gifted Telegram Premium +canBoostChatResultPremiumSubscriptionNeeded#7550d3cc = CanBoostChatResult; + +//@description The user must wait the specified time before the boost can be moved to another chat +//@retry_after Time left before the user can boost another chat +canBoostChatResultWaitNeeded#343aaeaa retry_after:int32 = CanBoostChatResult; + //@class CanTransferOwnershipResult @description Represents result of checking whether the current session can be used to transfer a chat ownership to another user //@description The session can be used @@ -5414,6 +5489,10 @@ internalLinkTypeBotStartInGroup#ca0d8cce bot_username:string start_parameter:str //@description The link is a link to the change phone number section of the app internalLinkTypeChangePhoneNumber#f0275b01 = InternalLinkType; +//@description The link is a link to boost a Telegram chat. Call getChatBoostLinkInfo with the given URL to process the link. +//@url URL to be passed to getChatBoostLinkInfo +internalLinkTypeChatBoost#d549fd40 url:string = InternalLinkType; + //@description The link is an invite link to a chat folder. Call checkChatFolderInviteLink with the given invite link to process the link //@invite_link Internal representation of the invite link internalLinkTypeChatFolderInvite#89b2493e invite_link:string = InternalLinkType; @@ -5563,6 +5642,16 @@ messageLink#af4a3aa6 link:string is_public:Bool = MessageLink; //@for_album True, if the whole media album to which the message belongs is linked messageLinkInfo#2b96fb50 is_public:Bool chat_id:int53 message_thread_id:int53 message:message media_timestamp:int32 for_album:Bool = MessageLinkInfo; +//@description Contains an HTTPS link to boost a chat +//@link The link +//@is_public True, if the link will work for non-members of the chat +chatBoostLink#b5417c71 link:string is_public:Bool = ChatBoostLink; + +//@description Contains information about a link to boost a a chat +//@is_public True, if the link will work for non-members of the chat +//@chat_id Identifier of the chat to which the link points; 0 if the chat isn't found +chatBoostLinkInfo#dc123884 is_public:Bool chat_id:int53 = ChatBoostLinkInfo; + //@class BlockList @description Describes a type of a block list //@description The main block list that disallows writing messages to the current user, receiving their status and photo, viewing of stories, and some other actions @@ -6084,9 +6173,8 @@ updateMessageSendSucceeded#6c399d7d message:message old_message_id:int53 = Updat //@description A message failed to send. Be aware that some messages being sent can be irrecoverably deleted, in which case updateDeleteMessages will be received instead of this update //@message The failed to send message //@old_message_id The previous temporary message identifier -//@error_code An error code -//@error_message Error message -updateMessageSendFailed#c277ce5d message:message old_message_id:int53 error_code:int32 error_message:string = Update; +//@error The cause of the message sending failure +updateMessageSendFailed#da1bf8e7 message:message old_message_id:int53 error:error = Update; //@description The message content has changed //@chat_id Chat identifier @@ -6465,10 +6553,9 @@ updateStorySendSucceeded#b9269e57 story:story old_story_id:int32 = Update; //@description A story failed to send. If the story sending is canceled, then updateStoryDeleted will be received instead of this update //@story The failed to send story -//@error The cause of the failure; may be null if unknown -//@error_code An error code -//@error_message Error message -updateStorySendFailed#4418bca2 story:story error:CanSendStoryResult error_code:int32 error_message:string = Update; +//@error The cause of the story sending failure +//@error_type Type of the error; may be null if unknown +updateStorySendFailed#e046f199 story:story error:error error_type:CanSendStoryResult = Update; //@description The list of active stories posted by a specific chat has changed //@active_stories The new list of active stories @@ -7594,7 +7681,7 @@ setPollAnswer#5303b916 chat_id:int53 message_id:int53 option_ids:vector = //@limit The maximum number of voters to be returned; must be positive and can't be greater than 50. For optimal performance, the number of returned voters is chosen by TDLib and can be smaller than the specified limit, even if the end of the voter list has not been reached getPollVoters#c45ba9ac chat_id:int53 message_id:int53 option_id:int32 offset:int32 limit:int32 = MessageSenders; -//@description Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag set +//@description Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag is set //@chat_id Identifier of the chat to which the poll belongs //@message_id Identifier of the message containing the poll //@reply_markup The new message reply markup; pass null if none; for bots only @@ -7854,7 +7941,7 @@ createNewBasicGroupChat#c479e224 user_ids:vector title:string message_aut //@param_description Chat description; 0-255 characters //@location Chat location if a location-based supergroup is being created; pass null to create an ordinary supergroup chat //@message_auto_delete_time Message auto-delete time value, in seconds; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically -//@for_import Pass true to create a supergroup for importing messages using importMessage +//@for_import Pass true to create a supergroup for importing messages using importMessages createNewSupergroupChat#2fecf6c6 title:string is_forum:Bool is_channel:Bool description:string location:chatLocation message_auto_delete_time:int32 for_import:Bool = Chat; //@description Creates a new secret chat. Returns the newly created chat @@ -8191,10 +8278,15 @@ readChatList#bd6498aa chat_list:ChatList = Ok; //@only_local Pass true to get only locally available information without sending network requests getStory#717b1c78 story_sender_chat_id:int53 story_id:int32 only_local:Bool = Story; -//@description Checks whether the current user can send a story -canSendStory#ede53a66 = CanSendStoryResult; +//@description Returns channel chats in which the current user has the right to post stories. The chats must be rechecked with canSendStory before actually trying to post a story there +getChatsToSendStories#22f9e3a4 = Chats; + +//@description Checks whether the current user can send a story on behalf of a chat; requires can_post_stories rights for channel chats +//@chat_id Chat identifier +canSendStory#b6e0216b chat_id:int53 = CanSendStoryResult; -//@description Sends a new story. Returns a temporary story +//@description Sends a new story to a chat; requires can_post_stories rights for channel chats. Returns a temporary story +//@chat_id Identifier of the chat that will post the story //@content Content of the story //@areas Clickable rectangle areas to be shown on the story media; pass null if none //@caption Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters @@ -8202,28 +8294,32 @@ canSendStory#ede53a66 = CanSendStoryResult; //@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 //@is_pinned Pass true to keep the story accessible after expiration //@protect_content Pass true if the content of the story must be protected from forwarding and screenshotting -sendStory#40b9f838 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 is_pinned:Bool protect_content:Bool = Story; +sendStory#53242a4 chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 is_pinned:Bool protect_content:Bool = Story; -//@description Changes content and caption of a previously sent 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 //@story_id Identifier of the story to edit //@content New content of the story; pass null to keep the current content //@areas New clickable rectangle areas to be shown on the story media; pass null to keep the current areas. Areas can't be edited if story content isn't changed //@caption New story caption; pass null to keep the current caption -editStory#aa2c3e86 story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText = Ok; +editStory#5e6a21b1 story_sender_chat_id:int53 story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText = Ok; -//@description Changes privacy settings of a previously sent story +//@description Changes privacy settings of a story. Can be called only if story.can_be_edited == true +//@story_sender_chat_id Identifier of the chat that posted the story //@story_id Identifier of the story //@privacy_settings The new privacy settigs for the story -setStoryPrivacySettings#d8e94332 story_id:int32 privacy_settings:StoryPrivacySettings = Ok; +setStoryPrivacySettings#1b6c5434 story_sender_chat_id:int53 story_id:int32 privacy_settings:StoryPrivacySettings = Ok; -//@description Toggles whether a story is accessible after expiration +//@description Toggles whether a story is accessible after expiration. Can be called only if story.can_toggle_is_pinned == true +//@story_sender_chat_id Identifier of the chat that posted the story //@story_id Identifier of the story //@is_pinned Pass true to make the story accessible after expiration; pass false to make it private -toggleStoryIsPinned#df8031f9 story_id:int32 is_pinned:Bool = Ok; +toggleStoryIsPinned#b493b30e story_sender_chat_id:int53 story_id:int32 is_pinned:Bool = Ok; -//@description Deletes a previously sent story +//@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#62332a06 story_id:int32 = Ok; +deleteStory#9f35af16 story_sender_chat_id:int53 story_id:int32 = Ok; //@description Returns list of chats with non-default notification settings for stories getStoryNotificationSettingsExceptions#256a2eb0 = Chats; @@ -8247,10 +8343,11 @@ getChatActiveStories#2e4ffbf5 chat_id:int53 = ChatActiveStories; //@limit The maximum number of stories to be returned getChatPinnedStories#53c82a1 chat_id:int53 from_story_id:int32 limit:int32 = Stories; -//@description Returns the list of all stories of the current user. The stories are returned in a reverse chronological order (i.e., in order of decreasing story_id). +//@description Returns the list of all stories posted by the given chat; requires can_edit_stories rights for channel chats. +//@chat_id Chat identifier //@from_story_id Identifier of the story starting from which stories must be returned; use 0 to get results from the last story //@limit The maximum number of stories to be returned -getArchivedStories#6a864fe7 from_story_id:int32 limit:int32 = Stories; +getChatArchivedStories#af1e9488 chat_id:int53 from_story_id:int32 limit:int32 = Stories; //@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 @@ -8273,7 +8370,7 @@ getStoryAvailableReactions#23854d3b row_size:int32 = AvailableReactions; //@update_recent_reactions Pass true if the reaction needs to be added to recent reactions setStoryReaction#ac8b4fa7 story_sender_chat_id:int53 story_id:int32 reaction_type:ReactionType update_recent_reactions:Bool = Ok; -//@description Returns viewers of a story. The method can be called if story.can_get_viewers == true +//@description Returns viewers of a story. The method can be called only for stories posted on behalf of the current user //@story_id Story identifier //@query Query to search for in names and usernames of the viewers; may be empty to get all relevant viewers //@only_contacts Pass true to get only contacts; pass false to get all relevant viewers @@ -8292,6 +8389,32 @@ reportStory#9b5f709b story_sender_chat_id:int53 story_id:int32 reason:ReportReas //@description Activates stealth mode for stories, which hides all views of stories from the current user in the last "story_stealth_mode_past_period" seconds activateStoryStealthMode#c3db8491 = Ok; +//@description Returns the current boost status for a channel chat +//@chat_id Identifier of the channel chat +getChatBoostStatus#cfac8acf chat_id:int53 = ChatBoostStatus; + +//@description Checks whether the current user can boost a chat +//@chat_id Identifier of the chat +canBoostChat#836e6e58 chat_id:int53 = CanBoostChatResult; + +//@description Boosts a chat +//@chat_id Identifier of the chat +boostChat#4e314c2d chat_id:int53 = Ok; + +//@description Returns an HTTPS link to boost the specified channel chat +//@chat_id Identifier of the chat +getChatBoostLink#56f16c85 chat_id:int53 = ChatBoostLink; + +//@description Returns information about a link to boost a chat. Can be called for any internal link of the type internalLinkTypeChatBoost +//@url The link to boost a chat +getChatBoostLinkInfo#26fc4b5c url:string = ChatBoostLinkInfo; + +//@description Returns list of boosts applied to a chat. The user must be an administrator in the channel chat to get the list of boosts +//@chat_id Identifier of 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#d82a288e chat_id:int53 offset:string limit:int32 = FoundChatBoosts; + //@description Returns information about a bot that can be added to attachment or side menu //@bot_user_id Bot's user identifier getAttachmentMenuBot#3da561fb bot_user_id:int53 = AttachmentMenuBot; @@ -8625,7 +8748,7 @@ setGroupCallTitle#b6c19dcd group_call_id:int32 title:string = Ok; //@mute_new_participants New value of the mute_new_participants setting toggleGroupCallMuteNewParticipants#10eec1c2 group_call_id:int32 mute_new_participants:Bool = Ok; -//@description Invites users to an active group call. Sends a service message of type messageInviteToGroupCall for video chats +//@description Invites users to an active group call. Sends a service message of type messageInviteVideoChatParticipants for video chats //@group_call_id Group call identifier //@user_ids User identifiers. At most 10 users can be invited simultaneously inviteGroupCallParticipants#56c030a6 group_call_id:int32 user_ids:vector = Ok; @@ -9245,7 +9368,7 @@ closeSecretChat#e3ed044b secret_chat_id:int32 = Ok; //@user_ids User identifiers by which to filter events. By default, events relating to all users will be returned getChatEventLog#f47b0a9b chat_id:int53 query:string from_event_id:int64 limit:int32 filters:chatEventLogFilters user_ids:vector = ChatEvents; -//@description Returns an invoice payment form. This method must be called when the user presses inlineKeyboardButtonBuy +//@description Returns an invoice payment form. This method must be called when the user presses inline button of the type inlineKeyboardButtonTypeBuy //@input_invoice The invoice //@theme Preferred payment form theme; pass null to use the default theme getPaymentForm#8d4f76d4 input_invoice:InputInvoice theme:themeParameters = PaymentForm; diff --git a/tdapi/tl_boost_chat_gen.go b/tdapi/tl_boost_chat_gen.go new file mode 100644 index 0000000000..6eb6801727 --- /dev/null +++ b/tdapi/tl_boost_chat_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{} +) + +// BoostChatRequest represents TL type `boostChat#4e314c2d`. +type BoostChatRequest struct { + // Identifier of the chat + ChatID int64 +} + +// BoostChatRequestTypeID is TL type id of BoostChatRequest. +const BoostChatRequestTypeID = 0x4e314c2d + +// Ensuring interfaces in compile-time for BoostChatRequest. +var ( + _ bin.Encoder = &BoostChatRequest{} + _ bin.Decoder = &BoostChatRequest{} + _ bin.BareEncoder = &BoostChatRequest{} + _ bin.BareDecoder = &BoostChatRequest{} +) + +func (b *BoostChatRequest) Zero() bool { + if b == nil { + return true + } + if !(b.ChatID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BoostChatRequest) String() string { + if b == nil { + return "BoostChatRequest(nil)" + } + type Alias BoostChatRequest + return fmt.Sprintf("BoostChatRequest%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BoostChatRequest) TypeID() uint32 { + return BoostChatRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*BoostChatRequest) TypeName() string { + return "boostChat" +} + +// TypeInfo returns info about TL type. +func (b *BoostChatRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "boostChat", + ID: BoostChatRequestTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BoostChatRequest) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode boostChat#4e314c2d as nil") + } + buf.PutID(BoostChatRequestTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BoostChatRequest) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode boostChat#4e314c2d as nil") + } + buf.PutInt53(b.ChatID) + return nil +} + +// Decode implements bin.Decoder. +func (b *BoostChatRequest) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode boostChat#4e314c2d to nil") + } + if err := buf.ConsumeID(BoostChatRequestTypeID); err != nil { + return fmt.Errorf("unable to decode boostChat#4e314c2d: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BoostChatRequest) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode boostChat#4e314c2d to nil") + } + { + value, err := buf.Int53() + if err != nil { + return fmt.Errorf("unable to decode boostChat#4e314c2d: field chat_id: %w", err) + } + b.ChatID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BoostChatRequest) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode boostChat#4e314c2d as nil") + } + buf.ObjStart() + buf.PutID("boostChat") + buf.Comma() + buf.FieldStart("chat_id") + buf.PutInt53(b.ChatID) + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BoostChatRequest) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode boostChat#4e314c2d to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("boostChat"); err != nil { + return fmt.Errorf("unable to decode boostChat#4e314c2d: %w", err) + } + case "chat_id": + value, err := buf.Int53() + if err != nil { + return fmt.Errorf("unable to decode boostChat#4e314c2d: field chat_id: %w", err) + } + b.ChatID = value + default: + return buf.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (b *BoostChatRequest) GetChatID() (value int64) { + if b == nil { + return + } + return b.ChatID +} + +// BoostChat invokes method boostChat#4e314c2d returning error if any. +func (c *Client) BoostChat(ctx context.Context, chatid int64) error { + var ok Ok + + request := &BoostChatRequest{ + ChatID: chatid, + } + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_can_boost_chat_gen.go b/tdapi/tl_can_boost_chat_gen.go new file mode 100644 index 0000000000..59899d8fd5 --- /dev/null +++ b/tdapi/tl_can_boost_chat_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{} +) + +// CanBoostChatRequest represents TL type `canBoostChat#836e6e58`. +type CanBoostChatRequest struct { + // Identifier of the chat + ChatID int64 +} + +// CanBoostChatRequestTypeID is TL type id of CanBoostChatRequest. +const CanBoostChatRequestTypeID = 0x836e6e58 + +// Ensuring interfaces in compile-time for CanBoostChatRequest. +var ( + _ bin.Encoder = &CanBoostChatRequest{} + _ bin.Decoder = &CanBoostChatRequest{} + _ bin.BareEncoder = &CanBoostChatRequest{} + _ bin.BareDecoder = &CanBoostChatRequest{} +) + +func (c *CanBoostChatRequest) Zero() bool { + if c == nil { + return true + } + if !(c.ChatID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *CanBoostChatRequest) String() string { + if c == nil { + return "CanBoostChatRequest(nil)" + } + type Alias CanBoostChatRequest + return fmt.Sprintf("CanBoostChatRequest%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*CanBoostChatRequest) TypeID() uint32 { + return CanBoostChatRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*CanBoostChatRequest) TypeName() string { + return "canBoostChat" +} + +// TypeInfo returns info about TL type. +func (c *CanBoostChatRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "canBoostChat", + ID: CanBoostChatRequestTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *CanBoostChatRequest) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChat#836e6e58 as nil") + } + b.PutID(CanBoostChatRequestTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *CanBoostChatRequest) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChat#836e6e58 as nil") + } + b.PutInt53(c.ChatID) + return nil +} + +// Decode implements bin.Decoder. +func (c *CanBoostChatRequest) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChat#836e6e58 to nil") + } + if err := b.ConsumeID(CanBoostChatRequestTypeID); err != nil { + return fmt.Errorf("unable to decode canBoostChat#836e6e58: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *CanBoostChatRequest) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChat#836e6e58 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode canBoostChat#836e6e58: field chat_id: %w", err) + } + c.ChatID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *CanBoostChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChat#836e6e58 as nil") + } + b.ObjStart() + b.PutID("canBoostChat") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(c.ChatID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *CanBoostChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChat#836e6e58 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("canBoostChat"); err != nil { + return fmt.Errorf("unable to decode canBoostChat#836e6e58: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode canBoostChat#836e6e58: field chat_id: %w", err) + } + c.ChatID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (c *CanBoostChatRequest) GetChatID() (value int64) { + if c == nil { + return + } + return c.ChatID +} + +// CanBoostChat invokes method canBoostChat#836e6e58 returning error if any. +func (c *Client) CanBoostChat(ctx context.Context, chatid int64) (CanBoostChatResultClass, error) { + var result CanBoostChatResultBox + + request := &CanBoostChatRequest{ + ChatID: chatid, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.CanBoostChatResult, nil +} diff --git a/tdapi/tl_can_boost_chat_result_gen.go b/tdapi/tl_can_boost_chat_result_gen.go new file mode 100644 index 0000000000..92679c2eef --- /dev/null +++ b/tdapi/tl_can_boost_chat_result_gen.go @@ -0,0 +1,1085 @@ +// 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{} +) + +// CanBoostChatResultOk represents TL type `canBoostChatResultOk#1da13a8b`. +type CanBoostChatResultOk struct { + // Identifier of the currently boosted chat from which boost will be removed; 0 if none + CurrentlyBoostedChatID int64 +} + +// CanBoostChatResultOkTypeID is TL type id of CanBoostChatResultOk. +const CanBoostChatResultOkTypeID = 0x1da13a8b + +// construct implements constructor of CanBoostChatResultClass. +func (c CanBoostChatResultOk) construct() CanBoostChatResultClass { return &c } + +// Ensuring interfaces in compile-time for CanBoostChatResultOk. +var ( + _ bin.Encoder = &CanBoostChatResultOk{} + _ bin.Decoder = &CanBoostChatResultOk{} + _ bin.BareEncoder = &CanBoostChatResultOk{} + _ bin.BareDecoder = &CanBoostChatResultOk{} + + _ CanBoostChatResultClass = &CanBoostChatResultOk{} +) + +func (c *CanBoostChatResultOk) Zero() bool { + if c == nil { + return true + } + if !(c.CurrentlyBoostedChatID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *CanBoostChatResultOk) String() string { + if c == nil { + return "CanBoostChatResultOk(nil)" + } + type Alias CanBoostChatResultOk + return fmt.Sprintf("CanBoostChatResultOk%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*CanBoostChatResultOk) TypeID() uint32 { + return CanBoostChatResultOkTypeID +} + +// TypeName returns name of type in TL schema. +func (*CanBoostChatResultOk) TypeName() string { + return "canBoostChatResultOk" +} + +// TypeInfo returns info about TL type. +func (c *CanBoostChatResultOk) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "canBoostChatResultOk", + ID: CanBoostChatResultOkTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "CurrentlyBoostedChatID", + SchemaName: "currently_boosted_chat_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *CanBoostChatResultOk) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChatResultOk#1da13a8b as nil") + } + b.PutID(CanBoostChatResultOkTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *CanBoostChatResultOk) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChatResultOk#1da13a8b as nil") + } + b.PutInt53(c.CurrentlyBoostedChatID) + return nil +} + +// Decode implements bin.Decoder. +func (c *CanBoostChatResultOk) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChatResultOk#1da13a8b to nil") + } + if err := b.ConsumeID(CanBoostChatResultOkTypeID); err != nil { + return fmt.Errorf("unable to decode canBoostChatResultOk#1da13a8b: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *CanBoostChatResultOk) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChatResultOk#1da13a8b to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode canBoostChatResultOk#1da13a8b: field currently_boosted_chat_id: %w", err) + } + c.CurrentlyBoostedChatID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *CanBoostChatResultOk) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChatResultOk#1da13a8b as nil") + } + b.ObjStart() + b.PutID("canBoostChatResultOk") + b.Comma() + b.FieldStart("currently_boosted_chat_id") + b.PutInt53(c.CurrentlyBoostedChatID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *CanBoostChatResultOk) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChatResultOk#1da13a8b to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("canBoostChatResultOk"); err != nil { + return fmt.Errorf("unable to decode canBoostChatResultOk#1da13a8b: %w", err) + } + case "currently_boosted_chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode canBoostChatResultOk#1da13a8b: field currently_boosted_chat_id: %w", err) + } + c.CurrentlyBoostedChatID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetCurrentlyBoostedChatID returns value of CurrentlyBoostedChatID field. +func (c *CanBoostChatResultOk) GetCurrentlyBoostedChatID() (value int64) { + if c == nil { + return + } + return c.CurrentlyBoostedChatID +} + +// CanBoostChatResultInvalidChat represents TL type `canBoostChatResultInvalidChat#3d4c3668`. +type CanBoostChatResultInvalidChat struct { +} + +// CanBoostChatResultInvalidChatTypeID is TL type id of CanBoostChatResultInvalidChat. +const CanBoostChatResultInvalidChatTypeID = 0x3d4c3668 + +// construct implements constructor of CanBoostChatResultClass. +func (c CanBoostChatResultInvalidChat) construct() CanBoostChatResultClass { return &c } + +// Ensuring interfaces in compile-time for CanBoostChatResultInvalidChat. +var ( + _ bin.Encoder = &CanBoostChatResultInvalidChat{} + _ bin.Decoder = &CanBoostChatResultInvalidChat{} + _ bin.BareEncoder = &CanBoostChatResultInvalidChat{} + _ bin.BareDecoder = &CanBoostChatResultInvalidChat{} + + _ CanBoostChatResultClass = &CanBoostChatResultInvalidChat{} +) + +func (c *CanBoostChatResultInvalidChat) Zero() bool { + if c == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (c *CanBoostChatResultInvalidChat) String() string { + if c == nil { + return "CanBoostChatResultInvalidChat(nil)" + } + type Alias CanBoostChatResultInvalidChat + return fmt.Sprintf("CanBoostChatResultInvalidChat%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*CanBoostChatResultInvalidChat) TypeID() uint32 { + return CanBoostChatResultInvalidChatTypeID +} + +// TypeName returns name of type in TL schema. +func (*CanBoostChatResultInvalidChat) TypeName() string { + return "canBoostChatResultInvalidChat" +} + +// TypeInfo returns info about TL type. +func (c *CanBoostChatResultInvalidChat) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "canBoostChatResultInvalidChat", + ID: CanBoostChatResultInvalidChatTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (c *CanBoostChatResultInvalidChat) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChatResultInvalidChat#3d4c3668 as nil") + } + b.PutID(CanBoostChatResultInvalidChatTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *CanBoostChatResultInvalidChat) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChatResultInvalidChat#3d4c3668 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (c *CanBoostChatResultInvalidChat) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChatResultInvalidChat#3d4c3668 to nil") + } + if err := b.ConsumeID(CanBoostChatResultInvalidChatTypeID); err != nil { + return fmt.Errorf("unable to decode canBoostChatResultInvalidChat#3d4c3668: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *CanBoostChatResultInvalidChat) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChatResultInvalidChat#3d4c3668 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *CanBoostChatResultInvalidChat) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChatResultInvalidChat#3d4c3668 as nil") + } + b.ObjStart() + b.PutID("canBoostChatResultInvalidChat") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *CanBoostChatResultInvalidChat) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChatResultInvalidChat#3d4c3668 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("canBoostChatResultInvalidChat"); err != nil { + return fmt.Errorf("unable to decode canBoostChatResultInvalidChat#3d4c3668: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// CanBoostChatResultAlreadyBoosted represents TL type `canBoostChatResultAlreadyBoosted#3e012a69`. +type CanBoostChatResultAlreadyBoosted struct { +} + +// CanBoostChatResultAlreadyBoostedTypeID is TL type id of CanBoostChatResultAlreadyBoosted. +const CanBoostChatResultAlreadyBoostedTypeID = 0x3e012a69 + +// construct implements constructor of CanBoostChatResultClass. +func (c CanBoostChatResultAlreadyBoosted) construct() CanBoostChatResultClass { return &c } + +// Ensuring interfaces in compile-time for CanBoostChatResultAlreadyBoosted. +var ( + _ bin.Encoder = &CanBoostChatResultAlreadyBoosted{} + _ bin.Decoder = &CanBoostChatResultAlreadyBoosted{} + _ bin.BareEncoder = &CanBoostChatResultAlreadyBoosted{} + _ bin.BareDecoder = &CanBoostChatResultAlreadyBoosted{} + + _ CanBoostChatResultClass = &CanBoostChatResultAlreadyBoosted{} +) + +func (c *CanBoostChatResultAlreadyBoosted) Zero() bool { + if c == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (c *CanBoostChatResultAlreadyBoosted) String() string { + if c == nil { + return "CanBoostChatResultAlreadyBoosted(nil)" + } + type Alias CanBoostChatResultAlreadyBoosted + return fmt.Sprintf("CanBoostChatResultAlreadyBoosted%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*CanBoostChatResultAlreadyBoosted) TypeID() uint32 { + return CanBoostChatResultAlreadyBoostedTypeID +} + +// TypeName returns name of type in TL schema. +func (*CanBoostChatResultAlreadyBoosted) TypeName() string { + return "canBoostChatResultAlreadyBoosted" +} + +// TypeInfo returns info about TL type. +func (c *CanBoostChatResultAlreadyBoosted) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "canBoostChatResultAlreadyBoosted", + ID: CanBoostChatResultAlreadyBoostedTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (c *CanBoostChatResultAlreadyBoosted) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChatResultAlreadyBoosted#3e012a69 as nil") + } + b.PutID(CanBoostChatResultAlreadyBoostedTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *CanBoostChatResultAlreadyBoosted) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChatResultAlreadyBoosted#3e012a69 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (c *CanBoostChatResultAlreadyBoosted) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChatResultAlreadyBoosted#3e012a69 to nil") + } + if err := b.ConsumeID(CanBoostChatResultAlreadyBoostedTypeID); err != nil { + return fmt.Errorf("unable to decode canBoostChatResultAlreadyBoosted#3e012a69: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *CanBoostChatResultAlreadyBoosted) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChatResultAlreadyBoosted#3e012a69 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *CanBoostChatResultAlreadyBoosted) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChatResultAlreadyBoosted#3e012a69 as nil") + } + b.ObjStart() + b.PutID("canBoostChatResultAlreadyBoosted") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *CanBoostChatResultAlreadyBoosted) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChatResultAlreadyBoosted#3e012a69 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("canBoostChatResultAlreadyBoosted"); err != nil { + return fmt.Errorf("unable to decode canBoostChatResultAlreadyBoosted#3e012a69: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// CanBoostChatResultPremiumNeeded represents TL type `canBoostChatResultPremiumNeeded#d4b4e4f`. +type CanBoostChatResultPremiumNeeded struct { +} + +// CanBoostChatResultPremiumNeededTypeID is TL type id of CanBoostChatResultPremiumNeeded. +const CanBoostChatResultPremiumNeededTypeID = 0xd4b4e4f + +// construct implements constructor of CanBoostChatResultClass. +func (c CanBoostChatResultPremiumNeeded) construct() CanBoostChatResultClass { return &c } + +// Ensuring interfaces in compile-time for CanBoostChatResultPremiumNeeded. +var ( + _ bin.Encoder = &CanBoostChatResultPremiumNeeded{} + _ bin.Decoder = &CanBoostChatResultPremiumNeeded{} + _ bin.BareEncoder = &CanBoostChatResultPremiumNeeded{} + _ bin.BareDecoder = &CanBoostChatResultPremiumNeeded{} + + _ CanBoostChatResultClass = &CanBoostChatResultPremiumNeeded{} +) + +func (c *CanBoostChatResultPremiumNeeded) Zero() bool { + if c == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (c *CanBoostChatResultPremiumNeeded) String() string { + if c == nil { + return "CanBoostChatResultPremiumNeeded(nil)" + } + type Alias CanBoostChatResultPremiumNeeded + return fmt.Sprintf("CanBoostChatResultPremiumNeeded%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*CanBoostChatResultPremiumNeeded) TypeID() uint32 { + return CanBoostChatResultPremiumNeededTypeID +} + +// TypeName returns name of type in TL schema. +func (*CanBoostChatResultPremiumNeeded) TypeName() string { + return "canBoostChatResultPremiumNeeded" +} + +// TypeInfo returns info about TL type. +func (c *CanBoostChatResultPremiumNeeded) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "canBoostChatResultPremiumNeeded", + ID: CanBoostChatResultPremiumNeededTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (c *CanBoostChatResultPremiumNeeded) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChatResultPremiumNeeded#d4b4e4f as nil") + } + b.PutID(CanBoostChatResultPremiumNeededTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *CanBoostChatResultPremiumNeeded) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChatResultPremiumNeeded#d4b4e4f as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (c *CanBoostChatResultPremiumNeeded) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChatResultPremiumNeeded#d4b4e4f to nil") + } + if err := b.ConsumeID(CanBoostChatResultPremiumNeededTypeID); err != nil { + return fmt.Errorf("unable to decode canBoostChatResultPremiumNeeded#d4b4e4f: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *CanBoostChatResultPremiumNeeded) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChatResultPremiumNeeded#d4b4e4f to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *CanBoostChatResultPremiumNeeded) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChatResultPremiumNeeded#d4b4e4f as nil") + } + b.ObjStart() + b.PutID("canBoostChatResultPremiumNeeded") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *CanBoostChatResultPremiumNeeded) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChatResultPremiumNeeded#d4b4e4f to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("canBoostChatResultPremiumNeeded"); err != nil { + return fmt.Errorf("unable to decode canBoostChatResultPremiumNeeded#d4b4e4f: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// CanBoostChatResultPremiumSubscriptionNeeded represents TL type `canBoostChatResultPremiumSubscriptionNeeded#7550d3cc`. +type CanBoostChatResultPremiumSubscriptionNeeded struct { +} + +// CanBoostChatResultPremiumSubscriptionNeededTypeID is TL type id of CanBoostChatResultPremiumSubscriptionNeeded. +const CanBoostChatResultPremiumSubscriptionNeededTypeID = 0x7550d3cc + +// construct implements constructor of CanBoostChatResultClass. +func (c CanBoostChatResultPremiumSubscriptionNeeded) construct() CanBoostChatResultClass { return &c } + +// Ensuring interfaces in compile-time for CanBoostChatResultPremiumSubscriptionNeeded. +var ( + _ bin.Encoder = &CanBoostChatResultPremiumSubscriptionNeeded{} + _ bin.Decoder = &CanBoostChatResultPremiumSubscriptionNeeded{} + _ bin.BareEncoder = &CanBoostChatResultPremiumSubscriptionNeeded{} + _ bin.BareDecoder = &CanBoostChatResultPremiumSubscriptionNeeded{} + + _ CanBoostChatResultClass = &CanBoostChatResultPremiumSubscriptionNeeded{} +) + +func (c *CanBoostChatResultPremiumSubscriptionNeeded) Zero() bool { + if c == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (c *CanBoostChatResultPremiumSubscriptionNeeded) String() string { + if c == nil { + return "CanBoostChatResultPremiumSubscriptionNeeded(nil)" + } + type Alias CanBoostChatResultPremiumSubscriptionNeeded + return fmt.Sprintf("CanBoostChatResultPremiumSubscriptionNeeded%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*CanBoostChatResultPremiumSubscriptionNeeded) TypeID() uint32 { + return CanBoostChatResultPremiumSubscriptionNeededTypeID +} + +// TypeName returns name of type in TL schema. +func (*CanBoostChatResultPremiumSubscriptionNeeded) TypeName() string { + return "canBoostChatResultPremiumSubscriptionNeeded" +} + +// TypeInfo returns info about TL type. +func (c *CanBoostChatResultPremiumSubscriptionNeeded) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "canBoostChatResultPremiumSubscriptionNeeded", + ID: CanBoostChatResultPremiumSubscriptionNeededTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (c *CanBoostChatResultPremiumSubscriptionNeeded) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChatResultPremiumSubscriptionNeeded#7550d3cc as nil") + } + b.PutID(CanBoostChatResultPremiumSubscriptionNeededTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *CanBoostChatResultPremiumSubscriptionNeeded) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChatResultPremiumSubscriptionNeeded#7550d3cc as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (c *CanBoostChatResultPremiumSubscriptionNeeded) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChatResultPremiumSubscriptionNeeded#7550d3cc to nil") + } + if err := b.ConsumeID(CanBoostChatResultPremiumSubscriptionNeededTypeID); err != nil { + return fmt.Errorf("unable to decode canBoostChatResultPremiumSubscriptionNeeded#7550d3cc: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *CanBoostChatResultPremiumSubscriptionNeeded) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChatResultPremiumSubscriptionNeeded#7550d3cc to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *CanBoostChatResultPremiumSubscriptionNeeded) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChatResultPremiumSubscriptionNeeded#7550d3cc as nil") + } + b.ObjStart() + b.PutID("canBoostChatResultPremiumSubscriptionNeeded") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *CanBoostChatResultPremiumSubscriptionNeeded) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChatResultPremiumSubscriptionNeeded#7550d3cc to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("canBoostChatResultPremiumSubscriptionNeeded"); err != nil { + return fmt.Errorf("unable to decode canBoostChatResultPremiumSubscriptionNeeded#7550d3cc: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// CanBoostChatResultWaitNeeded represents TL type `canBoostChatResultWaitNeeded#343aaeaa`. +type CanBoostChatResultWaitNeeded struct { + // Time left before the user can boost another chat + RetryAfter int32 +} + +// CanBoostChatResultWaitNeededTypeID is TL type id of CanBoostChatResultWaitNeeded. +const CanBoostChatResultWaitNeededTypeID = 0x343aaeaa + +// construct implements constructor of CanBoostChatResultClass. +func (c CanBoostChatResultWaitNeeded) construct() CanBoostChatResultClass { return &c } + +// Ensuring interfaces in compile-time for CanBoostChatResultWaitNeeded. +var ( + _ bin.Encoder = &CanBoostChatResultWaitNeeded{} + _ bin.Decoder = &CanBoostChatResultWaitNeeded{} + _ bin.BareEncoder = &CanBoostChatResultWaitNeeded{} + _ bin.BareDecoder = &CanBoostChatResultWaitNeeded{} + + _ CanBoostChatResultClass = &CanBoostChatResultWaitNeeded{} +) + +func (c *CanBoostChatResultWaitNeeded) Zero() bool { + if c == nil { + return true + } + if !(c.RetryAfter == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *CanBoostChatResultWaitNeeded) String() string { + if c == nil { + return "CanBoostChatResultWaitNeeded(nil)" + } + type Alias CanBoostChatResultWaitNeeded + return fmt.Sprintf("CanBoostChatResultWaitNeeded%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*CanBoostChatResultWaitNeeded) TypeID() uint32 { + return CanBoostChatResultWaitNeededTypeID +} + +// TypeName returns name of type in TL schema. +func (*CanBoostChatResultWaitNeeded) TypeName() string { + return "canBoostChatResultWaitNeeded" +} + +// TypeInfo returns info about TL type. +func (c *CanBoostChatResultWaitNeeded) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "canBoostChatResultWaitNeeded", + ID: CanBoostChatResultWaitNeededTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "RetryAfter", + SchemaName: "retry_after", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *CanBoostChatResultWaitNeeded) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChatResultWaitNeeded#343aaeaa as nil") + } + b.PutID(CanBoostChatResultWaitNeededTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *CanBoostChatResultWaitNeeded) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChatResultWaitNeeded#343aaeaa as nil") + } + b.PutInt32(c.RetryAfter) + return nil +} + +// Decode implements bin.Decoder. +func (c *CanBoostChatResultWaitNeeded) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChatResultWaitNeeded#343aaeaa to nil") + } + if err := b.ConsumeID(CanBoostChatResultWaitNeededTypeID); err != nil { + return fmt.Errorf("unable to decode canBoostChatResultWaitNeeded#343aaeaa: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *CanBoostChatResultWaitNeeded) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChatResultWaitNeeded#343aaeaa to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode canBoostChatResultWaitNeeded#343aaeaa: field retry_after: %w", err) + } + c.RetryAfter = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *CanBoostChatResultWaitNeeded) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode canBoostChatResultWaitNeeded#343aaeaa as nil") + } + b.ObjStart() + b.PutID("canBoostChatResultWaitNeeded") + b.Comma() + b.FieldStart("retry_after") + b.PutInt32(c.RetryAfter) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *CanBoostChatResultWaitNeeded) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode canBoostChatResultWaitNeeded#343aaeaa to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("canBoostChatResultWaitNeeded"); err != nil { + return fmt.Errorf("unable to decode canBoostChatResultWaitNeeded#343aaeaa: %w", err) + } + case "retry_after": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode canBoostChatResultWaitNeeded#343aaeaa: field retry_after: %w", err) + } + c.RetryAfter = value + default: + return b.Skip() + } + return nil + }) +} + +// GetRetryAfter returns value of RetryAfter field. +func (c *CanBoostChatResultWaitNeeded) GetRetryAfter() (value int32) { + if c == nil { + return + } + return c.RetryAfter +} + +// CanBoostChatResultClassName is schema name of CanBoostChatResultClass. +const CanBoostChatResultClassName = "CanBoostChatResult" + +// CanBoostChatResultClass represents CanBoostChatResult generic type. +// +// Example: +// +// g, err := tdapi.DecodeCanBoostChatResult(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tdapi.CanBoostChatResultOk: // canBoostChatResultOk#1da13a8b +// case *tdapi.CanBoostChatResultInvalidChat: // canBoostChatResultInvalidChat#3d4c3668 +// case *tdapi.CanBoostChatResultAlreadyBoosted: // canBoostChatResultAlreadyBoosted#3e012a69 +// case *tdapi.CanBoostChatResultPremiumNeeded: // canBoostChatResultPremiumNeeded#d4b4e4f +// case *tdapi.CanBoostChatResultPremiumSubscriptionNeeded: // canBoostChatResultPremiumSubscriptionNeeded#7550d3cc +// case *tdapi.CanBoostChatResultWaitNeeded: // canBoostChatResultWaitNeeded#343aaeaa +// default: panic(v) +// } +type CanBoostChatResultClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() CanBoostChatResultClass + + // 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 +} + +// DecodeCanBoostChatResult implements binary de-serialization for CanBoostChatResultClass. +func DecodeCanBoostChatResult(buf *bin.Buffer) (CanBoostChatResultClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case CanBoostChatResultOkTypeID: + // Decoding canBoostChatResultOk#1da13a8b. + v := CanBoostChatResultOk{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode CanBoostChatResultClass: %w", err) + } + return &v, nil + case CanBoostChatResultInvalidChatTypeID: + // Decoding canBoostChatResultInvalidChat#3d4c3668. + v := CanBoostChatResultInvalidChat{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode CanBoostChatResultClass: %w", err) + } + return &v, nil + case CanBoostChatResultAlreadyBoostedTypeID: + // Decoding canBoostChatResultAlreadyBoosted#3e012a69. + v := CanBoostChatResultAlreadyBoosted{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode CanBoostChatResultClass: %w", err) + } + return &v, nil + case CanBoostChatResultPremiumNeededTypeID: + // Decoding canBoostChatResultPremiumNeeded#d4b4e4f. + v := CanBoostChatResultPremiumNeeded{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode CanBoostChatResultClass: %w", err) + } + return &v, nil + case CanBoostChatResultPremiumSubscriptionNeededTypeID: + // Decoding canBoostChatResultPremiumSubscriptionNeeded#7550d3cc. + v := CanBoostChatResultPremiumSubscriptionNeeded{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode CanBoostChatResultClass: %w", err) + } + return &v, nil + case CanBoostChatResultWaitNeededTypeID: + // Decoding canBoostChatResultWaitNeeded#343aaeaa. + v := CanBoostChatResultWaitNeeded{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode CanBoostChatResultClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode CanBoostChatResultClass: %w", bin.NewUnexpectedID(id)) + } +} + +// DecodeTDLibJSONCanBoostChatResult implements binary de-serialization for CanBoostChatResultClass. +func DecodeTDLibJSONCanBoostChatResult(buf tdjson.Decoder) (CanBoostChatResultClass, error) { + id, err := buf.FindTypeID() + if err != nil { + return nil, err + } + switch id { + case "canBoostChatResultOk": + // Decoding canBoostChatResultOk#1da13a8b. + v := CanBoostChatResultOk{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode CanBoostChatResultClass: %w", err) + } + return &v, nil + case "canBoostChatResultInvalidChat": + // Decoding canBoostChatResultInvalidChat#3d4c3668. + v := CanBoostChatResultInvalidChat{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode CanBoostChatResultClass: %w", err) + } + return &v, nil + case "canBoostChatResultAlreadyBoosted": + // Decoding canBoostChatResultAlreadyBoosted#3e012a69. + v := CanBoostChatResultAlreadyBoosted{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode CanBoostChatResultClass: %w", err) + } + return &v, nil + case "canBoostChatResultPremiumNeeded": + // Decoding canBoostChatResultPremiumNeeded#d4b4e4f. + v := CanBoostChatResultPremiumNeeded{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode CanBoostChatResultClass: %w", err) + } + return &v, nil + case "canBoostChatResultPremiumSubscriptionNeeded": + // Decoding canBoostChatResultPremiumSubscriptionNeeded#7550d3cc. + v := CanBoostChatResultPremiumSubscriptionNeeded{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode CanBoostChatResultClass: %w", err) + } + return &v, nil + case "canBoostChatResultWaitNeeded": + // Decoding canBoostChatResultWaitNeeded#343aaeaa. + v := CanBoostChatResultWaitNeeded{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode CanBoostChatResultClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode CanBoostChatResultClass: %w", tdjson.NewUnexpectedID(id)) + } +} + +// CanBoostChatResult boxes the CanBoostChatResultClass providing a helper. +type CanBoostChatResultBox struct { + CanBoostChatResult CanBoostChatResultClass +} + +// Decode implements bin.Decoder for CanBoostChatResultBox. +func (b *CanBoostChatResultBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode CanBoostChatResultBox to nil") + } + v, err := DecodeCanBoostChatResult(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.CanBoostChatResult = v + return nil +} + +// Encode implements bin.Encode for CanBoostChatResultBox. +func (b *CanBoostChatResultBox) Encode(buf *bin.Buffer) error { + if b == nil || b.CanBoostChatResult == nil { + return fmt.Errorf("unable to encode CanBoostChatResultClass as nil") + } + return b.CanBoostChatResult.Encode(buf) +} + +// DecodeTDLibJSON implements bin.Decoder for CanBoostChatResultBox. +func (b *CanBoostChatResultBox) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("unable to decode CanBoostChatResultBox to nil") + } + v, err := DecodeTDLibJSONCanBoostChatResult(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.CanBoostChatResult = v + return nil +} + +// EncodeTDLibJSON implements bin.Encode for CanBoostChatResultBox. +func (b *CanBoostChatResultBox) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil || b.CanBoostChatResult == nil { + return fmt.Errorf("unable to encode CanBoostChatResultClass as nil") + } + return b.CanBoostChatResult.EncodeTDLibJSON(buf) +} diff --git a/tdapi/tl_can_send_story_gen.go b/tdapi/tl_can_send_story_gen.go index 3084a3fd9e..1c99f624c7 100644 --- a/tdapi/tl_can_send_story_gen.go +++ b/tdapi/tl_can_send_story_gen.go @@ -31,12 +31,14 @@ var ( _ = tdjson.Encoder{} ) -// CanSendStoryRequest represents TL type `canSendStory#ede53a66`. +// CanSendStoryRequest represents TL type `canSendStory#b6e0216b`. type CanSendStoryRequest struct { + // Chat identifier + ChatID int64 } // CanSendStoryRequestTypeID is TL type id of CanSendStoryRequest. -const CanSendStoryRequestTypeID = 0xede53a66 +const CanSendStoryRequestTypeID = 0xb6e0216b // Ensuring interfaces in compile-time for CanSendStoryRequest. var ( @@ -50,6 +52,9 @@ func (c *CanSendStoryRequest) Zero() bool { if c == nil { return true } + if !(c.ChatID == 0) { + return false + } return true } @@ -85,14 +90,19 @@ func (c *CanSendStoryRequest) TypeInfo() tdp.Type { typ.Null = true return typ } - typ.Fields = []tdp.Field{} + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + } return typ } // Encode implements bin.Encoder. func (c *CanSendStoryRequest) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode canSendStory#ede53a66 as nil") + return fmt.Errorf("can't encode canSendStory#b6e0216b as nil") } b.PutID(CanSendStoryRequestTypeID) return c.EncodeBare(b) @@ -101,18 +111,19 @@ func (c *CanSendStoryRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *CanSendStoryRequest) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode canSendStory#ede53a66 as nil") + return fmt.Errorf("can't encode canSendStory#b6e0216b as nil") } + b.PutInt53(c.ChatID) return nil } // Decode implements bin.Decoder. func (c *CanSendStoryRequest) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode canSendStory#ede53a66 to nil") + return fmt.Errorf("can't decode canSendStory#b6e0216b to nil") } if err := b.ConsumeID(CanSendStoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode canSendStory#ede53a66: %w", err) + return fmt.Errorf("unable to decode canSendStory#b6e0216b: %w", err) } return c.DecodeBare(b) } @@ -120,7 +131,14 @@ func (c *CanSendStoryRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *CanSendStoryRequest) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode canSendStory#ede53a66 to nil") + return fmt.Errorf("can't decode canSendStory#b6e0216b to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode canSendStory#b6e0216b: field chat_id: %w", err) + } + c.ChatID = value } return nil } @@ -128,11 +146,14 @@ func (c *CanSendStoryRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *CanSendStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode canSendStory#ede53a66 as nil") + return fmt.Errorf("can't encode canSendStory#b6e0216b as nil") } b.ObjStart() b.PutID("canSendStory") b.Comma() + b.FieldStart("chat_id") + b.PutInt53(c.ChatID) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -141,15 +162,21 @@ func (c *CanSendStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *CanSendStoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode canSendStory#ede53a66 to nil") + return fmt.Errorf("can't decode canSendStory#b6e0216b to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("canSendStory"); err != nil { - return fmt.Errorf("unable to decode canSendStory#ede53a66: %w", err) + return fmt.Errorf("unable to decode canSendStory#b6e0216b: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode canSendStory#b6e0216b: field chat_id: %w", err) } + c.ChatID = value default: return b.Skip() } @@ -157,11 +184,21 @@ func (c *CanSendStoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// CanSendStory invokes method canSendStory#ede53a66 returning error if any. -func (c *Client) CanSendStory(ctx context.Context) (CanSendStoryResultClass, error) { +// GetChatID returns value of ChatID field. +func (c *CanSendStoryRequest) GetChatID() (value int64) { + if c == nil { + return + } + return c.ChatID +} + +// CanSendStory invokes method canSendStory#b6e0216b returning error if any. +func (c *Client) CanSendStory(ctx context.Context, chatid int64) (CanSendStoryResultClass, error) { var result CanSendStoryResultBox - request := &CanSendStoryRequest{} + request := &CanSendStoryRequest{ + ChatID: chatid, + } if err := c.rpc.Invoke(ctx, request, &result); err != nil { return nil, err } diff --git a/tdapi/tl_can_send_story_result_gen.go b/tdapi/tl_can_send_story_result_gen.go index feaa317857..8b0204bfad 100644 --- a/tdapi/tl_can_send_story_result_gen.go +++ b/tdapi/tl_can_send_story_result_gen.go @@ -293,6 +293,137 @@ func (c *CanSendStoryResultPremiumNeeded) DecodeTDLibJSON(b tdjson.Decoder) erro }) } +// CanSendStoryResultBoostNeeded represents TL type `canSendStoryResultBoostNeeded#9e60e92f`. +type CanSendStoryResultBoostNeeded struct { +} + +// CanSendStoryResultBoostNeededTypeID is TL type id of CanSendStoryResultBoostNeeded. +const CanSendStoryResultBoostNeededTypeID = 0x9e60e92f + +// construct implements constructor of CanSendStoryResultClass. +func (c CanSendStoryResultBoostNeeded) construct() CanSendStoryResultClass { return &c } + +// Ensuring interfaces in compile-time for CanSendStoryResultBoostNeeded. +var ( + _ bin.Encoder = &CanSendStoryResultBoostNeeded{} + _ bin.Decoder = &CanSendStoryResultBoostNeeded{} + _ bin.BareEncoder = &CanSendStoryResultBoostNeeded{} + _ bin.BareDecoder = &CanSendStoryResultBoostNeeded{} + + _ CanSendStoryResultClass = &CanSendStoryResultBoostNeeded{} +) + +func (c *CanSendStoryResultBoostNeeded) Zero() bool { + if c == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (c *CanSendStoryResultBoostNeeded) String() string { + if c == nil { + return "CanSendStoryResultBoostNeeded(nil)" + } + type Alias CanSendStoryResultBoostNeeded + return fmt.Sprintf("CanSendStoryResultBoostNeeded%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*CanSendStoryResultBoostNeeded) TypeID() uint32 { + return CanSendStoryResultBoostNeededTypeID +} + +// TypeName returns name of type in TL schema. +func (*CanSendStoryResultBoostNeeded) TypeName() string { + return "canSendStoryResultBoostNeeded" +} + +// TypeInfo returns info about TL type. +func (c *CanSendStoryResultBoostNeeded) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "canSendStoryResultBoostNeeded", + ID: CanSendStoryResultBoostNeededTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (c *CanSendStoryResultBoostNeeded) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode canSendStoryResultBoostNeeded#9e60e92f as nil") + } + b.PutID(CanSendStoryResultBoostNeededTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *CanSendStoryResultBoostNeeded) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode canSendStoryResultBoostNeeded#9e60e92f as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (c *CanSendStoryResultBoostNeeded) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode canSendStoryResultBoostNeeded#9e60e92f to nil") + } + if err := b.ConsumeID(CanSendStoryResultBoostNeededTypeID); err != nil { + return fmt.Errorf("unable to decode canSendStoryResultBoostNeeded#9e60e92f: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *CanSendStoryResultBoostNeeded) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode canSendStoryResultBoostNeeded#9e60e92f to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *CanSendStoryResultBoostNeeded) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode canSendStoryResultBoostNeeded#9e60e92f as nil") + } + b.ObjStart() + b.PutID("canSendStoryResultBoostNeeded") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *CanSendStoryResultBoostNeeded) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode canSendStoryResultBoostNeeded#9e60e92f to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("canSendStoryResultBoostNeeded"); err != nil { + return fmt.Errorf("unable to decode canSendStoryResultBoostNeeded#9e60e92f: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + // CanSendStoryResultActiveStoryLimitExceeded represents TL type `canSendStoryResultActiveStoryLimitExceeded#afd9aad6`. type CanSendStoryResultActiveStoryLimitExceeded struct { } @@ -770,6 +901,7 @@ const CanSendStoryResultClassName = "CanSendStoryResult" // switch v := g.(type) { // case *tdapi.CanSendStoryResultOk: // canSendStoryResultOk#503cf0fd // case *tdapi.CanSendStoryResultPremiumNeeded: // canSendStoryResultPremiumNeeded#567fde69 +// case *tdapi.CanSendStoryResultBoostNeeded: // canSendStoryResultBoostNeeded#9e60e92f // case *tdapi.CanSendStoryResultActiveStoryLimitExceeded: // canSendStoryResultActiveStoryLimitExceeded#afd9aad6 // case *tdapi.CanSendStoryResultWeeklyLimitExceeded: // canSendStoryResultWeeklyLimitExceeded#1341a0b8 // case *tdapi.CanSendStoryResultMonthlyLimitExceeded: // canSendStoryResultMonthlyLimitExceeded#dd8242d5 @@ -818,6 +950,13 @@ func DecodeCanSendStoryResult(buf *bin.Buffer) (CanSendStoryResultClass, error) return nil, fmt.Errorf("unable to decode CanSendStoryResultClass: %w", err) } return &v, nil + case CanSendStoryResultBoostNeededTypeID: + // Decoding canSendStoryResultBoostNeeded#9e60e92f. + v := CanSendStoryResultBoostNeeded{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode CanSendStoryResultClass: %w", err) + } + return &v, nil case CanSendStoryResultActiveStoryLimitExceededTypeID: // Decoding canSendStoryResultActiveStoryLimitExceeded#afd9aad6. v := CanSendStoryResultActiveStoryLimitExceeded{} @@ -865,6 +1004,13 @@ func DecodeTDLibJSONCanSendStoryResult(buf tdjson.Decoder) (CanSendStoryResultCl return nil, fmt.Errorf("unable to decode CanSendStoryResultClass: %w", err) } return &v, nil + case "canSendStoryResultBoostNeeded": + // Decoding canSendStoryResultBoostNeeded#9e60e92f. + v := CanSendStoryResultBoostNeeded{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode CanSendStoryResultClass: %w", err) + } + return &v, nil case "canSendStoryResultActiveStoryLimitExceeded": // Decoding canSendStoryResultActiveStoryLimitExceeded#afd9aad6. v := CanSendStoryResultActiveStoryLimitExceeded{} diff --git a/tdapi/tl_chat_administrator_rights_gen.go b/tdapi/tl_chat_administrator_rights_gen.go index 7114fa9986..0de491ef0f 100644 --- a/tdapi/tl_chat_administrator_rights_gen.go +++ b/tdapi/tl_chat_administrator_rights_gen.go @@ -31,12 +31,10 @@ var ( _ = tdjson.Encoder{} ) -// ChatAdministratorRights represents TL type `chatAdministratorRights#ad77eac7`. +// ChatAdministratorRights represents TL type `chatAdministratorRights#5f4f9044`. type ChatAdministratorRights struct { - // True, if the administrator can get chat event log, get chat statistics, get message - // statistics in channels, get channel members, see anonymous administrators in - // supergroups and ignore slow mode. Implied by any other privilege; applicable to - // supergroups and channels only + // True, if the administrator can get chat event log, get chat statistics, get chat + // boosts in channels, get message statistics in channels, get channel members, CanManageChat bool // True, if the administrator can change the chat title, photo, and other settings CanChangeInfo bool @@ -62,13 +60,22 @@ type ChatAdministratorRights struct { CanPromoteMembers bool // True, if the administrator can manage video chats CanManageVideoChats bool + // True, if the administrator can create new channel stories, or edit and delete posted + // stories; applicable to channels only + CanPostStories bool + // True, if the administrator can edit stories posted by other users, pin stories and + // access story archive; applicable to channels only + CanEditStories bool + // True, if the administrator can delete stories posted by other users; applicable to + // channels only + CanDeleteStories bool // True, if the administrator isn't shown in the chat member list and sends messages // anonymously; applicable to supergroups only IsAnonymous bool } // ChatAdministratorRightsTypeID is TL type id of ChatAdministratorRights. -const ChatAdministratorRightsTypeID = 0xad77eac7 +const ChatAdministratorRightsTypeID = 0x5f4f9044 // Ensuring interfaces in compile-time for ChatAdministratorRights. var ( @@ -115,6 +122,15 @@ func (c *ChatAdministratorRights) Zero() bool { if !(c.CanManageVideoChats == false) { return false } + if !(c.CanPostStories == false) { + return false + } + if !(c.CanEditStories == false) { + return false + } + if !(c.CanDeleteStories == false) { + return false + } if !(c.IsAnonymous == false) { return false } @@ -198,6 +214,18 @@ func (c *ChatAdministratorRights) TypeInfo() tdp.Type { Name: "CanManageVideoChats", SchemaName: "can_manage_video_chats", }, + { + Name: "CanPostStories", + SchemaName: "can_post_stories", + }, + { + Name: "CanEditStories", + SchemaName: "can_edit_stories", + }, + { + Name: "CanDeleteStories", + SchemaName: "can_delete_stories", + }, { Name: "IsAnonymous", SchemaName: "is_anonymous", @@ -209,7 +237,7 @@ func (c *ChatAdministratorRights) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *ChatAdministratorRights) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatAdministratorRights#ad77eac7 as nil") + return fmt.Errorf("can't encode chatAdministratorRights#5f4f9044 as nil") } b.PutID(ChatAdministratorRightsTypeID) return c.EncodeBare(b) @@ -218,7 +246,7 @@ func (c *ChatAdministratorRights) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatAdministratorRights) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatAdministratorRights#ad77eac7 as nil") + return fmt.Errorf("can't encode chatAdministratorRights#5f4f9044 as nil") } b.PutBool(c.CanManageChat) b.PutBool(c.CanChangeInfo) @@ -231,6 +259,9 @@ func (c *ChatAdministratorRights) EncodeBare(b *bin.Buffer) error { b.PutBool(c.CanManageTopics) b.PutBool(c.CanPromoteMembers) b.PutBool(c.CanManageVideoChats) + b.PutBool(c.CanPostStories) + b.PutBool(c.CanEditStories) + b.PutBool(c.CanDeleteStories) b.PutBool(c.IsAnonymous) return nil } @@ -238,10 +269,10 @@ func (c *ChatAdministratorRights) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (c *ChatAdministratorRights) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatAdministratorRights#ad77eac7 to nil") + return fmt.Errorf("can't decode chatAdministratorRights#5f4f9044 to nil") } if err := b.ConsumeID(ChatAdministratorRightsTypeID); err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: %w", err) } return c.DecodeBare(b) } @@ -249,89 +280,110 @@ func (c *ChatAdministratorRights) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatAdministratorRights) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatAdministratorRights#ad77eac7 to nil") + return fmt.Errorf("can't decode chatAdministratorRights#5f4f9044 to nil") } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_manage_chat: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_manage_chat: %w", err) } c.CanManageChat = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_change_info: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_change_info: %w", err) } c.CanChangeInfo = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_post_messages: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_post_messages: %w", err) } c.CanPostMessages = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_edit_messages: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_edit_messages: %w", err) } c.CanEditMessages = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_delete_messages: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_delete_messages: %w", err) } c.CanDeleteMessages = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_invite_users: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_invite_users: %w", err) } c.CanInviteUsers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_restrict_members: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_restrict_members: %w", err) } c.CanRestrictMembers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_pin_messages: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_pin_messages: %w", err) } c.CanPinMessages = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_manage_topics: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_manage_topics: %w", err) } c.CanManageTopics = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_promote_members: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_promote_members: %w", err) } c.CanPromoteMembers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_manage_video_chats: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_manage_video_chats: %w", err) } c.CanManageVideoChats = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field is_anonymous: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_post_stories: %w", err) + } + c.CanPostStories = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_edit_stories: %w", err) + } + c.CanEditStories = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_delete_stories: %w", err) + } + c.CanDeleteStories = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field is_anonymous: %w", err) } c.IsAnonymous = value } @@ -341,7 +393,7 @@ func (c *ChatAdministratorRights) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *ChatAdministratorRights) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatAdministratorRights#ad77eac7 as nil") + return fmt.Errorf("can't encode chatAdministratorRights#5f4f9044 as nil") } b.ObjStart() b.PutID("chatAdministratorRights") @@ -379,6 +431,15 @@ func (c *ChatAdministratorRights) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("can_manage_video_chats") b.PutBool(c.CanManageVideoChats) b.Comma() + b.FieldStart("can_post_stories") + b.PutBool(c.CanPostStories) + b.Comma() + b.FieldStart("can_edit_stories") + b.PutBool(c.CanEditStories) + b.Comma() + b.FieldStart("can_delete_stories") + b.PutBool(c.CanDeleteStories) + b.Comma() b.FieldStart("is_anonymous") b.PutBool(c.IsAnonymous) b.Comma() @@ -390,85 +451,103 @@ func (c *ChatAdministratorRights) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *ChatAdministratorRights) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatAdministratorRights#ad77eac7 to nil") + return fmt.Errorf("can't decode chatAdministratorRights#5f4f9044 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("chatAdministratorRights"); err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: %w", err) } case "can_manage_chat": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_manage_chat: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_manage_chat: %w", err) } c.CanManageChat = value case "can_change_info": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_change_info: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_change_info: %w", err) } c.CanChangeInfo = value case "can_post_messages": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_post_messages: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_post_messages: %w", err) } c.CanPostMessages = value case "can_edit_messages": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_edit_messages: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_edit_messages: %w", err) } c.CanEditMessages = value case "can_delete_messages": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_delete_messages: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_delete_messages: %w", err) } c.CanDeleteMessages = value case "can_invite_users": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_invite_users: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_invite_users: %w", err) } c.CanInviteUsers = value case "can_restrict_members": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_restrict_members: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_restrict_members: %w", err) } c.CanRestrictMembers = value case "can_pin_messages": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_pin_messages: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_pin_messages: %w", err) } c.CanPinMessages = value case "can_manage_topics": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_manage_topics: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_manage_topics: %w", err) } c.CanManageTopics = value case "can_promote_members": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_promote_members: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_promote_members: %w", err) } c.CanPromoteMembers = value case "can_manage_video_chats": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field can_manage_video_chats: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_manage_video_chats: %w", err) } c.CanManageVideoChats = value + case "can_post_stories": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_post_stories: %w", err) + } + c.CanPostStories = value + case "can_edit_stories": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_edit_stories: %w", err) + } + c.CanEditStories = value + case "can_delete_stories": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_delete_stories: %w", err) + } + c.CanDeleteStories = value case "is_anonymous": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#ad77eac7: field is_anonymous: %w", err) + return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field is_anonymous: %w", err) } c.IsAnonymous = value default: @@ -566,6 +645,30 @@ func (c *ChatAdministratorRights) GetCanManageVideoChats() (value bool) { return c.CanManageVideoChats } +// GetCanPostStories returns value of CanPostStories field. +func (c *ChatAdministratorRights) GetCanPostStories() (value bool) { + if c == nil { + return + } + return c.CanPostStories +} + +// GetCanEditStories returns value of CanEditStories field. +func (c *ChatAdministratorRights) GetCanEditStories() (value bool) { + if c == nil { + return + } + return c.CanEditStories +} + +// GetCanDeleteStories returns value of CanDeleteStories field. +func (c *ChatAdministratorRights) GetCanDeleteStories() (value bool) { + if c == nil { + return + } + return c.CanDeleteStories +} + // GetIsAnonymous returns value of IsAnonymous field. func (c *ChatAdministratorRights) GetIsAnonymous() (value bool) { if c == nil { diff --git a/tdapi/tl_chat_boost_gen.go b/tdapi/tl_chat_boost_gen.go new file mode 100644 index 0000000000..9c561ebed4 --- /dev/null +++ b/tdapi/tl_chat_boost_gen.go @@ -0,0 +1,228 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// ChatBoost represents TL type `chatBoost#8d029d82`. +type ChatBoost struct { + // Identifier of a user that boosted the chat + UserID int64 + // Point in time (Unix timestamp) when the boost will automatically expire if the user + // will not prolongate their Telegram Premium subscription + ExpirationDate int32 +} + +// ChatBoostTypeID is TL type id of ChatBoost. +const ChatBoostTypeID = 0x8d029d82 + +// Ensuring interfaces in compile-time for ChatBoost. +var ( + _ bin.Encoder = &ChatBoost{} + _ bin.Decoder = &ChatBoost{} + _ bin.BareEncoder = &ChatBoost{} + _ bin.BareDecoder = &ChatBoost{} +) + +func (c *ChatBoost) Zero() bool { + if c == nil { + return true + } + if !(c.UserID == 0) { + return false + } + if !(c.ExpirationDate == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChatBoost) String() string { + if c == nil { + return "ChatBoost(nil)" + } + type Alias ChatBoost + return fmt.Sprintf("ChatBoost%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChatBoost) TypeID() uint32 { + return ChatBoostTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChatBoost) TypeName() string { + return "chatBoost" +} + +// TypeInfo returns info about TL type. +func (c *ChatBoost) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "chatBoost", + ID: ChatBoostTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "UserID", + SchemaName: "user_id", + }, + { + Name: "ExpirationDate", + SchemaName: "expiration_date", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChatBoost) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatBoost#8d029d82 as nil") + } + b.PutID(ChatBoostTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChatBoost) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatBoost#8d029d82 as nil") + } + b.PutInt53(c.UserID) + b.PutInt32(c.ExpirationDate) + return nil +} + +// Decode implements bin.Decoder. +func (c *ChatBoost) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatBoost#8d029d82 to nil") + } + if err := b.ConsumeID(ChatBoostTypeID); err != nil { + return fmt.Errorf("unable to decode chatBoost#8d029d82: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChatBoost) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatBoost#8d029d82 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode chatBoost#8d029d82: field user_id: %w", err) + } + c.UserID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatBoost#8d029d82: field expiration_date: %w", err) + } + c.ExpirationDate = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatBoost) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatBoost#8d029d82 as nil") + } + b.ObjStart() + b.PutID("chatBoost") + b.Comma() + b.FieldStart("user_id") + b.PutInt53(c.UserID) + b.Comma() + b.FieldStart("expiration_date") + b.PutInt32(c.ExpirationDate) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ChatBoost) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode chatBoost#8d029d82 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("chatBoost"); err != nil { + return fmt.Errorf("unable to decode chatBoost#8d029d82: %w", err) + } + case "user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode chatBoost#8d029d82: field user_id: %w", err) + } + c.UserID = value + case "expiration_date": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatBoost#8d029d82: field expiration_date: %w", err) + } + c.ExpirationDate = value + default: + return b.Skip() + } + return nil + }) +} + +// GetUserID returns value of UserID field. +func (c *ChatBoost) GetUserID() (value int64) { + if c == nil { + return + } + return c.UserID +} + +// GetExpirationDate returns value of ExpirationDate field. +func (c *ChatBoost) GetExpirationDate() (value int32) { + if c == nil { + return + } + return c.ExpirationDate +} diff --git a/tdapi/tl_chat_boost_link_gen.go b/tdapi/tl_chat_boost_link_gen.go new file mode 100644 index 0000000000..b0ef559f9f --- /dev/null +++ b/tdapi/tl_chat_boost_link_gen.go @@ -0,0 +1,227 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// ChatBoostLink represents TL type `chatBoostLink#b5417c71`. +type ChatBoostLink struct { + // The link + Link string + // True, if the link will work for non-members of the chat + IsPublic bool +} + +// ChatBoostLinkTypeID is TL type id of ChatBoostLink. +const ChatBoostLinkTypeID = 0xb5417c71 + +// Ensuring interfaces in compile-time for ChatBoostLink. +var ( + _ bin.Encoder = &ChatBoostLink{} + _ bin.Decoder = &ChatBoostLink{} + _ bin.BareEncoder = &ChatBoostLink{} + _ bin.BareDecoder = &ChatBoostLink{} +) + +func (c *ChatBoostLink) Zero() bool { + if c == nil { + return true + } + if !(c.Link == "") { + return false + } + if !(c.IsPublic == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChatBoostLink) String() string { + if c == nil { + return "ChatBoostLink(nil)" + } + type Alias ChatBoostLink + return fmt.Sprintf("ChatBoostLink%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChatBoostLink) TypeID() uint32 { + return ChatBoostLinkTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChatBoostLink) TypeName() string { + return "chatBoostLink" +} + +// TypeInfo returns info about TL type. +func (c *ChatBoostLink) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "chatBoostLink", + ID: ChatBoostLinkTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Link", + SchemaName: "link", + }, + { + Name: "IsPublic", + SchemaName: "is_public", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChatBoostLink) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatBoostLink#b5417c71 as nil") + } + b.PutID(ChatBoostLinkTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChatBoostLink) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatBoostLink#b5417c71 as nil") + } + b.PutString(c.Link) + b.PutBool(c.IsPublic) + return nil +} + +// Decode implements bin.Decoder. +func (c *ChatBoostLink) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatBoostLink#b5417c71 to nil") + } + if err := b.ConsumeID(ChatBoostLinkTypeID); err != nil { + return fmt.Errorf("unable to decode chatBoostLink#b5417c71: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChatBoostLink) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatBoostLink#b5417c71 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatBoostLink#b5417c71: field link: %w", err) + } + c.Link = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatBoostLink#b5417c71: field is_public: %w", err) + } + c.IsPublic = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatBoostLink) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatBoostLink#b5417c71 as nil") + } + b.ObjStart() + b.PutID("chatBoostLink") + b.Comma() + b.FieldStart("link") + b.PutString(c.Link) + b.Comma() + b.FieldStart("is_public") + b.PutBool(c.IsPublic) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ChatBoostLink) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode chatBoostLink#b5417c71 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("chatBoostLink"); err != nil { + return fmt.Errorf("unable to decode chatBoostLink#b5417c71: %w", err) + } + case "link": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatBoostLink#b5417c71: field link: %w", err) + } + c.Link = value + case "is_public": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatBoostLink#b5417c71: field is_public: %w", err) + } + c.IsPublic = value + default: + return b.Skip() + } + return nil + }) +} + +// GetLink returns value of Link field. +func (c *ChatBoostLink) GetLink() (value string) { + if c == nil { + return + } + return c.Link +} + +// GetIsPublic returns value of IsPublic field. +func (c *ChatBoostLink) GetIsPublic() (value bool) { + if c == nil { + return + } + return c.IsPublic +} diff --git a/tdapi/tl_chat_boost_link_info_gen.go b/tdapi/tl_chat_boost_link_info_gen.go new file mode 100644 index 0000000000..57259b8ba8 --- /dev/null +++ b/tdapi/tl_chat_boost_link_info_gen.go @@ -0,0 +1,227 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// ChatBoostLinkInfo represents TL type `chatBoostLinkInfo#dc123884`. +type ChatBoostLinkInfo struct { + // True, if the link will work for non-members of the chat + IsPublic bool + // Identifier of the chat to which the link points; 0 if the chat isn't found + ChatID int64 +} + +// ChatBoostLinkInfoTypeID is TL type id of ChatBoostLinkInfo. +const ChatBoostLinkInfoTypeID = 0xdc123884 + +// Ensuring interfaces in compile-time for ChatBoostLinkInfo. +var ( + _ bin.Encoder = &ChatBoostLinkInfo{} + _ bin.Decoder = &ChatBoostLinkInfo{} + _ bin.BareEncoder = &ChatBoostLinkInfo{} + _ bin.BareDecoder = &ChatBoostLinkInfo{} +) + +func (c *ChatBoostLinkInfo) Zero() bool { + if c == nil { + return true + } + if !(c.IsPublic == false) { + return false + } + if !(c.ChatID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChatBoostLinkInfo) String() string { + if c == nil { + return "ChatBoostLinkInfo(nil)" + } + type Alias ChatBoostLinkInfo + return fmt.Sprintf("ChatBoostLinkInfo%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChatBoostLinkInfo) TypeID() uint32 { + return ChatBoostLinkInfoTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChatBoostLinkInfo) TypeName() string { + return "chatBoostLinkInfo" +} + +// TypeInfo returns info about TL type. +func (c *ChatBoostLinkInfo) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "chatBoostLinkInfo", + ID: ChatBoostLinkInfoTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "IsPublic", + SchemaName: "is_public", + }, + { + Name: "ChatID", + SchemaName: "chat_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChatBoostLinkInfo) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatBoostLinkInfo#dc123884 as nil") + } + b.PutID(ChatBoostLinkInfoTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChatBoostLinkInfo) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatBoostLinkInfo#dc123884 as nil") + } + b.PutBool(c.IsPublic) + b.PutInt53(c.ChatID) + return nil +} + +// Decode implements bin.Decoder. +func (c *ChatBoostLinkInfo) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatBoostLinkInfo#dc123884 to nil") + } + if err := b.ConsumeID(ChatBoostLinkInfoTypeID); err != nil { + return fmt.Errorf("unable to decode chatBoostLinkInfo#dc123884: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChatBoostLinkInfo) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatBoostLinkInfo#dc123884 to nil") + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatBoostLinkInfo#dc123884: field is_public: %w", err) + } + c.IsPublic = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode chatBoostLinkInfo#dc123884: field chat_id: %w", err) + } + c.ChatID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatBoostLinkInfo) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatBoostLinkInfo#dc123884 as nil") + } + b.ObjStart() + b.PutID("chatBoostLinkInfo") + b.Comma() + b.FieldStart("is_public") + b.PutBool(c.IsPublic) + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(c.ChatID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ChatBoostLinkInfo) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode chatBoostLinkInfo#dc123884 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("chatBoostLinkInfo"); err != nil { + return fmt.Errorf("unable to decode chatBoostLinkInfo#dc123884: %w", err) + } + case "is_public": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatBoostLinkInfo#dc123884: field is_public: %w", err) + } + c.IsPublic = value + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode chatBoostLinkInfo#dc123884: field chat_id: %w", err) + } + c.ChatID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetIsPublic returns value of IsPublic field. +func (c *ChatBoostLinkInfo) GetIsPublic() (value bool) { + if c == nil { + return + } + return c.IsPublic +} + +// GetChatID returns value of ChatID field. +func (c *ChatBoostLinkInfo) GetChatID() (value int64) { + if c == nil { + return + } + return c.ChatID +} diff --git a/tdapi/tl_chat_boost_status_gen.go b/tdapi/tl_chat_boost_status_gen.go new file mode 100644 index 0000000000..77ef017352 --- /dev/null +++ b/tdapi/tl_chat_boost_status_gen.go @@ -0,0 +1,400 @@ +// 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{} +) + +// ChatBoostStatus represents TL type `chatBoostStatus#cd6a3f87`. +type ChatBoostStatus struct { + // True, if the current user has already boosted the chat + IsBoosted bool + // Current boost level of the chat + Level int32 + // The number of times the chat was boosted + BoostCount int32 + // The number of boosts added to reach the current level + CurrentLevelBoostCount int32 + // The number of boosts needed to reach the next level; 0 if the next level isn't + // available + NextLevelBoostCount int32 + // Approximate number of Telegram Premium subscribers joined the chat; always 0 if the + // current user isn't an administrator in the chat + PremiumMemberCount int32 + // A percentage of Telegram Premium subscribers joined the chat; always 0 if the current + // user isn't an administrator in the chat + PremiumMemberPercentage float64 +} + +// ChatBoostStatusTypeID is TL type id of ChatBoostStatus. +const ChatBoostStatusTypeID = 0xcd6a3f87 + +// Ensuring interfaces in compile-time for ChatBoostStatus. +var ( + _ bin.Encoder = &ChatBoostStatus{} + _ bin.Decoder = &ChatBoostStatus{} + _ bin.BareEncoder = &ChatBoostStatus{} + _ bin.BareDecoder = &ChatBoostStatus{} +) + +func (c *ChatBoostStatus) Zero() bool { + if c == nil { + return true + } + if !(c.IsBoosted == false) { + return false + } + if !(c.Level == 0) { + return false + } + if !(c.BoostCount == 0) { + return false + } + if !(c.CurrentLevelBoostCount == 0) { + return false + } + if !(c.NextLevelBoostCount == 0) { + return false + } + if !(c.PremiumMemberCount == 0) { + return false + } + if !(c.PremiumMemberPercentage == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChatBoostStatus) String() string { + if c == nil { + return "ChatBoostStatus(nil)" + } + type Alias ChatBoostStatus + return fmt.Sprintf("ChatBoostStatus%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChatBoostStatus) TypeID() uint32 { + return ChatBoostStatusTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChatBoostStatus) TypeName() string { + return "chatBoostStatus" +} + +// TypeInfo returns info about TL type. +func (c *ChatBoostStatus) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "chatBoostStatus", + ID: ChatBoostStatusTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "IsBoosted", + SchemaName: "is_boosted", + }, + { + Name: "Level", + SchemaName: "level", + }, + { + Name: "BoostCount", + SchemaName: "boost_count", + }, + { + Name: "CurrentLevelBoostCount", + SchemaName: "current_level_boost_count", + }, + { + Name: "NextLevelBoostCount", + SchemaName: "next_level_boost_count", + }, + { + Name: "PremiumMemberCount", + SchemaName: "premium_member_count", + }, + { + Name: "PremiumMemberPercentage", + SchemaName: "premium_member_percentage", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChatBoostStatus) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatBoostStatus#cd6a3f87 as nil") + } + b.PutID(ChatBoostStatusTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChatBoostStatus) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatBoostStatus#cd6a3f87 as nil") + } + b.PutBool(c.IsBoosted) + b.PutInt32(c.Level) + b.PutInt32(c.BoostCount) + b.PutInt32(c.CurrentLevelBoostCount) + b.PutInt32(c.NextLevelBoostCount) + b.PutInt32(c.PremiumMemberCount) + b.PutDouble(c.PremiumMemberPercentage) + return nil +} + +// Decode implements bin.Decoder. +func (c *ChatBoostStatus) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatBoostStatus#cd6a3f87 to nil") + } + if err := b.ConsumeID(ChatBoostStatusTypeID); err != nil { + return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChatBoostStatus) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatBoostStatus#cd6a3f87 to nil") + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field is_boosted: %w", err) + } + c.IsBoosted = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field level: %w", err) + } + c.Level = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field boost_count: %w", err) + } + c.BoostCount = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field current_level_boost_count: %w", err) + } + c.CurrentLevelBoostCount = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field next_level_boost_count: %w", err) + } + c.NextLevelBoostCount = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field premium_member_count: %w", err) + } + c.PremiumMemberCount = value + } + { + value, err := b.Double() + if err != nil { + return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field premium_member_percentage: %w", err) + } + c.PremiumMemberPercentage = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatBoostStatus) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatBoostStatus#cd6a3f87 as nil") + } + b.ObjStart() + b.PutID("chatBoostStatus") + b.Comma() + b.FieldStart("is_boosted") + b.PutBool(c.IsBoosted) + b.Comma() + b.FieldStart("level") + b.PutInt32(c.Level) + b.Comma() + b.FieldStart("boost_count") + b.PutInt32(c.BoostCount) + b.Comma() + b.FieldStart("current_level_boost_count") + b.PutInt32(c.CurrentLevelBoostCount) + b.Comma() + b.FieldStart("next_level_boost_count") + b.PutInt32(c.NextLevelBoostCount) + b.Comma() + b.FieldStart("premium_member_count") + b.PutInt32(c.PremiumMemberCount) + b.Comma() + b.FieldStart("premium_member_percentage") + b.PutDouble(c.PremiumMemberPercentage) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ChatBoostStatus) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode chatBoostStatus#cd6a3f87 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("chatBoostStatus"); err != nil { + return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: %w", err) + } + case "is_boosted": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field is_boosted: %w", err) + } + c.IsBoosted = value + case "level": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field level: %w", err) + } + c.Level = value + case "boost_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field boost_count: %w", err) + } + c.BoostCount = value + case "current_level_boost_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field current_level_boost_count: %w", err) + } + c.CurrentLevelBoostCount = value + case "next_level_boost_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field next_level_boost_count: %w", err) + } + c.NextLevelBoostCount = value + case "premium_member_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field premium_member_count: %w", err) + } + c.PremiumMemberCount = value + case "premium_member_percentage": + value, err := b.Double() + if err != nil { + return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field premium_member_percentage: %w", err) + } + c.PremiumMemberPercentage = value + default: + return b.Skip() + } + return nil + }) +} + +// GetIsBoosted returns value of IsBoosted field. +func (c *ChatBoostStatus) GetIsBoosted() (value bool) { + if c == nil { + return + } + return c.IsBoosted +} + +// GetLevel returns value of Level field. +func (c *ChatBoostStatus) GetLevel() (value int32) { + if c == nil { + return + } + return c.Level +} + +// GetBoostCount returns value of BoostCount field. +func (c *ChatBoostStatus) GetBoostCount() (value int32) { + if c == nil { + return + } + return c.BoostCount +} + +// GetCurrentLevelBoostCount returns value of CurrentLevelBoostCount field. +func (c *ChatBoostStatus) GetCurrentLevelBoostCount() (value int32) { + if c == nil { + return + } + return c.CurrentLevelBoostCount +} + +// GetNextLevelBoostCount returns value of NextLevelBoostCount field. +func (c *ChatBoostStatus) GetNextLevelBoostCount() (value int32) { + if c == nil { + return + } + return c.NextLevelBoostCount +} + +// GetPremiumMemberCount returns value of PremiumMemberCount field. +func (c *ChatBoostStatus) GetPremiumMemberCount() (value int32) { + if c == nil { + return + } + return c.PremiumMemberCount +} + +// GetPremiumMemberPercentage returns value of PremiumMemberPercentage field. +func (c *ChatBoostStatus) GetPremiumMemberPercentage() (value float64) { + if c == nil { + return + } + return c.PremiumMemberPercentage +} diff --git a/tdapi/tl_create_new_supergroup_chat_gen.go b/tdapi/tl_create_new_supergroup_chat_gen.go index 0318bd294f..274d458629 100644 --- a/tdapi/tl_create_new_supergroup_chat_gen.go +++ b/tdapi/tl_create_new_supergroup_chat_gen.go @@ -48,7 +48,7 @@ type CreateNewSupergroupChatRequest struct { // Message auto-delete time value, in seconds; must be from 0 up to 365 * 86400 and be // divisible by 86400. If 0, then messages aren't deleted automatically MessageAutoDeleteTime int32 - // Pass true to create a supergroup for importing messages using importMessage + // Pass true to create a supergroup for importing messages using importMessages ForImport bool } diff --git a/tdapi/tl_delete_story_gen.go b/tdapi/tl_delete_story_gen.go index 5ad83499ac..00efc5eec3 100644 --- a/tdapi/tl_delete_story_gen.go +++ b/tdapi/tl_delete_story_gen.go @@ -31,14 +31,16 @@ var ( _ = tdjson.Encoder{} ) -// DeleteStoryRequest represents TL type `deleteStory#62332a06`. +// DeleteStoryRequest represents TL type `deleteStory#9f35af16`. type DeleteStoryRequest struct { + // Identifier of the chat that posted the story + StorySenderChatID int64 // Identifier of the story to delete StoryID int32 } // DeleteStoryRequestTypeID is TL type id of DeleteStoryRequest. -const DeleteStoryRequestTypeID = 0x62332a06 +const DeleteStoryRequestTypeID = 0x9f35af16 // Ensuring interfaces in compile-time for DeleteStoryRequest. var ( @@ -52,6 +54,9 @@ func (d *DeleteStoryRequest) Zero() bool { if d == nil { return true } + if !(d.StorySenderChatID == 0) { + return false + } if !(d.StoryID == 0) { return false } @@ -91,6 +96,10 @@ func (d *DeleteStoryRequest) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "StorySenderChatID", + SchemaName: "story_sender_chat_id", + }, { Name: "StoryID", SchemaName: "story_id", @@ -102,7 +111,7 @@ func (d *DeleteStoryRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (d *DeleteStoryRequest) Encode(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't encode deleteStory#62332a06 as nil") + return fmt.Errorf("can't encode deleteStory#9f35af16 as nil") } b.PutID(DeleteStoryRequestTypeID) return d.EncodeBare(b) @@ -111,8 +120,9 @@ func (d *DeleteStoryRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (d *DeleteStoryRequest) EncodeBare(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't encode deleteStory#62332a06 as nil") + return fmt.Errorf("can't encode deleteStory#9f35af16 as nil") } + b.PutInt53(d.StorySenderChatID) b.PutInt32(d.StoryID) return nil } @@ -120,10 +130,10 @@ func (d *DeleteStoryRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (d *DeleteStoryRequest) Decode(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't decode deleteStory#62332a06 to nil") + return fmt.Errorf("can't decode deleteStory#9f35af16 to nil") } if err := b.ConsumeID(DeleteStoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteStory#62332a06: %w", err) + return fmt.Errorf("unable to decode deleteStory#9f35af16: %w", err) } return d.DecodeBare(b) } @@ -131,12 +141,19 @@ func (d *DeleteStoryRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (d *DeleteStoryRequest) DecodeBare(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't decode deleteStory#62332a06 to nil") + return fmt.Errorf("can't decode deleteStory#9f35af16 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode deleteStory#9f35af16: field story_sender_chat_id: %w", err) + } + d.StorySenderChatID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode deleteStory#62332a06: field story_id: %w", err) + return fmt.Errorf("unable to decode deleteStory#9f35af16: field story_id: %w", err) } d.StoryID = value } @@ -146,11 +163,14 @@ func (d *DeleteStoryRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (d *DeleteStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if d == nil { - return fmt.Errorf("can't encode deleteStory#62332a06 as nil") + return fmt.Errorf("can't encode deleteStory#9f35af16 as nil") } b.ObjStart() b.PutID("deleteStory") b.Comma() + b.FieldStart("story_sender_chat_id") + b.PutInt53(d.StorySenderChatID) + b.Comma() b.FieldStart("story_id") b.PutInt32(d.StoryID) b.Comma() @@ -162,19 +182,25 @@ func (d *DeleteStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (d *DeleteStoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if d == nil { - return fmt.Errorf("can't decode deleteStory#62332a06 to nil") + return fmt.Errorf("can't decode deleteStory#9f35af16 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("deleteStory"); err != nil { - return fmt.Errorf("unable to decode deleteStory#62332a06: %w", err) + return fmt.Errorf("unable to decode deleteStory#9f35af16: %w", err) } + case "story_sender_chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode deleteStory#9f35af16: field story_sender_chat_id: %w", err) + } + d.StorySenderChatID = value case "story_id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode deleteStory#62332a06: field story_id: %w", err) + return fmt.Errorf("unable to decode deleteStory#9f35af16: field story_id: %w", err) } d.StoryID = value default: @@ -184,6 +210,14 @@ func (d *DeleteStoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { }) } +// GetStorySenderChatID returns value of StorySenderChatID field. +func (d *DeleteStoryRequest) GetStorySenderChatID() (value int64) { + if d == nil { + return + } + return d.StorySenderChatID +} + // GetStoryID returns value of StoryID field. func (d *DeleteStoryRequest) GetStoryID() (value int32) { if d == nil { @@ -192,13 +226,10 @@ func (d *DeleteStoryRequest) GetStoryID() (value int32) { return d.StoryID } -// DeleteStory invokes method deleteStory#62332a06 returning error if any. -func (c *Client) DeleteStory(ctx context.Context, storyid int32) error { +// DeleteStory invokes method deleteStory#9f35af16 returning error if any. +func (c *Client) DeleteStory(ctx context.Context, request *DeleteStoryRequest) error { var ok Ok - request := &DeleteStoryRequest{ - StoryID: storyid, - } if err := c.rpc.Invoke(ctx, request, &ok); err != nil { return err } diff --git a/tdapi/tl_edit_story_gen.go b/tdapi/tl_edit_story_gen.go index dcb274d6f9..79bc3a4dfd 100644 --- a/tdapi/tl_edit_story_gen.go +++ b/tdapi/tl_edit_story_gen.go @@ -31,8 +31,10 @@ var ( _ = tdjson.Encoder{} ) -// EditStoryRequest represents TL type `editStory#aa2c3e86`. +// EditStoryRequest represents TL type `editStory#5e6a21b1`. type EditStoryRequest struct { + // Identifier of the chat that posted the story + StorySenderChatID int64 // Identifier of the story to edit StoryID int32 // New content of the story; pass null to keep the current content @@ -45,7 +47,7 @@ type EditStoryRequest struct { } // EditStoryRequestTypeID is TL type id of EditStoryRequest. -const EditStoryRequestTypeID = 0xaa2c3e86 +const EditStoryRequestTypeID = 0x5e6a21b1 // Ensuring interfaces in compile-time for EditStoryRequest. var ( @@ -59,6 +61,9 @@ func (e *EditStoryRequest) Zero() bool { if e == nil { return true } + if !(e.StorySenderChatID == 0) { + return false + } if !(e.StoryID == 0) { return false } @@ -107,6 +112,10 @@ func (e *EditStoryRequest) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "StorySenderChatID", + SchemaName: "story_sender_chat_id", + }, { Name: "StoryID", SchemaName: "story_id", @@ -130,7 +139,7 @@ func (e *EditStoryRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (e *EditStoryRequest) Encode(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't encode editStory#aa2c3e86 as nil") + return fmt.Errorf("can't encode editStory#5e6a21b1 as nil") } b.PutID(EditStoryRequestTypeID) return e.EncodeBare(b) @@ -139,20 +148,21 @@ func (e *EditStoryRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (e *EditStoryRequest) EncodeBare(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't encode editStory#aa2c3e86 as nil") + return fmt.Errorf("can't encode editStory#5e6a21b1 as nil") } + b.PutInt53(e.StorySenderChatID) b.PutInt32(e.StoryID) if e.Content == nil { - return fmt.Errorf("unable to encode editStory#aa2c3e86: field content is nil") + return fmt.Errorf("unable to encode editStory#5e6a21b1: field content is nil") } if err := e.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode editStory#aa2c3e86: field content: %w", err) + return fmt.Errorf("unable to encode editStory#5e6a21b1: field content: %w", err) } if err := e.Areas.Encode(b); err != nil { - return fmt.Errorf("unable to encode editStory#aa2c3e86: field areas: %w", err) + return fmt.Errorf("unable to encode editStory#5e6a21b1: field areas: %w", err) } if err := e.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode editStory#aa2c3e86: field caption: %w", err) + return fmt.Errorf("unable to encode editStory#5e6a21b1: field caption: %w", err) } return nil } @@ -160,10 +170,10 @@ func (e *EditStoryRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (e *EditStoryRequest) Decode(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't decode editStory#aa2c3e86 to nil") + return fmt.Errorf("can't decode editStory#5e6a21b1 to nil") } if err := b.ConsumeID(EditStoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editStory#aa2c3e86: %w", err) + return fmt.Errorf("unable to decode editStory#5e6a21b1: %w", err) } return e.DecodeBare(b) } @@ -171,30 +181,37 @@ func (e *EditStoryRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (e *EditStoryRequest) DecodeBare(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't decode editStory#aa2c3e86 to nil") + return fmt.Errorf("can't decode editStory#5e6a21b1 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode editStory#5e6a21b1: field story_sender_chat_id: %w", err) + } + e.StorySenderChatID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode editStory#aa2c3e86: field story_id: %w", err) + return fmt.Errorf("unable to decode editStory#5e6a21b1: field story_id: %w", err) } e.StoryID = value } { value, err := DecodeInputStoryContent(b) if err != nil { - return fmt.Errorf("unable to decode editStory#aa2c3e86: field content: %w", err) + return fmt.Errorf("unable to decode editStory#5e6a21b1: field content: %w", err) } e.Content = value } { if err := e.Areas.Decode(b); err != nil { - return fmt.Errorf("unable to decode editStory#aa2c3e86: field areas: %w", err) + return fmt.Errorf("unable to decode editStory#5e6a21b1: field areas: %w", err) } } { if err := e.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode editStory#aa2c3e86: field caption: %w", err) + return fmt.Errorf("unable to decode editStory#5e6a21b1: field caption: %w", err) } } return nil @@ -203,30 +220,33 @@ func (e *EditStoryRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (e *EditStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if e == nil { - return fmt.Errorf("can't encode editStory#aa2c3e86 as nil") + return fmt.Errorf("can't encode editStory#5e6a21b1 as nil") } b.ObjStart() b.PutID("editStory") b.Comma() + b.FieldStart("story_sender_chat_id") + b.PutInt53(e.StorySenderChatID) + b.Comma() b.FieldStart("story_id") b.PutInt32(e.StoryID) b.Comma() b.FieldStart("content") if e.Content == nil { - return fmt.Errorf("unable to encode editStory#aa2c3e86: field content is nil") + return fmt.Errorf("unable to encode editStory#5e6a21b1: field content is nil") } if err := e.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editStory#aa2c3e86: field content: %w", err) + return fmt.Errorf("unable to encode editStory#5e6a21b1: field content: %w", err) } b.Comma() b.FieldStart("areas") if err := e.Areas.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editStory#aa2c3e86: field areas: %w", err) + return fmt.Errorf("unable to encode editStory#5e6a21b1: field areas: %w", err) } b.Comma() b.FieldStart("caption") if err := e.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editStory#aa2c3e86: field caption: %w", err) + return fmt.Errorf("unable to encode editStory#5e6a21b1: field caption: %w", err) } b.Comma() b.StripComma() @@ -237,34 +257,40 @@ func (e *EditStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (e *EditStoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if e == nil { - return fmt.Errorf("can't decode editStory#aa2c3e86 to nil") + return fmt.Errorf("can't decode editStory#5e6a21b1 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("editStory"); err != nil { - return fmt.Errorf("unable to decode editStory#aa2c3e86: %w", err) + return fmt.Errorf("unable to decode editStory#5e6a21b1: %w", err) + } + case "story_sender_chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode editStory#5e6a21b1: field story_sender_chat_id: %w", err) } + e.StorySenderChatID = value case "story_id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode editStory#aa2c3e86: field story_id: %w", err) + return fmt.Errorf("unable to decode editStory#5e6a21b1: field story_id: %w", err) } e.StoryID = value case "content": value, err := DecodeTDLibJSONInputStoryContent(b) if err != nil { - return fmt.Errorf("unable to decode editStory#aa2c3e86: field content: %w", err) + return fmt.Errorf("unable to decode editStory#5e6a21b1: field content: %w", err) } e.Content = value case "areas": if err := e.Areas.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode editStory#aa2c3e86: field areas: %w", err) + return fmt.Errorf("unable to decode editStory#5e6a21b1: field areas: %w", err) } case "caption": if err := e.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode editStory#aa2c3e86: field caption: %w", err) + return fmt.Errorf("unable to decode editStory#5e6a21b1: field caption: %w", err) } default: return b.Skip() @@ -273,6 +299,14 @@ func (e *EditStoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { }) } +// GetStorySenderChatID returns value of StorySenderChatID field. +func (e *EditStoryRequest) GetStorySenderChatID() (value int64) { + if e == nil { + return + } + return e.StorySenderChatID +} + // GetStoryID returns value of StoryID field. func (e *EditStoryRequest) GetStoryID() (value int32) { if e == nil { @@ -305,7 +339,7 @@ func (e *EditStoryRequest) GetCaption() (value FormattedText) { return e.Caption } -// EditStory invokes method editStory#aa2c3e86 returning error if any. +// EditStory invokes method editStory#5e6a21b1 returning error if any. func (c *Client) EditStory(ctx context.Context, request *EditStoryRequest) error { var ok Ok diff --git a/tdapi/tl_found_chat_boosts_gen.go b/tdapi/tl_found_chat_boosts_gen.go new file mode 100644 index 0000000000..356cb9c5ba --- /dev/null +++ b/tdapi/tl_found_chat_boosts_gen.go @@ -0,0 +1,289 @@ +// 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{} +) + +// FoundChatBoosts represents TL type `foundChatBoosts#dc80d52e`. +type FoundChatBoosts struct { + // Total number of boosts applied to the chat + TotalCount int32 + // List of boosts + Boosts []ChatBoost + // The offset for the next request. If empty, there are no more results + NextOffset string +} + +// FoundChatBoostsTypeID is TL type id of FoundChatBoosts. +const FoundChatBoostsTypeID = 0xdc80d52e + +// Ensuring interfaces in compile-time for FoundChatBoosts. +var ( + _ bin.Encoder = &FoundChatBoosts{} + _ bin.Decoder = &FoundChatBoosts{} + _ bin.BareEncoder = &FoundChatBoosts{} + _ bin.BareDecoder = &FoundChatBoosts{} +) + +func (f *FoundChatBoosts) Zero() bool { + if f == nil { + return true + } + if !(f.TotalCount == 0) { + return false + } + if !(f.Boosts == nil) { + return false + } + if !(f.NextOffset == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (f *FoundChatBoosts) String() string { + if f == nil { + return "FoundChatBoosts(nil)" + } + type Alias FoundChatBoosts + return fmt.Sprintf("FoundChatBoosts%+v", Alias(*f)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*FoundChatBoosts) TypeID() uint32 { + return FoundChatBoostsTypeID +} + +// TypeName returns name of type in TL schema. +func (*FoundChatBoosts) TypeName() string { + return "foundChatBoosts" +} + +// TypeInfo returns info about TL type. +func (f *FoundChatBoosts) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "foundChatBoosts", + ID: FoundChatBoostsTypeID, + } + if f == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "TotalCount", + SchemaName: "total_count", + }, + { + Name: "Boosts", + SchemaName: "boosts", + }, + { + Name: "NextOffset", + SchemaName: "next_offset", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (f *FoundChatBoosts) Encode(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't encode foundChatBoosts#dc80d52e as nil") + } + b.PutID(FoundChatBoostsTypeID) + return f.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (f *FoundChatBoosts) EncodeBare(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't encode foundChatBoosts#dc80d52e as nil") + } + b.PutInt32(f.TotalCount) + b.PutInt(len(f.Boosts)) + for idx, v := range f.Boosts { + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare foundChatBoosts#dc80d52e: field boosts element with index %d: %w", idx, err) + } + } + b.PutString(f.NextOffset) + return nil +} + +// Decode implements bin.Decoder. +func (f *FoundChatBoosts) Decode(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't decode foundChatBoosts#dc80d52e to nil") + } + if err := b.ConsumeID(FoundChatBoostsTypeID); err != nil { + return fmt.Errorf("unable to decode foundChatBoosts#dc80d52e: %w", err) + } + return f.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (f *FoundChatBoosts) DecodeBare(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't decode foundChatBoosts#dc80d52e to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode foundChatBoosts#dc80d52e: field total_count: %w", err) + } + f.TotalCount = value + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode foundChatBoosts#dc80d52e: field boosts: %w", err) + } + + if headerLen > 0 { + f.Boosts = make([]ChatBoost, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value ChatBoost + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare foundChatBoosts#dc80d52e: field boosts: %w", err) + } + f.Boosts = append(f.Boosts, value) + } + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode foundChatBoosts#dc80d52e: field next_offset: %w", err) + } + f.NextOffset = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (f *FoundChatBoosts) EncodeTDLibJSON(b tdjson.Encoder) error { + if f == nil { + return fmt.Errorf("can't encode foundChatBoosts#dc80d52e as nil") + } + b.ObjStart() + b.PutID("foundChatBoosts") + b.Comma() + b.FieldStart("total_count") + b.PutInt32(f.TotalCount) + b.Comma() + b.FieldStart("boosts") + b.ArrStart() + for idx, v := range f.Boosts { + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode foundChatBoosts#dc80d52e: field boosts element with index %d: %w", idx, err) + } + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.FieldStart("next_offset") + b.PutString(f.NextOffset) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (f *FoundChatBoosts) DecodeTDLibJSON(b tdjson.Decoder) error { + if f == nil { + return fmt.Errorf("can't decode foundChatBoosts#dc80d52e to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("foundChatBoosts"); err != nil { + return fmt.Errorf("unable to decode foundChatBoosts#dc80d52e: %w", err) + } + case "total_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode foundChatBoosts#dc80d52e: field total_count: %w", err) + } + f.TotalCount = value + case "boosts": + if err := b.Arr(func(b tdjson.Decoder) error { + var value ChatBoost + if err := value.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode foundChatBoosts#dc80d52e: field boosts: %w", err) + } + f.Boosts = append(f.Boosts, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode foundChatBoosts#dc80d52e: field boosts: %w", err) + } + case "next_offset": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode foundChatBoosts#dc80d52e: field next_offset: %w", err) + } + f.NextOffset = value + default: + return b.Skip() + } + return nil + }) +} + +// GetTotalCount returns value of TotalCount field. +func (f *FoundChatBoosts) GetTotalCount() (value int32) { + if f == nil { + return + } + return f.TotalCount +} + +// GetBoosts returns value of Boosts field. +func (f *FoundChatBoosts) GetBoosts() (value []ChatBoost) { + if f == nil { + return + } + return f.Boosts +} + +// GetNextOffset returns value of NextOffset field. +func (f *FoundChatBoosts) GetNextOffset() (value string) { + if f == nil { + return + } + return f.NextOffset +} diff --git a/tdapi/tl_get_archived_stories_gen.go b/tdapi/tl_get_archived_stories_gen.go deleted file mode 100644 index ac686f270a..0000000000 --- a/tdapi/tl_get_archived_stories_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -import ( - "context" - "errors" - "fmt" - "sort" - "strings" - - "go.uber.org/multierr" - - "github.com/gotd/td/bin" - "github.com/gotd/td/tdjson" - "github.com/gotd/td/tdp" - "github.com/gotd/td/tgerr" -) - -// No-op definition for keeping imports. -var ( - _ = bin.Buffer{} - _ = context.Background() - _ = fmt.Stringer(nil) - _ = strings.Builder{} - _ = errors.Is - _ = multierr.AppendInto - _ = sort.Ints - _ = tdp.Format - _ = tgerr.Error{} - _ = tdjson.Encoder{} -) - -// GetArchivedStoriesRequest represents TL type `getArchivedStories#6a864fe7`. -type GetArchivedStoriesRequest struct { - // 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 -} - -// GetArchivedStoriesRequestTypeID is TL type id of GetArchivedStoriesRequest. -const GetArchivedStoriesRequestTypeID = 0x6a864fe7 - -// Ensuring interfaces in compile-time for GetArchivedStoriesRequest. -var ( - _ bin.Encoder = &GetArchivedStoriesRequest{} - _ bin.Decoder = &GetArchivedStoriesRequest{} - _ bin.BareEncoder = &GetArchivedStoriesRequest{} - _ bin.BareDecoder = &GetArchivedStoriesRequest{} -) - -func (g *GetArchivedStoriesRequest) Zero() bool { - if g == nil { - return true - } - if !(g.FromStoryID == 0) { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetArchivedStoriesRequest) String() string { - if g == nil { - return "GetArchivedStoriesRequest(nil)" - } - type Alias GetArchivedStoriesRequest - return fmt.Sprintf("GetArchivedStoriesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetArchivedStoriesRequest) TypeID() uint32 { - return GetArchivedStoriesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetArchivedStoriesRequest) TypeName() string { - return "getArchivedStories" -} - -// TypeInfo returns info about TL type. -func (g *GetArchivedStoriesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getArchivedStories", - ID: GetArchivedStoriesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FromStoryID", - SchemaName: "from_story_id", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetArchivedStoriesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getArchivedStories#6a864fe7 as nil") - } - b.PutID(GetArchivedStoriesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetArchivedStoriesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getArchivedStories#6a864fe7 as nil") - } - b.PutInt32(g.FromStoryID) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetArchivedStoriesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getArchivedStories#6a864fe7 to nil") - } - if err := b.ConsumeID(GetArchivedStoriesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getArchivedStories#6a864fe7: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetArchivedStoriesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getArchivedStories#6a864fe7 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getArchivedStories#6a864fe7: field from_story_id: %w", err) - } - g.FromStoryID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getArchivedStories#6a864fe7: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetArchivedStoriesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getArchivedStories#6a864fe7 as nil") - } - b.ObjStart() - b.PutID("getArchivedStories") - 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 *GetArchivedStoriesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getArchivedStories#6a864fe7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getArchivedStories"); err != nil { - return fmt.Errorf("unable to decode getArchivedStories#6a864fe7: %w", err) - } - case "from_story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getArchivedStories#6a864fe7: field from_story_id: %w", err) - } - g.FromStoryID = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getArchivedStories#6a864fe7: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFromStoryID returns value of FromStoryID field. -func (g *GetArchivedStoriesRequest) GetFromStoryID() (value int32) { - if g == nil { - return - } - return g.FromStoryID -} - -// GetLimit returns value of Limit field. -func (g *GetArchivedStoriesRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetArchivedStories invokes method getArchivedStories#6a864fe7 returning error if any. -func (c *Client) GetArchivedStories(ctx context.Context, request *GetArchivedStoriesRequest) (*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_archived_stories_gen.go b/tdapi/tl_get_chat_archived_stories_gen.go new file mode 100644 index 0000000000..90d79633de --- /dev/null +++ b/tdapi/tl_get_chat_archived_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{} +) + +// GetChatArchivedStoriesRequest represents TL type `getChatArchivedStories#af1e9488`. +type GetChatArchivedStoriesRequest 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 +} + +// GetChatArchivedStoriesRequestTypeID is TL type id of GetChatArchivedStoriesRequest. +const GetChatArchivedStoriesRequestTypeID = 0xaf1e9488 + +// Ensuring interfaces in compile-time for GetChatArchivedStoriesRequest. +var ( + _ bin.Encoder = &GetChatArchivedStoriesRequest{} + _ bin.Decoder = &GetChatArchivedStoriesRequest{} + _ bin.BareEncoder = &GetChatArchivedStoriesRequest{} + _ bin.BareDecoder = &GetChatArchivedStoriesRequest{} +) + +func (g *GetChatArchivedStoriesRequest) 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 *GetChatArchivedStoriesRequest) String() string { + if g == nil { + return "GetChatArchivedStoriesRequest(nil)" + } + type Alias GetChatArchivedStoriesRequest + return fmt.Sprintf("GetChatArchivedStoriesRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetChatArchivedStoriesRequest) TypeID() uint32 { + return GetChatArchivedStoriesRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetChatArchivedStoriesRequest) TypeName() string { + return "getChatArchivedStories" +} + +// TypeInfo returns info about TL type. +func (g *GetChatArchivedStoriesRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getChatArchivedStories", + ID: GetChatArchivedStoriesRequestTypeID, + } + 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 *GetChatArchivedStoriesRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getChatArchivedStories#af1e9488 as nil") + } + b.PutID(GetChatArchivedStoriesRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetChatArchivedStoriesRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getChatArchivedStories#af1e9488 as nil") + } + b.PutInt53(g.ChatID) + b.PutInt32(g.FromStoryID) + b.PutInt32(g.Limit) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetChatArchivedStoriesRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getChatArchivedStories#af1e9488 to nil") + } + if err := b.ConsumeID(GetChatArchivedStoriesRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getChatArchivedStories#af1e9488: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetChatArchivedStoriesRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getChatArchivedStories#af1e9488 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getChatArchivedStories#af1e9488: field chat_id: %w", err) + } + g.ChatID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getChatArchivedStories#af1e9488: field from_story_id: %w", err) + } + g.FromStoryID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getChatArchivedStories#af1e9488: field limit: %w", err) + } + g.Limit = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetChatArchivedStoriesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getChatArchivedStories#af1e9488 as nil") + } + b.ObjStart() + b.PutID("getChatArchivedStories") + 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 *GetChatArchivedStoriesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getChatArchivedStories#af1e9488 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getChatArchivedStories"); err != nil { + return fmt.Errorf("unable to decode getChatArchivedStories#af1e9488: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getChatArchivedStories#af1e9488: 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 getChatArchivedStories#af1e9488: field from_story_id: %w", err) + } + g.FromStoryID = value + case "limit": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getChatArchivedStories#af1e9488: field limit: %w", err) + } + g.Limit = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (g *GetChatArchivedStoriesRequest) GetChatID() (value int64) { + if g == nil { + return + } + return g.ChatID +} + +// GetFromStoryID returns value of FromStoryID field. +func (g *GetChatArchivedStoriesRequest) GetFromStoryID() (value int32) { + if g == nil { + return + } + return g.FromStoryID +} + +// GetLimit returns value of Limit field. +func (g *GetChatArchivedStoriesRequest) GetLimit() (value int32) { + if g == nil { + return + } + return g.Limit +} + +// GetChatArchivedStories invokes method getChatArchivedStories#af1e9488 returning error if any. +func (c *Client) GetChatArchivedStories(ctx context.Context, request *GetChatArchivedStoriesRequest) (*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_boost_link_gen.go b/tdapi/tl_get_chat_boost_link_gen.go new file mode 100644 index 0000000000..67c5d6b5fb --- /dev/null +++ b/tdapi/tl_get_chat_boost_link_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{} +) + +// GetChatBoostLinkRequest represents TL type `getChatBoostLink#56f16c85`. +type GetChatBoostLinkRequest struct { + // Identifier of the chat + ChatID int64 +} + +// GetChatBoostLinkRequestTypeID is TL type id of GetChatBoostLinkRequest. +const GetChatBoostLinkRequestTypeID = 0x56f16c85 + +// Ensuring interfaces in compile-time for GetChatBoostLinkRequest. +var ( + _ bin.Encoder = &GetChatBoostLinkRequest{} + _ bin.Decoder = &GetChatBoostLinkRequest{} + _ bin.BareEncoder = &GetChatBoostLinkRequest{} + _ bin.BareDecoder = &GetChatBoostLinkRequest{} +) + +func (g *GetChatBoostLinkRequest) Zero() bool { + if g == nil { + return true + } + if !(g.ChatID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetChatBoostLinkRequest) String() string { + if g == nil { + return "GetChatBoostLinkRequest(nil)" + } + type Alias GetChatBoostLinkRequest + return fmt.Sprintf("GetChatBoostLinkRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetChatBoostLinkRequest) TypeID() uint32 { + return GetChatBoostLinkRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetChatBoostLinkRequest) TypeName() string { + return "getChatBoostLink" +} + +// TypeInfo returns info about TL type. +func (g *GetChatBoostLinkRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getChatBoostLink", + ID: GetChatBoostLinkRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetChatBoostLinkRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getChatBoostLink#56f16c85 as nil") + } + b.PutID(GetChatBoostLinkRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetChatBoostLinkRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getChatBoostLink#56f16c85 as nil") + } + b.PutInt53(g.ChatID) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetChatBoostLinkRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getChatBoostLink#56f16c85 to nil") + } + if err := b.ConsumeID(GetChatBoostLinkRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getChatBoostLink#56f16c85: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetChatBoostLinkRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getChatBoostLink#56f16c85 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getChatBoostLink#56f16c85: field chat_id: %w", err) + } + g.ChatID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetChatBoostLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getChatBoostLink#56f16c85 as nil") + } + b.ObjStart() + b.PutID("getChatBoostLink") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(g.ChatID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetChatBoostLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getChatBoostLink#56f16c85 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getChatBoostLink"); err != nil { + return fmt.Errorf("unable to decode getChatBoostLink#56f16c85: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getChatBoostLink#56f16c85: field chat_id: %w", err) + } + g.ChatID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (g *GetChatBoostLinkRequest) GetChatID() (value int64) { + if g == nil { + return + } + return g.ChatID +} + +// GetChatBoostLink invokes method getChatBoostLink#56f16c85 returning error if any. +func (c *Client) GetChatBoostLink(ctx context.Context, chatid int64) (*ChatBoostLink, error) { + var result ChatBoostLink + + request := &GetChatBoostLinkRequest{ + ChatID: chatid, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_chat_boost_link_info_gen.go b/tdapi/tl_get_chat_boost_link_info_gen.go new file mode 100644 index 0000000000..c326f2443d --- /dev/null +++ b/tdapi/tl_get_chat_boost_link_info_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{} +) + +// GetChatBoostLinkInfoRequest represents TL type `getChatBoostLinkInfo#26fc4b5c`. +type GetChatBoostLinkInfoRequest struct { + // The link to boost a chat + URL string +} + +// GetChatBoostLinkInfoRequestTypeID is TL type id of GetChatBoostLinkInfoRequest. +const GetChatBoostLinkInfoRequestTypeID = 0x26fc4b5c + +// Ensuring interfaces in compile-time for GetChatBoostLinkInfoRequest. +var ( + _ bin.Encoder = &GetChatBoostLinkInfoRequest{} + _ bin.Decoder = &GetChatBoostLinkInfoRequest{} + _ bin.BareEncoder = &GetChatBoostLinkInfoRequest{} + _ bin.BareDecoder = &GetChatBoostLinkInfoRequest{} +) + +func (g *GetChatBoostLinkInfoRequest) Zero() bool { + if g == nil { + return true + } + if !(g.URL == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetChatBoostLinkInfoRequest) String() string { + if g == nil { + return "GetChatBoostLinkInfoRequest(nil)" + } + type Alias GetChatBoostLinkInfoRequest + return fmt.Sprintf("GetChatBoostLinkInfoRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetChatBoostLinkInfoRequest) TypeID() uint32 { + return GetChatBoostLinkInfoRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetChatBoostLinkInfoRequest) TypeName() string { + return "getChatBoostLinkInfo" +} + +// TypeInfo returns info about TL type. +func (g *GetChatBoostLinkInfoRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getChatBoostLinkInfo", + ID: GetChatBoostLinkInfoRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "URL", + SchemaName: "url", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetChatBoostLinkInfoRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getChatBoostLinkInfo#26fc4b5c as nil") + } + b.PutID(GetChatBoostLinkInfoRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetChatBoostLinkInfoRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getChatBoostLinkInfo#26fc4b5c as nil") + } + b.PutString(g.URL) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetChatBoostLinkInfoRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getChatBoostLinkInfo#26fc4b5c to nil") + } + if err := b.ConsumeID(GetChatBoostLinkInfoRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getChatBoostLinkInfo#26fc4b5c: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetChatBoostLinkInfoRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getChatBoostLinkInfo#26fc4b5c to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getChatBoostLinkInfo#26fc4b5c: field url: %w", err) + } + g.URL = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetChatBoostLinkInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getChatBoostLinkInfo#26fc4b5c as nil") + } + b.ObjStart() + b.PutID("getChatBoostLinkInfo") + b.Comma() + b.FieldStart("url") + b.PutString(g.URL) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetChatBoostLinkInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getChatBoostLinkInfo#26fc4b5c to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getChatBoostLinkInfo"); err != nil { + return fmt.Errorf("unable to decode getChatBoostLinkInfo#26fc4b5c: %w", err) + } + case "url": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getChatBoostLinkInfo#26fc4b5c: field url: %w", err) + } + g.URL = value + default: + return b.Skip() + } + return nil + }) +} + +// GetURL returns value of URL field. +func (g *GetChatBoostLinkInfoRequest) GetURL() (value string) { + if g == nil { + return + } + return g.URL +} + +// GetChatBoostLinkInfo invokes method getChatBoostLinkInfo#26fc4b5c returning error if any. +func (c *Client) GetChatBoostLinkInfo(ctx context.Context, url string) (*ChatBoostLinkInfo, error) { + var result ChatBoostLinkInfo + + request := &GetChatBoostLinkInfoRequest{ + URL: url, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_chat_boost_status_gen.go b/tdapi/tl_get_chat_boost_status_gen.go new file mode 100644 index 0000000000..5e3f1c12d9 --- /dev/null +++ b/tdapi/tl_get_chat_boost_status_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{} +) + +// GetChatBoostStatusRequest represents TL type `getChatBoostStatus#cfac8acf`. +type GetChatBoostStatusRequest struct { + // Identifier of the channel chat + ChatID int64 +} + +// GetChatBoostStatusRequestTypeID is TL type id of GetChatBoostStatusRequest. +const GetChatBoostStatusRequestTypeID = 0xcfac8acf + +// Ensuring interfaces in compile-time for GetChatBoostStatusRequest. +var ( + _ bin.Encoder = &GetChatBoostStatusRequest{} + _ bin.Decoder = &GetChatBoostStatusRequest{} + _ bin.BareEncoder = &GetChatBoostStatusRequest{} + _ bin.BareDecoder = &GetChatBoostStatusRequest{} +) + +func (g *GetChatBoostStatusRequest) Zero() bool { + if g == nil { + return true + } + if !(g.ChatID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetChatBoostStatusRequest) String() string { + if g == nil { + return "GetChatBoostStatusRequest(nil)" + } + type Alias GetChatBoostStatusRequest + return fmt.Sprintf("GetChatBoostStatusRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetChatBoostStatusRequest) TypeID() uint32 { + return GetChatBoostStatusRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetChatBoostStatusRequest) TypeName() string { + return "getChatBoostStatus" +} + +// TypeInfo returns info about TL type. +func (g *GetChatBoostStatusRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getChatBoostStatus", + ID: GetChatBoostStatusRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetChatBoostStatusRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getChatBoostStatus#cfac8acf as nil") + } + b.PutID(GetChatBoostStatusRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetChatBoostStatusRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getChatBoostStatus#cfac8acf as nil") + } + b.PutInt53(g.ChatID) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetChatBoostStatusRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getChatBoostStatus#cfac8acf to nil") + } + if err := b.ConsumeID(GetChatBoostStatusRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getChatBoostStatus#cfac8acf: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetChatBoostStatusRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getChatBoostStatus#cfac8acf to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getChatBoostStatus#cfac8acf: field chat_id: %w", err) + } + g.ChatID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetChatBoostStatusRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getChatBoostStatus#cfac8acf as nil") + } + b.ObjStart() + b.PutID("getChatBoostStatus") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(g.ChatID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetChatBoostStatusRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getChatBoostStatus#cfac8acf to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getChatBoostStatus"); err != nil { + return fmt.Errorf("unable to decode getChatBoostStatus#cfac8acf: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getChatBoostStatus#cfac8acf: field chat_id: %w", err) + } + g.ChatID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (g *GetChatBoostStatusRequest) GetChatID() (value int64) { + if g == nil { + return + } + return g.ChatID +} + +// GetChatBoostStatus invokes method getChatBoostStatus#cfac8acf returning error if any. +func (c *Client) GetChatBoostStatus(ctx context.Context, chatid int64) (*ChatBoostStatus, error) { + var result ChatBoostStatus + + request := &GetChatBoostStatusRequest{ + ChatID: chatid, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_chat_boosts_gen.go b/tdapi/tl_get_chat_boosts_gen.go new file mode 100644 index 0000000000..4493a787d4 --- /dev/null +++ b/tdapi/tl_get_chat_boosts_gen.go @@ -0,0 +1,273 @@ +// 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{} +) + +// GetChatBoostsRequest represents TL type `getChatBoosts#d82a288e`. +type GetChatBoostsRequest struct { + // Identifier of the chat + ChatID int64 + // Offset of the first entry to return as received from the previous request; use empty + // string to get the first chunk of results + Offset string + // The maximum number of boosts to be returned; up to 100. For optimal performance, the + // number of returned boosts can be smaller than the specified limit + Limit int32 +} + +// GetChatBoostsRequestTypeID is TL type id of GetChatBoostsRequest. +const GetChatBoostsRequestTypeID = 0xd82a288e + +// Ensuring interfaces in compile-time for GetChatBoostsRequest. +var ( + _ bin.Encoder = &GetChatBoostsRequest{} + _ bin.Decoder = &GetChatBoostsRequest{} + _ bin.BareEncoder = &GetChatBoostsRequest{} + _ bin.BareDecoder = &GetChatBoostsRequest{} +) + +func (g *GetChatBoostsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.ChatID == 0) { + return false + } + if !(g.Offset == "") { + return false + } + if !(g.Limit == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetChatBoostsRequest) String() string { + if g == nil { + return "GetChatBoostsRequest(nil)" + } + type Alias GetChatBoostsRequest + return fmt.Sprintf("GetChatBoostsRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetChatBoostsRequest) TypeID() uint32 { + return GetChatBoostsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetChatBoostsRequest) TypeName() string { + return "getChatBoosts" +} + +// TypeInfo returns info about TL type. +func (g *GetChatBoostsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getChatBoosts", + ID: GetChatBoostsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "Offset", + SchemaName: "offset", + }, + { + Name: "Limit", + SchemaName: "limit", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetChatBoostsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getChatBoosts#d82a288e as nil") + } + b.PutID(GetChatBoostsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetChatBoostsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getChatBoosts#d82a288e as nil") + } + b.PutInt53(g.ChatID) + b.PutString(g.Offset) + b.PutInt32(g.Limit) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetChatBoostsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getChatBoosts#d82a288e to nil") + } + if err := b.ConsumeID(GetChatBoostsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getChatBoosts#d82a288e: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetChatBoostsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getChatBoosts#d82a288e to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getChatBoosts#d82a288e: field chat_id: %w", err) + } + g.ChatID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getChatBoosts#d82a288e: field offset: %w", err) + } + g.Offset = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getChatBoosts#d82a288e: field limit: %w", err) + } + g.Limit = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetChatBoostsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getChatBoosts#d82a288e as nil") + } + b.ObjStart() + b.PutID("getChatBoosts") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(g.ChatID) + b.Comma() + b.FieldStart("offset") + b.PutString(g.Offset) + b.Comma() + b.FieldStart("limit") + b.PutInt32(g.Limit) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetChatBoostsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getChatBoosts#d82a288e to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getChatBoosts"); err != nil { + return fmt.Errorf("unable to decode getChatBoosts#d82a288e: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getChatBoosts#d82a288e: field chat_id: %w", err) + } + g.ChatID = value + case "offset": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getChatBoosts#d82a288e: field offset: %w", err) + } + g.Offset = value + case "limit": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getChatBoosts#d82a288e: field limit: %w", err) + } + g.Limit = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (g *GetChatBoostsRequest) GetChatID() (value int64) { + if g == nil { + return + } + return g.ChatID +} + +// GetOffset returns value of Offset field. +func (g *GetChatBoostsRequest) GetOffset() (value string) { + if g == nil { + return + } + return g.Offset +} + +// GetLimit returns value of Limit field. +func (g *GetChatBoostsRequest) GetLimit() (value int32) { + if g == nil { + return + } + return g.Limit +} + +// GetChatBoosts invokes method getChatBoosts#d82a288e returning error if any. +func (c *Client) GetChatBoosts(ctx context.Context, request *GetChatBoostsRequest) (*FoundChatBoosts, error) { + var result FoundChatBoosts + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_chats_to_send_stories_gen.go b/tdapi/tl_get_chats_to_send_stories_gen.go new file mode 100644 index 0000000000..2f91f9b999 --- /dev/null +++ b/tdapi/tl_get_chats_to_send_stories_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{} +) + +// GetChatsToSendStoriesRequest represents TL type `getChatsToSendStories#22f9e3a4`. +type GetChatsToSendStoriesRequest struct { +} + +// GetChatsToSendStoriesRequestTypeID is TL type id of GetChatsToSendStoriesRequest. +const GetChatsToSendStoriesRequestTypeID = 0x22f9e3a4 + +// Ensuring interfaces in compile-time for GetChatsToSendStoriesRequest. +var ( + _ bin.Encoder = &GetChatsToSendStoriesRequest{} + _ bin.Decoder = &GetChatsToSendStoriesRequest{} + _ bin.BareEncoder = &GetChatsToSendStoriesRequest{} + _ bin.BareDecoder = &GetChatsToSendStoriesRequest{} +) + +func (g *GetChatsToSendStoriesRequest) Zero() bool { + if g == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetChatsToSendStoriesRequest) String() string { + if g == nil { + return "GetChatsToSendStoriesRequest(nil)" + } + type Alias GetChatsToSendStoriesRequest + return fmt.Sprintf("GetChatsToSendStoriesRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetChatsToSendStoriesRequest) TypeID() uint32 { + return GetChatsToSendStoriesRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetChatsToSendStoriesRequest) TypeName() string { + return "getChatsToSendStories" +} + +// TypeInfo returns info about TL type. +func (g *GetChatsToSendStoriesRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getChatsToSendStories", + ID: GetChatsToSendStoriesRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (g *GetChatsToSendStoriesRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getChatsToSendStories#22f9e3a4 as nil") + } + b.PutID(GetChatsToSendStoriesRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetChatsToSendStoriesRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getChatsToSendStories#22f9e3a4 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (g *GetChatsToSendStoriesRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getChatsToSendStories#22f9e3a4 to nil") + } + if err := b.ConsumeID(GetChatsToSendStoriesRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getChatsToSendStories#22f9e3a4: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetChatsToSendStoriesRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getChatsToSendStories#22f9e3a4 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetChatsToSendStoriesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getChatsToSendStories#22f9e3a4 as nil") + } + b.ObjStart() + b.PutID("getChatsToSendStories") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetChatsToSendStoriesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getChatsToSendStories#22f9e3a4 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getChatsToSendStories"); err != nil { + return fmt.Errorf("unable to decode getChatsToSendStories#22f9e3a4: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetChatsToSendStories invokes method getChatsToSendStories#22f9e3a4 returning error if any. +func (c *Client) GetChatsToSendStories(ctx context.Context) (*Chats, error) { + var result Chats + + request := &GetChatsToSendStoriesRequest{} + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_input_story_area_type_gen.go b/tdapi/tl_input_story_area_type_gen.go index 79fcbab458..3c5d268744 100644 --- a/tdapi/tl_input_story_area_type_gen.go +++ b/tdapi/tl_input_story_area_type_gen.go @@ -597,6 +597,250 @@ func (i *InputStoryAreaTypePreviousVenue) GetVenueID() (value string) { return i.VenueID } +// InputStoryAreaTypeSuggestedReaction represents TL type `inputStoryAreaTypeSuggestedReaction#7d4751d3`. +type InputStoryAreaTypeSuggestedReaction struct { + // Type of the reaction + ReactionType ReactionTypeClass + // True, if reaction has a dark background + IsDark bool + // True, if reaction corner is flipped + IsFlipped bool +} + +// InputStoryAreaTypeSuggestedReactionTypeID is TL type id of InputStoryAreaTypeSuggestedReaction. +const InputStoryAreaTypeSuggestedReactionTypeID = 0x7d4751d3 + +// construct implements constructor of InputStoryAreaTypeClass. +func (i InputStoryAreaTypeSuggestedReaction) construct() InputStoryAreaTypeClass { return &i } + +// Ensuring interfaces in compile-time for InputStoryAreaTypeSuggestedReaction. +var ( + _ bin.Encoder = &InputStoryAreaTypeSuggestedReaction{} + _ bin.Decoder = &InputStoryAreaTypeSuggestedReaction{} + _ bin.BareEncoder = &InputStoryAreaTypeSuggestedReaction{} + _ bin.BareDecoder = &InputStoryAreaTypeSuggestedReaction{} + + _ InputStoryAreaTypeClass = &InputStoryAreaTypeSuggestedReaction{} +) + +func (i *InputStoryAreaTypeSuggestedReaction) Zero() bool { + if i == nil { + return true + } + if !(i.ReactionType == nil) { + return false + } + if !(i.IsDark == false) { + return false + } + if !(i.IsFlipped == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputStoryAreaTypeSuggestedReaction) String() string { + if i == nil { + return "InputStoryAreaTypeSuggestedReaction(nil)" + } + type Alias InputStoryAreaTypeSuggestedReaction + return fmt.Sprintf("InputStoryAreaTypeSuggestedReaction%+v", Alias(*i)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputStoryAreaTypeSuggestedReaction) TypeID() uint32 { + return InputStoryAreaTypeSuggestedReactionTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputStoryAreaTypeSuggestedReaction) TypeName() string { + return "inputStoryAreaTypeSuggestedReaction" +} + +// TypeInfo returns info about TL type. +func (i *InputStoryAreaTypeSuggestedReaction) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputStoryAreaTypeSuggestedReaction", + ID: InputStoryAreaTypeSuggestedReactionTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ReactionType", + SchemaName: "reaction_type", + }, + { + Name: "IsDark", + SchemaName: "is_dark", + }, + { + Name: "IsFlipped", + SchemaName: "is_flipped", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *InputStoryAreaTypeSuggestedReaction) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputStoryAreaTypeSuggestedReaction#7d4751d3 as nil") + } + b.PutID(InputStoryAreaTypeSuggestedReactionTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputStoryAreaTypeSuggestedReaction) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputStoryAreaTypeSuggestedReaction#7d4751d3 as nil") + } + if i.ReactionType == nil { + return fmt.Errorf("unable to encode inputStoryAreaTypeSuggestedReaction#7d4751d3: field reaction_type is nil") + } + if err := i.ReactionType.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputStoryAreaTypeSuggestedReaction#7d4751d3: field reaction_type: %w", err) + } + b.PutBool(i.IsDark) + b.PutBool(i.IsFlipped) + return nil +} + +// Decode implements bin.Decoder. +func (i *InputStoryAreaTypeSuggestedReaction) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputStoryAreaTypeSuggestedReaction#7d4751d3 to nil") + } + if err := b.ConsumeID(InputStoryAreaTypeSuggestedReactionTypeID); err != nil { + return fmt.Errorf("unable to decode inputStoryAreaTypeSuggestedReaction#7d4751d3: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputStoryAreaTypeSuggestedReaction) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputStoryAreaTypeSuggestedReaction#7d4751d3 to nil") + } + { + value, err := DecodeReactionType(b) + if err != nil { + return fmt.Errorf("unable to decode inputStoryAreaTypeSuggestedReaction#7d4751d3: field reaction_type: %w", err) + } + i.ReactionType = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode inputStoryAreaTypeSuggestedReaction#7d4751d3: field is_dark: %w", err) + } + i.IsDark = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode inputStoryAreaTypeSuggestedReaction#7d4751d3: field is_flipped: %w", err) + } + i.IsFlipped = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (i *InputStoryAreaTypeSuggestedReaction) EncodeTDLibJSON(b tdjson.Encoder) error { + if i == nil { + return fmt.Errorf("can't encode inputStoryAreaTypeSuggestedReaction#7d4751d3 as nil") + } + b.ObjStart() + b.PutID("inputStoryAreaTypeSuggestedReaction") + b.Comma() + b.FieldStart("reaction_type") + if i.ReactionType == nil { + return fmt.Errorf("unable to encode inputStoryAreaTypeSuggestedReaction#7d4751d3: field reaction_type is nil") + } + if err := i.ReactionType.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode inputStoryAreaTypeSuggestedReaction#7d4751d3: field reaction_type: %w", err) + } + b.Comma() + b.FieldStart("is_dark") + b.PutBool(i.IsDark) + b.Comma() + b.FieldStart("is_flipped") + b.PutBool(i.IsFlipped) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (i *InputStoryAreaTypeSuggestedReaction) DecodeTDLibJSON(b tdjson.Decoder) error { + if i == nil { + return fmt.Errorf("can't decode inputStoryAreaTypeSuggestedReaction#7d4751d3 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("inputStoryAreaTypeSuggestedReaction"); err != nil { + return fmt.Errorf("unable to decode inputStoryAreaTypeSuggestedReaction#7d4751d3: %w", err) + } + case "reaction_type": + value, err := DecodeTDLibJSONReactionType(b) + if err != nil { + return fmt.Errorf("unable to decode inputStoryAreaTypeSuggestedReaction#7d4751d3: field reaction_type: %w", err) + } + i.ReactionType = value + case "is_dark": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode inputStoryAreaTypeSuggestedReaction#7d4751d3: field is_dark: %w", err) + } + i.IsDark = value + case "is_flipped": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode inputStoryAreaTypeSuggestedReaction#7d4751d3: field is_flipped: %w", err) + } + i.IsFlipped = value + default: + return b.Skip() + } + return nil + }) +} + +// GetReactionType returns value of ReactionType field. +func (i *InputStoryAreaTypeSuggestedReaction) GetReactionType() (value ReactionTypeClass) { + if i == nil { + return + } + return i.ReactionType +} + +// GetIsDark returns value of IsDark field. +func (i *InputStoryAreaTypeSuggestedReaction) GetIsDark() (value bool) { + if i == nil { + return + } + return i.IsDark +} + +// GetIsFlipped returns value of IsFlipped field. +func (i *InputStoryAreaTypeSuggestedReaction) GetIsFlipped() (value bool) { + if i == nil { + return + } + return i.IsFlipped +} + // InputStoryAreaTypeClassName is schema name of InputStoryAreaTypeClass. const InputStoryAreaTypeClassName = "InputStoryAreaType" @@ -612,6 +856,7 @@ const InputStoryAreaTypeClassName = "InputStoryAreaType" // case *tdapi.InputStoryAreaTypeLocation: // inputStoryAreaTypeLocation#6849d762 // case *tdapi.InputStoryAreaTypeFoundVenue: // inputStoryAreaTypeFoundVenue#accda496 // case *tdapi.InputStoryAreaTypePreviousVenue: // inputStoryAreaTypePreviousVenue#6e124e0c +// case *tdapi.InputStoryAreaTypeSuggestedReaction: // inputStoryAreaTypeSuggestedReaction#7d4751d3 // default: panic(v) // } type InputStoryAreaTypeClass interface { @@ -664,6 +909,13 @@ func DecodeInputStoryAreaType(buf *bin.Buffer) (InputStoryAreaTypeClass, error) return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) } return &v, nil + case InputStoryAreaTypeSuggestedReactionTypeID: + // Decoding inputStoryAreaTypeSuggestedReaction#7d4751d3. + v := InputStoryAreaTypeSuggestedReaction{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", bin.NewUnexpectedID(id)) } @@ -697,6 +949,13 @@ func DecodeTDLibJSONInputStoryAreaType(buf tdjson.Decoder) (InputStoryAreaTypeCl return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) } return &v, nil + case "inputStoryAreaTypeSuggestedReaction": + // Decoding inputStoryAreaTypeSuggestedReaction#7d4751d3. + v := InputStoryAreaTypeSuggestedReaction{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", tdjson.NewUnexpectedID(id)) } diff --git a/tdapi/tl_internal_link_type_gen.go b/tdapi/tl_internal_link_type_gen.go index 0163191eaa..9667daab95 100644 --- a/tdapi/tl_internal_link_type_gen.go +++ b/tdapi/tl_internal_link_type_gen.go @@ -1538,6 +1538,172 @@ func (i *InternalLinkTypeChangePhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) er }) } +// InternalLinkTypeChatBoost represents TL type `internalLinkTypeChatBoost#d549fd40`. +type InternalLinkTypeChatBoost struct { + // URL to be passed to getChatBoostLinkInfo + URL string +} + +// InternalLinkTypeChatBoostTypeID is TL type id of InternalLinkTypeChatBoost. +const InternalLinkTypeChatBoostTypeID = 0xd549fd40 + +// construct implements constructor of InternalLinkTypeClass. +func (i InternalLinkTypeChatBoost) construct() InternalLinkTypeClass { return &i } + +// Ensuring interfaces in compile-time for InternalLinkTypeChatBoost. +var ( + _ bin.Encoder = &InternalLinkTypeChatBoost{} + _ bin.Decoder = &InternalLinkTypeChatBoost{} + _ bin.BareEncoder = &InternalLinkTypeChatBoost{} + _ bin.BareDecoder = &InternalLinkTypeChatBoost{} + + _ InternalLinkTypeClass = &InternalLinkTypeChatBoost{} +) + +func (i *InternalLinkTypeChatBoost) Zero() bool { + if i == nil { + return true + } + if !(i.URL == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InternalLinkTypeChatBoost) String() string { + if i == nil { + return "InternalLinkTypeChatBoost(nil)" + } + type Alias InternalLinkTypeChatBoost + return fmt.Sprintf("InternalLinkTypeChatBoost%+v", Alias(*i)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InternalLinkTypeChatBoost) TypeID() uint32 { + return InternalLinkTypeChatBoostTypeID +} + +// TypeName returns name of type in TL schema. +func (*InternalLinkTypeChatBoost) TypeName() string { + return "internalLinkTypeChatBoost" +} + +// TypeInfo returns info about TL type. +func (i *InternalLinkTypeChatBoost) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "internalLinkTypeChatBoost", + ID: InternalLinkTypeChatBoostTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "URL", + SchemaName: "url", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *InternalLinkTypeChatBoost) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode internalLinkTypeChatBoost#d549fd40 as nil") + } + b.PutID(InternalLinkTypeChatBoostTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InternalLinkTypeChatBoost) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode internalLinkTypeChatBoost#d549fd40 as nil") + } + b.PutString(i.URL) + return nil +} + +// Decode implements bin.Decoder. +func (i *InternalLinkTypeChatBoost) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode internalLinkTypeChatBoost#d549fd40 to nil") + } + if err := b.ConsumeID(InternalLinkTypeChatBoostTypeID); err != nil { + return fmt.Errorf("unable to decode internalLinkTypeChatBoost#d549fd40: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InternalLinkTypeChatBoost) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode internalLinkTypeChatBoost#d549fd40 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode internalLinkTypeChatBoost#d549fd40: field url: %w", err) + } + i.URL = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (i *InternalLinkTypeChatBoost) EncodeTDLibJSON(b tdjson.Encoder) error { + if i == nil { + return fmt.Errorf("can't encode internalLinkTypeChatBoost#d549fd40 as nil") + } + b.ObjStart() + b.PutID("internalLinkTypeChatBoost") + b.Comma() + b.FieldStart("url") + b.PutString(i.URL) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (i *InternalLinkTypeChatBoost) DecodeTDLibJSON(b tdjson.Decoder) error { + if i == nil { + return fmt.Errorf("can't decode internalLinkTypeChatBoost#d549fd40 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("internalLinkTypeChatBoost"); err != nil { + return fmt.Errorf("unable to decode internalLinkTypeChatBoost#d549fd40: %w", err) + } + case "url": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode internalLinkTypeChatBoost#d549fd40: field url: %w", err) + } + i.URL = value + default: + return b.Skip() + } + return nil + }) +} + +// GetURL returns value of URL field. +func (i *InternalLinkTypeChatBoost) GetURL() (value string) { + if i == nil { + return + } + return i.URL +} + // InternalLinkTypeChatFolderInvite represents TL type `internalLinkTypeChatFolderInvite#89b2493e`. type InternalLinkTypeChatFolderInvite struct { // Internal representation of the invite link @@ -7115,6 +7281,7 @@ const InternalLinkTypeClassName = "InternalLinkType" // case *tdapi.InternalLinkTypeBotStart: // internalLinkTypeBotStart#3f985fed // case *tdapi.InternalLinkTypeBotStartInGroup: // internalLinkTypeBotStartInGroup#ca0d8cce // case *tdapi.InternalLinkTypeChangePhoneNumber: // internalLinkTypeChangePhoneNumber#f0275b01 +// case *tdapi.InternalLinkTypeChatBoost: // internalLinkTypeChatBoost#d549fd40 // case *tdapi.InternalLinkTypeChatFolderInvite: // internalLinkTypeChatFolderInvite#89b2493e // case *tdapi.InternalLinkTypeChatFolderSettings: // internalLinkTypeChatFolderSettings#bfff055c // case *tdapi.InternalLinkTypeChatInvite: // internalLinkTypeChatInvite#198c3cd9 @@ -7234,6 +7401,13 @@ func DecodeInternalLinkType(buf *bin.Buffer) (InternalLinkTypeClass, error) { return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) } return &v, nil + case InternalLinkTypeChatBoostTypeID: + // Decoding internalLinkTypeChatBoost#d549fd40. + v := InternalLinkTypeChatBoost{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) + } + return &v, nil case InternalLinkTypeChatFolderInviteTypeID: // Decoding internalLinkTypeChatFolderInvite#89b2493e. v := InternalLinkTypeChatFolderInvite{} @@ -7526,6 +7700,13 @@ func DecodeTDLibJSONInternalLinkType(buf tdjson.Decoder) (InternalLinkTypeClass, return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) } return &v, nil + case "internalLinkTypeChatBoost": + // Decoding internalLinkTypeChatBoost#d549fd40. + v := InternalLinkTypeChatBoost{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) + } + return &v, nil case "internalLinkTypeChatFolderInvite": // Decoding internalLinkTypeChatFolderInvite#89b2493e. v := InternalLinkTypeChatFolderInvite{} diff --git a/tdapi/tl_invoice_gen.go b/tdapi/tl_invoice_gen.go index 5f1e6cab71..42a230b296 100644 --- a/tdapi/tl_invoice_gen.go +++ b/tdapi/tl_invoice_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// Invoice represents TL type `invoice#43609f28`. +// Invoice represents TL type `invoice#c19b2377`. type Invoice struct { // ISO 4217 currency code Currency string @@ -45,6 +45,9 @@ type Invoice struct { // payment will result in recurring payments and the user must accept the terms of // service before allowed to pay RecurringPaymentTermsOfServiceURL string + // An HTTP URL with terms of service for non-recurring payments. If non-empty, then the + // user must accept the terms of service before allowed to pay + TermsOfServiceURL string // True, if the payment is a test payment IsTest bool // True, if the user's name is needed for payment @@ -64,7 +67,7 @@ type Invoice struct { } // InvoiceTypeID is TL type id of Invoice. -const InvoiceTypeID = 0x43609f28 +const InvoiceTypeID = 0xc19b2377 // Ensuring interfaces in compile-time for Invoice. var ( @@ -93,6 +96,9 @@ func (i *Invoice) Zero() bool { if !(i.RecurringPaymentTermsOfServiceURL == "") { return false } + if !(i.TermsOfServiceURL == "") { + return false + } if !(i.IsTest == false) { return false } @@ -173,6 +179,10 @@ func (i *Invoice) TypeInfo() tdp.Type { Name: "RecurringPaymentTermsOfServiceURL", SchemaName: "recurring_payment_terms_of_service_url", }, + { + Name: "TermsOfServiceURL", + SchemaName: "terms_of_service_url", + }, { Name: "IsTest", SchemaName: "is_test", @@ -212,7 +222,7 @@ func (i *Invoice) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (i *Invoice) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode invoice#43609f28 as nil") + return fmt.Errorf("can't encode invoice#c19b2377 as nil") } b.PutID(InvoiceTypeID) return i.EncodeBare(b) @@ -221,13 +231,13 @@ func (i *Invoice) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (i *Invoice) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode invoice#43609f28 as nil") + return fmt.Errorf("can't encode invoice#c19b2377 as nil") } b.PutString(i.Currency) b.PutInt(len(i.PriceParts)) for idx, v := range i.PriceParts { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare invoice#43609f28: field price_parts element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare invoice#c19b2377: field price_parts element with index %d: %w", idx, err) } } b.PutInt53(i.MaxTipAmount) @@ -236,6 +246,7 @@ func (i *Invoice) EncodeBare(b *bin.Buffer) error { b.PutInt53(v) } b.PutString(i.RecurringPaymentTermsOfServiceURL) + b.PutString(i.TermsOfServiceURL) b.PutBool(i.IsTest) b.PutBool(i.NeedName) b.PutBool(i.NeedPhoneNumber) @@ -250,10 +261,10 @@ func (i *Invoice) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (i *Invoice) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode invoice#43609f28 to nil") + return fmt.Errorf("can't decode invoice#c19b2377 to nil") } if err := b.ConsumeID(InvoiceTypeID); err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: %w", err) } return i.DecodeBare(b) } @@ -261,19 +272,19 @@ func (i *Invoice) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (i *Invoice) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode invoice#43609f28 to nil") + return fmt.Errorf("can't decode invoice#c19b2377 to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field currency: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field currency: %w", err) } i.Currency = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field price_parts: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field price_parts: %w", err) } if headerLen > 0 { @@ -282,7 +293,7 @@ func (i *Invoice) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value LabeledPricePart if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare invoice#43609f28: field price_parts: %w", err) + return fmt.Errorf("unable to decode bare invoice#c19b2377: field price_parts: %w", err) } i.PriceParts = append(i.PriceParts, value) } @@ -290,14 +301,14 @@ func (i *Invoice) DecodeBare(b *bin.Buffer) error { { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field max_tip_amount: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field max_tip_amount: %w", err) } i.MaxTipAmount = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field suggested_tip_amounts: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field suggested_tip_amounts: %w", err) } if headerLen > 0 { @@ -306,7 +317,7 @@ func (i *Invoice) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field suggested_tip_amounts: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field suggested_tip_amounts: %w", err) } i.SuggestedTipAmounts = append(i.SuggestedTipAmounts, value) } @@ -314,63 +325,70 @@ func (i *Invoice) DecodeBare(b *bin.Buffer) error { { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field recurring_payment_terms_of_service_url: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field recurring_payment_terms_of_service_url: %w", err) } i.RecurringPaymentTermsOfServiceURL = value } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode invoice#c19b2377: field terms_of_service_url: %w", err) + } + i.TermsOfServiceURL = value + } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field is_test: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field is_test: %w", err) } i.IsTest = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field need_name: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field need_name: %w", err) } i.NeedName = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field need_phone_number: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field need_phone_number: %w", err) } i.NeedPhoneNumber = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field need_email_address: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field need_email_address: %w", err) } i.NeedEmailAddress = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field need_shipping_address: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field need_shipping_address: %w", err) } i.NeedShippingAddress = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field send_phone_number_to_provider: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field send_phone_number_to_provider: %w", err) } i.SendPhoneNumberToProvider = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field send_email_address_to_provider: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field send_email_address_to_provider: %w", err) } i.SendEmailAddressToProvider = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field is_flexible: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field is_flexible: %w", err) } i.IsFlexible = value } @@ -380,7 +398,7 @@ func (i *Invoice) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (i *Invoice) EncodeTDLibJSON(b tdjson.Encoder) error { if i == nil { - return fmt.Errorf("can't encode invoice#43609f28 as nil") + return fmt.Errorf("can't encode invoice#c19b2377 as nil") } b.ObjStart() b.PutID("invoice") @@ -392,7 +410,7 @@ func (i *Invoice) EncodeTDLibJSON(b tdjson.Encoder) error { b.ArrStart() for idx, v := range i.PriceParts { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode invoice#43609f28: field price_parts element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode invoice#c19b2377: field price_parts element with index %d: %w", idx, err) } b.Comma() } @@ -414,6 +432,9 @@ func (i *Invoice) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("recurring_payment_terms_of_service_url") b.PutString(i.RecurringPaymentTermsOfServiceURL) b.Comma() + b.FieldStart("terms_of_service_url") + b.PutString(i.TermsOfServiceURL) + b.Comma() b.FieldStart("is_test") b.PutBool(i.IsTest) b.Comma() @@ -446,101 +467,107 @@ func (i *Invoice) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (i *Invoice) DecodeTDLibJSON(b tdjson.Decoder) error { if i == nil { - return fmt.Errorf("can't decode invoice#43609f28 to nil") + return fmt.Errorf("can't decode invoice#c19b2377 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("invoice"); err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: %w", err) } case "currency": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field currency: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field currency: %w", err) } i.Currency = value case "price_parts": if err := b.Arr(func(b tdjson.Decoder) error { var value LabeledPricePart if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field price_parts: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field price_parts: %w", err) } i.PriceParts = append(i.PriceParts, value) return nil }); err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field price_parts: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field price_parts: %w", err) } case "max_tip_amount": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field max_tip_amount: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field max_tip_amount: %w", err) } i.MaxTipAmount = value case "suggested_tip_amounts": if err := b.Arr(func(b tdjson.Decoder) error { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field suggested_tip_amounts: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field suggested_tip_amounts: %w", err) } i.SuggestedTipAmounts = append(i.SuggestedTipAmounts, value) return nil }); err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field suggested_tip_amounts: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field suggested_tip_amounts: %w", err) } case "recurring_payment_terms_of_service_url": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field recurring_payment_terms_of_service_url: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field recurring_payment_terms_of_service_url: %w", err) } i.RecurringPaymentTermsOfServiceURL = value + case "terms_of_service_url": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode invoice#c19b2377: field terms_of_service_url: %w", err) + } + i.TermsOfServiceURL = value case "is_test": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field is_test: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field is_test: %w", err) } i.IsTest = value case "need_name": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field need_name: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field need_name: %w", err) } i.NeedName = value case "need_phone_number": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field need_phone_number: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field need_phone_number: %w", err) } i.NeedPhoneNumber = value case "need_email_address": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field need_email_address: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field need_email_address: %w", err) } i.NeedEmailAddress = value case "need_shipping_address": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field need_shipping_address: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field need_shipping_address: %w", err) } i.NeedShippingAddress = value case "send_phone_number_to_provider": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field send_phone_number_to_provider: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field send_phone_number_to_provider: %w", err) } i.SendPhoneNumberToProvider = value case "send_email_address_to_provider": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field send_email_address_to_provider: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field send_email_address_to_provider: %w", err) } i.SendEmailAddressToProvider = value case "is_flexible": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode invoice#43609f28: field is_flexible: %w", err) + return fmt.Errorf("unable to decode invoice#c19b2377: field is_flexible: %w", err) } i.IsFlexible = value default: @@ -590,6 +617,14 @@ func (i *Invoice) GetRecurringPaymentTermsOfServiceURL() (value string) { return i.RecurringPaymentTermsOfServiceURL } +// GetTermsOfServiceURL returns value of TermsOfServiceURL field. +func (i *Invoice) GetTermsOfServiceURL() (value string) { + if i == nil { + return + } + return i.TermsOfServiceURL +} + // GetIsTest returns value of IsTest field. func (i *Invoice) GetIsTest() (value bool) { if i == nil { diff --git a/tdapi/tl_message_sending_state_gen.go b/tdapi/tl_message_sending_state_gen.go index 76bc2c9d92..89dd5ed402 100644 --- a/tdapi/tl_message_sending_state_gen.go +++ b/tdapi/tl_message_sending_state_gen.go @@ -197,12 +197,10 @@ func (m *MessageSendingStatePending) GetSendingID() (value int32) { return m.SendingID } -// MessageSendingStateFailed represents TL type `messageSendingStateFailed#982ce904`. +// MessageSendingStateFailed represents TL type `messageSendingStateFailed#fb75b2af`. type MessageSendingStateFailed struct { - // An error code; 0 if unknown - ErrorCode int32 - // Error message - ErrorMessage string + // The cause of the message sending failure + Error Error // True, if the message can be re-sent CanRetry bool // True, if the message can be re-sent only on behalf of a different sender @@ -213,7 +211,7 @@ type MessageSendingStateFailed struct { } // MessageSendingStateFailedTypeID is TL type id of MessageSendingStateFailed. -const MessageSendingStateFailedTypeID = 0x982ce904 +const MessageSendingStateFailedTypeID = 0xfb75b2af // construct implements constructor of MessageSendingStateClass. func (m MessageSendingStateFailed) construct() MessageSendingStateClass { return &m } @@ -232,10 +230,7 @@ func (m *MessageSendingStateFailed) Zero() bool { if m == nil { return true } - if !(m.ErrorCode == 0) { - return false - } - if !(m.ErrorMessage == "") { + if !(m.Error.Zero()) { return false } if !(m.CanRetry == false) { @@ -284,12 +279,8 @@ func (m *MessageSendingStateFailed) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "ErrorCode", - SchemaName: "error_code", - }, - { - Name: "ErrorMessage", - SchemaName: "error_message", + Name: "Error", + SchemaName: "error", }, { Name: "CanRetry", @@ -310,7 +301,7 @@ func (m *MessageSendingStateFailed) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (m *MessageSendingStateFailed) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageSendingStateFailed#982ce904 as nil") + return fmt.Errorf("can't encode messageSendingStateFailed#fb75b2af as nil") } b.PutID(MessageSendingStateFailedTypeID) return m.EncodeBare(b) @@ -319,10 +310,11 @@ func (m *MessageSendingStateFailed) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageSendingStateFailed) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageSendingStateFailed#982ce904 as nil") + return fmt.Errorf("can't encode messageSendingStateFailed#fb75b2af as nil") + } + if err := m.Error.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageSendingStateFailed#fb75b2af: field error: %w", err) } - b.PutInt32(m.ErrorCode) - b.PutString(m.ErrorMessage) b.PutBool(m.CanRetry) b.PutBool(m.NeedAnotherSender) b.PutDouble(m.RetryAfter) @@ -332,10 +324,10 @@ func (m *MessageSendingStateFailed) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *MessageSendingStateFailed) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageSendingStateFailed#982ce904 to nil") + return fmt.Errorf("can't decode messageSendingStateFailed#fb75b2af to nil") } if err := b.ConsumeID(MessageSendingStateFailedTypeID); err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#982ce904: %w", err) + return fmt.Errorf("unable to decode messageSendingStateFailed#fb75b2af: %w", err) } return m.DecodeBare(b) } @@ -343,40 +335,31 @@ func (m *MessageSendingStateFailed) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageSendingStateFailed) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageSendingStateFailed#982ce904 to nil") + return fmt.Errorf("can't decode messageSendingStateFailed#fb75b2af to nil") } { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#982ce904: field error_code: %w", err) - } - m.ErrorCode = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#982ce904: field error_message: %w", err) + if err := m.Error.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageSendingStateFailed#fb75b2af: field error: %w", err) } - m.ErrorMessage = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#982ce904: field can_retry: %w", err) + return fmt.Errorf("unable to decode messageSendingStateFailed#fb75b2af: field can_retry: %w", err) } m.CanRetry = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#982ce904: field need_another_sender: %w", err) + return fmt.Errorf("unable to decode messageSendingStateFailed#fb75b2af: field need_another_sender: %w", err) } m.NeedAnotherSender = value } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#982ce904: field retry_after: %w", err) + return fmt.Errorf("unable to decode messageSendingStateFailed#fb75b2af: field retry_after: %w", err) } m.RetryAfter = value } @@ -386,16 +369,15 @@ func (m *MessageSendingStateFailed) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (m *MessageSendingStateFailed) EncodeTDLibJSON(b tdjson.Encoder) error { if m == nil { - return fmt.Errorf("can't encode messageSendingStateFailed#982ce904 as nil") + return fmt.Errorf("can't encode messageSendingStateFailed#fb75b2af as nil") } b.ObjStart() b.PutID("messageSendingStateFailed") b.Comma() - b.FieldStart("error_code") - b.PutInt32(m.ErrorCode) - b.Comma() - b.FieldStart("error_message") - b.PutString(m.ErrorMessage) + b.FieldStart("error") + if err := m.Error.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode messageSendingStateFailed#fb75b2af: field error: %w", err) + } b.Comma() b.FieldStart("can_retry") b.PutBool(m.CanRetry) @@ -414,43 +396,35 @@ func (m *MessageSendingStateFailed) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (m *MessageSendingStateFailed) DecodeTDLibJSON(b tdjson.Decoder) error { if m == nil { - return fmt.Errorf("can't decode messageSendingStateFailed#982ce904 to nil") + return fmt.Errorf("can't decode messageSendingStateFailed#fb75b2af to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("messageSendingStateFailed"); err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#982ce904: %w", err) - } - case "error_code": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#982ce904: field error_code: %w", err) + return fmt.Errorf("unable to decode messageSendingStateFailed#fb75b2af: %w", err) } - m.ErrorCode = value - case "error_message": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#982ce904: field error_message: %w", err) + case "error": + if err := m.Error.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode messageSendingStateFailed#fb75b2af: field error: %w", err) } - m.ErrorMessage = value case "can_retry": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#982ce904: field can_retry: %w", err) + return fmt.Errorf("unable to decode messageSendingStateFailed#fb75b2af: field can_retry: %w", err) } m.CanRetry = value case "need_another_sender": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#982ce904: field need_another_sender: %w", err) + return fmt.Errorf("unable to decode messageSendingStateFailed#fb75b2af: field need_another_sender: %w", err) } m.NeedAnotherSender = value case "retry_after": value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#982ce904: field retry_after: %w", err) + return fmt.Errorf("unable to decode messageSendingStateFailed#fb75b2af: field retry_after: %w", err) } m.RetryAfter = value default: @@ -460,20 +434,12 @@ func (m *MessageSendingStateFailed) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetErrorCode returns value of ErrorCode field. -func (m *MessageSendingStateFailed) GetErrorCode() (value int32) { - if m == nil { - return - } - return m.ErrorCode -} - -// GetErrorMessage returns value of ErrorMessage field. -func (m *MessageSendingStateFailed) GetErrorMessage() (value string) { +// GetError returns value of Error field. +func (m *MessageSendingStateFailed) GetError() (value Error) { if m == nil { return } - return m.ErrorMessage + return m.Error } // GetCanRetry returns value of CanRetry field. @@ -513,7 +479,7 @@ const MessageSendingStateClassName = "MessageSendingState" // } // switch v := g.(type) { // case *tdapi.MessageSendingStatePending: // messageSendingStatePending#f32b63b4 -// case *tdapi.MessageSendingStateFailed: // messageSendingStateFailed#982ce904 +// case *tdapi.MessageSendingStateFailed: // messageSendingStateFailed#fb75b2af // default: panic(v) // } type MessageSendingStateClass interface { @@ -553,7 +519,7 @@ func DecodeMessageSendingState(buf *bin.Buffer) (MessageSendingStateClass, error } return &v, nil case MessageSendingStateFailedTypeID: - // Decoding messageSendingStateFailed#982ce904. + // Decoding messageSendingStateFailed#fb75b2af. v := MessageSendingStateFailed{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageSendingStateClass: %w", err) @@ -579,7 +545,7 @@ func DecodeTDLibJSONMessageSendingState(buf tdjson.Decoder) (MessageSendingState } return &v, nil case "messageSendingStateFailed": - // Decoding messageSendingStateFailed#982ce904. + // Decoding messageSendingStateFailed#fb75b2af. v := MessageSendingStateFailed{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageSendingStateClass: %w", err) diff --git a/tdapi/tl_premium_feature_gen.go b/tdapi/tl_premium_feature_gen.go index 713b56ae40..2107bf2942 100644 --- a/tdapi/tl_premium_feature_gen.go +++ b/tdapi/tl_premium_feature_gen.go @@ -2127,6 +2127,137 @@ func (p *PremiumFeatureUpgradedStories) DecodeTDLibJSON(b tdjson.Decoder) error }) } +// PremiumFeatureChatBoost represents TL type `premiumFeatureChatBoost#5df89f1b`. +type PremiumFeatureChatBoost struct { +} + +// PremiumFeatureChatBoostTypeID is TL type id of PremiumFeatureChatBoost. +const PremiumFeatureChatBoostTypeID = 0x5df89f1b + +// construct implements constructor of PremiumFeatureClass. +func (p PremiumFeatureChatBoost) construct() PremiumFeatureClass { return &p } + +// Ensuring interfaces in compile-time for PremiumFeatureChatBoost. +var ( + _ bin.Encoder = &PremiumFeatureChatBoost{} + _ bin.Decoder = &PremiumFeatureChatBoost{} + _ bin.BareEncoder = &PremiumFeatureChatBoost{} + _ bin.BareDecoder = &PremiumFeatureChatBoost{} + + _ PremiumFeatureClass = &PremiumFeatureChatBoost{} +) + +func (p *PremiumFeatureChatBoost) Zero() bool { + if p == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (p *PremiumFeatureChatBoost) String() string { + if p == nil { + return "PremiumFeatureChatBoost(nil)" + } + type Alias PremiumFeatureChatBoost + return fmt.Sprintf("PremiumFeatureChatBoost%+v", Alias(*p)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PremiumFeatureChatBoost) TypeID() uint32 { + return PremiumFeatureChatBoostTypeID +} + +// TypeName returns name of type in TL schema. +func (*PremiumFeatureChatBoost) TypeName() string { + return "premiumFeatureChatBoost" +} + +// TypeInfo returns info about TL type. +func (p *PremiumFeatureChatBoost) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "premiumFeatureChatBoost", + ID: PremiumFeatureChatBoostTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (p *PremiumFeatureChatBoost) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode premiumFeatureChatBoost#5df89f1b as nil") + } + b.PutID(PremiumFeatureChatBoostTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *PremiumFeatureChatBoost) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode premiumFeatureChatBoost#5df89f1b as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (p *PremiumFeatureChatBoost) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode premiumFeatureChatBoost#5df89f1b to nil") + } + if err := b.ConsumeID(PremiumFeatureChatBoostTypeID); err != nil { + return fmt.Errorf("unable to decode premiumFeatureChatBoost#5df89f1b: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *PremiumFeatureChatBoost) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode premiumFeatureChatBoost#5df89f1b to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (p *PremiumFeatureChatBoost) EncodeTDLibJSON(b tdjson.Encoder) error { + if p == nil { + return fmt.Errorf("can't encode premiumFeatureChatBoost#5df89f1b as nil") + } + b.ObjStart() + b.PutID("premiumFeatureChatBoost") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (p *PremiumFeatureChatBoost) DecodeTDLibJSON(b tdjson.Decoder) error { + if p == nil { + return fmt.Errorf("can't decode premiumFeatureChatBoost#5df89f1b to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("premiumFeatureChatBoost"); err != nil { + return fmt.Errorf("unable to decode premiumFeatureChatBoost#5df89f1b: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + // PremiumFeatureClassName is schema name of PremiumFeatureClass. const PremiumFeatureClassName = "PremiumFeature" @@ -2155,6 +2286,7 @@ const PremiumFeatureClassName = "PremiumFeature" // case *tdapi.PremiumFeatureAppIcons: // premiumFeatureAppIcons#5e79f489 // case *tdapi.PremiumFeatureRealTimeChatTranslation: // premiumFeatureRealTimeChatTranslation#bbd80280 // case *tdapi.PremiumFeatureUpgradedStories: // premiumFeatureUpgradedStories#9008051b +// case *tdapi.PremiumFeatureChatBoost: // premiumFeatureChatBoost#5df89f1b // default: panic(v) // } type PremiumFeatureClass interface { @@ -2298,6 +2430,13 @@ func DecodePremiumFeature(buf *bin.Buffer) (PremiumFeatureClass, error) { return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) } return &v, nil + case PremiumFeatureChatBoostTypeID: + // Decoding premiumFeatureChatBoost#5df89f1b. + v := PremiumFeatureChatBoost{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", bin.NewUnexpectedID(id)) } @@ -2422,6 +2561,13 @@ func DecodeTDLibJSONPremiumFeature(buf tdjson.Decoder) (PremiumFeatureClass, err return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) } return &v, nil + case "premiumFeatureChatBoost": + // Decoding premiumFeatureChatBoost#5df89f1b. + v := PremiumFeatureChatBoost{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", tdjson.NewUnexpectedID(id)) } diff --git a/tdapi/tl_premium_limit_type_gen.go b/tdapi/tl_premium_limit_type_gen.go index 142bb1b6be..caca47d6ef 100644 --- a/tdapi/tl_premium_limit_type_gen.go +++ b/tdapi/tl_premium_limit_type_gen.go @@ -2127,6 +2127,137 @@ func (p *PremiumLimitTypeStoryCaptionLength) DecodeTDLibJSON(b tdjson.Decoder) e }) } +// PremiumLimitTypeStorySuggestedReactionAreaCount represents TL type `premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807`. +type PremiumLimitTypeStorySuggestedReactionAreaCount struct { +} + +// PremiumLimitTypeStorySuggestedReactionAreaCountTypeID is TL type id of PremiumLimitTypeStorySuggestedReactionAreaCount. +const PremiumLimitTypeStorySuggestedReactionAreaCountTypeID = 0xba42b807 + +// construct implements constructor of PremiumLimitTypeClass. +func (p PremiumLimitTypeStorySuggestedReactionAreaCount) construct() PremiumLimitTypeClass { return &p } + +// Ensuring interfaces in compile-time for PremiumLimitTypeStorySuggestedReactionAreaCount. +var ( + _ bin.Encoder = &PremiumLimitTypeStorySuggestedReactionAreaCount{} + _ bin.Decoder = &PremiumLimitTypeStorySuggestedReactionAreaCount{} + _ bin.BareEncoder = &PremiumLimitTypeStorySuggestedReactionAreaCount{} + _ bin.BareDecoder = &PremiumLimitTypeStorySuggestedReactionAreaCount{} + + _ PremiumLimitTypeClass = &PremiumLimitTypeStorySuggestedReactionAreaCount{} +) + +func (p *PremiumLimitTypeStorySuggestedReactionAreaCount) Zero() bool { + if p == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (p *PremiumLimitTypeStorySuggestedReactionAreaCount) String() string { + if p == nil { + return "PremiumLimitTypeStorySuggestedReactionAreaCount(nil)" + } + type Alias PremiumLimitTypeStorySuggestedReactionAreaCount + return fmt.Sprintf("PremiumLimitTypeStorySuggestedReactionAreaCount%+v", Alias(*p)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PremiumLimitTypeStorySuggestedReactionAreaCount) TypeID() uint32 { + return PremiumLimitTypeStorySuggestedReactionAreaCountTypeID +} + +// TypeName returns name of type in TL schema. +func (*PremiumLimitTypeStorySuggestedReactionAreaCount) TypeName() string { + return "premiumLimitTypeStorySuggestedReactionAreaCount" +} + +// TypeInfo returns info about TL type. +func (p *PremiumLimitTypeStorySuggestedReactionAreaCount) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "premiumLimitTypeStorySuggestedReactionAreaCount", + ID: PremiumLimitTypeStorySuggestedReactionAreaCountTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (p *PremiumLimitTypeStorySuggestedReactionAreaCount) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807 as nil") + } + b.PutID(PremiumLimitTypeStorySuggestedReactionAreaCountTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *PremiumLimitTypeStorySuggestedReactionAreaCount) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (p *PremiumLimitTypeStorySuggestedReactionAreaCount) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807 to nil") + } + if err := b.ConsumeID(PremiumLimitTypeStorySuggestedReactionAreaCountTypeID); err != nil { + return fmt.Errorf("unable to decode premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *PremiumLimitTypeStorySuggestedReactionAreaCount) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (p *PremiumLimitTypeStorySuggestedReactionAreaCount) EncodeTDLibJSON(b tdjson.Encoder) error { + if p == nil { + return fmt.Errorf("can't encode premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807 as nil") + } + b.ObjStart() + b.PutID("premiumLimitTypeStorySuggestedReactionAreaCount") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (p *PremiumLimitTypeStorySuggestedReactionAreaCount) DecodeTDLibJSON(b tdjson.Decoder) error { + if p == nil { + return fmt.Errorf("can't decode premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("premiumLimitTypeStorySuggestedReactionAreaCount"); err != nil { + return fmt.Errorf("unable to decode premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + // PremiumLimitTypeClassName is schema name of PremiumLimitTypeClass. const PremiumLimitTypeClassName = "PremiumLimitType" @@ -2155,6 +2286,7 @@ const PremiumLimitTypeClassName = "PremiumLimitType" // case *tdapi.PremiumLimitTypeWeeklySentStoryCount: // premiumLimitTypeWeeklySentStoryCount#269c34b // case *tdapi.PremiumLimitTypeMonthlySentStoryCount: // premiumLimitTypeMonthlySentStoryCount#30d84b83 // case *tdapi.PremiumLimitTypeStoryCaptionLength: // premiumLimitTypeStoryCaptionLength#bed53302 +// case *tdapi.PremiumLimitTypeStorySuggestedReactionAreaCount: // premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807 // default: panic(v) // } type PremiumLimitTypeClass interface { @@ -2298,6 +2430,13 @@ func DecodePremiumLimitType(buf *bin.Buffer) (PremiumLimitTypeClass, error) { return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) } return &v, nil + case PremiumLimitTypeStorySuggestedReactionAreaCountTypeID: + // Decoding premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807. + v := PremiumLimitTypeStorySuggestedReactionAreaCount{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", bin.NewUnexpectedID(id)) } @@ -2422,6 +2561,13 @@ func DecodeTDLibJSONPremiumLimitType(buf tdjson.Decoder) (PremiumLimitTypeClass, return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) } return &v, nil + case "premiumLimitTypeStorySuggestedReactionAreaCount": + // Decoding premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807. + v := PremiumLimitTypeStorySuggestedReactionAreaCount{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", tdjson.NewUnexpectedID(id)) } diff --git a/tdapi/tl_registry_gen.go b/tdapi/tl_registry_gen.go index 2c231b87c2..cefe221de4 100644 --- a/tdapi/tl_registry_gen.go +++ b/tdapi/tl_registry_gen.go @@ -152,7 +152,7 @@ func TypesMap() map[uint32]string { InputChatPhotoAnimationTypeID: "inputChatPhotoAnimation#56a3422", InputChatPhotoStickerTypeID: "inputChatPhotoSticker#4e6e735d", ChatPermissionsTypeID: "chatPermissions#af3b61cb", - ChatAdministratorRightsTypeID: "chatAdministratorRights#ad77eac7", + ChatAdministratorRightsTypeID: "chatAdministratorRights#5f4f9044", PremiumPaymentOptionTypeID: "premiumPaymentOption#8c0c5fb2", PremiumStatePaymentOptionTypeID: "premiumStatePaymentOption#7d06b579", EmojiStatusTypeID: "emojiStatus#dbd91636", @@ -202,8 +202,8 @@ func TypesMap() map[uint32]string { ChatJoinRequestsInfoTypeID: "chatJoinRequestsInfo#6aff5df5", BasicGroupTypeID: "basicGroup#f464168f", BasicGroupFullInfoTypeID: "basicGroupFullInfo#d62e521e", - SupergroupTypeID: "supergroup#88a83c57", - SupergroupFullInfoTypeID: "supergroupFullInfo#8d50b2f9", + SupergroupTypeID: "supergroup#8b30b3c5", + SupergroupFullInfoTypeID: "supergroupFullInfo#f2f19203", SecretChatStatePendingTypeID: "secretChatStatePending#9e6c967c", SecretChatStateReadyTypeID: "secretChatStateReady#9ff4b7e9", SecretChatStateClosedTypeID: "secretChatStateClosed#8c1006ed", @@ -228,7 +228,7 @@ func TypesMap() map[uint32]string { MessageInteractionInfoTypeID: "messageInteractionInfo#4af275ac", UnreadReactionTypeID: "unreadReaction#8c5b3b82", MessageSendingStatePendingTypeID: "messageSendingStatePending#f32b63b4", - MessageSendingStateFailedTypeID: "messageSendingStateFailed#982ce904", + MessageSendingStateFailedTypeID: "messageSendingStateFailed#fb75b2af", MessageReplyToMessageTypeID: "messageReplyToMessage#deb02f02", MessageReplyToStoryTypeID: "messageReplyToStory#708ca939", MessageTypeID: "message#a516cc02", @@ -398,7 +398,7 @@ func TypesMap() map[uint32]string { AddressTypeID: "address#86304f3a", ThemeParametersTypeID: "themeParameters#d990fe6e", LabeledPricePartTypeID: "labeledPricePart#20f2e726", - InvoiceTypeID: "invoice#43609f28", + InvoiceTypeID: "invoice#c19b2377", OrderInfoTypeID: "orderInfo#2ebad96e", ShippingOptionTypeID: "shippingOption#731bffce", SavedCredentialsTypeID: "savedCredentials#e9ee14dc", @@ -654,10 +654,12 @@ func TypesMap() map[uint32]string { StoryAreaPositionTypeID: "storyAreaPosition#6389679", StoryAreaTypeLocationTypeID: "storyAreaTypeLocation#9ebe1186", StoryAreaTypeVenueTypeID: "storyAreaTypeVenue#18ae4d06", + StoryAreaTypeSuggestedReactionTypeID: "storyAreaTypeSuggestedReaction#f95f927c", StoryAreaTypeID: "storyArea#c9ff075e", InputStoryAreaTypeLocationTypeID: "inputStoryAreaTypeLocation#6849d762", InputStoryAreaTypeFoundVenueTypeID: "inputStoryAreaTypeFoundVenue#accda496", InputStoryAreaTypePreviousVenueTypeID: "inputStoryAreaTypePreviousVenue#6e124e0c", + InputStoryAreaTypeSuggestedReactionTypeID: "inputStoryAreaTypeSuggestedReaction#7d4751d3", InputStoryAreaTypeID: "inputStoryArea#752ae7f", InputStoryAreasTypeID: "inputStoryAreas#b8ba29fe", StoryVideoTypeID: "storyVideo#8588ba3", @@ -668,11 +670,14 @@ func TypesMap() map[uint32]string { InputStoryContentVideoTypeID: "inputStoryContentVideo#d7383f99", StoryListMainTypeID: "storyListMain#d7eeb3ff", StoryListArchiveTypeID: "storyListArchive#fd80a741", - StoryInteractionInfoTypeID: "storyInteractionInfo#e5109256", - StoryTypeID: "story#3198c7c0", + StoryInteractionInfoTypeID: "storyInteractionInfo#e1557fc7", + StoryTypeID: "story#627556b4", StoriesTypeID: "stories#5a860711", StoryInfoTypeID: "storyInfo#8997c352", ChatActiveStoriesTypeID: "chatActiveStories#d923d773", + ChatBoostStatusTypeID: "chatBoostStatus#cd6a3f87", + ChatBoostTypeID: "chatBoost#8d029d82", + FoundChatBoostsTypeID: "foundChatBoosts#dc80d52e", CallDiscardReasonEmptyTypeID: "callDiscardReasonEmpty#b4f66fc3", CallDiscardReasonMissedTypeID: "callDiscardReasonMissed#64283a7c", CallDiscardReasonDeclinedTypeID: "callDiscardReasonDeclined#98e36c32", @@ -836,6 +841,7 @@ func TypesMap() map[uint32]string { PremiumLimitTypeWeeklySentStoryCountTypeID: "premiumLimitTypeWeeklySentStoryCount#269c34b", PremiumLimitTypeMonthlySentStoryCountTypeID: "premiumLimitTypeMonthlySentStoryCount#30d84b83", PremiumLimitTypeStoryCaptionLengthTypeID: "premiumLimitTypeStoryCaptionLength#bed53302", + PremiumLimitTypeStorySuggestedReactionAreaCountTypeID: "premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807", PremiumFeatureIncreasedLimitsTypeID: "premiumFeatureIncreasedLimits#6a6be1b7", PremiumFeatureIncreasedUploadFileSizeTypeID: "premiumFeatureIncreasedUploadFileSize#6ccce473", PremiumFeatureImprovedDownloadSpeedTypeID: "premiumFeatureImprovedDownloadSpeed#f00b4a3e", @@ -852,6 +858,7 @@ func TypesMap() map[uint32]string { PremiumFeatureAppIconsTypeID: "premiumFeatureAppIcons#5e79f489", PremiumFeatureRealTimeChatTranslationTypeID: "premiumFeatureRealTimeChatTranslation#bbd80280", PremiumFeatureUpgradedStoriesTypeID: "premiumFeatureUpgradedStories#9008051b", + PremiumFeatureChatBoostTypeID: "premiumFeatureChatBoost#5df89f1b", PremiumStoryFeaturePriorityOrderTypeID: "premiumStoryFeaturePriorityOrder#8ff172c7", PremiumStoryFeatureStealthModeTypeID: "premiumStoryFeatureStealthMode#47343da4", PremiumStoryFeaturePermanentViewsHistoryTypeID: "premiumStoryFeaturePermanentViewsHistory#c2a047a0", @@ -896,9 +903,16 @@ func TypesMap() map[uint32]string { HashtagsTypeID: "hashtags#6c2c0ae1", CanSendStoryResultOkTypeID: "canSendStoryResultOk#503cf0fd", CanSendStoryResultPremiumNeededTypeID: "canSendStoryResultPremiumNeeded#567fde69", + CanSendStoryResultBoostNeededTypeID: "canSendStoryResultBoostNeeded#9e60e92f", CanSendStoryResultActiveStoryLimitExceededTypeID: "canSendStoryResultActiveStoryLimitExceeded#afd9aad6", CanSendStoryResultWeeklyLimitExceededTypeID: "canSendStoryResultWeeklyLimitExceeded#1341a0b8", CanSendStoryResultMonthlyLimitExceededTypeID: "canSendStoryResultMonthlyLimitExceeded#dd8242d5", + CanBoostChatResultOkTypeID: "canBoostChatResultOk#1da13a8b", + CanBoostChatResultInvalidChatTypeID: "canBoostChatResultInvalidChat#3d4c3668", + CanBoostChatResultAlreadyBoostedTypeID: "canBoostChatResultAlreadyBoosted#3e012a69", + CanBoostChatResultPremiumNeededTypeID: "canBoostChatResultPremiumNeeded#d4b4e4f", + CanBoostChatResultPremiumSubscriptionNeededTypeID: "canBoostChatResultPremiumSubscriptionNeeded#7550d3cc", + CanBoostChatResultWaitNeededTypeID: "canBoostChatResultWaitNeeded#343aaeaa", CanTransferOwnershipResultOkTypeID: "canTransferOwnershipResultOk#faa48643", CanTransferOwnershipResultPasswordNeededTypeID: "canTransferOwnershipResultPasswordNeeded#5c4a4adf", CanTransferOwnershipResultPasswordTooFreshTypeID: "canTransferOwnershipResultPasswordTooFresh#305d9b11", @@ -1041,6 +1055,7 @@ func TypesMap() map[uint32]string { InternalLinkTypeBotStartTypeID: "internalLinkTypeBotStart#3f985fed", InternalLinkTypeBotStartInGroupTypeID: "internalLinkTypeBotStartInGroup#ca0d8cce", InternalLinkTypeChangePhoneNumberTypeID: "internalLinkTypeChangePhoneNumber#f0275b01", + InternalLinkTypeChatBoostTypeID: "internalLinkTypeChatBoost#d549fd40", InternalLinkTypeChatFolderInviteTypeID: "internalLinkTypeChatFolderInvite#89b2493e", InternalLinkTypeChatFolderSettingsTypeID: "internalLinkTypeChatFolderSettings#bfff055c", InternalLinkTypeChatInviteTypeID: "internalLinkTypeChatInvite#198c3cd9", @@ -1075,6 +1090,8 @@ func TypesMap() map[uint32]string { InternalLinkTypeWebAppTypeID: "internalLinkTypeWebApp#fc98d04f", MessageLinkTypeID: "messageLink#af4a3aa6", MessageLinkInfoTypeID: "messageLinkInfo#2b96fb50", + ChatBoostLinkTypeID: "chatBoostLink#b5417c71", + ChatBoostLinkInfoTypeID: "chatBoostLinkInfo#dc123884", BlockListMainTypeID: "blockListMain#50a4137c", BlockListStoriesTypeID: "blockListStories#628965c", FilePartTypeID: "filePart#36594c36", @@ -1186,7 +1203,7 @@ func TypesMap() map[uint32]string { UpdateNewMessageTypeID: "updateNewMessage#de6fb20e", UpdateMessageSendAcknowledgedTypeID: "updateMessageSendAcknowledged#4da7d239", UpdateMessageSendSucceededTypeID: "updateMessageSendSucceeded#6c399d7d", - UpdateMessageSendFailedTypeID: "updateMessageSendFailed#c277ce5d", + UpdateMessageSendFailedTypeID: "updateMessageSendFailed#da1bf8e7", UpdateMessageContentTypeID: "updateMessageContent#1e36bb24", UpdateMessageEditedTypeID: "updateMessageEdited#dea602e6", UpdateMessageIsPinnedTypeID: "updateMessageIsPinned#41bc233d", @@ -1258,7 +1275,7 @@ func TypesMap() map[uint32]string { UpdateStoryTypeID: "updateStory#1906572f", UpdateStoryDeletedTypeID: "updateStoryDeleted#7007eb9d", UpdateStorySendSucceededTypeID: "updateStorySendSucceeded#b9269e57", - UpdateStorySendFailedTypeID: "updateStorySendFailed#4418bca2", + UpdateStorySendFailedTypeID: "updateStorySendFailed#e046f199", UpdateChatActiveStoriesTypeID: "updateChatActiveStories#79786c2c", UpdateStoryListChatCountTypeID: "updateStoryListChatCount#8833cd3f", UpdateStoryStealthModeTypeID: "updateStoryStealthMode#6ff7bd1a", @@ -1590,18 +1607,19 @@ func TypesMap() map[uint32]string { SetPinnedChatsRequestTypeID: "setPinnedChats#c6c6edf1", ReadChatListRequestTypeID: "readChatList#bd6498aa", GetStoryRequestTypeID: "getStory#717b1c78", - CanSendStoryRequestTypeID: "canSendStory#ede53a66", - SendStoryRequestTypeID: "sendStory#40b9f838", - EditStoryRequestTypeID: "editStory#aa2c3e86", - SetStoryPrivacySettingsRequestTypeID: "setStoryPrivacySettings#d8e94332", - ToggleStoryIsPinnedRequestTypeID: "toggleStoryIsPinned#df8031f9", - DeleteStoryRequestTypeID: "deleteStory#62332a06", + GetChatsToSendStoriesRequestTypeID: "getChatsToSendStories#22f9e3a4", + CanSendStoryRequestTypeID: "canSendStory#b6e0216b", + SendStoryRequestTypeID: "sendStory#53242a4", + EditStoryRequestTypeID: "editStory#5e6a21b1", + SetStoryPrivacySettingsRequestTypeID: "setStoryPrivacySettings#1b6c5434", + ToggleStoryIsPinnedRequestTypeID: "toggleStoryIsPinned#b493b30e", + DeleteStoryRequestTypeID: "deleteStory#9f35af16", GetStoryNotificationSettingsExceptionsRequestTypeID: "getStoryNotificationSettingsExceptions#256a2eb0", LoadActiveStoriesRequestTypeID: "loadActiveStories#7d8cf738", SetChatActiveStoriesListRequestTypeID: "setChatActiveStoriesList#e0e35d11", GetChatActiveStoriesRequestTypeID: "getChatActiveStories#2e4ffbf5", GetChatPinnedStoriesRequestTypeID: "getChatPinnedStories#53c82a1", - GetArchivedStoriesRequestTypeID: "getArchivedStories#6a864fe7", + GetChatArchivedStoriesRequestTypeID: "getChatArchivedStories#af1e9488", OpenStoryRequestTypeID: "openStory#ceda7c7d", CloseStoryRequestTypeID: "closeStory#443d0f55", GetStoryAvailableReactionsRequestTypeID: "getStoryAvailableReactions#23854d3b", @@ -1609,6 +1627,12 @@ func TypesMap() map[uint32]string { GetStoryViewersRequestTypeID: "getStoryViewers#40df8dba", ReportStoryRequestTypeID: "reportStory#9b5f709b", ActivateStoryStealthModeRequestTypeID: "activateStoryStealthMode#c3db8491", + GetChatBoostStatusRequestTypeID: "getChatBoostStatus#cfac8acf", + CanBoostChatRequestTypeID: "canBoostChat#836e6e58", + BoostChatRequestTypeID: "boostChat#4e314c2d", + GetChatBoostLinkRequestTypeID: "getChatBoostLink#56f16c85", + GetChatBoostLinkInfoRequestTypeID: "getChatBoostLinkInfo#26fc4b5c", + GetChatBoostsRequestTypeID: "getChatBoosts#d82a288e", GetAttachmentMenuBotRequestTypeID: "getAttachmentMenuBot#3da561fb", ToggleBotIsAddedToAttachmentMenuRequestTypeID: "toggleBotIsAddedToAttachmentMenu#8e59de9a", GetThemedEmojiStatusesRequestTypeID: "getThemedEmojiStatuses#6ac5c8c2", @@ -2577,10 +2601,12 @@ func NamesMap() map[string]uint32 { "storyAreaPosition": StoryAreaPositionTypeID, "storyAreaTypeLocation": StoryAreaTypeLocationTypeID, "storyAreaTypeVenue": StoryAreaTypeVenueTypeID, + "storyAreaTypeSuggestedReaction": StoryAreaTypeSuggestedReactionTypeID, "storyArea": StoryAreaTypeID, "inputStoryAreaTypeLocation": InputStoryAreaTypeLocationTypeID, "inputStoryAreaTypeFoundVenue": InputStoryAreaTypeFoundVenueTypeID, "inputStoryAreaTypePreviousVenue": InputStoryAreaTypePreviousVenueTypeID, + "inputStoryAreaTypeSuggestedReaction": InputStoryAreaTypeSuggestedReactionTypeID, "inputStoryArea": InputStoryAreaTypeID, "inputStoryAreas": InputStoryAreasTypeID, "storyVideo": StoryVideoTypeID, @@ -2596,6 +2622,9 @@ func NamesMap() map[string]uint32 { "stories": StoriesTypeID, "storyInfo": StoryInfoTypeID, "chatActiveStories": ChatActiveStoriesTypeID, + "chatBoostStatus": ChatBoostStatusTypeID, + "chatBoost": ChatBoostTypeID, + "foundChatBoosts": FoundChatBoostsTypeID, "callDiscardReasonEmpty": CallDiscardReasonEmptyTypeID, "callDiscardReasonMissed": CallDiscardReasonMissedTypeID, "callDiscardReasonDeclined": CallDiscardReasonDeclinedTypeID, @@ -2759,6 +2788,7 @@ func NamesMap() map[string]uint32 { "premiumLimitTypeWeeklySentStoryCount": PremiumLimitTypeWeeklySentStoryCountTypeID, "premiumLimitTypeMonthlySentStoryCount": PremiumLimitTypeMonthlySentStoryCountTypeID, "premiumLimitTypeStoryCaptionLength": PremiumLimitTypeStoryCaptionLengthTypeID, + "premiumLimitTypeStorySuggestedReactionAreaCount": PremiumLimitTypeStorySuggestedReactionAreaCountTypeID, "premiumFeatureIncreasedLimits": PremiumFeatureIncreasedLimitsTypeID, "premiumFeatureIncreasedUploadFileSize": PremiumFeatureIncreasedUploadFileSizeTypeID, "premiumFeatureImprovedDownloadSpeed": PremiumFeatureImprovedDownloadSpeedTypeID, @@ -2775,6 +2805,7 @@ func NamesMap() map[string]uint32 { "premiumFeatureAppIcons": PremiumFeatureAppIconsTypeID, "premiumFeatureRealTimeChatTranslation": PremiumFeatureRealTimeChatTranslationTypeID, "premiumFeatureUpgradedStories": PremiumFeatureUpgradedStoriesTypeID, + "premiumFeatureChatBoost": PremiumFeatureChatBoostTypeID, "premiumStoryFeaturePriorityOrder": PremiumStoryFeaturePriorityOrderTypeID, "premiumStoryFeatureStealthMode": PremiumStoryFeatureStealthModeTypeID, "premiumStoryFeaturePermanentViewsHistory": PremiumStoryFeaturePermanentViewsHistoryTypeID, @@ -2819,9 +2850,16 @@ func NamesMap() map[string]uint32 { "hashtags": HashtagsTypeID, "canSendStoryResultOk": CanSendStoryResultOkTypeID, "canSendStoryResultPremiumNeeded": CanSendStoryResultPremiumNeededTypeID, + "canSendStoryResultBoostNeeded": CanSendStoryResultBoostNeededTypeID, "canSendStoryResultActiveStoryLimitExceeded": CanSendStoryResultActiveStoryLimitExceededTypeID, "canSendStoryResultWeeklyLimitExceeded": CanSendStoryResultWeeklyLimitExceededTypeID, "canSendStoryResultMonthlyLimitExceeded": CanSendStoryResultMonthlyLimitExceededTypeID, + "canBoostChatResultOk": CanBoostChatResultOkTypeID, + "canBoostChatResultInvalidChat": CanBoostChatResultInvalidChatTypeID, + "canBoostChatResultAlreadyBoosted": CanBoostChatResultAlreadyBoostedTypeID, + "canBoostChatResultPremiumNeeded": CanBoostChatResultPremiumNeededTypeID, + "canBoostChatResultPremiumSubscriptionNeeded": CanBoostChatResultPremiumSubscriptionNeededTypeID, + "canBoostChatResultWaitNeeded": CanBoostChatResultWaitNeededTypeID, "canTransferOwnershipResultOk": CanTransferOwnershipResultOkTypeID, "canTransferOwnershipResultPasswordNeeded": CanTransferOwnershipResultPasswordNeededTypeID, "canTransferOwnershipResultPasswordTooFresh": CanTransferOwnershipResultPasswordTooFreshTypeID, @@ -2964,6 +3002,7 @@ func NamesMap() map[string]uint32 { "internalLinkTypeBotStart": InternalLinkTypeBotStartTypeID, "internalLinkTypeBotStartInGroup": InternalLinkTypeBotStartInGroupTypeID, "internalLinkTypeChangePhoneNumber": InternalLinkTypeChangePhoneNumberTypeID, + "internalLinkTypeChatBoost": InternalLinkTypeChatBoostTypeID, "internalLinkTypeChatFolderInvite": InternalLinkTypeChatFolderInviteTypeID, "internalLinkTypeChatFolderSettings": InternalLinkTypeChatFolderSettingsTypeID, "internalLinkTypeChatInvite": InternalLinkTypeChatInviteTypeID, @@ -2998,6 +3037,8 @@ func NamesMap() map[string]uint32 { "internalLinkTypeWebApp": InternalLinkTypeWebAppTypeID, "messageLink": MessageLinkTypeID, "messageLinkInfo": MessageLinkInfoTypeID, + "chatBoostLink": ChatBoostLinkTypeID, + "chatBoostLinkInfo": ChatBoostLinkInfoTypeID, "blockListMain": BlockListMainTypeID, "blockListStories": BlockListStoriesTypeID, "filePart": FilePartTypeID, @@ -3513,6 +3554,7 @@ func NamesMap() map[string]uint32 { "setPinnedChats": SetPinnedChatsRequestTypeID, "readChatList": ReadChatListRequestTypeID, "getStory": GetStoryRequestTypeID, + "getChatsToSendStories": GetChatsToSendStoriesRequestTypeID, "canSendStory": CanSendStoryRequestTypeID, "sendStory": SendStoryRequestTypeID, "editStory": EditStoryRequestTypeID, @@ -3524,7 +3566,7 @@ func NamesMap() map[string]uint32 { "setChatActiveStoriesList": SetChatActiveStoriesListRequestTypeID, "getChatActiveStories": GetChatActiveStoriesRequestTypeID, "getChatPinnedStories": GetChatPinnedStoriesRequestTypeID, - "getArchivedStories": GetArchivedStoriesRequestTypeID, + "getChatArchivedStories": GetChatArchivedStoriesRequestTypeID, "openStory": OpenStoryRequestTypeID, "closeStory": CloseStoryRequestTypeID, "getStoryAvailableReactions": GetStoryAvailableReactionsRequestTypeID, @@ -3532,6 +3574,12 @@ func NamesMap() map[string]uint32 { "getStoryViewers": GetStoryViewersRequestTypeID, "reportStory": ReportStoryRequestTypeID, "activateStoryStealthMode": ActivateStoryStealthModeRequestTypeID, + "getChatBoostStatus": GetChatBoostStatusRequestTypeID, + "canBoostChat": CanBoostChatRequestTypeID, + "boostChat": BoostChatRequestTypeID, + "getChatBoostLink": GetChatBoostLinkRequestTypeID, + "getChatBoostLinkInfo": GetChatBoostLinkInfoRequestTypeID, + "getChatBoosts": GetChatBoostsRequestTypeID, "getAttachmentMenuBot": GetAttachmentMenuBotRequestTypeID, "toggleBotIsAddedToAttachmentMenu": ToggleBotIsAddedToAttachmentMenuRequestTypeID, "getThemedEmojiStatuses": GetThemedEmojiStatusesRequestTypeID, @@ -4500,10 +4548,12 @@ func TypesConstructorMap() map[uint32]func() bin.Object { StoryAreaPositionTypeID: func() bin.Object { return &StoryAreaPosition{} }, StoryAreaTypeLocationTypeID: func() bin.Object { return &StoryAreaTypeLocation{} }, StoryAreaTypeVenueTypeID: func() bin.Object { return &StoryAreaTypeVenue{} }, + StoryAreaTypeSuggestedReactionTypeID: func() bin.Object { return &StoryAreaTypeSuggestedReaction{} }, StoryAreaTypeID: func() bin.Object { return &StoryArea{} }, InputStoryAreaTypeLocationTypeID: func() bin.Object { return &InputStoryAreaTypeLocation{} }, InputStoryAreaTypeFoundVenueTypeID: func() bin.Object { return &InputStoryAreaTypeFoundVenue{} }, InputStoryAreaTypePreviousVenueTypeID: func() bin.Object { return &InputStoryAreaTypePreviousVenue{} }, + InputStoryAreaTypeSuggestedReactionTypeID: func() bin.Object { return &InputStoryAreaTypeSuggestedReaction{} }, InputStoryAreaTypeID: func() bin.Object { return &InputStoryArea{} }, InputStoryAreasTypeID: func() bin.Object { return &InputStoryAreas{} }, StoryVideoTypeID: func() bin.Object { return &StoryVideo{} }, @@ -4519,6 +4569,9 @@ func TypesConstructorMap() map[uint32]func() bin.Object { StoriesTypeID: func() bin.Object { return &Stories{} }, StoryInfoTypeID: func() bin.Object { return &StoryInfo{} }, ChatActiveStoriesTypeID: func() bin.Object { return &ChatActiveStories{} }, + ChatBoostStatusTypeID: func() bin.Object { return &ChatBoostStatus{} }, + ChatBoostTypeID: func() bin.Object { return &ChatBoost{} }, + FoundChatBoostsTypeID: func() bin.Object { return &FoundChatBoosts{} }, CallDiscardReasonEmptyTypeID: func() bin.Object { return &CallDiscardReasonEmpty{} }, CallDiscardReasonMissedTypeID: func() bin.Object { return &CallDiscardReasonMissed{} }, CallDiscardReasonDeclinedTypeID: func() bin.Object { return &CallDiscardReasonDeclined{} }, @@ -4682,6 +4735,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PremiumLimitTypeWeeklySentStoryCountTypeID: func() bin.Object { return &PremiumLimitTypeWeeklySentStoryCount{} }, PremiumLimitTypeMonthlySentStoryCountTypeID: func() bin.Object { return &PremiumLimitTypeMonthlySentStoryCount{} }, PremiumLimitTypeStoryCaptionLengthTypeID: func() bin.Object { return &PremiumLimitTypeStoryCaptionLength{} }, + PremiumLimitTypeStorySuggestedReactionAreaCountTypeID: func() bin.Object { return &PremiumLimitTypeStorySuggestedReactionAreaCount{} }, PremiumFeatureIncreasedLimitsTypeID: func() bin.Object { return &PremiumFeatureIncreasedLimits{} }, PremiumFeatureIncreasedUploadFileSizeTypeID: func() bin.Object { return &PremiumFeatureIncreasedUploadFileSize{} }, PremiumFeatureImprovedDownloadSpeedTypeID: func() bin.Object { return &PremiumFeatureImprovedDownloadSpeed{} }, @@ -4698,6 +4752,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PremiumFeatureAppIconsTypeID: func() bin.Object { return &PremiumFeatureAppIcons{} }, PremiumFeatureRealTimeChatTranslationTypeID: func() bin.Object { return &PremiumFeatureRealTimeChatTranslation{} }, PremiumFeatureUpgradedStoriesTypeID: func() bin.Object { return &PremiumFeatureUpgradedStories{} }, + PremiumFeatureChatBoostTypeID: func() bin.Object { return &PremiumFeatureChatBoost{} }, PremiumStoryFeaturePriorityOrderTypeID: func() bin.Object { return &PremiumStoryFeaturePriorityOrder{} }, PremiumStoryFeatureStealthModeTypeID: func() bin.Object { return &PremiumStoryFeatureStealthMode{} }, PremiumStoryFeaturePermanentViewsHistoryTypeID: func() bin.Object { return &PremiumStoryFeaturePermanentViewsHistory{} }, @@ -4742,9 +4797,16 @@ func TypesConstructorMap() map[uint32]func() bin.Object { HashtagsTypeID: func() bin.Object { return &Hashtags{} }, CanSendStoryResultOkTypeID: func() bin.Object { return &CanSendStoryResultOk{} }, CanSendStoryResultPremiumNeededTypeID: func() bin.Object { return &CanSendStoryResultPremiumNeeded{} }, + CanSendStoryResultBoostNeededTypeID: func() bin.Object { return &CanSendStoryResultBoostNeeded{} }, CanSendStoryResultActiveStoryLimitExceededTypeID: func() bin.Object { return &CanSendStoryResultActiveStoryLimitExceeded{} }, CanSendStoryResultWeeklyLimitExceededTypeID: func() bin.Object { return &CanSendStoryResultWeeklyLimitExceeded{} }, CanSendStoryResultMonthlyLimitExceededTypeID: func() bin.Object { return &CanSendStoryResultMonthlyLimitExceeded{} }, + CanBoostChatResultOkTypeID: func() bin.Object { return &CanBoostChatResultOk{} }, + CanBoostChatResultInvalidChatTypeID: func() bin.Object { return &CanBoostChatResultInvalidChat{} }, + CanBoostChatResultAlreadyBoostedTypeID: func() bin.Object { return &CanBoostChatResultAlreadyBoosted{} }, + CanBoostChatResultPremiumNeededTypeID: func() bin.Object { return &CanBoostChatResultPremiumNeeded{} }, + CanBoostChatResultPremiumSubscriptionNeededTypeID: func() bin.Object { return &CanBoostChatResultPremiumSubscriptionNeeded{} }, + CanBoostChatResultWaitNeededTypeID: func() bin.Object { return &CanBoostChatResultWaitNeeded{} }, CanTransferOwnershipResultOkTypeID: func() bin.Object { return &CanTransferOwnershipResultOk{} }, CanTransferOwnershipResultPasswordNeededTypeID: func() bin.Object { return &CanTransferOwnershipResultPasswordNeeded{} }, CanTransferOwnershipResultPasswordTooFreshTypeID: func() bin.Object { return &CanTransferOwnershipResultPasswordTooFresh{} }, @@ -4887,6 +4949,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { InternalLinkTypeBotStartTypeID: func() bin.Object { return &InternalLinkTypeBotStart{} }, InternalLinkTypeBotStartInGroupTypeID: func() bin.Object { return &InternalLinkTypeBotStartInGroup{} }, InternalLinkTypeChangePhoneNumberTypeID: func() bin.Object { return &InternalLinkTypeChangePhoneNumber{} }, + InternalLinkTypeChatBoostTypeID: func() bin.Object { return &InternalLinkTypeChatBoost{} }, InternalLinkTypeChatFolderInviteTypeID: func() bin.Object { return &InternalLinkTypeChatFolderInvite{} }, InternalLinkTypeChatFolderSettingsTypeID: func() bin.Object { return &InternalLinkTypeChatFolderSettings{} }, InternalLinkTypeChatInviteTypeID: func() bin.Object { return &InternalLinkTypeChatInvite{} }, @@ -4921,6 +4984,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { InternalLinkTypeWebAppTypeID: func() bin.Object { return &InternalLinkTypeWebApp{} }, MessageLinkTypeID: func() bin.Object { return &MessageLink{} }, MessageLinkInfoTypeID: func() bin.Object { return &MessageLinkInfo{} }, + ChatBoostLinkTypeID: func() bin.Object { return &ChatBoostLink{} }, + ChatBoostLinkInfoTypeID: func() bin.Object { return &ChatBoostLinkInfo{} }, BlockListMainTypeID: func() bin.Object { return &BlockListMain{} }, BlockListStoriesTypeID: func() bin.Object { return &BlockListStories{} }, FilePartTypeID: func() bin.Object { return &FilePart{} }, @@ -5436,6 +5501,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { SetPinnedChatsRequestTypeID: func() bin.Object { return &SetPinnedChatsRequest{} }, ReadChatListRequestTypeID: func() bin.Object { return &ReadChatListRequest{} }, GetStoryRequestTypeID: func() bin.Object { return &GetStoryRequest{} }, + GetChatsToSendStoriesRequestTypeID: func() bin.Object { return &GetChatsToSendStoriesRequest{} }, CanSendStoryRequestTypeID: func() bin.Object { return &CanSendStoryRequest{} }, SendStoryRequestTypeID: func() bin.Object { return &SendStoryRequest{} }, EditStoryRequestTypeID: func() bin.Object { return &EditStoryRequest{} }, @@ -5447,7 +5513,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { SetChatActiveStoriesListRequestTypeID: func() bin.Object { return &SetChatActiveStoriesListRequest{} }, GetChatActiveStoriesRequestTypeID: func() bin.Object { return &GetChatActiveStoriesRequest{} }, GetChatPinnedStoriesRequestTypeID: func() bin.Object { return &GetChatPinnedStoriesRequest{} }, - GetArchivedStoriesRequestTypeID: func() bin.Object { return &GetArchivedStoriesRequest{} }, + GetChatArchivedStoriesRequestTypeID: func() bin.Object { return &GetChatArchivedStoriesRequest{} }, OpenStoryRequestTypeID: func() bin.Object { return &OpenStoryRequest{} }, CloseStoryRequestTypeID: func() bin.Object { return &CloseStoryRequest{} }, GetStoryAvailableReactionsRequestTypeID: func() bin.Object { return &GetStoryAvailableReactionsRequest{} }, @@ -5455,6 +5521,12 @@ func TypesConstructorMap() map[uint32]func() bin.Object { GetStoryViewersRequestTypeID: func() bin.Object { return &GetStoryViewersRequest{} }, ReportStoryRequestTypeID: func() bin.Object { return &ReportStoryRequest{} }, ActivateStoryStealthModeRequestTypeID: func() bin.Object { return &ActivateStoryStealthModeRequest{} }, + GetChatBoostStatusRequestTypeID: func() bin.Object { return &GetChatBoostStatusRequest{} }, + CanBoostChatRequestTypeID: func() bin.Object { return &CanBoostChatRequest{} }, + BoostChatRequestTypeID: func() bin.Object { return &BoostChatRequest{} }, + GetChatBoostLinkRequestTypeID: func() bin.Object { return &GetChatBoostLinkRequest{} }, + GetChatBoostLinkInfoRequestTypeID: func() bin.Object { return &GetChatBoostLinkInfoRequest{} }, + GetChatBoostsRequestTypeID: func() bin.Object { return &GetChatBoostsRequest{} }, GetAttachmentMenuBotRequestTypeID: func() bin.Object { return &GetAttachmentMenuBotRequest{} }, ToggleBotIsAddedToAttachmentMenuRequestTypeID: func() bin.Object { return &ToggleBotIsAddedToAttachmentMenuRequest{} }, GetThemedEmojiStatusesRequestTypeID: func() bin.Object { return &GetThemedEmojiStatusesRequest{} }, @@ -5895,9 +5967,18 @@ func ClassConstructorsMap() map[string][]uint32 { CallbackQueryPayloadDataWithPasswordTypeID, CallbackQueryPayloadGameTypeID, }, + CanBoostChatResultClassName: { + CanBoostChatResultOkTypeID, + CanBoostChatResultInvalidChatTypeID, + CanBoostChatResultAlreadyBoostedTypeID, + CanBoostChatResultPremiumNeededTypeID, + CanBoostChatResultPremiumSubscriptionNeededTypeID, + CanBoostChatResultWaitNeededTypeID, + }, CanSendStoryResultClassName: { CanSendStoryResultOkTypeID, CanSendStoryResultPremiumNeededTypeID, + CanSendStoryResultBoostNeededTypeID, CanSendStoryResultActiveStoryLimitExceededTypeID, CanSendStoryResultWeeklyLimitExceededTypeID, CanSendStoryResultMonthlyLimitExceededTypeID, @@ -6226,6 +6307,7 @@ func ClassConstructorsMap() map[string][]uint32 { InputStoryAreaTypeLocationTypeID, InputStoryAreaTypeFoundVenueTypeID, InputStoryAreaTypePreviousVenueTypeID, + InputStoryAreaTypeSuggestedReactionTypeID, }, InputStoryContentClassName: { InputStoryContentPhotoTypeID, @@ -6240,6 +6322,7 @@ func ClassConstructorsMap() map[string][]uint32 { InternalLinkTypeBotStartTypeID, InternalLinkTypeBotStartInGroupTypeID, InternalLinkTypeChangePhoneNumberTypeID, + InternalLinkTypeChatBoostTypeID, InternalLinkTypeChatFolderInviteTypeID, InternalLinkTypeChatFolderSettingsTypeID, InternalLinkTypeChatInviteTypeID, @@ -6577,6 +6660,7 @@ func ClassConstructorsMap() map[string][]uint32 { PremiumFeatureAppIconsTypeID, PremiumFeatureRealTimeChatTranslationTypeID, PremiumFeatureUpgradedStoriesTypeID, + PremiumFeatureChatBoostTypeID, }, PremiumLimitTypeClassName: { PremiumLimitTypeSupergroupCountTypeID, @@ -6595,6 +6679,7 @@ func ClassConstructorsMap() map[string][]uint32 { PremiumLimitTypeWeeklySentStoryCountTypeID, PremiumLimitTypeMonthlySentStoryCountTypeID, PremiumLimitTypeStoryCaptionLengthTypeID, + PremiumLimitTypeStorySuggestedReactionAreaCountTypeID, }, PremiumSourceClassName: { PremiumSourceLimitExceededTypeID, @@ -6775,6 +6860,7 @@ func ClassConstructorsMap() map[string][]uint32 { StoryAreaTypeClassName: { StoryAreaTypeLocationTypeID, StoryAreaTypeVenueTypeID, + StoryAreaTypeSuggestedReactionTypeID, }, StoryContentClassName: { StoryContentPhotoTypeID, diff --git a/tdapi/tl_send_story_gen.go b/tdapi/tl_send_story_gen.go index 006f68d5e7..be97b98e8c 100644 --- a/tdapi/tl_send_story_gen.go +++ b/tdapi/tl_send_story_gen.go @@ -31,8 +31,10 @@ var ( _ = tdjson.Encoder{} ) -// SendStoryRequest represents TL type `sendStory#40b9f838`. +// SendStoryRequest represents TL type `sendStory#53242a4`. type SendStoryRequest struct { + // Identifier of the chat that will post the story + ChatID int64 // Content of the story Content InputStoryContentClass // Clickable rectangle areas to be shown on the story media; pass null if none @@ -53,7 +55,7 @@ type SendStoryRequest struct { } // SendStoryRequestTypeID is TL type id of SendStoryRequest. -const SendStoryRequestTypeID = 0x40b9f838 +const SendStoryRequestTypeID = 0x53242a4 // Ensuring interfaces in compile-time for SendStoryRequest. var ( @@ -67,6 +69,9 @@ func (s *SendStoryRequest) Zero() bool { if s == nil { return true } + if !(s.ChatID == 0) { + return false + } if !(s.Content == nil) { return false } @@ -124,6 +129,10 @@ func (s *SendStoryRequest) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, { Name: "Content", SchemaName: "content", @@ -159,7 +168,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#40b9f838 as nil") + return fmt.Errorf("can't encode sendStory#53242a4 as nil") } b.PutID(SendStoryRequestTypeID) return s.EncodeBare(b) @@ -168,25 +177,26 @@ 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#40b9f838 as nil") + return fmt.Errorf("can't encode sendStory#53242a4 as nil") } + b.PutInt53(s.ChatID) if s.Content == nil { - return fmt.Errorf("unable to encode sendStory#40b9f838: field content is nil") + return fmt.Errorf("unable to encode sendStory#53242a4: field content is nil") } if err := s.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendStory#40b9f838: field content: %w", err) + return fmt.Errorf("unable to encode sendStory#53242a4: field content: %w", err) } if err := s.Areas.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendStory#40b9f838: field areas: %w", err) + return fmt.Errorf("unable to encode sendStory#53242a4: field areas: %w", err) } if err := s.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendStory#40b9f838: field caption: %w", err) + return fmt.Errorf("unable to encode sendStory#53242a4: field caption: %w", err) } if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode sendStory#40b9f838: field privacy_settings is nil") + return fmt.Errorf("unable to encode sendStory#53242a4: field privacy_settings is nil") } if err := s.PrivacySettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendStory#40b9f838: field privacy_settings: %w", err) + return fmt.Errorf("unable to encode sendStory#53242a4: field privacy_settings: %w", err) } b.PutInt32(s.ActivePeriod) b.PutBool(s.IsPinned) @@ -197,10 +207,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#40b9f838 to nil") + return fmt.Errorf("can't decode sendStory#53242a4 to nil") } if err := b.ConsumeID(SendStoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendStory#40b9f838: %w", err) + return fmt.Errorf("unable to decode sendStory#53242a4: %w", err) } return s.DecodeBare(b) } @@ -208,50 +218,57 @@ 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#40b9f838 to nil") + return fmt.Errorf("can't decode sendStory#53242a4 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode sendStory#53242a4: field chat_id: %w", err) + } + s.ChatID = value } { value, err := DecodeInputStoryContent(b) if err != nil { - return fmt.Errorf("unable to decode sendStory#40b9f838: field content: %w", err) + return fmt.Errorf("unable to decode sendStory#53242a4: field content: %w", err) } s.Content = value } { if err := s.Areas.Decode(b); err != nil { - return fmt.Errorf("unable to decode sendStory#40b9f838: field areas: %w", err) + return fmt.Errorf("unable to decode sendStory#53242a4: field areas: %w", err) } } { if err := s.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode sendStory#40b9f838: field caption: %w", err) + return fmt.Errorf("unable to decode sendStory#53242a4: field caption: %w", err) } } { value, err := DecodeStoryPrivacySettings(b) if err != nil { - return fmt.Errorf("unable to decode sendStory#40b9f838: field privacy_settings: %w", err) + return fmt.Errorf("unable to decode sendStory#53242a4: field privacy_settings: %w", err) } s.PrivacySettings = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode sendStory#40b9f838: field active_period: %w", err) + return fmt.Errorf("unable to decode sendStory#53242a4: field active_period: %w", err) } s.ActivePeriod = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode sendStory#40b9f838: field is_pinned: %w", err) + return fmt.Errorf("unable to decode sendStory#53242a4: field is_pinned: %w", err) } s.IsPinned = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode sendStory#40b9f838: field protect_content: %w", err) + return fmt.Errorf("unable to decode sendStory#53242a4: field protect_content: %w", err) } s.ProtectContent = value } @@ -261,35 +278,38 @@ 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#40b9f838 as nil") + return fmt.Errorf("can't encode sendStory#53242a4 as nil") } b.ObjStart() b.PutID("sendStory") b.Comma() + b.FieldStart("chat_id") + b.PutInt53(s.ChatID) + b.Comma() b.FieldStart("content") if s.Content == nil { - return fmt.Errorf("unable to encode sendStory#40b9f838: field content is nil") + return fmt.Errorf("unable to encode sendStory#53242a4: field content is nil") } if err := s.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendStory#40b9f838: field content: %w", err) + return fmt.Errorf("unable to encode sendStory#53242a4: field content: %w", err) } b.Comma() b.FieldStart("areas") if err := s.Areas.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendStory#40b9f838: field areas: %w", err) + return fmt.Errorf("unable to encode sendStory#53242a4: field areas: %w", err) } b.Comma() b.FieldStart("caption") if err := s.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendStory#40b9f838: field caption: %w", err) + return fmt.Errorf("unable to encode sendStory#53242a4: field caption: %w", err) } b.Comma() b.FieldStart("privacy_settings") if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode sendStory#40b9f838: field privacy_settings is nil") + return fmt.Errorf("unable to encode sendStory#53242a4: field privacy_settings is nil") } if err := s.PrivacySettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendStory#40b9f838: field privacy_settings: %w", err) + return fmt.Errorf("unable to encode sendStory#53242a4: field privacy_settings: %w", err) } b.Comma() b.FieldStart("active_period") @@ -309,51 +329,57 @@ 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#40b9f838 to nil") + return fmt.Errorf("can't decode sendStory#53242a4 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#40b9f838: %w", err) + return fmt.Errorf("unable to decode sendStory#53242a4: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode sendStory#53242a4: field chat_id: %w", err) } + s.ChatID = value case "content": value, err := DecodeTDLibJSONInputStoryContent(b) if err != nil { - return fmt.Errorf("unable to decode sendStory#40b9f838: field content: %w", err) + return fmt.Errorf("unable to decode sendStory#53242a4: field content: %w", err) } s.Content = value case "areas": if err := s.Areas.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sendStory#40b9f838: field areas: %w", err) + return fmt.Errorf("unable to decode sendStory#53242a4: field areas: %w", err) } case "caption": if err := s.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sendStory#40b9f838: field caption: %w", err) + return fmt.Errorf("unable to decode sendStory#53242a4: field caption: %w", err) } case "privacy_settings": value, err := DecodeTDLibJSONStoryPrivacySettings(b) if err != nil { - return fmt.Errorf("unable to decode sendStory#40b9f838: field privacy_settings: %w", err) + return fmt.Errorf("unable to decode sendStory#53242a4: 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#40b9f838: field active_period: %w", err) + return fmt.Errorf("unable to decode sendStory#53242a4: field active_period: %w", err) } s.ActivePeriod = value case "is_pinned": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode sendStory#40b9f838: field is_pinned: %w", err) + return fmt.Errorf("unable to decode sendStory#53242a4: field is_pinned: %w", err) } s.IsPinned = value case "protect_content": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode sendStory#40b9f838: field protect_content: %w", err) + return fmt.Errorf("unable to decode sendStory#53242a4: field protect_content: %w", err) } s.ProtectContent = value default: @@ -363,6 +389,14 @@ func (s *SendStoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { }) } +// GetChatID returns value of ChatID field. +func (s *SendStoryRequest) GetChatID() (value int64) { + if s == nil { + return + } + return s.ChatID +} + // GetContent returns value of Content field. func (s *SendStoryRequest) GetContent() (value InputStoryContentClass) { if s == nil { @@ -419,7 +453,7 @@ func (s *SendStoryRequest) GetProtectContent() (value bool) { return s.ProtectContent } -// SendStory invokes method sendStory#40b9f838 returning error if any. +// SendStory invokes method sendStory#53242a4 returning error if any. func (c *Client) SendStory(ctx context.Context, request *SendStoryRequest) (*Story, error) { var result Story diff --git a/tdapi/tl_set_story_privacy_settings_gen.go b/tdapi/tl_set_story_privacy_settings_gen.go index 4f86c7b446..3367a46039 100644 --- a/tdapi/tl_set_story_privacy_settings_gen.go +++ b/tdapi/tl_set_story_privacy_settings_gen.go @@ -31,8 +31,10 @@ var ( _ = tdjson.Encoder{} ) -// SetStoryPrivacySettingsRequest represents TL type `setStoryPrivacySettings#d8e94332`. +// SetStoryPrivacySettingsRequest represents TL type `setStoryPrivacySettings#1b6c5434`. type SetStoryPrivacySettingsRequest struct { + // Identifier of the chat that posted the story + StorySenderChatID int64 // Identifier of the story StoryID int32 // The new privacy settigs for the story @@ -40,7 +42,7 @@ type SetStoryPrivacySettingsRequest struct { } // SetStoryPrivacySettingsRequestTypeID is TL type id of SetStoryPrivacySettingsRequest. -const SetStoryPrivacySettingsRequestTypeID = 0xd8e94332 +const SetStoryPrivacySettingsRequestTypeID = 0x1b6c5434 // Ensuring interfaces in compile-time for SetStoryPrivacySettingsRequest. var ( @@ -54,6 +56,9 @@ func (s *SetStoryPrivacySettingsRequest) Zero() bool { if s == nil { return true } + if !(s.StorySenderChatID == 0) { + return false + } if !(s.StoryID == 0) { return false } @@ -96,6 +101,10 @@ func (s *SetStoryPrivacySettingsRequest) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "StorySenderChatID", + SchemaName: "story_sender_chat_id", + }, { Name: "StoryID", SchemaName: "story_id", @@ -111,7 +120,7 @@ func (s *SetStoryPrivacySettingsRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *SetStoryPrivacySettingsRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode setStoryPrivacySettings#d8e94332 as nil") + return fmt.Errorf("can't encode setStoryPrivacySettings#1b6c5434 as nil") } b.PutID(SetStoryPrivacySettingsRequestTypeID) return s.EncodeBare(b) @@ -120,14 +129,15 @@ func (s *SetStoryPrivacySettingsRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *SetStoryPrivacySettingsRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode setStoryPrivacySettings#d8e94332 as nil") + return fmt.Errorf("can't encode setStoryPrivacySettings#1b6c5434 as nil") } + b.PutInt53(s.StorySenderChatID) b.PutInt32(s.StoryID) if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode setStoryPrivacySettings#d8e94332: field privacy_settings is nil") + return fmt.Errorf("unable to encode setStoryPrivacySettings#1b6c5434: field privacy_settings is nil") } if err := s.PrivacySettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode setStoryPrivacySettings#d8e94332: field privacy_settings: %w", err) + return fmt.Errorf("unable to encode setStoryPrivacySettings#1b6c5434: field privacy_settings: %w", err) } return nil } @@ -135,10 +145,10 @@ func (s *SetStoryPrivacySettingsRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *SetStoryPrivacySettingsRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode setStoryPrivacySettings#d8e94332 to nil") + return fmt.Errorf("can't decode setStoryPrivacySettings#1b6c5434 to nil") } if err := b.ConsumeID(SetStoryPrivacySettingsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setStoryPrivacySettings#d8e94332: %w", err) + return fmt.Errorf("unable to decode setStoryPrivacySettings#1b6c5434: %w", err) } return s.DecodeBare(b) } @@ -146,19 +156,26 @@ func (s *SetStoryPrivacySettingsRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *SetStoryPrivacySettingsRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode setStoryPrivacySettings#d8e94332 to nil") + return fmt.Errorf("can't decode setStoryPrivacySettings#1b6c5434 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setStoryPrivacySettings#1b6c5434: field story_sender_chat_id: %w", err) + } + s.StorySenderChatID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode setStoryPrivacySettings#d8e94332: field story_id: %w", err) + return fmt.Errorf("unable to decode setStoryPrivacySettings#1b6c5434: field story_id: %w", err) } s.StoryID = value } { value, err := DecodeStoryPrivacySettings(b) if err != nil { - return fmt.Errorf("unable to decode setStoryPrivacySettings#d8e94332: field privacy_settings: %w", err) + return fmt.Errorf("unable to decode setStoryPrivacySettings#1b6c5434: field privacy_settings: %w", err) } s.PrivacySettings = value } @@ -168,20 +185,23 @@ func (s *SetStoryPrivacySettingsRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *SetStoryPrivacySettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode setStoryPrivacySettings#d8e94332 as nil") + return fmt.Errorf("can't encode setStoryPrivacySettings#1b6c5434 as nil") } b.ObjStart() b.PutID("setStoryPrivacySettings") b.Comma() + b.FieldStart("story_sender_chat_id") + b.PutInt53(s.StorySenderChatID) + b.Comma() b.FieldStart("story_id") b.PutInt32(s.StoryID) b.Comma() b.FieldStart("privacy_settings") if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode setStoryPrivacySettings#d8e94332: field privacy_settings is nil") + return fmt.Errorf("unable to encode setStoryPrivacySettings#1b6c5434: field privacy_settings is nil") } if err := s.PrivacySettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setStoryPrivacySettings#d8e94332: field privacy_settings: %w", err) + return fmt.Errorf("unable to encode setStoryPrivacySettings#1b6c5434: field privacy_settings: %w", err) } b.Comma() b.StripComma() @@ -192,25 +212,31 @@ func (s *SetStoryPrivacySettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *SetStoryPrivacySettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode setStoryPrivacySettings#d8e94332 to nil") + return fmt.Errorf("can't decode setStoryPrivacySettings#1b6c5434 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("setStoryPrivacySettings"); err != nil { - return fmt.Errorf("unable to decode setStoryPrivacySettings#d8e94332: %w", err) + return fmt.Errorf("unable to decode setStoryPrivacySettings#1b6c5434: %w", err) + } + case "story_sender_chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setStoryPrivacySettings#1b6c5434: field story_sender_chat_id: %w", err) } + s.StorySenderChatID = value case "story_id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode setStoryPrivacySettings#d8e94332: field story_id: %w", err) + return fmt.Errorf("unable to decode setStoryPrivacySettings#1b6c5434: field story_id: %w", err) } s.StoryID = value case "privacy_settings": value, err := DecodeTDLibJSONStoryPrivacySettings(b) if err != nil { - return fmt.Errorf("unable to decode setStoryPrivacySettings#d8e94332: field privacy_settings: %w", err) + return fmt.Errorf("unable to decode setStoryPrivacySettings#1b6c5434: field privacy_settings: %w", err) } s.PrivacySettings = value default: @@ -220,6 +246,14 @@ func (s *SetStoryPrivacySettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error }) } +// GetStorySenderChatID returns value of StorySenderChatID field. +func (s *SetStoryPrivacySettingsRequest) GetStorySenderChatID() (value int64) { + if s == nil { + return + } + return s.StorySenderChatID +} + // GetStoryID returns value of StoryID field. func (s *SetStoryPrivacySettingsRequest) GetStoryID() (value int32) { if s == nil { @@ -236,7 +270,7 @@ func (s *SetStoryPrivacySettingsRequest) GetPrivacySettings() (value StoryPrivac return s.PrivacySettings } -// SetStoryPrivacySettings invokes method setStoryPrivacySettings#d8e94332 returning error if any. +// SetStoryPrivacySettings invokes method setStoryPrivacySettings#1b6c5434 returning error if any. func (c *Client) SetStoryPrivacySettings(ctx context.Context, request *SetStoryPrivacySettingsRequest) error { var ok Ok diff --git a/tdapi/tl_story_area_type_gen.go b/tdapi/tl_story_area_type_gen.go index 00ddecac92..702294c906 100644 --- a/tdapi/tl_story_area_type_gen.go +++ b/tdapi/tl_story_area_type_gen.go @@ -363,6 +363,284 @@ func (s *StoryAreaTypeVenue) GetVenue() (value Venue) { return s.Venue } +// StoryAreaTypeSuggestedReaction represents TL type `storyAreaTypeSuggestedReaction#f95f927c`. +type StoryAreaTypeSuggestedReaction struct { + // Type of the reaction + ReactionType ReactionTypeClass + // Number of times the reaction was added + TotalCount int32 + // True, if reaction has a dark background + IsDark bool + // True, if reaction corner is flipped + IsFlipped bool +} + +// StoryAreaTypeSuggestedReactionTypeID is TL type id of StoryAreaTypeSuggestedReaction. +const StoryAreaTypeSuggestedReactionTypeID = 0xf95f927c + +// construct implements constructor of StoryAreaTypeClass. +func (s StoryAreaTypeSuggestedReaction) construct() StoryAreaTypeClass { return &s } + +// Ensuring interfaces in compile-time for StoryAreaTypeSuggestedReaction. +var ( + _ bin.Encoder = &StoryAreaTypeSuggestedReaction{} + _ bin.Decoder = &StoryAreaTypeSuggestedReaction{} + _ bin.BareEncoder = &StoryAreaTypeSuggestedReaction{} + _ bin.BareDecoder = &StoryAreaTypeSuggestedReaction{} + + _ StoryAreaTypeClass = &StoryAreaTypeSuggestedReaction{} +) + +func (s *StoryAreaTypeSuggestedReaction) Zero() bool { + if s == nil { + return true + } + if !(s.ReactionType == nil) { + return false + } + if !(s.TotalCount == 0) { + return false + } + if !(s.IsDark == false) { + return false + } + if !(s.IsFlipped == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StoryAreaTypeSuggestedReaction) String() string { + if s == nil { + return "StoryAreaTypeSuggestedReaction(nil)" + } + type Alias StoryAreaTypeSuggestedReaction + return fmt.Sprintf("StoryAreaTypeSuggestedReaction%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StoryAreaTypeSuggestedReaction) TypeID() uint32 { + return StoryAreaTypeSuggestedReactionTypeID +} + +// TypeName returns name of type in TL schema. +func (*StoryAreaTypeSuggestedReaction) TypeName() string { + return "storyAreaTypeSuggestedReaction" +} + +// TypeInfo returns info about TL type. +func (s *StoryAreaTypeSuggestedReaction) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "storyAreaTypeSuggestedReaction", + ID: StoryAreaTypeSuggestedReactionTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ReactionType", + SchemaName: "reaction_type", + }, + { + Name: "TotalCount", + SchemaName: "total_count", + }, + { + Name: "IsDark", + SchemaName: "is_dark", + }, + { + Name: "IsFlipped", + SchemaName: "is_flipped", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StoryAreaTypeSuggestedReaction) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyAreaTypeSuggestedReaction#f95f927c as nil") + } + b.PutID(StoryAreaTypeSuggestedReactionTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StoryAreaTypeSuggestedReaction) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyAreaTypeSuggestedReaction#f95f927c as nil") + } + if s.ReactionType == nil { + return fmt.Errorf("unable to encode storyAreaTypeSuggestedReaction#f95f927c: field reaction_type is nil") + } + if err := s.ReactionType.Encode(b); err != nil { + return fmt.Errorf("unable to encode storyAreaTypeSuggestedReaction#f95f927c: field reaction_type: %w", err) + } + b.PutInt32(s.TotalCount) + b.PutBool(s.IsDark) + b.PutBool(s.IsFlipped) + return nil +} + +// Decode implements bin.Decoder. +func (s *StoryAreaTypeSuggestedReaction) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyAreaTypeSuggestedReaction#f95f927c to nil") + } + if err := b.ConsumeID(StoryAreaTypeSuggestedReactionTypeID); err != nil { + return fmt.Errorf("unable to decode storyAreaTypeSuggestedReaction#f95f927c: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StoryAreaTypeSuggestedReaction) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyAreaTypeSuggestedReaction#f95f927c to nil") + } + { + value, err := DecodeReactionType(b) + if err != nil { + return fmt.Errorf("unable to decode storyAreaTypeSuggestedReaction#f95f927c: field reaction_type: %w", err) + } + s.ReactionType = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode storyAreaTypeSuggestedReaction#f95f927c: field total_count: %w", err) + } + s.TotalCount = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode storyAreaTypeSuggestedReaction#f95f927c: field is_dark: %w", err) + } + s.IsDark = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode storyAreaTypeSuggestedReaction#f95f927c: field is_flipped: %w", err) + } + s.IsFlipped = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StoryAreaTypeSuggestedReaction) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode storyAreaTypeSuggestedReaction#f95f927c as nil") + } + b.ObjStart() + b.PutID("storyAreaTypeSuggestedReaction") + b.Comma() + b.FieldStart("reaction_type") + if s.ReactionType == nil { + return fmt.Errorf("unable to encode storyAreaTypeSuggestedReaction#f95f927c: field reaction_type is nil") + } + if err := s.ReactionType.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode storyAreaTypeSuggestedReaction#f95f927c: field reaction_type: %w", err) + } + b.Comma() + b.FieldStart("total_count") + b.PutInt32(s.TotalCount) + b.Comma() + b.FieldStart("is_dark") + b.PutBool(s.IsDark) + b.Comma() + b.FieldStart("is_flipped") + b.PutBool(s.IsFlipped) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StoryAreaTypeSuggestedReaction) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode storyAreaTypeSuggestedReaction#f95f927c to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("storyAreaTypeSuggestedReaction"); err != nil { + return fmt.Errorf("unable to decode storyAreaTypeSuggestedReaction#f95f927c: %w", err) + } + case "reaction_type": + value, err := DecodeTDLibJSONReactionType(b) + if err != nil { + return fmt.Errorf("unable to decode storyAreaTypeSuggestedReaction#f95f927c: field reaction_type: %w", err) + } + s.ReactionType = value + case "total_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode storyAreaTypeSuggestedReaction#f95f927c: field total_count: %w", err) + } + s.TotalCount = value + case "is_dark": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode storyAreaTypeSuggestedReaction#f95f927c: field is_dark: %w", err) + } + s.IsDark = value + case "is_flipped": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode storyAreaTypeSuggestedReaction#f95f927c: field is_flipped: %w", err) + } + s.IsFlipped = value + default: + return b.Skip() + } + return nil + }) +} + +// GetReactionType returns value of ReactionType field. +func (s *StoryAreaTypeSuggestedReaction) GetReactionType() (value ReactionTypeClass) { + if s == nil { + return + } + return s.ReactionType +} + +// GetTotalCount returns value of TotalCount field. +func (s *StoryAreaTypeSuggestedReaction) GetTotalCount() (value int32) { + if s == nil { + return + } + return s.TotalCount +} + +// GetIsDark returns value of IsDark field. +func (s *StoryAreaTypeSuggestedReaction) GetIsDark() (value bool) { + if s == nil { + return + } + return s.IsDark +} + +// GetIsFlipped returns value of IsFlipped field. +func (s *StoryAreaTypeSuggestedReaction) GetIsFlipped() (value bool) { + if s == nil { + return + } + return s.IsFlipped +} + // StoryAreaTypeClassName is schema name of StoryAreaTypeClass. const StoryAreaTypeClassName = "StoryAreaType" @@ -377,6 +655,7 @@ const StoryAreaTypeClassName = "StoryAreaType" // switch v := g.(type) { // case *tdapi.StoryAreaTypeLocation: // storyAreaTypeLocation#9ebe1186 // case *tdapi.StoryAreaTypeVenue: // storyAreaTypeVenue#18ae4d06 +// case *tdapi.StoryAreaTypeSuggestedReaction: // storyAreaTypeSuggestedReaction#f95f927c // default: panic(v) // } type StoryAreaTypeClass interface { @@ -422,6 +701,13 @@ func DecodeStoryAreaType(buf *bin.Buffer) (StoryAreaTypeClass, error) { return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", err) } return &v, nil + case StoryAreaTypeSuggestedReactionTypeID: + // Decoding storyAreaTypeSuggestedReaction#f95f927c. + v := StoryAreaTypeSuggestedReaction{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", bin.NewUnexpectedID(id)) } @@ -448,6 +734,13 @@ func DecodeTDLibJSONStoryAreaType(buf tdjson.Decoder) (StoryAreaTypeClass, error return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", err) } return &v, nil + case "storyAreaTypeSuggestedReaction": + // Decoding storyAreaTypeSuggestedReaction#f95f927c. + v := StoryAreaTypeSuggestedReaction{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", tdjson.NewUnexpectedID(id)) } diff --git a/tdapi/tl_story_gen.go b/tdapi/tl_story_gen.go index eb38fd1dd1..8dd7678114 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#3198c7c0`. +// Story represents TL type `story#627556b4`. type Story struct { // Unique story identifier among stories of the given sender ID int32 @@ -50,11 +50,17 @@ type Story struct { IsPinned bool // True, if the story is visible only for the current user IsVisibleOnlyForSelf bool + // True, if the story can be deleted + CanBeDeleted bool + // True, if the story can be edited + CanBeEdited bool // True, if the story can be forwarded as a message. Otherwise, screenshots and saving of // the story content must be also forbidden 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 users viewed the story can be received through getStoryViewers CanGetViewers bool // True, if users viewed the story can't be received, because the story has expired more @@ -76,7 +82,7 @@ type Story struct { } // StoryTypeID is TL type id of Story. -const StoryTypeID = 0x3198c7c0 +const StoryTypeID = 0x627556b4 // Ensuring interfaces in compile-time for Story. var ( @@ -114,12 +120,21 @@ func (s *Story) Zero() bool { if !(s.IsVisibleOnlyForSelf == false) { return false } + if !(s.CanBeDeleted == false) { + return false + } + if !(s.CanBeEdited == false) { + return false + } if !(s.CanBeForwarded == false) { return false } if !(s.CanBeReplied == false) { return false } + if !(s.CanToggleIsPinned == false) { + return false + } if !(s.CanGetViewers == false) { return false } @@ -212,6 +227,14 @@ func (s *Story) TypeInfo() tdp.Type { Name: "IsVisibleOnlyForSelf", SchemaName: "is_visible_only_for_self", }, + { + Name: "CanBeDeleted", + SchemaName: "can_be_deleted", + }, + { + Name: "CanBeEdited", + SchemaName: "can_be_edited", + }, { Name: "CanBeForwarded", SchemaName: "can_be_forwarded", @@ -220,6 +243,10 @@ func (s *Story) TypeInfo() tdp.Type { Name: "CanBeReplied", SchemaName: "can_be_replied", }, + { + Name: "CanToggleIsPinned", + SchemaName: "can_toggle_is_pinned", + }, { Name: "CanGetViewers", SchemaName: "can_get_viewers", @@ -259,7 +286,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#3198c7c0 as nil") + return fmt.Errorf("can't encode story#627556b4 as nil") } b.PutID(StoryTypeID) return s.EncodeBare(b) @@ -268,7 +295,7 @@ func (s *Story) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *Story) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode story#3198c7c0 as nil") + return fmt.Errorf("can't encode story#627556b4 as nil") } b.PutInt32(s.ID) b.PutInt53(s.SenderChatID) @@ -278,39 +305,42 @@ func (s *Story) EncodeBare(b *bin.Buffer) error { b.PutBool(s.IsEdited) b.PutBool(s.IsPinned) 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.CanGetViewers) b.PutBool(s.HasExpiredViewers) if err := s.InteractionInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#3198c7c0: field interaction_info: %w", err) + return fmt.Errorf("unable to encode story#627556b4: field interaction_info: %w", err) } if s.ChosenReactionType == nil { - return fmt.Errorf("unable to encode story#3198c7c0: field chosen_reaction_type is nil") + return fmt.Errorf("unable to encode story#627556b4: field chosen_reaction_type is nil") } if err := s.ChosenReactionType.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#3198c7c0: field chosen_reaction_type: %w", err) + return fmt.Errorf("unable to encode story#627556b4: field chosen_reaction_type: %w", err) } if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode story#3198c7c0: field privacy_settings is nil") + return fmt.Errorf("unable to encode story#627556b4: field privacy_settings is nil") } if err := s.PrivacySettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#3198c7c0: field privacy_settings: %w", err) + return fmt.Errorf("unable to encode story#627556b4: field privacy_settings: %w", err) } if s.Content == nil { - return fmt.Errorf("unable to encode story#3198c7c0: field content is nil") + return fmt.Errorf("unable to encode story#627556b4: field content is nil") } if err := s.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#3198c7c0: field content: %w", err) + return fmt.Errorf("unable to encode story#627556b4: 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#3198c7c0: field areas element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare story#627556b4: field areas element with index %d: %w", idx, err) } } if err := s.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#3198c7c0: field caption: %w", err) + return fmt.Errorf("unable to encode story#627556b4: field caption: %w", err) } return nil } @@ -318,10 +348,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#3198c7c0 to nil") + return fmt.Errorf("can't decode story#627556b4 to nil") } if err := b.ConsumeID(StoryTypeID); err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: %w", err) + return fmt.Errorf("unable to decode story#627556b4: %w", err) } return s.DecodeBare(b) } @@ -329,122 +359,143 @@ 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#3198c7c0 to nil") + return fmt.Errorf("can't decode story#627556b4 to nil") } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field id: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field id: %w", err) } s.ID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field sender_chat_id: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field sender_chat_id: %w", err) } s.SenderChatID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field date: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field date: %w", err) } s.Date = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field is_being_sent: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field is_being_sent: %w", err) } s.IsBeingSent = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field is_being_edited: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field is_being_edited: %w", err) } s.IsBeingEdited = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field is_edited: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field is_edited: %w", err) } s.IsEdited = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field is_pinned: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field is_pinned: %w", err) } s.IsPinned = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field is_visible_only_for_self: %w", err) + return fmt.Errorf("unable to decode story#627556b4: 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#3198c7c0: field can_be_forwarded: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field can_be_deleted: %w", err) + } + s.CanBeDeleted = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode story#627556b4: field can_be_edited: %w", err) + } + s.CanBeEdited = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode story#627556b4: field can_be_forwarded: %w", err) } s.CanBeForwarded = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field can_be_replied: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field can_be_replied: %w", err) } s.CanBeReplied = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field can_get_viewers: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field can_toggle_is_pinned: %w", err) + } + s.CanToggleIsPinned = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode story#627556b4: field can_get_viewers: %w", err) } s.CanGetViewers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field has_expired_viewers: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field has_expired_viewers: %w", err) } s.HasExpiredViewers = value } { if err := s.InteractionInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field interaction_info: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field interaction_info: %w", err) } } { value, err := DecodeReactionType(b) if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field chosen_reaction_type: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field chosen_reaction_type: %w", err) } s.ChosenReactionType = value } { value, err := DecodeStoryPrivacySettings(b) if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field privacy_settings: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field privacy_settings: %w", err) } s.PrivacySettings = value } { value, err := DecodeStoryContent(b) if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field content: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field content: %w", err) } s.Content = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field areas: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field areas: %w", err) } if headerLen > 0 { @@ -453,14 +504,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#3198c7c0: field areas: %w", err) + return fmt.Errorf("unable to decode bare story#627556b4: 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#3198c7c0: field caption: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field caption: %w", err) } } return nil @@ -469,7 +520,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#3198c7c0 as nil") + return fmt.Errorf("can't encode story#627556b4 as nil") } b.ObjStart() b.PutID("story") @@ -498,12 +549,21 @@ func (s *Story) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("is_visible_only_for_self") b.PutBool(s.IsVisibleOnlyForSelf) b.Comma() + b.FieldStart("can_be_deleted") + b.PutBool(s.CanBeDeleted) + b.Comma() + b.FieldStart("can_be_edited") + b.PutBool(s.CanBeEdited) + b.Comma() b.FieldStart("can_be_forwarded") b.PutBool(s.CanBeForwarded) b.Comma() b.FieldStart("can_be_replied") b.PutBool(s.CanBeReplied) b.Comma() + b.FieldStart("can_toggle_is_pinned") + b.PutBool(s.CanToggleIsPinned) + b.Comma() b.FieldStart("can_get_viewers") b.PutBool(s.CanGetViewers) b.Comma() @@ -512,38 +572,38 @@ func (s *Story) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("interaction_info") if err := s.InteractionInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#3198c7c0: field interaction_info: %w", err) + return fmt.Errorf("unable to encode story#627556b4: field interaction_info: %w", err) } b.Comma() b.FieldStart("chosen_reaction_type") if s.ChosenReactionType == nil { - return fmt.Errorf("unable to encode story#3198c7c0: field chosen_reaction_type is nil") + return fmt.Errorf("unable to encode story#627556b4: field chosen_reaction_type is nil") } if err := s.ChosenReactionType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#3198c7c0: field chosen_reaction_type: %w", err) + return fmt.Errorf("unable to encode story#627556b4: field chosen_reaction_type: %w", err) } b.Comma() b.FieldStart("privacy_settings") if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode story#3198c7c0: field privacy_settings is nil") + return fmt.Errorf("unable to encode story#627556b4: field privacy_settings is nil") } if err := s.PrivacySettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#3198c7c0: field privacy_settings: %w", err) + return fmt.Errorf("unable to encode story#627556b4: field privacy_settings: %w", err) } b.Comma() b.FieldStart("content") if s.Content == nil { - return fmt.Errorf("unable to encode story#3198c7c0: field content is nil") + return fmt.Errorf("unable to encode story#627556b4: field content is nil") } if err := s.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#3198c7c0: field content: %w", err) + return fmt.Errorf("unable to encode story#627556b4: 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#3198c7c0: field areas element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode story#627556b4: field areas element with index %d: %w", idx, err) } b.Comma() } @@ -552,7 +612,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#3198c7c0: field caption: %w", err) + return fmt.Errorf("unable to encode story#627556b4: field caption: %w", err) } b.Comma() b.StripComma() @@ -563,123 +623,141 @@ 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#3198c7c0 to nil") + return fmt.Errorf("can't decode story#627556b4 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#3198c7c0: %w", err) + return fmt.Errorf("unable to decode story#627556b4: %w", err) } case "id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field id: %w", err) + return fmt.Errorf("unable to decode story#627556b4: 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#3198c7c0: field sender_chat_id: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field sender_chat_id: %w", err) } s.SenderChatID = value case "date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field date: %w", err) + return fmt.Errorf("unable to decode story#627556b4: 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#3198c7c0: field is_being_sent: %w", err) + return fmt.Errorf("unable to decode story#627556b4: 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#3198c7c0: field is_being_edited: %w", err) + return fmt.Errorf("unable to decode story#627556b4: 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#3198c7c0: field is_edited: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field is_edited: %w", err) } s.IsEdited = value case "is_pinned": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field is_pinned: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field is_pinned: %w", err) } s.IsPinned = value case "is_visible_only_for_self": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field is_visible_only_for_self: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field is_visible_only_for_self: %w", err) } s.IsVisibleOnlyForSelf = value + case "can_be_deleted": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode story#627556b4: field can_be_deleted: %w", err) + } + s.CanBeDeleted = value + case "can_be_edited": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode story#627556b4: field can_be_edited: %w", err) + } + s.CanBeEdited = value case "can_be_forwarded": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field can_be_forwarded: %w", err) + return fmt.Errorf("unable to decode story#627556b4: 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#3198c7c0: field can_be_replied: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field can_be_replied: %w", err) } s.CanBeReplied = value + case "can_toggle_is_pinned": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode story#627556b4: field can_toggle_is_pinned: %w", err) + } + s.CanToggleIsPinned = value case "can_get_viewers": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field can_get_viewers: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field can_get_viewers: %w", err) } s.CanGetViewers = value case "has_expired_viewers": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field has_expired_viewers: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field has_expired_viewers: %w", err) } s.HasExpiredViewers = value case "interaction_info": if err := s.InteractionInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field interaction_info: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field interaction_info: %w", err) } case "chosen_reaction_type": value, err := DecodeTDLibJSONReactionType(b) if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field chosen_reaction_type: %w", err) + return fmt.Errorf("unable to decode story#627556b4: 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#3198c7c0: field privacy_settings: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field privacy_settings: %w", err) } s.PrivacySettings = value case "content": value, err := DecodeTDLibJSONStoryContent(b) if err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field content: %w", err) + return fmt.Errorf("unable to decode story#627556b4: 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#3198c7c0: field areas: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field areas: %w", err) } s.Areas = append(s.Areas, value) return nil }); err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field areas: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field areas: %w", err) } case "caption": if err := s.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode story#3198c7c0: field caption: %w", err) + return fmt.Errorf("unable to decode story#627556b4: field caption: %w", err) } default: return b.Skip() @@ -752,6 +830,22 @@ func (s *Story) GetIsVisibleOnlyForSelf() (value bool) { return s.IsVisibleOnlyForSelf } +// GetCanBeDeleted returns value of CanBeDeleted field. +func (s *Story) GetCanBeDeleted() (value bool) { + if s == nil { + return + } + return s.CanBeDeleted +} + +// GetCanBeEdited returns value of CanBeEdited field. +func (s *Story) GetCanBeEdited() (value bool) { + if s == nil { + return + } + return s.CanBeEdited +} + // GetCanBeForwarded returns value of CanBeForwarded field. func (s *Story) GetCanBeForwarded() (value bool) { if s == nil { @@ -768,6 +862,14 @@ func (s *Story) GetCanBeReplied() (value bool) { return s.CanBeReplied } +// GetCanToggleIsPinned returns value of CanToggleIsPinned field. +func (s *Story) GetCanToggleIsPinned() (value bool) { + if s == nil { + return + } + return s.CanToggleIsPinned +} + // GetCanGetViewers returns value of CanGetViewers field. func (s *Story) GetCanGetViewers() (value bool) { if s == nil { diff --git a/tdapi/tl_story_interaction_info_gen.go b/tdapi/tl_story_interaction_info_gen.go index ffbc2d77b2..6bad4be235 100644 --- a/tdapi/tl_story_interaction_info_gen.go +++ b/tdapi/tl_story_interaction_info_gen.go @@ -31,18 +31,20 @@ var ( _ = tdjson.Encoder{} ) -// StoryInteractionInfo represents TL type `storyInteractionInfo#e5109256`. +// StoryInteractionInfo represents TL type `storyInteractionInfo#e1557fc7`. type StoryInteractionInfo struct { // Number of times the story was viewed ViewCount int32 - // Number of reactions added to the story + // Number of times the story was forwarded; 0 if none or unknown + ForwardCount int32 + // Number of reactions added to the story; 0 if none or unknown ReactionCount int32 // Identifiers of at most 3 recent viewers of the story RecentViewerUserIDs []int64 } // StoryInteractionInfoTypeID is TL type id of StoryInteractionInfo. -const StoryInteractionInfoTypeID = 0xe5109256 +const StoryInteractionInfoTypeID = 0xe1557fc7 // Ensuring interfaces in compile-time for StoryInteractionInfo. var ( @@ -59,6 +61,9 @@ func (s *StoryInteractionInfo) Zero() bool { if !(s.ViewCount == 0) { return false } + if !(s.ForwardCount == 0) { + return false + } if !(s.ReactionCount == 0) { return false } @@ -105,6 +110,10 @@ func (s *StoryInteractionInfo) TypeInfo() tdp.Type { Name: "ViewCount", SchemaName: "view_count", }, + { + Name: "ForwardCount", + SchemaName: "forward_count", + }, { Name: "ReactionCount", SchemaName: "reaction_count", @@ -120,7 +129,7 @@ func (s *StoryInteractionInfo) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *StoryInteractionInfo) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode storyInteractionInfo#e5109256 as nil") + return fmt.Errorf("can't encode storyInteractionInfo#e1557fc7 as nil") } b.PutID(StoryInteractionInfoTypeID) return s.EncodeBare(b) @@ -129,9 +138,10 @@ func (s *StoryInteractionInfo) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StoryInteractionInfo) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode storyInteractionInfo#e5109256 as nil") + return fmt.Errorf("can't encode storyInteractionInfo#e1557fc7 as nil") } b.PutInt32(s.ViewCount) + b.PutInt32(s.ForwardCount) b.PutInt32(s.ReactionCount) b.PutInt(len(s.RecentViewerUserIDs)) for _, v := range s.RecentViewerUserIDs { @@ -143,10 +153,10 @@ func (s *StoryInteractionInfo) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *StoryInteractionInfo) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode storyInteractionInfo#e5109256 to nil") + return fmt.Errorf("can't decode storyInteractionInfo#e1557fc7 to nil") } if err := b.ConsumeID(StoryInteractionInfoTypeID); err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e5109256: %w", err) + return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: %w", err) } return s.DecodeBare(b) } @@ -154,26 +164,33 @@ func (s *StoryInteractionInfo) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StoryInteractionInfo) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode storyInteractionInfo#e5109256 to nil") + return fmt.Errorf("can't decode storyInteractionInfo#e1557fc7 to nil") } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e5109256: field view_count: %w", err) + return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: field view_count: %w", err) } s.ViewCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e5109256: field reaction_count: %w", err) + return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: field forward_count: %w", err) + } + s.ForwardCount = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: field reaction_count: %w", err) } s.ReactionCount = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e5109256: field recent_viewer_user_ids: %w", err) + return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: field recent_viewer_user_ids: %w", err) } if headerLen > 0 { @@ -182,7 +199,7 @@ func (s *StoryInteractionInfo) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e5109256: field recent_viewer_user_ids: %w", err) + return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: field recent_viewer_user_ids: %w", err) } s.RecentViewerUserIDs = append(s.RecentViewerUserIDs, value) } @@ -193,7 +210,7 @@ func (s *StoryInteractionInfo) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *StoryInteractionInfo) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode storyInteractionInfo#e5109256 as nil") + return fmt.Errorf("can't encode storyInteractionInfo#e1557fc7 as nil") } b.ObjStart() b.PutID("storyInteractionInfo") @@ -201,6 +218,9 @@ func (s *StoryInteractionInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("view_count") b.PutInt32(s.ViewCount) b.Comma() + b.FieldStart("forward_count") + b.PutInt32(s.ForwardCount) + b.Comma() b.FieldStart("reaction_count") b.PutInt32(s.ReactionCount) b.Comma() @@ -221,37 +241,43 @@ func (s *StoryInteractionInfo) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *StoryInteractionInfo) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode storyInteractionInfo#e5109256 to nil") + return fmt.Errorf("can't decode storyInteractionInfo#e1557fc7 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("storyInteractionInfo"); err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e5109256: %w", err) + return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: %w", err) } case "view_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e5109256: field view_count: %w", err) + return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: field view_count: %w", err) } s.ViewCount = value + case "forward_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: field forward_count: %w", err) + } + s.ForwardCount = value case "reaction_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e5109256: field reaction_count: %w", err) + return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: field reaction_count: %w", err) } s.ReactionCount = value case "recent_viewer_user_ids": if err := b.Arr(func(b tdjson.Decoder) error { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e5109256: field recent_viewer_user_ids: %w", err) + return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: field recent_viewer_user_ids: %w", err) } s.RecentViewerUserIDs = append(s.RecentViewerUserIDs, value) return nil }); err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e5109256: field recent_viewer_user_ids: %w", err) + return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: field recent_viewer_user_ids: %w", err) } default: return b.Skip() @@ -268,6 +294,14 @@ func (s *StoryInteractionInfo) GetViewCount() (value int32) { return s.ViewCount } +// GetForwardCount returns value of ForwardCount field. +func (s *StoryInteractionInfo) GetForwardCount() (value int32) { + if s == nil { + return + } + return s.ForwardCount +} + // GetReactionCount returns value of ReactionCount field. func (s *StoryInteractionInfo) GetReactionCount() (value int32) { if s == nil { diff --git a/tdapi/tl_supergroup_full_info_gen.go b/tdapi/tl_supergroup_full_info_gen.go index aabf588a13..72c742454d 100644 --- a/tdapi/tl_supergroup_full_info_gen.go +++ b/tdapi/tl_supergroup_full_info_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// SupergroupFullInfo represents TL type `supergroupFullInfo#8d50b2f9`. +// SupergroupFullInfo represents TL type `supergroupFullInfo#f2f19203`. type SupergroupFullInfo struct { // Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as // in chat.photo @@ -79,6 +79,8 @@ type SupergroupFullInfo struct { // True, if aggressive anti-spam checks are enabled in the supergroup. The value of this // field is only available to chat administrators HasAggressiveAntiSpamEnabled bool + // True, if the channel has pinned stories + HasPinnedStories bool // Identifier of the supergroup sticker set; 0 if none StickerSetID int64 // Location to which the supergroup is connected; may be null if none @@ -96,7 +98,7 @@ type SupergroupFullInfo struct { } // SupergroupFullInfoTypeID is TL type id of SupergroupFullInfo. -const SupergroupFullInfoTypeID = 0x8d50b2f9 +const SupergroupFullInfoTypeID = 0xf2f19203 // Ensuring interfaces in compile-time for SupergroupFullInfo. var ( @@ -164,6 +166,9 @@ func (s *SupergroupFullInfo) Zero() bool { if !(s.HasAggressiveAntiSpamEnabled == false) { return false } + if !(s.HasPinnedStories == false) { + return false + } if !(s.StickerSetID == 0) { return false } @@ -290,6 +295,10 @@ func (s *SupergroupFullInfo) TypeInfo() tdp.Type { Name: "HasAggressiveAntiSpamEnabled", SchemaName: "has_aggressive_anti_spam_enabled", }, + { + Name: "HasPinnedStories", + SchemaName: "has_pinned_stories", + }, { Name: "StickerSetID", SchemaName: "sticker_set_id", @@ -321,7 +330,7 @@ func (s *SupergroupFullInfo) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *SupergroupFullInfo) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode supergroupFullInfo#8d50b2f9 as nil") + return fmt.Errorf("can't encode supergroupFullInfo#f2f19203 as nil") } b.PutID(SupergroupFullInfoTypeID) return s.EncodeBare(b) @@ -330,10 +339,10 @@ func (s *SupergroupFullInfo) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *SupergroupFullInfo) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode supergroupFullInfo#8d50b2f9 as nil") + return fmt.Errorf("can't encode supergroupFullInfo#f2f19203 as nil") } if err := s.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#8d50b2f9: field photo: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#f2f19203: field photo: %w", err) } b.PutString(s.Description) b.PutInt32(s.MemberCount) @@ -352,17 +361,18 @@ func (s *SupergroupFullInfo) EncodeBare(b *bin.Buffer) error { b.PutBool(s.CanToggleAggressiveAntiSpam) b.PutBool(s.IsAllHistoryAvailable) b.PutBool(s.HasAggressiveAntiSpamEnabled) + b.PutBool(s.HasPinnedStories) b.PutLong(s.StickerSetID) if err := s.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#8d50b2f9: field location: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#f2f19203: field location: %w", err) } if err := s.InviteLink.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#8d50b2f9: field invite_link: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#f2f19203: field invite_link: %w", err) } b.PutInt(len(s.BotCommands)) for idx, v := range s.BotCommands { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare supergroupFullInfo#8d50b2f9: field bot_commands element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare supergroupFullInfo#f2f19203: field bot_commands element with index %d: %w", idx, err) } } b.PutInt53(s.UpgradedFromBasicGroupID) @@ -373,10 +383,10 @@ func (s *SupergroupFullInfo) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *SupergroupFullInfo) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode supergroupFullInfo#8d50b2f9 to nil") + return fmt.Errorf("can't decode supergroupFullInfo#f2f19203 to nil") } if err := b.ConsumeID(SupergroupFullInfoTypeID); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: %w", err) } return s.DecodeBare(b) } @@ -384,153 +394,160 @@ func (s *SupergroupFullInfo) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *SupergroupFullInfo) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode supergroupFullInfo#8d50b2f9 to nil") + return fmt.Errorf("can't decode supergroupFullInfo#f2f19203 to nil") } { if err := s.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field photo: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field photo: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field description: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field description: %w", err) } s.Description = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field member_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field member_count: %w", err) } s.MemberCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field administrator_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field administrator_count: %w", err) } s.AdministratorCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field restricted_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field restricted_count: %w", err) } s.RestrictedCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field banned_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field banned_count: %w", err) } s.BannedCount = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field linked_chat_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field linked_chat_id: %w", err) } s.LinkedChatID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field slow_mode_delay: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field slow_mode_delay: %w", err) } s.SlowModeDelay = value } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field slow_mode_delay_expires_in: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field slow_mode_delay_expires_in: %w", err) } s.SlowModeDelayExpiresIn = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field can_get_members: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field can_get_members: %w", err) } s.CanGetMembers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field has_hidden_members: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field has_hidden_members: %w", err) } s.HasHiddenMembers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field can_hide_members: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field can_hide_members: %w", err) } s.CanHideMembers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field can_set_sticker_set: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field can_set_sticker_set: %w", err) } s.CanSetStickerSet = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field can_set_location: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field can_set_location: %w", err) } s.CanSetLocation = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field can_get_statistics: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field can_get_statistics: %w", err) } s.CanGetStatistics = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field can_toggle_aggressive_anti_spam: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field can_toggle_aggressive_anti_spam: %w", err) } s.CanToggleAggressiveAntiSpam = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field is_all_history_available: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field is_all_history_available: %w", err) } s.IsAllHistoryAvailable = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field has_aggressive_anti_spam_enabled: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field has_aggressive_anti_spam_enabled: %w", err) } s.HasAggressiveAntiSpamEnabled = value } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field has_pinned_stories: %w", err) + } + s.HasPinnedStories = value + } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field sticker_set_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field sticker_set_id: %w", err) } s.StickerSetID = value } { if err := s.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field location: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field location: %w", err) } } { if err := s.InviteLink.Decode(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field invite_link: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field invite_link: %w", err) } } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field bot_commands: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field bot_commands: %w", err) } if headerLen > 0 { @@ -539,7 +556,7 @@ func (s *SupergroupFullInfo) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value BotCommands if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare supergroupFullInfo#8d50b2f9: field bot_commands: %w", err) + return fmt.Errorf("unable to decode bare supergroupFullInfo#f2f19203: field bot_commands: %w", err) } s.BotCommands = append(s.BotCommands, value) } @@ -547,14 +564,14 @@ func (s *SupergroupFullInfo) DecodeBare(b *bin.Buffer) error { { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field upgraded_from_basic_group_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field upgraded_from_basic_group_id: %w", err) } s.UpgradedFromBasicGroupID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field upgraded_from_max_message_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field upgraded_from_max_message_id: %w", err) } s.UpgradedFromMaxMessageID = value } @@ -564,14 +581,14 @@ func (s *SupergroupFullInfo) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *SupergroupFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode supergroupFullInfo#8d50b2f9 as nil") + return fmt.Errorf("can't encode supergroupFullInfo#f2f19203 as nil") } b.ObjStart() b.PutID("supergroupFullInfo") b.Comma() b.FieldStart("photo") if err := s.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#8d50b2f9: field photo: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#f2f19203: field photo: %w", err) } b.Comma() b.FieldStart("description") @@ -625,24 +642,27 @@ func (s *SupergroupFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("has_aggressive_anti_spam_enabled") b.PutBool(s.HasAggressiveAntiSpamEnabled) b.Comma() + b.FieldStart("has_pinned_stories") + b.PutBool(s.HasPinnedStories) + b.Comma() b.FieldStart("sticker_set_id") b.PutLong(s.StickerSetID) b.Comma() b.FieldStart("location") if err := s.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#8d50b2f9: field location: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#f2f19203: field location: %w", err) } b.Comma() b.FieldStart("invite_link") if err := s.InviteLink.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#8d50b2f9: field invite_link: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#f2f19203: field invite_link: %w", err) } b.Comma() b.FieldStart("bot_commands") b.ArrStart() for idx, v := range s.BotCommands { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#8d50b2f9: field bot_commands element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode supergroupFullInfo#f2f19203: field bot_commands element with index %d: %w", idx, err) } b.Comma() } @@ -663,156 +683,162 @@ func (s *SupergroupFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *SupergroupFullInfo) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode supergroupFullInfo#8d50b2f9 to nil") + return fmt.Errorf("can't decode supergroupFullInfo#f2f19203 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("supergroupFullInfo"); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: %w", err) } case "photo": if err := s.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field photo: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field photo: %w", err) } case "description": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field description: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field description: %w", err) } s.Description = value case "member_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field member_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field member_count: %w", err) } s.MemberCount = value case "administrator_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field administrator_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field administrator_count: %w", err) } s.AdministratorCount = value case "restricted_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field restricted_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field restricted_count: %w", err) } s.RestrictedCount = value case "banned_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field banned_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field banned_count: %w", err) } s.BannedCount = value case "linked_chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field linked_chat_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field linked_chat_id: %w", err) } s.LinkedChatID = value case "slow_mode_delay": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field slow_mode_delay: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field slow_mode_delay: %w", err) } s.SlowModeDelay = value case "slow_mode_delay_expires_in": value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field slow_mode_delay_expires_in: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field slow_mode_delay_expires_in: %w", err) } s.SlowModeDelayExpiresIn = value case "can_get_members": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field can_get_members: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field can_get_members: %w", err) } s.CanGetMembers = value case "has_hidden_members": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field has_hidden_members: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field has_hidden_members: %w", err) } s.HasHiddenMembers = value case "can_hide_members": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field can_hide_members: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field can_hide_members: %w", err) } s.CanHideMembers = value case "can_set_sticker_set": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field can_set_sticker_set: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field can_set_sticker_set: %w", err) } s.CanSetStickerSet = value case "can_set_location": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field can_set_location: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field can_set_location: %w", err) } s.CanSetLocation = value case "can_get_statistics": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field can_get_statistics: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field can_get_statistics: %w", err) } s.CanGetStatistics = value case "can_toggle_aggressive_anti_spam": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field can_toggle_aggressive_anti_spam: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field can_toggle_aggressive_anti_spam: %w", err) } s.CanToggleAggressiveAntiSpam = value case "is_all_history_available": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field is_all_history_available: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field is_all_history_available: %w", err) } s.IsAllHistoryAvailable = value case "has_aggressive_anti_spam_enabled": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field has_aggressive_anti_spam_enabled: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field has_aggressive_anti_spam_enabled: %w", err) } s.HasAggressiveAntiSpamEnabled = value + case "has_pinned_stories": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field has_pinned_stories: %w", err) + } + s.HasPinnedStories = value case "sticker_set_id": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field sticker_set_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field sticker_set_id: %w", err) } s.StickerSetID = value case "location": if err := s.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field location: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field location: %w", err) } case "invite_link": if err := s.InviteLink.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field invite_link: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field invite_link: %w", err) } case "bot_commands": if err := b.Arr(func(b tdjson.Decoder) error { var value BotCommands if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field bot_commands: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field bot_commands: %w", err) } s.BotCommands = append(s.BotCommands, value) return nil }); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field bot_commands: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field bot_commands: %w", err) } case "upgraded_from_basic_group_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field upgraded_from_basic_group_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field upgraded_from_basic_group_id: %w", err) } s.UpgradedFromBasicGroupID = value case "upgraded_from_max_message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#8d50b2f9: field upgraded_from_max_message_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f2f19203: field upgraded_from_max_message_id: %w", err) } s.UpgradedFromMaxMessageID = value default: @@ -966,6 +992,14 @@ func (s *SupergroupFullInfo) GetHasAggressiveAntiSpamEnabled() (value bool) { return s.HasAggressiveAntiSpamEnabled } +// GetHasPinnedStories returns value of HasPinnedStories field. +func (s *SupergroupFullInfo) GetHasPinnedStories() (value bool) { + if s == nil { + return + } + return s.HasPinnedStories +} + // GetStickerSetID returns value of StickerSetID field. func (s *SupergroupFullInfo) GetStickerSetID() (value int64) { if s == nil { diff --git a/tdapi/tl_supergroup_gen.go b/tdapi/tl_supergroup_gen.go index 2df0af9e9b..350f7ad1d7 100644 --- a/tdapi/tl_supergroup_gen.go +++ b/tdapi/tl_supergroup_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// Supergroup represents TL type `supergroup#88a83c57`. +// Supergroup represents TL type `supergroup#8b30b3c5`. type Supergroup struct { // Supergroup or channel identifier ID int64 @@ -80,10 +80,14 @@ type Supergroup struct { IsScam bool // True, if many users reported this supergroup or channel as a fake account IsFake bool + // True, if the channel has non-expired stories available to the current user + HasActiveStories bool + // True, if the channel has unread non-expired stories available to the current user + HasUnreadActiveStories bool } // SupergroupTypeID is TL type id of Supergroup. -const SupergroupTypeID = 0x88a83c57 +const SupergroupTypeID = 0x8b30b3c5 // Ensuring interfaces in compile-time for Supergroup. var ( @@ -151,6 +155,12 @@ func (s *Supergroup) Zero() bool { if !(s.IsFake == false) { return false } + if !(s.HasActiveStories == false) { + return false + } + if !(s.HasUnreadActiveStories == false) { + return false + } return true } @@ -259,6 +269,14 @@ func (s *Supergroup) TypeInfo() tdp.Type { Name: "IsFake", SchemaName: "is_fake", }, + { + Name: "HasActiveStories", + SchemaName: "has_active_stories", + }, + { + Name: "HasUnreadActiveStories", + SchemaName: "has_unread_active_stories", + }, } return typ } @@ -266,7 +284,7 @@ func (s *Supergroup) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *Supergroup) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode supergroup#88a83c57 as nil") + return fmt.Errorf("can't encode supergroup#8b30b3c5 as nil") } b.PutID(SupergroupTypeID) return s.EncodeBare(b) @@ -275,18 +293,18 @@ func (s *Supergroup) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *Supergroup) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode supergroup#88a83c57 as nil") + return fmt.Errorf("can't encode supergroup#8b30b3c5 as nil") } b.PutInt53(s.ID) if err := s.Usernames.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroup#88a83c57: field usernames: %w", err) + return fmt.Errorf("unable to encode supergroup#8b30b3c5: field usernames: %w", err) } b.PutInt32(s.Date) if s.Status == nil { - return fmt.Errorf("unable to encode supergroup#88a83c57: field status is nil") + return fmt.Errorf("unable to encode supergroup#8b30b3c5: field status is nil") } if err := s.Status.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroup#88a83c57: field status: %w", err) + return fmt.Errorf("unable to encode supergroup#8b30b3c5: field status: %w", err) } b.PutInt32(s.MemberCount) b.PutBool(s.HasLinkedChat) @@ -302,16 +320,18 @@ func (s *Supergroup) EncodeBare(b *bin.Buffer) error { b.PutString(s.RestrictionReason) b.PutBool(s.IsScam) b.PutBool(s.IsFake) + b.PutBool(s.HasActiveStories) + b.PutBool(s.HasUnreadActiveStories) return nil } // Decode implements bin.Decoder. func (s *Supergroup) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode supergroup#88a83c57 to nil") + return fmt.Errorf("can't decode supergroup#8b30b3c5 to nil") } if err := b.ConsumeID(SupergroupTypeID); err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: %w", err) } return s.DecodeBare(b) } @@ -319,139 +339,153 @@ func (s *Supergroup) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *Supergroup) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode supergroup#88a83c57 to nil") + return fmt.Errorf("can't decode supergroup#8b30b3c5 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field id: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field id: %w", err) } s.ID = value } { if err := s.Usernames.Decode(b); err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field usernames: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field usernames: %w", err) } } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field date: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field date: %w", err) } s.Date = value } { value, err := DecodeChatMemberStatus(b) if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field status: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field status: %w", err) } s.Status = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field member_count: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field member_count: %w", err) } s.MemberCount = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field has_linked_chat: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field has_linked_chat: %w", err) } s.HasLinkedChat = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field has_location: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field has_location: %w", err) } s.HasLocation = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field sign_messages: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field sign_messages: %w", err) } s.SignMessages = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field join_to_send_messages: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field join_to_send_messages: %w", err) } s.JoinToSendMessages = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field join_by_request: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field join_by_request: %w", err) } s.JoinByRequest = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field is_slow_mode_enabled: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field is_slow_mode_enabled: %w", err) } s.IsSlowModeEnabled = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field is_channel: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field is_channel: %w", err) } s.IsChannel = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field is_broadcast_group: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field is_broadcast_group: %w", err) } s.IsBroadcastGroup = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field is_forum: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field is_forum: %w", err) } s.IsForum = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field is_verified: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field is_verified: %w", err) } s.IsVerified = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field restriction_reason: %w", err) } s.RestrictionReason = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field is_scam: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field is_scam: %w", err) } s.IsScam = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field is_fake: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field is_fake: %w", err) } s.IsFake = value } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field has_active_stories: %w", err) + } + s.HasActiveStories = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field has_unread_active_stories: %w", err) + } + s.HasUnreadActiveStories = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *Supergroup) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode supergroup#88a83c57 as nil") + return fmt.Errorf("can't encode supergroup#8b30b3c5 as nil") } b.ObjStart() b.PutID("supergroup") @@ -461,7 +495,7 @@ func (s *Supergroup) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("usernames") if err := s.Usernames.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroup#88a83c57: field usernames: %w", err) + return fmt.Errorf("unable to encode supergroup#8b30b3c5: field usernames: %w", err) } b.Comma() b.FieldStart("date") @@ -469,10 +503,10 @@ func (s *Supergroup) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("status") if s.Status == nil { - return fmt.Errorf("unable to encode supergroup#88a83c57: field status is nil") + return fmt.Errorf("unable to encode supergroup#8b30b3c5: field status is nil") } if err := s.Status.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroup#88a83c57: field status: %w", err) + return fmt.Errorf("unable to encode supergroup#8b30b3c5: field status: %w", err) } b.Comma() b.FieldStart("member_count") @@ -517,6 +551,12 @@ func (s *Supergroup) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("is_fake") b.PutBool(s.IsFake) b.Comma() + b.FieldStart("has_active_stories") + b.PutBool(s.HasActiveStories) + b.Comma() + b.FieldStart("has_unread_active_stories") + b.PutBool(s.HasUnreadActiveStories) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -525,121 +565,133 @@ func (s *Supergroup) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *Supergroup) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode supergroup#88a83c57 to nil") + return fmt.Errorf("can't decode supergroup#8b30b3c5 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("supergroup"); err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: %w", err) } case "id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field id: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field id: %w", err) } s.ID = value case "usernames": if err := s.Usernames.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field usernames: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field usernames: %w", err) } case "date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field date: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field date: %w", err) } s.Date = value case "status": value, err := DecodeTDLibJSONChatMemberStatus(b) if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field status: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field status: %w", err) } s.Status = value case "member_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field member_count: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field member_count: %w", err) } s.MemberCount = value case "has_linked_chat": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field has_linked_chat: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field has_linked_chat: %w", err) } s.HasLinkedChat = value case "has_location": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field has_location: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field has_location: %w", err) } s.HasLocation = value case "sign_messages": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field sign_messages: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field sign_messages: %w", err) } s.SignMessages = value case "join_to_send_messages": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field join_to_send_messages: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field join_to_send_messages: %w", err) } s.JoinToSendMessages = value case "join_by_request": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field join_by_request: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field join_by_request: %w", err) } s.JoinByRequest = value case "is_slow_mode_enabled": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field is_slow_mode_enabled: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field is_slow_mode_enabled: %w", err) } s.IsSlowModeEnabled = value case "is_channel": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field is_channel: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field is_channel: %w", err) } s.IsChannel = value case "is_broadcast_group": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field is_broadcast_group: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field is_broadcast_group: %w", err) } s.IsBroadcastGroup = value case "is_forum": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field is_forum: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field is_forum: %w", err) } s.IsForum = value case "is_verified": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field is_verified: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field is_verified: %w", err) } s.IsVerified = value case "restriction_reason": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field restriction_reason: %w", err) } s.RestrictionReason = value case "is_scam": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field is_scam: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field is_scam: %w", err) } s.IsScam = value case "is_fake": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#88a83c57: field is_fake: %w", err) + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field is_fake: %w", err) } s.IsFake = value + case "has_active_stories": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field has_active_stories: %w", err) + } + s.HasActiveStories = value + case "has_unread_active_stories": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode supergroup#8b30b3c5: field has_unread_active_stories: %w", err) + } + s.HasUnreadActiveStories = value default: return b.Skip() } @@ -790,3 +842,19 @@ func (s *Supergroup) GetIsFake() (value bool) { } return s.IsFake } + +// GetHasActiveStories returns value of HasActiveStories field. +func (s *Supergroup) GetHasActiveStories() (value bool) { + if s == nil { + return + } + return s.HasActiveStories +} + +// GetHasUnreadActiveStories returns value of HasUnreadActiveStories field. +func (s *Supergroup) GetHasUnreadActiveStories() (value bool) { + if s == nil { + return + } + return s.HasUnreadActiveStories +} diff --git a/tdapi/tl_toggle_story_is_pinned_gen.go b/tdapi/tl_toggle_story_is_pinned_gen.go index a08fc8002d..cbb47a62b9 100644 --- a/tdapi/tl_toggle_story_is_pinned_gen.go +++ b/tdapi/tl_toggle_story_is_pinned_gen.go @@ -31,8 +31,10 @@ var ( _ = tdjson.Encoder{} ) -// ToggleStoryIsPinnedRequest represents TL type `toggleStoryIsPinned#df8031f9`. +// 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 @@ -40,7 +42,7 @@ type ToggleStoryIsPinnedRequest struct { } // ToggleStoryIsPinnedRequestTypeID is TL type id of ToggleStoryIsPinnedRequest. -const ToggleStoryIsPinnedRequestTypeID = 0xdf8031f9 +const ToggleStoryIsPinnedRequestTypeID = 0xb493b30e // Ensuring interfaces in compile-time for ToggleStoryIsPinnedRequest. var ( @@ -54,6 +56,9 @@ func (t *ToggleStoryIsPinnedRequest) Zero() bool { if t == nil { return true } + if !(t.StorySenderChatID == 0) { + return false + } if !(t.StoryID == 0) { return false } @@ -96,6 +101,10 @@ func (t *ToggleStoryIsPinnedRequest) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "StorySenderChatID", + SchemaName: "story_sender_chat_id", + }, { Name: "StoryID", SchemaName: "story_id", @@ -111,7 +120,7 @@ func (t *ToggleStoryIsPinnedRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (t *ToggleStoryIsPinnedRequest) Encode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode toggleStoryIsPinned#df8031f9 as nil") + return fmt.Errorf("can't encode toggleStoryIsPinned#b493b30e as nil") } b.PutID(ToggleStoryIsPinnedRequestTypeID) return t.EncodeBare(b) @@ -120,8 +129,9 @@ func (t *ToggleStoryIsPinnedRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (t *ToggleStoryIsPinnedRequest) EncodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode toggleStoryIsPinned#df8031f9 as 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 @@ -130,10 +140,10 @@ func (t *ToggleStoryIsPinnedRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (t *ToggleStoryIsPinnedRequest) Decode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode toggleStoryIsPinned#df8031f9 to 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#df8031f9: %w", err) + return fmt.Errorf("unable to decode toggleStoryIsPinned#b493b30e: %w", err) } return t.DecodeBare(b) } @@ -141,19 +151,26 @@ func (t *ToggleStoryIsPinnedRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (t *ToggleStoryIsPinnedRequest) DecodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode toggleStoryIsPinned#df8031f9 to 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#df8031f9: field story_id: %w", err) + 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#df8031f9: field is_pinned: %w", err) + return fmt.Errorf("unable to decode toggleStoryIsPinned#b493b30e: field is_pinned: %w", err) } t.IsPinned = value } @@ -163,11 +180,14 @@ func (t *ToggleStoryIsPinnedRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (t *ToggleStoryIsPinnedRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if t == nil { - return fmt.Errorf("can't encode toggleStoryIsPinned#df8031f9 as 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() @@ -182,25 +202,31 @@ func (t *ToggleStoryIsPinnedRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (t *ToggleStoryIsPinnedRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if t == nil { - return fmt.Errorf("can't decode toggleStoryIsPinned#df8031f9 to 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#df8031f9: %w", err) + 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#df8031f9: field story_id: %w", err) + 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#df8031f9: field is_pinned: %w", err) + return fmt.Errorf("unable to decode toggleStoryIsPinned#b493b30e: field is_pinned: %w", err) } t.IsPinned = value default: @@ -210,6 +236,14 @@ func (t *ToggleStoryIsPinnedRequest) DecodeTDLibJSON(b tdjson.Decoder) error { }) } +// 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 { @@ -226,7 +260,7 @@ func (t *ToggleStoryIsPinnedRequest) GetIsPinned() (value bool) { return t.IsPinned } -// ToggleStoryIsPinned invokes method toggleStoryIsPinned#df8031f9 returning error if any. +// ToggleStoryIsPinned invokes method toggleStoryIsPinned#b493b30e returning error if any. func (c *Client) ToggleStoryIsPinned(ctx context.Context, request *ToggleStoryIsPinnedRequest) error { var ok Ok diff --git a/tdapi/tl_update_gen.go b/tdapi/tl_update_gen.go index 7834526a45..36817845da 100644 --- a/tdapi/tl_update_gen.go +++ b/tdapi/tl_update_gen.go @@ -774,20 +774,18 @@ func (u *UpdateMessageSendSucceeded) GetOldMessageID() (value int64) { return u.OldMessageID } -// UpdateMessageSendFailed represents TL type `updateMessageSendFailed#c277ce5d`. +// UpdateMessageSendFailed represents TL type `updateMessageSendFailed#da1bf8e7`. type UpdateMessageSendFailed struct { // The failed to send message Message Message // The previous temporary message identifier OldMessageID int64 - // An error code - ErrorCode int32 - // Error message - ErrorMessage string + // The cause of the message sending failure + Error Error } // UpdateMessageSendFailedTypeID is TL type id of UpdateMessageSendFailed. -const UpdateMessageSendFailedTypeID = 0xc277ce5d +const UpdateMessageSendFailedTypeID = 0xda1bf8e7 // construct implements constructor of UpdateClass. func (u UpdateMessageSendFailed) construct() UpdateClass { return &u } @@ -812,10 +810,7 @@ func (u *UpdateMessageSendFailed) Zero() bool { if !(u.OldMessageID == 0) { return false } - if !(u.ErrorCode == 0) { - return false - } - if !(u.ErrorMessage == "") { + if !(u.Error.Zero()) { return false } @@ -863,12 +858,8 @@ func (u *UpdateMessageSendFailed) TypeInfo() tdp.Type { SchemaName: "old_message_id", }, { - Name: "ErrorCode", - SchemaName: "error_code", - }, - { - Name: "ErrorMessage", - SchemaName: "error_message", + Name: "Error", + SchemaName: "error", }, } return typ @@ -877,7 +868,7 @@ func (u *UpdateMessageSendFailed) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (u *UpdateMessageSendFailed) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateMessageSendFailed#c277ce5d as nil") + return fmt.Errorf("can't encode updateMessageSendFailed#da1bf8e7 as nil") } b.PutID(UpdateMessageSendFailedTypeID) return u.EncodeBare(b) @@ -886,24 +877,25 @@ func (u *UpdateMessageSendFailed) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *UpdateMessageSendFailed) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateMessageSendFailed#c277ce5d as nil") + return fmt.Errorf("can't encode updateMessageSendFailed#da1bf8e7 as nil") } if err := u.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateMessageSendFailed#c277ce5d: field message: %w", err) + return fmt.Errorf("unable to encode updateMessageSendFailed#da1bf8e7: field message: %w", err) } b.PutInt53(u.OldMessageID) - b.PutInt32(u.ErrorCode) - b.PutString(u.ErrorMessage) + if err := u.Error.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateMessageSendFailed#da1bf8e7: field error: %w", err) + } return nil } // Decode implements bin.Decoder. func (u *UpdateMessageSendFailed) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateMessageSendFailed#c277ce5d to nil") + return fmt.Errorf("can't decode updateMessageSendFailed#da1bf8e7 to nil") } if err := b.ConsumeID(UpdateMessageSendFailedTypeID); err != nil { - return fmt.Errorf("unable to decode updateMessageSendFailed#c277ce5d: %w", err) + return fmt.Errorf("unable to decode updateMessageSendFailed#da1bf8e7: %w", err) } return u.DecodeBare(b) } @@ -911,33 +903,24 @@ func (u *UpdateMessageSendFailed) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *UpdateMessageSendFailed) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateMessageSendFailed#c277ce5d to nil") + return fmt.Errorf("can't decode updateMessageSendFailed#da1bf8e7 to nil") } { if err := u.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateMessageSendFailed#c277ce5d: field message: %w", err) + return fmt.Errorf("unable to decode updateMessageSendFailed#da1bf8e7: field message: %w", err) } } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateMessageSendFailed#c277ce5d: field old_message_id: %w", err) + return fmt.Errorf("unable to decode updateMessageSendFailed#da1bf8e7: field old_message_id: %w", err) } u.OldMessageID = value } { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateMessageSendFailed#c277ce5d: field error_code: %w", err) - } - u.ErrorCode = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateMessageSendFailed#c277ce5d: field error_message: %w", err) + if err := u.Error.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateMessageSendFailed#da1bf8e7: field error: %w", err) } - u.ErrorMessage = value } return nil } @@ -945,24 +928,23 @@ func (u *UpdateMessageSendFailed) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UpdateMessageSendFailed) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateMessageSendFailed#c277ce5d as nil") + return fmt.Errorf("can't encode updateMessageSendFailed#da1bf8e7 as nil") } b.ObjStart() b.PutID("updateMessageSendFailed") b.Comma() b.FieldStart("message") if err := u.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateMessageSendFailed#c277ce5d: field message: %w", err) + return fmt.Errorf("unable to encode updateMessageSendFailed#da1bf8e7: field message: %w", err) } b.Comma() b.FieldStart("old_message_id") b.PutInt53(u.OldMessageID) b.Comma() - b.FieldStart("error_code") - b.PutInt32(u.ErrorCode) - b.Comma() - b.FieldStart("error_message") - b.PutString(u.ErrorMessage) + b.FieldStart("error") + if err := u.Error.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateMessageSendFailed#da1bf8e7: field error: %w", err) + } b.Comma() b.StripComma() b.ObjEnd() @@ -972,37 +954,29 @@ func (u *UpdateMessageSendFailed) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UpdateMessageSendFailed) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateMessageSendFailed#c277ce5d to nil") + return fmt.Errorf("can't decode updateMessageSendFailed#da1bf8e7 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("updateMessageSendFailed"); err != nil { - return fmt.Errorf("unable to decode updateMessageSendFailed#c277ce5d: %w", err) + return fmt.Errorf("unable to decode updateMessageSendFailed#da1bf8e7: %w", err) } case "message": if err := u.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateMessageSendFailed#c277ce5d: field message: %w", err) + return fmt.Errorf("unable to decode updateMessageSendFailed#da1bf8e7: field message: %w", err) } case "old_message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateMessageSendFailed#c277ce5d: field old_message_id: %w", err) + return fmt.Errorf("unable to decode updateMessageSendFailed#da1bf8e7: field old_message_id: %w", err) } u.OldMessageID = value - case "error_code": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateMessageSendFailed#c277ce5d: field error_code: %w", err) - } - u.ErrorCode = value - case "error_message": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateMessageSendFailed#c277ce5d: field error_message: %w", err) + case "error": + if err := u.Error.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode updateMessageSendFailed#da1bf8e7: field error: %w", err) } - u.ErrorMessage = value default: return b.Skip() } @@ -1026,20 +1000,12 @@ func (u *UpdateMessageSendFailed) GetOldMessageID() (value int64) { return u.OldMessageID } -// GetErrorCode returns value of ErrorCode field. -func (u *UpdateMessageSendFailed) GetErrorCode() (value int32) { - if u == nil { - return - } - return u.ErrorCode -} - -// GetErrorMessage returns value of ErrorMessage field. -func (u *UpdateMessageSendFailed) GetErrorMessage() (value string) { +// GetError returns value of Error field. +func (u *UpdateMessageSendFailed) GetError() (value Error) { if u == nil { return } - return u.ErrorMessage + return u.Error } // UpdateMessageContent represents TL type `updateMessageContent#1e36bb24`. @@ -16299,20 +16265,18 @@ func (u *UpdateStorySendSucceeded) GetOldStoryID() (value int32) { return u.OldStoryID } -// UpdateStorySendFailed represents TL type `updateStorySendFailed#4418bca2`. +// UpdateStorySendFailed represents TL type `updateStorySendFailed#e046f199`. type UpdateStorySendFailed struct { // The failed to send story Story Story - // The cause of the failure; may be null if unknown - Error CanSendStoryResultClass - // An error code - ErrorCode int32 - // Error message - ErrorMessage string + // The cause of the story sending failure + Error Error + // Type of the error; may be null if unknown + ErrorType CanSendStoryResultClass } // UpdateStorySendFailedTypeID is TL type id of UpdateStorySendFailed. -const UpdateStorySendFailedTypeID = 0x4418bca2 +const UpdateStorySendFailedTypeID = 0xe046f199 // construct implements constructor of UpdateClass. func (u UpdateStorySendFailed) construct() UpdateClass { return &u } @@ -16334,13 +16298,10 @@ func (u *UpdateStorySendFailed) Zero() bool { if !(u.Story.Zero()) { return false } - if !(u.Error == nil) { + if !(u.Error.Zero()) { return false } - if !(u.ErrorCode == 0) { - return false - } - if !(u.ErrorMessage == "") { + if !(u.ErrorType == nil) { return false } @@ -16388,12 +16349,8 @@ func (u *UpdateStorySendFailed) TypeInfo() tdp.Type { SchemaName: "error", }, { - Name: "ErrorCode", - SchemaName: "error_code", - }, - { - Name: "ErrorMessage", - SchemaName: "error_message", + Name: "ErrorType", + SchemaName: "error_type", }, } return typ @@ -16402,7 +16359,7 @@ func (u *UpdateStorySendFailed) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (u *UpdateStorySendFailed) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateStorySendFailed#4418bca2 as nil") + return fmt.Errorf("can't encode updateStorySendFailed#e046f199 as nil") } b.PutID(UpdateStorySendFailedTypeID) return u.EncodeBare(b) @@ -16411,29 +16368,30 @@ func (u *UpdateStorySendFailed) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *UpdateStorySendFailed) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateStorySendFailed#4418bca2 as nil") + return fmt.Errorf("can't encode updateStorySendFailed#e046f199 as nil") } if err := u.Story.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateStorySendFailed#4418bca2: field story: %w", err) - } - if u.Error == nil { - return fmt.Errorf("unable to encode updateStorySendFailed#4418bca2: field error is nil") + return fmt.Errorf("unable to encode updateStorySendFailed#e046f199: field story: %w", err) } if err := u.Error.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateStorySendFailed#4418bca2: field error: %w", err) + return fmt.Errorf("unable to encode updateStorySendFailed#e046f199: field error: %w", err) + } + if u.ErrorType == nil { + return fmt.Errorf("unable to encode updateStorySendFailed#e046f199: field error_type is nil") + } + if err := u.ErrorType.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateStorySendFailed#e046f199: field error_type: %w", err) } - b.PutInt32(u.ErrorCode) - b.PutString(u.ErrorMessage) return nil } // Decode implements bin.Decoder. func (u *UpdateStorySendFailed) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateStorySendFailed#4418bca2 to nil") + return fmt.Errorf("can't decode updateStorySendFailed#e046f199 to nil") } if err := b.ConsumeID(UpdateStorySendFailedTypeID); err != nil { - return fmt.Errorf("unable to decode updateStorySendFailed#4418bca2: %w", err) + return fmt.Errorf("unable to decode updateStorySendFailed#e046f199: %w", err) } return u.DecodeBare(b) } @@ -16441,33 +16399,24 @@ func (u *UpdateStorySendFailed) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *UpdateStorySendFailed) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateStorySendFailed#4418bca2 to nil") + return fmt.Errorf("can't decode updateStorySendFailed#e046f199 to nil") } { if err := u.Story.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateStorySendFailed#4418bca2: field story: %w", err) - } - } - { - value, err := DecodeCanSendStoryResult(b) - if err != nil { - return fmt.Errorf("unable to decode updateStorySendFailed#4418bca2: field error: %w", err) + return fmt.Errorf("unable to decode updateStorySendFailed#e046f199: field story: %w", err) } - u.Error = value } { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateStorySendFailed#4418bca2: field error_code: %w", err) + if err := u.Error.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateStorySendFailed#e046f199: field error: %w", err) } - u.ErrorCode = value } { - value, err := b.String() + value, err := DecodeCanSendStoryResult(b) if err != nil { - return fmt.Errorf("unable to decode updateStorySendFailed#4418bca2: field error_message: %w", err) + return fmt.Errorf("unable to decode updateStorySendFailed#e046f199: field error_type: %w", err) } - u.ErrorMessage = value + u.ErrorType = value } return nil } @@ -16475,29 +16424,28 @@ func (u *UpdateStorySendFailed) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UpdateStorySendFailed) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateStorySendFailed#4418bca2 as nil") + return fmt.Errorf("can't encode updateStorySendFailed#e046f199 as nil") } b.ObjStart() b.PutID("updateStorySendFailed") b.Comma() b.FieldStart("story") if err := u.Story.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateStorySendFailed#4418bca2: field story: %w", err) + return fmt.Errorf("unable to encode updateStorySendFailed#e046f199: field story: %w", err) } b.Comma() b.FieldStart("error") - if u.Error == nil { - return fmt.Errorf("unable to encode updateStorySendFailed#4418bca2: field error is nil") - } if err := u.Error.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateStorySendFailed#4418bca2: field error: %w", err) + return fmt.Errorf("unable to encode updateStorySendFailed#e046f199: field error: %w", err) } b.Comma() - b.FieldStart("error_code") - b.PutInt32(u.ErrorCode) - b.Comma() - b.FieldStart("error_message") - b.PutString(u.ErrorMessage) + b.FieldStart("error_type") + if u.ErrorType == nil { + return fmt.Errorf("unable to encode updateStorySendFailed#e046f199: field error_type is nil") + } + if err := u.ErrorType.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateStorySendFailed#e046f199: field error_type: %w", err) + } b.Comma() b.StripComma() b.ObjEnd() @@ -16507,37 +16455,29 @@ func (u *UpdateStorySendFailed) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UpdateStorySendFailed) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateStorySendFailed#4418bca2 to nil") + return fmt.Errorf("can't decode updateStorySendFailed#e046f199 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("updateStorySendFailed"); err != nil { - return fmt.Errorf("unable to decode updateStorySendFailed#4418bca2: %w", err) + return fmt.Errorf("unable to decode updateStorySendFailed#e046f199: %w", err) } case "story": if err := u.Story.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateStorySendFailed#4418bca2: field story: %w", err) + return fmt.Errorf("unable to decode updateStorySendFailed#e046f199: field story: %w", err) } case "error": - value, err := DecodeTDLibJSONCanSendStoryResult(b) - if err != nil { - return fmt.Errorf("unable to decode updateStorySendFailed#4418bca2: field error: %w", err) - } - u.Error = value - case "error_code": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateStorySendFailed#4418bca2: field error_code: %w", err) + if err := u.Error.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode updateStorySendFailed#e046f199: field error: %w", err) } - u.ErrorCode = value - case "error_message": - value, err := b.String() + case "error_type": + value, err := DecodeTDLibJSONCanSendStoryResult(b) if err != nil { - return fmt.Errorf("unable to decode updateStorySendFailed#4418bca2: field error_message: %w", err) + return fmt.Errorf("unable to decode updateStorySendFailed#e046f199: field error_type: %w", err) } - u.ErrorMessage = value + u.ErrorType = value default: return b.Skip() } @@ -16554,27 +16494,19 @@ func (u *UpdateStorySendFailed) GetStory() (value Story) { } // GetError returns value of Error field. -func (u *UpdateStorySendFailed) GetError() (value CanSendStoryResultClass) { +func (u *UpdateStorySendFailed) GetError() (value Error) { if u == nil { return } return u.Error } -// GetErrorCode returns value of ErrorCode field. -func (u *UpdateStorySendFailed) GetErrorCode() (value int32) { - if u == nil { - return - } - return u.ErrorCode -} - -// GetErrorMessage returns value of ErrorMessage field. -func (u *UpdateStorySendFailed) GetErrorMessage() (value string) { +// GetErrorType returns value of ErrorType field. +func (u *UpdateStorySendFailed) GetErrorType() (value CanSendStoryResultClass) { if u == nil { return } - return u.ErrorMessage + return u.ErrorType } // UpdateChatActiveStories represents TL type `updateChatActiveStories#79786c2c`. @@ -25669,7 +25601,7 @@ const UpdateClassName = "Update" // case *tdapi.UpdateNewMessage: // updateNewMessage#de6fb20e // case *tdapi.UpdateMessageSendAcknowledged: // updateMessageSendAcknowledged#4da7d239 // case *tdapi.UpdateMessageSendSucceeded: // updateMessageSendSucceeded#6c399d7d -// case *tdapi.UpdateMessageSendFailed: // updateMessageSendFailed#c277ce5d +// case *tdapi.UpdateMessageSendFailed: // updateMessageSendFailed#da1bf8e7 // case *tdapi.UpdateMessageContent: // updateMessageContent#1e36bb24 // case *tdapi.UpdateMessageEdited: // updateMessageEdited#dea602e6 // case *tdapi.UpdateMessageIsPinned: // updateMessageIsPinned#41bc233d @@ -25741,7 +25673,7 @@ const UpdateClassName = "Update" // case *tdapi.UpdateStory: // updateStory#1906572f // case *tdapi.UpdateStoryDeleted: // updateStoryDeleted#7007eb9d // case *tdapi.UpdateStorySendSucceeded: // updateStorySendSucceeded#b9269e57 -// case *tdapi.UpdateStorySendFailed: // updateStorySendFailed#4418bca2 +// case *tdapi.UpdateStorySendFailed: // updateStorySendFailed#e046f199 // case *tdapi.UpdateChatActiveStories: // updateChatActiveStories#79786c2c // case *tdapi.UpdateStoryListChatCount: // updateStoryListChatCount#8833cd3f // case *tdapi.UpdateStoryStealthMode: // updateStoryStealthMode#6ff7bd1a @@ -25842,7 +25774,7 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { } return &v, nil case UpdateMessageSendFailedTypeID: - // Decoding updateMessageSendFailed#c277ce5d. + // Decoding updateMessageSendFailed#da1bf8e7. v := UpdateMessageSendFailed{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) @@ -26346,7 +26278,7 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { } return &v, nil case UpdateStorySendFailedTypeID: - // Decoding updateStorySendFailed#4418bca2. + // Decoding updateStorySendFailed#e046f199. v := UpdateStorySendFailed{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) @@ -26673,7 +26605,7 @@ func DecodeTDLibJSONUpdate(buf tdjson.Decoder) (UpdateClass, error) { } return &v, nil case "updateMessageSendFailed": - // Decoding updateMessageSendFailed#c277ce5d. + // Decoding updateMessageSendFailed#da1bf8e7. v := UpdateMessageSendFailed{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) @@ -27177,7 +27109,7 @@ func DecodeTDLibJSONUpdate(buf tdjson.Decoder) (UpdateClass, error) { } return &v, nil case "updateStorySendFailed": - // Decoding updateStorySendFailed#4418bca2. + // Decoding updateStorySendFailed#e046f199. v := UpdateStorySendFailed{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)