diff --git a/_schema/tdapi.tl b/_schema/tdapi.tl index 9c7f025a30..6dbe7750b2 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: 6c47328011c26b2e8305ae7fee0b791a91ee5555f8a57fefb41a879974ca221d +// SHA256: 1c0e24ffba9d393c5dd25aee81b4fa2629fca3e208938d67c66cb8e5541e6655 double#2210c154 ? = Double; @@ -613,6 +613,26 @@ botCommands#4f9aa2c5 bot_user_id:int53 commands:vector = BotCommands //@url URL of a Web App to open when the button is pressed. If the link is of the type internalLinkTypeWebApp, then it must be processed accordingly. Otherwise, the link must be passed to openWebApp botMenuButton#c7b57ce6 text:string url:string = BotMenuButton; +//@description Describes parameters of verification that is provided by a bot +//@icon_custom_emoji_id Identifier of the custom emoji that is used as the verification sign +//@organization_name Name of the organization that provides verification +//@default_custom_description Default custom description of verification reason to be used as placeholder in setMessageSenderBotVerification; may be null if none +//@can_set_custom_description True, if the bot is allowed to provide custom description for verified entities +botVerificationParameters#d4dca55f icon_custom_emoji_id:int64 organization_name:string default_custom_description:formattedText can_set_custom_description:Bool = BotVerificationParameters; + +//@description Describes verification status provided by a bot +//@bot_user_id Identifier of the bot that provided the verification +//@icon_custom_emoji_id Identifier of the custom emoji that is used as the verification sign +//@custom_description Custom description of verification reason set by the bot +botVerification#b160b6f2 bot_user_id:int53 icon_custom_emoji_id:int64 custom_description:formattedText = BotVerification; + +//@description Contains information about verification status of a chat or a user +//@is_verified True, if the chat or the user is verified by Telegram +//@is_scam True, if the chat or the user is marked as scam by Telegram +//@is_fake True, if the chat or the user is marked as fake by Telegram +//@bot_verification_icon_custom_emoji_id Identifier of the custom emoji to be shown as verification sign provided by a bot for the user; 0 if none +verificationStatus#3ae6a18c is_verified:Bool is_scam:Bool is_fake:Bool bot_verification_icon_custom_emoji_id:int64 = VerificationStatus; + //@description Represents a location to which a chat is connected //@location The location //@address Location address; 1-64 characters, as defined by the chat owner @@ -862,6 +882,19 @@ starSubscription#3a3811f5 id:string chat_id:int53 expiration_date:int32 is_cance //@next_offset The offset for the next request. If empty, then there are no more results starSubscriptions#a2f27c8d star_amount:starAmount subscriptions:vector required_star_count:int53 next_offset:string = StarSubscriptions; +//@class AffiliateType @description Describes type of affiliate for an affiliate program + +//@description The affiliate is the current user +affiliateTypeCurrentUser#56a701f5 = AffiliateType; + +//@description The affiliate is a bot owned by the current user +//@user_id User identifier of the bot +affiliateTypeBot#c273f840 user_id:int53 = AffiliateType; + +//@description The affiliate is a channel chat where the current user has can_post_messages administrator right +//@chat_id Identifier of the channel chat +affiliateTypeChannel#d73be869 chat_id:int53 = AffiliateType; + //@class AffiliateProgramSortOrder @description Describes the order of the found affiliate programs //@description The affiliate programs must be sorted by the profitability @@ -892,8 +925,8 @@ affiliateInfo#b1c1dcfa commission_per_mille:int32 affiliate_chat_id:int53 star_a //@description Describes a found affiliate program //@bot_user_id User identifier of the bot created the program -//@parameters Information about the affiliate program -foundAffiliateProgram#80bf7012 bot_user_id:int53 parameters:affiliateProgramInfo = FoundAffiliateProgram; +//@info Information about the affiliate program +foundAffiliateProgram#c6636286 bot_user_id:int53 info:affiliateProgramInfo = FoundAffiliateProgram; //@description Represents a list of found affiliate programs //@total_count The total number of found affiliate programs @@ -901,7 +934,7 @@ foundAffiliateProgram#80bf7012 bot_user_id:int53 parameters:affiliateProgramInfo //@next_offset The offset for the next request. If empty, then there are no more results foundAffiliatePrograms#b6228108 total_count:int32 programs:vector next_offset:string = FoundAffiliatePrograms; -//@description Describes an affiliate program that was connected to a chat +//@description Describes an affiliate program that was connected to an affiliate //@url The link that can be used to refer users if the program is still active //@bot_user_id User identifier of the bot created the program //@parameters The parameters of the affiliate program @@ -909,13 +942,13 @@ foundAffiliatePrograms#b6228108 total_count:int32 programs:vector next_offset:string = ChatAffiliatePrograms; +connectedAffiliatePrograms#59231e33 total_count:int32 programs:vector next_offset:string = ConnectedAffiliatePrograms; //@description Contains information about a product that can be paid with invoice //@title Product title @@ -997,32 +1030,98 @@ starGiveawayPaymentOption#bca2d5e5 currency:string amount:int53 star_count:int53 //@options The list of options starGiveawayPaymentOptions#909fbf18 options:vector = StarGiveawayPaymentOptions; +//@description Describes a model of an upgraded gift +//@name Name of the model +//@sticker The sticker representing the upgraded gift +//@rarity_per_mille The number of upgraded gift that receive this model for each 1000 gifts upgraded +upgradedGiftModel#5112584f name:string sticker:sticker rarity_per_mille:int32 = UpgradedGiftModel; + +//@description Describes a symbol shown on the pattern of an upgraded gift +//@name Name of the symbol +//@sticker The sticker representing the upgraded gift +//@rarity_per_mille The number of upgraded gift that receive this symbol for each 1000 gifts upgraded +upgradedGiftSymbol#4340c5af name:string sticker:sticker rarity_per_mille:int32 = UpgradedGiftSymbol; + +//@description Describes a backdrop of an upgraded gift +//@name Name of the backdrop +//@center_color A color in the center of the backdrop in the RGB format +//@edge_color A color on the edges of the backdrop in the RGB format +//@symbol_color A color to be applied for the symbol in the RGB format +//@text_color A color for the text on the backdrop in the RGB format +//@rarity_per_mille The number of upgraded gift that receive this backdrop for each 1000 gifts upgraded +upgradedGiftBackdrop#fc371c7e name:string center_color:int32 edge_color:int32 symbol_color:int32 text_color:int32 rarity_per_mille:int32 = UpgradedGiftBackdrop; + +//@description Describes the original details about the gift +//@sender_user_id Identifier of the user that sent the gift; 0 if the gift was private +//@receiver_user_id Identifier of the user that received the gift +//@text Message added to the gift +//@date Point in time (Unix timestamp) when the gift was sent +upgradedGiftOriginalDetails#44d2b2dd sender_user_id:int53 receiver_user_id:int53 text:formattedText date:int32 = UpgradedGiftOriginalDetails; + //@description Describes a gift that can be sent to another user //@id Unique identifier of the gift //@sticker The sticker representing the gift //@star_count Number of Telegram Stars that must be paid for the gift -//@default_sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed +//@default_sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed +//@upgrade_star_count Number of Telegram Stars that must be paid to upgrade the gift; 0 if upgrade isn't possible //@is_for_birthday True, if the gift is a birthday gift //@remaining_count Number of remaining times the gift can be purchased by all users; 0 if not limited or the gift was sold out //@total_count Number of total times the gift can be purchased by all users; 0 if not limited //@first_send_date Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only //@last_send_date Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only -gift#d3284cce id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; +gift#7cf9442d id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; //@description Contains a list of gifts that can be sent to another user //@gifts The list of gifts gifts#7ea494b8 gifts:vector = Gifts; +//@description Describes an upgraded gift that can be gifted to another user or transferred to TON blockchain as an NFT +//@id Unique identifier of the gift +//@title The title of the upgraded gift +//@number Unique number of the upgraded gift among gifts upgraded from the same gift +//@total_upgraded_count Total number of gifts that were upgraded from the same gift +//@max_upgraded_count The maximum number of gifts that can be upgraded from the same gift +//@owner_user_id User identifier of the user that owns the upgraded gift; 0 if none +//@model Model of the upgraded gift +//@symbol Symbol of the upgraded gift +//@backdrop Backdrop of the upgraded gift +//@original_details Information about the originally sent gift; may be null if unknown +upgradedGift#e5f50e98 id:int64 title:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_user_id:int53 model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails = UpgradedGift; + +//@description Contains result of gift upgrading +//@gift The upgraded gift +//@is_saved True, if the gift is displayed on the user's profile page +//@can_be_transferred True, if the gift can be transferred to another user +//@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift +//@export_date Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as an NFT +upgradeGiftResult#3d9e8331 gift:upgradedGift is_saved:Bool can_be_transferred:Bool transfer_star_count:int53 export_date:int32 = UpgradeGiftResult; + +//@class SentGift @description Represents a gift received by a user + +//@description Regular gift +//@gift The gift +sentGiftRegular#2368ad19 gift:gift = SentGift; + +//@description Upgraded gift +//@gift The gift +sentGiftUpgraded#25674480 gift:upgradedGift = SentGift; + //@description Represents a gift received by a user //@sender_user_id Identifier of the user that sent the gift; 0 if unknown //@text Message added to the gift //@is_private True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone are able to see them -//@is_saved True, if the gift is displayed on the user's profile page; may be false only for the receiver of the gift +//@is_saved True, if the gift is displayed on the user's profile page; only for the receiver of the gift +//@can_be_upgraded True, if the gift is a regular gift that can be upgraded to a unique gift; only for the receiver of the gift +//@can_be_transferred True, if the gift is an upgraded gift that can be transferred to another user; only for the receiver of the gift +//@was_refunded True, if the gift was refunded and isn't available anymore //@date Point in time (Unix timestamp) when the gift was sent //@gift The gift -//@message_id Identifier of the message with the gift in the chat with the sender of the gift; can be 0 or an identifier of a deleted message; only for the gift receiver -//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the gift; 0 if the gift can't be sold by the current user -userGift#494eb721 sender_user_id:int53 text:formattedText is_private:Bool is_saved:Bool date:int32 gift:gift message_id:int53 sell_star_count:int53 = UserGift; +//@message_id Identifier of the message with the gift in the chat with the sender of the gift; can be 0 or an identifier of a deleted message; only for the receiver of the gift +//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the current user +//@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift +//@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift +//@export_date Point in time (Unix timestamp) when the upgraded gift can be transferred to TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift +userGift#a39db860 sender_user_id:int53 text:formattedText is_private:Bool is_saved:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift message_id:int53 sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 export_date:int32 = UserGift; //@description Represents a list of gifts received by a user //@total_count The total number of received gifts @@ -1030,6 +1129,12 @@ userGift#494eb721 sender_user_id:int53 text:formattedText is_private:Bool is_sav //@next_offset The offset for the next request. If empty, then there are no more results userGifts#e274219f total_count:int32 gifts:vector next_offset:string = UserGifts; +//@description Contains examples of possible upgraded gifts for the given regular gift +//@models Examples of possible models that can be chosen for the gift after upgrade +//@symbols Examples of possible symbols that can be chosen for the gift after upgrade +//@backdrops Examples of possible backdrops that can be chosen for the gift after upgrade +giftUpgradePreview#4319deef models:vector symbols:vector backdrops:vector = GiftUpgradePreview; + //@class StarTransactionDirection @description Describes direction of a transaction with Telegram Stars //@description The transaction is incoming and increases the number of owned Telegram Stars @@ -1133,16 +1238,25 @@ starTransactionTypeChannelSubscriptionPurchase#380eb3d1 chat_id:int53 subscripti //@subscription_period The number of seconds between consecutive Telegram Star debitings starTransactionTypeChannelSubscriptionSale#fe127c82 user_id:int53 subscription_period:int32 = StarTransactionType; -//@description The transaction is a purchase of a gift to another user; for regular users and bots only +//@description The transaction is a purchase of a regular gift to another user; for regular users and bots only //@user_id Identifier of the user that received the gift //@gift The gift starTransactionTypeGiftPurchase#ef5f1d52 user_id:int53 gift:gift = StarTransactionType; +//@description The transaction is a transfer of an upgraded gift to another user; for regular users only +//@user_id Identifier of the user that received the gift +//@gift The gift +starTransactionTypeGiftTransfer#ef323c55 user_id:int53 gift:upgradedGift = StarTransactionType; + //@description The transaction is a sale of a gift received from another user or bot; for regular users only //@user_id Identifier of the user that sent the gift //@gift The gift starTransactionTypeGiftSale#64d61157 user_id:int53 gift:gift = StarTransactionType; +//@description The transaction is an upgrade of a gift; for regular users only +//@gift The upgraded gift +starTransactionTypeGiftUpgrade#2697844b gift:upgradedGift = StarTransactionType; + //@description The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only //@chat_id Identifier of the channel chat //@message_id Identifier of the reacted message; can be 0 or an identifier of a deleted message @@ -1277,12 +1391,10 @@ usernames#bf343063 active_usernames:vector disabled_usernames:vector disabled_usernames:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights affiliate_program:affiliateProgramInfo web_app_background_light_color:int32 web_app_background_dark_color:int32 web_app_header_light_color:int32 web_app_header_dark_color:int32 can_get_revenue_statistics:Bool can_manage_emoji_status:Bool has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; +botInfo#d16edb85 short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights affiliate_program:affiliateProgramInfo web_app_background_light_color:int32 web_app_background_dark_color:int32 web_app_header_light_color:int32 web_app_header_dark_color:int32 verification_parameters:botVerificationParameters can_get_revenue_statistics:Bool can_manage_emoji_status:Bool has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; //@description Contains full information about a user //@personal_photo User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. @@ -1335,9 +1448,10 @@ botInfo#80eb0e42 short_description:string description:string photo:photo animati //@personal_chat_id Identifier of the personal chat of the user; 0 if none //@gift_count Number of gifts saved to profile by the user //@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user +//@bot_verification Information about verification status of the user provided by a bot; may be null if none or unknown //@business_info Information about business settings for Telegram Business accounts; may be null if none //@bot_info For bots, information about the bot; may be null if the user isn't a bot -userFullInfo#85d0c905 personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 gift_count:int32 group_in_common_count:int32 business_info:businessInfo bot_info:botInfo = UserFullInfo; +userFullInfo#ae9201c2 personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 gift_count:int32 group_in_common_count:int32 bot_verification:botVerification business_info:businessInfo bot_info:botInfo = UserFullInfo; //@description Represents a list of users //@total_count Approximate total number of users found @@ -1532,10 +1646,8 @@ chatInviteLinkSubscriptionInfo#38cf7368 pricing:starSubscriptionPricing can_reus //@subscription_info Information about subscription plan that must be paid by the user to use the link; may be null if the link doesn't require subscription //@creates_join_request True, if the link only creates join request //@is_public True, if the chat is a public supergroup or channel, i.e. it has a username or it is a location-based supergroup -//@is_verified True, if the chat is verified -//@is_scam True, if many users reported this chat as a scam -//@is_fake True, if many users reported this chat as a fake account -chatInviteLinkInfo#95bf0ec4 chat_id:int53 accessible_for:int32 type:InviteLinkChatType title:string photo:chatPhotoInfo accent_color_id:int32 description:string member_count:int32 member_user_ids:vector subscription_info:chatInviteLinkSubscriptionInfo creates_join_request:Bool is_public:Bool is_verified:Bool is_scam:Bool is_fake:Bool = ChatInviteLinkInfo; +//@verification_status Information about verification status of the chat; may be null if none +chatInviteLinkInfo#c3fe73a chat_id:int53 accessible_for:int32 type:InviteLinkChatType title:string photo:chatPhotoInfo accent_color_id:int32 description:string member_count:int32 member_user_ids:vector subscription_info:chatInviteLinkSubscriptionInfo creates_join_request:Bool is_public:Bool verification_status:verificationStatus = ChatInviteLinkInfo; //@description Describes a user that sent a join request and waits for administrator approval //@user_id User identifier @@ -1589,14 +1701,12 @@ basicGroupFullInfo#d62e521e photo:chatPhoto description:string creator_user_id:i //@is_channel True, if the supergroup is a channel //@is_broadcast_group True, if the supergroup is a broadcast group, i.e. only administrators can send messages and there is no limit on the number of members //@is_forum True, if the supergroup is a forum with topics -//@is_verified True, if the supergroup or channel is verified +//@verification_status Information about verification status of the supergroup or channel; may be null if none //@has_sensitive_content True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted -//@is_scam True, if many users reported this supergroup or channel as a scam -//@is_fake True, if many users reported this supergroup or channel as a fake account //@has_active_stories True, if the supergroup or channel has non-expired stories available to the current user //@has_unread_active_stories True, if the supergroup or channel has unread non-expired stories available to the current user -supergroup#ca7c2ce id:int53 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender: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 has_sensitive_content:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; +supergroup#9ebc0c42 id:int53 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender: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 verification_status:verificationStatus has_sensitive_content:Bool restriction_reason:string 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 @@ -1630,9 +1740,10 @@ supergroup#ca7c2ce id:int53 usernames:usernames date:int32 status:ChatMemberStat //@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 +//@bot_verification Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown //@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#1ea45bb 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_enable_paid_reaction:Bool 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_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo#f763d79d 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_enable_paid_reaction:Bool 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_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -2165,8 +2276,13 @@ chatTypeSecret#3366ab31 secret_chat_id:int32 user_id:int53 = ChatType; //@name The chosen icon name for short folder representation; one of "All", "Unread", "Unmuted", "Bots", "Channels", "Groups", "Private", "Custom", "Setup", "Cat", "Crown", chatFolderIcon#f74aa0e6 name:string = ChatFolderIcon; +//@description Describes name of a chat folder +//@text The text of the chat folder name; 1-12 characters without line feeds. May contain only CustomEmoji entities +//@animate_custom_emoji True, if custom emoji in the name must be animated +chatFolderName#ec4d3d9e text:formattedText animate_custom_emoji:Bool = ChatFolderName; + //@description Represents a folder for user chats -//@title The title of the folder; 1-12 characters without line feeds +//@name The name of the folder //@icon The chosen icon for the chat folder; may be null. If null, use getChatFolderDefaultIconName to get default icon name for the folder //@color_id The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is disabled. Can't be changed if folder tags are disabled or the current user doesn't have Telegram Premium subscription //@is_shareable True, if at least one link has been created for the folder @@ -2181,16 +2297,16 @@ chatFolderIcon#f74aa0e6 name:string = ChatFolderIcon; //@include_bots True, if bots need to be included //@include_groups True, if basic groups and supergroups need to be included //@include_channels True, if channels need to be included -chatFolder#65805ba5 title:string icon:chatFolderIcon color_id:int32 is_shareable:Bool pinned_chat_ids:vector included_chat_ids:vector excluded_chat_ids:vector exclude_muted:Bool exclude_read:Bool exclude_archived:Bool include_contacts:Bool include_non_contacts:Bool include_bots:Bool include_groups:Bool include_channels:Bool = ChatFolder; +chatFolder#a2e17d38 name:chatFolderName icon:chatFolderIcon color_id:int32 is_shareable:Bool pinned_chat_ids:vector included_chat_ids:vector excluded_chat_ids:vector exclude_muted:Bool exclude_read:Bool exclude_archived:Bool include_contacts:Bool include_non_contacts:Bool include_bots:Bool include_groups:Bool include_channels:Bool = ChatFolder; //@description Contains basic information about a chat folder //@id Unique chat folder identifier -//@title The title of the folder; 1-12 characters without line feeds +//@name The name of the folder //@icon The chosen or default icon for the chat folder //@color_id The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is disabled //@is_shareable True, if at least one link has been created for the folder //@has_my_invite_links True, if the chat folder has invite links created by the current user -chatFolderInfo#b61a485 id:int32 title:string icon:chatFolderIcon color_id:int32 is_shareable:Bool has_my_invite_links:Bool = ChatFolderInfo; +chatFolderInfo#309c140d id:int32 name:chatFolderName icon:chatFolderIcon color_id:int32 is_shareable:Bool has_my_invite_links:Bool = ChatFolderInfo; //@description Contains a chat folder invite link //@invite_link The chat folder invite link @@ -4098,14 +4214,34 @@ messageGiftedStars#41bdbea7 gifter_user_id:int53 receiver_user_id:int53 currency //@sticker A sticker to be shown in the message; may be null if unknown messageGiveawayPrizeStars#aa0f5de3 star_count:int53 transaction_id:string boosted_chat_id:int53 giveaway_message_id:int53 is_unclaimed:Bool sticker:sticker = MessageContent; -//@description A gift was received or sent by the current user +//@description A regular gift was received or sent by the current user //@gift The gift //@text Message added to the gift -//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the gift; 0 if the gift can't be sold by the receiver +//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the receiver +//@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift //@is_private True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them //@is_saved True, if the gift is displayed on the user's profile page; only for the receiver of the gift +//@can_be_upgraded True, if the gift can be upgraded to a unique gift; only for the receiver of the gift //@was_converted True, if the gift was converted to Telegram Stars; only for the receiver of the gift -messageGift#982ec167 gift:gift text:formattedText sell_star_count:int53 is_private:Bool is_saved:Bool was_converted:Bool = MessageContent; +//@was_upgraded True, if the gift was upgraded to a unique gift +//@was_refunded True, if the gift was refunded and isn't available anymore +//@upgrade_message_id Identifier of the service message messageUpgradedGift or messageRefundedUpgradedGift with upgraded version of the gift; can be 0 if none or an identifier of a deleted message. +messageGift#621a3876 gift:gift text:formattedText sell_star_count:int53 prepaid_upgrade_star_count:int53 is_private:Bool is_saved:Bool can_be_upgraded:Bool was_converted:Bool was_upgraded:Bool was_refunded:Bool upgrade_message_id:int53 = MessageContent; + +//@description An upgraded gift was received or sent by the current user +//@gift The gift +//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift +//@is_saved True, if the gift is displayed on the user's profile page; only for the receiver of the gift +//@can_be_transferred True, if the gift can be transferred to another user; only for the receiver of the gift +//@was_transferred True, if the gift was transferred to another user; only for the receiver of the gift +//@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift +//@export_date Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift +messageUpgradedGift#4932f215 gift:upgradedGift is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool transfer_star_count:int53 export_date:int32 = MessageContent; + +//@description A gift which purchase, upgrade or transfer were refunded +//@gift The gift +//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift +messageRefundedUpgradedGift#d373886d gift:gift is_upgrade:Bool = MessageContent; //@description A contact has registered with Telegram messageContactRegistered#a678fcff = MessageContent; @@ -4529,6 +4665,17 @@ searchMessagesFilterFailedToSend#dc74d6fc = SearchMessagesFilter; //@description Returns only pinned messages searchMessagesFilterPinned#16294d48 = SearchMessagesFilter; +//@class SearchMessagesChatTypeFilter @description Represents a filter for type of the chats in which to search messages + +//@description Returns only messages in private chats +searchMessagesChatTypeFilterPrivate#45b152cf = SearchMessagesChatTypeFilter; + +//@description Returns only messages in basic group and supergroup chats +searchMessagesChatTypeFilterGroup#853fa71a = SearchMessagesChatTypeFilter; + +//@description Returns only messages in channel chats +searchMessagesChatTypeFilterChannel#d1e4b6d5 = SearchMessagesChatTypeFilter; + //@class ChatAction @description Describes the different types of activity in a chat //@description The user is typing a message @@ -5137,6 +5284,10 @@ callDiscardReasonDisconnected#aff563a2 = CallDiscardReason; //@description The call was ended because one of the parties hung up callDiscardReasonHungUp#1a1ea5e6 = CallDiscardReason; +//@description The call was ended because it has been used successfully to transfer private encryption key for the associated group call +//@encrypted_group_call_key Encrypted using the call private key encryption key for the associated group call +callDiscardReasonAllowGroupCall#af177fd5 encrypted_group_call_key:bytes = CallDiscardReason; + //@description Specifies the supported call protocols //@udp_p2p True, if UDP peer-to-peer connections are supported //@udp_reflector True, if connection through UDP reflectors is supported @@ -5331,7 +5482,8 @@ callProblemPixelatedVideo#7e1526d3 = CallProblem; //@is_outgoing True, if the call is outgoing //@is_video True, if the call is a video call //@state Call state -call#36db9764 id:int32 user_id:int53 is_outgoing:Bool is_video:Bool state:CallState = Call; +//@group_call_id Identifier of the group call associated with the call; 0 if the group call isn't created yet. The group call can be received through the method getGroupCall +call#9e0dd8aa id:int32 user_id:int53 is_outgoing:Bool is_video:Bool state:CallState group_call_id:int32 = Call; //@class FirebaseAuthenticationSettings @description Contains settings for Firebase Authentication in the official applications @@ -5546,7 +5698,6 @@ inputInlineQueryResultAnimation#a7335216 id:string title:string thumbnail_url:st //@description Represents a link to an article or web page //@id Unique identifier of the query result //@url URL of the result, if it exists -//@hide_url True, if the URL must be not shown //@title Title of the result //@param_description A short description of the result //@thumbnail_url URL of the result thumbnail, if it exists @@ -5554,7 +5705,7 @@ inputInlineQueryResultAnimation#a7335216 id:string title:string thumbnail_url:st //@thumbnail_height Thumbnail height, if known //@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null //@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact -inputInlineQueryResultArticle#75a3d10c id:string url:string hide_url:Bool title:string description:string thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; +inputInlineQueryResultArticle#763583bc id:string url:string title:string description:string thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; //@description Represents a link to an MP3 audio file //@id Unique identifier of the query result @@ -5667,11 +5818,10 @@ inputInlineQueryResultVoiceNote#954da949 id:string title:string voice_note_url:s //@description Represents a link to an article or web page //@id Unique identifier of the query result //@url URL of the result, if it exists -//@hide_url True, if the URL must be not shown //@title Title of the result //@param_description A short description of the result //@thumbnail Result thumbnail in JPEG format; may be null -inlineQueryResultArticle#c4c82d9 id:string url:string hide_url:Bool title:string description:string thumbnail:thumbnail = InlineQueryResult; +inlineQueryResultArticle#1016d01a id:string url:string title:string description:string thumbnail:thumbnail = InlineQueryResult; //@description Represents a user contact //@id Unique identifier of the query result @@ -6770,6 +6920,10 @@ pushMessageContentGiveaway#d63e7f8e winner_count:int32 prize:GiveawayPrize is_pi //@star_count Number of Telegram Stars that sender paid for the gift pushMessageContentGift#84a8cd0b star_count:int53 = PushMessageContent; +//@description A message with an upgraded gift +//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift +pushMessageContentUpgradedGift#99fa0ade is_upgrade:Bool = PushMessageContent; + //@description A screenshot of a message in the chat has been taken pushMessageContentScreenshotTaken#cc51ff9 = PushMessageContent; @@ -7812,6 +7966,9 @@ suggestedActionGiftPremiumForChristmas#93b3ee6f = SuggestedAction; //@description Suggests the user to set birthdate suggestedActionSetBirthdate#eabd9b02 = SuggestedAction; +//@description Suggests the user to set profile photo +suggestedActionSetProfilePhoto#9fe23d6b = SuggestedAction; + //@description Suggests the user to extend their expiring Telegram Premium subscription //@manage_premium_subscription_url A URL for managing Telegram Premium subscription suggestedActionExtendPremium#de405cca manage_premium_subscription_url:string = SuggestedAction; @@ -9440,14 +9597,14 @@ searchChatMessages#dfdeb5c6 chat_id:int53 query:string sender_id:MessageSender f //@description Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). //@chat_list Chat list in which to search messages; pass null to search in all chats regardless of their chat list. Only Main and Archive chat lists are supported -//@only_in_channels Pass true to search only for messages in channels //@query Query to search for //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@filter Additional filter for messages to search; pass null to search for all messages. Filters searchMessagesFilterMention, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, searchMessagesFilterFailedToSend, and searchMessagesFilterPinned are unsupported in this function +//@chat_type_filter Additional filter for type of the chat of the searched messages; pass null to search for messages in all chats //@min_date If not 0, the minimum date of the messages to return //@max_date If not 0, the maximum date of the messages to return -searchMessages#31f9c3c9 chat_list:ChatList only_in_channels:Bool query:string offset:string limit:int32 filter:SearchMessagesFilter min_date:int32 max_date:int32 = FoundMessages; +searchMessages#490addb5 chat_list:ChatList query:string offset:string limit:int32 filter:SearchMessagesFilter chat_type_filter:SearchMessagesChatTypeFilter min_date:int32 max_date:int32 = FoundMessages; //@description Searches for messages in secret chats. Returns the results in reverse chronological order. For optimal performance, the number of returned messages is chosen by TDLib //@chat_id Identifier of the chat in which to search. Specify 0 to search in all secret chats @@ -11275,7 +11432,8 @@ processChatJoinRequests#3e823dce chat_id:int53 invite_link:string approve:Bool = //@user_id Identifier of the user to be called //@protocol The call protocols supported by the application //@is_video Pass true to create a video call -createCall#be282e10 user_id:int53 protocol:callProtocol is_video:Bool = CallId; +//@group_call_id Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none; currently, ignored +createCall#b4410c99 user_id:int53 protocol:callProtocol is_video:Bool group_call_id:int32 = CallId; //@description Accepts an incoming call //@call_id Call identifier @@ -11328,6 +11486,10 @@ setVideoChatDefaultParticipant#f1a672b3 chat_id:int53 default_participant_id:Mes //@is_rtmp_stream Pass true to create an RTMP stream instead of an ordinary video chat createVideoChat#7ea4958d chat_id:int53 title:string start_date:int32 is_rtmp_stream:Bool = GroupCallId; +//@description Creates a group call from a one-to-one call +//@call_id Call identifier +createGroupCall#87b855fb call_id:int32 = Ok; + //@description Returns RTMP URL for streaming to the chat; requires can_manage_video_chats administrator right //@chat_id Chat identifier getVideoChatRtmpUrl#482b1b1f chat_id:int53 = RtmpUrl; @@ -12034,6 +12196,17 @@ setBotInfoShortDescription#3a96bae3 bot_user_id:int53 language_code:string short //@language_code A two-letter ISO 639-1 language code or an empty string getBotInfoShortDescription#4a1c2614 bot_user_id:int53 language_code:string = Text; +//@description Changes the verification status of a user or a chat by an owned bot +//@bot_user_id Identifier of the owned bot, which will verify the user or the chat +//@verified_id Identifier of the user or the supergroup or channel chat, which will be verified by the bot +//@custom_description Custom description of verification reason; 0-getOption("bot_verification_custom_description_length_max"). +setMessageSenderBotVerification#b4c1da4a bot_user_id:int53 verified_id:MessageSender custom_description:string = Ok; + +//@description Removes the verification status of a user or a chat by an owned bot +//@bot_user_id Identifier of the owned bot, which verified the user or the chat +//@verified_id Identifier of the user or the supergroup or channel chat, which verification is removed +removeMessageSenderBotVerification#9a10cf5a bot_user_id:int53 verified_id:MessageSender = Ok; + //@description Returns all active sessions of the current user getActiveSessions#42bd6d3e = Sessions; @@ -12227,7 +12400,8 @@ getAvailableGifts#f6d565eb = Gifts; //@user_id Identifier of the user that will receive the gift //@text Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed //@is_private Pass true to show the current user as sender and gift text only to the gift receiver; otherwise, everyone will be able to see them -sendGift#32c9796d gift_id:int64 user_id:int53 text:formattedText is_private:Bool = Ok; +//@pay_for_upgrade Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade it for free +sendGift#13a97db gift_id:int64 user_id:int53 text:formattedText is_private:Bool pay_for_upgrade:Bool = Ok; //@description Sells a gift received by the current user for Telegram Stars //@sender_user_id Identifier of the user that sent the gift @@ -12240,12 +12414,33 @@ sellGift#671b88b4 sender_user_id:int53 message_id:int53 = Ok; //@is_saved Pass true to display the gift on the user's profile page; pass false to remove it from the profile page toggleGiftIsSaved#91c2f183 sender_user_id:int53 message_id:int53 is_saved:Bool = Ok; +//@description Returns examples of possible upgraded gifts for a regular gift +//@gift_id Identifier of the gift +getGiftUpgradePreview#bdcbc25d gift_id:int64 = GiftUpgradePreview; + +//@description Upgrades a gift received by the current user. Unless the gift has prepaid_upgrade_star_count > 0, the user must pay gift.upgrade_star_count Telegram Stars for the upgrade +//@sender_user_id Identifier of the user that sent the gift +//@message_id Identifier of the message with the gift in the chat with the user +//@keep_original_details Pass true to keep the original gift text, sender and receiver in the upgraded gift +upgradeGift#e0c0953e sender_user_id:int53 message_id:int53 keep_original_details:Bool = UpgradeGiftResult; + +//@description Sends a gift upgraded by the current user to another user +//@sender_user_id Identifier of the user that sent the gift +//@message_id Identifier of the message with the upgraded gift in the chat with the user +//@receiver_user_id Identifier of the user that will receive the gift +//@star_count The amount of Telegram Stars required for the transfer +transferGift#7f379a4e sender_user_id:int53 message_id:int53 receiver_user_id:int53 star_count:int53 = Ok; + //@description Returns gifts saved to profile by the given user //@user_id Identifier of the user //@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 gifts to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit getUserGifts#b7cdbc7c user_id:int53 offset:string limit:int32 = UserGifts; +//@description Returns information about a gift received or sent by the current user +//@message_id Identifier of the message with the gift +getUserGift#74e6a939 message_id:int53 = UserGift; + //@description Creates a link for the given invoice; for bots only //@business_connection_id Unique identifier of business connection on behalf of which to send the request //@invoice Information about the invoice of the type inputMessageInvoice @@ -12815,33 +13010,33 @@ setChatAffiliateProgram#e00237 chat_id:int53 parameters:affiliateProgramParamete //@referrer The referrer from an internalLinkTypeChatAffiliateProgram link searchChatAffiliateProgram#b02c09ba username:string referrer:string = Chat; -//@description Searches affiliate programs that can be applied to the given chat -//@chat_id Identifier of the chat for which affiliate programs are searched for. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@description Searches affiliate programs that can be connected to the given affiliate +//@affiliate The affiliate for which affiliate programs are searched for //@sort_order Sort order for the results //@offset Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of affiliate programs to return -searchAffiliatePrograms#617c974c chat_id:int53 sort_order:AffiliateProgramSortOrder offset:string limit:int32 = FoundAffiliatePrograms; +searchAffiliatePrograms#2899a011 affiliate:AffiliateType sort_order:AffiliateProgramSortOrder offset:string limit:int32 = FoundAffiliatePrograms; -//@description Connects an affiliate program to the given chat. Returns information about the connected affiliate program -//@chat_id Identifier of the chat to which the affiliate program will be connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@description Connects an affiliate program to the given affiliate. Returns information about the connected affiliate program +//@affiliate The affiliate to which the affiliate program will be connected //@bot_user_id Identifier of the bot, which affiliate program is connected -connectChatAffiliateProgram#75b163c4 chat_id:int53 bot_user_id:int53 = ChatAffiliateProgram; +connectAffiliateProgram#6306d72c affiliate:AffiliateType bot_user_id:int53 = ConnectedAffiliateProgram; -//@description Disconnects an affiliate program from the given chat and immediately deactivates its referral link. Returns updated information about the disconnected affiliate program -//@chat_id Identifier of the chat for which the affiliate program is connected +//@description Disconnects an affiliate program from the given affiliate and immediately deactivates its referral link. Returns updated information about the disconnected affiliate program +//@affiliate The affiliate to which the affiliate program is connected //@url The referral link of the affiliate program -disconnectChatAffiliateProgram#48ef7257 chat_id:int53 url:string = ChatAffiliateProgram; +disconnectAffiliateProgram#f9b124fc affiliate:AffiliateType url:string = ConnectedAffiliateProgram; -//@description Returns an affiliate program that were connected to the given chat by identifier of the bot that created the program -//@chat_id Identifier of the chat for which the affiliate program was connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@description Returns an affiliate program that were connected to the given affiliate by identifier of the bot that created the program +//@affiliate The affiliate to which the affiliate program will be connected //@bot_user_id Identifier of the bot that created the program -getChatAffiliateProgram#6ec8a39a chat_id:int53 bot_user_id:int53 = ChatAffiliateProgram; +getConnectedAffiliateProgram#9761e770 affiliate:AffiliateType bot_user_id:int53 = ConnectedAffiliateProgram; -//@description Returns affiliate programs that were connected to the given chat -//@chat_id Identifier of the chat for which the affiliate programs were connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@description Returns affiliate programs that were connected to the given affiliate +//@affiliate The affiliate to which the affiliate program were connected //@offset Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of affiliate programs to return -getChatAffiliatePrograms#f9df5251 chat_id:int53 offset:string limit:int32 = ChatAffiliatePrograms; +getConnectedAffiliatePrograms#8b2c5272 affiliate:AffiliateType offset:string limit:int32 = ConnectedAffiliatePrograms; //@description Returns information about features, available to Business users //@source Source of the request; pass null if the method is called from settings or some non-standard source diff --git a/tdapi/tl_affiliate_type_gen.go b/tdapi/tl_affiliate_type_gen.go new file mode 100644 index 0000000000..2af384a568 --- /dev/null +++ b/tdapi/tl_affiliate_type_gen.go @@ -0,0 +1,647 @@ +// 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{} +) + +// AffiliateTypeCurrentUser represents TL type `affiliateTypeCurrentUser#56a701f5`. +type AffiliateTypeCurrentUser struct { +} + +// AffiliateTypeCurrentUserTypeID is TL type id of AffiliateTypeCurrentUser. +const AffiliateTypeCurrentUserTypeID = 0x56a701f5 + +// construct implements constructor of AffiliateTypeClass. +func (a AffiliateTypeCurrentUser) construct() AffiliateTypeClass { return &a } + +// Ensuring interfaces in compile-time for AffiliateTypeCurrentUser. +var ( + _ bin.Encoder = &AffiliateTypeCurrentUser{} + _ bin.Decoder = &AffiliateTypeCurrentUser{} + _ bin.BareEncoder = &AffiliateTypeCurrentUser{} + _ bin.BareDecoder = &AffiliateTypeCurrentUser{} + + _ AffiliateTypeClass = &AffiliateTypeCurrentUser{} +) + +func (a *AffiliateTypeCurrentUser) Zero() bool { + if a == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (a *AffiliateTypeCurrentUser) String() string { + if a == nil { + return "AffiliateTypeCurrentUser(nil)" + } + type Alias AffiliateTypeCurrentUser + return fmt.Sprintf("AffiliateTypeCurrentUser%+v", Alias(*a)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AffiliateTypeCurrentUser) TypeID() uint32 { + return AffiliateTypeCurrentUserTypeID +} + +// TypeName returns name of type in TL schema. +func (*AffiliateTypeCurrentUser) TypeName() string { + return "affiliateTypeCurrentUser" +} + +// TypeInfo returns info about TL type. +func (a *AffiliateTypeCurrentUser) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "affiliateTypeCurrentUser", + ID: AffiliateTypeCurrentUserTypeID, + } + if a == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (a *AffiliateTypeCurrentUser) Encode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode affiliateTypeCurrentUser#56a701f5 as nil") + } + b.PutID(AffiliateTypeCurrentUserTypeID) + return a.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (a *AffiliateTypeCurrentUser) EncodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode affiliateTypeCurrentUser#56a701f5 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (a *AffiliateTypeCurrentUser) Decode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode affiliateTypeCurrentUser#56a701f5 to nil") + } + if err := b.ConsumeID(AffiliateTypeCurrentUserTypeID); err != nil { + return fmt.Errorf("unable to decode affiliateTypeCurrentUser#56a701f5: %w", err) + } + return a.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (a *AffiliateTypeCurrentUser) DecodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode affiliateTypeCurrentUser#56a701f5 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (a *AffiliateTypeCurrentUser) EncodeTDLibJSON(b tdjson.Encoder) error { + if a == nil { + return fmt.Errorf("can't encode affiliateTypeCurrentUser#56a701f5 as nil") + } + b.ObjStart() + b.PutID("affiliateTypeCurrentUser") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (a *AffiliateTypeCurrentUser) DecodeTDLibJSON(b tdjson.Decoder) error { + if a == nil { + return fmt.Errorf("can't decode affiliateTypeCurrentUser#56a701f5 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("affiliateTypeCurrentUser"); err != nil { + return fmt.Errorf("unable to decode affiliateTypeCurrentUser#56a701f5: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// AffiliateTypeBot represents TL type `affiliateTypeBot#c273f840`. +type AffiliateTypeBot struct { + // User identifier of the bot + UserID int64 +} + +// AffiliateTypeBotTypeID is TL type id of AffiliateTypeBot. +const AffiliateTypeBotTypeID = 0xc273f840 + +// construct implements constructor of AffiliateTypeClass. +func (a AffiliateTypeBot) construct() AffiliateTypeClass { return &a } + +// Ensuring interfaces in compile-time for AffiliateTypeBot. +var ( + _ bin.Encoder = &AffiliateTypeBot{} + _ bin.Decoder = &AffiliateTypeBot{} + _ bin.BareEncoder = &AffiliateTypeBot{} + _ bin.BareDecoder = &AffiliateTypeBot{} + + _ AffiliateTypeClass = &AffiliateTypeBot{} +) + +func (a *AffiliateTypeBot) Zero() bool { + if a == nil { + return true + } + if !(a.UserID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (a *AffiliateTypeBot) String() string { + if a == nil { + return "AffiliateTypeBot(nil)" + } + type Alias AffiliateTypeBot + return fmt.Sprintf("AffiliateTypeBot%+v", Alias(*a)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AffiliateTypeBot) TypeID() uint32 { + return AffiliateTypeBotTypeID +} + +// TypeName returns name of type in TL schema. +func (*AffiliateTypeBot) TypeName() string { + return "affiliateTypeBot" +} + +// TypeInfo returns info about TL type. +func (a *AffiliateTypeBot) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "affiliateTypeBot", + ID: AffiliateTypeBotTypeID, + } + if a == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "UserID", + SchemaName: "user_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (a *AffiliateTypeBot) Encode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode affiliateTypeBot#c273f840 as nil") + } + b.PutID(AffiliateTypeBotTypeID) + return a.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (a *AffiliateTypeBot) EncodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode affiliateTypeBot#c273f840 as nil") + } + b.PutInt53(a.UserID) + return nil +} + +// Decode implements bin.Decoder. +func (a *AffiliateTypeBot) Decode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode affiliateTypeBot#c273f840 to nil") + } + if err := b.ConsumeID(AffiliateTypeBotTypeID); err != nil { + return fmt.Errorf("unable to decode affiliateTypeBot#c273f840: %w", err) + } + return a.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (a *AffiliateTypeBot) DecodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode affiliateTypeBot#c273f840 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode affiliateTypeBot#c273f840: field user_id: %w", err) + } + a.UserID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (a *AffiliateTypeBot) EncodeTDLibJSON(b tdjson.Encoder) error { + if a == nil { + return fmt.Errorf("can't encode affiliateTypeBot#c273f840 as nil") + } + b.ObjStart() + b.PutID("affiliateTypeBot") + b.Comma() + b.FieldStart("user_id") + b.PutInt53(a.UserID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (a *AffiliateTypeBot) DecodeTDLibJSON(b tdjson.Decoder) error { + if a == nil { + return fmt.Errorf("can't decode affiliateTypeBot#c273f840 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("affiliateTypeBot"); err != nil { + return fmt.Errorf("unable to decode affiliateTypeBot#c273f840: %w", err) + } + case "user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode affiliateTypeBot#c273f840: field user_id: %w", err) + } + a.UserID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetUserID returns value of UserID field. +func (a *AffiliateTypeBot) GetUserID() (value int64) { + if a == nil { + return + } + return a.UserID +} + +// AffiliateTypeChannel represents TL type `affiliateTypeChannel#d73be869`. +type AffiliateTypeChannel struct { + // Identifier of the channel chat + ChatID int64 +} + +// AffiliateTypeChannelTypeID is TL type id of AffiliateTypeChannel. +const AffiliateTypeChannelTypeID = 0xd73be869 + +// construct implements constructor of AffiliateTypeClass. +func (a AffiliateTypeChannel) construct() AffiliateTypeClass { return &a } + +// Ensuring interfaces in compile-time for AffiliateTypeChannel. +var ( + _ bin.Encoder = &AffiliateTypeChannel{} + _ bin.Decoder = &AffiliateTypeChannel{} + _ bin.BareEncoder = &AffiliateTypeChannel{} + _ bin.BareDecoder = &AffiliateTypeChannel{} + + _ AffiliateTypeClass = &AffiliateTypeChannel{} +) + +func (a *AffiliateTypeChannel) Zero() bool { + if a == nil { + return true + } + if !(a.ChatID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (a *AffiliateTypeChannel) String() string { + if a == nil { + return "AffiliateTypeChannel(nil)" + } + type Alias AffiliateTypeChannel + return fmt.Sprintf("AffiliateTypeChannel%+v", Alias(*a)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AffiliateTypeChannel) TypeID() uint32 { + return AffiliateTypeChannelTypeID +} + +// TypeName returns name of type in TL schema. +func (*AffiliateTypeChannel) TypeName() string { + return "affiliateTypeChannel" +} + +// TypeInfo returns info about TL type. +func (a *AffiliateTypeChannel) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "affiliateTypeChannel", + ID: AffiliateTypeChannelTypeID, + } + if a == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (a *AffiliateTypeChannel) Encode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode affiliateTypeChannel#d73be869 as nil") + } + b.PutID(AffiliateTypeChannelTypeID) + return a.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (a *AffiliateTypeChannel) EncodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode affiliateTypeChannel#d73be869 as nil") + } + b.PutInt53(a.ChatID) + return nil +} + +// Decode implements bin.Decoder. +func (a *AffiliateTypeChannel) Decode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode affiliateTypeChannel#d73be869 to nil") + } + if err := b.ConsumeID(AffiliateTypeChannelTypeID); err != nil { + return fmt.Errorf("unable to decode affiliateTypeChannel#d73be869: %w", err) + } + return a.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (a *AffiliateTypeChannel) DecodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode affiliateTypeChannel#d73be869 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode affiliateTypeChannel#d73be869: field chat_id: %w", err) + } + a.ChatID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (a *AffiliateTypeChannel) EncodeTDLibJSON(b tdjson.Encoder) error { + if a == nil { + return fmt.Errorf("can't encode affiliateTypeChannel#d73be869 as nil") + } + b.ObjStart() + b.PutID("affiliateTypeChannel") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(a.ChatID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (a *AffiliateTypeChannel) DecodeTDLibJSON(b tdjson.Decoder) error { + if a == nil { + return fmt.Errorf("can't decode affiliateTypeChannel#d73be869 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("affiliateTypeChannel"); err != nil { + return fmt.Errorf("unable to decode affiliateTypeChannel#d73be869: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode affiliateTypeChannel#d73be869: field chat_id: %w", err) + } + a.ChatID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (a *AffiliateTypeChannel) GetChatID() (value int64) { + if a == nil { + return + } + return a.ChatID +} + +// AffiliateTypeClassName is schema name of AffiliateTypeClass. +const AffiliateTypeClassName = "AffiliateType" + +// AffiliateTypeClass represents AffiliateType generic type. +// +// Example: +// +// g, err := tdapi.DecodeAffiliateType(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tdapi.AffiliateTypeCurrentUser: // affiliateTypeCurrentUser#56a701f5 +// case *tdapi.AffiliateTypeBot: // affiliateTypeBot#c273f840 +// case *tdapi.AffiliateTypeChannel: // affiliateTypeChannel#d73be869 +// default: panic(v) +// } +type AffiliateTypeClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() AffiliateTypeClass + + // 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 +} + +// DecodeAffiliateType implements binary de-serialization for AffiliateTypeClass. +func DecodeAffiliateType(buf *bin.Buffer) (AffiliateTypeClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case AffiliateTypeCurrentUserTypeID: + // Decoding affiliateTypeCurrentUser#56a701f5. + v := AffiliateTypeCurrentUser{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode AffiliateTypeClass: %w", err) + } + return &v, nil + case AffiliateTypeBotTypeID: + // Decoding affiliateTypeBot#c273f840. + v := AffiliateTypeBot{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode AffiliateTypeClass: %w", err) + } + return &v, nil + case AffiliateTypeChannelTypeID: + // Decoding affiliateTypeChannel#d73be869. + v := AffiliateTypeChannel{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode AffiliateTypeClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode AffiliateTypeClass: %w", bin.NewUnexpectedID(id)) + } +} + +// DecodeTDLibJSONAffiliateType implements binary de-serialization for AffiliateTypeClass. +func DecodeTDLibJSONAffiliateType(buf tdjson.Decoder) (AffiliateTypeClass, error) { + id, err := buf.FindTypeID() + if err != nil { + return nil, err + } + switch id { + case "affiliateTypeCurrentUser": + // Decoding affiliateTypeCurrentUser#56a701f5. + v := AffiliateTypeCurrentUser{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode AffiliateTypeClass: %w", err) + } + return &v, nil + case "affiliateTypeBot": + // Decoding affiliateTypeBot#c273f840. + v := AffiliateTypeBot{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode AffiliateTypeClass: %w", err) + } + return &v, nil + case "affiliateTypeChannel": + // Decoding affiliateTypeChannel#d73be869. + v := AffiliateTypeChannel{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode AffiliateTypeClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode AffiliateTypeClass: %w", tdjson.NewUnexpectedID(id)) + } +} + +// AffiliateType boxes the AffiliateTypeClass providing a helper. +type AffiliateTypeBox struct { + AffiliateType AffiliateTypeClass +} + +// Decode implements bin.Decoder for AffiliateTypeBox. +func (b *AffiliateTypeBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode AffiliateTypeBox to nil") + } + v, err := DecodeAffiliateType(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.AffiliateType = v + return nil +} + +// Encode implements bin.Encode for AffiliateTypeBox. +func (b *AffiliateTypeBox) Encode(buf *bin.Buffer) error { + if b == nil || b.AffiliateType == nil { + return fmt.Errorf("unable to encode AffiliateTypeClass as nil") + } + return b.AffiliateType.Encode(buf) +} + +// DecodeTDLibJSON implements bin.Decoder for AffiliateTypeBox. +func (b *AffiliateTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("unable to decode AffiliateTypeBox to nil") + } + v, err := DecodeTDLibJSONAffiliateType(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.AffiliateType = v + return nil +} + +// EncodeTDLibJSON implements bin.Encode for AffiliateTypeBox. +func (b *AffiliateTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil || b.AffiliateType == nil { + return fmt.Errorf("unable to encode AffiliateTypeClass as nil") + } + return b.AffiliateType.EncodeTDLibJSON(buf) +} diff --git a/tdapi/tl_bot_info_gen.go b/tdapi/tl_bot_info_gen.go index 3b4b67d8d5..3404a3ce0b 100644 --- a/tdapi/tl_bot_info_gen.go +++ b/tdapi/tl_bot_info_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// BotInfo represents TL type `botInfo#80eb0e42`. +// BotInfo represents TL type `botInfo#d16edb85`. type BotInfo struct { // The text that is shown on the bot's profile page and is sent together with the link // when users share the bot @@ -66,6 +66,9 @@ type BotInfo struct { WebAppHeaderLightColor int32 // Default dark header color for bot Web Apps; -1 if not specified WebAppHeaderDarkColor int32 + // Parameters of the verification that can be provided by the bot; may be null if none or + // the current user isn't the owner of the bot + VerificationParameters BotVerificationParameters // True, if the bot's revenue statistics are available to the current user CanGetRevenueStatistics bool // True, if the bot can manage emoji status of the current user @@ -84,7 +87,7 @@ type BotInfo struct { } // BotInfoTypeID is TL type id of BotInfo. -const BotInfoTypeID = 0x80eb0e42 +const BotInfoTypeID = 0xd16edb85 // Ensuring interfaces in compile-time for BotInfo. var ( @@ -140,6 +143,9 @@ func (b *BotInfo) Zero() bool { if !(b.WebAppHeaderDarkColor == 0) { return false } + if !(b.VerificationParameters.Zero()) { + return false + } if !(b.CanGetRevenueStatistics == false) { return false } @@ -253,6 +259,10 @@ func (b *BotInfo) TypeInfo() tdp.Type { Name: "WebAppHeaderDarkColor", SchemaName: "web_app_header_dark_color", }, + { + Name: "VerificationParameters", + SchemaName: "verification_parameters", + }, { Name: "CanGetRevenueStatistics", SchemaName: "can_get_revenue_statistics", @@ -288,7 +298,7 @@ func (b *BotInfo) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (b *BotInfo) Encode(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't encode botInfo#80eb0e42 as nil") + return fmt.Errorf("can't encode botInfo#d16edb85 as nil") } buf.PutID(BotInfoTypeID) return b.EncodeBare(buf) @@ -297,65 +307,68 @@ func (b *BotInfo) Encode(buf *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (b *BotInfo) EncodeBare(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't encode botInfo#80eb0e42 as nil") + return fmt.Errorf("can't encode botInfo#d16edb85 as nil") } buf.PutString(b.ShortDescription) buf.PutString(b.Description) if err := b.Photo.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field photo: %w", err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field photo: %w", err) } if err := b.Animation.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field animation: %w", err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field animation: %w", err) } if err := b.MenuButton.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field menu_button: %w", err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field menu_button: %w", err) } buf.PutInt(len(b.Commands)) for idx, v := range b.Commands { if err := v.EncodeBare(buf); err != nil { - return fmt.Errorf("unable to encode bare botInfo#80eb0e42: field commands element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare botInfo#d16edb85: field commands element with index %d: %w", idx, err) } } buf.PutString(b.PrivacyPolicyURL) if err := b.DefaultGroupAdministratorRights.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field default_group_administrator_rights: %w", err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field default_group_administrator_rights: %w", err) } if err := b.DefaultChannelAdministratorRights.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field default_channel_administrator_rights: %w", err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field default_channel_administrator_rights: %w", err) } if err := b.AffiliateProgram.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field affiliate_program: %w", err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field affiliate_program: %w", err) } buf.PutInt32(b.WebAppBackgroundLightColor) buf.PutInt32(b.WebAppBackgroundDarkColor) buf.PutInt32(b.WebAppHeaderLightColor) buf.PutInt32(b.WebAppHeaderDarkColor) + if err := b.VerificationParameters.Encode(buf); err != nil { + return fmt.Errorf("unable to encode botInfo#d16edb85: field verification_parameters: %w", err) + } buf.PutBool(b.CanGetRevenueStatistics) buf.PutBool(b.CanManageEmojiStatus) buf.PutBool(b.HasMediaPreviews) if b.EditCommandsLink == nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field edit_commands_link is nil") + return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_commands_link is nil") } if err := b.EditCommandsLink.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field edit_commands_link: %w", err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_commands_link: %w", err) } if b.EditDescriptionLink == nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field edit_description_link is nil") + return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_description_link is nil") } if err := b.EditDescriptionLink.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field edit_description_link: %w", err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_description_link: %w", err) } if b.EditDescriptionMediaLink == nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field edit_description_media_link is nil") + return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_description_media_link is nil") } if err := b.EditDescriptionMediaLink.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field edit_description_media_link: %w", err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_description_media_link: %w", err) } if b.EditSettingsLink == nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field edit_settings_link is nil") + return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_settings_link is nil") } if err := b.EditSettingsLink.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field edit_settings_link: %w", err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_settings_link: %w", err) } return nil } @@ -363,10 +376,10 @@ func (b *BotInfo) EncodeBare(buf *bin.Buffer) error { // Decode implements bin.Decoder. func (b *BotInfo) Decode(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't decode botInfo#80eb0e42 to nil") + return fmt.Errorf("can't decode botInfo#d16edb85 to nil") } if err := buf.ConsumeID(BotInfoTypeID); err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: %w", err) } return b.DecodeBare(buf) } @@ -374,41 +387,41 @@ func (b *BotInfo) Decode(buf *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (b *BotInfo) DecodeBare(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't decode botInfo#80eb0e42 to nil") + return fmt.Errorf("can't decode botInfo#d16edb85 to nil") } { value, err := buf.String() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field short_description: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field short_description: %w", err) } b.ShortDescription = value } { value, err := buf.String() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field description: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field description: %w", err) } b.Description = value } { if err := b.Photo.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field photo: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field photo: %w", err) } } { if err := b.Animation.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field animation: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field animation: %w", err) } } { if err := b.MenuButton.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field menu_button: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field menu_button: %w", err) } } { headerLen, err := buf.Int() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field commands: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field commands: %w", err) } if headerLen > 0 { @@ -417,7 +430,7 @@ func (b *BotInfo) DecodeBare(buf *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value BotCommand if err := value.DecodeBare(buf); err != nil { - return fmt.Errorf("unable to decode bare botInfo#80eb0e42: field commands: %w", err) + return fmt.Errorf("unable to decode bare botInfo#d16edb85: field commands: %w", err) } b.Commands = append(b.Commands, value) } @@ -425,99 +438,104 @@ func (b *BotInfo) DecodeBare(buf *bin.Buffer) error { { value, err := buf.String() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field privacy_policy_url: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field privacy_policy_url: %w", err) } b.PrivacyPolicyURL = value } { if err := b.DefaultGroupAdministratorRights.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field default_group_administrator_rights: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field default_group_administrator_rights: %w", err) } } { if err := b.DefaultChannelAdministratorRights.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field default_channel_administrator_rights: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field default_channel_administrator_rights: %w", err) } } { if err := b.AffiliateProgram.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field affiliate_program: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field affiliate_program: %w", err) } } { value, err := buf.Int32() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field web_app_background_light_color: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field web_app_background_light_color: %w", err) } b.WebAppBackgroundLightColor = value } { value, err := buf.Int32() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field web_app_background_dark_color: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field web_app_background_dark_color: %w", err) } b.WebAppBackgroundDarkColor = value } { value, err := buf.Int32() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field web_app_header_light_color: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field web_app_header_light_color: %w", err) } b.WebAppHeaderLightColor = value } { value, err := buf.Int32() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field web_app_header_dark_color: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field web_app_header_dark_color: %w", err) } b.WebAppHeaderDarkColor = value } + { + if err := b.VerificationParameters.Decode(buf); err != nil { + return fmt.Errorf("unable to decode botInfo#d16edb85: field verification_parameters: %w", err) + } + } { value, err := buf.Bool() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field can_get_revenue_statistics: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field can_get_revenue_statistics: %w", err) } b.CanGetRevenueStatistics = value } { value, err := buf.Bool() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field can_manage_emoji_status: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field can_manage_emoji_status: %w", err) } b.CanManageEmojiStatus = value } { value, err := buf.Bool() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field has_media_previews: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field has_media_previews: %w", err) } b.HasMediaPreviews = value } { value, err := DecodeInternalLinkType(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field edit_commands_link: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field edit_commands_link: %w", err) } b.EditCommandsLink = value } { value, err := DecodeInternalLinkType(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field edit_description_link: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field edit_description_link: %w", err) } b.EditDescriptionLink = value } { value, err := DecodeInternalLinkType(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field edit_description_media_link: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field edit_description_media_link: %w", err) } b.EditDescriptionMediaLink = value } { value, err := DecodeInternalLinkType(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field edit_settings_link: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field edit_settings_link: %w", err) } b.EditSettingsLink = value } @@ -527,7 +545,7 @@ func (b *BotInfo) DecodeBare(buf *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (b *BotInfo) EncodeTDLibJSON(buf tdjson.Encoder) error { if b == nil { - return fmt.Errorf("can't encode botInfo#80eb0e42 as nil") + return fmt.Errorf("can't encode botInfo#d16edb85 as nil") } buf.ObjStart() buf.PutID("botInfo") @@ -540,24 +558,24 @@ func (b *BotInfo) EncodeTDLibJSON(buf tdjson.Encoder) error { buf.Comma() buf.FieldStart("photo") if err := b.Photo.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field photo: %w", err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field photo: %w", err) } buf.Comma() buf.FieldStart("animation") if err := b.Animation.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field animation: %w", err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field animation: %w", err) } buf.Comma() buf.FieldStart("menu_button") if err := b.MenuButton.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field menu_button: %w", err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field menu_button: %w", err) } buf.Comma() buf.FieldStart("commands") buf.ArrStart() for idx, v := range b.Commands { if err := v.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field commands element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field commands element with index %d: %w", idx, err) } buf.Comma() } @@ -569,17 +587,17 @@ func (b *BotInfo) EncodeTDLibJSON(buf tdjson.Encoder) error { buf.Comma() buf.FieldStart("default_group_administrator_rights") if err := b.DefaultGroupAdministratorRights.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field default_group_administrator_rights: %w", err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field default_group_administrator_rights: %w", err) } buf.Comma() buf.FieldStart("default_channel_administrator_rights") if err := b.DefaultChannelAdministratorRights.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field default_channel_administrator_rights: %w", err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field default_channel_administrator_rights: %w", err) } buf.Comma() buf.FieldStart("affiliate_program") if err := b.AffiliateProgram.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field affiliate_program: %w", err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field affiliate_program: %w", err) } buf.Comma() buf.FieldStart("web_app_background_light_color") @@ -594,6 +612,11 @@ func (b *BotInfo) EncodeTDLibJSON(buf tdjson.Encoder) error { buf.FieldStart("web_app_header_dark_color") buf.PutInt32(b.WebAppHeaderDarkColor) buf.Comma() + buf.FieldStart("verification_parameters") + if err := b.VerificationParameters.EncodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to encode botInfo#d16edb85: field verification_parameters: %w", err) + } + buf.Comma() buf.FieldStart("can_get_revenue_statistics") buf.PutBool(b.CanGetRevenueStatistics) buf.Comma() @@ -605,34 +628,34 @@ func (b *BotInfo) EncodeTDLibJSON(buf tdjson.Encoder) error { buf.Comma() buf.FieldStart("edit_commands_link") if b.EditCommandsLink == nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field edit_commands_link is nil") + return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_commands_link is nil") } if err := b.EditCommandsLink.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field edit_commands_link: %w", err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_commands_link: %w", err) } buf.Comma() buf.FieldStart("edit_description_link") if b.EditDescriptionLink == nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field edit_description_link is nil") + return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_description_link is nil") } if err := b.EditDescriptionLink.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field edit_description_link: %w", err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_description_link: %w", err) } buf.Comma() buf.FieldStart("edit_description_media_link") if b.EditDescriptionMediaLink == nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field edit_description_media_link is nil") + return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_description_media_link is nil") } if err := b.EditDescriptionMediaLink.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field edit_description_media_link: %w", err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_description_media_link: %w", err) } buf.Comma() buf.FieldStart("edit_settings_link") if b.EditSettingsLink == nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field edit_settings_link is nil") + return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_settings_link is nil") } if err := b.EditSettingsLink.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#80eb0e42: field edit_settings_link: %w", err) + return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_settings_link: %w", err) } buf.Comma() buf.StripComma() @@ -643,132 +666,136 @@ func (b *BotInfo) EncodeTDLibJSON(buf tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (b *BotInfo) DecodeTDLibJSON(buf tdjson.Decoder) error { if b == nil { - return fmt.Errorf("can't decode botInfo#80eb0e42 to nil") + return fmt.Errorf("can't decode botInfo#d16edb85 to nil") } return buf.Obj(func(buf tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := buf.ConsumeID("botInfo"); err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: %w", err) } case "short_description": value, err := buf.String() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field short_description: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field short_description: %w", err) } b.ShortDescription = value case "description": value, err := buf.String() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field description: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field description: %w", err) } b.Description = value case "photo": if err := b.Photo.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field photo: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field photo: %w", err) } case "animation": if err := b.Animation.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field animation: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field animation: %w", err) } case "menu_button": if err := b.MenuButton.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field menu_button: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field menu_button: %w", err) } case "commands": if err := buf.Arr(func(buf tdjson.Decoder) error { var value BotCommand if err := value.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field commands: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field commands: %w", err) } b.Commands = append(b.Commands, value) return nil }); err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field commands: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field commands: %w", err) } case "privacy_policy_url": value, err := buf.String() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field privacy_policy_url: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field privacy_policy_url: %w", err) } b.PrivacyPolicyURL = value case "default_group_administrator_rights": if err := b.DefaultGroupAdministratorRights.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field default_group_administrator_rights: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field default_group_administrator_rights: %w", err) } case "default_channel_administrator_rights": if err := b.DefaultChannelAdministratorRights.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field default_channel_administrator_rights: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field default_channel_administrator_rights: %w", err) } case "affiliate_program": if err := b.AffiliateProgram.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field affiliate_program: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field affiliate_program: %w", err) } case "web_app_background_light_color": value, err := buf.Int32() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field web_app_background_light_color: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field web_app_background_light_color: %w", err) } b.WebAppBackgroundLightColor = value case "web_app_background_dark_color": value, err := buf.Int32() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field web_app_background_dark_color: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field web_app_background_dark_color: %w", err) } b.WebAppBackgroundDarkColor = value case "web_app_header_light_color": value, err := buf.Int32() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field web_app_header_light_color: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field web_app_header_light_color: %w", err) } b.WebAppHeaderLightColor = value case "web_app_header_dark_color": value, err := buf.Int32() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field web_app_header_dark_color: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field web_app_header_dark_color: %w", err) } b.WebAppHeaderDarkColor = value + case "verification_parameters": + if err := b.VerificationParameters.DecodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to decode botInfo#d16edb85: field verification_parameters: %w", err) + } case "can_get_revenue_statistics": value, err := buf.Bool() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field can_get_revenue_statistics: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field can_get_revenue_statistics: %w", err) } b.CanGetRevenueStatistics = value case "can_manage_emoji_status": value, err := buf.Bool() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field can_manage_emoji_status: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field can_manage_emoji_status: %w", err) } b.CanManageEmojiStatus = value case "has_media_previews": value, err := buf.Bool() if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field has_media_previews: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field has_media_previews: %w", err) } b.HasMediaPreviews = value case "edit_commands_link": value, err := DecodeTDLibJSONInternalLinkType(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field edit_commands_link: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field edit_commands_link: %w", err) } b.EditCommandsLink = value case "edit_description_link": value, err := DecodeTDLibJSONInternalLinkType(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field edit_description_link: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field edit_description_link: %w", err) } b.EditDescriptionLink = value case "edit_description_media_link": value, err := DecodeTDLibJSONInternalLinkType(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field edit_description_media_link: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field edit_description_media_link: %w", err) } b.EditDescriptionMediaLink = value case "edit_settings_link": value, err := DecodeTDLibJSONInternalLinkType(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#80eb0e42: field edit_settings_link: %w", err) + return fmt.Errorf("unable to decode botInfo#d16edb85: field edit_settings_link: %w", err) } b.EditSettingsLink = value default: @@ -890,6 +917,14 @@ func (b *BotInfo) GetWebAppHeaderDarkColor() (value int32) { return b.WebAppHeaderDarkColor } +// GetVerificationParameters returns value of VerificationParameters field. +func (b *BotInfo) GetVerificationParameters() (value BotVerificationParameters) { + if b == nil { + return + } + return b.VerificationParameters +} + // GetCanGetRevenueStatistics returns value of CanGetRevenueStatistics field. func (b *BotInfo) GetCanGetRevenueStatistics() (value bool) { if b == nil { diff --git a/tdapi/tl_bot_verification_gen.go b/tdapi/tl_bot_verification_gen.go new file mode 100644 index 0000000000..9a4f439998 --- /dev/null +++ b/tdapi/tl_bot_verification_gen.go @@ -0,0 +1,261 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BotVerification represents TL type `botVerification#b160b6f2`. +type BotVerification struct { + // Identifier of the bot that provided the verification + BotUserID int64 + // Identifier of the custom emoji that is used as the verification sign + IconCustomEmojiID int64 + // Custom description of verification reason set by the bot + CustomDescription FormattedText +} + +// BotVerificationTypeID is TL type id of BotVerification. +const BotVerificationTypeID = 0xb160b6f2 + +// Ensuring interfaces in compile-time for BotVerification. +var ( + _ bin.Encoder = &BotVerification{} + _ bin.Decoder = &BotVerification{} + _ bin.BareEncoder = &BotVerification{} + _ bin.BareDecoder = &BotVerification{} +) + +func (b *BotVerification) Zero() bool { + if b == nil { + return true + } + if !(b.BotUserID == 0) { + return false + } + if !(b.IconCustomEmojiID == 0) { + return false + } + if !(b.CustomDescription.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BotVerification) String() string { + if b == nil { + return "BotVerification(nil)" + } + type Alias BotVerification + return fmt.Sprintf("BotVerification%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotVerification) TypeID() uint32 { + return BotVerificationTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotVerification) TypeName() string { + return "botVerification" +} + +// TypeInfo returns info about TL type. +func (b *BotVerification) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "botVerification", + ID: BotVerificationTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "BotUserID", + SchemaName: "bot_user_id", + }, + { + Name: "IconCustomEmojiID", + SchemaName: "icon_custom_emoji_id", + }, + { + Name: "CustomDescription", + SchemaName: "custom_description", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BotVerification) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botVerification#b160b6f2 as nil") + } + buf.PutID(BotVerificationTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BotVerification) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botVerification#b160b6f2 as nil") + } + buf.PutInt53(b.BotUserID) + buf.PutLong(b.IconCustomEmojiID) + if err := b.CustomDescription.Encode(buf); err != nil { + return fmt.Errorf("unable to encode botVerification#b160b6f2: field custom_description: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (b *BotVerification) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botVerification#b160b6f2 to nil") + } + if err := buf.ConsumeID(BotVerificationTypeID); err != nil { + return fmt.Errorf("unable to decode botVerification#b160b6f2: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BotVerification) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botVerification#b160b6f2 to nil") + } + { + value, err := buf.Int53() + if err != nil { + return fmt.Errorf("unable to decode botVerification#b160b6f2: field bot_user_id: %w", err) + } + b.BotUserID = value + } + { + value, err := buf.Long() + if err != nil { + return fmt.Errorf("unable to decode botVerification#b160b6f2: field icon_custom_emoji_id: %w", err) + } + b.IconCustomEmojiID = value + } + { + if err := b.CustomDescription.Decode(buf); err != nil { + return fmt.Errorf("unable to decode botVerification#b160b6f2: field custom_description: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BotVerification) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode botVerification#b160b6f2 as nil") + } + buf.ObjStart() + buf.PutID("botVerification") + buf.Comma() + buf.FieldStart("bot_user_id") + buf.PutInt53(b.BotUserID) + buf.Comma() + buf.FieldStart("icon_custom_emoji_id") + buf.PutLong(b.IconCustomEmojiID) + buf.Comma() + buf.FieldStart("custom_description") + if err := b.CustomDescription.EncodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to encode botVerification#b160b6f2: field custom_description: %w", err) + } + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BotVerification) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode botVerification#b160b6f2 to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("botVerification"); err != nil { + return fmt.Errorf("unable to decode botVerification#b160b6f2: %w", err) + } + case "bot_user_id": + value, err := buf.Int53() + if err != nil { + return fmt.Errorf("unable to decode botVerification#b160b6f2: field bot_user_id: %w", err) + } + b.BotUserID = value + case "icon_custom_emoji_id": + value, err := buf.Long() + if err != nil { + return fmt.Errorf("unable to decode botVerification#b160b6f2: field icon_custom_emoji_id: %w", err) + } + b.IconCustomEmojiID = value + case "custom_description": + if err := b.CustomDescription.DecodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to decode botVerification#b160b6f2: field custom_description: %w", err) + } + default: + return buf.Skip() + } + return nil + }) +} + +// GetBotUserID returns value of BotUserID field. +func (b *BotVerification) GetBotUserID() (value int64) { + if b == nil { + return + } + return b.BotUserID +} + +// GetIconCustomEmojiID returns value of IconCustomEmojiID field. +func (b *BotVerification) GetIconCustomEmojiID() (value int64) { + if b == nil { + return + } + return b.IconCustomEmojiID +} + +// GetCustomDescription returns value of CustomDescription field. +func (b *BotVerification) GetCustomDescription() (value FormattedText) { + if b == nil { + return + } + return b.CustomDescription +} diff --git a/tdapi/tl_bot_verification_parameters_gen.go b/tdapi/tl_bot_verification_parameters_gen.go new file mode 100644 index 0000000000..ecdd9aead1 --- /dev/null +++ b/tdapi/tl_bot_verification_parameters_gen.go @@ -0,0 +1,296 @@ +// 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{} +) + +// BotVerificationParameters represents TL type `botVerificationParameters#d4dca55f`. +type BotVerificationParameters struct { + // Identifier of the custom emoji that is used as the verification sign + IconCustomEmojiID int64 + // Name of the organization that provides verification + OrganizationName string + // Default custom description of verification reason to be used as placeholder in + // setMessageSenderBotVerification; may be null if none + DefaultCustomDescription FormattedText + // True, if the bot is allowed to provide custom description for verified entities + CanSetCustomDescription bool +} + +// BotVerificationParametersTypeID is TL type id of BotVerificationParameters. +const BotVerificationParametersTypeID = 0xd4dca55f + +// Ensuring interfaces in compile-time for BotVerificationParameters. +var ( + _ bin.Encoder = &BotVerificationParameters{} + _ bin.Decoder = &BotVerificationParameters{} + _ bin.BareEncoder = &BotVerificationParameters{} + _ bin.BareDecoder = &BotVerificationParameters{} +) + +func (b *BotVerificationParameters) Zero() bool { + if b == nil { + return true + } + if !(b.IconCustomEmojiID == 0) { + return false + } + if !(b.OrganizationName == "") { + return false + } + if !(b.DefaultCustomDescription.Zero()) { + return false + } + if !(b.CanSetCustomDescription == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BotVerificationParameters) String() string { + if b == nil { + return "BotVerificationParameters(nil)" + } + type Alias BotVerificationParameters + return fmt.Sprintf("BotVerificationParameters%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotVerificationParameters) TypeID() uint32 { + return BotVerificationParametersTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotVerificationParameters) TypeName() string { + return "botVerificationParameters" +} + +// TypeInfo returns info about TL type. +func (b *BotVerificationParameters) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "botVerificationParameters", + ID: BotVerificationParametersTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "IconCustomEmojiID", + SchemaName: "icon_custom_emoji_id", + }, + { + Name: "OrganizationName", + SchemaName: "organization_name", + }, + { + Name: "DefaultCustomDescription", + SchemaName: "default_custom_description", + }, + { + Name: "CanSetCustomDescription", + SchemaName: "can_set_custom_description", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BotVerificationParameters) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botVerificationParameters#d4dca55f as nil") + } + buf.PutID(BotVerificationParametersTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BotVerificationParameters) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botVerificationParameters#d4dca55f as nil") + } + buf.PutLong(b.IconCustomEmojiID) + buf.PutString(b.OrganizationName) + if err := b.DefaultCustomDescription.Encode(buf); err != nil { + return fmt.Errorf("unable to encode botVerificationParameters#d4dca55f: field default_custom_description: %w", err) + } + buf.PutBool(b.CanSetCustomDescription) + return nil +} + +// Decode implements bin.Decoder. +func (b *BotVerificationParameters) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botVerificationParameters#d4dca55f to nil") + } + if err := buf.ConsumeID(BotVerificationParametersTypeID); err != nil { + return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BotVerificationParameters) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botVerificationParameters#d4dca55f to nil") + } + { + value, err := buf.Long() + if err != nil { + return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field icon_custom_emoji_id: %w", err) + } + b.IconCustomEmojiID = value + } + { + value, err := buf.String() + if err != nil { + return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field organization_name: %w", err) + } + b.OrganizationName = value + } + { + if err := b.DefaultCustomDescription.Decode(buf); err != nil { + return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field default_custom_description: %w", err) + } + } + { + value, err := buf.Bool() + if err != nil { + return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field can_set_custom_description: %w", err) + } + b.CanSetCustomDescription = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BotVerificationParameters) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode botVerificationParameters#d4dca55f as nil") + } + buf.ObjStart() + buf.PutID("botVerificationParameters") + buf.Comma() + buf.FieldStart("icon_custom_emoji_id") + buf.PutLong(b.IconCustomEmojiID) + buf.Comma() + buf.FieldStart("organization_name") + buf.PutString(b.OrganizationName) + buf.Comma() + buf.FieldStart("default_custom_description") + if err := b.DefaultCustomDescription.EncodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to encode botVerificationParameters#d4dca55f: field default_custom_description: %w", err) + } + buf.Comma() + buf.FieldStart("can_set_custom_description") + buf.PutBool(b.CanSetCustomDescription) + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BotVerificationParameters) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode botVerificationParameters#d4dca55f to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("botVerificationParameters"); err != nil { + return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: %w", err) + } + case "icon_custom_emoji_id": + value, err := buf.Long() + if err != nil { + return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field icon_custom_emoji_id: %w", err) + } + b.IconCustomEmojiID = value + case "organization_name": + value, err := buf.String() + if err != nil { + return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field organization_name: %w", err) + } + b.OrganizationName = value + case "default_custom_description": + if err := b.DefaultCustomDescription.DecodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field default_custom_description: %w", err) + } + case "can_set_custom_description": + value, err := buf.Bool() + if err != nil { + return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field can_set_custom_description: %w", err) + } + b.CanSetCustomDescription = value + default: + return buf.Skip() + } + return nil + }) +} + +// GetIconCustomEmojiID returns value of IconCustomEmojiID field. +func (b *BotVerificationParameters) GetIconCustomEmojiID() (value int64) { + if b == nil { + return + } + return b.IconCustomEmojiID +} + +// GetOrganizationName returns value of OrganizationName field. +func (b *BotVerificationParameters) GetOrganizationName() (value string) { + if b == nil { + return + } + return b.OrganizationName +} + +// GetDefaultCustomDescription returns value of DefaultCustomDescription field. +func (b *BotVerificationParameters) GetDefaultCustomDescription() (value FormattedText) { + if b == nil { + return + } + return b.DefaultCustomDescription +} + +// GetCanSetCustomDescription returns value of CanSetCustomDescription field. +func (b *BotVerificationParameters) GetCanSetCustomDescription() (value bool) { + if b == nil { + return + } + return b.CanSetCustomDescription +} diff --git a/tdapi/tl_call_discard_reason_gen.go b/tdapi/tl_call_discard_reason_gen.go index 4e4a0c5195..482feacf4b 100644 --- a/tdapi/tl_call_discard_reason_gen.go +++ b/tdapi/tl_call_discard_reason_gen.go @@ -686,6 +686,172 @@ func (c *CallDiscardReasonHungUp) DecodeTDLibJSON(b tdjson.Decoder) error { }) } +// CallDiscardReasonAllowGroupCall represents TL type `callDiscardReasonAllowGroupCall#af177fd5`. +type CallDiscardReasonAllowGroupCall struct { + // Encrypted using the call private key encryption key for the associated group call + EncryptedGroupCallKey []byte +} + +// CallDiscardReasonAllowGroupCallTypeID is TL type id of CallDiscardReasonAllowGroupCall. +const CallDiscardReasonAllowGroupCallTypeID = 0xaf177fd5 + +// construct implements constructor of CallDiscardReasonClass. +func (c CallDiscardReasonAllowGroupCall) construct() CallDiscardReasonClass { return &c } + +// Ensuring interfaces in compile-time for CallDiscardReasonAllowGroupCall. +var ( + _ bin.Encoder = &CallDiscardReasonAllowGroupCall{} + _ bin.Decoder = &CallDiscardReasonAllowGroupCall{} + _ bin.BareEncoder = &CallDiscardReasonAllowGroupCall{} + _ bin.BareDecoder = &CallDiscardReasonAllowGroupCall{} + + _ CallDiscardReasonClass = &CallDiscardReasonAllowGroupCall{} +) + +func (c *CallDiscardReasonAllowGroupCall) Zero() bool { + if c == nil { + return true + } + if !(c.EncryptedGroupCallKey == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *CallDiscardReasonAllowGroupCall) String() string { + if c == nil { + return "CallDiscardReasonAllowGroupCall(nil)" + } + type Alias CallDiscardReasonAllowGroupCall + return fmt.Sprintf("CallDiscardReasonAllowGroupCall%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*CallDiscardReasonAllowGroupCall) TypeID() uint32 { + return CallDiscardReasonAllowGroupCallTypeID +} + +// TypeName returns name of type in TL schema. +func (*CallDiscardReasonAllowGroupCall) TypeName() string { + return "callDiscardReasonAllowGroupCall" +} + +// TypeInfo returns info about TL type. +func (c *CallDiscardReasonAllowGroupCall) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "callDiscardReasonAllowGroupCall", + ID: CallDiscardReasonAllowGroupCallTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "EncryptedGroupCallKey", + SchemaName: "encrypted_group_call_key", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *CallDiscardReasonAllowGroupCall) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode callDiscardReasonAllowGroupCall#af177fd5 as nil") + } + b.PutID(CallDiscardReasonAllowGroupCallTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *CallDiscardReasonAllowGroupCall) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode callDiscardReasonAllowGroupCall#af177fd5 as nil") + } + b.PutBytes(c.EncryptedGroupCallKey) + return nil +} + +// Decode implements bin.Decoder. +func (c *CallDiscardReasonAllowGroupCall) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode callDiscardReasonAllowGroupCall#af177fd5 to nil") + } + if err := b.ConsumeID(CallDiscardReasonAllowGroupCallTypeID); err != nil { + return fmt.Errorf("unable to decode callDiscardReasonAllowGroupCall#af177fd5: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *CallDiscardReasonAllowGroupCall) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode callDiscardReasonAllowGroupCall#af177fd5 to nil") + } + { + value, err := b.Bytes() + if err != nil { + return fmt.Errorf("unable to decode callDiscardReasonAllowGroupCall#af177fd5: field encrypted_group_call_key: %w", err) + } + c.EncryptedGroupCallKey = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *CallDiscardReasonAllowGroupCall) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode callDiscardReasonAllowGroupCall#af177fd5 as nil") + } + b.ObjStart() + b.PutID("callDiscardReasonAllowGroupCall") + b.Comma() + b.FieldStart("encrypted_group_call_key") + b.PutBytes(c.EncryptedGroupCallKey) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *CallDiscardReasonAllowGroupCall) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode callDiscardReasonAllowGroupCall#af177fd5 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("callDiscardReasonAllowGroupCall"); err != nil { + return fmt.Errorf("unable to decode callDiscardReasonAllowGroupCall#af177fd5: %w", err) + } + case "encrypted_group_call_key": + value, err := b.Bytes() + if err != nil { + return fmt.Errorf("unable to decode callDiscardReasonAllowGroupCall#af177fd5: field encrypted_group_call_key: %w", err) + } + c.EncryptedGroupCallKey = value + default: + return b.Skip() + } + return nil + }) +} + +// GetEncryptedGroupCallKey returns value of EncryptedGroupCallKey field. +func (c *CallDiscardReasonAllowGroupCall) GetEncryptedGroupCallKey() (value []byte) { + if c == nil { + return + } + return c.EncryptedGroupCallKey +} + // CallDiscardReasonClassName is schema name of CallDiscardReasonClass. const CallDiscardReasonClassName = "CallDiscardReason" @@ -703,6 +869,7 @@ const CallDiscardReasonClassName = "CallDiscardReason" // case *tdapi.CallDiscardReasonDeclined: // callDiscardReasonDeclined#98e36c32 // case *tdapi.CallDiscardReasonDisconnected: // callDiscardReasonDisconnected#aff563a2 // case *tdapi.CallDiscardReasonHungUp: // callDiscardReasonHungUp#1a1ea5e6 +// case *tdapi.CallDiscardReasonAllowGroupCall: // callDiscardReasonAllowGroupCall#af177fd5 // default: panic(v) // } type CallDiscardReasonClass interface { @@ -769,6 +936,13 @@ func DecodeCallDiscardReason(buf *bin.Buffer) (CallDiscardReasonClass, error) { return nil, fmt.Errorf("unable to decode CallDiscardReasonClass: %w", err) } return &v, nil + case CallDiscardReasonAllowGroupCallTypeID: + // Decoding callDiscardReasonAllowGroupCall#af177fd5. + v := CallDiscardReasonAllowGroupCall{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode CallDiscardReasonClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode CallDiscardReasonClass: %w", bin.NewUnexpectedID(id)) } @@ -816,6 +990,13 @@ func DecodeTDLibJSONCallDiscardReason(buf tdjson.Decoder) (CallDiscardReasonClas return nil, fmt.Errorf("unable to decode CallDiscardReasonClass: %w", err) } return &v, nil + case "callDiscardReasonAllowGroupCall": + // Decoding callDiscardReasonAllowGroupCall#af177fd5. + v := CallDiscardReasonAllowGroupCall{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode CallDiscardReasonClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode CallDiscardReasonClass: %w", tdjson.NewUnexpectedID(id)) } diff --git a/tdapi/tl_call_gen.go b/tdapi/tl_call_gen.go index 1ab206c542..76e23e9237 100644 --- a/tdapi/tl_call_gen.go +++ b/tdapi/tl_call_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// Call represents TL type `call#36db9764`. +// Call represents TL type `call#9e0dd8aa`. type Call struct { // Call identifier, not persistent ID int32 @@ -43,10 +43,13 @@ type Call struct { IsVideo bool // Call state State CallStateClass + // Identifier of the group call associated with the call; 0 if the group call isn't + // created yet. The group call can be received through the method getGroupCall + GroupCallID int32 } // CallTypeID is TL type id of Call. -const CallTypeID = 0x36db9764 +const CallTypeID = 0x9e0dd8aa // Ensuring interfaces in compile-time for Call. var ( @@ -75,6 +78,9 @@ func (c *Call) Zero() bool { if !(c.State == nil) { return false } + if !(c.GroupCallID == 0) { + return false + } return true } @@ -131,6 +137,10 @@ func (c *Call) TypeInfo() tdp.Type { Name: "State", SchemaName: "state", }, + { + Name: "GroupCallID", + SchemaName: "group_call_id", + }, } return typ } @@ -138,7 +148,7 @@ func (c *Call) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *Call) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode call#36db9764 as nil") + return fmt.Errorf("can't encode call#9e0dd8aa as nil") } b.PutID(CallTypeID) return c.EncodeBare(b) @@ -147,28 +157,29 @@ func (c *Call) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *Call) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode call#36db9764 as nil") + return fmt.Errorf("can't encode call#9e0dd8aa as nil") } b.PutInt32(c.ID) b.PutInt53(c.UserID) b.PutBool(c.IsOutgoing) b.PutBool(c.IsVideo) if c.State == nil { - return fmt.Errorf("unable to encode call#36db9764: field state is nil") + return fmt.Errorf("unable to encode call#9e0dd8aa: field state is nil") } if err := c.State.Encode(b); err != nil { - return fmt.Errorf("unable to encode call#36db9764: field state: %w", err) + return fmt.Errorf("unable to encode call#9e0dd8aa: field state: %w", err) } + b.PutInt32(c.GroupCallID) return nil } // Decode implements bin.Decoder. func (c *Call) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode call#36db9764 to nil") + return fmt.Errorf("can't decode call#9e0dd8aa to nil") } if err := b.ConsumeID(CallTypeID); err != nil { - return fmt.Errorf("unable to decode call#36db9764: %w", err) + return fmt.Errorf("unable to decode call#9e0dd8aa: %w", err) } return c.DecodeBare(b) } @@ -176,50 +187,57 @@ func (c *Call) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *Call) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode call#36db9764 to nil") + return fmt.Errorf("can't decode call#9e0dd8aa to nil") } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode call#36db9764: field id: %w", err) + return fmt.Errorf("unable to decode call#9e0dd8aa: field id: %w", err) } c.ID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode call#36db9764: field user_id: %w", err) + return fmt.Errorf("unable to decode call#9e0dd8aa: field user_id: %w", err) } c.UserID = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode call#36db9764: field is_outgoing: %w", err) + return fmt.Errorf("unable to decode call#9e0dd8aa: field is_outgoing: %w", err) } c.IsOutgoing = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode call#36db9764: field is_video: %w", err) + return fmt.Errorf("unable to decode call#9e0dd8aa: field is_video: %w", err) } c.IsVideo = value } { value, err := DecodeCallState(b) if err != nil { - return fmt.Errorf("unable to decode call#36db9764: field state: %w", err) + return fmt.Errorf("unable to decode call#9e0dd8aa: field state: %w", err) } c.State = value } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode call#9e0dd8aa: field group_call_id: %w", err) + } + c.GroupCallID = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *Call) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode call#36db9764 as nil") + return fmt.Errorf("can't encode call#9e0dd8aa as nil") } b.ObjStart() b.PutID("call") @@ -238,12 +256,15 @@ func (c *Call) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("state") if c.State == nil { - return fmt.Errorf("unable to encode call#36db9764: field state is nil") + return fmt.Errorf("unable to encode call#9e0dd8aa: field state is nil") } if err := c.State.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode call#36db9764: field state: %w", err) + return fmt.Errorf("unable to encode call#9e0dd8aa: field state: %w", err) } b.Comma() + b.FieldStart("group_call_id") + b.PutInt32(c.GroupCallID) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -252,45 +273,51 @@ func (c *Call) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *Call) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode call#36db9764 to nil") + return fmt.Errorf("can't decode call#9e0dd8aa to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("call"); err != nil { - return fmt.Errorf("unable to decode call#36db9764: %w", err) + return fmt.Errorf("unable to decode call#9e0dd8aa: %w", err) } case "id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode call#36db9764: field id: %w", err) + return fmt.Errorf("unable to decode call#9e0dd8aa: field id: %w", err) } c.ID = value case "user_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode call#36db9764: field user_id: %w", err) + return fmt.Errorf("unable to decode call#9e0dd8aa: field user_id: %w", err) } c.UserID = value case "is_outgoing": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode call#36db9764: field is_outgoing: %w", err) + return fmt.Errorf("unable to decode call#9e0dd8aa: field is_outgoing: %w", err) } c.IsOutgoing = value case "is_video": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode call#36db9764: field is_video: %w", err) + return fmt.Errorf("unable to decode call#9e0dd8aa: field is_video: %w", err) } c.IsVideo = value case "state": value, err := DecodeTDLibJSONCallState(b) if err != nil { - return fmt.Errorf("unable to decode call#36db9764: field state: %w", err) + return fmt.Errorf("unable to decode call#9e0dd8aa: field state: %w", err) } c.State = value + case "group_call_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode call#9e0dd8aa: field group_call_id: %w", err) + } + c.GroupCallID = value default: return b.Skip() } @@ -337,3 +364,11 @@ func (c *Call) GetState() (value CallStateClass) { } return c.State } + +// GetGroupCallID returns value of GroupCallID field. +func (c *Call) GetGroupCallID() (value int32) { + if c == nil { + return + } + return c.GroupCallID +} diff --git a/tdapi/tl_chat_affiliate_programs_gen.go b/tdapi/tl_chat_affiliate_programs_gen.go deleted file mode 100644 index cc52186cfa..0000000000 --- a/tdapi/tl_chat_affiliate_programs_gen.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -import ( - "context" - "errors" - "fmt" - "sort" - "strings" - - "go.uber.org/multierr" - - "github.com/gotd/td/bin" - "github.com/gotd/td/tdjson" - "github.com/gotd/td/tdp" - "github.com/gotd/td/tgerr" -) - -// No-op definition for keeping imports. -var ( - _ = bin.Buffer{} - _ = context.Background() - _ = fmt.Stringer(nil) - _ = strings.Builder{} - _ = errors.Is - _ = multierr.AppendInto - _ = sort.Ints - _ = tdp.Format - _ = tgerr.Error{} - _ = tdjson.Encoder{} -) - -// ChatAffiliatePrograms represents TL type `chatAffiliatePrograms#74f423e2`. -type ChatAffiliatePrograms struct { - // The total number of affiliate programs that were connected to the chat - TotalCount int32 - // The list of connected affiliate programs - Programs []ChatAffiliateProgram - // The offset for the next request. If empty, then there are no more results - NextOffset string -} - -// ChatAffiliateProgramsTypeID is TL type id of ChatAffiliatePrograms. -const ChatAffiliateProgramsTypeID = 0x74f423e2 - -// Ensuring interfaces in compile-time for ChatAffiliatePrograms. -var ( - _ bin.Encoder = &ChatAffiliatePrograms{} - _ bin.Decoder = &ChatAffiliatePrograms{} - _ bin.BareEncoder = &ChatAffiliatePrograms{} - _ bin.BareDecoder = &ChatAffiliatePrograms{} -) - -func (c *ChatAffiliatePrograms) Zero() bool { - if c == nil { - return true - } - if !(c.TotalCount == 0) { - return false - } - if !(c.Programs == nil) { - return false - } - if !(c.NextOffset == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatAffiliatePrograms) String() string { - if c == nil { - return "ChatAffiliatePrograms(nil)" - } - type Alias ChatAffiliatePrograms - return fmt.Sprintf("ChatAffiliatePrograms%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatAffiliatePrograms) TypeID() uint32 { - return ChatAffiliateProgramsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatAffiliatePrograms) TypeName() string { - return "chatAffiliatePrograms" -} - -// TypeInfo returns info about TL type. -func (c *ChatAffiliatePrograms) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatAffiliatePrograms", - ID: ChatAffiliateProgramsTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Programs", - SchemaName: "programs", - }, - { - Name: "NextOffset", - SchemaName: "next_offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatAffiliatePrograms) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatAffiliatePrograms#74f423e2 as nil") - } - b.PutID(ChatAffiliateProgramsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatAffiliatePrograms) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatAffiliatePrograms#74f423e2 as nil") - } - b.PutInt32(c.TotalCount) - b.PutInt(len(c.Programs)) - for idx, v := range c.Programs { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatAffiliatePrograms#74f423e2: field programs element with index %d: %w", idx, err) - } - } - b.PutString(c.NextOffset) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatAffiliatePrograms) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatAffiliatePrograms#74f423e2 to nil") - } - if err := b.ConsumeID(ChatAffiliateProgramsTypeID); err != nil { - return fmt.Errorf("unable to decode chatAffiliatePrograms#74f423e2: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatAffiliatePrograms) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatAffiliatePrograms#74f423e2 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatAffiliatePrograms#74f423e2: field total_count: %w", err) - } - c.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatAffiliatePrograms#74f423e2: field programs: %w", err) - } - - if headerLen > 0 { - c.Programs = make([]ChatAffiliateProgram, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatAffiliateProgram - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatAffiliatePrograms#74f423e2: field programs: %w", err) - } - c.Programs = append(c.Programs, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatAffiliatePrograms#74f423e2: field next_offset: %w", err) - } - c.NextOffset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatAffiliatePrograms) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatAffiliatePrograms#74f423e2 as nil") - } - b.ObjStart() - b.PutID("chatAffiliatePrograms") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(c.TotalCount) - b.Comma() - b.FieldStart("programs") - b.ArrStart() - for idx, v := range c.Programs { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatAffiliatePrograms#74f423e2: field programs element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("next_offset") - b.PutString(c.NextOffset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatAffiliatePrograms) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatAffiliatePrograms#74f423e2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatAffiliatePrograms"); err != nil { - return fmt.Errorf("unable to decode chatAffiliatePrograms#74f423e2: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatAffiliatePrograms#74f423e2: field total_count: %w", err) - } - c.TotalCount = value - case "programs": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatAffiliateProgram - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatAffiliatePrograms#74f423e2: field programs: %w", err) - } - c.Programs = append(c.Programs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatAffiliatePrograms#74f423e2: field programs: %w", err) - } - case "next_offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatAffiliatePrograms#74f423e2: field next_offset: %w", err) - } - c.NextOffset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (c *ChatAffiliatePrograms) GetTotalCount() (value int32) { - if c == nil { - return - } - return c.TotalCount -} - -// GetPrograms returns value of Programs field. -func (c *ChatAffiliatePrograms) GetPrograms() (value []ChatAffiliateProgram) { - if c == nil { - return - } - return c.Programs -} - -// GetNextOffset returns value of NextOffset field. -func (c *ChatAffiliatePrograms) GetNextOffset() (value string) { - if c == nil { - return - } - return c.NextOffset -} diff --git a/tdapi/tl_chat_folder_gen.go b/tdapi/tl_chat_folder_gen.go index 4b96ada02b..dc481bab0e 100644 --- a/tdapi/tl_chat_folder_gen.go +++ b/tdapi/tl_chat_folder_gen.go @@ -31,10 +31,10 @@ var ( _ = tdjson.Encoder{} ) -// ChatFolder represents TL type `chatFolder#65805ba5`. +// ChatFolder represents TL type `chatFolder#a2e17d38`. type ChatFolder struct { - // The title of the folder; 1-12 characters without line feeds - Title string + // The name of the folder + Name ChatFolderName // The chosen icon for the chat folder; may be null. If null, use // getChatFolderDefaultIconName to get default icon name for the folder Icon ChatFolderIcon @@ -77,7 +77,7 @@ type ChatFolder struct { } // ChatFolderTypeID is TL type id of ChatFolder. -const ChatFolderTypeID = 0x65805ba5 +const ChatFolderTypeID = 0xa2e17d38 // Ensuring interfaces in compile-time for ChatFolder. var ( @@ -91,7 +91,7 @@ func (c *ChatFolder) Zero() bool { if c == nil { return true } - if !(c.Title == "") { + if !(c.Name.Zero()) { return false } if !(c.Icon.Zero()) { @@ -173,8 +173,8 @@ func (c *ChatFolder) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "Title", - SchemaName: "title", + Name: "Name", + SchemaName: "name", }, { Name: "Icon", @@ -239,7 +239,7 @@ func (c *ChatFolder) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *ChatFolder) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatFolder#65805ba5 as nil") + return fmt.Errorf("can't encode chatFolder#a2e17d38 as nil") } b.PutID(ChatFolderTypeID) return c.EncodeBare(b) @@ -248,11 +248,13 @@ func (c *ChatFolder) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatFolder) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatFolder#65805ba5 as nil") + return fmt.Errorf("can't encode chatFolder#a2e17d38 as nil") + } + if err := c.Name.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatFolder#a2e17d38: field name: %w", err) } - b.PutString(c.Title) if err := c.Icon.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatFolder#65805ba5: field icon: %w", err) + return fmt.Errorf("unable to encode chatFolder#a2e17d38: field icon: %w", err) } b.PutInt32(c.ColorID) b.PutBool(c.IsShareable) @@ -282,10 +284,10 @@ func (c *ChatFolder) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (c *ChatFolder) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatFolder#65805ba5 to nil") + return fmt.Errorf("can't decode chatFolder#a2e17d38 to nil") } if err := b.ConsumeID(ChatFolderTypeID); err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: %w", err) } return c.DecodeBare(b) } @@ -293,38 +295,36 @@ func (c *ChatFolder) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatFolder) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatFolder#65805ba5 to nil") + return fmt.Errorf("can't decode chatFolder#a2e17d38 to nil") } { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field title: %w", err) + if err := c.Name.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field name: %w", err) } - c.Title = value } { if err := c.Icon.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field icon: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field icon: %w", err) } } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field color_id: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field color_id: %w", err) } c.ColorID = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field is_shareable: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field is_shareable: %w", err) } c.IsShareable = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field pinned_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field pinned_chat_ids: %w", err) } if headerLen > 0 { @@ -333,7 +333,7 @@ func (c *ChatFolder) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field pinned_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field pinned_chat_ids: %w", err) } c.PinnedChatIDs = append(c.PinnedChatIDs, value) } @@ -341,7 +341,7 @@ func (c *ChatFolder) DecodeBare(b *bin.Buffer) error { { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field included_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field included_chat_ids: %w", err) } if headerLen > 0 { @@ -350,7 +350,7 @@ func (c *ChatFolder) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field included_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field included_chat_ids: %w", err) } c.IncludedChatIDs = append(c.IncludedChatIDs, value) } @@ -358,7 +358,7 @@ func (c *ChatFolder) DecodeBare(b *bin.Buffer) error { { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field excluded_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field excluded_chat_ids: %w", err) } if headerLen > 0 { @@ -367,7 +367,7 @@ func (c *ChatFolder) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field excluded_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field excluded_chat_ids: %w", err) } c.ExcludedChatIDs = append(c.ExcludedChatIDs, value) } @@ -375,56 +375,56 @@ func (c *ChatFolder) DecodeBare(b *bin.Buffer) error { { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field exclude_muted: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field exclude_muted: %w", err) } c.ExcludeMuted = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field exclude_read: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field exclude_read: %w", err) } c.ExcludeRead = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field exclude_archived: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field exclude_archived: %w", err) } c.ExcludeArchived = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field include_contacts: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field include_contacts: %w", err) } c.IncludeContacts = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field include_non_contacts: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field include_non_contacts: %w", err) } c.IncludeNonContacts = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field include_bots: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field include_bots: %w", err) } c.IncludeBots = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field include_groups: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field include_groups: %w", err) } c.IncludeGroups = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field include_channels: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field include_channels: %w", err) } c.IncludeChannels = value } @@ -434,17 +434,19 @@ func (c *ChatFolder) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *ChatFolder) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatFolder#65805ba5 as nil") + return fmt.Errorf("can't encode chatFolder#a2e17d38 as nil") } b.ObjStart() b.PutID("chatFolder") b.Comma() - b.FieldStart("title") - b.PutString(c.Title) + b.FieldStart("name") + if err := c.Name.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatFolder#a2e17d38: field name: %w", err) + } b.Comma() b.FieldStart("icon") if err := c.Icon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatFolder#65805ba5: field icon: %w", err) + return fmt.Errorf("unable to encode chatFolder#a2e17d38: field icon: %w", err) } b.Comma() b.FieldStart("color_id") @@ -512,116 +514,114 @@ func (c *ChatFolder) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *ChatFolder) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatFolder#65805ba5 to nil") + return fmt.Errorf("can't decode chatFolder#a2e17d38 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("chatFolder"); err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: %w", err) } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field title: %w", err) + case "name": + if err := c.Name.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field name: %w", err) } - c.Title = value case "icon": if err := c.Icon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field icon: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field icon: %w", err) } case "color_id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field color_id: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field color_id: %w", err) } c.ColorID = value case "is_shareable": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field is_shareable: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field is_shareable: %w", err) } c.IsShareable = value case "pinned_chat_ids": if err := b.Arr(func(b tdjson.Decoder) error { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field pinned_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field pinned_chat_ids: %w", err) } c.PinnedChatIDs = append(c.PinnedChatIDs, value) return nil }); err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field pinned_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field pinned_chat_ids: %w", err) } case "included_chat_ids": if err := b.Arr(func(b tdjson.Decoder) error { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field included_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field included_chat_ids: %w", err) } c.IncludedChatIDs = append(c.IncludedChatIDs, value) return nil }); err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field included_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field included_chat_ids: %w", err) } case "excluded_chat_ids": if err := b.Arr(func(b tdjson.Decoder) error { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field excluded_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field excluded_chat_ids: %w", err) } c.ExcludedChatIDs = append(c.ExcludedChatIDs, value) return nil }); err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field excluded_chat_ids: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field excluded_chat_ids: %w", err) } case "exclude_muted": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field exclude_muted: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field exclude_muted: %w", err) } c.ExcludeMuted = value case "exclude_read": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field exclude_read: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field exclude_read: %w", err) } c.ExcludeRead = value case "exclude_archived": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field exclude_archived: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field exclude_archived: %w", err) } c.ExcludeArchived = value case "include_contacts": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field include_contacts: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field include_contacts: %w", err) } c.IncludeContacts = value case "include_non_contacts": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field include_non_contacts: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field include_non_contacts: %w", err) } c.IncludeNonContacts = value case "include_bots": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field include_bots: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field include_bots: %w", err) } c.IncludeBots = value case "include_groups": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field include_groups: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field include_groups: %w", err) } c.IncludeGroups = value case "include_channels": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolder#65805ba5: field include_channels: %w", err) + return fmt.Errorf("unable to decode chatFolder#a2e17d38: field include_channels: %w", err) } c.IncludeChannels = value default: @@ -631,12 +631,12 @@ func (c *ChatFolder) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetTitle returns value of Title field. -func (c *ChatFolder) GetTitle() (value string) { +// GetName returns value of Name field. +func (c *ChatFolder) GetName() (value ChatFolderName) { if c == nil { return } - return c.Title + return c.Name } // GetIcon returns value of Icon field. diff --git a/tdapi/tl_chat_folder_info_gen.go b/tdapi/tl_chat_folder_info_gen.go index 9c14f1b832..33690ecc6d 100644 --- a/tdapi/tl_chat_folder_info_gen.go +++ b/tdapi/tl_chat_folder_info_gen.go @@ -31,12 +31,12 @@ var ( _ = tdjson.Encoder{} ) -// ChatFolderInfo represents TL type `chatFolderInfo#b61a485`. +// ChatFolderInfo represents TL type `chatFolderInfo#309c140d`. type ChatFolderInfo struct { // Unique chat folder identifier ID int32 - // The title of the folder; 1-12 characters without line feeds - Title string + // The name of the folder + Name ChatFolderName // The chosen or default icon for the chat folder Icon ChatFolderIcon // The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then @@ -49,7 +49,7 @@ type ChatFolderInfo struct { } // ChatFolderInfoTypeID is TL type id of ChatFolderInfo. -const ChatFolderInfoTypeID = 0xb61a485 +const ChatFolderInfoTypeID = 0x309c140d // Ensuring interfaces in compile-time for ChatFolderInfo. var ( @@ -66,7 +66,7 @@ func (c *ChatFolderInfo) Zero() bool { if !(c.ID == 0) { return false } - if !(c.Title == "") { + if !(c.Name.Zero()) { return false } if !(c.Icon.Zero()) { @@ -122,8 +122,8 @@ func (c *ChatFolderInfo) TypeInfo() tdp.Type { SchemaName: "id", }, { - Name: "Title", - SchemaName: "title", + Name: "Name", + SchemaName: "name", }, { Name: "Icon", @@ -148,7 +148,7 @@ func (c *ChatFolderInfo) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *ChatFolderInfo) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatFolderInfo#b61a485 as nil") + return fmt.Errorf("can't encode chatFolderInfo#309c140d as nil") } b.PutID(ChatFolderInfoTypeID) return c.EncodeBare(b) @@ -157,12 +157,14 @@ func (c *ChatFolderInfo) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatFolderInfo) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatFolderInfo#b61a485 as nil") + return fmt.Errorf("can't encode chatFolderInfo#309c140d as nil") } b.PutInt32(c.ID) - b.PutString(c.Title) + if err := c.Name.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatFolderInfo#309c140d: field name: %w", err) + } if err := c.Icon.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatFolderInfo#b61a485: field icon: %w", err) + return fmt.Errorf("unable to encode chatFolderInfo#309c140d: field icon: %w", err) } b.PutInt32(c.ColorID) b.PutBool(c.IsShareable) @@ -173,10 +175,10 @@ func (c *ChatFolderInfo) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (c *ChatFolderInfo) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatFolderInfo#b61a485 to nil") + return fmt.Errorf("can't decode chatFolderInfo#309c140d to nil") } if err := b.ConsumeID(ChatFolderInfoTypeID); err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#b61a485: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#309c140d: %w", err) } return c.DecodeBare(b) } @@ -184,45 +186,43 @@ func (c *ChatFolderInfo) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatFolderInfo) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatFolderInfo#b61a485 to nil") + return fmt.Errorf("can't decode chatFolderInfo#309c140d to nil") } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field id: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field id: %w", err) } c.ID = value } { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field title: %w", err) + if err := c.Name.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field name: %w", err) } - c.Title = value } { if err := c.Icon.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field icon: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field icon: %w", err) } } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field color_id: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field color_id: %w", err) } c.ColorID = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field is_shareable: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field is_shareable: %w", err) } c.IsShareable = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field has_my_invite_links: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field has_my_invite_links: %w", err) } c.HasMyInviteLinks = value } @@ -232,7 +232,7 @@ func (c *ChatFolderInfo) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *ChatFolderInfo) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatFolderInfo#b61a485 as nil") + return fmt.Errorf("can't encode chatFolderInfo#309c140d as nil") } b.ObjStart() b.PutID("chatFolderInfo") @@ -240,12 +240,14 @@ func (c *ChatFolderInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("id") b.PutInt32(c.ID) b.Comma() - b.FieldStart("title") - b.PutString(c.Title) + b.FieldStart("name") + if err := c.Name.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatFolderInfo#309c140d: field name: %w", err) + } b.Comma() b.FieldStart("icon") if err := c.Icon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatFolderInfo#b61a485: field icon: %w", err) + return fmt.Errorf("unable to encode chatFolderInfo#309c140d: field icon: %w", err) } b.Comma() b.FieldStart("color_id") @@ -265,47 +267,45 @@ func (c *ChatFolderInfo) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *ChatFolderInfo) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatFolderInfo#b61a485 to nil") + return fmt.Errorf("can't decode chatFolderInfo#309c140d to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("chatFolderInfo"); err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#b61a485: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#309c140d: %w", err) } case "id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field id: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field id: %w", err) } c.ID = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field title: %w", err) + case "name": + if err := c.Name.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field name: %w", err) } - c.Title = value case "icon": if err := c.Icon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field icon: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field icon: %w", err) } case "color_id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field color_id: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field color_id: %w", err) } c.ColorID = value case "is_shareable": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field is_shareable: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field is_shareable: %w", err) } c.IsShareable = value case "has_my_invite_links": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#b61a485: field has_my_invite_links: %w", err) + return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field has_my_invite_links: %w", err) } c.HasMyInviteLinks = value default: @@ -323,12 +323,12 @@ func (c *ChatFolderInfo) GetID() (value int32) { return c.ID } -// GetTitle returns value of Title field. -func (c *ChatFolderInfo) GetTitle() (value string) { +// GetName returns value of Name field. +func (c *ChatFolderInfo) GetName() (value ChatFolderName) { if c == nil { return } - return c.Title + return c.Name } // GetIcon returns value of Icon field. diff --git a/tdapi/tl_chat_folder_name_gen.go b/tdapi/tl_chat_folder_name_gen.go new file mode 100644 index 0000000000..a07827bbfc --- /dev/null +++ b/tdapi/tl_chat_folder_name_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{} +) + +// ChatFolderName represents TL type `chatFolderName#ec4d3d9e`. +type ChatFolderName struct { + // The text of the chat folder name; 1-12 characters without line feeds. May contain only + // CustomEmoji entities + Text FormattedText + // True, if custom emoji in the name must be animated + AnimateCustomEmoji bool +} + +// ChatFolderNameTypeID is TL type id of ChatFolderName. +const ChatFolderNameTypeID = 0xec4d3d9e + +// Ensuring interfaces in compile-time for ChatFolderName. +var ( + _ bin.Encoder = &ChatFolderName{} + _ bin.Decoder = &ChatFolderName{} + _ bin.BareEncoder = &ChatFolderName{} + _ bin.BareDecoder = &ChatFolderName{} +) + +func (c *ChatFolderName) Zero() bool { + if c == nil { + return true + } + if !(c.Text.Zero()) { + return false + } + if !(c.AnimateCustomEmoji == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChatFolderName) String() string { + if c == nil { + return "ChatFolderName(nil)" + } + type Alias ChatFolderName + return fmt.Sprintf("ChatFolderName%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChatFolderName) TypeID() uint32 { + return ChatFolderNameTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChatFolderName) TypeName() string { + return "chatFolderName" +} + +// TypeInfo returns info about TL type. +func (c *ChatFolderName) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "chatFolderName", + ID: ChatFolderNameTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Text", + SchemaName: "text", + }, + { + Name: "AnimateCustomEmoji", + SchemaName: "animate_custom_emoji", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChatFolderName) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatFolderName#ec4d3d9e as nil") + } + b.PutID(ChatFolderNameTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChatFolderName) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatFolderName#ec4d3d9e as nil") + } + if err := c.Text.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatFolderName#ec4d3d9e: field text: %w", err) + } + b.PutBool(c.AnimateCustomEmoji) + return nil +} + +// Decode implements bin.Decoder. +func (c *ChatFolderName) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatFolderName#ec4d3d9e to nil") + } + if err := b.ConsumeID(ChatFolderNameTypeID); err != nil { + return fmt.Errorf("unable to decode chatFolderName#ec4d3d9e: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChatFolderName) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatFolderName#ec4d3d9e to nil") + } + { + if err := c.Text.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatFolderName#ec4d3d9e: field text: %w", err) + } + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatFolderName#ec4d3d9e: field animate_custom_emoji: %w", err) + } + c.AnimateCustomEmoji = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatFolderName) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatFolderName#ec4d3d9e as nil") + } + b.ObjStart() + b.PutID("chatFolderName") + b.Comma() + b.FieldStart("text") + if err := c.Text.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatFolderName#ec4d3d9e: field text: %w", err) + } + b.Comma() + b.FieldStart("animate_custom_emoji") + b.PutBool(c.AnimateCustomEmoji) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ChatFolderName) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode chatFolderName#ec4d3d9e to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("chatFolderName"); err != nil { + return fmt.Errorf("unable to decode chatFolderName#ec4d3d9e: %w", err) + } + case "text": + if err := c.Text.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode chatFolderName#ec4d3d9e: field text: %w", err) + } + case "animate_custom_emoji": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatFolderName#ec4d3d9e: field animate_custom_emoji: %w", err) + } + c.AnimateCustomEmoji = value + default: + return b.Skip() + } + return nil + }) +} + +// GetText returns value of Text field. +func (c *ChatFolderName) GetText() (value FormattedText) { + if c == nil { + return + } + return c.Text +} + +// GetAnimateCustomEmoji returns value of AnimateCustomEmoji field. +func (c *ChatFolderName) GetAnimateCustomEmoji() (value bool) { + if c == nil { + return + } + return c.AnimateCustomEmoji +} diff --git a/tdapi/tl_chat_invite_link_info_gen.go b/tdapi/tl_chat_invite_link_info_gen.go index 39d0b32d73..ddace04f66 100644 --- a/tdapi/tl_chat_invite_link_info_gen.go +++ b/tdapi/tl_chat_invite_link_info_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// ChatInviteLinkInfo represents TL type `chatInviteLinkInfo#95bf0ec4`. +// ChatInviteLinkInfo represents TL type `chatInviteLinkInfo#c3fe73a`. type ChatInviteLinkInfo struct { // Chat identifier of the invite link; 0 if the user has no access to the chat before // joining @@ -61,16 +61,12 @@ type ChatInviteLinkInfo struct { // True, if the chat is a public supergroup or channel, i.e. it has a username or it is a // location-based supergroup IsPublic bool - // True, if the chat is verified - IsVerified bool - // True, if many users reported this chat as a scam - IsScam bool - // True, if many users reported this chat as a fake account - IsFake bool + // Information about verification status of the chat; may be null if none + VerificationStatus VerificationStatus } // ChatInviteLinkInfoTypeID is TL type id of ChatInviteLinkInfo. -const ChatInviteLinkInfoTypeID = 0x95bf0ec4 +const ChatInviteLinkInfoTypeID = 0xc3fe73a // Ensuring interfaces in compile-time for ChatInviteLinkInfo. var ( @@ -120,13 +116,7 @@ func (c *ChatInviteLinkInfo) Zero() bool { if !(c.IsPublic == false) { return false } - if !(c.IsVerified == false) { - return false - } - if !(c.IsScam == false) { - return false - } - if !(c.IsFake == false) { + if !(c.VerificationStatus.Zero()) { return false } @@ -214,16 +204,8 @@ func (c *ChatInviteLinkInfo) TypeInfo() tdp.Type { SchemaName: "is_public", }, { - Name: "IsVerified", - SchemaName: "is_verified", - }, - { - Name: "IsScam", - SchemaName: "is_scam", - }, - { - Name: "IsFake", - SchemaName: "is_fake", + Name: "VerificationStatus", + SchemaName: "verification_status", }, } return typ @@ -232,7 +214,7 @@ func (c *ChatInviteLinkInfo) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *ChatInviteLinkInfo) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatInviteLinkInfo#95bf0ec4 as nil") + return fmt.Errorf("can't encode chatInviteLinkInfo#c3fe73a as nil") } b.PutID(ChatInviteLinkInfoTypeID) return c.EncodeBare(b) @@ -241,19 +223,19 @@ func (c *ChatInviteLinkInfo) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatInviteLinkInfo) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatInviteLinkInfo#95bf0ec4 as nil") + return fmt.Errorf("can't encode chatInviteLinkInfo#c3fe73a as nil") } b.PutInt53(c.ChatID) b.PutInt32(c.AccessibleFor) if c.Type == nil { - return fmt.Errorf("unable to encode chatInviteLinkInfo#95bf0ec4: field type is nil") + return fmt.Errorf("unable to encode chatInviteLinkInfo#c3fe73a: field type is nil") } if err := c.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLinkInfo#95bf0ec4: field type: %w", err) + return fmt.Errorf("unable to encode chatInviteLinkInfo#c3fe73a: field type: %w", err) } b.PutString(c.Title) if err := c.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLinkInfo#95bf0ec4: field photo: %w", err) + return fmt.Errorf("unable to encode chatInviteLinkInfo#c3fe73a: field photo: %w", err) } b.PutInt32(c.AccentColorID) b.PutString(c.Description) @@ -263,23 +245,23 @@ func (c *ChatInviteLinkInfo) EncodeBare(b *bin.Buffer) error { b.PutInt53(v) } if err := c.SubscriptionInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLinkInfo#95bf0ec4: field subscription_info: %w", err) + return fmt.Errorf("unable to encode chatInviteLinkInfo#c3fe73a: field subscription_info: %w", err) } b.PutBool(c.CreatesJoinRequest) b.PutBool(c.IsPublic) - b.PutBool(c.IsVerified) - b.PutBool(c.IsScam) - b.PutBool(c.IsFake) + if err := c.VerificationStatus.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatInviteLinkInfo#c3fe73a: field verification_status: %w", err) + } return nil } // Decode implements bin.Decoder. func (c *ChatInviteLinkInfo) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatInviteLinkInfo#95bf0ec4 to nil") + return fmt.Errorf("can't decode chatInviteLinkInfo#c3fe73a to nil") } if err := b.ConsumeID(ChatInviteLinkInfoTypeID); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: %w", err) } return c.DecodeBare(b) } @@ -287,66 +269,66 @@ func (c *ChatInviteLinkInfo) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatInviteLinkInfo) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatInviteLinkInfo#95bf0ec4 to nil") + return fmt.Errorf("can't decode chatInviteLinkInfo#c3fe73a to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field chat_id: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field chat_id: %w", err) } c.ChatID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field accessible_for: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field accessible_for: %w", err) } c.AccessibleFor = value } { value, err := DecodeInviteLinkChatType(b) if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field type: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field type: %w", err) } c.Type = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field title: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field title: %w", err) } c.Title = value } { if err := c.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field photo: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field photo: %w", err) } } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field accent_color_id: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field accent_color_id: %w", err) } c.AccentColorID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field description: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field description: %w", err) } c.Description = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field member_count: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field member_count: %w", err) } c.MemberCount = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field member_user_ids: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field member_user_ids: %w", err) } if headerLen > 0 { @@ -355,50 +337,34 @@ func (c *ChatInviteLinkInfo) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field member_user_ids: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field member_user_ids: %w", err) } c.MemberUserIDs = append(c.MemberUserIDs, value) } } { if err := c.SubscriptionInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field subscription_info: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field subscription_info: %w", err) } } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field creates_join_request: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field creates_join_request: %w", err) } c.CreatesJoinRequest = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field is_public: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field is_public: %w", err) } c.IsPublic = value } { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field is_verified: %w", err) - } - c.IsVerified = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field is_scam: %w", err) - } - c.IsScam = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field is_fake: %w", err) + if err := c.VerificationStatus.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field verification_status: %w", err) } - c.IsFake = value } return nil } @@ -406,7 +372,7 @@ func (c *ChatInviteLinkInfo) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *ChatInviteLinkInfo) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatInviteLinkInfo#95bf0ec4 as nil") + return fmt.Errorf("can't encode chatInviteLinkInfo#c3fe73a as nil") } b.ObjStart() b.PutID("chatInviteLinkInfo") @@ -419,10 +385,10 @@ func (c *ChatInviteLinkInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("type") if c.Type == nil { - return fmt.Errorf("unable to encode chatInviteLinkInfo#95bf0ec4: field type is nil") + return fmt.Errorf("unable to encode chatInviteLinkInfo#c3fe73a: field type is nil") } if err := c.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLinkInfo#95bf0ec4: field type: %w", err) + return fmt.Errorf("unable to encode chatInviteLinkInfo#c3fe73a: field type: %w", err) } b.Comma() b.FieldStart("title") @@ -430,7 +396,7 @@ func (c *ChatInviteLinkInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("photo") if err := c.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLinkInfo#95bf0ec4: field photo: %w", err) + return fmt.Errorf("unable to encode chatInviteLinkInfo#c3fe73a: field photo: %w", err) } b.Comma() b.FieldStart("accent_color_id") @@ -453,7 +419,7 @@ func (c *ChatInviteLinkInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("subscription_info") if err := c.SubscriptionInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLinkInfo#95bf0ec4: field subscription_info: %w", err) + return fmt.Errorf("unable to encode chatInviteLinkInfo#c3fe73a: field subscription_info: %w", err) } b.Comma() b.FieldStart("creates_join_request") @@ -462,14 +428,10 @@ func (c *ChatInviteLinkInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("is_public") b.PutBool(c.IsPublic) b.Comma() - b.FieldStart("is_verified") - b.PutBool(c.IsVerified) - b.Comma() - b.FieldStart("is_scam") - b.PutBool(c.IsScam) - b.Comma() - b.FieldStart("is_fake") - b.PutBool(c.IsFake) + b.FieldStart("verification_status") + if err := c.VerificationStatus.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatInviteLinkInfo#c3fe73a: field verification_status: %w", err) + } b.Comma() b.StripComma() b.ObjEnd() @@ -479,106 +441,92 @@ func (c *ChatInviteLinkInfo) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *ChatInviteLinkInfo) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatInviteLinkInfo#95bf0ec4 to nil") + return fmt.Errorf("can't decode chatInviteLinkInfo#c3fe73a to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("chatInviteLinkInfo"); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field chat_id: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field chat_id: %w", err) } c.ChatID = value case "accessible_for": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field accessible_for: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field accessible_for: %w", err) } c.AccessibleFor = value case "type": value, err := DecodeTDLibJSONInviteLinkChatType(b) if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field type: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field type: %w", err) } c.Type = value case "title": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field title: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field title: %w", err) } c.Title = value case "photo": if err := c.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field photo: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field photo: %w", err) } case "accent_color_id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field accent_color_id: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field accent_color_id: %w", err) } c.AccentColorID = value case "description": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field description: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field description: %w", err) } c.Description = value case "member_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field member_count: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field member_count: %w", err) } c.MemberCount = value case "member_user_ids": if err := b.Arr(func(b tdjson.Decoder) error { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field member_user_ids: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field member_user_ids: %w", err) } c.MemberUserIDs = append(c.MemberUserIDs, value) return nil }); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field member_user_ids: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field member_user_ids: %w", err) } case "subscription_info": if err := c.SubscriptionInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field subscription_info: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field subscription_info: %w", err) } case "creates_join_request": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field creates_join_request: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field creates_join_request: %w", err) } c.CreatesJoinRequest = value case "is_public": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field is_public: %w", err) + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field is_public: %w", err) } c.IsPublic = value - case "is_verified": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field is_verified: %w", err) - } - c.IsVerified = value - case "is_scam": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field is_scam: %w", err) - } - c.IsScam = value - case "is_fake": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#95bf0ec4: field is_fake: %w", err) + case "verification_status": + if err := c.VerificationStatus.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field verification_status: %w", err) } - c.IsFake = value default: return b.Skip() } @@ -682,26 +630,10 @@ func (c *ChatInviteLinkInfo) GetIsPublic() (value bool) { return c.IsPublic } -// GetIsVerified returns value of IsVerified field. -func (c *ChatInviteLinkInfo) GetIsVerified() (value bool) { - if c == nil { - return - } - return c.IsVerified -} - -// GetIsScam returns value of IsScam field. -func (c *ChatInviteLinkInfo) GetIsScam() (value bool) { - if c == nil { - return - } - return c.IsScam -} - -// GetIsFake returns value of IsFake field. -func (c *ChatInviteLinkInfo) GetIsFake() (value bool) { +// GetVerificationStatus returns value of VerificationStatus field. +func (c *ChatInviteLinkInfo) GetVerificationStatus() (value VerificationStatus) { if c == nil { return } - return c.IsFake + return c.VerificationStatus } diff --git a/tdapi/tl_connect_affiliate_program_gen.go b/tdapi/tl_connect_affiliate_program_gen.go new file mode 100644 index 0000000000..6725802448 --- /dev/null +++ b/tdapi/tl_connect_affiliate_program_gen.go @@ -0,0 +1,247 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// ConnectAffiliateProgramRequest represents TL type `connectAffiliateProgram#6306d72c`. +type ConnectAffiliateProgramRequest struct { + // The affiliate to which the affiliate program will be connected + Affiliate AffiliateTypeClass + // Identifier of the bot, which affiliate program is connected + BotUserID int64 +} + +// ConnectAffiliateProgramRequestTypeID is TL type id of ConnectAffiliateProgramRequest. +const ConnectAffiliateProgramRequestTypeID = 0x6306d72c + +// Ensuring interfaces in compile-time for ConnectAffiliateProgramRequest. +var ( + _ bin.Encoder = &ConnectAffiliateProgramRequest{} + _ bin.Decoder = &ConnectAffiliateProgramRequest{} + _ bin.BareEncoder = &ConnectAffiliateProgramRequest{} + _ bin.BareDecoder = &ConnectAffiliateProgramRequest{} +) + +func (c *ConnectAffiliateProgramRequest) Zero() bool { + if c == nil { + return true + } + if !(c.Affiliate == nil) { + return false + } + if !(c.BotUserID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ConnectAffiliateProgramRequest) String() string { + if c == nil { + return "ConnectAffiliateProgramRequest(nil)" + } + type Alias ConnectAffiliateProgramRequest + return fmt.Sprintf("ConnectAffiliateProgramRequest%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ConnectAffiliateProgramRequest) TypeID() uint32 { + return ConnectAffiliateProgramRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ConnectAffiliateProgramRequest) TypeName() string { + return "connectAffiliateProgram" +} + +// TypeInfo returns info about TL type. +func (c *ConnectAffiliateProgramRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "connectAffiliateProgram", + ID: ConnectAffiliateProgramRequestTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Affiliate", + SchemaName: "affiliate", + }, + { + Name: "BotUserID", + SchemaName: "bot_user_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ConnectAffiliateProgramRequest) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode connectAffiliateProgram#6306d72c as nil") + } + b.PutID(ConnectAffiliateProgramRequestTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ConnectAffiliateProgramRequest) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode connectAffiliateProgram#6306d72c as nil") + } + if c.Affiliate == nil { + return fmt.Errorf("unable to encode connectAffiliateProgram#6306d72c: field affiliate is nil") + } + if err := c.Affiliate.Encode(b); err != nil { + return fmt.Errorf("unable to encode connectAffiliateProgram#6306d72c: field affiliate: %w", err) + } + b.PutInt53(c.BotUserID) + return nil +} + +// Decode implements bin.Decoder. +func (c *ConnectAffiliateProgramRequest) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode connectAffiliateProgram#6306d72c to nil") + } + if err := b.ConsumeID(ConnectAffiliateProgramRequestTypeID); err != nil { + return fmt.Errorf("unable to decode connectAffiliateProgram#6306d72c: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ConnectAffiliateProgramRequest) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode connectAffiliateProgram#6306d72c to nil") + } + { + value, err := DecodeAffiliateType(b) + if err != nil { + return fmt.Errorf("unable to decode connectAffiliateProgram#6306d72c: field affiliate: %w", err) + } + c.Affiliate = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode connectAffiliateProgram#6306d72c: field bot_user_id: %w", err) + } + c.BotUserID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ConnectAffiliateProgramRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode connectAffiliateProgram#6306d72c as nil") + } + b.ObjStart() + b.PutID("connectAffiliateProgram") + b.Comma() + b.FieldStart("affiliate") + if c.Affiliate == nil { + return fmt.Errorf("unable to encode connectAffiliateProgram#6306d72c: field affiliate is nil") + } + if err := c.Affiliate.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode connectAffiliateProgram#6306d72c: field affiliate: %w", err) + } + b.Comma() + b.FieldStart("bot_user_id") + b.PutInt53(c.BotUserID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ConnectAffiliateProgramRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode connectAffiliateProgram#6306d72c to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("connectAffiliateProgram"); err != nil { + return fmt.Errorf("unable to decode connectAffiliateProgram#6306d72c: %w", err) + } + case "affiliate": + value, err := DecodeTDLibJSONAffiliateType(b) + if err != nil { + return fmt.Errorf("unable to decode connectAffiliateProgram#6306d72c: field affiliate: %w", err) + } + c.Affiliate = value + case "bot_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode connectAffiliateProgram#6306d72c: field bot_user_id: %w", err) + } + c.BotUserID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetAffiliate returns value of Affiliate field. +func (c *ConnectAffiliateProgramRequest) GetAffiliate() (value AffiliateTypeClass) { + if c == nil { + return + } + return c.Affiliate +} + +// GetBotUserID returns value of BotUserID field. +func (c *ConnectAffiliateProgramRequest) GetBotUserID() (value int64) { + if c == nil { + return + } + return c.BotUserID +} + +// ConnectAffiliateProgram invokes method connectAffiliateProgram#6306d72c returning error if any. +func (c *Client) ConnectAffiliateProgram(ctx context.Context, request *ConnectAffiliateProgramRequest) (*ConnectedAffiliateProgram, error) { + var result ConnectedAffiliateProgram + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_connect_chat_affiliate_program_gen.go b/tdapi/tl_connect_chat_affiliate_program_gen.go deleted file mode 100644 index d9be27a544..0000000000 --- a/tdapi/tl_connect_chat_affiliate_program_gen.go +++ /dev/null @@ -1,239 +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{} -) - -// ConnectChatAffiliateProgramRequest represents TL type `connectChatAffiliateProgram#75b163c4`. -type ConnectChatAffiliateProgramRequest struct { - // Identifier of the chat to which the affiliate program will be connected. Can be an - // identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel - // chat with can_post_messages administrator right - ChatID int64 - // Identifier of the bot, which affiliate program is connected - BotUserID int64 -} - -// ConnectChatAffiliateProgramRequestTypeID is TL type id of ConnectChatAffiliateProgramRequest. -const ConnectChatAffiliateProgramRequestTypeID = 0x75b163c4 - -// Ensuring interfaces in compile-time for ConnectChatAffiliateProgramRequest. -var ( - _ bin.Encoder = &ConnectChatAffiliateProgramRequest{} - _ bin.Decoder = &ConnectChatAffiliateProgramRequest{} - _ bin.BareEncoder = &ConnectChatAffiliateProgramRequest{} - _ bin.BareDecoder = &ConnectChatAffiliateProgramRequest{} -) - -func (c *ConnectChatAffiliateProgramRequest) Zero() bool { - if c == nil { - return true - } - if !(c.ChatID == 0) { - return false - } - if !(c.BotUserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ConnectChatAffiliateProgramRequest) String() string { - if c == nil { - return "ConnectChatAffiliateProgramRequest(nil)" - } - type Alias ConnectChatAffiliateProgramRequest - return fmt.Sprintf("ConnectChatAffiliateProgramRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ConnectChatAffiliateProgramRequest) TypeID() uint32 { - return ConnectChatAffiliateProgramRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ConnectChatAffiliateProgramRequest) TypeName() string { - return "connectChatAffiliateProgram" -} - -// TypeInfo returns info about TL type. -func (c *ConnectChatAffiliateProgramRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "connectChatAffiliateProgram", - ID: ConnectChatAffiliateProgramRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ConnectChatAffiliateProgramRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectChatAffiliateProgram#75b163c4 as nil") - } - b.PutID(ConnectChatAffiliateProgramRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ConnectChatAffiliateProgramRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectChatAffiliateProgram#75b163c4 as nil") - } - b.PutInt53(c.ChatID) - b.PutInt53(c.BotUserID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ConnectChatAffiliateProgramRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectChatAffiliateProgram#75b163c4 to nil") - } - if err := b.ConsumeID(ConnectChatAffiliateProgramRequestTypeID); err != nil { - return fmt.Errorf("unable to decode connectChatAffiliateProgram#75b163c4: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ConnectChatAffiliateProgramRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectChatAffiliateProgram#75b163c4 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode connectChatAffiliateProgram#75b163c4: field chat_id: %w", err) - } - c.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode connectChatAffiliateProgram#75b163c4: field bot_user_id: %w", err) - } - c.BotUserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ConnectChatAffiliateProgramRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode connectChatAffiliateProgram#75b163c4 as nil") - } - b.ObjStart() - b.PutID("connectChatAffiliateProgram") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(c.ChatID) - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(c.BotUserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ConnectChatAffiliateProgramRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode connectChatAffiliateProgram#75b163c4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("connectChatAffiliateProgram"); err != nil { - return fmt.Errorf("unable to decode connectChatAffiliateProgram#75b163c4: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode connectChatAffiliateProgram#75b163c4: field chat_id: %w", err) - } - c.ChatID = value - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode connectChatAffiliateProgram#75b163c4: field bot_user_id: %w", err) - } - c.BotUserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (c *ConnectChatAffiliateProgramRequest) GetChatID() (value int64) { - if c == nil { - return - } - return c.ChatID -} - -// GetBotUserID returns value of BotUserID field. -func (c *ConnectChatAffiliateProgramRequest) GetBotUserID() (value int64) { - if c == nil { - return - } - return c.BotUserID -} - -// ConnectChatAffiliateProgram invokes method connectChatAffiliateProgram#75b163c4 returning error if any. -func (c *Client) ConnectChatAffiliateProgram(ctx context.Context, request *ConnectChatAffiliateProgramRequest) (*ChatAffiliateProgram, error) { - var result ChatAffiliateProgram - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_chat_affiliate_program_gen.go b/tdapi/tl_connected_affiliate_program_gen.go similarity index 55% rename from tdapi/tl_chat_affiliate_program_gen.go rename to tdapi/tl_connected_affiliate_program_gen.go index ebf41ddc9b..8006fcec6c 100644 --- a/tdapi/tl_chat_affiliate_program_gen.go +++ b/tdapi/tl_connected_affiliate_program_gen.go @@ -31,8 +31,8 @@ var ( _ = tdjson.Encoder{} ) -// ChatAffiliateProgram represents TL type `chatAffiliateProgram#ab9c1136`. -type ChatAffiliateProgram struct { +// ConnectedAffiliateProgram represents TL type `connectedAffiliateProgram#58bf7415`. +type ConnectedAffiliateProgram struct { // The link that can be used to refer users if the program is still active URL string // User identifier of the bot created the program @@ -50,18 +50,18 @@ type ChatAffiliateProgram struct { RevenueStarCount int64 } -// ChatAffiliateProgramTypeID is TL type id of ChatAffiliateProgram. -const ChatAffiliateProgramTypeID = 0xab9c1136 +// ConnectedAffiliateProgramTypeID is TL type id of ConnectedAffiliateProgram. +const ConnectedAffiliateProgramTypeID = 0x58bf7415 -// Ensuring interfaces in compile-time for ChatAffiliateProgram. +// Ensuring interfaces in compile-time for ConnectedAffiliateProgram. var ( - _ bin.Encoder = &ChatAffiliateProgram{} - _ bin.Decoder = &ChatAffiliateProgram{} - _ bin.BareEncoder = &ChatAffiliateProgram{} - _ bin.BareDecoder = &ChatAffiliateProgram{} + _ bin.Encoder = &ConnectedAffiliateProgram{} + _ bin.Decoder = &ConnectedAffiliateProgram{} + _ bin.BareEncoder = &ConnectedAffiliateProgram{} + _ bin.BareDecoder = &ConnectedAffiliateProgram{} ) -func (c *ChatAffiliateProgram) Zero() bool { +func (c *ConnectedAffiliateProgram) Zero() bool { if c == nil { return true } @@ -91,31 +91,31 @@ func (c *ChatAffiliateProgram) Zero() bool { } // String implements fmt.Stringer. -func (c *ChatAffiliateProgram) String() string { +func (c *ConnectedAffiliateProgram) String() string { if c == nil { - return "ChatAffiliateProgram(nil)" + return "ConnectedAffiliateProgram(nil)" } - type Alias ChatAffiliateProgram - return fmt.Sprintf("ChatAffiliateProgram%+v", Alias(*c)) + type Alias ConnectedAffiliateProgram + return fmt.Sprintf("ConnectedAffiliateProgram%+v", Alias(*c)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatAffiliateProgram) TypeID() uint32 { - return ChatAffiliateProgramTypeID +func (*ConnectedAffiliateProgram) TypeID() uint32 { + return ConnectedAffiliateProgramTypeID } // TypeName returns name of type in TL schema. -func (*ChatAffiliateProgram) TypeName() string { - return "chatAffiliateProgram" +func (*ConnectedAffiliateProgram) TypeName() string { + return "connectedAffiliateProgram" } // TypeInfo returns info about TL type. -func (c *ChatAffiliateProgram) TypeInfo() tdp.Type { +func (c *ConnectedAffiliateProgram) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "chatAffiliateProgram", - ID: ChatAffiliateProgramTypeID, + Name: "connectedAffiliateProgram", + ID: ConnectedAffiliateProgramTypeID, } if c == nil { typ.Null = true @@ -155,23 +155,23 @@ func (c *ChatAffiliateProgram) TypeInfo() tdp.Type { } // Encode implements bin.Encoder. -func (c *ChatAffiliateProgram) Encode(b *bin.Buffer) error { +func (c *ConnectedAffiliateProgram) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatAffiliateProgram#ab9c1136 as nil") + return fmt.Errorf("can't encode connectedAffiliateProgram#58bf7415 as nil") } - b.PutID(ChatAffiliateProgramTypeID) + b.PutID(ConnectedAffiliateProgramTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *ChatAffiliateProgram) EncodeBare(b *bin.Buffer) error { +func (c *ConnectedAffiliateProgram) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatAffiliateProgram#ab9c1136 as nil") + return fmt.Errorf("can't encode connectedAffiliateProgram#58bf7415 as nil") } b.PutString(c.URL) b.PutInt53(c.BotUserID) if err := c.Parameters.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatAffiliateProgram#ab9c1136: field parameters: %w", err) + return fmt.Errorf("unable to encode connectedAffiliateProgram#58bf7415: field parameters: %w", err) } b.PutInt32(c.ConnectionDate) b.PutBool(c.IsDisconnected) @@ -181,65 +181,65 @@ func (c *ChatAffiliateProgram) EncodeBare(b *bin.Buffer) error { } // Decode implements bin.Decoder. -func (c *ChatAffiliateProgram) Decode(b *bin.Buffer) error { +func (c *ConnectedAffiliateProgram) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatAffiliateProgram#ab9c1136 to nil") + return fmt.Errorf("can't decode connectedAffiliateProgram#58bf7415 to nil") } - if err := b.ConsumeID(ChatAffiliateProgramTypeID); err != nil { - return fmt.Errorf("unable to decode chatAffiliateProgram#ab9c1136: %w", err) + if err := b.ConsumeID(ConnectedAffiliateProgramTypeID); err != nil { + return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *ChatAffiliateProgram) DecodeBare(b *bin.Buffer) error { +func (c *ConnectedAffiliateProgram) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatAffiliateProgram#ab9c1136 to nil") + return fmt.Errorf("can't decode connectedAffiliateProgram#58bf7415 to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatAffiliateProgram#ab9c1136: field url: %w", err) + return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field url: %w", err) } c.URL = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatAffiliateProgram#ab9c1136: field bot_user_id: %w", err) + return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field bot_user_id: %w", err) } c.BotUserID = value } { if err := c.Parameters.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatAffiliateProgram#ab9c1136: field parameters: %w", err) + return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field parameters: %w", err) } } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatAffiliateProgram#ab9c1136: field connection_date: %w", err) + return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field connection_date: %w", err) } c.ConnectionDate = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAffiliateProgram#ab9c1136: field is_disconnected: %w", err) + return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field is_disconnected: %w", err) } c.IsDisconnected = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chatAffiliateProgram#ab9c1136: field user_count: %w", err) + return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field user_count: %w", err) } c.UserCount = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chatAffiliateProgram#ab9c1136: field revenue_star_count: %w", err) + return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field revenue_star_count: %w", err) } c.RevenueStarCount = value } @@ -247,12 +247,12 @@ func (c *ChatAffiliateProgram) DecodeBare(b *bin.Buffer) error { } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatAffiliateProgram) EncodeTDLibJSON(b tdjson.Encoder) error { +func (c *ConnectedAffiliateProgram) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatAffiliateProgram#ab9c1136 as nil") + return fmt.Errorf("can't encode connectedAffiliateProgram#58bf7415 as nil") } b.ObjStart() - b.PutID("chatAffiliateProgram") + b.PutID("connectedAffiliateProgram") b.Comma() b.FieldStart("url") b.PutString(c.URL) @@ -262,7 +262,7 @@ func (c *ChatAffiliateProgram) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("parameters") if err := c.Parameters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatAffiliateProgram#ab9c1136: field parameters: %w", err) + return fmt.Errorf("unable to encode connectedAffiliateProgram#58bf7415: field parameters: %w", err) } b.Comma() b.FieldStart("connection_date") @@ -283,55 +283,55 @@ func (c *ChatAffiliateProgram) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatAffiliateProgram) DecodeTDLibJSON(b tdjson.Decoder) error { +func (c *ConnectedAffiliateProgram) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatAffiliateProgram#ab9c1136 to nil") + return fmt.Errorf("can't decode connectedAffiliateProgram#58bf7415 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("chatAffiliateProgram"); err != nil { - return fmt.Errorf("unable to decode chatAffiliateProgram#ab9c1136: %w", err) + if err := b.ConsumeID("connectedAffiliateProgram"); err != nil { + return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: %w", err) } case "url": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatAffiliateProgram#ab9c1136: field url: %w", err) + return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field url: %w", err) } c.URL = value case "bot_user_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatAffiliateProgram#ab9c1136: field bot_user_id: %w", err) + return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field bot_user_id: %w", err) } c.BotUserID = value case "parameters": if err := c.Parameters.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatAffiliateProgram#ab9c1136: field parameters: %w", err) + return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field parameters: %w", err) } case "connection_date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatAffiliateProgram#ab9c1136: field connection_date: %w", err) + return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field connection_date: %w", err) } c.ConnectionDate = value case "is_disconnected": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatAffiliateProgram#ab9c1136: field is_disconnected: %w", err) + return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field is_disconnected: %w", err) } c.IsDisconnected = value case "user_count": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chatAffiliateProgram#ab9c1136: field user_count: %w", err) + return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field user_count: %w", err) } c.UserCount = value case "revenue_star_count": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chatAffiliateProgram#ab9c1136: field revenue_star_count: %w", err) + return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field revenue_star_count: %w", err) } c.RevenueStarCount = value default: @@ -342,7 +342,7 @@ func (c *ChatAffiliateProgram) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetURL returns value of URL field. -func (c *ChatAffiliateProgram) GetURL() (value string) { +func (c *ConnectedAffiliateProgram) GetURL() (value string) { if c == nil { return } @@ -350,7 +350,7 @@ func (c *ChatAffiliateProgram) GetURL() (value string) { } // GetBotUserID returns value of BotUserID field. -func (c *ChatAffiliateProgram) GetBotUserID() (value int64) { +func (c *ConnectedAffiliateProgram) GetBotUserID() (value int64) { if c == nil { return } @@ -358,7 +358,7 @@ func (c *ChatAffiliateProgram) GetBotUserID() (value int64) { } // GetParameters returns value of Parameters field. -func (c *ChatAffiliateProgram) GetParameters() (value AffiliateProgramParameters) { +func (c *ConnectedAffiliateProgram) GetParameters() (value AffiliateProgramParameters) { if c == nil { return } @@ -366,7 +366,7 @@ func (c *ChatAffiliateProgram) GetParameters() (value AffiliateProgramParameters } // GetConnectionDate returns value of ConnectionDate field. -func (c *ChatAffiliateProgram) GetConnectionDate() (value int32) { +func (c *ConnectedAffiliateProgram) GetConnectionDate() (value int32) { if c == nil { return } @@ -374,7 +374,7 @@ func (c *ChatAffiliateProgram) GetConnectionDate() (value int32) { } // GetIsDisconnected returns value of IsDisconnected field. -func (c *ChatAffiliateProgram) GetIsDisconnected() (value bool) { +func (c *ConnectedAffiliateProgram) GetIsDisconnected() (value bool) { if c == nil { return } @@ -382,7 +382,7 @@ func (c *ChatAffiliateProgram) GetIsDisconnected() (value bool) { } // GetUserCount returns value of UserCount field. -func (c *ChatAffiliateProgram) GetUserCount() (value int64) { +func (c *ConnectedAffiliateProgram) GetUserCount() (value int64) { if c == nil { return } @@ -390,7 +390,7 @@ func (c *ChatAffiliateProgram) GetUserCount() (value int64) { } // GetRevenueStarCount returns value of RevenueStarCount field. -func (c *ChatAffiliateProgram) GetRevenueStarCount() (value int64) { +func (c *ConnectedAffiliateProgram) GetRevenueStarCount() (value int64) { if c == nil { return } diff --git a/tdapi/tl_connected_affiliate_programs_gen.go b/tdapi/tl_connected_affiliate_programs_gen.go new file mode 100644 index 0000000000..6570b016cd --- /dev/null +++ b/tdapi/tl_connected_affiliate_programs_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{} +) + +// ConnectedAffiliatePrograms represents TL type `connectedAffiliatePrograms#59231e33`. +type ConnectedAffiliatePrograms struct { + // The total number of affiliate programs that were connected to the affiliate + TotalCount int32 + // The list of connected affiliate programs + Programs []ConnectedAffiliateProgram + // The offset for the next request. If empty, then there are no more results + NextOffset string +} + +// ConnectedAffiliateProgramsTypeID is TL type id of ConnectedAffiliatePrograms. +const ConnectedAffiliateProgramsTypeID = 0x59231e33 + +// Ensuring interfaces in compile-time for ConnectedAffiliatePrograms. +var ( + _ bin.Encoder = &ConnectedAffiliatePrograms{} + _ bin.Decoder = &ConnectedAffiliatePrograms{} + _ bin.BareEncoder = &ConnectedAffiliatePrograms{} + _ bin.BareDecoder = &ConnectedAffiliatePrograms{} +) + +func (c *ConnectedAffiliatePrograms) Zero() bool { + if c == nil { + return true + } + if !(c.TotalCount == 0) { + return false + } + if !(c.Programs == nil) { + return false + } + if !(c.NextOffset == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ConnectedAffiliatePrograms) String() string { + if c == nil { + return "ConnectedAffiliatePrograms(nil)" + } + type Alias ConnectedAffiliatePrograms + return fmt.Sprintf("ConnectedAffiliatePrograms%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ConnectedAffiliatePrograms) TypeID() uint32 { + return ConnectedAffiliateProgramsTypeID +} + +// TypeName returns name of type in TL schema. +func (*ConnectedAffiliatePrograms) TypeName() string { + return "connectedAffiliatePrograms" +} + +// TypeInfo returns info about TL type. +func (c *ConnectedAffiliatePrograms) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "connectedAffiliatePrograms", + ID: ConnectedAffiliateProgramsTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "TotalCount", + SchemaName: "total_count", + }, + { + Name: "Programs", + SchemaName: "programs", + }, + { + Name: "NextOffset", + SchemaName: "next_offset", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ConnectedAffiliatePrograms) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode connectedAffiliatePrograms#59231e33 as nil") + } + b.PutID(ConnectedAffiliateProgramsTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ConnectedAffiliatePrograms) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode connectedAffiliatePrograms#59231e33 as nil") + } + b.PutInt32(c.TotalCount) + b.PutInt(len(c.Programs)) + for idx, v := range c.Programs { + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare connectedAffiliatePrograms#59231e33: field programs element with index %d: %w", idx, err) + } + } + b.PutString(c.NextOffset) + return nil +} + +// Decode implements bin.Decoder. +func (c *ConnectedAffiliatePrograms) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode connectedAffiliatePrograms#59231e33 to nil") + } + if err := b.ConsumeID(ConnectedAffiliateProgramsTypeID); err != nil { + return fmt.Errorf("unable to decode connectedAffiliatePrograms#59231e33: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ConnectedAffiliatePrograms) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode connectedAffiliatePrograms#59231e33 to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode connectedAffiliatePrograms#59231e33: field total_count: %w", err) + } + c.TotalCount = value + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode connectedAffiliatePrograms#59231e33: field programs: %w", err) + } + + if headerLen > 0 { + c.Programs = make([]ConnectedAffiliateProgram, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value ConnectedAffiliateProgram + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare connectedAffiliatePrograms#59231e33: field programs: %w", err) + } + c.Programs = append(c.Programs, value) + } + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode connectedAffiliatePrograms#59231e33: field next_offset: %w", err) + } + c.NextOffset = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ConnectedAffiliatePrograms) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode connectedAffiliatePrograms#59231e33 as nil") + } + b.ObjStart() + b.PutID("connectedAffiliatePrograms") + b.Comma() + b.FieldStart("total_count") + b.PutInt32(c.TotalCount) + b.Comma() + b.FieldStart("programs") + b.ArrStart() + for idx, v := range c.Programs { + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode connectedAffiliatePrograms#59231e33: field programs element with index %d: %w", idx, err) + } + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.FieldStart("next_offset") + b.PutString(c.NextOffset) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ConnectedAffiliatePrograms) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode connectedAffiliatePrograms#59231e33 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("connectedAffiliatePrograms"); err != nil { + return fmt.Errorf("unable to decode connectedAffiliatePrograms#59231e33: %w", err) + } + case "total_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode connectedAffiliatePrograms#59231e33: field total_count: %w", err) + } + c.TotalCount = value + case "programs": + if err := b.Arr(func(b tdjson.Decoder) error { + var value ConnectedAffiliateProgram + if err := value.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode connectedAffiliatePrograms#59231e33: field programs: %w", err) + } + c.Programs = append(c.Programs, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode connectedAffiliatePrograms#59231e33: field programs: %w", err) + } + case "next_offset": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode connectedAffiliatePrograms#59231e33: field next_offset: %w", err) + } + c.NextOffset = value + default: + return b.Skip() + } + return nil + }) +} + +// GetTotalCount returns value of TotalCount field. +func (c *ConnectedAffiliatePrograms) GetTotalCount() (value int32) { + if c == nil { + return + } + return c.TotalCount +} + +// GetPrograms returns value of Programs field. +func (c *ConnectedAffiliatePrograms) GetPrograms() (value []ConnectedAffiliateProgram) { + if c == nil { + return + } + return c.Programs +} + +// GetNextOffset returns value of NextOffset field. +func (c *ConnectedAffiliatePrograms) GetNextOffset() (value string) { + if c == nil { + return + } + return c.NextOffset +} diff --git a/tdapi/tl_create_call_gen.go b/tdapi/tl_create_call_gen.go index c9c6f2611c..69776b21bf 100644 --- a/tdapi/tl_create_call_gen.go +++ b/tdapi/tl_create_call_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// CreateCallRequest represents TL type `createCall#be282e10`. +// CreateCallRequest represents TL type `createCall#b4410c99`. type CreateCallRequest struct { // Identifier of the user to be called UserID int64 @@ -39,10 +39,13 @@ type CreateCallRequest struct { Protocol CallProtocol // Pass true to create a video call IsVideo bool + // Identifier of the group call to which the user will be added after exchanging private + // key via the call; pass 0 if none; currently, ignored + GroupCallID int32 } // CreateCallRequestTypeID is TL type id of CreateCallRequest. -const CreateCallRequestTypeID = 0xbe282e10 +const CreateCallRequestTypeID = 0xb4410c99 // Ensuring interfaces in compile-time for CreateCallRequest. var ( @@ -65,6 +68,9 @@ func (c *CreateCallRequest) Zero() bool { if !(c.IsVideo == false) { return false } + if !(c.GroupCallID == 0) { + return false + } return true } @@ -113,6 +119,10 @@ func (c *CreateCallRequest) TypeInfo() tdp.Type { Name: "IsVideo", SchemaName: "is_video", }, + { + Name: "GroupCallID", + SchemaName: "group_call_id", + }, } return typ } @@ -120,7 +130,7 @@ func (c *CreateCallRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *CreateCallRequest) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode createCall#be282e10 as nil") + return fmt.Errorf("can't encode createCall#b4410c99 as nil") } b.PutID(CreateCallRequestTypeID) return c.EncodeBare(b) @@ -129,23 +139,24 @@ func (c *CreateCallRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *CreateCallRequest) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode createCall#be282e10 as nil") + return fmt.Errorf("can't encode createCall#b4410c99 as nil") } b.PutInt53(c.UserID) if err := c.Protocol.Encode(b); err != nil { - return fmt.Errorf("unable to encode createCall#be282e10: field protocol: %w", err) + return fmt.Errorf("unable to encode createCall#b4410c99: field protocol: %w", err) } b.PutBool(c.IsVideo) + b.PutInt32(c.GroupCallID) return nil } // Decode implements bin.Decoder. func (c *CreateCallRequest) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode createCall#be282e10 to nil") + return fmt.Errorf("can't decode createCall#b4410c99 to nil") } if err := b.ConsumeID(CreateCallRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createCall#be282e10: %w", err) + return fmt.Errorf("unable to decode createCall#b4410c99: %w", err) } return c.DecodeBare(b) } @@ -153,34 +164,41 @@ func (c *CreateCallRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *CreateCallRequest) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode createCall#be282e10 to nil") + return fmt.Errorf("can't decode createCall#b4410c99 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode createCall#be282e10: field user_id: %w", err) + return fmt.Errorf("unable to decode createCall#b4410c99: field user_id: %w", err) } c.UserID = value } { if err := c.Protocol.Decode(b); err != nil { - return fmt.Errorf("unable to decode createCall#be282e10: field protocol: %w", err) + return fmt.Errorf("unable to decode createCall#b4410c99: field protocol: %w", err) } } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode createCall#be282e10: field is_video: %w", err) + return fmt.Errorf("unable to decode createCall#b4410c99: field is_video: %w", err) } c.IsVideo = value } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode createCall#b4410c99: field group_call_id: %w", err) + } + c.GroupCallID = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *CreateCallRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode createCall#be282e10 as nil") + return fmt.Errorf("can't encode createCall#b4410c99 as nil") } b.ObjStart() b.PutID("createCall") @@ -190,12 +208,15 @@ func (c *CreateCallRequest) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("protocol") if err := c.Protocol.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode createCall#be282e10: field protocol: %w", err) + return fmt.Errorf("unable to encode createCall#b4410c99: field protocol: %w", err) } b.Comma() b.FieldStart("is_video") b.PutBool(c.IsVideo) b.Comma() + b.FieldStart("group_call_id") + b.PutInt32(c.GroupCallID) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -204,31 +225,37 @@ func (c *CreateCallRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *CreateCallRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode createCall#be282e10 to nil") + return fmt.Errorf("can't decode createCall#b4410c99 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("createCall"); err != nil { - return fmt.Errorf("unable to decode createCall#be282e10: %w", err) + return fmt.Errorf("unable to decode createCall#b4410c99: %w", err) } case "user_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode createCall#be282e10: field user_id: %w", err) + return fmt.Errorf("unable to decode createCall#b4410c99: field user_id: %w", err) } c.UserID = value case "protocol": if err := c.Protocol.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode createCall#be282e10: field protocol: %w", err) + return fmt.Errorf("unable to decode createCall#b4410c99: field protocol: %w", err) } case "is_video": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode createCall#be282e10: field is_video: %w", err) + return fmt.Errorf("unable to decode createCall#b4410c99: field is_video: %w", err) } c.IsVideo = value + case "group_call_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode createCall#b4410c99: field group_call_id: %w", err) + } + c.GroupCallID = value default: return b.Skip() } @@ -260,7 +287,15 @@ func (c *CreateCallRequest) GetIsVideo() (value bool) { return c.IsVideo } -// CreateCall invokes method createCall#be282e10 returning error if any. +// GetGroupCallID returns value of GroupCallID field. +func (c *CreateCallRequest) GetGroupCallID() (value int32) { + if c == nil { + return + } + return c.GroupCallID +} + +// CreateCall invokes method createCall#b4410c99 returning error if any. func (c *Client) CreateCall(ctx context.Context, request *CreateCallRequest) (*CallID, error) { var result CallID diff --git a/tdapi/tl_create_group_call_gen.go b/tdapi/tl_create_group_call_gen.go new file mode 100644 index 0000000000..37df5067de --- /dev/null +++ b/tdapi/tl_create_group_call_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{} +) + +// CreateGroupCallRequest represents TL type `createGroupCall#87b855fb`. +type CreateGroupCallRequest struct { + // Call identifier + CallID int32 +} + +// CreateGroupCallRequestTypeID is TL type id of CreateGroupCallRequest. +const CreateGroupCallRequestTypeID = 0x87b855fb + +// Ensuring interfaces in compile-time for CreateGroupCallRequest. +var ( + _ bin.Encoder = &CreateGroupCallRequest{} + _ bin.Decoder = &CreateGroupCallRequest{} + _ bin.BareEncoder = &CreateGroupCallRequest{} + _ bin.BareDecoder = &CreateGroupCallRequest{} +) + +func (c *CreateGroupCallRequest) Zero() bool { + if c == nil { + return true + } + if !(c.CallID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *CreateGroupCallRequest) String() string { + if c == nil { + return "CreateGroupCallRequest(nil)" + } + type Alias CreateGroupCallRequest + return fmt.Sprintf("CreateGroupCallRequest%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*CreateGroupCallRequest) TypeID() uint32 { + return CreateGroupCallRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*CreateGroupCallRequest) TypeName() string { + return "createGroupCall" +} + +// TypeInfo returns info about TL type. +func (c *CreateGroupCallRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "createGroupCall", + ID: CreateGroupCallRequestTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "CallID", + SchemaName: "call_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *CreateGroupCallRequest) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode createGroupCall#87b855fb as nil") + } + b.PutID(CreateGroupCallRequestTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *CreateGroupCallRequest) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode createGroupCall#87b855fb as nil") + } + b.PutInt32(c.CallID) + return nil +} + +// Decode implements bin.Decoder. +func (c *CreateGroupCallRequest) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode createGroupCall#87b855fb to nil") + } + if err := b.ConsumeID(CreateGroupCallRequestTypeID); err != nil { + return fmt.Errorf("unable to decode createGroupCall#87b855fb: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *CreateGroupCallRequest) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode createGroupCall#87b855fb to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode createGroupCall#87b855fb: field call_id: %w", err) + } + c.CallID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *CreateGroupCallRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode createGroupCall#87b855fb as nil") + } + b.ObjStart() + b.PutID("createGroupCall") + b.Comma() + b.FieldStart("call_id") + b.PutInt32(c.CallID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *CreateGroupCallRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode createGroupCall#87b855fb to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("createGroupCall"); err != nil { + return fmt.Errorf("unable to decode createGroupCall#87b855fb: %w", err) + } + case "call_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode createGroupCall#87b855fb: field call_id: %w", err) + } + c.CallID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetCallID returns value of CallID field. +func (c *CreateGroupCallRequest) GetCallID() (value int32) { + if c == nil { + return + } + return c.CallID +} + +// CreateGroupCall invokes method createGroupCall#87b855fb returning error if any. +func (c *Client) CreateGroupCall(ctx context.Context, callid int32) error { + var ok Ok + + request := &CreateGroupCallRequest{ + CallID: callid, + } + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_disconnect_affiliate_program_gen.go b/tdapi/tl_disconnect_affiliate_program_gen.go new file mode 100644 index 0000000000..e67376419c --- /dev/null +++ b/tdapi/tl_disconnect_affiliate_program_gen.go @@ -0,0 +1,247 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// DisconnectAffiliateProgramRequest represents TL type `disconnectAffiliateProgram#f9b124fc`. +type DisconnectAffiliateProgramRequest struct { + // The affiliate to which the affiliate program is connected + Affiliate AffiliateTypeClass + // The referral link of the affiliate program + URL string +} + +// DisconnectAffiliateProgramRequestTypeID is TL type id of DisconnectAffiliateProgramRequest. +const DisconnectAffiliateProgramRequestTypeID = 0xf9b124fc + +// Ensuring interfaces in compile-time for DisconnectAffiliateProgramRequest. +var ( + _ bin.Encoder = &DisconnectAffiliateProgramRequest{} + _ bin.Decoder = &DisconnectAffiliateProgramRequest{} + _ bin.BareEncoder = &DisconnectAffiliateProgramRequest{} + _ bin.BareDecoder = &DisconnectAffiliateProgramRequest{} +) + +func (d *DisconnectAffiliateProgramRequest) Zero() bool { + if d == nil { + return true + } + if !(d.Affiliate == nil) { + return false + } + if !(d.URL == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (d *DisconnectAffiliateProgramRequest) String() string { + if d == nil { + return "DisconnectAffiliateProgramRequest(nil)" + } + type Alias DisconnectAffiliateProgramRequest + return fmt.Sprintf("DisconnectAffiliateProgramRequest%+v", Alias(*d)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*DisconnectAffiliateProgramRequest) TypeID() uint32 { + return DisconnectAffiliateProgramRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*DisconnectAffiliateProgramRequest) TypeName() string { + return "disconnectAffiliateProgram" +} + +// TypeInfo returns info about TL type. +func (d *DisconnectAffiliateProgramRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "disconnectAffiliateProgram", + ID: DisconnectAffiliateProgramRequestTypeID, + } + if d == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Affiliate", + SchemaName: "affiliate", + }, + { + Name: "URL", + SchemaName: "url", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (d *DisconnectAffiliateProgramRequest) Encode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode disconnectAffiliateProgram#f9b124fc as nil") + } + b.PutID(DisconnectAffiliateProgramRequestTypeID) + return d.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (d *DisconnectAffiliateProgramRequest) EncodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode disconnectAffiliateProgram#f9b124fc as nil") + } + if d.Affiliate == nil { + return fmt.Errorf("unable to encode disconnectAffiliateProgram#f9b124fc: field affiliate is nil") + } + if err := d.Affiliate.Encode(b); err != nil { + return fmt.Errorf("unable to encode disconnectAffiliateProgram#f9b124fc: field affiliate: %w", err) + } + b.PutString(d.URL) + return nil +} + +// Decode implements bin.Decoder. +func (d *DisconnectAffiliateProgramRequest) Decode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode disconnectAffiliateProgram#f9b124fc to nil") + } + if err := b.ConsumeID(DisconnectAffiliateProgramRequestTypeID); err != nil { + return fmt.Errorf("unable to decode disconnectAffiliateProgram#f9b124fc: %w", err) + } + return d.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (d *DisconnectAffiliateProgramRequest) DecodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode disconnectAffiliateProgram#f9b124fc to nil") + } + { + value, err := DecodeAffiliateType(b) + if err != nil { + return fmt.Errorf("unable to decode disconnectAffiliateProgram#f9b124fc: field affiliate: %w", err) + } + d.Affiliate = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode disconnectAffiliateProgram#f9b124fc: field url: %w", err) + } + d.URL = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (d *DisconnectAffiliateProgramRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if d == nil { + return fmt.Errorf("can't encode disconnectAffiliateProgram#f9b124fc as nil") + } + b.ObjStart() + b.PutID("disconnectAffiliateProgram") + b.Comma() + b.FieldStart("affiliate") + if d.Affiliate == nil { + return fmt.Errorf("unable to encode disconnectAffiliateProgram#f9b124fc: field affiliate is nil") + } + if err := d.Affiliate.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode disconnectAffiliateProgram#f9b124fc: field affiliate: %w", err) + } + b.Comma() + b.FieldStart("url") + b.PutString(d.URL) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (d *DisconnectAffiliateProgramRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if d == nil { + return fmt.Errorf("can't decode disconnectAffiliateProgram#f9b124fc to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("disconnectAffiliateProgram"); err != nil { + return fmt.Errorf("unable to decode disconnectAffiliateProgram#f9b124fc: %w", err) + } + case "affiliate": + value, err := DecodeTDLibJSONAffiliateType(b) + if err != nil { + return fmt.Errorf("unable to decode disconnectAffiliateProgram#f9b124fc: field affiliate: %w", err) + } + d.Affiliate = value + case "url": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode disconnectAffiliateProgram#f9b124fc: field url: %w", err) + } + d.URL = value + default: + return b.Skip() + } + return nil + }) +} + +// GetAffiliate returns value of Affiliate field. +func (d *DisconnectAffiliateProgramRequest) GetAffiliate() (value AffiliateTypeClass) { + if d == nil { + return + } + return d.Affiliate +} + +// GetURL returns value of URL field. +func (d *DisconnectAffiliateProgramRequest) GetURL() (value string) { + if d == nil { + return + } + return d.URL +} + +// DisconnectAffiliateProgram invokes method disconnectAffiliateProgram#f9b124fc returning error if any. +func (c *Client) DisconnectAffiliateProgram(ctx context.Context, request *DisconnectAffiliateProgramRequest) (*ConnectedAffiliateProgram, error) { + var result ConnectedAffiliateProgram + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_disconnect_chat_affiliate_program_gen.go b/tdapi/tl_disconnect_chat_affiliate_program_gen.go deleted file mode 100644 index fbbc308723..0000000000 --- a/tdapi/tl_disconnect_chat_affiliate_program_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -import ( - "context" - "errors" - "fmt" - "sort" - "strings" - - "go.uber.org/multierr" - - "github.com/gotd/td/bin" - "github.com/gotd/td/tdjson" - "github.com/gotd/td/tdp" - "github.com/gotd/td/tgerr" -) - -// No-op definition for keeping imports. -var ( - _ = bin.Buffer{} - _ = context.Background() - _ = fmt.Stringer(nil) - _ = strings.Builder{} - _ = errors.Is - _ = multierr.AppendInto - _ = sort.Ints - _ = tdp.Format - _ = tgerr.Error{} - _ = tdjson.Encoder{} -) - -// DisconnectChatAffiliateProgramRequest represents TL type `disconnectChatAffiliateProgram#48ef7257`. -type DisconnectChatAffiliateProgramRequest struct { - // Identifier of the chat for which the affiliate program is connected - ChatID int64 - // The referral link of the affiliate program - URL string -} - -// DisconnectChatAffiliateProgramRequestTypeID is TL type id of DisconnectChatAffiliateProgramRequest. -const DisconnectChatAffiliateProgramRequestTypeID = 0x48ef7257 - -// Ensuring interfaces in compile-time for DisconnectChatAffiliateProgramRequest. -var ( - _ bin.Encoder = &DisconnectChatAffiliateProgramRequest{} - _ bin.Decoder = &DisconnectChatAffiliateProgramRequest{} - _ bin.BareEncoder = &DisconnectChatAffiliateProgramRequest{} - _ bin.BareDecoder = &DisconnectChatAffiliateProgramRequest{} -) - -func (d *DisconnectChatAffiliateProgramRequest) Zero() bool { - if d == nil { - return true - } - if !(d.ChatID == 0) { - return false - } - if !(d.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DisconnectChatAffiliateProgramRequest) String() string { - if d == nil { - return "DisconnectChatAffiliateProgramRequest(nil)" - } - type Alias DisconnectChatAffiliateProgramRequest - return fmt.Sprintf("DisconnectChatAffiliateProgramRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DisconnectChatAffiliateProgramRequest) TypeID() uint32 { - return DisconnectChatAffiliateProgramRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DisconnectChatAffiliateProgramRequest) TypeName() string { - return "disconnectChatAffiliateProgram" -} - -// TypeInfo returns info about TL type. -func (d *DisconnectChatAffiliateProgramRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "disconnectChatAffiliateProgram", - ID: DisconnectChatAffiliateProgramRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DisconnectChatAffiliateProgramRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode disconnectChatAffiliateProgram#48ef7257 as nil") - } - b.PutID(DisconnectChatAffiliateProgramRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DisconnectChatAffiliateProgramRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode disconnectChatAffiliateProgram#48ef7257 as nil") - } - b.PutInt53(d.ChatID) - b.PutString(d.URL) - return nil -} - -// Decode implements bin.Decoder. -func (d *DisconnectChatAffiliateProgramRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode disconnectChatAffiliateProgram#48ef7257 to nil") - } - if err := b.ConsumeID(DisconnectChatAffiliateProgramRequestTypeID); err != nil { - return fmt.Errorf("unable to decode disconnectChatAffiliateProgram#48ef7257: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DisconnectChatAffiliateProgramRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode disconnectChatAffiliateProgram#48ef7257 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode disconnectChatAffiliateProgram#48ef7257: field chat_id: %w", err) - } - d.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode disconnectChatAffiliateProgram#48ef7257: field url: %w", err) - } - d.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DisconnectChatAffiliateProgramRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode disconnectChatAffiliateProgram#48ef7257 as nil") - } - b.ObjStart() - b.PutID("disconnectChatAffiliateProgram") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(d.ChatID) - b.Comma() - b.FieldStart("url") - b.PutString(d.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DisconnectChatAffiliateProgramRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode disconnectChatAffiliateProgram#48ef7257 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("disconnectChatAffiliateProgram"); err != nil { - return fmt.Errorf("unable to decode disconnectChatAffiliateProgram#48ef7257: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode disconnectChatAffiliateProgram#48ef7257: field chat_id: %w", err) - } - d.ChatID = value - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode disconnectChatAffiliateProgram#48ef7257: field url: %w", err) - } - d.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (d *DisconnectChatAffiliateProgramRequest) GetChatID() (value int64) { - if d == nil { - return - } - return d.ChatID -} - -// GetURL returns value of URL field. -func (d *DisconnectChatAffiliateProgramRequest) GetURL() (value string) { - if d == nil { - return - } - return d.URL -} - -// DisconnectChatAffiliateProgram invokes method disconnectChatAffiliateProgram#48ef7257 returning error if any. -func (c *Client) DisconnectChatAffiliateProgram(ctx context.Context, request *DisconnectChatAffiliateProgramRequest) (*ChatAffiliateProgram, error) { - var result ChatAffiliateProgram - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_found_affiliate_program_gen.go b/tdapi/tl_found_affiliate_program_gen.go index 1f900b1b36..7df4aec229 100644 --- a/tdapi/tl_found_affiliate_program_gen.go +++ b/tdapi/tl_found_affiliate_program_gen.go @@ -31,16 +31,16 @@ var ( _ = tdjson.Encoder{} ) -// FoundAffiliateProgram represents TL type `foundAffiliateProgram#80bf7012`. +// FoundAffiliateProgram represents TL type `foundAffiliateProgram#c6636286`. type FoundAffiliateProgram struct { // User identifier of the bot created the program BotUserID int64 // Information about the affiliate program - Parameters AffiliateProgramInfo + Info AffiliateProgramInfo } // FoundAffiliateProgramTypeID is TL type id of FoundAffiliateProgram. -const FoundAffiliateProgramTypeID = 0x80bf7012 +const FoundAffiliateProgramTypeID = 0xc6636286 // Ensuring interfaces in compile-time for FoundAffiliateProgram. var ( @@ -57,7 +57,7 @@ func (f *FoundAffiliateProgram) Zero() bool { if !(f.BotUserID == 0) { return false } - if !(f.Parameters.Zero()) { + if !(f.Info.Zero()) { return false } @@ -101,8 +101,8 @@ func (f *FoundAffiliateProgram) TypeInfo() tdp.Type { SchemaName: "bot_user_id", }, { - Name: "Parameters", - SchemaName: "parameters", + Name: "Info", + SchemaName: "info", }, } return typ @@ -111,7 +111,7 @@ func (f *FoundAffiliateProgram) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (f *FoundAffiliateProgram) Encode(b *bin.Buffer) error { if f == nil { - return fmt.Errorf("can't encode foundAffiliateProgram#80bf7012 as nil") + return fmt.Errorf("can't encode foundAffiliateProgram#c6636286 as nil") } b.PutID(FoundAffiliateProgramTypeID) return f.EncodeBare(b) @@ -120,11 +120,11 @@ func (f *FoundAffiliateProgram) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (f *FoundAffiliateProgram) EncodeBare(b *bin.Buffer) error { if f == nil { - return fmt.Errorf("can't encode foundAffiliateProgram#80bf7012 as nil") + return fmt.Errorf("can't encode foundAffiliateProgram#c6636286 as nil") } b.PutInt53(f.BotUserID) - if err := f.Parameters.Encode(b); err != nil { - return fmt.Errorf("unable to encode foundAffiliateProgram#80bf7012: field parameters: %w", err) + if err := f.Info.Encode(b); err != nil { + return fmt.Errorf("unable to encode foundAffiliateProgram#c6636286: field info: %w", err) } return nil } @@ -132,10 +132,10 @@ func (f *FoundAffiliateProgram) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (f *FoundAffiliateProgram) Decode(b *bin.Buffer) error { if f == nil { - return fmt.Errorf("can't decode foundAffiliateProgram#80bf7012 to nil") + return fmt.Errorf("can't decode foundAffiliateProgram#c6636286 to nil") } if err := b.ConsumeID(FoundAffiliateProgramTypeID); err != nil { - return fmt.Errorf("unable to decode foundAffiliateProgram#80bf7012: %w", err) + return fmt.Errorf("unable to decode foundAffiliateProgram#c6636286: %w", err) } return f.DecodeBare(b) } @@ -143,18 +143,18 @@ func (f *FoundAffiliateProgram) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (f *FoundAffiliateProgram) DecodeBare(b *bin.Buffer) error { if f == nil { - return fmt.Errorf("can't decode foundAffiliateProgram#80bf7012 to nil") + return fmt.Errorf("can't decode foundAffiliateProgram#c6636286 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode foundAffiliateProgram#80bf7012: field bot_user_id: %w", err) + return fmt.Errorf("unable to decode foundAffiliateProgram#c6636286: field bot_user_id: %w", err) } f.BotUserID = value } { - if err := f.Parameters.Decode(b); err != nil { - return fmt.Errorf("unable to decode foundAffiliateProgram#80bf7012: field parameters: %w", err) + if err := f.Info.Decode(b); err != nil { + return fmt.Errorf("unable to decode foundAffiliateProgram#c6636286: field info: %w", err) } } return nil @@ -163,7 +163,7 @@ func (f *FoundAffiliateProgram) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (f *FoundAffiliateProgram) EncodeTDLibJSON(b tdjson.Encoder) error { if f == nil { - return fmt.Errorf("can't encode foundAffiliateProgram#80bf7012 as nil") + return fmt.Errorf("can't encode foundAffiliateProgram#c6636286 as nil") } b.ObjStart() b.PutID("foundAffiliateProgram") @@ -171,9 +171,9 @@ func (f *FoundAffiliateProgram) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("bot_user_id") b.PutInt53(f.BotUserID) b.Comma() - b.FieldStart("parameters") - if err := f.Parameters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode foundAffiliateProgram#80bf7012: field parameters: %w", err) + b.FieldStart("info") + if err := f.Info.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode foundAffiliateProgram#c6636286: field info: %w", err) } b.Comma() b.StripComma() @@ -184,24 +184,24 @@ func (f *FoundAffiliateProgram) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (f *FoundAffiliateProgram) DecodeTDLibJSON(b tdjson.Decoder) error { if f == nil { - return fmt.Errorf("can't decode foundAffiliateProgram#80bf7012 to nil") + return fmt.Errorf("can't decode foundAffiliateProgram#c6636286 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("foundAffiliateProgram"); err != nil { - return fmt.Errorf("unable to decode foundAffiliateProgram#80bf7012: %w", err) + return fmt.Errorf("unable to decode foundAffiliateProgram#c6636286: %w", err) } case "bot_user_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode foundAffiliateProgram#80bf7012: field bot_user_id: %w", err) + return fmt.Errorf("unable to decode foundAffiliateProgram#c6636286: field bot_user_id: %w", err) } f.BotUserID = value - case "parameters": - if err := f.Parameters.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode foundAffiliateProgram#80bf7012: field parameters: %w", err) + case "info": + if err := f.Info.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode foundAffiliateProgram#c6636286: field info: %w", err) } default: return b.Skip() @@ -218,10 +218,10 @@ func (f *FoundAffiliateProgram) GetBotUserID() (value int64) { return f.BotUserID } -// GetParameters returns value of Parameters field. -func (f *FoundAffiliateProgram) GetParameters() (value AffiliateProgramInfo) { +// GetInfo returns value of Info field. +func (f *FoundAffiliateProgram) GetInfo() (value AffiliateProgramInfo) { if f == nil { return } - return f.Parameters + return f.Info } diff --git a/tdapi/tl_get_chat_affiliate_program_gen.go b/tdapi/tl_get_chat_affiliate_program_gen.go deleted file mode 100644 index 6e5cf805dd..0000000000 --- a/tdapi/tl_get_chat_affiliate_program_gen.go +++ /dev/null @@ -1,239 +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{} -) - -// GetChatAffiliateProgramRequest represents TL type `getChatAffiliateProgram#6ec8a39a`. -type GetChatAffiliateProgramRequest struct { - // Identifier of the chat for which the affiliate program was connected. Can be an - // identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel - // chat with can_post_messages administrator right - ChatID int64 - // Identifier of the bot that created the program - BotUserID int64 -} - -// GetChatAffiliateProgramRequestTypeID is TL type id of GetChatAffiliateProgramRequest. -const GetChatAffiliateProgramRequestTypeID = 0x6ec8a39a - -// Ensuring interfaces in compile-time for GetChatAffiliateProgramRequest. -var ( - _ bin.Encoder = &GetChatAffiliateProgramRequest{} - _ bin.Decoder = &GetChatAffiliateProgramRequest{} - _ bin.BareEncoder = &GetChatAffiliateProgramRequest{} - _ bin.BareDecoder = &GetChatAffiliateProgramRequest{} -) - -func (g *GetChatAffiliateProgramRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.BotUserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatAffiliateProgramRequest) String() string { - if g == nil { - return "GetChatAffiliateProgramRequest(nil)" - } - type Alias GetChatAffiliateProgramRequest - return fmt.Sprintf("GetChatAffiliateProgramRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatAffiliateProgramRequest) TypeID() uint32 { - return GetChatAffiliateProgramRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatAffiliateProgramRequest) TypeName() string { - return "getChatAffiliateProgram" -} - -// TypeInfo returns info about TL type. -func (g *GetChatAffiliateProgramRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatAffiliateProgram", - ID: GetChatAffiliateProgramRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatAffiliateProgramRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatAffiliateProgram#6ec8a39a as nil") - } - b.PutID(GetChatAffiliateProgramRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatAffiliateProgramRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatAffiliateProgram#6ec8a39a as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.BotUserID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatAffiliateProgramRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatAffiliateProgram#6ec8a39a to nil") - } - if err := b.ConsumeID(GetChatAffiliateProgramRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatAffiliateProgram#6ec8a39a: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatAffiliateProgramRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatAffiliateProgram#6ec8a39a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatAffiliateProgram#6ec8a39a: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatAffiliateProgram#6ec8a39a: field bot_user_id: %w", err) - } - g.BotUserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatAffiliateProgramRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatAffiliateProgram#6ec8a39a as nil") - } - b.ObjStart() - b.PutID("getChatAffiliateProgram") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(g.BotUserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatAffiliateProgramRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatAffiliateProgram#6ec8a39a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatAffiliateProgram"); err != nil { - return fmt.Errorf("unable to decode getChatAffiliateProgram#6ec8a39a: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatAffiliateProgram#6ec8a39a: field chat_id: %w", err) - } - g.ChatID = value - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatAffiliateProgram#6ec8a39a: field bot_user_id: %w", err) - } - g.BotUserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatAffiliateProgramRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetBotUserID returns value of BotUserID field. -func (g *GetChatAffiliateProgramRequest) GetBotUserID() (value int64) { - if g == nil { - return - } - return g.BotUserID -} - -// GetChatAffiliateProgram invokes method getChatAffiliateProgram#6ec8a39a returning error if any. -func (c *Client) GetChatAffiliateProgram(ctx context.Context, request *GetChatAffiliateProgramRequest) (*ChatAffiliateProgram, error) { - var result ChatAffiliateProgram - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_affiliate_programs_gen.go b/tdapi/tl_get_chat_affiliate_programs_gen.go deleted file mode 100644 index 2eef94e012..0000000000 --- a/tdapi/tl_get_chat_affiliate_programs_gen.go +++ /dev/null @@ -1,274 +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{} -) - -// GetChatAffiliateProgramsRequest represents TL type `getChatAffiliatePrograms#f9df5251`. -type GetChatAffiliateProgramsRequest struct { - // Identifier of the chat for which the affiliate programs were connected. Can be an - // identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel - // chat with can_post_messages administrator right - ChatID int64 - // Offset of the first affiliate program to return as received from the previous request; - // use empty string to get the first chunk of results - Offset string - // The maximum number of affiliate programs to return - Limit int32 -} - -// GetChatAffiliateProgramsRequestTypeID is TL type id of GetChatAffiliateProgramsRequest. -const GetChatAffiliateProgramsRequestTypeID = 0xf9df5251 - -// Ensuring interfaces in compile-time for GetChatAffiliateProgramsRequest. -var ( - _ bin.Encoder = &GetChatAffiliateProgramsRequest{} - _ bin.Decoder = &GetChatAffiliateProgramsRequest{} - _ bin.BareEncoder = &GetChatAffiliateProgramsRequest{} - _ bin.BareDecoder = &GetChatAffiliateProgramsRequest{} -) - -func (g *GetChatAffiliateProgramsRequest) 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 *GetChatAffiliateProgramsRequest) String() string { - if g == nil { - return "GetChatAffiliateProgramsRequest(nil)" - } - type Alias GetChatAffiliateProgramsRequest - return fmt.Sprintf("GetChatAffiliateProgramsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatAffiliateProgramsRequest) TypeID() uint32 { - return GetChatAffiliateProgramsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatAffiliateProgramsRequest) TypeName() string { - return "getChatAffiliatePrograms" -} - -// TypeInfo returns info about TL type. -func (g *GetChatAffiliateProgramsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatAffiliatePrograms", - ID: GetChatAffiliateProgramsRequestTypeID, - } - 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 *GetChatAffiliateProgramsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatAffiliatePrograms#f9df5251 as nil") - } - b.PutID(GetChatAffiliateProgramsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatAffiliateProgramsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatAffiliatePrograms#f9df5251 as nil") - } - b.PutInt53(g.ChatID) - b.PutString(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatAffiliateProgramsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatAffiliatePrograms#f9df5251 to nil") - } - if err := b.ConsumeID(GetChatAffiliateProgramsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatAffiliatePrograms#f9df5251: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatAffiliateProgramsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatAffiliatePrograms#f9df5251 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatAffiliatePrograms#f9df5251: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatAffiliatePrograms#f9df5251: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatAffiliatePrograms#f9df5251: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatAffiliateProgramsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatAffiliatePrograms#f9df5251 as nil") - } - b.ObjStart() - b.PutID("getChatAffiliatePrograms") - 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 *GetChatAffiliateProgramsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatAffiliatePrograms#f9df5251 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatAffiliatePrograms"); err != nil { - return fmt.Errorf("unable to decode getChatAffiliatePrograms#f9df5251: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatAffiliatePrograms#f9df5251: field chat_id: %w", err) - } - g.ChatID = value - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatAffiliatePrograms#f9df5251: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatAffiliatePrograms#f9df5251: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatAffiliateProgramsRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetOffset returns value of Offset field. -func (g *GetChatAffiliateProgramsRequest) GetOffset() (value string) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetChatAffiliateProgramsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetChatAffiliatePrograms invokes method getChatAffiliatePrograms#f9df5251 returning error if any. -func (c *Client) GetChatAffiliatePrograms(ctx context.Context, request *GetChatAffiliateProgramsRequest) (*ChatAffiliatePrograms, error) { - var result ChatAffiliatePrograms - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_connected_affiliate_program_gen.go b/tdapi/tl_get_connected_affiliate_program_gen.go new file mode 100644 index 0000000000..413c2b1368 --- /dev/null +++ b/tdapi/tl_get_connected_affiliate_program_gen.go @@ -0,0 +1,247 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// GetConnectedAffiliateProgramRequest represents TL type `getConnectedAffiliateProgram#9761e770`. +type GetConnectedAffiliateProgramRequest struct { + // The affiliate to which the affiliate program will be connected + Affiliate AffiliateTypeClass + // Identifier of the bot that created the program + BotUserID int64 +} + +// GetConnectedAffiliateProgramRequestTypeID is TL type id of GetConnectedAffiliateProgramRequest. +const GetConnectedAffiliateProgramRequestTypeID = 0x9761e770 + +// Ensuring interfaces in compile-time for GetConnectedAffiliateProgramRequest. +var ( + _ bin.Encoder = &GetConnectedAffiliateProgramRequest{} + _ bin.Decoder = &GetConnectedAffiliateProgramRequest{} + _ bin.BareEncoder = &GetConnectedAffiliateProgramRequest{} + _ bin.BareDecoder = &GetConnectedAffiliateProgramRequest{} +) + +func (g *GetConnectedAffiliateProgramRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Affiliate == nil) { + return false + } + if !(g.BotUserID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetConnectedAffiliateProgramRequest) String() string { + if g == nil { + return "GetConnectedAffiliateProgramRequest(nil)" + } + type Alias GetConnectedAffiliateProgramRequest + return fmt.Sprintf("GetConnectedAffiliateProgramRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetConnectedAffiliateProgramRequest) TypeID() uint32 { + return GetConnectedAffiliateProgramRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetConnectedAffiliateProgramRequest) TypeName() string { + return "getConnectedAffiliateProgram" +} + +// TypeInfo returns info about TL type. +func (g *GetConnectedAffiliateProgramRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getConnectedAffiliateProgram", + ID: GetConnectedAffiliateProgramRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Affiliate", + SchemaName: "affiliate", + }, + { + Name: "BotUserID", + SchemaName: "bot_user_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetConnectedAffiliateProgramRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getConnectedAffiliateProgram#9761e770 as nil") + } + b.PutID(GetConnectedAffiliateProgramRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetConnectedAffiliateProgramRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getConnectedAffiliateProgram#9761e770 as nil") + } + if g.Affiliate == nil { + return fmt.Errorf("unable to encode getConnectedAffiliateProgram#9761e770: field affiliate is nil") + } + if err := g.Affiliate.Encode(b); err != nil { + return fmt.Errorf("unable to encode getConnectedAffiliateProgram#9761e770: field affiliate: %w", err) + } + b.PutInt53(g.BotUserID) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetConnectedAffiliateProgramRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getConnectedAffiliateProgram#9761e770 to nil") + } + if err := b.ConsumeID(GetConnectedAffiliateProgramRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getConnectedAffiliateProgram#9761e770: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetConnectedAffiliateProgramRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getConnectedAffiliateProgram#9761e770 to nil") + } + { + value, err := DecodeAffiliateType(b) + if err != nil { + return fmt.Errorf("unable to decode getConnectedAffiliateProgram#9761e770: field affiliate: %w", err) + } + g.Affiliate = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getConnectedAffiliateProgram#9761e770: field bot_user_id: %w", err) + } + g.BotUserID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetConnectedAffiliateProgramRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getConnectedAffiliateProgram#9761e770 as nil") + } + b.ObjStart() + b.PutID("getConnectedAffiliateProgram") + b.Comma() + b.FieldStart("affiliate") + if g.Affiliate == nil { + return fmt.Errorf("unable to encode getConnectedAffiliateProgram#9761e770: field affiliate is nil") + } + if err := g.Affiliate.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode getConnectedAffiliateProgram#9761e770: field affiliate: %w", err) + } + b.Comma() + b.FieldStart("bot_user_id") + b.PutInt53(g.BotUserID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetConnectedAffiliateProgramRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getConnectedAffiliateProgram#9761e770 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getConnectedAffiliateProgram"); err != nil { + return fmt.Errorf("unable to decode getConnectedAffiliateProgram#9761e770: %w", err) + } + case "affiliate": + value, err := DecodeTDLibJSONAffiliateType(b) + if err != nil { + return fmt.Errorf("unable to decode getConnectedAffiliateProgram#9761e770: field affiliate: %w", err) + } + g.Affiliate = value + case "bot_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getConnectedAffiliateProgram#9761e770: field bot_user_id: %w", err) + } + g.BotUserID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetAffiliate returns value of Affiliate field. +func (g *GetConnectedAffiliateProgramRequest) GetAffiliate() (value AffiliateTypeClass) { + if g == nil { + return + } + return g.Affiliate +} + +// GetBotUserID returns value of BotUserID field. +func (g *GetConnectedAffiliateProgramRequest) GetBotUserID() (value int64) { + if g == nil { + return + } + return g.BotUserID +} + +// GetConnectedAffiliateProgram invokes method getConnectedAffiliateProgram#9761e770 returning error if any. +func (c *Client) GetConnectedAffiliateProgram(ctx context.Context, request *GetConnectedAffiliateProgramRequest) (*ConnectedAffiliateProgram, error) { + var result ConnectedAffiliateProgram + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_connected_affiliate_programs_gen.go b/tdapi/tl_get_connected_affiliate_programs_gen.go new file mode 100644 index 0000000000..efd2fc82a7 --- /dev/null +++ b/tdapi/tl_get_connected_affiliate_programs_gen.go @@ -0,0 +1,282 @@ +// 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{} +) + +// GetConnectedAffiliateProgramsRequest represents TL type `getConnectedAffiliatePrograms#8b2c5272`. +type GetConnectedAffiliateProgramsRequest struct { + // The affiliate to which the affiliate program were connected + Affiliate AffiliateTypeClass + // Offset of the first affiliate program to return as received from the previous request; + // use empty string to get the first chunk of results + Offset string + // The maximum number of affiliate programs to return + Limit int32 +} + +// GetConnectedAffiliateProgramsRequestTypeID is TL type id of GetConnectedAffiliateProgramsRequest. +const GetConnectedAffiliateProgramsRequestTypeID = 0x8b2c5272 + +// Ensuring interfaces in compile-time for GetConnectedAffiliateProgramsRequest. +var ( + _ bin.Encoder = &GetConnectedAffiliateProgramsRequest{} + _ bin.Decoder = &GetConnectedAffiliateProgramsRequest{} + _ bin.BareEncoder = &GetConnectedAffiliateProgramsRequest{} + _ bin.BareDecoder = &GetConnectedAffiliateProgramsRequest{} +) + +func (g *GetConnectedAffiliateProgramsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Affiliate == nil) { + return false + } + if !(g.Offset == "") { + return false + } + if !(g.Limit == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetConnectedAffiliateProgramsRequest) String() string { + if g == nil { + return "GetConnectedAffiliateProgramsRequest(nil)" + } + type Alias GetConnectedAffiliateProgramsRequest + return fmt.Sprintf("GetConnectedAffiliateProgramsRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetConnectedAffiliateProgramsRequest) TypeID() uint32 { + return GetConnectedAffiliateProgramsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetConnectedAffiliateProgramsRequest) TypeName() string { + return "getConnectedAffiliatePrograms" +} + +// TypeInfo returns info about TL type. +func (g *GetConnectedAffiliateProgramsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getConnectedAffiliatePrograms", + ID: GetConnectedAffiliateProgramsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Affiliate", + SchemaName: "affiliate", + }, + { + Name: "Offset", + SchemaName: "offset", + }, + { + Name: "Limit", + SchemaName: "limit", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetConnectedAffiliateProgramsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getConnectedAffiliatePrograms#8b2c5272 as nil") + } + b.PutID(GetConnectedAffiliateProgramsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetConnectedAffiliateProgramsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getConnectedAffiliatePrograms#8b2c5272 as nil") + } + if g.Affiliate == nil { + return fmt.Errorf("unable to encode getConnectedAffiliatePrograms#8b2c5272: field affiliate is nil") + } + if err := g.Affiliate.Encode(b); err != nil { + return fmt.Errorf("unable to encode getConnectedAffiliatePrograms#8b2c5272: field affiliate: %w", err) + } + b.PutString(g.Offset) + b.PutInt32(g.Limit) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetConnectedAffiliateProgramsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getConnectedAffiliatePrograms#8b2c5272 to nil") + } + if err := b.ConsumeID(GetConnectedAffiliateProgramsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getConnectedAffiliatePrograms#8b2c5272: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetConnectedAffiliateProgramsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getConnectedAffiliatePrograms#8b2c5272 to nil") + } + { + value, err := DecodeAffiliateType(b) + if err != nil { + return fmt.Errorf("unable to decode getConnectedAffiliatePrograms#8b2c5272: field affiliate: %w", err) + } + g.Affiliate = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getConnectedAffiliatePrograms#8b2c5272: field offset: %w", err) + } + g.Offset = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getConnectedAffiliatePrograms#8b2c5272: field limit: %w", err) + } + g.Limit = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetConnectedAffiliateProgramsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getConnectedAffiliatePrograms#8b2c5272 as nil") + } + b.ObjStart() + b.PutID("getConnectedAffiliatePrograms") + b.Comma() + b.FieldStart("affiliate") + if g.Affiliate == nil { + return fmt.Errorf("unable to encode getConnectedAffiliatePrograms#8b2c5272: field affiliate is nil") + } + if err := g.Affiliate.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode getConnectedAffiliatePrograms#8b2c5272: field affiliate: %w", err) + } + 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 *GetConnectedAffiliateProgramsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getConnectedAffiliatePrograms#8b2c5272 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getConnectedAffiliatePrograms"); err != nil { + return fmt.Errorf("unable to decode getConnectedAffiliatePrograms#8b2c5272: %w", err) + } + case "affiliate": + value, err := DecodeTDLibJSONAffiliateType(b) + if err != nil { + return fmt.Errorf("unable to decode getConnectedAffiliatePrograms#8b2c5272: field affiliate: %w", err) + } + g.Affiliate = value + case "offset": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getConnectedAffiliatePrograms#8b2c5272: field offset: %w", err) + } + g.Offset = value + case "limit": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getConnectedAffiliatePrograms#8b2c5272: field limit: %w", err) + } + g.Limit = value + default: + return b.Skip() + } + return nil + }) +} + +// GetAffiliate returns value of Affiliate field. +func (g *GetConnectedAffiliateProgramsRequest) GetAffiliate() (value AffiliateTypeClass) { + if g == nil { + return + } + return g.Affiliate +} + +// GetOffset returns value of Offset field. +func (g *GetConnectedAffiliateProgramsRequest) GetOffset() (value string) { + if g == nil { + return + } + return g.Offset +} + +// GetLimit returns value of Limit field. +func (g *GetConnectedAffiliateProgramsRequest) GetLimit() (value int32) { + if g == nil { + return + } + return g.Limit +} + +// GetConnectedAffiliatePrograms invokes method getConnectedAffiliatePrograms#8b2c5272 returning error if any. +func (c *Client) GetConnectedAffiliatePrograms(ctx context.Context, request *GetConnectedAffiliateProgramsRequest) (*ConnectedAffiliatePrograms, error) { + var result ConnectedAffiliatePrograms + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_gift_upgrade_preview_gen.go b/tdapi/tl_get_gift_upgrade_preview_gen.go new file mode 100644 index 0000000000..3c5f6ad2ee --- /dev/null +++ b/tdapi/tl_get_gift_upgrade_preview_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{} +) + +// GetGiftUpgradePreviewRequest represents TL type `getGiftUpgradePreview#bdcbc25d`. +type GetGiftUpgradePreviewRequest struct { + // Identifier of the gift + GiftID int64 +} + +// GetGiftUpgradePreviewRequestTypeID is TL type id of GetGiftUpgradePreviewRequest. +const GetGiftUpgradePreviewRequestTypeID = 0xbdcbc25d + +// Ensuring interfaces in compile-time for GetGiftUpgradePreviewRequest. +var ( + _ bin.Encoder = &GetGiftUpgradePreviewRequest{} + _ bin.Decoder = &GetGiftUpgradePreviewRequest{} + _ bin.BareEncoder = &GetGiftUpgradePreviewRequest{} + _ bin.BareDecoder = &GetGiftUpgradePreviewRequest{} +) + +func (g *GetGiftUpgradePreviewRequest) Zero() bool { + if g == nil { + return true + } + if !(g.GiftID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetGiftUpgradePreviewRequest) String() string { + if g == nil { + return "GetGiftUpgradePreviewRequest(nil)" + } + type Alias GetGiftUpgradePreviewRequest + return fmt.Sprintf("GetGiftUpgradePreviewRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetGiftUpgradePreviewRequest) TypeID() uint32 { + return GetGiftUpgradePreviewRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetGiftUpgradePreviewRequest) TypeName() string { + return "getGiftUpgradePreview" +} + +// TypeInfo returns info about TL type. +func (g *GetGiftUpgradePreviewRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getGiftUpgradePreview", + ID: GetGiftUpgradePreviewRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "GiftID", + SchemaName: "gift_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetGiftUpgradePreviewRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getGiftUpgradePreview#bdcbc25d as nil") + } + b.PutID(GetGiftUpgradePreviewRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetGiftUpgradePreviewRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getGiftUpgradePreview#bdcbc25d as nil") + } + b.PutLong(g.GiftID) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetGiftUpgradePreviewRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getGiftUpgradePreview#bdcbc25d to nil") + } + if err := b.ConsumeID(GetGiftUpgradePreviewRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getGiftUpgradePreview#bdcbc25d: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetGiftUpgradePreviewRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getGiftUpgradePreview#bdcbc25d to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode getGiftUpgradePreview#bdcbc25d: field gift_id: %w", err) + } + g.GiftID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetGiftUpgradePreviewRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getGiftUpgradePreview#bdcbc25d as nil") + } + b.ObjStart() + b.PutID("getGiftUpgradePreview") + b.Comma() + b.FieldStart("gift_id") + b.PutLong(g.GiftID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetGiftUpgradePreviewRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getGiftUpgradePreview#bdcbc25d to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getGiftUpgradePreview"); err != nil { + return fmt.Errorf("unable to decode getGiftUpgradePreview#bdcbc25d: %w", err) + } + case "gift_id": + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode getGiftUpgradePreview#bdcbc25d: field gift_id: %w", err) + } + g.GiftID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetGiftID returns value of GiftID field. +func (g *GetGiftUpgradePreviewRequest) GetGiftID() (value int64) { + if g == nil { + return + } + return g.GiftID +} + +// GetGiftUpgradePreview invokes method getGiftUpgradePreview#bdcbc25d returning error if any. +func (c *Client) GetGiftUpgradePreview(ctx context.Context, giftid int64) (*GiftUpgradePreview, error) { + var result GiftUpgradePreview + + request := &GetGiftUpgradePreviewRequest{ + GiftID: giftid, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_user_gift_gen.go b/tdapi/tl_get_user_gift_gen.go new file mode 100644 index 0000000000..d08a2f0f48 --- /dev/null +++ b/tdapi/tl_get_user_gift_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{} +) + +// GetUserGiftRequest represents TL type `getUserGift#74e6a939`. +type GetUserGiftRequest struct { + // Identifier of the message with the gift + MessageID int64 +} + +// GetUserGiftRequestTypeID is TL type id of GetUserGiftRequest. +const GetUserGiftRequestTypeID = 0x74e6a939 + +// Ensuring interfaces in compile-time for GetUserGiftRequest. +var ( + _ bin.Encoder = &GetUserGiftRequest{} + _ bin.Decoder = &GetUserGiftRequest{} + _ bin.BareEncoder = &GetUserGiftRequest{} + _ bin.BareDecoder = &GetUserGiftRequest{} +) + +func (g *GetUserGiftRequest) Zero() bool { + if g == nil { + return true + } + if !(g.MessageID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetUserGiftRequest) String() string { + if g == nil { + return "GetUserGiftRequest(nil)" + } + type Alias GetUserGiftRequest + return fmt.Sprintf("GetUserGiftRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetUserGiftRequest) TypeID() uint32 { + return GetUserGiftRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetUserGiftRequest) TypeName() string { + return "getUserGift" +} + +// TypeInfo returns info about TL type. +func (g *GetUserGiftRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getUserGift", + ID: GetUserGiftRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "MessageID", + SchemaName: "message_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetUserGiftRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getUserGift#74e6a939 as nil") + } + b.PutID(GetUserGiftRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetUserGiftRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getUserGift#74e6a939 as nil") + } + b.PutInt53(g.MessageID) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetUserGiftRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getUserGift#74e6a939 to nil") + } + if err := b.ConsumeID(GetUserGiftRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getUserGift#74e6a939: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetUserGiftRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getUserGift#74e6a939 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getUserGift#74e6a939: field message_id: %w", err) + } + g.MessageID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetUserGiftRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getUserGift#74e6a939 as nil") + } + b.ObjStart() + b.PutID("getUserGift") + b.Comma() + b.FieldStart("message_id") + b.PutInt53(g.MessageID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetUserGiftRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getUserGift#74e6a939 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getUserGift"); err != nil { + return fmt.Errorf("unable to decode getUserGift#74e6a939: %w", err) + } + case "message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getUserGift#74e6a939: field message_id: %w", err) + } + g.MessageID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetMessageID returns value of MessageID field. +func (g *GetUserGiftRequest) GetMessageID() (value int64) { + if g == nil { + return + } + return g.MessageID +} + +// GetUserGift invokes method getUserGift#74e6a939 returning error if any. +func (c *Client) GetUserGift(ctx context.Context, messageid int64) (*UserGift, error) { + var result UserGift + + request := &GetUserGiftRequest{ + MessageID: messageid, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_gift_gen.go b/tdapi/tl_gift_gen.go index a6f4d7b91e..9acaaa19c0 100644 --- a/tdapi/tl_gift_gen.go +++ b/tdapi/tl_gift_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// Gift represents TL type `gift#d3284cce`. +// Gift represents TL type `gift#7cf9442d`. type Gift struct { // Unique identifier of the gift ID int64 @@ -39,10 +39,13 @@ type Gift struct { Sticker Sticker // Number of Telegram Stars that must be paid for the gift StarCount int64 - // Number of Telegram Stars that can be claimed by the receiver instead of the gift by - // default. If the gift was paid with just bought Telegram Stars, then full value can be - // claimed + // Number of Telegram Stars that can be claimed by the receiver instead of the regular + // gift by default. If the gift was paid with just bought Telegram Stars, then full value + // can be claimed DefaultSellStarCount int64 + // Number of Telegram Stars that must be paid to upgrade the gift; 0 if upgrade isn't + // possible + UpgradeStarCount int64 // True, if the gift is a birthday gift IsForBirthday bool // Number of remaining times the gift can be purchased by all users; 0 if not limited or @@ -59,7 +62,7 @@ type Gift struct { } // GiftTypeID is TL type id of Gift. -const GiftTypeID = 0xd3284cce +const GiftTypeID = 0x7cf9442d // Ensuring interfaces in compile-time for Gift. var ( @@ -85,6 +88,9 @@ func (g *Gift) Zero() bool { if !(g.DefaultSellStarCount == 0) { return false } + if !(g.UpgradeStarCount == 0) { + return false + } if !(g.IsForBirthday == false) { return false } @@ -152,6 +158,10 @@ func (g *Gift) TypeInfo() tdp.Type { Name: "DefaultSellStarCount", SchemaName: "default_sell_star_count", }, + { + Name: "UpgradeStarCount", + SchemaName: "upgrade_star_count", + }, { Name: "IsForBirthday", SchemaName: "is_for_birthday", @@ -179,7 +189,7 @@ func (g *Gift) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (g *Gift) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode gift#d3284cce as nil") + return fmt.Errorf("can't encode gift#7cf9442d as nil") } b.PutID(GiftTypeID) return g.EncodeBare(b) @@ -188,14 +198,15 @@ func (g *Gift) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (g *Gift) EncodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode gift#d3284cce as nil") + return fmt.Errorf("can't encode gift#7cf9442d as nil") } b.PutLong(g.ID) if err := g.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode gift#d3284cce: field sticker: %w", err) + return fmt.Errorf("unable to encode gift#7cf9442d: field sticker: %w", err) } b.PutInt53(g.StarCount) b.PutInt53(g.DefaultSellStarCount) + b.PutInt53(g.UpgradeStarCount) b.PutBool(g.IsForBirthday) b.PutInt32(g.RemainingCount) b.PutInt32(g.TotalCount) @@ -207,10 +218,10 @@ func (g *Gift) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (g *Gift) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode gift#d3284cce to nil") + return fmt.Errorf("can't decode gift#7cf9442d to nil") } if err := b.ConsumeID(GiftTypeID); err != nil { - return fmt.Errorf("unable to decode gift#d3284cce: %w", err) + return fmt.Errorf("unable to decode gift#7cf9442d: %w", err) } return g.DecodeBare(b) } @@ -218,66 +229,73 @@ func (g *Gift) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (g *Gift) DecodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode gift#d3284cce to nil") + return fmt.Errorf("can't decode gift#7cf9442d to nil") } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode gift#d3284cce: field id: %w", err) + return fmt.Errorf("unable to decode gift#7cf9442d: field id: %w", err) } g.ID = value } { if err := g.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode gift#d3284cce: field sticker: %w", err) + return fmt.Errorf("unable to decode gift#7cf9442d: field sticker: %w", err) } } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode gift#d3284cce: field star_count: %w", err) + return fmt.Errorf("unable to decode gift#7cf9442d: field star_count: %w", err) } g.StarCount = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode gift#d3284cce: field default_sell_star_count: %w", err) + return fmt.Errorf("unable to decode gift#7cf9442d: field default_sell_star_count: %w", err) } g.DefaultSellStarCount = value } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode gift#7cf9442d: field upgrade_star_count: %w", err) + } + g.UpgradeStarCount = value + } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode gift#d3284cce: field is_for_birthday: %w", err) + return fmt.Errorf("unable to decode gift#7cf9442d: field is_for_birthday: %w", err) } g.IsForBirthday = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode gift#d3284cce: field remaining_count: %w", err) + return fmt.Errorf("unable to decode gift#7cf9442d: field remaining_count: %w", err) } g.RemainingCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode gift#d3284cce: field total_count: %w", err) + return fmt.Errorf("unable to decode gift#7cf9442d: field total_count: %w", err) } g.TotalCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode gift#d3284cce: field first_send_date: %w", err) + return fmt.Errorf("unable to decode gift#7cf9442d: field first_send_date: %w", err) } g.FirstSendDate = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode gift#d3284cce: field last_send_date: %w", err) + return fmt.Errorf("unable to decode gift#7cf9442d: field last_send_date: %w", err) } g.LastSendDate = value } @@ -287,7 +305,7 @@ func (g *Gift) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (g *Gift) EncodeTDLibJSON(b tdjson.Encoder) error { if g == nil { - return fmt.Errorf("can't encode gift#d3284cce as nil") + return fmt.Errorf("can't encode gift#7cf9442d as nil") } b.ObjStart() b.PutID("gift") @@ -297,7 +315,7 @@ func (g *Gift) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("sticker") if err := g.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode gift#d3284cce: field sticker: %w", err) + return fmt.Errorf("unable to encode gift#7cf9442d: field sticker: %w", err) } b.Comma() b.FieldStart("star_count") @@ -306,6 +324,9 @@ func (g *Gift) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("default_sell_star_count") b.PutInt53(g.DefaultSellStarCount) b.Comma() + b.FieldStart("upgrade_star_count") + b.PutInt53(g.UpgradeStarCount) + b.Comma() b.FieldStart("is_for_birthday") b.PutBool(g.IsForBirthday) b.Comma() @@ -329,65 +350,71 @@ func (g *Gift) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (g *Gift) DecodeTDLibJSON(b tdjson.Decoder) error { if g == nil { - return fmt.Errorf("can't decode gift#d3284cce to nil") + return fmt.Errorf("can't decode gift#7cf9442d to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("gift"); err != nil { - return fmt.Errorf("unable to decode gift#d3284cce: %w", err) + return fmt.Errorf("unable to decode gift#7cf9442d: %w", err) } case "id": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode gift#d3284cce: field id: %w", err) + return fmt.Errorf("unable to decode gift#7cf9442d: field id: %w", err) } g.ID = value case "sticker": if err := g.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode gift#d3284cce: field sticker: %w", err) + return fmt.Errorf("unable to decode gift#7cf9442d: field sticker: %w", err) } case "star_count": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode gift#d3284cce: field star_count: %w", err) + return fmt.Errorf("unable to decode gift#7cf9442d: field star_count: %w", err) } g.StarCount = value case "default_sell_star_count": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode gift#d3284cce: field default_sell_star_count: %w", err) + return fmt.Errorf("unable to decode gift#7cf9442d: field default_sell_star_count: %w", err) } g.DefaultSellStarCount = value + case "upgrade_star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode gift#7cf9442d: field upgrade_star_count: %w", err) + } + g.UpgradeStarCount = value case "is_for_birthday": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode gift#d3284cce: field is_for_birthday: %w", err) + return fmt.Errorf("unable to decode gift#7cf9442d: field is_for_birthday: %w", err) } g.IsForBirthday = value case "remaining_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode gift#d3284cce: field remaining_count: %w", err) + return fmt.Errorf("unable to decode gift#7cf9442d: field remaining_count: %w", err) } g.RemainingCount = value case "total_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode gift#d3284cce: field total_count: %w", err) + return fmt.Errorf("unable to decode gift#7cf9442d: field total_count: %w", err) } g.TotalCount = value case "first_send_date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode gift#d3284cce: field first_send_date: %w", err) + return fmt.Errorf("unable to decode gift#7cf9442d: field first_send_date: %w", err) } g.FirstSendDate = value case "last_send_date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode gift#d3284cce: field last_send_date: %w", err) + return fmt.Errorf("unable to decode gift#7cf9442d: field last_send_date: %w", err) } g.LastSendDate = value default: @@ -429,6 +456,14 @@ func (g *Gift) GetDefaultSellStarCount() (value int64) { return g.DefaultSellStarCount } +// GetUpgradeStarCount returns value of UpgradeStarCount field. +func (g *Gift) GetUpgradeStarCount() (value int64) { + if g == nil { + return + } + return g.UpgradeStarCount +} + // GetIsForBirthday returns value of IsForBirthday field. func (g *Gift) GetIsForBirthday() (value bool) { if g == nil { diff --git a/tdapi/tl_gift_upgrade_preview_gen.go b/tdapi/tl_gift_upgrade_preview_gen.go new file mode 100644 index 0000000000..93d77a0112 --- /dev/null +++ b/tdapi/tl_gift_upgrade_preview_gen.go @@ -0,0 +1,345 @@ +// 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{} +) + +// GiftUpgradePreview represents TL type `giftUpgradePreview#4319deef`. +type GiftUpgradePreview struct { + // Examples of possible models that can be chosen for the gift after upgrade + Models []UpgradedGiftModel + // Examples of possible symbols that can be chosen for the gift after upgrade + Symbols []UpgradedGiftSymbol + // Examples of possible backdrops that can be chosen for the gift after upgrade + Backdrops []UpgradedGiftBackdrop +} + +// GiftUpgradePreviewTypeID is TL type id of GiftUpgradePreview. +const GiftUpgradePreviewTypeID = 0x4319deef + +// Ensuring interfaces in compile-time for GiftUpgradePreview. +var ( + _ bin.Encoder = &GiftUpgradePreview{} + _ bin.Decoder = &GiftUpgradePreview{} + _ bin.BareEncoder = &GiftUpgradePreview{} + _ bin.BareDecoder = &GiftUpgradePreview{} +) + +func (g *GiftUpgradePreview) Zero() bool { + if g == nil { + return true + } + if !(g.Models == nil) { + return false + } + if !(g.Symbols == nil) { + return false + } + if !(g.Backdrops == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GiftUpgradePreview) String() string { + if g == nil { + return "GiftUpgradePreview(nil)" + } + type Alias GiftUpgradePreview + return fmt.Sprintf("GiftUpgradePreview%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GiftUpgradePreview) TypeID() uint32 { + return GiftUpgradePreviewTypeID +} + +// TypeName returns name of type in TL schema. +func (*GiftUpgradePreview) TypeName() string { + return "giftUpgradePreview" +} + +// TypeInfo returns info about TL type. +func (g *GiftUpgradePreview) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "giftUpgradePreview", + ID: GiftUpgradePreviewTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Models", + SchemaName: "models", + }, + { + Name: "Symbols", + SchemaName: "symbols", + }, + { + Name: "Backdrops", + SchemaName: "backdrops", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GiftUpgradePreview) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giftUpgradePreview#4319deef as nil") + } + b.PutID(GiftUpgradePreviewTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GiftUpgradePreview) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giftUpgradePreview#4319deef as nil") + } + b.PutInt(len(g.Models)) + for idx, v := range g.Models { + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare giftUpgradePreview#4319deef: field models element with index %d: %w", idx, err) + } + } + b.PutInt(len(g.Symbols)) + for idx, v := range g.Symbols { + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare giftUpgradePreview#4319deef: field symbols element with index %d: %w", idx, err) + } + } + b.PutInt(len(g.Backdrops)) + for idx, v := range g.Backdrops { + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare giftUpgradePreview#4319deef: field backdrops element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (g *GiftUpgradePreview) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giftUpgradePreview#4319deef to nil") + } + if err := b.ConsumeID(GiftUpgradePreviewTypeID); err != nil { + return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GiftUpgradePreview) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giftUpgradePreview#4319deef to nil") + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: field models: %w", err) + } + + if headerLen > 0 { + g.Models = make([]UpgradedGiftModel, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value UpgradedGiftModel + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare giftUpgradePreview#4319deef: field models: %w", err) + } + g.Models = append(g.Models, value) + } + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: field symbols: %w", err) + } + + if headerLen > 0 { + g.Symbols = make([]UpgradedGiftSymbol, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value UpgradedGiftSymbol + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare giftUpgradePreview#4319deef: field symbols: %w", err) + } + g.Symbols = append(g.Symbols, value) + } + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: field backdrops: %w", err) + } + + if headerLen > 0 { + g.Backdrops = make([]UpgradedGiftBackdrop, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value UpgradedGiftBackdrop + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare giftUpgradePreview#4319deef: field backdrops: %w", err) + } + g.Backdrops = append(g.Backdrops, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GiftUpgradePreview) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode giftUpgradePreview#4319deef as nil") + } + b.ObjStart() + b.PutID("giftUpgradePreview") + b.Comma() + b.FieldStart("models") + b.ArrStart() + for idx, v := range g.Models { + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode giftUpgradePreview#4319deef: field models element with index %d: %w", idx, err) + } + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.FieldStart("symbols") + b.ArrStart() + for idx, v := range g.Symbols { + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode giftUpgradePreview#4319deef: field symbols element with index %d: %w", idx, err) + } + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.FieldStart("backdrops") + b.ArrStart() + for idx, v := range g.Backdrops { + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode giftUpgradePreview#4319deef: field backdrops element with index %d: %w", idx, err) + } + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GiftUpgradePreview) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode giftUpgradePreview#4319deef to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("giftUpgradePreview"); err != nil { + return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: %w", err) + } + case "models": + if err := b.Arr(func(b tdjson.Decoder) error { + var value UpgradedGiftModel + if err := value.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: field models: %w", err) + } + g.Models = append(g.Models, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: field models: %w", err) + } + case "symbols": + if err := b.Arr(func(b tdjson.Decoder) error { + var value UpgradedGiftSymbol + if err := value.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: field symbols: %w", err) + } + g.Symbols = append(g.Symbols, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: field symbols: %w", err) + } + case "backdrops": + if err := b.Arr(func(b tdjson.Decoder) error { + var value UpgradedGiftBackdrop + if err := value.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: field backdrops: %w", err) + } + g.Backdrops = append(g.Backdrops, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: field backdrops: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetModels returns value of Models field. +func (g *GiftUpgradePreview) GetModels() (value []UpgradedGiftModel) { + if g == nil { + return + } + return g.Models +} + +// GetSymbols returns value of Symbols field. +func (g *GiftUpgradePreview) GetSymbols() (value []UpgradedGiftSymbol) { + if g == nil { + return + } + return g.Symbols +} + +// GetBackdrops returns value of Backdrops field. +func (g *GiftUpgradePreview) GetBackdrops() (value []UpgradedGiftBackdrop) { + if g == nil { + return + } + return g.Backdrops +} diff --git a/tdapi/tl_inline_query_result_gen.go b/tdapi/tl_inline_query_result_gen.go index 6baa5659da..7c46c10e72 100644 --- a/tdapi/tl_inline_query_result_gen.go +++ b/tdapi/tl_inline_query_result_gen.go @@ -31,14 +31,12 @@ var ( _ = tdjson.Encoder{} ) -// InlineQueryResultArticle represents TL type `inlineQueryResultArticle#c4c82d9`. +// InlineQueryResultArticle represents TL type `inlineQueryResultArticle#1016d01a`. type InlineQueryResultArticle struct { // Unique identifier of the query result ID string // URL of the result, if it exists URL string - // True, if the URL must be not shown - HideURL bool // Title of the result Title string // Represents a link to an article or web page @@ -48,7 +46,7 @@ type InlineQueryResultArticle struct { } // InlineQueryResultArticleTypeID is TL type id of InlineQueryResultArticle. -const InlineQueryResultArticleTypeID = 0xc4c82d9 +const InlineQueryResultArticleTypeID = 0x1016d01a // construct implements constructor of InlineQueryResultClass. func (i InlineQueryResultArticle) construct() InlineQueryResultClass { return &i } @@ -73,9 +71,6 @@ func (i *InlineQueryResultArticle) Zero() bool { if !(i.URL == "") { return false } - if !(i.HideURL == false) { - return false - } if !(i.Title == "") { return false } @@ -129,10 +124,6 @@ func (i *InlineQueryResultArticle) TypeInfo() tdp.Type { Name: "URL", SchemaName: "url", }, - { - Name: "HideURL", - SchemaName: "hide_url", - }, { Name: "Title", SchemaName: "title", @@ -152,7 +143,7 @@ func (i *InlineQueryResultArticle) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (i *InlineQueryResultArticle) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inlineQueryResultArticle#c4c82d9 as nil") + return fmt.Errorf("can't encode inlineQueryResultArticle#1016d01a as nil") } b.PutID(InlineQueryResultArticleTypeID) return i.EncodeBare(b) @@ -161,15 +152,14 @@ func (i *InlineQueryResultArticle) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (i *InlineQueryResultArticle) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inlineQueryResultArticle#c4c82d9 as nil") + return fmt.Errorf("can't encode inlineQueryResultArticle#1016d01a as nil") } b.PutString(i.ID) b.PutString(i.URL) - b.PutBool(i.HideURL) b.PutString(i.Title) b.PutString(i.Description) if err := i.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultArticle#c4c82d9: field thumbnail: %w", err) + return fmt.Errorf("unable to encode inlineQueryResultArticle#1016d01a: field thumbnail: %w", err) } return nil } @@ -177,10 +167,10 @@ func (i *InlineQueryResultArticle) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (i *InlineQueryResultArticle) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inlineQueryResultArticle#c4c82d9 to nil") + return fmt.Errorf("can't decode inlineQueryResultArticle#1016d01a to nil") } if err := b.ConsumeID(InlineQueryResultArticleTypeID); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#c4c82d9: %w", err) + return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: %w", err) } return i.DecodeBare(b) } @@ -188,46 +178,39 @@ func (i *InlineQueryResultArticle) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (i *InlineQueryResultArticle) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inlineQueryResultArticle#c4c82d9 to nil") + return fmt.Errorf("can't decode inlineQueryResultArticle#1016d01a to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#c4c82d9: field id: %w", err) + return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field id: %w", err) } i.ID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#c4c82d9: field url: %w", err) + return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field url: %w", err) } i.URL = value } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#c4c82d9: field hide_url: %w", err) - } - i.HideURL = value - } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#c4c82d9: field title: %w", err) + return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field title: %w", err) } i.Title = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#c4c82d9: field description: %w", err) + return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field description: %w", err) } i.Description = value } { if err := i.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#c4c82d9: field thumbnail: %w", err) + return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field thumbnail: %w", err) } } return nil @@ -236,7 +219,7 @@ func (i *InlineQueryResultArticle) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (i *InlineQueryResultArticle) EncodeTDLibJSON(b tdjson.Encoder) error { if i == nil { - return fmt.Errorf("can't encode inlineQueryResultArticle#c4c82d9 as nil") + return fmt.Errorf("can't encode inlineQueryResultArticle#1016d01a as nil") } b.ObjStart() b.PutID("inlineQueryResultArticle") @@ -247,9 +230,6 @@ func (i *InlineQueryResultArticle) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("url") b.PutString(i.URL) b.Comma() - b.FieldStart("hide_url") - b.PutBool(i.HideURL) - b.Comma() b.FieldStart("title") b.PutString(i.Title) b.Comma() @@ -258,7 +238,7 @@ func (i *InlineQueryResultArticle) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("thumbnail") if err := i.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultArticle#c4c82d9: field thumbnail: %w", err) + return fmt.Errorf("unable to encode inlineQueryResultArticle#1016d01a: field thumbnail: %w", err) } b.Comma() b.StripComma() @@ -269,48 +249,42 @@ func (i *InlineQueryResultArticle) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (i *InlineQueryResultArticle) DecodeTDLibJSON(b tdjson.Decoder) error { if i == nil { - return fmt.Errorf("can't decode inlineQueryResultArticle#c4c82d9 to nil") + return fmt.Errorf("can't decode inlineQueryResultArticle#1016d01a to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("inlineQueryResultArticle"); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#c4c82d9: %w", err) + return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: %w", err) } case "id": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#c4c82d9: field id: %w", err) + return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field id: %w", err) } i.ID = value case "url": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#c4c82d9: field url: %w", err) + return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field url: %w", err) } i.URL = value - case "hide_url": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#c4c82d9: field hide_url: %w", err) - } - i.HideURL = value case "title": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#c4c82d9: field title: %w", err) + return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field title: %w", err) } i.Title = value case "description": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#c4c82d9: field description: %w", err) + return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field description: %w", err) } i.Description = value case "thumbnail": if err := i.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#c4c82d9: field thumbnail: %w", err) + return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field thumbnail: %w", err) } default: return b.Skip() @@ -335,14 +309,6 @@ func (i *InlineQueryResultArticle) GetURL() (value string) { return i.URL } -// GetHideURL returns value of HideURL field. -func (i *InlineQueryResultArticle) GetHideURL() (value bool) { - if i == nil { - return - } - return i.HideURL -} - // GetTitle returns value of Title field. func (i *InlineQueryResultArticle) GetTitle() (value string) { if i == nil { @@ -2987,7 +2953,7 @@ const InlineQueryResultClassName = "InlineQueryResult" // panic(err) // } // switch v := g.(type) { -// case *tdapi.InlineQueryResultArticle: // inlineQueryResultArticle#c4c82d9 +// case *tdapi.InlineQueryResultArticle: // inlineQueryResultArticle#1016d01a // case *tdapi.InlineQueryResultContact: // inlineQueryResultContact#f5278212 // case *tdapi.InlineQueryResultLocation: // inlineQueryResultLocation#1bc6ab10 // case *tdapi.InlineQueryResultVenue: // inlineQueryResultVenue#4c5b105e @@ -3034,7 +3000,7 @@ func DecodeInlineQueryResult(buf *bin.Buffer) (InlineQueryResultClass, error) { } switch id { case InlineQueryResultArticleTypeID: - // Decoding inlineQueryResultArticle#c4c82d9. + // Decoding inlineQueryResultArticle#1016d01a. v := InlineQueryResultArticle{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) @@ -3130,7 +3096,7 @@ func DecodeTDLibJSONInlineQueryResult(buf tdjson.Decoder) (InlineQueryResultClas } switch id { case "inlineQueryResultArticle": - // Decoding inlineQueryResultArticle#c4c82d9. + // Decoding inlineQueryResultArticle#1016d01a. v := InlineQueryResultArticle{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) diff --git a/tdapi/tl_input_inline_query_result_gen.go b/tdapi/tl_input_inline_query_result_gen.go index 3a7d2e6da6..5dbbd6d45f 100644 --- a/tdapi/tl_input_inline_query_result_gen.go +++ b/tdapi/tl_input_inline_query_result_gen.go @@ -561,14 +561,12 @@ func (i *InputInlineQueryResultAnimation) GetInputMessageContent() (value InputM return i.InputMessageContent } -// InputInlineQueryResultArticle represents TL type `inputInlineQueryResultArticle#75a3d10c`. +// InputInlineQueryResultArticle represents TL type `inputInlineQueryResultArticle#763583bc`. type InputInlineQueryResultArticle struct { // Unique identifier of the query result ID string // URL of the result, if it exists URL string - // True, if the URL must be not shown - HideURL bool // Title of the result Title string // Represents a link to an article or web page @@ -589,7 +587,7 @@ type InputInlineQueryResultArticle struct { } // InputInlineQueryResultArticleTypeID is TL type id of InputInlineQueryResultArticle. -const InputInlineQueryResultArticleTypeID = 0x75a3d10c +const InputInlineQueryResultArticleTypeID = 0x763583bc // construct implements constructor of InputInlineQueryResultClass. func (i InputInlineQueryResultArticle) construct() InputInlineQueryResultClass { return &i } @@ -614,9 +612,6 @@ func (i *InputInlineQueryResultArticle) Zero() bool { if !(i.URL == "") { return false } - if !(i.HideURL == false) { - return false - } if !(i.Title == "") { return false } @@ -682,10 +677,6 @@ func (i *InputInlineQueryResultArticle) TypeInfo() tdp.Type { Name: "URL", SchemaName: "url", }, - { - Name: "HideURL", - SchemaName: "hide_url", - }, { Name: "Title", SchemaName: "title", @@ -721,7 +712,7 @@ func (i *InputInlineQueryResultArticle) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (i *InputInlineQueryResultArticle) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultArticle#75a3d10c as nil") + return fmt.Errorf("can't encode inputInlineQueryResultArticle#763583bc as nil") } b.PutID(InputInlineQueryResultArticleTypeID) return i.EncodeBare(b) @@ -730,27 +721,26 @@ func (i *InputInlineQueryResultArticle) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (i *InputInlineQueryResultArticle) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultArticle#75a3d10c as nil") + return fmt.Errorf("can't encode inputInlineQueryResultArticle#763583bc as nil") } b.PutString(i.ID) b.PutString(i.URL) - b.PutBool(i.HideURL) b.PutString(i.Title) b.PutString(i.Description) b.PutString(i.ThumbnailURL) b.PutInt32(i.ThumbnailWidth) b.PutInt32(i.ThumbnailHeight) if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultArticle#75a3d10c: field reply_markup is nil") + return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field reply_markup is nil") } if err := i.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultArticle#75a3d10c: field reply_markup: %w", err) + return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field reply_markup: %w", err) } if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultArticle#75a3d10c: field input_message_content is nil") + return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field input_message_content is nil") } if err := i.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultArticle#75a3d10c: field input_message_content: %w", err) + return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field input_message_content: %w", err) } return nil } @@ -758,10 +748,10 @@ func (i *InputInlineQueryResultArticle) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (i *InputInlineQueryResultArticle) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultArticle#75a3d10c to nil") + return fmt.Errorf("can't decode inputInlineQueryResultArticle#763583bc to nil") } if err := b.ConsumeID(InputInlineQueryResultArticleTypeID); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: %w", err) + return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: %w", err) } return i.DecodeBare(b) } @@ -769,75 +759,68 @@ func (i *InputInlineQueryResultArticle) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (i *InputInlineQueryResultArticle) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultArticle#75a3d10c to nil") + return fmt.Errorf("can't decode inputInlineQueryResultArticle#763583bc to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: field id: %w", err) + return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field id: %w", err) } i.ID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: field url: %w", err) + return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field url: %w", err) } i.URL = value } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: field hide_url: %w", err) - } - i.HideURL = value - } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: field title: %w", err) + return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field title: %w", err) } i.Title = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: field description: %w", err) + return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field description: %w", err) } i.Description = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: field thumbnail_url: %w", err) + return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field thumbnail_url: %w", err) } i.ThumbnailURL = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: field thumbnail_width: %w", err) + return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field thumbnail_width: %w", err) } i.ThumbnailWidth = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: field thumbnail_height: %w", err) + return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field thumbnail_height: %w", err) } i.ThumbnailHeight = value } { value, err := DecodeReplyMarkup(b) if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: field reply_markup: %w", err) + return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field reply_markup: %w", err) } i.ReplyMarkup = value } { value, err := DecodeInputMessageContent(b) if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: field input_message_content: %w", err) + return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field input_message_content: %w", err) } i.InputMessageContent = value } @@ -847,7 +830,7 @@ func (i *InputInlineQueryResultArticle) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (i *InputInlineQueryResultArticle) EncodeTDLibJSON(b tdjson.Encoder) error { if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultArticle#75a3d10c as nil") + return fmt.Errorf("can't encode inputInlineQueryResultArticle#763583bc as nil") } b.ObjStart() b.PutID("inputInlineQueryResultArticle") @@ -858,9 +841,6 @@ func (i *InputInlineQueryResultArticle) EncodeTDLibJSON(b tdjson.Encoder) error b.FieldStart("url") b.PutString(i.URL) b.Comma() - b.FieldStart("hide_url") - b.PutBool(i.HideURL) - b.Comma() b.FieldStart("title") b.PutString(i.Title) b.Comma() @@ -878,18 +858,18 @@ func (i *InputInlineQueryResultArticle) EncodeTDLibJSON(b tdjson.Encoder) error b.Comma() b.FieldStart("reply_markup") if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultArticle#75a3d10c: field reply_markup is nil") + return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field reply_markup is nil") } if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultArticle#75a3d10c: field reply_markup: %w", err) + return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field reply_markup: %w", err) } b.Comma() b.FieldStart("input_message_content") if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultArticle#75a3d10c: field input_message_content is nil") + return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field input_message_content is nil") } if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultArticle#75a3d10c: field input_message_content: %w", err) + return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field input_message_content: %w", err) } b.Comma() b.StripComma() @@ -900,73 +880,67 @@ func (i *InputInlineQueryResultArticle) EncodeTDLibJSON(b tdjson.Encoder) error // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (i *InputInlineQueryResultArticle) DecodeTDLibJSON(b tdjson.Decoder) error { if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultArticle#75a3d10c to nil") + return fmt.Errorf("can't decode inputInlineQueryResultArticle#763583bc to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("inputInlineQueryResultArticle"); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: %w", err) + return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: %w", err) } case "id": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: field id: %w", err) + return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field id: %w", err) } i.ID = value case "url": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: field url: %w", err) + return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field url: %w", err) } i.URL = value - case "hide_url": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: field hide_url: %w", err) - } - i.HideURL = value case "title": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: field title: %w", err) + return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field title: %w", err) } i.Title = value case "description": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: field description: %w", err) + return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field description: %w", err) } i.Description = value case "thumbnail_url": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: field thumbnail_url: %w", err) + return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field thumbnail_url: %w", err) } i.ThumbnailURL = value case "thumbnail_width": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: field thumbnail_width: %w", err) + return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field thumbnail_width: %w", err) } i.ThumbnailWidth = value case "thumbnail_height": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: field thumbnail_height: %w", err) + return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field thumbnail_height: %w", err) } i.ThumbnailHeight = value case "reply_markup": value, err := DecodeTDLibJSONReplyMarkup(b) if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: field reply_markup: %w", err) + return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field reply_markup: %w", err) } i.ReplyMarkup = value case "input_message_content": value, err := DecodeTDLibJSONInputMessageContent(b) if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#75a3d10c: field input_message_content: %w", err) + return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field input_message_content: %w", err) } i.InputMessageContent = value default: @@ -992,14 +966,6 @@ func (i *InputInlineQueryResultArticle) GetURL() (value string) { return i.URL } -// GetHideURL returns value of HideURL field. -func (i *InputInlineQueryResultArticle) GetHideURL() (value bool) { - if i == nil { - return - } - return i.HideURL -} - // GetTitle returns value of Title field. func (i *InputInlineQueryResultArticle) GetTitle() (value string) { if i == nil { @@ -5194,7 +5160,7 @@ const InputInlineQueryResultClassName = "InputInlineQueryResult" // } // switch v := g.(type) { // case *tdapi.InputInlineQueryResultAnimation: // inputInlineQueryResultAnimation#a7335216 -// case *tdapi.InputInlineQueryResultArticle: // inputInlineQueryResultArticle#75a3d10c +// case *tdapi.InputInlineQueryResultArticle: // inputInlineQueryResultArticle#763583bc // case *tdapi.InputInlineQueryResultAudio: // inputInlineQueryResultAudio#4b1c35d4 // case *tdapi.InputInlineQueryResultContact: // inputInlineQueryResultContact#6e08b5d2 // case *tdapi.InputInlineQueryResultDocument: // inputInlineQueryResultDocument#227fd0cd @@ -5250,7 +5216,7 @@ func DecodeInputInlineQueryResult(buf *bin.Buffer) (InputInlineQueryResultClass, } return &v, nil case InputInlineQueryResultArticleTypeID: - // Decoding inputInlineQueryResultArticle#75a3d10c. + // Decoding inputInlineQueryResultArticle#763583bc. v := InputInlineQueryResultArticle{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) @@ -5346,7 +5312,7 @@ func DecodeTDLibJSONInputInlineQueryResult(buf tdjson.Decoder) (InputInlineQuery } return &v, nil case "inputInlineQueryResultArticle": - // Decoding inputInlineQueryResultArticle#75a3d10c. + // Decoding inputInlineQueryResultArticle#763583bc. v := InputInlineQueryResultArticle{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) diff --git a/tdapi/tl_message_content_gen.go b/tdapi/tl_message_content_gen.go index e7e8d17fa1..7ca9dac4b4 100644 --- a/tdapi/tl_message_content_gen.go +++ b/tdapi/tl_message_content_gen.go @@ -14770,27 +14770,40 @@ func (m *MessageGiveawayPrizeStars) GetSticker() (value Sticker) { return m.Sticker } -// MessageGift represents TL type `messageGift#982ec167`. +// MessageGift represents TL type `messageGift#621a3876`. type MessageGift struct { // The gift Gift Gift // Message added to the gift Text FormattedText - // Number of Telegram Stars that can be claimed by the receiver instead of the gift; 0 if - // the gift can't be sold by the receiver + // Number of Telegram Stars that can be claimed by the receiver instead of the regular + // gift; 0 if the gift can't be sold by the receiver SellStarCount int64 + // Number of Telegram Stars that were paid by the sender for the ability to upgrade the + // gift + PrepaidUpgradeStarCount int64 // True, if the sender and gift text are shown only to the gift receiver; otherwise, // everyone will be able to see them IsPrivate bool // True, if the gift is displayed on the user's profile page; only for the receiver of // the gift IsSaved bool + // True, if the gift can be upgraded to a unique gift; only for the receiver of the gift + CanBeUpgraded bool // True, if the gift was converted to Telegram Stars; only for the receiver of the gift WasConverted bool + // True, if the gift was upgraded to a unique gift + WasUpgraded bool + // True, if the gift was refunded and isn't available anymore + WasRefunded bool + // Identifier of the service message messageUpgradedGift or messageRefundedUpgradedGift + // with upgraded version of the gift; can be 0 if none or an identifier of a deleted + // message. + UpgradeMessageID int64 } // MessageGiftTypeID is TL type id of MessageGift. -const MessageGiftTypeID = 0x982ec167 +const MessageGiftTypeID = 0x621a3876 // construct implements constructor of MessageContentClass. func (m MessageGift) construct() MessageContentClass { return &m } @@ -14818,15 +14831,30 @@ func (m *MessageGift) Zero() bool { if !(m.SellStarCount == 0) { return false } + if !(m.PrepaidUpgradeStarCount == 0) { + return false + } if !(m.IsPrivate == false) { return false } if !(m.IsSaved == false) { return false } + if !(m.CanBeUpgraded == false) { + return false + } if !(m.WasConverted == false) { return false } + if !(m.WasUpgraded == false) { + return false + } + if !(m.WasRefunded == false) { + return false + } + if !(m.UpgradeMessageID == 0) { + return false + } return true } @@ -14875,6 +14903,10 @@ func (m *MessageGift) TypeInfo() tdp.Type { Name: "SellStarCount", SchemaName: "sell_star_count", }, + { + Name: "PrepaidUpgradeStarCount", + SchemaName: "prepaid_upgrade_star_count", + }, { Name: "IsPrivate", SchemaName: "is_private", @@ -14883,10 +14915,26 @@ func (m *MessageGift) TypeInfo() tdp.Type { Name: "IsSaved", SchemaName: "is_saved", }, + { + Name: "CanBeUpgraded", + SchemaName: "can_be_upgraded", + }, { Name: "WasConverted", SchemaName: "was_converted", }, + { + Name: "WasUpgraded", + SchemaName: "was_upgraded", + }, + { + Name: "WasRefunded", + SchemaName: "was_refunded", + }, + { + Name: "UpgradeMessageID", + SchemaName: "upgrade_message_id", + }, } return typ } @@ -14894,7 +14942,7 @@ func (m *MessageGift) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (m *MessageGift) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageGift#982ec167 as nil") + return fmt.Errorf("can't encode messageGift#621a3876 as nil") } b.PutID(MessageGiftTypeID) return m.EncodeBare(b) @@ -14903,28 +14951,33 @@ func (m *MessageGift) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageGift) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageGift#982ec167 as nil") + return fmt.Errorf("can't encode messageGift#621a3876 as nil") } if err := m.Gift.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageGift#982ec167: field gift: %w", err) + return fmt.Errorf("unable to encode messageGift#621a3876: field gift: %w", err) } if err := m.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageGift#982ec167: field text: %w", err) + return fmt.Errorf("unable to encode messageGift#621a3876: field text: %w", err) } b.PutInt53(m.SellStarCount) + b.PutInt53(m.PrepaidUpgradeStarCount) b.PutBool(m.IsPrivate) b.PutBool(m.IsSaved) + b.PutBool(m.CanBeUpgraded) b.PutBool(m.WasConverted) + b.PutBool(m.WasUpgraded) + b.PutBool(m.WasRefunded) + b.PutInt53(m.UpgradeMessageID) return nil } // Decode implements bin.Decoder. func (m *MessageGift) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageGift#982ec167 to nil") + return fmt.Errorf("can't decode messageGift#621a3876 to nil") } if err := b.ConsumeID(MessageGiftTypeID); err != nil { - return fmt.Errorf("unable to decode messageGift#982ec167: %w", err) + return fmt.Errorf("unable to decode messageGift#621a3876: %w", err) } return m.DecodeBare(b) } @@ -14932,79 +14985,129 @@ func (m *MessageGift) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageGift) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageGift#982ec167 to nil") + return fmt.Errorf("can't decode messageGift#621a3876 to nil") } { if err := m.Gift.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageGift#982ec167: field gift: %w", err) + return fmt.Errorf("unable to decode messageGift#621a3876: field gift: %w", err) } } { if err := m.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageGift#982ec167: field text: %w", err) + return fmt.Errorf("unable to decode messageGift#621a3876: field text: %w", err) } } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode messageGift#982ec167: field sell_star_count: %w", err) + return fmt.Errorf("unable to decode messageGift#621a3876: field sell_star_count: %w", err) } m.SellStarCount = value } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGift#621a3876: field prepaid_upgrade_star_count: %w", err) + } + m.PrepaidUpgradeStarCount = value + } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageGift#982ec167: field is_private: %w", err) + return fmt.Errorf("unable to decode messageGift#621a3876: field is_private: %w", err) } m.IsPrivate = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageGift#982ec167: field is_saved: %w", err) + return fmt.Errorf("unable to decode messageGift#621a3876: field is_saved: %w", err) } m.IsSaved = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageGift#982ec167: field was_converted: %w", err) + return fmt.Errorf("unable to decode messageGift#621a3876: field can_be_upgraded: %w", err) + } + m.CanBeUpgraded = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageGift#621a3876: field was_converted: %w", err) } m.WasConverted = value } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageGift#621a3876: field was_upgraded: %w", err) + } + m.WasUpgraded = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageGift#621a3876: field was_refunded: %w", err) + } + m.WasRefunded = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGift#621a3876: field upgrade_message_id: %w", err) + } + m.UpgradeMessageID = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (m *MessageGift) EncodeTDLibJSON(b tdjson.Encoder) error { if m == nil { - return fmt.Errorf("can't encode messageGift#982ec167 as nil") + return fmt.Errorf("can't encode messageGift#621a3876 as nil") } b.ObjStart() b.PutID("messageGift") b.Comma() b.FieldStart("gift") if err := m.Gift.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageGift#982ec167: field gift: %w", err) + return fmt.Errorf("unable to encode messageGift#621a3876: field gift: %w", err) } b.Comma() b.FieldStart("text") if err := m.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageGift#982ec167: field text: %w", err) + return fmt.Errorf("unable to encode messageGift#621a3876: field text: %w", err) } b.Comma() b.FieldStart("sell_star_count") b.PutInt53(m.SellStarCount) b.Comma() + b.FieldStart("prepaid_upgrade_star_count") + b.PutInt53(m.PrepaidUpgradeStarCount) + b.Comma() b.FieldStart("is_private") b.PutBool(m.IsPrivate) b.Comma() b.FieldStart("is_saved") b.PutBool(m.IsSaved) b.Comma() + b.FieldStart("can_be_upgraded") + b.PutBool(m.CanBeUpgraded) + b.Comma() b.FieldStart("was_converted") b.PutBool(m.WasConverted) b.Comma() + b.FieldStart("was_upgraded") + b.PutBool(m.WasUpgraded) + b.Comma() + b.FieldStart("was_refunded") + b.PutBool(m.WasRefunded) + b.Comma() + b.FieldStart("upgrade_message_id") + b.PutInt53(m.UpgradeMessageID) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -15013,47 +15116,77 @@ func (m *MessageGift) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (m *MessageGift) DecodeTDLibJSON(b tdjson.Decoder) error { if m == nil { - return fmt.Errorf("can't decode messageGift#982ec167 to nil") + return fmt.Errorf("can't decode messageGift#621a3876 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("messageGift"); err != nil { - return fmt.Errorf("unable to decode messageGift#982ec167: %w", err) + return fmt.Errorf("unable to decode messageGift#621a3876: %w", err) } case "gift": if err := m.Gift.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageGift#982ec167: field gift: %w", err) + return fmt.Errorf("unable to decode messageGift#621a3876: field gift: %w", err) } case "text": if err := m.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageGift#982ec167: field text: %w", err) + return fmt.Errorf("unable to decode messageGift#621a3876: field text: %w", err) } case "sell_star_count": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode messageGift#982ec167: field sell_star_count: %w", err) + return fmt.Errorf("unable to decode messageGift#621a3876: field sell_star_count: %w", err) } m.SellStarCount = value + case "prepaid_upgrade_star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGift#621a3876: field prepaid_upgrade_star_count: %w", err) + } + m.PrepaidUpgradeStarCount = value case "is_private": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageGift#982ec167: field is_private: %w", err) + return fmt.Errorf("unable to decode messageGift#621a3876: field is_private: %w", err) } m.IsPrivate = value case "is_saved": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageGift#982ec167: field is_saved: %w", err) + return fmt.Errorf("unable to decode messageGift#621a3876: field is_saved: %w", err) } m.IsSaved = value + case "can_be_upgraded": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageGift#621a3876: field can_be_upgraded: %w", err) + } + m.CanBeUpgraded = value case "was_converted": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageGift#982ec167: field was_converted: %w", err) + return fmt.Errorf("unable to decode messageGift#621a3876: field was_converted: %w", err) } m.WasConverted = value + case "was_upgraded": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageGift#621a3876: field was_upgraded: %w", err) + } + m.WasUpgraded = value + case "was_refunded": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageGift#621a3876: field was_refunded: %w", err) + } + m.WasRefunded = value + case "upgrade_message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGift#621a3876: field upgrade_message_id: %w", err) + } + m.UpgradeMessageID = value default: return b.Skip() } @@ -15085,6 +15218,14 @@ func (m *MessageGift) GetSellStarCount() (value int64) { return m.SellStarCount } +// GetPrepaidUpgradeStarCount returns value of PrepaidUpgradeStarCount field. +func (m *MessageGift) GetPrepaidUpgradeStarCount() (value int64) { + if m == nil { + return + } + return m.PrepaidUpgradeStarCount +} + // GetIsPrivate returns value of IsPrivate field. func (m *MessageGift) GetIsPrivate() (value bool) { if m == nil { @@ -15101,6 +15242,14 @@ func (m *MessageGift) GetIsSaved() (value bool) { return m.IsSaved } +// GetCanBeUpgraded returns value of CanBeUpgraded field. +func (m *MessageGift) GetCanBeUpgraded() (value bool) { + if m == nil { + return + } + return m.CanBeUpgraded +} + // GetWasConverted returns value of WasConverted field. func (m *MessageGift) GetWasConverted() (value bool) { if m == nil { @@ -15109,6 +15258,605 @@ func (m *MessageGift) GetWasConverted() (value bool) { return m.WasConverted } +// GetWasUpgraded returns value of WasUpgraded field. +func (m *MessageGift) GetWasUpgraded() (value bool) { + if m == nil { + return + } + return m.WasUpgraded +} + +// GetWasRefunded returns value of WasRefunded field. +func (m *MessageGift) GetWasRefunded() (value bool) { + if m == nil { + return + } + return m.WasRefunded +} + +// GetUpgradeMessageID returns value of UpgradeMessageID field. +func (m *MessageGift) GetUpgradeMessageID() (value int64) { + if m == nil { + return + } + return m.UpgradeMessageID +} + +// MessageUpgradedGift represents TL type `messageUpgradedGift#4932f215`. +type MessageUpgradedGift struct { + // The gift + Gift UpgradedGift + // True, if the gift was obtained by upgrading of a previously received gift; otherwise, + // this is a transferred gift + IsUpgrade bool + // True, if the gift is displayed on the user's profile page; only for the receiver of + // the gift + IsSaved bool + // True, if the gift can be transferred to another user; only for the receiver of the + // gift + CanBeTransferred bool + // True, if the gift was transferred to another user; only for the receiver of the gift + WasTransferred bool + // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the + // receiver of the gift + TransferStarCount int64 + // Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as + // an NFT; 0 if NFT export isn't possible; only for the receiver of the gift + ExportDate int32 +} + +// MessageUpgradedGiftTypeID is TL type id of MessageUpgradedGift. +const MessageUpgradedGiftTypeID = 0x4932f215 + +// construct implements constructor of MessageContentClass. +func (m MessageUpgradedGift) construct() MessageContentClass { return &m } + +// Ensuring interfaces in compile-time for MessageUpgradedGift. +var ( + _ bin.Encoder = &MessageUpgradedGift{} + _ bin.Decoder = &MessageUpgradedGift{} + _ bin.BareEncoder = &MessageUpgradedGift{} + _ bin.BareDecoder = &MessageUpgradedGift{} + + _ MessageContentClass = &MessageUpgradedGift{} +) + +func (m *MessageUpgradedGift) Zero() bool { + if m == nil { + return true + } + if !(m.Gift.Zero()) { + return false + } + if !(m.IsUpgrade == false) { + return false + } + if !(m.IsSaved == false) { + return false + } + if !(m.CanBeTransferred == false) { + return false + } + if !(m.WasTransferred == false) { + return false + } + if !(m.TransferStarCount == 0) { + return false + } + if !(m.ExportDate == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageUpgradedGift) String() string { + if m == nil { + return "MessageUpgradedGift(nil)" + } + type Alias MessageUpgradedGift + return fmt.Sprintf("MessageUpgradedGift%+v", Alias(*m)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageUpgradedGift) TypeID() uint32 { + return MessageUpgradedGiftTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageUpgradedGift) TypeName() string { + return "messageUpgradedGift" +} + +// TypeInfo returns info about TL type. +func (m *MessageUpgradedGift) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageUpgradedGift", + ID: MessageUpgradedGiftTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Gift", + SchemaName: "gift", + }, + { + Name: "IsUpgrade", + SchemaName: "is_upgrade", + }, + { + Name: "IsSaved", + SchemaName: "is_saved", + }, + { + Name: "CanBeTransferred", + SchemaName: "can_be_transferred", + }, + { + Name: "WasTransferred", + SchemaName: "was_transferred", + }, + { + Name: "TransferStarCount", + SchemaName: "transfer_star_count", + }, + { + Name: "ExportDate", + SchemaName: "export_date", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MessageUpgradedGift) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageUpgradedGift#4932f215 as nil") + } + b.PutID(MessageUpgradedGiftTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageUpgradedGift) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageUpgradedGift#4932f215 as nil") + } + if err := m.Gift.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageUpgradedGift#4932f215: field gift: %w", err) + } + b.PutBool(m.IsUpgrade) + b.PutBool(m.IsSaved) + b.PutBool(m.CanBeTransferred) + b.PutBool(m.WasTransferred) + b.PutInt53(m.TransferStarCount) + b.PutInt32(m.ExportDate) + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageUpgradedGift) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageUpgradedGift#4932f215 to nil") + } + if err := b.ConsumeID(MessageUpgradedGiftTypeID); err != nil { + return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageUpgradedGift) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageUpgradedGift#4932f215 to nil") + } + { + if err := m.Gift.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field gift: %w", err) + } + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field is_upgrade: %w", err) + } + m.IsUpgrade = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field is_saved: %w", err) + } + m.IsSaved = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field can_be_transferred: %w", err) + } + m.CanBeTransferred = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field was_transferred: %w", err) + } + m.WasTransferred = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field transfer_star_count: %w", err) + } + m.TransferStarCount = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field export_date: %w", err) + } + m.ExportDate = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (m *MessageUpgradedGift) EncodeTDLibJSON(b tdjson.Encoder) error { + if m == nil { + return fmt.Errorf("can't encode messageUpgradedGift#4932f215 as nil") + } + b.ObjStart() + b.PutID("messageUpgradedGift") + b.Comma() + b.FieldStart("gift") + if err := m.Gift.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode messageUpgradedGift#4932f215: field gift: %w", err) + } + b.Comma() + b.FieldStart("is_upgrade") + b.PutBool(m.IsUpgrade) + b.Comma() + b.FieldStart("is_saved") + b.PutBool(m.IsSaved) + b.Comma() + b.FieldStart("can_be_transferred") + b.PutBool(m.CanBeTransferred) + b.Comma() + b.FieldStart("was_transferred") + b.PutBool(m.WasTransferred) + b.Comma() + b.FieldStart("transfer_star_count") + b.PutInt53(m.TransferStarCount) + b.Comma() + b.FieldStart("export_date") + b.PutInt32(m.ExportDate) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (m *MessageUpgradedGift) DecodeTDLibJSON(b tdjson.Decoder) error { + if m == nil { + return fmt.Errorf("can't decode messageUpgradedGift#4932f215 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("messageUpgradedGift"); err != nil { + return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: %w", err) + } + case "gift": + if err := m.Gift.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field gift: %w", err) + } + case "is_upgrade": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field is_upgrade: %w", err) + } + m.IsUpgrade = value + case "is_saved": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field is_saved: %w", err) + } + m.IsSaved = value + case "can_be_transferred": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field can_be_transferred: %w", err) + } + m.CanBeTransferred = value + case "was_transferred": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field was_transferred: %w", err) + } + m.WasTransferred = value + case "transfer_star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field transfer_star_count: %w", err) + } + m.TransferStarCount = value + case "export_date": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field export_date: %w", err) + } + m.ExportDate = value + default: + return b.Skip() + } + return nil + }) +} + +// GetGift returns value of Gift field. +func (m *MessageUpgradedGift) GetGift() (value UpgradedGift) { + if m == nil { + return + } + return m.Gift +} + +// GetIsUpgrade returns value of IsUpgrade field. +func (m *MessageUpgradedGift) GetIsUpgrade() (value bool) { + if m == nil { + return + } + return m.IsUpgrade +} + +// GetIsSaved returns value of IsSaved field. +func (m *MessageUpgradedGift) GetIsSaved() (value bool) { + if m == nil { + return + } + return m.IsSaved +} + +// GetCanBeTransferred returns value of CanBeTransferred field. +func (m *MessageUpgradedGift) GetCanBeTransferred() (value bool) { + if m == nil { + return + } + return m.CanBeTransferred +} + +// GetWasTransferred returns value of WasTransferred field. +func (m *MessageUpgradedGift) GetWasTransferred() (value bool) { + if m == nil { + return + } + return m.WasTransferred +} + +// GetTransferStarCount returns value of TransferStarCount field. +func (m *MessageUpgradedGift) GetTransferStarCount() (value int64) { + if m == nil { + return + } + return m.TransferStarCount +} + +// GetExportDate returns value of ExportDate field. +func (m *MessageUpgradedGift) GetExportDate() (value int32) { + if m == nil { + return + } + return m.ExportDate +} + +// MessageRefundedUpgradedGift represents TL type `messageRefundedUpgradedGift#d373886d`. +type MessageRefundedUpgradedGift struct { + // The gift + Gift Gift + // True, if the gift was obtained by upgrading of a previously received gift + IsUpgrade bool +} + +// MessageRefundedUpgradedGiftTypeID is TL type id of MessageRefundedUpgradedGift. +const MessageRefundedUpgradedGiftTypeID = 0xd373886d + +// construct implements constructor of MessageContentClass. +func (m MessageRefundedUpgradedGift) construct() MessageContentClass { return &m } + +// Ensuring interfaces in compile-time for MessageRefundedUpgradedGift. +var ( + _ bin.Encoder = &MessageRefundedUpgradedGift{} + _ bin.Decoder = &MessageRefundedUpgradedGift{} + _ bin.BareEncoder = &MessageRefundedUpgradedGift{} + _ bin.BareDecoder = &MessageRefundedUpgradedGift{} + + _ MessageContentClass = &MessageRefundedUpgradedGift{} +) + +func (m *MessageRefundedUpgradedGift) Zero() bool { + if m == nil { + return true + } + if !(m.Gift.Zero()) { + return false + } + if !(m.IsUpgrade == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageRefundedUpgradedGift) String() string { + if m == nil { + return "MessageRefundedUpgradedGift(nil)" + } + type Alias MessageRefundedUpgradedGift + return fmt.Sprintf("MessageRefundedUpgradedGift%+v", Alias(*m)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageRefundedUpgradedGift) TypeID() uint32 { + return MessageRefundedUpgradedGiftTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageRefundedUpgradedGift) TypeName() string { + return "messageRefundedUpgradedGift" +} + +// TypeInfo returns info about TL type. +func (m *MessageRefundedUpgradedGift) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageRefundedUpgradedGift", + ID: MessageRefundedUpgradedGiftTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Gift", + SchemaName: "gift", + }, + { + Name: "IsUpgrade", + SchemaName: "is_upgrade", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MessageRefundedUpgradedGift) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageRefundedUpgradedGift#d373886d as nil") + } + b.PutID(MessageRefundedUpgradedGiftTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageRefundedUpgradedGift) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageRefundedUpgradedGift#d373886d as nil") + } + if err := m.Gift.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageRefundedUpgradedGift#d373886d: field gift: %w", err) + } + b.PutBool(m.IsUpgrade) + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageRefundedUpgradedGift) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageRefundedUpgradedGift#d373886d to nil") + } + if err := b.ConsumeID(MessageRefundedUpgradedGiftTypeID); err != nil { + return fmt.Errorf("unable to decode messageRefundedUpgradedGift#d373886d: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageRefundedUpgradedGift) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageRefundedUpgradedGift#d373886d to nil") + } + { + if err := m.Gift.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageRefundedUpgradedGift#d373886d: field gift: %w", err) + } + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageRefundedUpgradedGift#d373886d: field is_upgrade: %w", err) + } + m.IsUpgrade = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (m *MessageRefundedUpgradedGift) EncodeTDLibJSON(b tdjson.Encoder) error { + if m == nil { + return fmt.Errorf("can't encode messageRefundedUpgradedGift#d373886d as nil") + } + b.ObjStart() + b.PutID("messageRefundedUpgradedGift") + b.Comma() + b.FieldStart("gift") + if err := m.Gift.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode messageRefundedUpgradedGift#d373886d: field gift: %w", err) + } + b.Comma() + b.FieldStart("is_upgrade") + b.PutBool(m.IsUpgrade) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (m *MessageRefundedUpgradedGift) DecodeTDLibJSON(b tdjson.Decoder) error { + if m == nil { + return fmt.Errorf("can't decode messageRefundedUpgradedGift#d373886d to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("messageRefundedUpgradedGift"); err != nil { + return fmt.Errorf("unable to decode messageRefundedUpgradedGift#d373886d: %w", err) + } + case "gift": + if err := m.Gift.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode messageRefundedUpgradedGift#d373886d: field gift: %w", err) + } + case "is_upgrade": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageRefundedUpgradedGift#d373886d: field is_upgrade: %w", err) + } + m.IsUpgrade = value + default: + return b.Skip() + } + return nil + }) +} + +// GetGift returns value of Gift field. +func (m *MessageRefundedUpgradedGift) GetGift() (value Gift) { + if m == nil { + return + } + return m.Gift +} + +// GetIsUpgrade returns value of IsUpgrade field. +func (m *MessageRefundedUpgradedGift) GetIsUpgrade() (value bool) { + if m == nil { + return + } + return m.IsUpgrade +} + // MessageContactRegistered represents TL type `messageContactRegistered#a678fcff`. type MessageContactRegistered struct { } @@ -17098,7 +17846,9 @@ const MessageContentClassName = "MessageContent" // case *tdapi.MessageGiveawayWinners: // messageGiveawayWinners#1d99a27a // case *tdapi.MessageGiftedStars: // messageGiftedStars#41bdbea7 // case *tdapi.MessageGiveawayPrizeStars: // messageGiveawayPrizeStars#aa0f5de3 -// case *tdapi.MessageGift: // messageGift#982ec167 +// case *tdapi.MessageGift: // messageGift#621a3876 +// case *tdapi.MessageUpgradedGift: // messageUpgradedGift#4932f215 +// case *tdapi.MessageRefundedUpgradedGift: // messageRefundedUpgradedGift#d373886d // case *tdapi.MessageContactRegistered: // messageContactRegistered#a678fcff // case *tdapi.MessageUsersShared: // messageUsersShared#7f1f4a22 // case *tdapi.MessageChatShared: // messageChatShared#aec6d961 @@ -17582,12 +18332,26 @@ func DecodeMessageContent(buf *bin.Buffer) (MessageContentClass, error) { } return &v, nil case MessageGiftTypeID: - // Decoding messageGift#982ec167. + // Decoding messageGift#621a3876. v := MessageGift{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil + case MessageUpgradedGiftTypeID: + // Decoding messageUpgradedGift#4932f215. + v := MessageUpgradedGift{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) + } + return &v, nil + case MessageRefundedUpgradedGiftTypeID: + // Decoding messageRefundedUpgradedGift#d373886d. + v := MessageRefundedUpgradedGift{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) + } + return &v, nil case MessageContactRegisteredTypeID: // Decoding messageContactRegistered#a678fcff. v := MessageContactRegistered{} @@ -18112,12 +18876,26 @@ func DecodeTDLibJSONMessageContent(buf tdjson.Decoder) (MessageContentClass, err } return &v, nil case "messageGift": - // Decoding messageGift#982ec167. + // Decoding messageGift#621a3876. v := MessageGift{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil + case "messageUpgradedGift": + // Decoding messageUpgradedGift#4932f215. + v := MessageUpgradedGift{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) + } + return &v, nil + case "messageRefundedUpgradedGift": + // Decoding messageRefundedUpgradedGift#d373886d. + v := MessageRefundedUpgradedGift{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) + } + return &v, nil case "messageContactRegistered": // Decoding messageContactRegistered#a678fcff. v := MessageContactRegistered{} diff --git a/tdapi/tl_push_message_content_gen.go b/tdapi/tl_push_message_content_gen.go index 3e7b81989d..0656d352f3 100644 --- a/tdapi/tl_push_message_content_gen.go +++ b/tdapi/tl_push_message_content_gen.go @@ -3276,6 +3276,173 @@ func (p *PushMessageContentGift) GetStarCount() (value int64) { return p.StarCount } +// PushMessageContentUpgradedGift represents TL type `pushMessageContentUpgradedGift#99fa0ade`. +type PushMessageContentUpgradedGift struct { + // True, if the gift was obtained by upgrading of a previously received gift; otherwise, + // this is a transferred gift + IsUpgrade bool +} + +// PushMessageContentUpgradedGiftTypeID is TL type id of PushMessageContentUpgradedGift. +const PushMessageContentUpgradedGiftTypeID = 0x99fa0ade + +// construct implements constructor of PushMessageContentClass. +func (p PushMessageContentUpgradedGift) construct() PushMessageContentClass { return &p } + +// Ensuring interfaces in compile-time for PushMessageContentUpgradedGift. +var ( + _ bin.Encoder = &PushMessageContentUpgradedGift{} + _ bin.Decoder = &PushMessageContentUpgradedGift{} + _ bin.BareEncoder = &PushMessageContentUpgradedGift{} + _ bin.BareDecoder = &PushMessageContentUpgradedGift{} + + _ PushMessageContentClass = &PushMessageContentUpgradedGift{} +) + +func (p *PushMessageContentUpgradedGift) Zero() bool { + if p == nil { + return true + } + if !(p.IsUpgrade == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *PushMessageContentUpgradedGift) String() string { + if p == nil { + return "PushMessageContentUpgradedGift(nil)" + } + type Alias PushMessageContentUpgradedGift + return fmt.Sprintf("PushMessageContentUpgradedGift%+v", Alias(*p)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PushMessageContentUpgradedGift) TypeID() uint32 { + return PushMessageContentUpgradedGiftTypeID +} + +// TypeName returns name of type in TL schema. +func (*PushMessageContentUpgradedGift) TypeName() string { + return "pushMessageContentUpgradedGift" +} + +// TypeInfo returns info about TL type. +func (p *PushMessageContentUpgradedGift) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "pushMessageContentUpgradedGift", + ID: PushMessageContentUpgradedGiftTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "IsUpgrade", + SchemaName: "is_upgrade", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (p *PushMessageContentUpgradedGift) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode pushMessageContentUpgradedGift#99fa0ade as nil") + } + b.PutID(PushMessageContentUpgradedGiftTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *PushMessageContentUpgradedGift) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode pushMessageContentUpgradedGift#99fa0ade as nil") + } + b.PutBool(p.IsUpgrade) + return nil +} + +// Decode implements bin.Decoder. +func (p *PushMessageContentUpgradedGift) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode pushMessageContentUpgradedGift#99fa0ade to nil") + } + if err := b.ConsumeID(PushMessageContentUpgradedGiftTypeID); err != nil { + return fmt.Errorf("unable to decode pushMessageContentUpgradedGift#99fa0ade: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *PushMessageContentUpgradedGift) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode pushMessageContentUpgradedGift#99fa0ade to nil") + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode pushMessageContentUpgradedGift#99fa0ade: field is_upgrade: %w", err) + } + p.IsUpgrade = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (p *PushMessageContentUpgradedGift) EncodeTDLibJSON(b tdjson.Encoder) error { + if p == nil { + return fmt.Errorf("can't encode pushMessageContentUpgradedGift#99fa0ade as nil") + } + b.ObjStart() + b.PutID("pushMessageContentUpgradedGift") + b.Comma() + b.FieldStart("is_upgrade") + b.PutBool(p.IsUpgrade) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (p *PushMessageContentUpgradedGift) DecodeTDLibJSON(b tdjson.Decoder) error { + if p == nil { + return fmt.Errorf("can't decode pushMessageContentUpgradedGift#99fa0ade to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("pushMessageContentUpgradedGift"); err != nil { + return fmt.Errorf("unable to decode pushMessageContentUpgradedGift#99fa0ade: %w", err) + } + case "is_upgrade": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode pushMessageContentUpgradedGift#99fa0ade: field is_upgrade: %w", err) + } + p.IsUpgrade = value + default: + return b.Skip() + } + return nil + }) +} + +// GetIsUpgrade returns value of IsUpgrade field. +func (p *PushMessageContentUpgradedGift) GetIsUpgrade() (value bool) { + if p == nil { + return + } + return p.IsUpgrade +} + // PushMessageContentScreenshotTaken represents TL type `pushMessageContentScreenshotTaken#cc51ff9`. type PushMessageContentScreenshotTaken struct { } @@ -6959,6 +7126,7 @@ const PushMessageContentClassName = "PushMessageContent" // case *tdapi.PushMessageContentPremiumGiftCode: // pushMessageContentPremiumGiftCode#18a15025 // case *tdapi.PushMessageContentGiveaway: // pushMessageContentGiveaway#d63e7f8e // case *tdapi.PushMessageContentGift: // pushMessageContentGift#84a8cd0b +// case *tdapi.PushMessageContentUpgradedGift: // pushMessageContentUpgradedGift#99fa0ade // case *tdapi.PushMessageContentScreenshotTaken: // pushMessageContentScreenshotTaken#cc51ff9 // case *tdapi.PushMessageContentSticker: // pushMessageContentSticker#5c98bdd3 // case *tdapi.PushMessageContentStory: // pushMessageContentStory#996471c9 @@ -7122,6 +7290,13 @@ func DecodePushMessageContent(buf *bin.Buffer) (PushMessageContentClass, error) return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) } return &v, nil + case PushMessageContentUpgradedGiftTypeID: + // Decoding pushMessageContentUpgradedGift#99fa0ade. + v := PushMessageContentUpgradedGift{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) + } + return &v, nil case PushMessageContentScreenshotTakenTypeID: // Decoding pushMessageContentScreenshotTaken#cc51ff9. v := PushMessageContentScreenshotTaken{} @@ -7386,6 +7561,13 @@ func DecodeTDLibJSONPushMessageContent(buf tdjson.Decoder) (PushMessageContentCl return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) } return &v, nil + case "pushMessageContentUpgradedGift": + // Decoding pushMessageContentUpgradedGift#99fa0ade. + v := PushMessageContentUpgradedGift{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) + } + return &v, nil case "pushMessageContentScreenshotTaken": // Decoding pushMessageContentScreenshotTaken#cc51ff9. v := PushMessageContentScreenshotTaken{} diff --git a/tdapi/tl_registry_gen.go b/tdapi/tl_registry_gen.go index 07d5f19dd6..7fd894fc07 100644 --- a/tdapi/tl_registry_gen.go +++ b/tdapi/tl_registry_gen.go @@ -146,6 +146,9 @@ func TypesMap() map[uint32]string { BotCommandTypeID: "botCommand#c27ac8c7", BotCommandsTypeID: "botCommands#4f9aa2c5", BotMenuButtonTypeID: "botMenuButton#c7b57ce6", + BotVerificationParametersTypeID: "botVerificationParameters#d4dca55f", + BotVerificationTypeID: "botVerification#b160b6f2", + VerificationStatusTypeID: "verificationStatus#3ae6a18c", ChatLocationTypeID: "chatLocation#a29b8f21", BirthdateTypeID: "birthdate#61fe6d1e", CloseBirthdayUserTypeID: "closeBirthdayUser#800659ee", @@ -184,16 +187,19 @@ func TypesMap() map[uint32]string { StarSubscriptionPricingTypeID: "starSubscriptionPricing#96a28856", StarSubscriptionTypeID: "starSubscription#3a3811f5", StarSubscriptionsTypeID: "starSubscriptions#a2f27c8d", + AffiliateTypeCurrentUserTypeID: "affiliateTypeCurrentUser#56a701f5", + AffiliateTypeBotTypeID: "affiliateTypeBot#c273f840", + AffiliateTypeChannelTypeID: "affiliateTypeChannel#d73be869", AffiliateProgramSortOrderProfitabilityTypeID: "affiliateProgramSortOrderProfitability#8afaaf67", AffiliateProgramSortOrderCreationDateTypeID: "affiliateProgramSortOrderCreationDate#a319390d", AffiliateProgramSortOrderRevenueTypeID: "affiliateProgramSortOrderRevenue#72a2c2b8", AffiliateProgramParametersTypeID: "affiliateProgramParameters#61e90c54", AffiliateProgramInfoTypeID: "affiliateProgramInfo#96fce8b5", AffiliateInfoTypeID: "affiliateInfo#b1c1dcfa", - FoundAffiliateProgramTypeID: "foundAffiliateProgram#80bf7012", + FoundAffiliateProgramTypeID: "foundAffiliateProgram#c6636286", FoundAffiliateProgramsTypeID: "foundAffiliatePrograms#b6228108", - ChatAffiliateProgramTypeID: "chatAffiliateProgram#ab9c1136", - ChatAffiliateProgramsTypeID: "chatAffiliatePrograms#74f423e2", + ConnectedAffiliateProgramTypeID: "connectedAffiliateProgram#58bf7415", + ConnectedAffiliateProgramsTypeID: "connectedAffiliatePrograms#59231e33", ProductInfoTypeID: "productInfo#87e47ca4", PremiumPaymentOptionTypeID: "premiumPaymentOption#8c0c5fb2", PremiumStatePaymentOptionTypeID: "premiumStatePaymentOption#7d06b579", @@ -205,10 +211,19 @@ func TypesMap() map[uint32]string { StarGiveawayWinnerOptionTypeID: "starGiveawayWinnerOption#cc639607", StarGiveawayPaymentOptionTypeID: "starGiveawayPaymentOption#bca2d5e5", StarGiveawayPaymentOptionsTypeID: "starGiveawayPaymentOptions#909fbf18", - GiftTypeID: "gift#d3284cce", + UpgradedGiftModelTypeID: "upgradedGiftModel#5112584f", + UpgradedGiftSymbolTypeID: "upgradedGiftSymbol#4340c5af", + UpgradedGiftBackdropTypeID: "upgradedGiftBackdrop#fc371c7e", + UpgradedGiftOriginalDetailsTypeID: "upgradedGiftOriginalDetails#44d2b2dd", + GiftTypeID: "gift#7cf9442d", GiftsTypeID: "gifts#7ea494b8", - UserGiftTypeID: "userGift#494eb721", + UpgradedGiftTypeID: "upgradedGift#e5f50e98", + UpgradeGiftResultTypeID: "upgradeGiftResult#3d9e8331", + SentGiftRegularTypeID: "sentGiftRegular#2368ad19", + SentGiftUpgradedTypeID: "sentGiftUpgraded#25674480", + UserGiftTypeID: "userGift#a39db860", UserGiftsTypeID: "userGifts#e274219f", + GiftUpgradePreviewTypeID: "giftUpgradePreview#4319deef", StarTransactionDirectionIncomingTypeID: "starTransactionDirectionIncoming#b2cabe46", StarTransactionDirectionOutgoingTypeID: "starTransactionDirectionOutgoing#6e83b5a0", StarTransactionTypePremiumBotDepositTypeID: "starTransactionTypePremiumBotDeposit#d879090e", @@ -231,7 +246,9 @@ func TypesMap() map[uint32]string { StarTransactionTypeChannelSubscriptionPurchaseTypeID: "starTransactionTypeChannelSubscriptionPurchase#380eb3d1", StarTransactionTypeChannelSubscriptionSaleTypeID: "starTransactionTypeChannelSubscriptionSale#fe127c82", StarTransactionTypeGiftPurchaseTypeID: "starTransactionTypeGiftPurchase#ef5f1d52", + StarTransactionTypeGiftTransferTypeID: "starTransactionTypeGiftTransfer#ef323c55", StarTransactionTypeGiftSaleTypeID: "starTransactionTypeGiftSale#64d61157", + StarTransactionTypeGiftUpgradeTypeID: "starTransactionTypeGiftUpgrade#2697844b", StarTransactionTypeChannelPaidReactionSendTypeID: "starTransactionTypeChannelPaidReactionSend#c02667c0", StarTransactionTypeChannelPaidReactionReceiveTypeID: "starTransactionTypeChannelPaidReactionReceive#23d6f9eb", StarTransactionTypeAffiliateProgramCommissionTypeID: "starTransactionTypeAffiliateProgramCommission#9a637573", @@ -253,9 +270,9 @@ func TypesMap() map[uint32]string { EmojiStatusTypeID: "emojiStatus#dbd91636", EmojiStatusesTypeID: "emojiStatuses#eaeb9bdc", UsernamesTypeID: "usernames#bf343063", - UserTypeID: "user#18552c62", - BotInfoTypeID: "botInfo#80eb0e42", - UserFullInfoTypeID: "userFullInfo#85d0c905", + UserTypeID: "user#598c3933", + BotInfoTypeID: "botInfo#d16edb85", + UserFullInfoTypeID: "userFullInfo#ae9201c2", UsersTypeID: "users#9d955a12", FoundUsersTypeID: "foundUsers#c531e854", ChatAdministratorTypeID: "chatAdministrator#7277bd2c", @@ -293,14 +310,14 @@ func TypesMap() map[uint32]string { InviteLinkChatTypeSupergroupTypeID: "inviteLinkChatTypeSupergroup#3de86758", InviteLinkChatTypeChannelTypeID: "inviteLinkChatTypeChannel#3012ef0b", ChatInviteLinkSubscriptionInfoTypeID: "chatInviteLinkSubscriptionInfo#38cf7368", - ChatInviteLinkInfoTypeID: "chatInviteLinkInfo#95bf0ec4", + ChatInviteLinkInfoTypeID: "chatInviteLinkInfo#c3fe73a", ChatJoinRequestTypeID: "chatJoinRequest#3897a68", ChatJoinRequestsTypeID: "chatJoinRequests#b2c5fd31", ChatJoinRequestsInfoTypeID: "chatJoinRequestsInfo#6aff5df5", BasicGroupTypeID: "basicGroup#f464168f", BasicGroupFullInfoTypeID: "basicGroupFullInfo#d62e521e", - SupergroupTypeID: "supergroup#ca7c2ce", - SupergroupFullInfoTypeID: "supergroupFullInfo#1ea45bb", + SupergroupTypeID: "supergroup#9ebc0c42", + SupergroupFullInfoTypeID: "supergroupFullInfo#f763d79d", SecretChatStatePendingTypeID: "secretChatStatePending#9e6c967c", SecretChatStateReadyTypeID: "secretChatStateReady#9ff4b7e9", SecretChatStateClosedTypeID: "secretChatStateClosed#8c1006ed", @@ -393,8 +410,9 @@ func TypesMap() map[uint32]string { ChatTypeSupergroupTypeID: "chatTypeSupergroup#a83a5a6a", ChatTypeSecretTypeID: "chatTypeSecret#3366ab31", ChatFolderIconTypeID: "chatFolderIcon#f74aa0e6", - ChatFolderTypeID: "chatFolder#65805ba5", - ChatFolderInfoTypeID: "chatFolderInfo#b61a485", + ChatFolderNameTypeID: "chatFolderName#ec4d3d9e", + ChatFolderTypeID: "chatFolder#a2e17d38", + ChatFolderInfoTypeID: "chatFolderInfo#309c140d", ChatFolderInviteLinkTypeID: "chatFolderInviteLink#d33caf97", ChatFolderInviteLinksTypeID: "chatFolderInviteLinks#6c135313", ChatFolderInviteLinkInfoTypeID: "chatFolderInviteLinkInfo#776fe405", @@ -740,7 +758,9 @@ func TypesMap() map[uint32]string { MessageGiveawayWinnersTypeID: "messageGiveawayWinners#1d99a27a", MessageGiftedStarsTypeID: "messageGiftedStars#41bdbea7", MessageGiveawayPrizeStarsTypeID: "messageGiveawayPrizeStars#aa0f5de3", - MessageGiftTypeID: "messageGift#982ec167", + MessageGiftTypeID: "messageGift#621a3876", + MessageUpgradedGiftTypeID: "messageUpgradedGift#4932f215", + MessageRefundedUpgradedGiftTypeID: "messageRefundedUpgradedGift#d373886d", MessageContactRegisteredTypeID: "messageContactRegistered#a678fcff", MessageUsersSharedTypeID: "messageUsersShared#7f1f4a22", MessageChatSharedTypeID: "messageChatShared#aec6d961", @@ -821,6 +841,9 @@ func TypesMap() map[uint32]string { SearchMessagesFilterUnreadReactionTypeID: "searchMessagesFilterUnreadReaction#adc43100", SearchMessagesFilterFailedToSendTypeID: "searchMessagesFilterFailedToSend#dc74d6fc", SearchMessagesFilterPinnedTypeID: "searchMessagesFilterPinned#16294d48", + SearchMessagesChatTypeFilterPrivateTypeID: "searchMessagesChatTypeFilterPrivate#45b152cf", + SearchMessagesChatTypeFilterGroupTypeID: "searchMessagesChatTypeFilterGroup#853fa71a", + SearchMessagesChatTypeFilterChannelTypeID: "searchMessagesChatTypeFilterChannel#d1e4b6d5", ChatActionTypingTypeID: "chatActionTyping#16a83437", ChatActionRecordingVideoTypeID: "chatActionRecordingVideo#ce85792", ChatActionUploadingVideoTypeID: "chatActionUploadingVideo#49902c36", @@ -926,6 +949,7 @@ func TypesMap() map[uint32]string { CallDiscardReasonDeclinedTypeID: "callDiscardReasonDeclined#98e36c32", CallDiscardReasonDisconnectedTypeID: "callDiscardReasonDisconnected#aff563a2", CallDiscardReasonHungUpTypeID: "callDiscardReasonHungUp#1a1ea5e6", + CallDiscardReasonAllowGroupCallTypeID: "callDiscardReasonAllowGroupCall#af177fd5", CallProtocolTypeID: "callProtocol#a9a037e", CallServerTypeTelegramReflectorTypeID: "callServerTypeTelegramReflector#32af3515", CallServerTypeWebrtcTypeID: "callServerTypeWebrtc#4a8afd65", @@ -958,7 +982,7 @@ func TypesMap() map[uint32]string { CallProblemDroppedTypeID: "callProblemDropped#b809e381", CallProblemDistortedVideoTypeID: "callProblemDistortedVideo#16f6620a", CallProblemPixelatedVideoTypeID: "callProblemPixelatedVideo#7e1526d3", - CallTypeID: "call#36db9764", + CallTypeID: "call#9e0dd8aa", FirebaseAuthenticationSettingsAndroidTypeID: "firebaseAuthenticationSettingsAndroid#966ef61c", FirebaseAuthenticationSettingsIosTypeID: "firebaseAuthenticationSettingsIos#d49a4c4", PhoneNumberAuthenticationSettingsTypeID: "phoneNumberAuthenticationSettings#3e1183db", @@ -991,7 +1015,7 @@ func TypesMap() map[uint32]string { TargetChatChosenTypeID: "targetChatChosen#acf8d5a6", TargetChatInternalLinkTypeID: "targetChatInternalLink#dd788fe0", InputInlineQueryResultAnimationTypeID: "inputInlineQueryResultAnimation#a7335216", - InputInlineQueryResultArticleTypeID: "inputInlineQueryResultArticle#75a3d10c", + InputInlineQueryResultArticleTypeID: "inputInlineQueryResultArticle#763583bc", InputInlineQueryResultAudioTypeID: "inputInlineQueryResultAudio#4b1c35d4", InputInlineQueryResultContactTypeID: "inputInlineQueryResultContact#6e08b5d2", InputInlineQueryResultDocumentTypeID: "inputInlineQueryResultDocument#227fd0cd", @@ -1002,7 +1026,7 @@ func TypesMap() map[uint32]string { InputInlineQueryResultVenueTypeID: "inputInlineQueryResultVenue#2049c13d", InputInlineQueryResultVideoTypeID: "inputInlineQueryResultVideo#66c344e7", InputInlineQueryResultVoiceNoteTypeID: "inputInlineQueryResultVoiceNote#954da949", - InlineQueryResultArticleTypeID: "inlineQueryResultArticle#c4c82d9", + InlineQueryResultArticleTypeID: "inlineQueryResultArticle#1016d01a", InlineQueryResultContactTypeID: "inlineQueryResultContact#f5278212", InlineQueryResultLocationTypeID: "inlineQueryResultLocation#1bc6ab10", InlineQueryResultVenueTypeID: "inlineQueryResultVenue#4c5b105e", @@ -1241,6 +1265,7 @@ func TypesMap() map[uint32]string { PushMessageContentPremiumGiftCodeTypeID: "pushMessageContentPremiumGiftCode#18a15025", PushMessageContentGiveawayTypeID: "pushMessageContentGiveaway#d63e7f8e", PushMessageContentGiftTypeID: "pushMessageContentGift#84a8cd0b", + PushMessageContentUpgradedGiftTypeID: "pushMessageContentUpgradedGift#99fa0ade", PushMessageContentScreenshotTakenTypeID: "pushMessageContentScreenshotTaken#cc51ff9", PushMessageContentStickerTypeID: "pushMessageContentSticker#5c98bdd3", PushMessageContentStoryTypeID: "pushMessageContentStory#996471c9", @@ -1488,6 +1513,7 @@ func TypesMap() map[uint32]string { SuggestedActionSubscribeToAnnualPremiumTypeID: "suggestedActionSubscribeToAnnualPremium#164978bb", SuggestedActionGiftPremiumForChristmasTypeID: "suggestedActionGiftPremiumForChristmas#93b3ee6f", SuggestedActionSetBirthdateTypeID: "suggestedActionSetBirthdate#eabd9b02", + SuggestedActionSetProfilePhotoTypeID: "suggestedActionSetProfilePhoto#9fe23d6b", SuggestedActionExtendPremiumTypeID: "suggestedActionExtendPremium#de405cca", SuggestedActionExtendStarSubscriptionsTypeID: "suggestedActionExtendStarSubscriptions#fd32d556", CountTypeID: "count#4d38f104", @@ -1805,7 +1831,7 @@ func TypesMap() map[uint32]string { DeleteChatHistoryRequestTypeID: "deleteChatHistory#a841d09f", DeleteChatRequestTypeID: "deleteChat#f5cae05e", SearchChatMessagesRequestTypeID: "searchChatMessages#dfdeb5c6", - SearchMessagesRequestTypeID: "searchMessages#31f9c3c9", + SearchMessagesRequestTypeID: "searchMessages#490addb5", SearchSecretMessagesRequestTypeID: "searchSecretMessages#cd2a4c9c", SearchSavedMessagesRequestTypeID: "searchSavedMessages#8a9b9f96", SearchCallMessagesRequestTypeID: "searchCallMessages#8c3bef1b", @@ -2136,7 +2162,7 @@ func TypesMap() map[uint32]string { GetChatJoinRequestsRequestTypeID: "getChatJoinRequests#e8d90ea2", ProcessChatJoinRequestRequestTypeID: "processChatJoinRequest#3be534a3", ProcessChatJoinRequestsRequestTypeID: "processChatJoinRequests#3e823dce", - CreateCallRequestTypeID: "createCall#be282e10", + CreateCallRequestTypeID: "createCall#b4410c99", AcceptCallRequestTypeID: "acceptCall#d97562d0", SendCallSignalingDataRequestTypeID: "sendCallSignalingData#542db19c", DiscardCallRequestTypeID: "discardCall#95a9a57e", @@ -2146,6 +2172,7 @@ func TypesMap() map[uint32]string { GetVideoChatAvailableParticipantsRequestTypeID: "getVideoChatAvailableParticipants#c45da305", SetVideoChatDefaultParticipantRequestTypeID: "setVideoChatDefaultParticipant#f1a672b3", CreateVideoChatRequestTypeID: "createVideoChat#7ea4958d", + CreateGroupCallRequestTypeID: "createGroupCall#87b855fb", GetVideoChatRtmpURLRequestTypeID: "getVideoChatRtmpUrl#482b1b1f", ReplaceVideoChatRtmpURLRequestTypeID: "replaceVideoChatRtmpUrl#214f8fe0", GetGroupCallRequestTypeID: "getGroupCall#5787668e", @@ -2297,6 +2324,8 @@ func TypesMap() map[uint32]string { GetBotInfoDescriptionRequestTypeID: "getBotInfoDescription#d287f835", SetBotInfoShortDescriptionRequestTypeID: "setBotInfoShortDescription#3a96bae3", GetBotInfoShortDescriptionRequestTypeID: "getBotInfoShortDescription#4a1c2614", + SetMessageSenderBotVerificationRequestTypeID: "setMessageSenderBotVerification#b4c1da4a", + RemoveMessageSenderBotVerificationRequestTypeID: "removeMessageSenderBotVerification#9a10cf5a", GetActiveSessionsRequestTypeID: "getActiveSessions#42bd6d3e", TerminateSessionRequestTypeID: "terminateSession#e7b7c92c", TerminateAllOtherSessionsRequestTypeID: "terminateAllOtherSessions#6fba6113", @@ -2337,10 +2366,14 @@ func TypesMap() map[uint32]string { DeleteSavedOrderInfoRequestTypeID: "deleteSavedOrderInfo#61197474", DeleteSavedCredentialsRequestTypeID: "deleteSavedCredentials#314056d2", GetAvailableGiftsRequestTypeID: "getAvailableGifts#f6d565eb", - SendGiftRequestTypeID: "sendGift#32c9796d", + SendGiftRequestTypeID: "sendGift#13a97db", SellGiftRequestTypeID: "sellGift#671b88b4", ToggleGiftIsSavedRequestTypeID: "toggleGiftIsSaved#91c2f183", + GetGiftUpgradePreviewRequestTypeID: "getGiftUpgradePreview#bdcbc25d", + UpgradeGiftRequestTypeID: "upgradeGift#e0c0953e", + TransferGiftRequestTypeID: "transferGift#7f379a4e", GetUserGiftsRequestTypeID: "getUserGifts#b7cdbc7c", + GetUserGiftRequestTypeID: "getUserGift#74e6a939", CreateInvoiceLinkRequestTypeID: "createInvoiceLink#cf70c867", RefundStarPaymentRequestTypeID: "refundStarPayment#9476a055", GetSupportUserRequestTypeID: "getSupportUser#98acec9c", @@ -2462,11 +2495,11 @@ func TypesMap() map[uint32]string { ReuseStarSubscriptionRequestTypeID: "reuseStarSubscription#2e677441", SetChatAffiliateProgramRequestTypeID: "setChatAffiliateProgram#e00237", SearchChatAffiliateProgramRequestTypeID: "searchChatAffiliateProgram#b02c09ba", - SearchAffiliateProgramsRequestTypeID: "searchAffiliatePrograms#617c974c", - ConnectChatAffiliateProgramRequestTypeID: "connectChatAffiliateProgram#75b163c4", - DisconnectChatAffiliateProgramRequestTypeID: "disconnectChatAffiliateProgram#48ef7257", - GetChatAffiliateProgramRequestTypeID: "getChatAffiliateProgram#6ec8a39a", - GetChatAffiliateProgramsRequestTypeID: "getChatAffiliatePrograms#f9df5251", + SearchAffiliateProgramsRequestTypeID: "searchAffiliatePrograms#2899a011", + ConnectAffiliateProgramRequestTypeID: "connectAffiliateProgram#6306d72c", + DisconnectAffiliateProgramRequestTypeID: "disconnectAffiliateProgram#f9b124fc", + GetConnectedAffiliateProgramRequestTypeID: "getConnectedAffiliateProgram#9761e770", + GetConnectedAffiliateProgramsRequestTypeID: "getConnectedAffiliatePrograms#8b2c5272", GetBusinessFeaturesRequestTypeID: "getBusinessFeatures#c4906001", AcceptTermsOfServiceRequestTypeID: "acceptTermsOfService#7efe03e4", SearchStringsByPrefixRequestTypeID: "searchStringsByPrefix#a8145813", @@ -2632,6 +2665,9 @@ func NamesMap() map[string]uint32 { "botCommand": BotCommandTypeID, "botCommands": BotCommandsTypeID, "botMenuButton": BotMenuButtonTypeID, + "botVerificationParameters": BotVerificationParametersTypeID, + "botVerification": BotVerificationTypeID, + "verificationStatus": VerificationStatusTypeID, "chatLocation": ChatLocationTypeID, "birthdate": BirthdateTypeID, "closeBirthdayUser": CloseBirthdayUserTypeID, @@ -2670,6 +2706,9 @@ func NamesMap() map[string]uint32 { "starSubscriptionPricing": StarSubscriptionPricingTypeID, "starSubscription": StarSubscriptionTypeID, "starSubscriptions": StarSubscriptionsTypeID, + "affiliateTypeCurrentUser": AffiliateTypeCurrentUserTypeID, + "affiliateTypeBot": AffiliateTypeBotTypeID, + "affiliateTypeChannel": AffiliateTypeChannelTypeID, "affiliateProgramSortOrderProfitability": AffiliateProgramSortOrderProfitabilityTypeID, "affiliateProgramSortOrderCreationDate": AffiliateProgramSortOrderCreationDateTypeID, "affiliateProgramSortOrderRevenue": AffiliateProgramSortOrderRevenueTypeID, @@ -2678,8 +2717,8 @@ func NamesMap() map[string]uint32 { "affiliateInfo": AffiliateInfoTypeID, "foundAffiliateProgram": FoundAffiliateProgramTypeID, "foundAffiliatePrograms": FoundAffiliateProgramsTypeID, - "chatAffiliateProgram": ChatAffiliateProgramTypeID, - "chatAffiliatePrograms": ChatAffiliateProgramsTypeID, + "connectedAffiliateProgram": ConnectedAffiliateProgramTypeID, + "connectedAffiliatePrograms": ConnectedAffiliateProgramsTypeID, "productInfo": ProductInfoTypeID, "premiumPaymentOption": PremiumPaymentOptionTypeID, "premiumStatePaymentOption": PremiumStatePaymentOptionTypeID, @@ -2691,10 +2730,19 @@ func NamesMap() map[string]uint32 { "starGiveawayWinnerOption": StarGiveawayWinnerOptionTypeID, "starGiveawayPaymentOption": StarGiveawayPaymentOptionTypeID, "starGiveawayPaymentOptions": StarGiveawayPaymentOptionsTypeID, + "upgradedGiftModel": UpgradedGiftModelTypeID, + "upgradedGiftSymbol": UpgradedGiftSymbolTypeID, + "upgradedGiftBackdrop": UpgradedGiftBackdropTypeID, + "upgradedGiftOriginalDetails": UpgradedGiftOriginalDetailsTypeID, "gift": GiftTypeID, "gifts": GiftsTypeID, + "upgradedGift": UpgradedGiftTypeID, + "upgradeGiftResult": UpgradeGiftResultTypeID, + "sentGiftRegular": SentGiftRegularTypeID, + "sentGiftUpgraded": SentGiftUpgradedTypeID, "userGift": UserGiftTypeID, "userGifts": UserGiftsTypeID, + "giftUpgradePreview": GiftUpgradePreviewTypeID, "starTransactionDirectionIncoming": StarTransactionDirectionIncomingTypeID, "starTransactionDirectionOutgoing": StarTransactionDirectionOutgoingTypeID, "starTransactionTypePremiumBotDeposit": StarTransactionTypePremiumBotDepositTypeID, @@ -2717,7 +2765,9 @@ func NamesMap() map[string]uint32 { "starTransactionTypeChannelSubscriptionPurchase": StarTransactionTypeChannelSubscriptionPurchaseTypeID, "starTransactionTypeChannelSubscriptionSale": StarTransactionTypeChannelSubscriptionSaleTypeID, "starTransactionTypeGiftPurchase": StarTransactionTypeGiftPurchaseTypeID, + "starTransactionTypeGiftTransfer": StarTransactionTypeGiftTransferTypeID, "starTransactionTypeGiftSale": StarTransactionTypeGiftSaleTypeID, + "starTransactionTypeGiftUpgrade": StarTransactionTypeGiftUpgradeTypeID, "starTransactionTypeChannelPaidReactionSend": StarTransactionTypeChannelPaidReactionSendTypeID, "starTransactionTypeChannelPaidReactionReceive": StarTransactionTypeChannelPaidReactionReceiveTypeID, "starTransactionTypeAffiliateProgramCommission": StarTransactionTypeAffiliateProgramCommissionTypeID, @@ -2879,6 +2929,7 @@ func NamesMap() map[string]uint32 { "chatTypeSupergroup": ChatTypeSupergroupTypeID, "chatTypeSecret": ChatTypeSecretTypeID, "chatFolderIcon": ChatFolderIconTypeID, + "chatFolderName": ChatFolderNameTypeID, "chatFolder": ChatFolderTypeID, "chatFolderInfo": ChatFolderInfoTypeID, "chatFolderInviteLink": ChatFolderInviteLinkTypeID, @@ -3227,6 +3278,8 @@ func NamesMap() map[string]uint32 { "messageGiftedStars": MessageGiftedStarsTypeID, "messageGiveawayPrizeStars": MessageGiveawayPrizeStarsTypeID, "messageGift": MessageGiftTypeID, + "messageUpgradedGift": MessageUpgradedGiftTypeID, + "messageRefundedUpgradedGift": MessageRefundedUpgradedGiftTypeID, "messageContactRegistered": MessageContactRegisteredTypeID, "messageUsersShared": MessageUsersSharedTypeID, "messageChatShared": MessageChatSharedTypeID, @@ -3307,6 +3360,9 @@ func NamesMap() map[string]uint32 { "searchMessagesFilterUnreadReaction": SearchMessagesFilterUnreadReactionTypeID, "searchMessagesFilterFailedToSend": SearchMessagesFilterFailedToSendTypeID, "searchMessagesFilterPinned": SearchMessagesFilterPinnedTypeID, + "searchMessagesChatTypeFilterPrivate": SearchMessagesChatTypeFilterPrivateTypeID, + "searchMessagesChatTypeFilterGroup": SearchMessagesChatTypeFilterGroupTypeID, + "searchMessagesChatTypeFilterChannel": SearchMessagesChatTypeFilterChannelTypeID, "chatActionTyping": ChatActionTypingTypeID, "chatActionRecordingVideo": ChatActionRecordingVideoTypeID, "chatActionUploadingVideo": ChatActionUploadingVideoTypeID, @@ -3412,6 +3468,7 @@ func NamesMap() map[string]uint32 { "callDiscardReasonDeclined": CallDiscardReasonDeclinedTypeID, "callDiscardReasonDisconnected": CallDiscardReasonDisconnectedTypeID, "callDiscardReasonHungUp": CallDiscardReasonHungUpTypeID, + "callDiscardReasonAllowGroupCall": CallDiscardReasonAllowGroupCallTypeID, "callProtocol": CallProtocolTypeID, "callServerTypeTelegramReflector": CallServerTypeTelegramReflectorTypeID, "callServerTypeWebrtc": CallServerTypeWebrtcTypeID, @@ -3727,6 +3784,7 @@ func NamesMap() map[string]uint32 { "pushMessageContentPremiumGiftCode": PushMessageContentPremiumGiftCodeTypeID, "pushMessageContentGiveaway": PushMessageContentGiveawayTypeID, "pushMessageContentGift": PushMessageContentGiftTypeID, + "pushMessageContentUpgradedGift": PushMessageContentUpgradedGiftTypeID, "pushMessageContentScreenshotTaken": PushMessageContentScreenshotTakenTypeID, "pushMessageContentSticker": PushMessageContentStickerTypeID, "pushMessageContentStory": PushMessageContentStoryTypeID, @@ -3974,6 +4032,7 @@ func NamesMap() map[string]uint32 { "suggestedActionSubscribeToAnnualPremium": SuggestedActionSubscribeToAnnualPremiumTypeID, "suggestedActionGiftPremiumForChristmas": SuggestedActionGiftPremiumForChristmasTypeID, "suggestedActionSetBirthdate": SuggestedActionSetBirthdateTypeID, + "suggestedActionSetProfilePhoto": SuggestedActionSetProfilePhotoTypeID, "suggestedActionExtendPremium": SuggestedActionExtendPremiumTypeID, "suggestedActionExtendStarSubscriptions": SuggestedActionExtendStarSubscriptionsTypeID, "count": CountTypeID, @@ -4632,6 +4691,7 @@ func NamesMap() map[string]uint32 { "getVideoChatAvailableParticipants": GetVideoChatAvailableParticipantsRequestTypeID, "setVideoChatDefaultParticipant": SetVideoChatDefaultParticipantRequestTypeID, "createVideoChat": CreateVideoChatRequestTypeID, + "createGroupCall": CreateGroupCallRequestTypeID, "getVideoChatRtmpUrl": GetVideoChatRtmpURLRequestTypeID, "replaceVideoChatRtmpUrl": ReplaceVideoChatRtmpURLRequestTypeID, "getGroupCall": GetGroupCallRequestTypeID, @@ -4783,6 +4843,8 @@ func NamesMap() map[string]uint32 { "getBotInfoDescription": GetBotInfoDescriptionRequestTypeID, "setBotInfoShortDescription": SetBotInfoShortDescriptionRequestTypeID, "getBotInfoShortDescription": GetBotInfoShortDescriptionRequestTypeID, + "setMessageSenderBotVerification": SetMessageSenderBotVerificationRequestTypeID, + "removeMessageSenderBotVerification": RemoveMessageSenderBotVerificationRequestTypeID, "getActiveSessions": GetActiveSessionsRequestTypeID, "terminateSession": TerminateSessionRequestTypeID, "terminateAllOtherSessions": TerminateAllOtherSessionsRequestTypeID, @@ -4826,7 +4888,11 @@ func NamesMap() map[string]uint32 { "sendGift": SendGiftRequestTypeID, "sellGift": SellGiftRequestTypeID, "toggleGiftIsSaved": ToggleGiftIsSavedRequestTypeID, + "getGiftUpgradePreview": GetGiftUpgradePreviewRequestTypeID, + "upgradeGift": UpgradeGiftRequestTypeID, + "transferGift": TransferGiftRequestTypeID, "getUserGifts": GetUserGiftsRequestTypeID, + "getUserGift": GetUserGiftRequestTypeID, "createInvoiceLink": CreateInvoiceLinkRequestTypeID, "refundStarPayment": RefundStarPaymentRequestTypeID, "getSupportUser": GetSupportUserRequestTypeID, @@ -4949,10 +5015,10 @@ func NamesMap() map[string]uint32 { "setChatAffiliateProgram": SetChatAffiliateProgramRequestTypeID, "searchChatAffiliateProgram": SearchChatAffiliateProgramRequestTypeID, "searchAffiliatePrograms": SearchAffiliateProgramsRequestTypeID, - "connectChatAffiliateProgram": ConnectChatAffiliateProgramRequestTypeID, - "disconnectChatAffiliateProgram": DisconnectChatAffiliateProgramRequestTypeID, - "getChatAffiliateProgram": GetChatAffiliateProgramRequestTypeID, - "getChatAffiliatePrograms": GetChatAffiliateProgramsRequestTypeID, + "connectAffiliateProgram": ConnectAffiliateProgramRequestTypeID, + "disconnectAffiliateProgram": DisconnectAffiliateProgramRequestTypeID, + "getConnectedAffiliateProgram": GetConnectedAffiliateProgramRequestTypeID, + "getConnectedAffiliatePrograms": GetConnectedAffiliateProgramsRequestTypeID, "getBusinessFeatures": GetBusinessFeaturesRequestTypeID, "acceptTermsOfService": AcceptTermsOfServiceRequestTypeID, "searchStringsByPrefix": SearchStringsByPrefixRequestTypeID, @@ -5118,6 +5184,9 @@ func TypesConstructorMap() map[uint32]func() bin.Object { BotCommandTypeID: func() bin.Object { return &BotCommand{} }, BotCommandsTypeID: func() bin.Object { return &BotCommands{} }, BotMenuButtonTypeID: func() bin.Object { return &BotMenuButton{} }, + BotVerificationParametersTypeID: func() bin.Object { return &BotVerificationParameters{} }, + BotVerificationTypeID: func() bin.Object { return &BotVerification{} }, + VerificationStatusTypeID: func() bin.Object { return &VerificationStatus{} }, ChatLocationTypeID: func() bin.Object { return &ChatLocation{} }, BirthdateTypeID: func() bin.Object { return &Birthdate{} }, CloseBirthdayUserTypeID: func() bin.Object { return &CloseBirthdayUser{} }, @@ -5156,6 +5225,9 @@ func TypesConstructorMap() map[uint32]func() bin.Object { StarSubscriptionPricingTypeID: func() bin.Object { return &StarSubscriptionPricing{} }, StarSubscriptionTypeID: func() bin.Object { return &StarSubscription{} }, StarSubscriptionsTypeID: func() bin.Object { return &StarSubscriptions{} }, + AffiliateTypeCurrentUserTypeID: func() bin.Object { return &AffiliateTypeCurrentUser{} }, + AffiliateTypeBotTypeID: func() bin.Object { return &AffiliateTypeBot{} }, + AffiliateTypeChannelTypeID: func() bin.Object { return &AffiliateTypeChannel{} }, AffiliateProgramSortOrderProfitabilityTypeID: func() bin.Object { return &AffiliateProgramSortOrderProfitability{} }, AffiliateProgramSortOrderCreationDateTypeID: func() bin.Object { return &AffiliateProgramSortOrderCreationDate{} }, AffiliateProgramSortOrderRevenueTypeID: func() bin.Object { return &AffiliateProgramSortOrderRevenue{} }, @@ -5164,8 +5236,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { AffiliateInfoTypeID: func() bin.Object { return &AffiliateInfo{} }, FoundAffiliateProgramTypeID: func() bin.Object { return &FoundAffiliateProgram{} }, FoundAffiliateProgramsTypeID: func() bin.Object { return &FoundAffiliatePrograms{} }, - ChatAffiliateProgramTypeID: func() bin.Object { return &ChatAffiliateProgram{} }, - ChatAffiliateProgramsTypeID: func() bin.Object { return &ChatAffiliatePrograms{} }, + ConnectedAffiliateProgramTypeID: func() bin.Object { return &ConnectedAffiliateProgram{} }, + ConnectedAffiliateProgramsTypeID: func() bin.Object { return &ConnectedAffiliatePrograms{} }, ProductInfoTypeID: func() bin.Object { return &ProductInfo{} }, PremiumPaymentOptionTypeID: func() bin.Object { return &PremiumPaymentOption{} }, PremiumStatePaymentOptionTypeID: func() bin.Object { return &PremiumStatePaymentOption{} }, @@ -5177,10 +5249,19 @@ func TypesConstructorMap() map[uint32]func() bin.Object { StarGiveawayWinnerOptionTypeID: func() bin.Object { return &StarGiveawayWinnerOption{} }, StarGiveawayPaymentOptionTypeID: func() bin.Object { return &StarGiveawayPaymentOption{} }, StarGiveawayPaymentOptionsTypeID: func() bin.Object { return &StarGiveawayPaymentOptions{} }, + UpgradedGiftModelTypeID: func() bin.Object { return &UpgradedGiftModel{} }, + UpgradedGiftSymbolTypeID: func() bin.Object { return &UpgradedGiftSymbol{} }, + UpgradedGiftBackdropTypeID: func() bin.Object { return &UpgradedGiftBackdrop{} }, + UpgradedGiftOriginalDetailsTypeID: func() bin.Object { return &UpgradedGiftOriginalDetails{} }, GiftTypeID: func() bin.Object { return &Gift{} }, GiftsTypeID: func() bin.Object { return &Gifts{} }, + UpgradedGiftTypeID: func() bin.Object { return &UpgradedGift{} }, + UpgradeGiftResultTypeID: func() bin.Object { return &UpgradeGiftResult{} }, + SentGiftRegularTypeID: func() bin.Object { return &SentGiftRegular{} }, + SentGiftUpgradedTypeID: func() bin.Object { return &SentGiftUpgraded{} }, UserGiftTypeID: func() bin.Object { return &UserGift{} }, UserGiftsTypeID: func() bin.Object { return &UserGifts{} }, + GiftUpgradePreviewTypeID: func() bin.Object { return &GiftUpgradePreview{} }, StarTransactionDirectionIncomingTypeID: func() bin.Object { return &StarTransactionDirectionIncoming{} }, StarTransactionDirectionOutgoingTypeID: func() bin.Object { return &StarTransactionDirectionOutgoing{} }, StarTransactionTypePremiumBotDepositTypeID: func() bin.Object { return &StarTransactionTypePremiumBotDeposit{} }, @@ -5203,7 +5284,9 @@ func TypesConstructorMap() map[uint32]func() bin.Object { StarTransactionTypeChannelSubscriptionPurchaseTypeID: func() bin.Object { return &StarTransactionTypeChannelSubscriptionPurchase{} }, StarTransactionTypeChannelSubscriptionSaleTypeID: func() bin.Object { return &StarTransactionTypeChannelSubscriptionSale{} }, StarTransactionTypeGiftPurchaseTypeID: func() bin.Object { return &StarTransactionTypeGiftPurchase{} }, + StarTransactionTypeGiftTransferTypeID: func() bin.Object { return &StarTransactionTypeGiftTransfer{} }, StarTransactionTypeGiftSaleTypeID: func() bin.Object { return &StarTransactionTypeGiftSale{} }, + StarTransactionTypeGiftUpgradeTypeID: func() bin.Object { return &StarTransactionTypeGiftUpgrade{} }, StarTransactionTypeChannelPaidReactionSendTypeID: func() bin.Object { return &StarTransactionTypeChannelPaidReactionSend{} }, StarTransactionTypeChannelPaidReactionReceiveTypeID: func() bin.Object { return &StarTransactionTypeChannelPaidReactionReceive{} }, StarTransactionTypeAffiliateProgramCommissionTypeID: func() bin.Object { return &StarTransactionTypeAffiliateProgramCommission{} }, @@ -5365,6 +5448,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ChatTypeSupergroupTypeID: func() bin.Object { return &ChatTypeSupergroup{} }, ChatTypeSecretTypeID: func() bin.Object { return &ChatTypeSecret{} }, ChatFolderIconTypeID: func() bin.Object { return &ChatFolderIcon{} }, + ChatFolderNameTypeID: func() bin.Object { return &ChatFolderName{} }, ChatFolderTypeID: func() bin.Object { return &ChatFolder{} }, ChatFolderInfoTypeID: func() bin.Object { return &ChatFolderInfo{} }, ChatFolderInviteLinkTypeID: func() bin.Object { return &ChatFolderInviteLink{} }, @@ -5713,6 +5797,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessageGiftedStarsTypeID: func() bin.Object { return &MessageGiftedStars{} }, MessageGiveawayPrizeStarsTypeID: func() bin.Object { return &MessageGiveawayPrizeStars{} }, MessageGiftTypeID: func() bin.Object { return &MessageGift{} }, + MessageUpgradedGiftTypeID: func() bin.Object { return &MessageUpgradedGift{} }, + MessageRefundedUpgradedGiftTypeID: func() bin.Object { return &MessageRefundedUpgradedGift{} }, MessageContactRegisteredTypeID: func() bin.Object { return &MessageContactRegistered{} }, MessageUsersSharedTypeID: func() bin.Object { return &MessageUsersShared{} }, MessageChatSharedTypeID: func() bin.Object { return &MessageChatShared{} }, @@ -5793,6 +5879,9 @@ func TypesConstructorMap() map[uint32]func() bin.Object { SearchMessagesFilterUnreadReactionTypeID: func() bin.Object { return &SearchMessagesFilterUnreadReaction{} }, SearchMessagesFilterFailedToSendTypeID: func() bin.Object { return &SearchMessagesFilterFailedToSend{} }, SearchMessagesFilterPinnedTypeID: func() bin.Object { return &SearchMessagesFilterPinned{} }, + SearchMessagesChatTypeFilterPrivateTypeID: func() bin.Object { return &SearchMessagesChatTypeFilterPrivate{} }, + SearchMessagesChatTypeFilterGroupTypeID: func() bin.Object { return &SearchMessagesChatTypeFilterGroup{} }, + SearchMessagesChatTypeFilterChannelTypeID: func() bin.Object { return &SearchMessagesChatTypeFilterChannel{} }, ChatActionTypingTypeID: func() bin.Object { return &ChatActionTyping{} }, ChatActionRecordingVideoTypeID: func() bin.Object { return &ChatActionRecordingVideo{} }, ChatActionUploadingVideoTypeID: func() bin.Object { return &ChatActionUploadingVideo{} }, @@ -5898,6 +5987,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { CallDiscardReasonDeclinedTypeID: func() bin.Object { return &CallDiscardReasonDeclined{} }, CallDiscardReasonDisconnectedTypeID: func() bin.Object { return &CallDiscardReasonDisconnected{} }, CallDiscardReasonHungUpTypeID: func() bin.Object { return &CallDiscardReasonHungUp{} }, + CallDiscardReasonAllowGroupCallTypeID: func() bin.Object { return &CallDiscardReasonAllowGroupCall{} }, CallProtocolTypeID: func() bin.Object { return &CallProtocol{} }, CallServerTypeTelegramReflectorTypeID: func() bin.Object { return &CallServerTypeTelegramReflector{} }, CallServerTypeWebrtcTypeID: func() bin.Object { return &CallServerTypeWebrtc{} }, @@ -6213,6 +6303,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PushMessageContentPremiumGiftCodeTypeID: func() bin.Object { return &PushMessageContentPremiumGiftCode{} }, PushMessageContentGiveawayTypeID: func() bin.Object { return &PushMessageContentGiveaway{} }, PushMessageContentGiftTypeID: func() bin.Object { return &PushMessageContentGift{} }, + PushMessageContentUpgradedGiftTypeID: func() bin.Object { return &PushMessageContentUpgradedGift{} }, PushMessageContentScreenshotTakenTypeID: func() bin.Object { return &PushMessageContentScreenshotTaken{} }, PushMessageContentStickerTypeID: func() bin.Object { return &PushMessageContentSticker{} }, PushMessageContentStoryTypeID: func() bin.Object { return &PushMessageContentStory{} }, @@ -6460,6 +6551,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { SuggestedActionSubscribeToAnnualPremiumTypeID: func() bin.Object { return &SuggestedActionSubscribeToAnnualPremium{} }, SuggestedActionGiftPremiumForChristmasTypeID: func() bin.Object { return &SuggestedActionGiftPremiumForChristmas{} }, SuggestedActionSetBirthdateTypeID: func() bin.Object { return &SuggestedActionSetBirthdate{} }, + SuggestedActionSetProfilePhotoTypeID: func() bin.Object { return &SuggestedActionSetProfilePhoto{} }, SuggestedActionExtendPremiumTypeID: func() bin.Object { return &SuggestedActionExtendPremium{} }, SuggestedActionExtendStarSubscriptionsTypeID: func() bin.Object { return &SuggestedActionExtendStarSubscriptions{} }, CountTypeID: func() bin.Object { return &Count{} }, @@ -7118,6 +7210,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { GetVideoChatAvailableParticipantsRequestTypeID: func() bin.Object { return &GetVideoChatAvailableParticipantsRequest{} }, SetVideoChatDefaultParticipantRequestTypeID: func() bin.Object { return &SetVideoChatDefaultParticipantRequest{} }, CreateVideoChatRequestTypeID: func() bin.Object { return &CreateVideoChatRequest{} }, + CreateGroupCallRequestTypeID: func() bin.Object { return &CreateGroupCallRequest{} }, GetVideoChatRtmpURLRequestTypeID: func() bin.Object { return &GetVideoChatRtmpURLRequest{} }, ReplaceVideoChatRtmpURLRequestTypeID: func() bin.Object { return &ReplaceVideoChatRtmpURLRequest{} }, GetGroupCallRequestTypeID: func() bin.Object { return &GetGroupCallRequest{} }, @@ -7269,6 +7362,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { GetBotInfoDescriptionRequestTypeID: func() bin.Object { return &GetBotInfoDescriptionRequest{} }, SetBotInfoShortDescriptionRequestTypeID: func() bin.Object { return &SetBotInfoShortDescriptionRequest{} }, GetBotInfoShortDescriptionRequestTypeID: func() bin.Object { return &GetBotInfoShortDescriptionRequest{} }, + SetMessageSenderBotVerificationRequestTypeID: func() bin.Object { return &SetMessageSenderBotVerificationRequest{} }, + RemoveMessageSenderBotVerificationRequestTypeID: func() bin.Object { return &RemoveMessageSenderBotVerificationRequest{} }, GetActiveSessionsRequestTypeID: func() bin.Object { return &GetActiveSessionsRequest{} }, TerminateSessionRequestTypeID: func() bin.Object { return &TerminateSessionRequest{} }, TerminateAllOtherSessionsRequestTypeID: func() bin.Object { return &TerminateAllOtherSessionsRequest{} }, @@ -7312,7 +7407,11 @@ func TypesConstructorMap() map[uint32]func() bin.Object { SendGiftRequestTypeID: func() bin.Object { return &SendGiftRequest{} }, SellGiftRequestTypeID: func() bin.Object { return &SellGiftRequest{} }, ToggleGiftIsSavedRequestTypeID: func() bin.Object { return &ToggleGiftIsSavedRequest{} }, + GetGiftUpgradePreviewRequestTypeID: func() bin.Object { return &GetGiftUpgradePreviewRequest{} }, + UpgradeGiftRequestTypeID: func() bin.Object { return &UpgradeGiftRequest{} }, + TransferGiftRequestTypeID: func() bin.Object { return &TransferGiftRequest{} }, GetUserGiftsRequestTypeID: func() bin.Object { return &GetUserGiftsRequest{} }, + GetUserGiftRequestTypeID: func() bin.Object { return &GetUserGiftRequest{} }, CreateInvoiceLinkRequestTypeID: func() bin.Object { return &CreateInvoiceLinkRequest{} }, RefundStarPaymentRequestTypeID: func() bin.Object { return &RefundStarPaymentRequest{} }, GetSupportUserRequestTypeID: func() bin.Object { return &GetSupportUserRequest{} }, @@ -7435,10 +7534,10 @@ func TypesConstructorMap() map[uint32]func() bin.Object { SetChatAffiliateProgramRequestTypeID: func() bin.Object { return &SetChatAffiliateProgramRequest{} }, SearchChatAffiliateProgramRequestTypeID: func() bin.Object { return &SearchChatAffiliateProgramRequest{} }, SearchAffiliateProgramsRequestTypeID: func() bin.Object { return &SearchAffiliateProgramsRequest{} }, - ConnectChatAffiliateProgramRequestTypeID: func() bin.Object { return &ConnectChatAffiliateProgramRequest{} }, - DisconnectChatAffiliateProgramRequestTypeID: func() bin.Object { return &DisconnectChatAffiliateProgramRequest{} }, - GetChatAffiliateProgramRequestTypeID: func() bin.Object { return &GetChatAffiliateProgramRequest{} }, - GetChatAffiliateProgramsRequestTypeID: func() bin.Object { return &GetChatAffiliateProgramsRequest{} }, + ConnectAffiliateProgramRequestTypeID: func() bin.Object { return &ConnectAffiliateProgramRequest{} }, + DisconnectAffiliateProgramRequestTypeID: func() bin.Object { return &DisconnectAffiliateProgramRequest{} }, + GetConnectedAffiliateProgramRequestTypeID: func() bin.Object { return &GetConnectedAffiliateProgramRequest{} }, + GetConnectedAffiliateProgramsRequestTypeID: func() bin.Object { return &GetConnectedAffiliateProgramsRequest{} }, GetBusinessFeaturesRequestTypeID: func() bin.Object { return &GetBusinessFeaturesRequest{} }, AcceptTermsOfServiceRequestTypeID: func() bin.Object { return &AcceptTermsOfServiceRequest{} }, SearchStringsByPrefixRequestTypeID: func() bin.Object { return &SearchStringsByPrefixRequest{} }, @@ -7497,6 +7596,11 @@ func ClassConstructorsMap() map[string][]uint32 { AffiliateProgramSortOrderCreationDateTypeID, AffiliateProgramSortOrderRevenueTypeID, }, + AffiliateTypeClassName: { + AffiliateTypeCurrentUserTypeID, + AffiliateTypeBotTypeID, + AffiliateTypeChannelTypeID, + }, AuthenticationCodeTypeClassName: { AuthenticationCodeTypeTelegramMessageTypeID, AuthenticationCodeTypeSMSTypeID, @@ -7587,6 +7691,7 @@ func ClassConstructorsMap() map[string][]uint32 { CallDiscardReasonDeclinedTypeID, CallDiscardReasonDisconnectedTypeID, CallDiscardReasonHungUpTypeID, + CallDiscardReasonAllowGroupCallTypeID, }, CallProblemClassName: { CallProblemEchoTypeID, @@ -8218,6 +8323,8 @@ func ClassConstructorsMap() map[string][]uint32 { MessageGiftedStarsTypeID, MessageGiveawayPrizeStarsTypeID, MessageGiftTypeID, + MessageUpgradedGiftTypeID, + MessageRefundedUpgradedGiftTypeID, MessageContactRegisteredTypeID, MessageUsersSharedTypeID, MessageChatSharedTypeID, @@ -8523,6 +8630,7 @@ func ClassConstructorsMap() map[string][]uint32 { PushMessageContentPremiumGiftCodeTypeID, PushMessageContentGiveawayTypeID, PushMessageContentGiftTypeID, + PushMessageContentUpgradedGiftTypeID, PushMessageContentScreenshotTakenTypeID, PushMessageContentStickerTypeID, PushMessageContentStoryTypeID, @@ -8632,6 +8740,11 @@ func ClassConstructorsMap() map[string][]uint32 { SavedMessagesTopicTypeAuthorHiddenTypeID, SavedMessagesTopicTypeSavedFromChatTypeID, }, + SearchMessagesChatTypeFilterClassName: { + SearchMessagesChatTypeFilterPrivateTypeID, + SearchMessagesChatTypeFilterGroupTypeID, + SearchMessagesChatTypeFilterChannelTypeID, + }, SearchMessagesFilterClassName: { SearchMessagesFilterEmptyTypeID, SearchMessagesFilterAnimationTypeID, @@ -8656,6 +8769,10 @@ func ClassConstructorsMap() map[string][]uint32 { SecretChatStateReadyTypeID, SecretChatStateClosedTypeID, }, + SentGiftClassName: { + SentGiftRegularTypeID, + SentGiftUpgradedTypeID, + }, SessionTypeClassName: { SessionTypeAndroidTypeID, SessionTypeAppleTypeID, @@ -8709,7 +8826,9 @@ func ClassConstructorsMap() map[string][]uint32 { StarTransactionTypeChannelSubscriptionPurchaseTypeID, StarTransactionTypeChannelSubscriptionSaleTypeID, StarTransactionTypeGiftPurchaseTypeID, + StarTransactionTypeGiftTransferTypeID, StarTransactionTypeGiftSaleTypeID, + StarTransactionTypeGiftUpgradeTypeID, StarTransactionTypeChannelPaidReactionSendTypeID, StarTransactionTypeChannelPaidReactionReceiveTypeID, StarTransactionTypeAffiliateProgramCommissionTypeID, @@ -8787,6 +8906,7 @@ func ClassConstructorsMap() map[string][]uint32 { SuggestedActionSubscribeToAnnualPremiumTypeID, SuggestedActionGiftPremiumForChristmasTypeID, SuggestedActionSetBirthdateTypeID, + SuggestedActionSetProfilePhotoTypeID, SuggestedActionExtendPremiumTypeID, SuggestedActionExtendStarSubscriptionsTypeID, }, diff --git a/tdapi/tl_remove_message_sender_bot_verification_gen.go b/tdapi/tl_remove_message_sender_bot_verification_gen.go new file mode 100644 index 0000000000..23eb2c389f --- /dev/null +++ b/tdapi/tl_remove_message_sender_bot_verification_gen.go @@ -0,0 +1,248 @@ +// 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{} +) + +// RemoveMessageSenderBotVerificationRequest represents TL type `removeMessageSenderBotVerification#9a10cf5a`. +type RemoveMessageSenderBotVerificationRequest struct { + // Identifier of the owned bot, which verified the user or the chat + BotUserID int64 + // Identifier of the user or the supergroup or channel chat, which verification is + // removed + VerifiedID MessageSenderClass +} + +// RemoveMessageSenderBotVerificationRequestTypeID is TL type id of RemoveMessageSenderBotVerificationRequest. +const RemoveMessageSenderBotVerificationRequestTypeID = 0x9a10cf5a + +// Ensuring interfaces in compile-time for RemoveMessageSenderBotVerificationRequest. +var ( + _ bin.Encoder = &RemoveMessageSenderBotVerificationRequest{} + _ bin.Decoder = &RemoveMessageSenderBotVerificationRequest{} + _ bin.BareEncoder = &RemoveMessageSenderBotVerificationRequest{} + _ bin.BareDecoder = &RemoveMessageSenderBotVerificationRequest{} +) + +func (r *RemoveMessageSenderBotVerificationRequest) Zero() bool { + if r == nil { + return true + } + if !(r.BotUserID == 0) { + return false + } + if !(r.VerifiedID == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (r *RemoveMessageSenderBotVerificationRequest) String() string { + if r == nil { + return "RemoveMessageSenderBotVerificationRequest(nil)" + } + type Alias RemoveMessageSenderBotVerificationRequest + return fmt.Sprintf("RemoveMessageSenderBotVerificationRequest%+v", Alias(*r)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*RemoveMessageSenderBotVerificationRequest) TypeID() uint32 { + return RemoveMessageSenderBotVerificationRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*RemoveMessageSenderBotVerificationRequest) TypeName() string { + return "removeMessageSenderBotVerification" +} + +// TypeInfo returns info about TL type. +func (r *RemoveMessageSenderBotVerificationRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "removeMessageSenderBotVerification", + ID: RemoveMessageSenderBotVerificationRequestTypeID, + } + if r == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "BotUserID", + SchemaName: "bot_user_id", + }, + { + Name: "VerifiedID", + SchemaName: "verified_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (r *RemoveMessageSenderBotVerificationRequest) Encode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode removeMessageSenderBotVerification#9a10cf5a as nil") + } + b.PutID(RemoveMessageSenderBotVerificationRequestTypeID) + return r.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (r *RemoveMessageSenderBotVerificationRequest) EncodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode removeMessageSenderBotVerification#9a10cf5a as nil") + } + b.PutInt53(r.BotUserID) + if r.VerifiedID == nil { + return fmt.Errorf("unable to encode removeMessageSenderBotVerification#9a10cf5a: field verified_id is nil") + } + if err := r.VerifiedID.Encode(b); err != nil { + return fmt.Errorf("unable to encode removeMessageSenderBotVerification#9a10cf5a: field verified_id: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (r *RemoveMessageSenderBotVerificationRequest) Decode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode removeMessageSenderBotVerification#9a10cf5a to nil") + } + if err := b.ConsumeID(RemoveMessageSenderBotVerificationRequestTypeID); err != nil { + return fmt.Errorf("unable to decode removeMessageSenderBotVerification#9a10cf5a: %w", err) + } + return r.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (r *RemoveMessageSenderBotVerificationRequest) DecodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode removeMessageSenderBotVerification#9a10cf5a to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode removeMessageSenderBotVerification#9a10cf5a: field bot_user_id: %w", err) + } + r.BotUserID = value + } + { + value, err := DecodeMessageSender(b) + if err != nil { + return fmt.Errorf("unable to decode removeMessageSenderBotVerification#9a10cf5a: field verified_id: %w", err) + } + r.VerifiedID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (r *RemoveMessageSenderBotVerificationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if r == nil { + return fmt.Errorf("can't encode removeMessageSenderBotVerification#9a10cf5a as nil") + } + b.ObjStart() + b.PutID("removeMessageSenderBotVerification") + b.Comma() + b.FieldStart("bot_user_id") + b.PutInt53(r.BotUserID) + b.Comma() + b.FieldStart("verified_id") + if r.VerifiedID == nil { + return fmt.Errorf("unable to encode removeMessageSenderBotVerification#9a10cf5a: field verified_id is nil") + } + if err := r.VerifiedID.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode removeMessageSenderBotVerification#9a10cf5a: field verified_id: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (r *RemoveMessageSenderBotVerificationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if r == nil { + return fmt.Errorf("can't decode removeMessageSenderBotVerification#9a10cf5a to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("removeMessageSenderBotVerification"); err != nil { + return fmt.Errorf("unable to decode removeMessageSenderBotVerification#9a10cf5a: %w", err) + } + case "bot_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode removeMessageSenderBotVerification#9a10cf5a: field bot_user_id: %w", err) + } + r.BotUserID = value + case "verified_id": + value, err := DecodeTDLibJSONMessageSender(b) + if err != nil { + return fmt.Errorf("unable to decode removeMessageSenderBotVerification#9a10cf5a: field verified_id: %w", err) + } + r.VerifiedID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetBotUserID returns value of BotUserID field. +func (r *RemoveMessageSenderBotVerificationRequest) GetBotUserID() (value int64) { + if r == nil { + return + } + return r.BotUserID +} + +// GetVerifiedID returns value of VerifiedID field. +func (r *RemoveMessageSenderBotVerificationRequest) GetVerifiedID() (value MessageSenderClass) { + if r == nil { + return + } + return r.VerifiedID +} + +// RemoveMessageSenderBotVerification invokes method removeMessageSenderBotVerification#9a10cf5a returning error if any. +func (c *Client) RemoveMessageSenderBotVerification(ctx context.Context, request *RemoveMessageSenderBotVerificationRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_search_affiliate_programs_gen.go b/tdapi/tl_search_affiliate_programs_gen.go index e19412df2e..4bb4166841 100644 --- a/tdapi/tl_search_affiliate_programs_gen.go +++ b/tdapi/tl_search_affiliate_programs_gen.go @@ -31,12 +31,10 @@ var ( _ = tdjson.Encoder{} ) -// SearchAffiliateProgramsRequest represents TL type `searchAffiliatePrograms#617c974c`. +// SearchAffiliateProgramsRequest represents TL type `searchAffiliatePrograms#2899a011`. type SearchAffiliateProgramsRequest struct { - // Identifier of the chat for which affiliate programs are searched for. Can be an - // identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel - // chat with can_post_messages administrator right - ChatID int64 + // The affiliate for which affiliate programs are searched for + Affiliate AffiliateTypeClass // Sort order for the results SortOrder AffiliateProgramSortOrderClass // Offset of the first affiliate program to return as received from the previous request; @@ -47,7 +45,7 @@ type SearchAffiliateProgramsRequest struct { } // SearchAffiliateProgramsRequestTypeID is TL type id of SearchAffiliateProgramsRequest. -const SearchAffiliateProgramsRequestTypeID = 0x617c974c +const SearchAffiliateProgramsRequestTypeID = 0x2899a011 // Ensuring interfaces in compile-time for SearchAffiliateProgramsRequest. var ( @@ -61,7 +59,7 @@ func (s *SearchAffiliateProgramsRequest) Zero() bool { if s == nil { return true } - if !(s.ChatID == 0) { + if !(s.Affiliate == nil) { return false } if !(s.SortOrder == nil) { @@ -110,8 +108,8 @@ func (s *SearchAffiliateProgramsRequest) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "ChatID", - SchemaName: "chat_id", + Name: "Affiliate", + SchemaName: "affiliate", }, { Name: "SortOrder", @@ -132,7 +130,7 @@ func (s *SearchAffiliateProgramsRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *SearchAffiliateProgramsRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode searchAffiliatePrograms#617c974c as nil") + return fmt.Errorf("can't encode searchAffiliatePrograms#2899a011 as nil") } b.PutID(SearchAffiliateProgramsRequestTypeID) return s.EncodeBare(b) @@ -141,14 +139,19 @@ func (s *SearchAffiliateProgramsRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *SearchAffiliateProgramsRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode searchAffiliatePrograms#617c974c as nil") + return fmt.Errorf("can't encode searchAffiliatePrograms#2899a011 as nil") + } + if s.Affiliate == nil { + return fmt.Errorf("unable to encode searchAffiliatePrograms#2899a011: field affiliate is nil") + } + if err := s.Affiliate.Encode(b); err != nil { + return fmt.Errorf("unable to encode searchAffiliatePrograms#2899a011: field affiliate: %w", err) } - b.PutInt53(s.ChatID) if s.SortOrder == nil { - return fmt.Errorf("unable to encode searchAffiliatePrograms#617c974c: field sort_order is nil") + return fmt.Errorf("unable to encode searchAffiliatePrograms#2899a011: field sort_order is nil") } if err := s.SortOrder.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchAffiliatePrograms#617c974c: field sort_order: %w", err) + return fmt.Errorf("unable to encode searchAffiliatePrograms#2899a011: field sort_order: %w", err) } b.PutString(s.Offset) b.PutInt32(s.Limit) @@ -158,10 +161,10 @@ func (s *SearchAffiliateProgramsRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *SearchAffiliateProgramsRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode searchAffiliatePrograms#617c974c to nil") + return fmt.Errorf("can't decode searchAffiliatePrograms#2899a011 to nil") } if err := b.ConsumeID(SearchAffiliateProgramsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchAffiliatePrograms#617c974c: %w", err) + return fmt.Errorf("unable to decode searchAffiliatePrograms#2899a011: %w", err) } return s.DecodeBare(b) } @@ -169,33 +172,33 @@ func (s *SearchAffiliateProgramsRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *SearchAffiliateProgramsRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode searchAffiliatePrograms#617c974c to nil") + return fmt.Errorf("can't decode searchAffiliatePrograms#2899a011 to nil") } { - value, err := b.Int53() + value, err := DecodeAffiliateType(b) if err != nil { - return fmt.Errorf("unable to decode searchAffiliatePrograms#617c974c: field chat_id: %w", err) + return fmt.Errorf("unable to decode searchAffiliatePrograms#2899a011: field affiliate: %w", err) } - s.ChatID = value + s.Affiliate = value } { value, err := DecodeAffiliateProgramSortOrder(b) if err != nil { - return fmt.Errorf("unable to decode searchAffiliatePrograms#617c974c: field sort_order: %w", err) + return fmt.Errorf("unable to decode searchAffiliatePrograms#2899a011: field sort_order: %w", err) } s.SortOrder = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode searchAffiliatePrograms#617c974c: field offset: %w", err) + return fmt.Errorf("unable to decode searchAffiliatePrograms#2899a011: field offset: %w", err) } s.Offset = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchAffiliatePrograms#617c974c: field limit: %w", err) + return fmt.Errorf("unable to decode searchAffiliatePrograms#2899a011: field limit: %w", err) } s.Limit = value } @@ -205,20 +208,25 @@ func (s *SearchAffiliateProgramsRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *SearchAffiliateProgramsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode searchAffiliatePrograms#617c974c as nil") + return fmt.Errorf("can't encode searchAffiliatePrograms#2899a011 as nil") } b.ObjStart() b.PutID("searchAffiliatePrograms") b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) + b.FieldStart("affiliate") + if s.Affiliate == nil { + return fmt.Errorf("unable to encode searchAffiliatePrograms#2899a011: field affiliate is nil") + } + if err := s.Affiliate.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode searchAffiliatePrograms#2899a011: field affiliate: %w", err) + } b.Comma() b.FieldStart("sort_order") if s.SortOrder == nil { - return fmt.Errorf("unable to encode searchAffiliatePrograms#617c974c: field sort_order is nil") + return fmt.Errorf("unable to encode searchAffiliatePrograms#2899a011: field sort_order is nil") } if err := s.SortOrder.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchAffiliatePrograms#617c974c: field sort_order: %w", err) + return fmt.Errorf("unable to encode searchAffiliatePrograms#2899a011: field sort_order: %w", err) } b.Comma() b.FieldStart("offset") @@ -235,37 +243,37 @@ func (s *SearchAffiliateProgramsRequest) EncodeTDLibJSON(b tdjson.Encoder) error // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *SearchAffiliateProgramsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode searchAffiliatePrograms#617c974c to nil") + return fmt.Errorf("can't decode searchAffiliatePrograms#2899a011 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("searchAffiliatePrograms"); err != nil { - return fmt.Errorf("unable to decode searchAffiliatePrograms#617c974c: %w", err) + return fmt.Errorf("unable to decode searchAffiliatePrograms#2899a011: %w", err) } - case "chat_id": - value, err := b.Int53() + case "affiliate": + value, err := DecodeTDLibJSONAffiliateType(b) if err != nil { - return fmt.Errorf("unable to decode searchAffiliatePrograms#617c974c: field chat_id: %w", err) + return fmt.Errorf("unable to decode searchAffiliatePrograms#2899a011: field affiliate: %w", err) } - s.ChatID = value + s.Affiliate = value case "sort_order": value, err := DecodeTDLibJSONAffiliateProgramSortOrder(b) if err != nil { - return fmt.Errorf("unable to decode searchAffiliatePrograms#617c974c: field sort_order: %w", err) + return fmt.Errorf("unable to decode searchAffiliatePrograms#2899a011: field sort_order: %w", err) } s.SortOrder = value case "offset": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode searchAffiliatePrograms#617c974c: field offset: %w", err) + return fmt.Errorf("unable to decode searchAffiliatePrograms#2899a011: field offset: %w", err) } s.Offset = value case "limit": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchAffiliatePrograms#617c974c: field limit: %w", err) + return fmt.Errorf("unable to decode searchAffiliatePrograms#2899a011: field limit: %w", err) } s.Limit = value default: @@ -275,12 +283,12 @@ func (s *SearchAffiliateProgramsRequest) DecodeTDLibJSON(b tdjson.Decoder) error }) } -// GetChatID returns value of ChatID field. -func (s *SearchAffiliateProgramsRequest) GetChatID() (value int64) { +// GetAffiliate returns value of Affiliate field. +func (s *SearchAffiliateProgramsRequest) GetAffiliate() (value AffiliateTypeClass) { if s == nil { return } - return s.ChatID + return s.Affiliate } // GetSortOrder returns value of SortOrder field. @@ -307,7 +315,7 @@ func (s *SearchAffiliateProgramsRequest) GetLimit() (value int32) { return s.Limit } -// SearchAffiliatePrograms invokes method searchAffiliatePrograms#617c974c returning error if any. +// SearchAffiliatePrograms invokes method searchAffiliatePrograms#2899a011 returning error if any. func (c *Client) SearchAffiliatePrograms(ctx context.Context, request *SearchAffiliateProgramsRequest) (*FoundAffiliatePrograms, error) { var result FoundAffiliatePrograms diff --git a/tdapi/tl_search_messages_chat_type_filter_gen.go b/tdapi/tl_search_messages_chat_type_filter_gen.go new file mode 100644 index 0000000000..19d0d8a718 --- /dev/null +++ b/tdapi/tl_search_messages_chat_type_filter_gen.go @@ -0,0 +1,577 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// SearchMessagesChatTypeFilterPrivate represents TL type `searchMessagesChatTypeFilterPrivate#45b152cf`. +type SearchMessagesChatTypeFilterPrivate struct { +} + +// SearchMessagesChatTypeFilterPrivateTypeID is TL type id of SearchMessagesChatTypeFilterPrivate. +const SearchMessagesChatTypeFilterPrivateTypeID = 0x45b152cf + +// construct implements constructor of SearchMessagesChatTypeFilterClass. +func (s SearchMessagesChatTypeFilterPrivate) construct() SearchMessagesChatTypeFilterClass { return &s } + +// Ensuring interfaces in compile-time for SearchMessagesChatTypeFilterPrivate. +var ( + _ bin.Encoder = &SearchMessagesChatTypeFilterPrivate{} + _ bin.Decoder = &SearchMessagesChatTypeFilterPrivate{} + _ bin.BareEncoder = &SearchMessagesChatTypeFilterPrivate{} + _ bin.BareDecoder = &SearchMessagesChatTypeFilterPrivate{} + + _ SearchMessagesChatTypeFilterClass = &SearchMessagesChatTypeFilterPrivate{} +) + +func (s *SearchMessagesChatTypeFilterPrivate) Zero() bool { + if s == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (s *SearchMessagesChatTypeFilterPrivate) String() string { + if s == nil { + return "SearchMessagesChatTypeFilterPrivate(nil)" + } + type Alias SearchMessagesChatTypeFilterPrivate + return fmt.Sprintf("SearchMessagesChatTypeFilterPrivate%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SearchMessagesChatTypeFilterPrivate) TypeID() uint32 { + return SearchMessagesChatTypeFilterPrivateTypeID +} + +// TypeName returns name of type in TL schema. +func (*SearchMessagesChatTypeFilterPrivate) TypeName() string { + return "searchMessagesChatTypeFilterPrivate" +} + +// TypeInfo returns info about TL type. +func (s *SearchMessagesChatTypeFilterPrivate) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "searchMessagesChatTypeFilterPrivate", + ID: SearchMessagesChatTypeFilterPrivateTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (s *SearchMessagesChatTypeFilterPrivate) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode searchMessagesChatTypeFilterPrivate#45b152cf as nil") + } + b.PutID(SearchMessagesChatTypeFilterPrivateTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SearchMessagesChatTypeFilterPrivate) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode searchMessagesChatTypeFilterPrivate#45b152cf as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (s *SearchMessagesChatTypeFilterPrivate) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode searchMessagesChatTypeFilterPrivate#45b152cf to nil") + } + if err := b.ConsumeID(SearchMessagesChatTypeFilterPrivateTypeID); err != nil { + return fmt.Errorf("unable to decode searchMessagesChatTypeFilterPrivate#45b152cf: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SearchMessagesChatTypeFilterPrivate) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode searchMessagesChatTypeFilterPrivate#45b152cf to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SearchMessagesChatTypeFilterPrivate) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode searchMessagesChatTypeFilterPrivate#45b152cf as nil") + } + b.ObjStart() + b.PutID("searchMessagesChatTypeFilterPrivate") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SearchMessagesChatTypeFilterPrivate) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode searchMessagesChatTypeFilterPrivate#45b152cf to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("searchMessagesChatTypeFilterPrivate"); err != nil { + return fmt.Errorf("unable to decode searchMessagesChatTypeFilterPrivate#45b152cf: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// SearchMessagesChatTypeFilterGroup represents TL type `searchMessagesChatTypeFilterGroup#853fa71a`. +type SearchMessagesChatTypeFilterGroup struct { +} + +// SearchMessagesChatTypeFilterGroupTypeID is TL type id of SearchMessagesChatTypeFilterGroup. +const SearchMessagesChatTypeFilterGroupTypeID = 0x853fa71a + +// construct implements constructor of SearchMessagesChatTypeFilterClass. +func (s SearchMessagesChatTypeFilterGroup) construct() SearchMessagesChatTypeFilterClass { return &s } + +// Ensuring interfaces in compile-time for SearchMessagesChatTypeFilterGroup. +var ( + _ bin.Encoder = &SearchMessagesChatTypeFilterGroup{} + _ bin.Decoder = &SearchMessagesChatTypeFilterGroup{} + _ bin.BareEncoder = &SearchMessagesChatTypeFilterGroup{} + _ bin.BareDecoder = &SearchMessagesChatTypeFilterGroup{} + + _ SearchMessagesChatTypeFilterClass = &SearchMessagesChatTypeFilterGroup{} +) + +func (s *SearchMessagesChatTypeFilterGroup) Zero() bool { + if s == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (s *SearchMessagesChatTypeFilterGroup) String() string { + if s == nil { + return "SearchMessagesChatTypeFilterGroup(nil)" + } + type Alias SearchMessagesChatTypeFilterGroup + return fmt.Sprintf("SearchMessagesChatTypeFilterGroup%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SearchMessagesChatTypeFilterGroup) TypeID() uint32 { + return SearchMessagesChatTypeFilterGroupTypeID +} + +// TypeName returns name of type in TL schema. +func (*SearchMessagesChatTypeFilterGroup) TypeName() string { + return "searchMessagesChatTypeFilterGroup" +} + +// TypeInfo returns info about TL type. +func (s *SearchMessagesChatTypeFilterGroup) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "searchMessagesChatTypeFilterGroup", + ID: SearchMessagesChatTypeFilterGroupTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (s *SearchMessagesChatTypeFilterGroup) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode searchMessagesChatTypeFilterGroup#853fa71a as nil") + } + b.PutID(SearchMessagesChatTypeFilterGroupTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SearchMessagesChatTypeFilterGroup) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode searchMessagesChatTypeFilterGroup#853fa71a as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (s *SearchMessagesChatTypeFilterGroup) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode searchMessagesChatTypeFilterGroup#853fa71a to nil") + } + if err := b.ConsumeID(SearchMessagesChatTypeFilterGroupTypeID); err != nil { + return fmt.Errorf("unable to decode searchMessagesChatTypeFilterGroup#853fa71a: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SearchMessagesChatTypeFilterGroup) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode searchMessagesChatTypeFilterGroup#853fa71a to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SearchMessagesChatTypeFilterGroup) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode searchMessagesChatTypeFilterGroup#853fa71a as nil") + } + b.ObjStart() + b.PutID("searchMessagesChatTypeFilterGroup") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SearchMessagesChatTypeFilterGroup) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode searchMessagesChatTypeFilterGroup#853fa71a to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("searchMessagesChatTypeFilterGroup"); err != nil { + return fmt.Errorf("unable to decode searchMessagesChatTypeFilterGroup#853fa71a: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// SearchMessagesChatTypeFilterChannel represents TL type `searchMessagesChatTypeFilterChannel#d1e4b6d5`. +type SearchMessagesChatTypeFilterChannel struct { +} + +// SearchMessagesChatTypeFilterChannelTypeID is TL type id of SearchMessagesChatTypeFilterChannel. +const SearchMessagesChatTypeFilterChannelTypeID = 0xd1e4b6d5 + +// construct implements constructor of SearchMessagesChatTypeFilterClass. +func (s SearchMessagesChatTypeFilterChannel) construct() SearchMessagesChatTypeFilterClass { return &s } + +// Ensuring interfaces in compile-time for SearchMessagesChatTypeFilterChannel. +var ( + _ bin.Encoder = &SearchMessagesChatTypeFilterChannel{} + _ bin.Decoder = &SearchMessagesChatTypeFilterChannel{} + _ bin.BareEncoder = &SearchMessagesChatTypeFilterChannel{} + _ bin.BareDecoder = &SearchMessagesChatTypeFilterChannel{} + + _ SearchMessagesChatTypeFilterClass = &SearchMessagesChatTypeFilterChannel{} +) + +func (s *SearchMessagesChatTypeFilterChannel) Zero() bool { + if s == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (s *SearchMessagesChatTypeFilterChannel) String() string { + if s == nil { + return "SearchMessagesChatTypeFilterChannel(nil)" + } + type Alias SearchMessagesChatTypeFilterChannel + return fmt.Sprintf("SearchMessagesChatTypeFilterChannel%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SearchMessagesChatTypeFilterChannel) TypeID() uint32 { + return SearchMessagesChatTypeFilterChannelTypeID +} + +// TypeName returns name of type in TL schema. +func (*SearchMessagesChatTypeFilterChannel) TypeName() string { + return "searchMessagesChatTypeFilterChannel" +} + +// TypeInfo returns info about TL type. +func (s *SearchMessagesChatTypeFilterChannel) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "searchMessagesChatTypeFilterChannel", + ID: SearchMessagesChatTypeFilterChannelTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (s *SearchMessagesChatTypeFilterChannel) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode searchMessagesChatTypeFilterChannel#d1e4b6d5 as nil") + } + b.PutID(SearchMessagesChatTypeFilterChannelTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SearchMessagesChatTypeFilterChannel) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode searchMessagesChatTypeFilterChannel#d1e4b6d5 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (s *SearchMessagesChatTypeFilterChannel) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode searchMessagesChatTypeFilterChannel#d1e4b6d5 to nil") + } + if err := b.ConsumeID(SearchMessagesChatTypeFilterChannelTypeID); err != nil { + return fmt.Errorf("unable to decode searchMessagesChatTypeFilterChannel#d1e4b6d5: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SearchMessagesChatTypeFilterChannel) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode searchMessagesChatTypeFilterChannel#d1e4b6d5 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SearchMessagesChatTypeFilterChannel) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode searchMessagesChatTypeFilterChannel#d1e4b6d5 as nil") + } + b.ObjStart() + b.PutID("searchMessagesChatTypeFilterChannel") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SearchMessagesChatTypeFilterChannel) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode searchMessagesChatTypeFilterChannel#d1e4b6d5 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("searchMessagesChatTypeFilterChannel"); err != nil { + return fmt.Errorf("unable to decode searchMessagesChatTypeFilterChannel#d1e4b6d5: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// SearchMessagesChatTypeFilterClassName is schema name of SearchMessagesChatTypeFilterClass. +const SearchMessagesChatTypeFilterClassName = "SearchMessagesChatTypeFilter" + +// SearchMessagesChatTypeFilterClass represents SearchMessagesChatTypeFilter generic type. +// +// Example: +// +// g, err := tdapi.DecodeSearchMessagesChatTypeFilter(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tdapi.SearchMessagesChatTypeFilterPrivate: // searchMessagesChatTypeFilterPrivate#45b152cf +// case *tdapi.SearchMessagesChatTypeFilterGroup: // searchMessagesChatTypeFilterGroup#853fa71a +// case *tdapi.SearchMessagesChatTypeFilterChannel: // searchMessagesChatTypeFilterChannel#d1e4b6d5 +// default: panic(v) +// } +type SearchMessagesChatTypeFilterClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() SearchMessagesChatTypeFilterClass + + // 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 +} + +// DecodeSearchMessagesChatTypeFilter implements binary de-serialization for SearchMessagesChatTypeFilterClass. +func DecodeSearchMessagesChatTypeFilter(buf *bin.Buffer) (SearchMessagesChatTypeFilterClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case SearchMessagesChatTypeFilterPrivateTypeID: + // Decoding searchMessagesChatTypeFilterPrivate#45b152cf. + v := SearchMessagesChatTypeFilterPrivate{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode SearchMessagesChatTypeFilterClass: %w", err) + } + return &v, nil + case SearchMessagesChatTypeFilterGroupTypeID: + // Decoding searchMessagesChatTypeFilterGroup#853fa71a. + v := SearchMessagesChatTypeFilterGroup{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode SearchMessagesChatTypeFilterClass: %w", err) + } + return &v, nil + case SearchMessagesChatTypeFilterChannelTypeID: + // Decoding searchMessagesChatTypeFilterChannel#d1e4b6d5. + v := SearchMessagesChatTypeFilterChannel{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode SearchMessagesChatTypeFilterClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode SearchMessagesChatTypeFilterClass: %w", bin.NewUnexpectedID(id)) + } +} + +// DecodeTDLibJSONSearchMessagesChatTypeFilter implements binary de-serialization for SearchMessagesChatTypeFilterClass. +func DecodeTDLibJSONSearchMessagesChatTypeFilter(buf tdjson.Decoder) (SearchMessagesChatTypeFilterClass, error) { + id, err := buf.FindTypeID() + if err != nil { + return nil, err + } + switch id { + case "searchMessagesChatTypeFilterPrivate": + // Decoding searchMessagesChatTypeFilterPrivate#45b152cf. + v := SearchMessagesChatTypeFilterPrivate{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode SearchMessagesChatTypeFilterClass: %w", err) + } + return &v, nil + case "searchMessagesChatTypeFilterGroup": + // Decoding searchMessagesChatTypeFilterGroup#853fa71a. + v := SearchMessagesChatTypeFilterGroup{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode SearchMessagesChatTypeFilterClass: %w", err) + } + return &v, nil + case "searchMessagesChatTypeFilterChannel": + // Decoding searchMessagesChatTypeFilterChannel#d1e4b6d5. + v := SearchMessagesChatTypeFilterChannel{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode SearchMessagesChatTypeFilterClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode SearchMessagesChatTypeFilterClass: %w", tdjson.NewUnexpectedID(id)) + } +} + +// SearchMessagesChatTypeFilter boxes the SearchMessagesChatTypeFilterClass providing a helper. +type SearchMessagesChatTypeFilterBox struct { + SearchMessagesChatTypeFilter SearchMessagesChatTypeFilterClass +} + +// Decode implements bin.Decoder for SearchMessagesChatTypeFilterBox. +func (b *SearchMessagesChatTypeFilterBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode SearchMessagesChatTypeFilterBox to nil") + } + v, err := DecodeSearchMessagesChatTypeFilter(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.SearchMessagesChatTypeFilter = v + return nil +} + +// Encode implements bin.Encode for SearchMessagesChatTypeFilterBox. +func (b *SearchMessagesChatTypeFilterBox) Encode(buf *bin.Buffer) error { + if b == nil || b.SearchMessagesChatTypeFilter == nil { + return fmt.Errorf("unable to encode SearchMessagesChatTypeFilterClass as nil") + } + return b.SearchMessagesChatTypeFilter.Encode(buf) +} + +// DecodeTDLibJSON implements bin.Decoder for SearchMessagesChatTypeFilterBox. +func (b *SearchMessagesChatTypeFilterBox) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("unable to decode SearchMessagesChatTypeFilterBox to nil") + } + v, err := DecodeTDLibJSONSearchMessagesChatTypeFilter(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.SearchMessagesChatTypeFilter = v + return nil +} + +// EncodeTDLibJSON implements bin.Encode for SearchMessagesChatTypeFilterBox. +func (b *SearchMessagesChatTypeFilterBox) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil || b.SearchMessagesChatTypeFilter == nil { + return fmt.Errorf("unable to encode SearchMessagesChatTypeFilterClass as nil") + } + return b.SearchMessagesChatTypeFilter.EncodeTDLibJSON(buf) +} diff --git a/tdapi/tl_search_messages_gen.go b/tdapi/tl_search_messages_gen.go index a46b2a1e86..289e05d950 100644 --- a/tdapi/tl_search_messages_gen.go +++ b/tdapi/tl_search_messages_gen.go @@ -31,13 +31,11 @@ var ( _ = tdjson.Encoder{} ) -// SearchMessagesRequest represents TL type `searchMessages#31f9c3c9`. +// SearchMessagesRequest represents TL type `searchMessages#490addb5`. type SearchMessagesRequest struct { // Chat list in which to search messages; pass null to search in all chats regardless of // their chat list. Only Main and Archive chat lists are supported ChatList ChatListClass - // Pass true to search only for messages in channels - OnlyInChannels bool // Query to search for Query string // Offset of the first entry to return as received from the previous request; use empty @@ -52,6 +50,9 @@ type SearchMessagesRequest struct { // searchMessagesFilterUnreadReaction, searchMessagesFilterFailedToSend, and // searchMessagesFilterPinned are unsupported in this function Filter SearchMessagesFilterClass + // Additional filter for type of the chat of the searched messages; pass null to search + // for messages in all chats + ChatTypeFilter SearchMessagesChatTypeFilterClass // If not 0, the minimum date of the messages to return MinDate int32 // If not 0, the maximum date of the messages to return @@ -59,7 +60,7 @@ type SearchMessagesRequest struct { } // SearchMessagesRequestTypeID is TL type id of SearchMessagesRequest. -const SearchMessagesRequestTypeID = 0x31f9c3c9 +const SearchMessagesRequestTypeID = 0x490addb5 // Ensuring interfaces in compile-time for SearchMessagesRequest. var ( @@ -76,9 +77,6 @@ func (s *SearchMessagesRequest) Zero() bool { if !(s.ChatList == nil) { return false } - if !(s.OnlyInChannels == false) { - return false - } if !(s.Query == "") { return false } @@ -91,6 +89,9 @@ func (s *SearchMessagesRequest) Zero() bool { if !(s.Filter == nil) { return false } + if !(s.ChatTypeFilter == nil) { + return false + } if !(s.MinDate == 0) { return false } @@ -137,10 +138,6 @@ func (s *SearchMessagesRequest) TypeInfo() tdp.Type { Name: "ChatList", SchemaName: "chat_list", }, - { - Name: "OnlyInChannels", - SchemaName: "only_in_channels", - }, { Name: "Query", SchemaName: "query", @@ -157,6 +154,10 @@ func (s *SearchMessagesRequest) TypeInfo() tdp.Type { Name: "Filter", SchemaName: "filter", }, + { + Name: "ChatTypeFilter", + SchemaName: "chat_type_filter", + }, { Name: "MinDate", SchemaName: "min_date", @@ -172,7 +173,7 @@ func (s *SearchMessagesRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *SearchMessagesRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode searchMessages#31f9c3c9 as nil") + return fmt.Errorf("can't encode searchMessages#490addb5 as nil") } b.PutID(SearchMessagesRequestTypeID) return s.EncodeBare(b) @@ -181,23 +182,28 @@ func (s *SearchMessagesRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *SearchMessagesRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode searchMessages#31f9c3c9 as nil") + return fmt.Errorf("can't encode searchMessages#490addb5 as nil") } if s.ChatList == nil { - return fmt.Errorf("unable to encode searchMessages#31f9c3c9: field chat_list is nil") + return fmt.Errorf("unable to encode searchMessages#490addb5: field chat_list is nil") } if err := s.ChatList.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchMessages#31f9c3c9: field chat_list: %w", err) + return fmt.Errorf("unable to encode searchMessages#490addb5: field chat_list: %w", err) } - b.PutBool(s.OnlyInChannels) b.PutString(s.Query) b.PutString(s.Offset) b.PutInt32(s.Limit) if s.Filter == nil { - return fmt.Errorf("unable to encode searchMessages#31f9c3c9: field filter is nil") + return fmt.Errorf("unable to encode searchMessages#490addb5: field filter is nil") } if err := s.Filter.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchMessages#31f9c3c9: field filter: %w", err) + return fmt.Errorf("unable to encode searchMessages#490addb5: field filter: %w", err) + } + if s.ChatTypeFilter == nil { + return fmt.Errorf("unable to encode searchMessages#490addb5: field chat_type_filter is nil") + } + if err := s.ChatTypeFilter.Encode(b); err != nil { + return fmt.Errorf("unable to encode searchMessages#490addb5: field chat_type_filter: %w", err) } b.PutInt32(s.MinDate) b.PutInt32(s.MaxDate) @@ -207,10 +213,10 @@ func (s *SearchMessagesRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *SearchMessagesRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode searchMessages#31f9c3c9 to nil") + return fmt.Errorf("can't decode searchMessages#490addb5 to nil") } if err := b.ConsumeID(SearchMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessages#31f9c3c9: %w", err) + return fmt.Errorf("unable to decode searchMessages#490addb5: %w", err) } return s.DecodeBare(b) } @@ -218,61 +224,61 @@ func (s *SearchMessagesRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *SearchMessagesRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode searchMessages#31f9c3c9 to nil") + return fmt.Errorf("can't decode searchMessages#490addb5 to nil") } { value, err := DecodeChatList(b) if err != nil { - return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field chat_list: %w", err) + return fmt.Errorf("unable to decode searchMessages#490addb5: field chat_list: %w", err) } s.ChatList = value } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field only_in_channels: %w", err) - } - s.OnlyInChannels = value - } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field query: %w", err) + return fmt.Errorf("unable to decode searchMessages#490addb5: field query: %w", err) } s.Query = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field offset: %w", err) + return fmt.Errorf("unable to decode searchMessages#490addb5: field offset: %w", err) } s.Offset = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field limit: %w", err) + return fmt.Errorf("unable to decode searchMessages#490addb5: field limit: %w", err) } s.Limit = value } { value, err := DecodeSearchMessagesFilter(b) if err != nil { - return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field filter: %w", err) + return fmt.Errorf("unable to decode searchMessages#490addb5: field filter: %w", err) } s.Filter = value } + { + value, err := DecodeSearchMessagesChatTypeFilter(b) + if err != nil { + return fmt.Errorf("unable to decode searchMessages#490addb5: field chat_type_filter: %w", err) + } + s.ChatTypeFilter = value + } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field min_date: %w", err) + return fmt.Errorf("unable to decode searchMessages#490addb5: field min_date: %w", err) } s.MinDate = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field max_date: %w", err) + return fmt.Errorf("unable to decode searchMessages#490addb5: field max_date: %w", err) } s.MaxDate = value } @@ -282,22 +288,19 @@ func (s *SearchMessagesRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *SearchMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode searchMessages#31f9c3c9 as nil") + return fmt.Errorf("can't encode searchMessages#490addb5 as nil") } b.ObjStart() b.PutID("searchMessages") b.Comma() b.FieldStart("chat_list") if s.ChatList == nil { - return fmt.Errorf("unable to encode searchMessages#31f9c3c9: field chat_list is nil") + return fmt.Errorf("unable to encode searchMessages#490addb5: field chat_list is nil") } if err := s.ChatList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchMessages#31f9c3c9: field chat_list: %w", err) + return fmt.Errorf("unable to encode searchMessages#490addb5: field chat_list: %w", err) } b.Comma() - b.FieldStart("only_in_channels") - b.PutBool(s.OnlyInChannels) - b.Comma() b.FieldStart("query") b.PutString(s.Query) b.Comma() @@ -309,10 +312,18 @@ func (s *SearchMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("filter") if s.Filter == nil { - return fmt.Errorf("unable to encode searchMessages#31f9c3c9: field filter is nil") + return fmt.Errorf("unable to encode searchMessages#490addb5: field filter is nil") } if err := s.Filter.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchMessages#31f9c3c9: field filter: %w", err) + return fmt.Errorf("unable to encode searchMessages#490addb5: field filter: %w", err) + } + b.Comma() + b.FieldStart("chat_type_filter") + if s.ChatTypeFilter == nil { + return fmt.Errorf("unable to encode searchMessages#490addb5: field chat_type_filter is nil") + } + if err := s.ChatTypeFilter.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode searchMessages#490addb5: field chat_type_filter: %w", err) } b.Comma() b.FieldStart("min_date") @@ -329,61 +340,61 @@ func (s *SearchMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *SearchMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode searchMessages#31f9c3c9 to nil") + return fmt.Errorf("can't decode searchMessages#490addb5 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("searchMessages"); err != nil { - return fmt.Errorf("unable to decode searchMessages#31f9c3c9: %w", err) + return fmt.Errorf("unable to decode searchMessages#490addb5: %w", err) } case "chat_list": value, err := DecodeTDLibJSONChatList(b) if err != nil { - return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field chat_list: %w", err) + return fmt.Errorf("unable to decode searchMessages#490addb5: field chat_list: %w", err) } s.ChatList = value - case "only_in_channels": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field only_in_channels: %w", err) - } - s.OnlyInChannels = value case "query": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field query: %w", err) + return fmt.Errorf("unable to decode searchMessages#490addb5: field query: %w", err) } s.Query = value case "offset": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field offset: %w", err) + return fmt.Errorf("unable to decode searchMessages#490addb5: field offset: %w", err) } s.Offset = value case "limit": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field limit: %w", err) + return fmt.Errorf("unable to decode searchMessages#490addb5: field limit: %w", err) } s.Limit = value case "filter": value, err := DecodeTDLibJSONSearchMessagesFilter(b) if err != nil { - return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field filter: %w", err) + return fmt.Errorf("unable to decode searchMessages#490addb5: field filter: %w", err) } s.Filter = value + case "chat_type_filter": + value, err := DecodeTDLibJSONSearchMessagesChatTypeFilter(b) + if err != nil { + return fmt.Errorf("unable to decode searchMessages#490addb5: field chat_type_filter: %w", err) + } + s.ChatTypeFilter = value case "min_date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field min_date: %w", err) + return fmt.Errorf("unable to decode searchMessages#490addb5: field min_date: %w", err) } s.MinDate = value case "max_date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode searchMessages#31f9c3c9: field max_date: %w", err) + return fmt.Errorf("unable to decode searchMessages#490addb5: field max_date: %w", err) } s.MaxDate = value default: @@ -401,14 +412,6 @@ func (s *SearchMessagesRequest) GetChatList() (value ChatListClass) { return s.ChatList } -// GetOnlyInChannels returns value of OnlyInChannels field. -func (s *SearchMessagesRequest) GetOnlyInChannels() (value bool) { - if s == nil { - return - } - return s.OnlyInChannels -} - // GetQuery returns value of Query field. func (s *SearchMessagesRequest) GetQuery() (value string) { if s == nil { @@ -441,6 +444,14 @@ func (s *SearchMessagesRequest) GetFilter() (value SearchMessagesFilterClass) { return s.Filter } +// GetChatTypeFilter returns value of ChatTypeFilter field. +func (s *SearchMessagesRequest) GetChatTypeFilter() (value SearchMessagesChatTypeFilterClass) { + if s == nil { + return + } + return s.ChatTypeFilter +} + // GetMinDate returns value of MinDate field. func (s *SearchMessagesRequest) GetMinDate() (value int32) { if s == nil { @@ -457,7 +468,7 @@ func (s *SearchMessagesRequest) GetMaxDate() (value int32) { return s.MaxDate } -// SearchMessages invokes method searchMessages#31f9c3c9 returning error if any. +// SearchMessages invokes method searchMessages#490addb5 returning error if any. func (c *Client) SearchMessages(ctx context.Context, request *SearchMessagesRequest) (*FoundMessages, error) { var result FoundMessages diff --git a/tdapi/tl_send_gift_gen.go b/tdapi/tl_send_gift_gen.go index bd9cb88ee8..3bc5944c5f 100644 --- a/tdapi/tl_send_gift_gen.go +++ b/tdapi/tl_send_gift_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// SendGiftRequest represents TL type `sendGift#32c9796d`. +// SendGiftRequest represents TL type `sendGift#13a97db`. type SendGiftRequest struct { // Identifier of the gift to send GiftID int64 @@ -43,10 +43,13 @@ type SendGiftRequest struct { // Pass true to show the current user as sender and gift text only to the gift receiver; // otherwise, everyone will be able to see them IsPrivate bool + // Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade + // it for free + PayForUpgrade bool } // SendGiftRequestTypeID is TL type id of SendGiftRequest. -const SendGiftRequestTypeID = 0x32c9796d +const SendGiftRequestTypeID = 0x13a97db // Ensuring interfaces in compile-time for SendGiftRequest. var ( @@ -72,6 +75,9 @@ func (s *SendGiftRequest) Zero() bool { if !(s.IsPrivate == false) { return false } + if !(s.PayForUpgrade == false) { + return false + } return true } @@ -124,6 +130,10 @@ func (s *SendGiftRequest) TypeInfo() tdp.Type { Name: "IsPrivate", SchemaName: "is_private", }, + { + Name: "PayForUpgrade", + SchemaName: "pay_for_upgrade", + }, } return typ } @@ -131,7 +141,7 @@ func (s *SendGiftRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *SendGiftRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode sendGift#32c9796d as nil") + return fmt.Errorf("can't encode sendGift#13a97db as nil") } b.PutID(SendGiftRequestTypeID) return s.EncodeBare(b) @@ -140,24 +150,25 @@ func (s *SendGiftRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *SendGiftRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode sendGift#32c9796d as nil") + return fmt.Errorf("can't encode sendGift#13a97db as nil") } b.PutLong(s.GiftID) b.PutInt53(s.UserID) if err := s.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendGift#32c9796d: field text: %w", err) + return fmt.Errorf("unable to encode sendGift#13a97db: field text: %w", err) } b.PutBool(s.IsPrivate) + b.PutBool(s.PayForUpgrade) return nil } // Decode implements bin.Decoder. func (s *SendGiftRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode sendGift#32c9796d to nil") + return fmt.Errorf("can't decode sendGift#13a97db to nil") } if err := b.ConsumeID(SendGiftRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendGift#32c9796d: %w", err) + return fmt.Errorf("unable to decode sendGift#13a97db: %w", err) } return s.DecodeBare(b) } @@ -165,41 +176,48 @@ func (s *SendGiftRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *SendGiftRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode sendGift#32c9796d to nil") + return fmt.Errorf("can't decode sendGift#13a97db to nil") } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode sendGift#32c9796d: field gift_id: %w", err) + return fmt.Errorf("unable to decode sendGift#13a97db: field gift_id: %w", err) } s.GiftID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode sendGift#32c9796d: field user_id: %w", err) + return fmt.Errorf("unable to decode sendGift#13a97db: field user_id: %w", err) } s.UserID = value } { if err := s.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode sendGift#32c9796d: field text: %w", err) + return fmt.Errorf("unable to decode sendGift#13a97db: field text: %w", err) } } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode sendGift#32c9796d: field is_private: %w", err) + return fmt.Errorf("unable to decode sendGift#13a97db: field is_private: %w", err) } s.IsPrivate = value } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode sendGift#13a97db: field pay_for_upgrade: %w", err) + } + s.PayForUpgrade = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *SendGiftRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode sendGift#32c9796d as nil") + return fmt.Errorf("can't encode sendGift#13a97db as nil") } b.ObjStart() b.PutID("sendGift") @@ -212,12 +230,15 @@ func (s *SendGiftRequest) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("text") if err := s.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendGift#32c9796d: field text: %w", err) + return fmt.Errorf("unable to encode sendGift#13a97db: field text: %w", err) } b.Comma() b.FieldStart("is_private") b.PutBool(s.IsPrivate) b.Comma() + b.FieldStart("pay_for_upgrade") + b.PutBool(s.PayForUpgrade) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -226,37 +247,43 @@ func (s *SendGiftRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *SendGiftRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode sendGift#32c9796d to nil") + return fmt.Errorf("can't decode sendGift#13a97db to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("sendGift"); err != nil { - return fmt.Errorf("unable to decode sendGift#32c9796d: %w", err) + return fmt.Errorf("unable to decode sendGift#13a97db: %w", err) } case "gift_id": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode sendGift#32c9796d: field gift_id: %w", err) + return fmt.Errorf("unable to decode sendGift#13a97db: field gift_id: %w", err) } s.GiftID = value case "user_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode sendGift#32c9796d: field user_id: %w", err) + return fmt.Errorf("unable to decode sendGift#13a97db: field user_id: %w", err) } s.UserID = value case "text": if err := s.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sendGift#32c9796d: field text: %w", err) + return fmt.Errorf("unable to decode sendGift#13a97db: field text: %w", err) } case "is_private": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode sendGift#32c9796d: field is_private: %w", err) + return fmt.Errorf("unable to decode sendGift#13a97db: field is_private: %w", err) } s.IsPrivate = value + case "pay_for_upgrade": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode sendGift#13a97db: field pay_for_upgrade: %w", err) + } + s.PayForUpgrade = value default: return b.Skip() } @@ -296,7 +323,15 @@ func (s *SendGiftRequest) GetIsPrivate() (value bool) { return s.IsPrivate } -// SendGift invokes method sendGift#32c9796d returning error if any. +// GetPayForUpgrade returns value of PayForUpgrade field. +func (s *SendGiftRequest) GetPayForUpgrade() (value bool) { + if s == nil { + return + } + return s.PayForUpgrade +} + +// SendGift invokes method sendGift#13a97db returning error if any. func (c *Client) SendGift(ctx context.Context, request *SendGiftRequest) error { var ok Ok diff --git a/tdapi/tl_sent_gift_gen.go b/tdapi/tl_sent_gift_gen.go new file mode 100644 index 0000000000..bfbe27186c --- /dev/null +++ b/tdapi/tl_sent_gift_gen.go @@ -0,0 +1,501 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// SentGiftRegular represents TL type `sentGiftRegular#2368ad19`. +type SentGiftRegular struct { + // The gift + Gift Gift +} + +// SentGiftRegularTypeID is TL type id of SentGiftRegular. +const SentGiftRegularTypeID = 0x2368ad19 + +// construct implements constructor of SentGiftClass. +func (s SentGiftRegular) construct() SentGiftClass { return &s } + +// Ensuring interfaces in compile-time for SentGiftRegular. +var ( + _ bin.Encoder = &SentGiftRegular{} + _ bin.Decoder = &SentGiftRegular{} + _ bin.BareEncoder = &SentGiftRegular{} + _ bin.BareDecoder = &SentGiftRegular{} + + _ SentGiftClass = &SentGiftRegular{} +) + +func (s *SentGiftRegular) Zero() bool { + if s == nil { + return true + } + if !(s.Gift.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SentGiftRegular) String() string { + if s == nil { + return "SentGiftRegular(nil)" + } + type Alias SentGiftRegular + return fmt.Sprintf("SentGiftRegular%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SentGiftRegular) TypeID() uint32 { + return SentGiftRegularTypeID +} + +// TypeName returns name of type in TL schema. +func (*SentGiftRegular) TypeName() string { + return "sentGiftRegular" +} + +// TypeInfo returns info about TL type. +func (s *SentGiftRegular) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "sentGiftRegular", + ID: SentGiftRegularTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Gift", + SchemaName: "gift", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SentGiftRegular) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode sentGiftRegular#2368ad19 as nil") + } + b.PutID(SentGiftRegularTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SentGiftRegular) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode sentGiftRegular#2368ad19 as nil") + } + if err := s.Gift.Encode(b); err != nil { + return fmt.Errorf("unable to encode sentGiftRegular#2368ad19: field gift: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *SentGiftRegular) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode sentGiftRegular#2368ad19 to nil") + } + if err := b.ConsumeID(SentGiftRegularTypeID); err != nil { + return fmt.Errorf("unable to decode sentGiftRegular#2368ad19: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SentGiftRegular) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode sentGiftRegular#2368ad19 to nil") + } + { + if err := s.Gift.Decode(b); err != nil { + return fmt.Errorf("unable to decode sentGiftRegular#2368ad19: field gift: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SentGiftRegular) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode sentGiftRegular#2368ad19 as nil") + } + b.ObjStart() + b.PutID("sentGiftRegular") + b.Comma() + b.FieldStart("gift") + if err := s.Gift.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode sentGiftRegular#2368ad19: field gift: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SentGiftRegular) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode sentGiftRegular#2368ad19 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("sentGiftRegular"); err != nil { + return fmt.Errorf("unable to decode sentGiftRegular#2368ad19: %w", err) + } + case "gift": + if err := s.Gift.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode sentGiftRegular#2368ad19: field gift: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetGift returns value of Gift field. +func (s *SentGiftRegular) GetGift() (value Gift) { + if s == nil { + return + } + return s.Gift +} + +// SentGiftUpgraded represents TL type `sentGiftUpgraded#25674480`. +type SentGiftUpgraded struct { + // The gift + Gift UpgradedGift +} + +// SentGiftUpgradedTypeID is TL type id of SentGiftUpgraded. +const SentGiftUpgradedTypeID = 0x25674480 + +// construct implements constructor of SentGiftClass. +func (s SentGiftUpgraded) construct() SentGiftClass { return &s } + +// Ensuring interfaces in compile-time for SentGiftUpgraded. +var ( + _ bin.Encoder = &SentGiftUpgraded{} + _ bin.Decoder = &SentGiftUpgraded{} + _ bin.BareEncoder = &SentGiftUpgraded{} + _ bin.BareDecoder = &SentGiftUpgraded{} + + _ SentGiftClass = &SentGiftUpgraded{} +) + +func (s *SentGiftUpgraded) Zero() bool { + if s == nil { + return true + } + if !(s.Gift.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SentGiftUpgraded) String() string { + if s == nil { + return "SentGiftUpgraded(nil)" + } + type Alias SentGiftUpgraded + return fmt.Sprintf("SentGiftUpgraded%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SentGiftUpgraded) TypeID() uint32 { + return SentGiftUpgradedTypeID +} + +// TypeName returns name of type in TL schema. +func (*SentGiftUpgraded) TypeName() string { + return "sentGiftUpgraded" +} + +// TypeInfo returns info about TL type. +func (s *SentGiftUpgraded) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "sentGiftUpgraded", + ID: SentGiftUpgradedTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Gift", + SchemaName: "gift", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SentGiftUpgraded) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode sentGiftUpgraded#25674480 as nil") + } + b.PutID(SentGiftUpgradedTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SentGiftUpgraded) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode sentGiftUpgraded#25674480 as nil") + } + if err := s.Gift.Encode(b); err != nil { + return fmt.Errorf("unable to encode sentGiftUpgraded#25674480: field gift: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *SentGiftUpgraded) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode sentGiftUpgraded#25674480 to nil") + } + if err := b.ConsumeID(SentGiftUpgradedTypeID); err != nil { + return fmt.Errorf("unable to decode sentGiftUpgraded#25674480: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SentGiftUpgraded) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode sentGiftUpgraded#25674480 to nil") + } + { + if err := s.Gift.Decode(b); err != nil { + return fmt.Errorf("unable to decode sentGiftUpgraded#25674480: field gift: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SentGiftUpgraded) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode sentGiftUpgraded#25674480 as nil") + } + b.ObjStart() + b.PutID("sentGiftUpgraded") + b.Comma() + b.FieldStart("gift") + if err := s.Gift.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode sentGiftUpgraded#25674480: field gift: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SentGiftUpgraded) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode sentGiftUpgraded#25674480 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("sentGiftUpgraded"); err != nil { + return fmt.Errorf("unable to decode sentGiftUpgraded#25674480: %w", err) + } + case "gift": + if err := s.Gift.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode sentGiftUpgraded#25674480: field gift: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetGift returns value of Gift field. +func (s *SentGiftUpgraded) GetGift() (value UpgradedGift) { + if s == nil { + return + } + return s.Gift +} + +// SentGiftClassName is schema name of SentGiftClass. +const SentGiftClassName = "SentGift" + +// SentGiftClass represents SentGift generic type. +// +// Example: +// +// g, err := tdapi.DecodeSentGift(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tdapi.SentGiftRegular: // sentGiftRegular#2368ad19 +// case *tdapi.SentGiftUpgraded: // sentGiftUpgraded#25674480 +// default: panic(v) +// } +type SentGiftClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() SentGiftClass + + // 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 +} + +// DecodeSentGift implements binary de-serialization for SentGiftClass. +func DecodeSentGift(buf *bin.Buffer) (SentGiftClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case SentGiftRegularTypeID: + // Decoding sentGiftRegular#2368ad19. + v := SentGiftRegular{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode SentGiftClass: %w", err) + } + return &v, nil + case SentGiftUpgradedTypeID: + // Decoding sentGiftUpgraded#25674480. + v := SentGiftUpgraded{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode SentGiftClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode SentGiftClass: %w", bin.NewUnexpectedID(id)) + } +} + +// DecodeTDLibJSONSentGift implements binary de-serialization for SentGiftClass. +func DecodeTDLibJSONSentGift(buf tdjson.Decoder) (SentGiftClass, error) { + id, err := buf.FindTypeID() + if err != nil { + return nil, err + } + switch id { + case "sentGiftRegular": + // Decoding sentGiftRegular#2368ad19. + v := SentGiftRegular{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode SentGiftClass: %w", err) + } + return &v, nil + case "sentGiftUpgraded": + // Decoding sentGiftUpgraded#25674480. + v := SentGiftUpgraded{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode SentGiftClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode SentGiftClass: %w", tdjson.NewUnexpectedID(id)) + } +} + +// SentGift boxes the SentGiftClass providing a helper. +type SentGiftBox struct { + SentGift SentGiftClass +} + +// Decode implements bin.Decoder for SentGiftBox. +func (b *SentGiftBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode SentGiftBox to nil") + } + v, err := DecodeSentGift(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.SentGift = v + return nil +} + +// Encode implements bin.Encode for SentGiftBox. +func (b *SentGiftBox) Encode(buf *bin.Buffer) error { + if b == nil || b.SentGift == nil { + return fmt.Errorf("unable to encode SentGiftClass as nil") + } + return b.SentGift.Encode(buf) +} + +// DecodeTDLibJSON implements bin.Decoder for SentGiftBox. +func (b *SentGiftBox) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("unable to decode SentGiftBox to nil") + } + v, err := DecodeTDLibJSONSentGift(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.SentGift = v + return nil +} + +// EncodeTDLibJSON implements bin.Encode for SentGiftBox. +func (b *SentGiftBox) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil || b.SentGift == nil { + return fmt.Errorf("unable to encode SentGiftClass as nil") + } + return b.SentGift.EncodeTDLibJSON(buf) +} diff --git a/tdapi/tl_set_message_sender_bot_verification_gen.go b/tdapi/tl_set_message_sender_bot_verification_gen.go new file mode 100644 index 0000000000..2f5bfb8732 --- /dev/null +++ b/tdapi/tl_set_message_sender_bot_verification_gen.go @@ -0,0 +1,283 @@ +// 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{} +) + +// SetMessageSenderBotVerificationRequest represents TL type `setMessageSenderBotVerification#b4c1da4a`. +type SetMessageSenderBotVerificationRequest struct { + // Identifier of the owned bot, which will verify the user or the chat + BotUserID int64 + // Identifier of the user or the supergroup or channel chat, which will be verified by + // the bot + VerifiedID MessageSenderClass + // Custom description of verification reason; + // 0-getOption("bot_verification_custom_description_length_max"). + CustomDescription string +} + +// SetMessageSenderBotVerificationRequestTypeID is TL type id of SetMessageSenderBotVerificationRequest. +const SetMessageSenderBotVerificationRequestTypeID = 0xb4c1da4a + +// Ensuring interfaces in compile-time for SetMessageSenderBotVerificationRequest. +var ( + _ bin.Encoder = &SetMessageSenderBotVerificationRequest{} + _ bin.Decoder = &SetMessageSenderBotVerificationRequest{} + _ bin.BareEncoder = &SetMessageSenderBotVerificationRequest{} + _ bin.BareDecoder = &SetMessageSenderBotVerificationRequest{} +) + +func (s *SetMessageSenderBotVerificationRequest) Zero() bool { + if s == nil { + return true + } + if !(s.BotUserID == 0) { + return false + } + if !(s.VerifiedID == nil) { + return false + } + if !(s.CustomDescription == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SetMessageSenderBotVerificationRequest) String() string { + if s == nil { + return "SetMessageSenderBotVerificationRequest(nil)" + } + type Alias SetMessageSenderBotVerificationRequest + return fmt.Sprintf("SetMessageSenderBotVerificationRequest%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SetMessageSenderBotVerificationRequest) TypeID() uint32 { + return SetMessageSenderBotVerificationRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SetMessageSenderBotVerificationRequest) TypeName() string { + return "setMessageSenderBotVerification" +} + +// TypeInfo returns info about TL type. +func (s *SetMessageSenderBotVerificationRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "setMessageSenderBotVerification", + ID: SetMessageSenderBotVerificationRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "BotUserID", + SchemaName: "bot_user_id", + }, + { + Name: "VerifiedID", + SchemaName: "verified_id", + }, + { + Name: "CustomDescription", + SchemaName: "custom_description", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SetMessageSenderBotVerificationRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setMessageSenderBotVerification#b4c1da4a as nil") + } + b.PutID(SetMessageSenderBotVerificationRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SetMessageSenderBotVerificationRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setMessageSenderBotVerification#b4c1da4a as nil") + } + b.PutInt53(s.BotUserID) + if s.VerifiedID == nil { + return fmt.Errorf("unable to encode setMessageSenderBotVerification#b4c1da4a: field verified_id is nil") + } + if err := s.VerifiedID.Encode(b); err != nil { + return fmt.Errorf("unable to encode setMessageSenderBotVerification#b4c1da4a: field verified_id: %w", err) + } + b.PutString(s.CustomDescription) + return nil +} + +// Decode implements bin.Decoder. +func (s *SetMessageSenderBotVerificationRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setMessageSenderBotVerification#b4c1da4a to nil") + } + if err := b.ConsumeID(SetMessageSenderBotVerificationRequestTypeID); err != nil { + return fmt.Errorf("unable to decode setMessageSenderBotVerification#b4c1da4a: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SetMessageSenderBotVerificationRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setMessageSenderBotVerification#b4c1da4a to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setMessageSenderBotVerification#b4c1da4a: field bot_user_id: %w", err) + } + s.BotUserID = value + } + { + value, err := DecodeMessageSender(b) + if err != nil { + return fmt.Errorf("unable to decode setMessageSenderBotVerification#b4c1da4a: field verified_id: %w", err) + } + s.VerifiedID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode setMessageSenderBotVerification#b4c1da4a: field custom_description: %w", err) + } + s.CustomDescription = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SetMessageSenderBotVerificationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode setMessageSenderBotVerification#b4c1da4a as nil") + } + b.ObjStart() + b.PutID("setMessageSenderBotVerification") + b.Comma() + b.FieldStart("bot_user_id") + b.PutInt53(s.BotUserID) + b.Comma() + b.FieldStart("verified_id") + if s.VerifiedID == nil { + return fmt.Errorf("unable to encode setMessageSenderBotVerification#b4c1da4a: field verified_id is nil") + } + if err := s.VerifiedID.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode setMessageSenderBotVerification#b4c1da4a: field verified_id: %w", err) + } + b.Comma() + b.FieldStart("custom_description") + b.PutString(s.CustomDescription) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SetMessageSenderBotVerificationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode setMessageSenderBotVerification#b4c1da4a to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("setMessageSenderBotVerification"); err != nil { + return fmt.Errorf("unable to decode setMessageSenderBotVerification#b4c1da4a: %w", err) + } + case "bot_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setMessageSenderBotVerification#b4c1da4a: field bot_user_id: %w", err) + } + s.BotUserID = value + case "verified_id": + value, err := DecodeTDLibJSONMessageSender(b) + if err != nil { + return fmt.Errorf("unable to decode setMessageSenderBotVerification#b4c1da4a: field verified_id: %w", err) + } + s.VerifiedID = value + case "custom_description": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode setMessageSenderBotVerification#b4c1da4a: field custom_description: %w", err) + } + s.CustomDescription = value + default: + return b.Skip() + } + return nil + }) +} + +// GetBotUserID returns value of BotUserID field. +func (s *SetMessageSenderBotVerificationRequest) GetBotUserID() (value int64) { + if s == nil { + return + } + return s.BotUserID +} + +// GetVerifiedID returns value of VerifiedID field. +func (s *SetMessageSenderBotVerificationRequest) GetVerifiedID() (value MessageSenderClass) { + if s == nil { + return + } + return s.VerifiedID +} + +// GetCustomDescription returns value of CustomDescription field. +func (s *SetMessageSenderBotVerificationRequest) GetCustomDescription() (value string) { + if s == nil { + return + } + return s.CustomDescription +} + +// SetMessageSenderBotVerification invokes method setMessageSenderBotVerification#b4c1da4a returning error if any. +func (c *Client) SetMessageSenderBotVerification(ctx context.Context, request *SetMessageSenderBotVerificationRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_star_transaction_type_gen.go b/tdapi/tl_star_transaction_type_gen.go index 7244bc5b16..be4aa1eb15 100644 --- a/tdapi/tl_star_transaction_type_gen.go +++ b/tdapi/tl_star_transaction_type_gen.go @@ -4112,6 +4112,206 @@ func (s *StarTransactionTypeGiftPurchase) GetGift() (value Gift) { return s.Gift } +// StarTransactionTypeGiftTransfer represents TL type `starTransactionTypeGiftTransfer#ef323c55`. +type StarTransactionTypeGiftTransfer struct { + // Identifier of the user that received the gift + UserID int64 + // The gift + Gift UpgradedGift +} + +// StarTransactionTypeGiftTransferTypeID is TL type id of StarTransactionTypeGiftTransfer. +const StarTransactionTypeGiftTransferTypeID = 0xef323c55 + +// construct implements constructor of StarTransactionTypeClass. +func (s StarTransactionTypeGiftTransfer) construct() StarTransactionTypeClass { return &s } + +// Ensuring interfaces in compile-time for StarTransactionTypeGiftTransfer. +var ( + _ bin.Encoder = &StarTransactionTypeGiftTransfer{} + _ bin.Decoder = &StarTransactionTypeGiftTransfer{} + _ bin.BareEncoder = &StarTransactionTypeGiftTransfer{} + _ bin.BareDecoder = &StarTransactionTypeGiftTransfer{} + + _ StarTransactionTypeClass = &StarTransactionTypeGiftTransfer{} +) + +func (s *StarTransactionTypeGiftTransfer) Zero() bool { + if s == nil { + return true + } + if !(s.UserID == 0) { + return false + } + if !(s.Gift.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarTransactionTypeGiftTransfer) String() string { + if s == nil { + return "StarTransactionTypeGiftTransfer(nil)" + } + type Alias StarTransactionTypeGiftTransfer + return fmt.Sprintf("StarTransactionTypeGiftTransfer%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarTransactionTypeGiftTransfer) TypeID() uint32 { + return StarTransactionTypeGiftTransferTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarTransactionTypeGiftTransfer) TypeName() string { + return "starTransactionTypeGiftTransfer" +} + +// TypeInfo returns info about TL type. +func (s *StarTransactionTypeGiftTransfer) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starTransactionTypeGiftTransfer", + ID: StarTransactionTypeGiftTransferTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "UserID", + SchemaName: "user_id", + }, + { + Name: "Gift", + SchemaName: "gift", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StarTransactionTypeGiftTransfer) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starTransactionTypeGiftTransfer#ef323c55 as nil") + } + b.PutID(StarTransactionTypeGiftTransferTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarTransactionTypeGiftTransfer) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starTransactionTypeGiftTransfer#ef323c55 as nil") + } + b.PutInt53(s.UserID) + if err := s.Gift.Encode(b); err != nil { + return fmt.Errorf("unable to encode starTransactionTypeGiftTransfer#ef323c55: field gift: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StarTransactionTypeGiftTransfer) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starTransactionTypeGiftTransfer#ef323c55 to nil") + } + if err := b.ConsumeID(StarTransactionTypeGiftTransferTypeID); err != nil { + return fmt.Errorf("unable to decode starTransactionTypeGiftTransfer#ef323c55: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarTransactionTypeGiftTransfer) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starTransactionTypeGiftTransfer#ef323c55 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode starTransactionTypeGiftTransfer#ef323c55: field user_id: %w", err) + } + s.UserID = value + } + { + if err := s.Gift.Decode(b); err != nil { + return fmt.Errorf("unable to decode starTransactionTypeGiftTransfer#ef323c55: field gift: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StarTransactionTypeGiftTransfer) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode starTransactionTypeGiftTransfer#ef323c55 as nil") + } + b.ObjStart() + b.PutID("starTransactionTypeGiftTransfer") + b.Comma() + b.FieldStart("user_id") + b.PutInt53(s.UserID) + b.Comma() + b.FieldStart("gift") + if err := s.Gift.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode starTransactionTypeGiftTransfer#ef323c55: field gift: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StarTransactionTypeGiftTransfer) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode starTransactionTypeGiftTransfer#ef323c55 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("starTransactionTypeGiftTransfer"); err != nil { + return fmt.Errorf("unable to decode starTransactionTypeGiftTransfer#ef323c55: %w", err) + } + case "user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode starTransactionTypeGiftTransfer#ef323c55: field user_id: %w", err) + } + s.UserID = value + case "gift": + if err := s.Gift.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode starTransactionTypeGiftTransfer#ef323c55: field gift: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetUserID returns value of UserID field. +func (s *StarTransactionTypeGiftTransfer) GetUserID() (value int64) { + if s == nil { + return + } + return s.UserID +} + +// GetGift returns value of Gift field. +func (s *StarTransactionTypeGiftTransfer) GetGift() (value UpgradedGift) { + if s == nil { + return + } + return s.Gift +} + // StarTransactionTypeGiftSale represents TL type `starTransactionTypeGiftSale#64d61157`. type StarTransactionTypeGiftSale struct { // Identifier of the user that sent the gift @@ -4312,6 +4512,172 @@ func (s *StarTransactionTypeGiftSale) GetGift() (value Gift) { return s.Gift } +// StarTransactionTypeGiftUpgrade represents TL type `starTransactionTypeGiftUpgrade#2697844b`. +type StarTransactionTypeGiftUpgrade struct { + // The upgraded gift + Gift UpgradedGift +} + +// StarTransactionTypeGiftUpgradeTypeID is TL type id of StarTransactionTypeGiftUpgrade. +const StarTransactionTypeGiftUpgradeTypeID = 0x2697844b + +// construct implements constructor of StarTransactionTypeClass. +func (s StarTransactionTypeGiftUpgrade) construct() StarTransactionTypeClass { return &s } + +// Ensuring interfaces in compile-time for StarTransactionTypeGiftUpgrade. +var ( + _ bin.Encoder = &StarTransactionTypeGiftUpgrade{} + _ bin.Decoder = &StarTransactionTypeGiftUpgrade{} + _ bin.BareEncoder = &StarTransactionTypeGiftUpgrade{} + _ bin.BareDecoder = &StarTransactionTypeGiftUpgrade{} + + _ StarTransactionTypeClass = &StarTransactionTypeGiftUpgrade{} +) + +func (s *StarTransactionTypeGiftUpgrade) Zero() bool { + if s == nil { + return true + } + if !(s.Gift.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarTransactionTypeGiftUpgrade) String() string { + if s == nil { + return "StarTransactionTypeGiftUpgrade(nil)" + } + type Alias StarTransactionTypeGiftUpgrade + return fmt.Sprintf("StarTransactionTypeGiftUpgrade%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarTransactionTypeGiftUpgrade) TypeID() uint32 { + return StarTransactionTypeGiftUpgradeTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarTransactionTypeGiftUpgrade) TypeName() string { + return "starTransactionTypeGiftUpgrade" +} + +// TypeInfo returns info about TL type. +func (s *StarTransactionTypeGiftUpgrade) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starTransactionTypeGiftUpgrade", + ID: StarTransactionTypeGiftUpgradeTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Gift", + SchemaName: "gift", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StarTransactionTypeGiftUpgrade) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starTransactionTypeGiftUpgrade#2697844b as nil") + } + b.PutID(StarTransactionTypeGiftUpgradeTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarTransactionTypeGiftUpgrade) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starTransactionTypeGiftUpgrade#2697844b as nil") + } + if err := s.Gift.Encode(b); err != nil { + return fmt.Errorf("unable to encode starTransactionTypeGiftUpgrade#2697844b: field gift: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StarTransactionTypeGiftUpgrade) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starTransactionTypeGiftUpgrade#2697844b to nil") + } + if err := b.ConsumeID(StarTransactionTypeGiftUpgradeTypeID); err != nil { + return fmt.Errorf("unable to decode starTransactionTypeGiftUpgrade#2697844b: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarTransactionTypeGiftUpgrade) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starTransactionTypeGiftUpgrade#2697844b to nil") + } + { + if err := s.Gift.Decode(b); err != nil { + return fmt.Errorf("unable to decode starTransactionTypeGiftUpgrade#2697844b: field gift: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StarTransactionTypeGiftUpgrade) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode starTransactionTypeGiftUpgrade#2697844b as nil") + } + b.ObjStart() + b.PutID("starTransactionTypeGiftUpgrade") + b.Comma() + b.FieldStart("gift") + if err := s.Gift.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode starTransactionTypeGiftUpgrade#2697844b: field gift: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StarTransactionTypeGiftUpgrade) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode starTransactionTypeGiftUpgrade#2697844b to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("starTransactionTypeGiftUpgrade"); err != nil { + return fmt.Errorf("unable to decode starTransactionTypeGiftUpgrade#2697844b: %w", err) + } + case "gift": + if err := s.Gift.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode starTransactionTypeGiftUpgrade#2697844b: field gift: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetGift returns value of Gift field. +func (s *StarTransactionTypeGiftUpgrade) GetGift() (value UpgradedGift) { + if s == nil { + return + } + return s.Gift +} + // StarTransactionTypeChannelPaidReactionSend represents TL type `starTransactionTypeChannelPaidReactionSend#c02667c0`. type StarTransactionTypeChannelPaidReactionSend struct { // Identifier of the channel chat @@ -5080,7 +5446,9 @@ const StarTransactionTypeClassName = "StarTransactionType" // case *tdapi.StarTransactionTypeChannelSubscriptionPurchase: // starTransactionTypeChannelSubscriptionPurchase#380eb3d1 // case *tdapi.StarTransactionTypeChannelSubscriptionSale: // starTransactionTypeChannelSubscriptionSale#fe127c82 // case *tdapi.StarTransactionTypeGiftPurchase: // starTransactionTypeGiftPurchase#ef5f1d52 +// case *tdapi.StarTransactionTypeGiftTransfer: // starTransactionTypeGiftTransfer#ef323c55 // case *tdapi.StarTransactionTypeGiftSale: // starTransactionTypeGiftSale#64d61157 +// case *tdapi.StarTransactionTypeGiftUpgrade: // starTransactionTypeGiftUpgrade#2697844b // case *tdapi.StarTransactionTypeChannelPaidReactionSend: // starTransactionTypeChannelPaidReactionSend#c02667c0 // case *tdapi.StarTransactionTypeChannelPaidReactionReceive: // starTransactionTypeChannelPaidReactionReceive#23d6f9eb // case *tdapi.StarTransactionTypeAffiliateProgramCommission: // starTransactionTypeAffiliateProgramCommission#9a637573 @@ -5256,6 +5624,13 @@ func DecodeStarTransactionType(buf *bin.Buffer) (StarTransactionTypeClass, error return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) } return &v, nil + case StarTransactionTypeGiftTransferTypeID: + // Decoding starTransactionTypeGiftTransfer#ef323c55. + v := StarTransactionTypeGiftTransfer{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) + } + return &v, nil case StarTransactionTypeGiftSaleTypeID: // Decoding starTransactionTypeGiftSale#64d61157. v := StarTransactionTypeGiftSale{} @@ -5263,6 +5638,13 @@ func DecodeStarTransactionType(buf *bin.Buffer) (StarTransactionTypeClass, error return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) } return &v, nil + case StarTransactionTypeGiftUpgradeTypeID: + // Decoding starTransactionTypeGiftUpgrade#2697844b. + v := StarTransactionTypeGiftUpgrade{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) + } + return &v, nil case StarTransactionTypeChannelPaidReactionSendTypeID: // Decoding starTransactionTypeChannelPaidReactionSend#c02667c0. v := StarTransactionTypeChannelPaidReactionSend{} @@ -5443,6 +5825,13 @@ func DecodeTDLibJSONStarTransactionType(buf tdjson.Decoder) (StarTransactionType return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) } return &v, nil + case "starTransactionTypeGiftTransfer": + // Decoding starTransactionTypeGiftTransfer#ef323c55. + v := StarTransactionTypeGiftTransfer{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) + } + return &v, nil case "starTransactionTypeGiftSale": // Decoding starTransactionTypeGiftSale#64d61157. v := StarTransactionTypeGiftSale{} @@ -5450,6 +5839,13 @@ func DecodeTDLibJSONStarTransactionType(buf tdjson.Decoder) (StarTransactionType return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) } return &v, nil + case "starTransactionTypeGiftUpgrade": + // Decoding starTransactionTypeGiftUpgrade#2697844b. + v := StarTransactionTypeGiftUpgrade{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) + } + return &v, nil case "starTransactionTypeChannelPaidReactionSend": // Decoding starTransactionTypeChannelPaidReactionSend#c02667c0. v := StarTransactionTypeChannelPaidReactionSend{} diff --git a/tdapi/tl_suggested_action_gen.go b/tdapi/tl_suggested_action_gen.go index 121a14738e..59815ff99a 100644 --- a/tdapi/tl_suggested_action_gen.go +++ b/tdapi/tl_suggested_action_gen.go @@ -1543,6 +1543,137 @@ func (s *SuggestedActionSetBirthdate) DecodeTDLibJSON(b tdjson.Decoder) error { }) } +// SuggestedActionSetProfilePhoto represents TL type `suggestedActionSetProfilePhoto#9fe23d6b`. +type SuggestedActionSetProfilePhoto struct { +} + +// SuggestedActionSetProfilePhotoTypeID is TL type id of SuggestedActionSetProfilePhoto. +const SuggestedActionSetProfilePhotoTypeID = 0x9fe23d6b + +// construct implements constructor of SuggestedActionClass. +func (s SuggestedActionSetProfilePhoto) construct() SuggestedActionClass { return &s } + +// Ensuring interfaces in compile-time for SuggestedActionSetProfilePhoto. +var ( + _ bin.Encoder = &SuggestedActionSetProfilePhoto{} + _ bin.Decoder = &SuggestedActionSetProfilePhoto{} + _ bin.BareEncoder = &SuggestedActionSetProfilePhoto{} + _ bin.BareDecoder = &SuggestedActionSetProfilePhoto{} + + _ SuggestedActionClass = &SuggestedActionSetProfilePhoto{} +) + +func (s *SuggestedActionSetProfilePhoto) Zero() bool { + if s == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (s *SuggestedActionSetProfilePhoto) String() string { + if s == nil { + return "SuggestedActionSetProfilePhoto(nil)" + } + type Alias SuggestedActionSetProfilePhoto + return fmt.Sprintf("SuggestedActionSetProfilePhoto%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SuggestedActionSetProfilePhoto) TypeID() uint32 { + return SuggestedActionSetProfilePhotoTypeID +} + +// TypeName returns name of type in TL schema. +func (*SuggestedActionSetProfilePhoto) TypeName() string { + return "suggestedActionSetProfilePhoto" +} + +// TypeInfo returns info about TL type. +func (s *SuggestedActionSetProfilePhoto) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "suggestedActionSetProfilePhoto", + ID: SuggestedActionSetProfilePhotoTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (s *SuggestedActionSetProfilePhoto) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode suggestedActionSetProfilePhoto#9fe23d6b as nil") + } + b.PutID(SuggestedActionSetProfilePhotoTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SuggestedActionSetProfilePhoto) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode suggestedActionSetProfilePhoto#9fe23d6b as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (s *SuggestedActionSetProfilePhoto) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode suggestedActionSetProfilePhoto#9fe23d6b to nil") + } + if err := b.ConsumeID(SuggestedActionSetProfilePhotoTypeID); err != nil { + return fmt.Errorf("unable to decode suggestedActionSetProfilePhoto#9fe23d6b: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SuggestedActionSetProfilePhoto) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode suggestedActionSetProfilePhoto#9fe23d6b to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SuggestedActionSetProfilePhoto) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode suggestedActionSetProfilePhoto#9fe23d6b as nil") + } + b.ObjStart() + b.PutID("suggestedActionSetProfilePhoto") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SuggestedActionSetProfilePhoto) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode suggestedActionSetProfilePhoto#9fe23d6b to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("suggestedActionSetProfilePhoto"); err != nil { + return fmt.Errorf("unable to decode suggestedActionSetProfilePhoto#9fe23d6b: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + // SuggestedActionExtendPremium represents TL type `suggestedActionExtendPremium#de405cca`. type SuggestedActionExtendPremium struct { // A URL for managing Telegram Premium subscription @@ -1863,6 +1994,7 @@ const SuggestedActionClassName = "SuggestedAction" // case *tdapi.SuggestedActionSubscribeToAnnualPremium: // suggestedActionSubscribeToAnnualPremium#164978bb // case *tdapi.SuggestedActionGiftPremiumForChristmas: // suggestedActionGiftPremiumForChristmas#93b3ee6f // case *tdapi.SuggestedActionSetBirthdate: // suggestedActionSetBirthdate#eabd9b02 +// case *tdapi.SuggestedActionSetProfilePhoto: // suggestedActionSetProfilePhoto#9fe23d6b // case *tdapi.SuggestedActionExtendPremium: // suggestedActionExtendPremium#de405cca // case *tdapi.SuggestedActionExtendStarSubscriptions: // suggestedActionExtendStarSubscriptions#fd32d556 // default: panic(v) @@ -1973,6 +2105,13 @@ func DecodeSuggestedAction(buf *bin.Buffer) (SuggestedActionClass, error) { return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) } return &v, nil + case SuggestedActionSetProfilePhotoTypeID: + // Decoding suggestedActionSetProfilePhoto#9fe23d6b. + v := SuggestedActionSetProfilePhoto{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) + } + return &v, nil case SuggestedActionExtendPremiumTypeID: // Decoding suggestedActionExtendPremium#de405cca. v := SuggestedActionExtendPremium{} @@ -2076,6 +2215,13 @@ func DecodeTDLibJSONSuggestedAction(buf tdjson.Decoder) (SuggestedActionClass, e return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) } return &v, nil + case "suggestedActionSetProfilePhoto": + // Decoding suggestedActionSetProfilePhoto#9fe23d6b. + v := SuggestedActionSetProfilePhoto{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) + } + return &v, nil case "suggestedActionExtendPremium": // Decoding suggestedActionExtendPremium#de405cca. v := SuggestedActionExtendPremium{} diff --git a/tdapi/tl_supergroup_full_info_gen.go b/tdapi/tl_supergroup_full_info_gen.go index 85b1c89e88..39b2d0dfd7 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#1ea45bb`. +// SupergroupFullInfo represents TL type `supergroupFullInfo#f763d79d`. 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 @@ -110,6 +110,9 @@ type SupergroupFullInfo struct { InviteLink ChatInviteLink // List of commands of bots in the group BotCommands []BotCommands + // Information about verification status of the supergroup or the channel provided by a + // bot; may be null if none or unknown + BotVerification BotVerification // Identifier of the basic group from which supergroup was upgraded; 0 if none UpgradedFromBasicGroupID int64 // Identifier of the last message in the basic group from which supergroup was upgraded; @@ -118,7 +121,7 @@ type SupergroupFullInfo struct { } // SupergroupFullInfoTypeID is TL type id of SupergroupFullInfo. -const SupergroupFullInfoTypeID = 0x1ea45bb +const SupergroupFullInfoTypeID = 0xf763d79d // Ensuring interfaces in compile-time for SupergroupFullInfo. var ( @@ -225,6 +228,9 @@ func (s *SupergroupFullInfo) Zero() bool { if !(s.BotCommands == nil) { return false } + if !(s.BotVerification.Zero()) { + return false + } if !(s.UpgradedFromBasicGroupID == 0) { return false } @@ -391,6 +397,10 @@ func (s *SupergroupFullInfo) TypeInfo() tdp.Type { Name: "BotCommands", SchemaName: "bot_commands", }, + { + Name: "BotVerification", + SchemaName: "bot_verification", + }, { Name: "UpgradedFromBasicGroupID", SchemaName: "upgraded_from_basic_group_id", @@ -406,7 +416,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#1ea45bb as nil") + return fmt.Errorf("can't encode supergroupFullInfo#f763d79d as nil") } b.PutID(SupergroupFullInfoTypeID) return s.EncodeBare(b) @@ -415,10 +425,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#1ea45bb as nil") + return fmt.Errorf("can't encode supergroupFullInfo#f763d79d as nil") } if err := s.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#1ea45bb: field photo: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#f763d79d: field photo: %w", err) } b.PutString(s.Description) b.PutInt32(s.MemberCount) @@ -448,17 +458,20 @@ func (s *SupergroupFullInfo) EncodeBare(b *bin.Buffer) error { b.PutLong(s.StickerSetID) b.PutLong(s.CustomEmojiStickerSetID) if err := s.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#1ea45bb: field location: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#f763d79d: field location: %w", err) } if err := s.InviteLink.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#1ea45bb: field invite_link: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#f763d79d: 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#1ea45bb: field bot_commands element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare supergroupFullInfo#f763d79d: field bot_commands element with index %d: %w", idx, err) } } + if err := s.BotVerification.Encode(b); err != nil { + return fmt.Errorf("unable to encode supergroupFullInfo#f763d79d: field bot_verification: %w", err) + } b.PutInt53(s.UpgradedFromBasicGroupID) b.PutInt53(s.UpgradedFromMaxMessageID) return nil @@ -467,10 +480,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#1ea45bb to nil") + return fmt.Errorf("can't decode supergroupFullInfo#f763d79d to nil") } if err := b.ConsumeID(SupergroupFullInfoTypeID); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: %w", err) } return s.DecodeBare(b) } @@ -478,216 +491,216 @@ 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#1ea45bb to nil") + return fmt.Errorf("can't decode supergroupFullInfo#f763d79d to nil") } { if err := s.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field photo: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field photo: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field description: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field description: %w", err) } s.Description = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field member_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field member_count: %w", err) } s.MemberCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field administrator_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field administrator_count: %w", err) } s.AdministratorCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field restricted_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field restricted_count: %w", err) } s.RestrictedCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field banned_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field banned_count: %w", err) } s.BannedCount = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field linked_chat_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field linked_chat_id: %w", err) } s.LinkedChatID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field slow_mode_delay: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field slow_mode_delay: %w", err) } s.SlowModeDelay = value } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field slow_mode_delay_expires_in: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: 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#1ea45bb: field can_enable_paid_reaction: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_enable_paid_reaction: %w", err) } s.CanEnablePaidReaction = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field can_get_members: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_get_members: %w", err) } s.CanGetMembers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field has_hidden_members: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field has_hidden_members: %w", err) } s.HasHiddenMembers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field can_hide_members: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_hide_members: %w", err) } s.CanHideMembers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field can_set_sticker_set: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_set_sticker_set: %w", err) } s.CanSetStickerSet = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field can_set_location: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_set_location: %w", err) } s.CanSetLocation = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field can_get_statistics: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_get_statistics: %w", err) } s.CanGetStatistics = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field can_get_revenue_statistics: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_get_revenue_statistics: %w", err) } s.CanGetRevenueStatistics = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field can_get_star_revenue_statistics: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_get_star_revenue_statistics: %w", err) } s.CanGetStarRevenueStatistics = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field can_toggle_aggressive_anti_spam: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: 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#1ea45bb: field is_all_history_available: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field is_all_history_available: %w", err) } s.IsAllHistoryAvailable = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field can_have_sponsored_messages: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_have_sponsored_messages: %w", err) } s.CanHaveSponsoredMessages = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field has_aggressive_anti_spam_enabled: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: 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#1ea45bb: field has_paid_media_allowed: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field has_paid_media_allowed: %w", err) } s.HasPaidMediaAllowed = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field has_pinned_stories: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field has_pinned_stories: %w", err) } s.HasPinnedStories = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field my_boost_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field my_boost_count: %w", err) } s.MyBoostCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field unrestrict_boost_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field unrestrict_boost_count: %w", err) } s.UnrestrictBoostCount = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field sticker_set_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field sticker_set_id: %w", err) } s.StickerSetID = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field custom_emoji_sticker_set_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field custom_emoji_sticker_set_id: %w", err) } s.CustomEmojiStickerSetID = value } { if err := s.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field location: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field location: %w", err) } } { if err := s.InviteLink.Decode(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field invite_link: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field invite_link: %w", err) } } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field bot_commands: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field bot_commands: %w", err) } if headerLen > 0 { @@ -696,22 +709,27 @@ 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#1ea45bb: field bot_commands: %w", err) + return fmt.Errorf("unable to decode bare supergroupFullInfo#f763d79d: field bot_commands: %w", err) } s.BotCommands = append(s.BotCommands, value) } } + { + if err := s.BotVerification.Decode(b); err != nil { + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field bot_verification: %w", err) + } + } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field upgraded_from_basic_group_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: 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#1ea45bb: field upgraded_from_max_message_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field upgraded_from_max_message_id: %w", err) } s.UpgradedFromMaxMessageID = value } @@ -721,14 +739,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#1ea45bb as nil") + return fmt.Errorf("can't encode supergroupFullInfo#f763d79d 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#1ea45bb: field photo: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#f763d79d: field photo: %w", err) } b.Comma() b.FieldStart("description") @@ -814,25 +832,30 @@ func (s *SupergroupFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("location") if err := s.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#1ea45bb: field location: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#f763d79d: 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#1ea45bb: field invite_link: %w", err) + return fmt.Errorf("unable to encode supergroupFullInfo#f763d79d: 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#1ea45bb: field bot_commands element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode supergroupFullInfo#f763d79d: field bot_commands element with index %d: %w", idx, err) } b.Comma() } b.StripComma() b.ArrEnd() b.Comma() + b.FieldStart("bot_verification") + if err := s.BotVerification.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode supergroupFullInfo#f763d79d: field bot_verification: %w", err) + } + b.Comma() b.FieldStart("upgraded_from_basic_group_id") b.PutInt53(s.UpgradedFromBasicGroupID) b.Comma() @@ -847,210 +870,214 @@ 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#1ea45bb to nil") + return fmt.Errorf("can't decode supergroupFullInfo#f763d79d 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#1ea45bb: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: %w", err) } case "photo": if err := s.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field photo: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field photo: %w", err) } case "description": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field description: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field description: %w", err) } s.Description = value case "member_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field member_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: 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#1ea45bb: field administrator_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: 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#1ea45bb: field restricted_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: 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#1ea45bb: field banned_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: 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#1ea45bb: field linked_chat_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: 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#1ea45bb: field slow_mode_delay: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: 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#1ea45bb: field slow_mode_delay_expires_in: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field slow_mode_delay_expires_in: %w", err) } s.SlowModeDelayExpiresIn = value case "can_enable_paid_reaction": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field can_enable_paid_reaction: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_enable_paid_reaction: %w", err) } s.CanEnablePaidReaction = value case "can_get_members": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field can_get_members: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: 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#1ea45bb: field has_hidden_members: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: 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#1ea45bb: field can_hide_members: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: 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#1ea45bb: field can_set_sticker_set: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: 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#1ea45bb: field can_set_location: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: 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#1ea45bb: field can_get_statistics: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_get_statistics: %w", err) } s.CanGetStatistics = value case "can_get_revenue_statistics": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field can_get_revenue_statistics: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_get_revenue_statistics: %w", err) } s.CanGetRevenueStatistics = value case "can_get_star_revenue_statistics": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field can_get_star_revenue_statistics: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_get_star_revenue_statistics: %w", err) } s.CanGetStarRevenueStatistics = value case "can_toggle_aggressive_anti_spam": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field can_toggle_aggressive_anti_spam: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: 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#1ea45bb: field is_all_history_available: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field is_all_history_available: %w", err) } s.IsAllHistoryAvailable = value case "can_have_sponsored_messages": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field can_have_sponsored_messages: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_have_sponsored_messages: %w", err) } s.CanHaveSponsoredMessages = value case "has_aggressive_anti_spam_enabled": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field has_aggressive_anti_spam_enabled: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field has_aggressive_anti_spam_enabled: %w", err) } s.HasAggressiveAntiSpamEnabled = value case "has_paid_media_allowed": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field has_paid_media_allowed: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field has_paid_media_allowed: %w", err) } s.HasPaidMediaAllowed = value case "has_pinned_stories": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field has_pinned_stories: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field has_pinned_stories: %w", err) } s.HasPinnedStories = value case "my_boost_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field my_boost_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field my_boost_count: %w", err) } s.MyBoostCount = value case "unrestrict_boost_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field unrestrict_boost_count: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field unrestrict_boost_count: %w", err) } s.UnrestrictBoostCount = value case "sticker_set_id": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field sticker_set_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field sticker_set_id: %w", err) } s.StickerSetID = value case "custom_emoji_sticker_set_id": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field custom_emoji_sticker_set_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field custom_emoji_sticker_set_id: %w", err) } s.CustomEmojiStickerSetID = value case "location": if err := s.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field location: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field location: %w", err) } case "invite_link": if err := s.InviteLink.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field invite_link: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: 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#1ea45bb: field bot_commands: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field bot_commands: %w", err) } s.BotCommands = append(s.BotCommands, value) return nil }); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field bot_commands: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field bot_commands: %w", err) + } + case "bot_verification": + if err := s.BotVerification.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field bot_verification: %w", err) } case "upgraded_from_basic_group_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#1ea45bb: field upgraded_from_basic_group_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: 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#1ea45bb: field upgraded_from_max_message_id: %w", err) + return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field upgraded_from_max_message_id: %w", err) } s.UpgradedFromMaxMessageID = value default: @@ -1308,6 +1335,14 @@ func (s *SupergroupFullInfo) GetBotCommands() (value []BotCommands) { return s.BotCommands } +// GetBotVerification returns value of BotVerification field. +func (s *SupergroupFullInfo) GetBotVerification() (value BotVerification) { + if s == nil { + return + } + return s.BotVerification +} + // GetUpgradedFromBasicGroupID returns value of UpgradedFromBasicGroupID field. func (s *SupergroupFullInfo) GetUpgradedFromBasicGroupID() (value int64) { if s == nil { diff --git a/tdapi/tl_supergroup_gen.go b/tdapi/tl_supergroup_gen.go index daae444437..e107ecf151 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#ca7c2ce`. +// Supergroup represents TL type `supergroup#9ebc0c42`. type Supergroup struct { // Supergroup or channel identifier ID int64 @@ -76,18 +76,15 @@ type Supergroup struct { IsBroadcastGroup bool // True, if the supergroup is a forum with topics IsForum bool - // True, if the supergroup or channel is verified - IsVerified bool + // Information about verification status of the supergroup or channel; may be null if + // none + VerificationStatus VerificationStatus // True, if content of media messages in the supergroup or channel chat must be hidden // with 18+ spoiler HasSensitiveContent bool // If non-empty, contains a human-readable description of the reason why access to this // supergroup or channel must be restricted RestrictionReason string - // True, if many users reported this supergroup or channel as a scam - IsScam bool - // True, if many users reported this supergroup or channel as a fake account - IsFake bool // True, if the supergroup or channel has non-expired stories available to the current // user HasActiveStories bool @@ -97,7 +94,7 @@ type Supergroup struct { } // SupergroupTypeID is TL type id of Supergroup. -const SupergroupTypeID = 0xca7c2ce +const SupergroupTypeID = 0x9ebc0c42 // Ensuring interfaces in compile-time for Supergroup. var ( @@ -159,7 +156,7 @@ func (s *Supergroup) Zero() bool { if !(s.IsForum == false) { return false } - if !(s.IsVerified == false) { + if !(s.VerificationStatus.Zero()) { return false } if !(s.HasSensitiveContent == false) { @@ -168,12 +165,6 @@ func (s *Supergroup) Zero() bool { if !(s.RestrictionReason == "") { return false } - if !(s.IsScam == false) { - return false - } - if !(s.IsFake == false) { - return false - } if !(s.HasActiveStories == false) { return false } @@ -281,8 +272,8 @@ func (s *Supergroup) TypeInfo() tdp.Type { SchemaName: "is_forum", }, { - Name: "IsVerified", - SchemaName: "is_verified", + Name: "VerificationStatus", + SchemaName: "verification_status", }, { Name: "HasSensitiveContent", @@ -292,14 +283,6 @@ func (s *Supergroup) TypeInfo() tdp.Type { Name: "RestrictionReason", SchemaName: "restriction_reason", }, - { - Name: "IsScam", - SchemaName: "is_scam", - }, - { - Name: "IsFake", - SchemaName: "is_fake", - }, { Name: "HasActiveStories", SchemaName: "has_active_stories", @@ -315,7 +298,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#ca7c2ce as nil") + return fmt.Errorf("can't encode supergroup#9ebc0c42 as nil") } b.PutID(SupergroupTypeID) return s.EncodeBare(b) @@ -324,18 +307,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#ca7c2ce as nil") + return fmt.Errorf("can't encode supergroup#9ebc0c42 as nil") } b.PutInt53(s.ID) if err := s.Usernames.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroup#ca7c2ce: field usernames: %w", err) + return fmt.Errorf("unable to encode supergroup#9ebc0c42: field usernames: %w", err) } b.PutInt32(s.Date) if s.Status == nil { - return fmt.Errorf("unable to encode supergroup#ca7c2ce: field status is nil") + return fmt.Errorf("unable to encode supergroup#9ebc0c42: field status is nil") } if err := s.Status.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroup#ca7c2ce: field status: %w", err) + return fmt.Errorf("unable to encode supergroup#9ebc0c42: field status: %w", err) } b.PutInt32(s.MemberCount) b.PutInt32(s.BoostLevel) @@ -349,11 +332,11 @@ func (s *Supergroup) EncodeBare(b *bin.Buffer) error { b.PutBool(s.IsChannel) b.PutBool(s.IsBroadcastGroup) b.PutBool(s.IsForum) - b.PutBool(s.IsVerified) + if err := s.VerificationStatus.Encode(b); err != nil { + return fmt.Errorf("unable to encode supergroup#9ebc0c42: field verification_status: %w", err) + } b.PutBool(s.HasSensitiveContent) b.PutString(s.RestrictionReason) - b.PutBool(s.IsScam) - b.PutBool(s.IsFake) b.PutBool(s.HasActiveStories) b.PutBool(s.HasUnreadActiveStories) return nil @@ -362,10 +345,10 @@ func (s *Supergroup) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *Supergroup) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode supergroup#ca7c2ce to nil") + return fmt.Errorf("can't decode supergroup#9ebc0c42 to nil") } if err := b.ConsumeID(SupergroupTypeID); err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: %w", err) } return s.DecodeBare(b) } @@ -373,164 +356,148 @@ 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#ca7c2ce to nil") + return fmt.Errorf("can't decode supergroup#9ebc0c42 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field id: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field id: %w", err) } s.ID = value } { if err := s.Usernames.Decode(b); err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field usernames: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field usernames: %w", err) } } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field date: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field date: %w", err) } s.Date = value } { value, err := DecodeChatMemberStatus(b) if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field status: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field status: %w", err) } s.Status = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field member_count: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field member_count: %w", err) } s.MemberCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field boost_level: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field boost_level: %w", err) } s.BoostLevel = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field has_linked_chat: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field has_linked_chat: %w", err) } s.HasLinkedChat = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field has_location: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field has_location: %w", err) } s.HasLocation = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field sign_messages: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field sign_messages: %w", err) } s.SignMessages = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field show_message_sender: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field show_message_sender: %w", err) } s.ShowMessageSender = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field join_to_send_messages: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field join_to_send_messages: %w", err) } s.JoinToSendMessages = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field join_by_request: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field join_by_request: %w", err) } s.JoinByRequest = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field is_slow_mode_enabled: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field is_slow_mode_enabled: %w", err) } s.IsSlowModeEnabled = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field is_channel: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field is_channel: %w", err) } s.IsChannel = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field is_broadcast_group: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field is_broadcast_group: %w", err) } s.IsBroadcastGroup = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field is_forum: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field is_forum: %w", err) } s.IsForum = value } { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field is_verified: %w", err) + if err := s.VerificationStatus.Decode(b); err != nil { + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field verification_status: %w", err) } - s.IsVerified = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field has_sensitive_content: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field has_sensitive_content: %w", err) } s.HasSensitiveContent = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field restriction_reason: %w", err) } s.RestrictionReason = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field is_scam: %w", err) - } - s.IsScam = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field is_fake: %w", err) - } - s.IsFake = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field has_active_stories: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field has_active_stories: %w", err) } s.HasActiveStories = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field has_unread_active_stories: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field has_unread_active_stories: %w", err) } s.HasUnreadActiveStories = value } @@ -540,7 +507,7 @@ func (s *Supergroup) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *Supergroup) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode supergroup#ca7c2ce as nil") + return fmt.Errorf("can't encode supergroup#9ebc0c42 as nil") } b.ObjStart() b.PutID("supergroup") @@ -550,7 +517,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#ca7c2ce: field usernames: %w", err) + return fmt.Errorf("unable to encode supergroup#9ebc0c42: field usernames: %w", err) } b.Comma() b.FieldStart("date") @@ -558,10 +525,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#ca7c2ce: field status is nil") + return fmt.Errorf("unable to encode supergroup#9ebc0c42: field status is nil") } if err := s.Status.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroup#ca7c2ce: field status: %w", err) + return fmt.Errorf("unable to encode supergroup#9ebc0c42: field status: %w", err) } b.Comma() b.FieldStart("member_count") @@ -600,8 +567,10 @@ func (s *Supergroup) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("is_forum") b.PutBool(s.IsForum) b.Comma() - b.FieldStart("is_verified") - b.PutBool(s.IsVerified) + b.FieldStart("verification_status") + if err := s.VerificationStatus.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode supergroup#9ebc0c42: field verification_status: %w", err) + } b.Comma() b.FieldStart("has_sensitive_content") b.PutBool(s.HasSensitiveContent) @@ -609,12 +578,6 @@ func (s *Supergroup) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("restriction_reason") b.PutString(s.RestrictionReason) b.Comma() - b.FieldStart("is_scam") - b.PutBool(s.IsScam) - b.Comma() - b.FieldStart("is_fake") - b.PutBool(s.IsFake) - b.Comma() b.FieldStart("has_active_stories") b.PutBool(s.HasActiveStories) b.Comma() @@ -629,149 +592,135 @@ 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#ca7c2ce to nil") + return fmt.Errorf("can't decode supergroup#9ebc0c42 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#ca7c2ce: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: %w", err) } case "id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field id: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field id: %w", err) } s.ID = value case "usernames": if err := s.Usernames.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field usernames: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field usernames: %w", err) } case "date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field date: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field date: %w", err) } s.Date = value case "status": value, err := DecodeTDLibJSONChatMemberStatus(b) if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field status: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field status: %w", err) } s.Status = value case "member_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field member_count: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field member_count: %w", err) } s.MemberCount = value case "boost_level": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field boost_level: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field boost_level: %w", err) } s.BoostLevel = value case "has_linked_chat": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field has_linked_chat: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: 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#ca7c2ce: field has_location: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: 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#ca7c2ce: field sign_messages: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field sign_messages: %w", err) } s.SignMessages = value case "show_message_sender": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field show_message_sender: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field show_message_sender: %w", err) } s.ShowMessageSender = value case "join_to_send_messages": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field join_to_send_messages: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: 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#ca7c2ce: field join_by_request: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: 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#ca7c2ce: field is_slow_mode_enabled: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: 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#ca7c2ce: field is_channel: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: 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#ca7c2ce: field is_broadcast_group: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: 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#ca7c2ce: field is_forum: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: 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#ca7c2ce: field is_verified: %w", err) + case "verification_status": + if err := s.VerificationStatus.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field verification_status: %w", err) } - s.IsVerified = value case "has_sensitive_content": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field has_sensitive_content: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field has_sensitive_content: %w", err) } s.HasSensitiveContent = value case "restriction_reason": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode supergroup#ca7c2ce: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: 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#ca7c2ce: 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#ca7c2ce: 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#ca7c2ce: field has_active_stories: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: 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#ca7c2ce: field has_unread_active_stories: %w", err) + return fmt.Errorf("unable to decode supergroup#9ebc0c42: field has_unread_active_stories: %w", err) } s.HasUnreadActiveStories = value default: @@ -909,12 +858,12 @@ func (s *Supergroup) GetIsForum() (value bool) { return s.IsForum } -// GetIsVerified returns value of IsVerified field. -func (s *Supergroup) GetIsVerified() (value bool) { +// GetVerificationStatus returns value of VerificationStatus field. +func (s *Supergroup) GetVerificationStatus() (value VerificationStatus) { if s == nil { return } - return s.IsVerified + return s.VerificationStatus } // GetHasSensitiveContent returns value of HasSensitiveContent field. @@ -933,22 +882,6 @@ func (s *Supergroup) GetRestrictionReason() (value string) { return s.RestrictionReason } -// GetIsScam returns value of IsScam field. -func (s *Supergroup) GetIsScam() (value bool) { - if s == nil { - return - } - return s.IsScam -} - -// GetIsFake returns value of IsFake field. -func (s *Supergroup) GetIsFake() (value bool) { - if s == nil { - return - } - return s.IsFake -} - // GetHasActiveStories returns value of HasActiveStories field. func (s *Supergroup) GetHasActiveStories() (value bool) { if s == nil { diff --git a/tdapi/tl_transfer_gift_gen.go b/tdapi/tl_transfer_gift_gen.go new file mode 100644 index 0000000000..238979990f --- /dev/null +++ b/tdapi/tl_transfer_gift_gen.go @@ -0,0 +1,305 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// TransferGiftRequest represents TL type `transferGift#7f379a4e`. +type TransferGiftRequest struct { + // Identifier of the user that sent the gift + SenderUserID int64 + // Identifier of the message with the upgraded gift in the chat with the user + MessageID int64 + // Identifier of the user that will receive the gift + ReceiverUserID int64 + // The amount of Telegram Stars required for the transfer + StarCount int64 +} + +// TransferGiftRequestTypeID is TL type id of TransferGiftRequest. +const TransferGiftRequestTypeID = 0x7f379a4e + +// Ensuring interfaces in compile-time for TransferGiftRequest. +var ( + _ bin.Encoder = &TransferGiftRequest{} + _ bin.Decoder = &TransferGiftRequest{} + _ bin.BareEncoder = &TransferGiftRequest{} + _ bin.BareDecoder = &TransferGiftRequest{} +) + +func (t *TransferGiftRequest) Zero() bool { + if t == nil { + return true + } + if !(t.SenderUserID == 0) { + return false + } + if !(t.MessageID == 0) { + return false + } + if !(t.ReceiverUserID == 0) { + return false + } + if !(t.StarCount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *TransferGiftRequest) String() string { + if t == nil { + return "TransferGiftRequest(nil)" + } + type Alias TransferGiftRequest + return fmt.Sprintf("TransferGiftRequest%+v", Alias(*t)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*TransferGiftRequest) TypeID() uint32 { + return TransferGiftRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*TransferGiftRequest) TypeName() string { + return "transferGift" +} + +// TypeInfo returns info about TL type. +func (t *TransferGiftRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "transferGift", + ID: TransferGiftRequestTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "SenderUserID", + SchemaName: "sender_user_id", + }, + { + Name: "MessageID", + SchemaName: "message_id", + }, + { + Name: "ReceiverUserID", + SchemaName: "receiver_user_id", + }, + { + Name: "StarCount", + SchemaName: "star_count", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *TransferGiftRequest) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode transferGift#7f379a4e as nil") + } + b.PutID(TransferGiftRequestTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *TransferGiftRequest) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode transferGift#7f379a4e as nil") + } + b.PutInt53(t.SenderUserID) + b.PutInt53(t.MessageID) + b.PutInt53(t.ReceiverUserID) + b.PutInt53(t.StarCount) + return nil +} + +// Decode implements bin.Decoder. +func (t *TransferGiftRequest) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode transferGift#7f379a4e to nil") + } + if err := b.ConsumeID(TransferGiftRequestTypeID); err != nil { + return fmt.Errorf("unable to decode transferGift#7f379a4e: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *TransferGiftRequest) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode transferGift#7f379a4e to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode transferGift#7f379a4e: field sender_user_id: %w", err) + } + t.SenderUserID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode transferGift#7f379a4e: field message_id: %w", err) + } + t.MessageID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode transferGift#7f379a4e: field receiver_user_id: %w", err) + } + t.ReceiverUserID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode transferGift#7f379a4e: field star_count: %w", err) + } + t.StarCount = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (t *TransferGiftRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if t == nil { + return fmt.Errorf("can't encode transferGift#7f379a4e as nil") + } + b.ObjStart() + b.PutID("transferGift") + b.Comma() + b.FieldStart("sender_user_id") + b.PutInt53(t.SenderUserID) + b.Comma() + b.FieldStart("message_id") + b.PutInt53(t.MessageID) + b.Comma() + b.FieldStart("receiver_user_id") + b.PutInt53(t.ReceiverUserID) + b.Comma() + b.FieldStart("star_count") + b.PutInt53(t.StarCount) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (t *TransferGiftRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if t == nil { + return fmt.Errorf("can't decode transferGift#7f379a4e to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("transferGift"); err != nil { + return fmt.Errorf("unable to decode transferGift#7f379a4e: %w", err) + } + case "sender_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode transferGift#7f379a4e: field sender_user_id: %w", err) + } + t.SenderUserID = value + case "message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode transferGift#7f379a4e: field message_id: %w", err) + } + t.MessageID = value + case "receiver_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode transferGift#7f379a4e: field receiver_user_id: %w", err) + } + t.ReceiverUserID = value + case "star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode transferGift#7f379a4e: field star_count: %w", err) + } + t.StarCount = value + default: + return b.Skip() + } + return nil + }) +} + +// GetSenderUserID returns value of SenderUserID field. +func (t *TransferGiftRequest) GetSenderUserID() (value int64) { + if t == nil { + return + } + return t.SenderUserID +} + +// GetMessageID returns value of MessageID field. +func (t *TransferGiftRequest) GetMessageID() (value int64) { + if t == nil { + return + } + return t.MessageID +} + +// GetReceiverUserID returns value of ReceiverUserID field. +func (t *TransferGiftRequest) GetReceiverUserID() (value int64) { + if t == nil { + return + } + return t.ReceiverUserID +} + +// GetStarCount returns value of StarCount field. +func (t *TransferGiftRequest) GetStarCount() (value int64) { + if t == nil { + return + } + return t.StarCount +} + +// TransferGift invokes method transferGift#7f379a4e returning error if any. +func (c *Client) TransferGift(ctx context.Context, request *TransferGiftRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_upgrade_gift_gen.go b/tdapi/tl_upgrade_gift_gen.go new file mode 100644 index 0000000000..542c008b17 --- /dev/null +++ b/tdapi/tl_upgrade_gift_gen.go @@ -0,0 +1,271 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// UpgradeGiftRequest represents TL type `upgradeGift#e0c0953e`. +type UpgradeGiftRequest struct { + // Identifier of the user that sent the gift + SenderUserID int64 + // Identifier of the message with the gift in the chat with the user + MessageID int64 + // Pass true to keep the original gift text, sender and receiver in the upgraded gift + KeepOriginalDetails bool +} + +// UpgradeGiftRequestTypeID is TL type id of UpgradeGiftRequest. +const UpgradeGiftRequestTypeID = 0xe0c0953e + +// Ensuring interfaces in compile-time for UpgradeGiftRequest. +var ( + _ bin.Encoder = &UpgradeGiftRequest{} + _ bin.Decoder = &UpgradeGiftRequest{} + _ bin.BareEncoder = &UpgradeGiftRequest{} + _ bin.BareDecoder = &UpgradeGiftRequest{} +) + +func (u *UpgradeGiftRequest) Zero() bool { + if u == nil { + return true + } + if !(u.SenderUserID == 0) { + return false + } + if !(u.MessageID == 0) { + return false + } + if !(u.KeepOriginalDetails == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpgradeGiftRequest) String() string { + if u == nil { + return "UpgradeGiftRequest(nil)" + } + type Alias UpgradeGiftRequest + return fmt.Sprintf("UpgradeGiftRequest%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpgradeGiftRequest) TypeID() uint32 { + return UpgradeGiftRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpgradeGiftRequest) TypeName() string { + return "upgradeGift" +} + +// TypeInfo returns info about TL type. +func (u *UpgradeGiftRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "upgradeGift", + ID: UpgradeGiftRequestTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "SenderUserID", + SchemaName: "sender_user_id", + }, + { + Name: "MessageID", + SchemaName: "message_id", + }, + { + Name: "KeepOriginalDetails", + SchemaName: "keep_original_details", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpgradeGiftRequest) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode upgradeGift#e0c0953e as nil") + } + b.PutID(UpgradeGiftRequestTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpgradeGiftRequest) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode upgradeGift#e0c0953e as nil") + } + b.PutInt53(u.SenderUserID) + b.PutInt53(u.MessageID) + b.PutBool(u.KeepOriginalDetails) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpgradeGiftRequest) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode upgradeGift#e0c0953e to nil") + } + if err := b.ConsumeID(UpgradeGiftRequestTypeID); err != nil { + return fmt.Errorf("unable to decode upgradeGift#e0c0953e: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpgradeGiftRequest) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode upgradeGift#e0c0953e to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode upgradeGift#e0c0953e: field sender_user_id: %w", err) + } + u.SenderUserID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode upgradeGift#e0c0953e: field message_id: %w", err) + } + u.MessageID = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode upgradeGift#e0c0953e: field keep_original_details: %w", err) + } + u.KeepOriginalDetails = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpgradeGiftRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode upgradeGift#e0c0953e as nil") + } + b.ObjStart() + b.PutID("upgradeGift") + b.Comma() + b.FieldStart("sender_user_id") + b.PutInt53(u.SenderUserID) + b.Comma() + b.FieldStart("message_id") + b.PutInt53(u.MessageID) + b.Comma() + b.FieldStart("keep_original_details") + b.PutBool(u.KeepOriginalDetails) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpgradeGiftRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode upgradeGift#e0c0953e to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("upgradeGift"); err != nil { + return fmt.Errorf("unable to decode upgradeGift#e0c0953e: %w", err) + } + case "sender_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode upgradeGift#e0c0953e: field sender_user_id: %w", err) + } + u.SenderUserID = value + case "message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode upgradeGift#e0c0953e: field message_id: %w", err) + } + u.MessageID = value + case "keep_original_details": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode upgradeGift#e0c0953e: field keep_original_details: %w", err) + } + u.KeepOriginalDetails = value + default: + return b.Skip() + } + return nil + }) +} + +// GetSenderUserID returns value of SenderUserID field. +func (u *UpgradeGiftRequest) GetSenderUserID() (value int64) { + if u == nil { + return + } + return u.SenderUserID +} + +// GetMessageID returns value of MessageID field. +func (u *UpgradeGiftRequest) GetMessageID() (value int64) { + if u == nil { + return + } + return u.MessageID +} + +// GetKeepOriginalDetails returns value of KeepOriginalDetails field. +func (u *UpgradeGiftRequest) GetKeepOriginalDetails() (value bool) { + if u == nil { + return + } + return u.KeepOriginalDetails +} + +// UpgradeGift invokes method upgradeGift#e0c0953e returning error if any. +func (c *Client) UpgradeGift(ctx context.Context, request *UpgradeGiftRequest) (*UpgradeGiftResult, error) { + var result UpgradeGiftResult + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_upgrade_gift_result_gen.go b/tdapi/tl_upgrade_gift_result_gen.go new file mode 100644 index 0000000000..1c7679d920 --- /dev/null +++ b/tdapi/tl_upgrade_gift_result_gen.go @@ -0,0 +1,330 @@ +// 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{} +) + +// UpgradeGiftResult represents TL type `upgradeGiftResult#3d9e8331`. +type UpgradeGiftResult struct { + // The upgraded gift + Gift UpgradedGift + // True, if the gift is displayed on the user's profile page + IsSaved bool + // True, if the gift can be transferred to another user + CanBeTransferred bool + // Number of Telegram Stars that must be paid to transfer the upgraded gift + TransferStarCount int64 + // Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as + // an NFT + ExportDate int32 +} + +// UpgradeGiftResultTypeID is TL type id of UpgradeGiftResult. +const UpgradeGiftResultTypeID = 0x3d9e8331 + +// Ensuring interfaces in compile-time for UpgradeGiftResult. +var ( + _ bin.Encoder = &UpgradeGiftResult{} + _ bin.Decoder = &UpgradeGiftResult{} + _ bin.BareEncoder = &UpgradeGiftResult{} + _ bin.BareDecoder = &UpgradeGiftResult{} +) + +func (u *UpgradeGiftResult) Zero() bool { + if u == nil { + return true + } + if !(u.Gift.Zero()) { + return false + } + if !(u.IsSaved == false) { + return false + } + if !(u.CanBeTransferred == false) { + return false + } + if !(u.TransferStarCount == 0) { + return false + } + if !(u.ExportDate == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpgradeGiftResult) String() string { + if u == nil { + return "UpgradeGiftResult(nil)" + } + type Alias UpgradeGiftResult + return fmt.Sprintf("UpgradeGiftResult%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpgradeGiftResult) TypeID() uint32 { + return UpgradeGiftResultTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpgradeGiftResult) TypeName() string { + return "upgradeGiftResult" +} + +// TypeInfo returns info about TL type. +func (u *UpgradeGiftResult) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "upgradeGiftResult", + ID: UpgradeGiftResultTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Gift", + SchemaName: "gift", + }, + { + Name: "IsSaved", + SchemaName: "is_saved", + }, + { + Name: "CanBeTransferred", + SchemaName: "can_be_transferred", + }, + { + Name: "TransferStarCount", + SchemaName: "transfer_star_count", + }, + { + Name: "ExportDate", + SchemaName: "export_date", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpgradeGiftResult) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode upgradeGiftResult#3d9e8331 as nil") + } + b.PutID(UpgradeGiftResultTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpgradeGiftResult) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode upgradeGiftResult#3d9e8331 as nil") + } + if err := u.Gift.Encode(b); err != nil { + return fmt.Errorf("unable to encode upgradeGiftResult#3d9e8331: field gift: %w", err) + } + b.PutBool(u.IsSaved) + b.PutBool(u.CanBeTransferred) + b.PutInt53(u.TransferStarCount) + b.PutInt32(u.ExportDate) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpgradeGiftResult) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode upgradeGiftResult#3d9e8331 to nil") + } + if err := b.ConsumeID(UpgradeGiftResultTypeID); err != nil { + return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpgradeGiftResult) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode upgradeGiftResult#3d9e8331 to nil") + } + { + if err := u.Gift.Decode(b); err != nil { + return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: field gift: %w", err) + } + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: field is_saved: %w", err) + } + u.IsSaved = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: field can_be_transferred: %w", err) + } + u.CanBeTransferred = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: field transfer_star_count: %w", err) + } + u.TransferStarCount = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: field export_date: %w", err) + } + u.ExportDate = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpgradeGiftResult) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode upgradeGiftResult#3d9e8331 as nil") + } + b.ObjStart() + b.PutID("upgradeGiftResult") + b.Comma() + b.FieldStart("gift") + if err := u.Gift.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode upgradeGiftResult#3d9e8331: field gift: %w", err) + } + b.Comma() + b.FieldStart("is_saved") + b.PutBool(u.IsSaved) + b.Comma() + b.FieldStart("can_be_transferred") + b.PutBool(u.CanBeTransferred) + b.Comma() + b.FieldStart("transfer_star_count") + b.PutInt53(u.TransferStarCount) + b.Comma() + b.FieldStart("export_date") + b.PutInt32(u.ExportDate) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpgradeGiftResult) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode upgradeGiftResult#3d9e8331 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("upgradeGiftResult"); err != nil { + return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: %w", err) + } + case "gift": + if err := u.Gift.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: field gift: %w", err) + } + case "is_saved": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: field is_saved: %w", err) + } + u.IsSaved = value + case "can_be_transferred": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: field can_be_transferred: %w", err) + } + u.CanBeTransferred = value + case "transfer_star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: field transfer_star_count: %w", err) + } + u.TransferStarCount = value + case "export_date": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: field export_date: %w", err) + } + u.ExportDate = value + default: + return b.Skip() + } + return nil + }) +} + +// GetGift returns value of Gift field. +func (u *UpgradeGiftResult) GetGift() (value UpgradedGift) { + if u == nil { + return + } + return u.Gift +} + +// GetIsSaved returns value of IsSaved field. +func (u *UpgradeGiftResult) GetIsSaved() (value bool) { + if u == nil { + return + } + return u.IsSaved +} + +// GetCanBeTransferred returns value of CanBeTransferred field. +func (u *UpgradeGiftResult) GetCanBeTransferred() (value bool) { + if u == nil { + return + } + return u.CanBeTransferred +} + +// GetTransferStarCount returns value of TransferStarCount field. +func (u *UpgradeGiftResult) GetTransferStarCount() (value int64) { + if u == nil { + return + } + return u.TransferStarCount +} + +// GetExportDate returns value of ExportDate field. +func (u *UpgradeGiftResult) GetExportDate() (value int32) { + if u == nil { + return + } + return u.ExportDate +} diff --git a/tdapi/tl_upgraded_gift_backdrop_gen.go b/tdapi/tl_upgraded_gift_backdrop_gen.go new file mode 100644 index 0000000000..4f38486379 --- /dev/null +++ b/tdapi/tl_upgraded_gift_backdrop_gen.go @@ -0,0 +1,363 @@ +// 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{} +) + +// UpgradedGiftBackdrop represents TL type `upgradedGiftBackdrop#fc371c7e`. +type UpgradedGiftBackdrop struct { + // Name of the backdrop + Name string + // A color in the center of the backdrop in the RGB format + CenterColor int32 + // A color on the edges of the backdrop in the RGB format + EdgeColor int32 + // A color to be applied for the symbol in the RGB format + SymbolColor int32 + // A color for the text on the backdrop in the RGB format + TextColor int32 + // The number of upgraded gift that receive this backdrop for each 1000 gifts upgraded + RarityPerMille int32 +} + +// UpgradedGiftBackdropTypeID is TL type id of UpgradedGiftBackdrop. +const UpgradedGiftBackdropTypeID = 0xfc371c7e + +// Ensuring interfaces in compile-time for UpgradedGiftBackdrop. +var ( + _ bin.Encoder = &UpgradedGiftBackdrop{} + _ bin.Decoder = &UpgradedGiftBackdrop{} + _ bin.BareEncoder = &UpgradedGiftBackdrop{} + _ bin.BareDecoder = &UpgradedGiftBackdrop{} +) + +func (u *UpgradedGiftBackdrop) Zero() bool { + if u == nil { + return true + } + if !(u.Name == "") { + return false + } + if !(u.CenterColor == 0) { + return false + } + if !(u.EdgeColor == 0) { + return false + } + if !(u.SymbolColor == 0) { + return false + } + if !(u.TextColor == 0) { + return false + } + if !(u.RarityPerMille == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpgradedGiftBackdrop) String() string { + if u == nil { + return "UpgradedGiftBackdrop(nil)" + } + type Alias UpgradedGiftBackdrop + return fmt.Sprintf("UpgradedGiftBackdrop%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpgradedGiftBackdrop) TypeID() uint32 { + return UpgradedGiftBackdropTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpgradedGiftBackdrop) TypeName() string { + return "upgradedGiftBackdrop" +} + +// TypeInfo returns info about TL type. +func (u *UpgradedGiftBackdrop) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "upgradedGiftBackdrop", + ID: UpgradedGiftBackdropTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Name", + SchemaName: "name", + }, + { + Name: "CenterColor", + SchemaName: "center_color", + }, + { + Name: "EdgeColor", + SchemaName: "edge_color", + }, + { + Name: "SymbolColor", + SchemaName: "symbol_color", + }, + { + Name: "TextColor", + SchemaName: "text_color", + }, + { + Name: "RarityPerMille", + SchemaName: "rarity_per_mille", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpgradedGiftBackdrop) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode upgradedGiftBackdrop#fc371c7e as nil") + } + b.PutID(UpgradedGiftBackdropTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpgradedGiftBackdrop) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode upgradedGiftBackdrop#fc371c7e as nil") + } + b.PutString(u.Name) + b.PutInt32(u.CenterColor) + b.PutInt32(u.EdgeColor) + b.PutInt32(u.SymbolColor) + b.PutInt32(u.TextColor) + b.PutInt32(u.RarityPerMille) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpgradedGiftBackdrop) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode upgradedGiftBackdrop#fc371c7e to nil") + } + if err := b.ConsumeID(UpgradedGiftBackdropTypeID); err != nil { + return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpgradedGiftBackdrop) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode upgradedGiftBackdrop#fc371c7e to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field name: %w", err) + } + u.Name = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field center_color: %w", err) + } + u.CenterColor = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field edge_color: %w", err) + } + u.EdgeColor = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field symbol_color: %w", err) + } + u.SymbolColor = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field text_color: %w", err) + } + u.TextColor = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field rarity_per_mille: %w", err) + } + u.RarityPerMille = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpgradedGiftBackdrop) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode upgradedGiftBackdrop#fc371c7e as nil") + } + b.ObjStart() + b.PutID("upgradedGiftBackdrop") + b.Comma() + b.FieldStart("name") + b.PutString(u.Name) + b.Comma() + b.FieldStart("center_color") + b.PutInt32(u.CenterColor) + b.Comma() + b.FieldStart("edge_color") + b.PutInt32(u.EdgeColor) + b.Comma() + b.FieldStart("symbol_color") + b.PutInt32(u.SymbolColor) + b.Comma() + b.FieldStart("text_color") + b.PutInt32(u.TextColor) + b.Comma() + b.FieldStart("rarity_per_mille") + b.PutInt32(u.RarityPerMille) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpgradedGiftBackdrop) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode upgradedGiftBackdrop#fc371c7e to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("upgradedGiftBackdrop"); err != nil { + return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: %w", err) + } + case "name": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field name: %w", err) + } + u.Name = value + case "center_color": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field center_color: %w", err) + } + u.CenterColor = value + case "edge_color": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field edge_color: %w", err) + } + u.EdgeColor = value + case "symbol_color": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field symbol_color: %w", err) + } + u.SymbolColor = value + case "text_color": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field text_color: %w", err) + } + u.TextColor = value + case "rarity_per_mille": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field rarity_per_mille: %w", err) + } + u.RarityPerMille = value + default: + return b.Skip() + } + return nil + }) +} + +// GetName returns value of Name field. +func (u *UpgradedGiftBackdrop) GetName() (value string) { + if u == nil { + return + } + return u.Name +} + +// GetCenterColor returns value of CenterColor field. +func (u *UpgradedGiftBackdrop) GetCenterColor() (value int32) { + if u == nil { + return + } + return u.CenterColor +} + +// GetEdgeColor returns value of EdgeColor field. +func (u *UpgradedGiftBackdrop) GetEdgeColor() (value int32) { + if u == nil { + return + } + return u.EdgeColor +} + +// GetSymbolColor returns value of SymbolColor field. +func (u *UpgradedGiftBackdrop) GetSymbolColor() (value int32) { + if u == nil { + return + } + return u.SymbolColor +} + +// GetTextColor returns value of TextColor field. +func (u *UpgradedGiftBackdrop) GetTextColor() (value int32) { + if u == nil { + return + } + return u.TextColor +} + +// GetRarityPerMille returns value of RarityPerMille field. +func (u *UpgradedGiftBackdrop) GetRarityPerMille() (value int32) { + if u == nil { + return + } + return u.RarityPerMille +} diff --git a/tdapi/tl_upgraded_gift_gen.go b/tdapi/tl_upgraded_gift_gen.go new file mode 100644 index 0000000000..31453be9cb --- /dev/null +++ b/tdapi/tl_upgraded_gift_gen.go @@ -0,0 +1,499 @@ +// 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{} +) + +// UpgradedGift represents TL type `upgradedGift#e5f50e98`. +type UpgradedGift struct { + // Unique identifier of the gift + ID int64 + // The title of the upgraded gift + Title string + // Unique number of the upgraded gift among gifts upgraded from the same gift + Number int32 + // Total number of gifts that were upgraded from the same gift + TotalUpgradedCount int32 + // The maximum number of gifts that can be upgraded from the same gift + MaxUpgradedCount int32 + // User identifier of the user that owns the upgraded gift; 0 if none + OwnerUserID int64 + // Model of the upgraded gift + Model UpgradedGiftModel + // Symbol of the upgraded gift + Symbol UpgradedGiftSymbol + // Backdrop of the upgraded gift + Backdrop UpgradedGiftBackdrop + // Information about the originally sent gift; may be null if unknown + OriginalDetails UpgradedGiftOriginalDetails +} + +// UpgradedGiftTypeID is TL type id of UpgradedGift. +const UpgradedGiftTypeID = 0xe5f50e98 + +// Ensuring interfaces in compile-time for UpgradedGift. +var ( + _ bin.Encoder = &UpgradedGift{} + _ bin.Decoder = &UpgradedGift{} + _ bin.BareEncoder = &UpgradedGift{} + _ bin.BareDecoder = &UpgradedGift{} +) + +func (u *UpgradedGift) Zero() bool { + if u == nil { + return true + } + if !(u.ID == 0) { + return false + } + if !(u.Title == "") { + return false + } + if !(u.Number == 0) { + return false + } + if !(u.TotalUpgradedCount == 0) { + return false + } + if !(u.MaxUpgradedCount == 0) { + return false + } + if !(u.OwnerUserID == 0) { + return false + } + if !(u.Model.Zero()) { + return false + } + if !(u.Symbol.Zero()) { + return false + } + if !(u.Backdrop.Zero()) { + return false + } + if !(u.OriginalDetails.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpgradedGift) String() string { + if u == nil { + return "UpgradedGift(nil)" + } + type Alias UpgradedGift + return fmt.Sprintf("UpgradedGift%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpgradedGift) TypeID() uint32 { + return UpgradedGiftTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpgradedGift) TypeName() string { + return "upgradedGift" +} + +// TypeInfo returns info about TL type. +func (u *UpgradedGift) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "upgradedGift", + ID: UpgradedGiftTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ID", + SchemaName: "id", + }, + { + Name: "Title", + SchemaName: "title", + }, + { + Name: "Number", + SchemaName: "number", + }, + { + Name: "TotalUpgradedCount", + SchemaName: "total_upgraded_count", + }, + { + Name: "MaxUpgradedCount", + SchemaName: "max_upgraded_count", + }, + { + Name: "OwnerUserID", + SchemaName: "owner_user_id", + }, + { + Name: "Model", + SchemaName: "model", + }, + { + Name: "Symbol", + SchemaName: "symbol", + }, + { + Name: "Backdrop", + SchemaName: "backdrop", + }, + { + Name: "OriginalDetails", + SchemaName: "original_details", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpgradedGift) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode upgradedGift#e5f50e98 as nil") + } + b.PutID(UpgradedGiftTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpgradedGift) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode upgradedGift#e5f50e98 as nil") + } + b.PutLong(u.ID) + b.PutString(u.Title) + b.PutInt32(u.Number) + b.PutInt32(u.TotalUpgradedCount) + b.PutInt32(u.MaxUpgradedCount) + b.PutInt53(u.OwnerUserID) + if err := u.Model.Encode(b); err != nil { + return fmt.Errorf("unable to encode upgradedGift#e5f50e98: field model: %w", err) + } + if err := u.Symbol.Encode(b); err != nil { + return fmt.Errorf("unable to encode upgradedGift#e5f50e98: field symbol: %w", err) + } + if err := u.Backdrop.Encode(b); err != nil { + return fmt.Errorf("unable to encode upgradedGift#e5f50e98: field backdrop: %w", err) + } + if err := u.OriginalDetails.Encode(b); err != nil { + return fmt.Errorf("unable to encode upgradedGift#e5f50e98: field original_details: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (u *UpgradedGift) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode upgradedGift#e5f50e98 to nil") + } + if err := b.ConsumeID(UpgradedGiftTypeID); err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpgradedGift) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode upgradedGift#e5f50e98 to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field id: %w", err) + } + u.ID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field title: %w", err) + } + u.Title = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field number: %w", err) + } + u.Number = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field total_upgraded_count: %w", err) + } + u.TotalUpgradedCount = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field max_upgraded_count: %w", err) + } + u.MaxUpgradedCount = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field owner_user_id: %w", err) + } + u.OwnerUserID = value + } + { + if err := u.Model.Decode(b); err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field model: %w", err) + } + } + { + if err := u.Symbol.Decode(b); err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field symbol: %w", err) + } + } + { + if err := u.Backdrop.Decode(b); err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field backdrop: %w", err) + } + } + { + if err := u.OriginalDetails.Decode(b); err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field original_details: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpgradedGift) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode upgradedGift#e5f50e98 as nil") + } + b.ObjStart() + b.PutID("upgradedGift") + b.Comma() + b.FieldStart("id") + b.PutLong(u.ID) + b.Comma() + b.FieldStart("title") + b.PutString(u.Title) + b.Comma() + b.FieldStart("number") + b.PutInt32(u.Number) + b.Comma() + b.FieldStart("total_upgraded_count") + b.PutInt32(u.TotalUpgradedCount) + b.Comma() + b.FieldStart("max_upgraded_count") + b.PutInt32(u.MaxUpgradedCount) + b.Comma() + b.FieldStart("owner_user_id") + b.PutInt53(u.OwnerUserID) + b.Comma() + b.FieldStart("model") + if err := u.Model.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode upgradedGift#e5f50e98: field model: %w", err) + } + b.Comma() + b.FieldStart("symbol") + if err := u.Symbol.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode upgradedGift#e5f50e98: field symbol: %w", err) + } + b.Comma() + b.FieldStart("backdrop") + if err := u.Backdrop.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode upgradedGift#e5f50e98: field backdrop: %w", err) + } + b.Comma() + b.FieldStart("original_details") + if err := u.OriginalDetails.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode upgradedGift#e5f50e98: field original_details: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpgradedGift) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode upgradedGift#e5f50e98 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("upgradedGift"); err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: %w", err) + } + case "id": + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field id: %w", err) + } + u.ID = value + case "title": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field title: %w", err) + } + u.Title = value + case "number": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field number: %w", err) + } + u.Number = value + case "total_upgraded_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field total_upgraded_count: %w", err) + } + u.TotalUpgradedCount = value + case "max_upgraded_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field max_upgraded_count: %w", err) + } + u.MaxUpgradedCount = value + case "owner_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field owner_user_id: %w", err) + } + u.OwnerUserID = value + case "model": + if err := u.Model.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field model: %w", err) + } + case "symbol": + if err := u.Symbol.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field symbol: %w", err) + } + case "backdrop": + if err := u.Backdrop.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field backdrop: %w", err) + } + case "original_details": + if err := u.OriginalDetails.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field original_details: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetID returns value of ID field. +func (u *UpgradedGift) GetID() (value int64) { + if u == nil { + return + } + return u.ID +} + +// GetTitle returns value of Title field. +func (u *UpgradedGift) GetTitle() (value string) { + if u == nil { + return + } + return u.Title +} + +// GetNumber returns value of Number field. +func (u *UpgradedGift) GetNumber() (value int32) { + if u == nil { + return + } + return u.Number +} + +// GetTotalUpgradedCount returns value of TotalUpgradedCount field. +func (u *UpgradedGift) GetTotalUpgradedCount() (value int32) { + if u == nil { + return + } + return u.TotalUpgradedCount +} + +// GetMaxUpgradedCount returns value of MaxUpgradedCount field. +func (u *UpgradedGift) GetMaxUpgradedCount() (value int32) { + if u == nil { + return + } + return u.MaxUpgradedCount +} + +// GetOwnerUserID returns value of OwnerUserID field. +func (u *UpgradedGift) GetOwnerUserID() (value int64) { + if u == nil { + return + } + return u.OwnerUserID +} + +// GetModel returns value of Model field. +func (u *UpgradedGift) GetModel() (value UpgradedGiftModel) { + if u == nil { + return + } + return u.Model +} + +// GetSymbol returns value of Symbol field. +func (u *UpgradedGift) GetSymbol() (value UpgradedGiftSymbol) { + if u == nil { + return + } + return u.Symbol +} + +// GetBackdrop returns value of Backdrop field. +func (u *UpgradedGift) GetBackdrop() (value UpgradedGiftBackdrop) { + if u == nil { + return + } + return u.Backdrop +} + +// GetOriginalDetails returns value of OriginalDetails field. +func (u *UpgradedGift) GetOriginalDetails() (value UpgradedGiftOriginalDetails) { + if u == nil { + return + } + return u.OriginalDetails +} diff --git a/tdapi/tl_upgraded_gift_model_gen.go b/tdapi/tl_upgraded_gift_model_gen.go new file mode 100644 index 0000000000..4178585da5 --- /dev/null +++ b/tdapi/tl_upgraded_gift_model_gen.go @@ -0,0 +1,261 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// UpgradedGiftModel represents TL type `upgradedGiftModel#5112584f`. +type UpgradedGiftModel struct { + // Name of the model + Name string + // The sticker representing the upgraded gift + Sticker Sticker + // The number of upgraded gift that receive this model for each 1000 gifts upgraded + RarityPerMille int32 +} + +// UpgradedGiftModelTypeID is TL type id of UpgradedGiftModel. +const UpgradedGiftModelTypeID = 0x5112584f + +// Ensuring interfaces in compile-time for UpgradedGiftModel. +var ( + _ bin.Encoder = &UpgradedGiftModel{} + _ bin.Decoder = &UpgradedGiftModel{} + _ bin.BareEncoder = &UpgradedGiftModel{} + _ bin.BareDecoder = &UpgradedGiftModel{} +) + +func (u *UpgradedGiftModel) Zero() bool { + if u == nil { + return true + } + if !(u.Name == "") { + return false + } + if !(u.Sticker.Zero()) { + return false + } + if !(u.RarityPerMille == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpgradedGiftModel) String() string { + if u == nil { + return "UpgradedGiftModel(nil)" + } + type Alias UpgradedGiftModel + return fmt.Sprintf("UpgradedGiftModel%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpgradedGiftModel) TypeID() uint32 { + return UpgradedGiftModelTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpgradedGiftModel) TypeName() string { + return "upgradedGiftModel" +} + +// TypeInfo returns info about TL type. +func (u *UpgradedGiftModel) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "upgradedGiftModel", + ID: UpgradedGiftModelTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Name", + SchemaName: "name", + }, + { + Name: "Sticker", + SchemaName: "sticker", + }, + { + Name: "RarityPerMille", + SchemaName: "rarity_per_mille", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpgradedGiftModel) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode upgradedGiftModel#5112584f as nil") + } + b.PutID(UpgradedGiftModelTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpgradedGiftModel) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode upgradedGiftModel#5112584f as nil") + } + b.PutString(u.Name) + if err := u.Sticker.Encode(b); err != nil { + return fmt.Errorf("unable to encode upgradedGiftModel#5112584f: field sticker: %w", err) + } + b.PutInt32(u.RarityPerMille) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpgradedGiftModel) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode upgradedGiftModel#5112584f to nil") + } + if err := b.ConsumeID(UpgradedGiftModelTypeID); err != nil { + return fmt.Errorf("unable to decode upgradedGiftModel#5112584f: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpgradedGiftModel) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode upgradedGiftModel#5112584f to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftModel#5112584f: field name: %w", err) + } + u.Name = value + } + { + if err := u.Sticker.Decode(b); err != nil { + return fmt.Errorf("unable to decode upgradedGiftModel#5112584f: field sticker: %w", err) + } + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftModel#5112584f: field rarity_per_mille: %w", err) + } + u.RarityPerMille = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpgradedGiftModel) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode upgradedGiftModel#5112584f as nil") + } + b.ObjStart() + b.PutID("upgradedGiftModel") + b.Comma() + b.FieldStart("name") + b.PutString(u.Name) + b.Comma() + b.FieldStart("sticker") + if err := u.Sticker.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode upgradedGiftModel#5112584f: field sticker: %w", err) + } + b.Comma() + b.FieldStart("rarity_per_mille") + b.PutInt32(u.RarityPerMille) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpgradedGiftModel) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode upgradedGiftModel#5112584f to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("upgradedGiftModel"); err != nil { + return fmt.Errorf("unable to decode upgradedGiftModel#5112584f: %w", err) + } + case "name": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftModel#5112584f: field name: %w", err) + } + u.Name = value + case "sticker": + if err := u.Sticker.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode upgradedGiftModel#5112584f: field sticker: %w", err) + } + case "rarity_per_mille": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftModel#5112584f: field rarity_per_mille: %w", err) + } + u.RarityPerMille = value + default: + return b.Skip() + } + return nil + }) +} + +// GetName returns value of Name field. +func (u *UpgradedGiftModel) GetName() (value string) { + if u == nil { + return + } + return u.Name +} + +// GetSticker returns value of Sticker field. +func (u *UpgradedGiftModel) GetSticker() (value Sticker) { + if u == nil { + return + } + return u.Sticker +} + +// GetRarityPerMille returns value of RarityPerMille field. +func (u *UpgradedGiftModel) GetRarityPerMille() (value int32) { + if u == nil { + return + } + return u.RarityPerMille +} diff --git a/tdapi/tl_upgraded_gift_original_details_gen.go b/tdapi/tl_upgraded_gift_original_details_gen.go new file mode 100644 index 0000000000..5e6ead7b96 --- /dev/null +++ b/tdapi/tl_upgraded_gift_original_details_gen.go @@ -0,0 +1,295 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// UpgradedGiftOriginalDetails represents TL type `upgradedGiftOriginalDetails#44d2b2dd`. +type UpgradedGiftOriginalDetails struct { + // Identifier of the user that sent the gift; 0 if the gift was private + SenderUserID int64 + // Identifier of the user that received the gift + ReceiverUserID int64 + // Message added to the gift + Text FormattedText + // Point in time (Unix timestamp) when the gift was sent + Date int32 +} + +// UpgradedGiftOriginalDetailsTypeID is TL type id of UpgradedGiftOriginalDetails. +const UpgradedGiftOriginalDetailsTypeID = 0x44d2b2dd + +// Ensuring interfaces in compile-time for UpgradedGiftOriginalDetails. +var ( + _ bin.Encoder = &UpgradedGiftOriginalDetails{} + _ bin.Decoder = &UpgradedGiftOriginalDetails{} + _ bin.BareEncoder = &UpgradedGiftOriginalDetails{} + _ bin.BareDecoder = &UpgradedGiftOriginalDetails{} +) + +func (u *UpgradedGiftOriginalDetails) Zero() bool { + if u == nil { + return true + } + if !(u.SenderUserID == 0) { + return false + } + if !(u.ReceiverUserID == 0) { + return false + } + if !(u.Text.Zero()) { + return false + } + if !(u.Date == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpgradedGiftOriginalDetails) String() string { + if u == nil { + return "UpgradedGiftOriginalDetails(nil)" + } + type Alias UpgradedGiftOriginalDetails + return fmt.Sprintf("UpgradedGiftOriginalDetails%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpgradedGiftOriginalDetails) TypeID() uint32 { + return UpgradedGiftOriginalDetailsTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpgradedGiftOriginalDetails) TypeName() string { + return "upgradedGiftOriginalDetails" +} + +// TypeInfo returns info about TL type. +func (u *UpgradedGiftOriginalDetails) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "upgradedGiftOriginalDetails", + ID: UpgradedGiftOriginalDetailsTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "SenderUserID", + SchemaName: "sender_user_id", + }, + { + Name: "ReceiverUserID", + SchemaName: "receiver_user_id", + }, + { + Name: "Text", + SchemaName: "text", + }, + { + Name: "Date", + SchemaName: "date", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpgradedGiftOriginalDetails) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode upgradedGiftOriginalDetails#44d2b2dd as nil") + } + b.PutID(UpgradedGiftOriginalDetailsTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpgradedGiftOriginalDetails) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode upgradedGiftOriginalDetails#44d2b2dd as nil") + } + b.PutInt53(u.SenderUserID) + b.PutInt53(u.ReceiverUserID) + if err := u.Text.Encode(b); err != nil { + return fmt.Errorf("unable to encode upgradedGiftOriginalDetails#44d2b2dd: field text: %w", err) + } + b.PutInt32(u.Date) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpgradedGiftOriginalDetails) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode upgradedGiftOriginalDetails#44d2b2dd to nil") + } + if err := b.ConsumeID(UpgradedGiftOriginalDetailsTypeID); err != nil { + return fmt.Errorf("unable to decode upgradedGiftOriginalDetails#44d2b2dd: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpgradedGiftOriginalDetails) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode upgradedGiftOriginalDetails#44d2b2dd to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftOriginalDetails#44d2b2dd: field sender_user_id: %w", err) + } + u.SenderUserID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftOriginalDetails#44d2b2dd: field receiver_user_id: %w", err) + } + u.ReceiverUserID = value + } + { + if err := u.Text.Decode(b); err != nil { + return fmt.Errorf("unable to decode upgradedGiftOriginalDetails#44d2b2dd: field text: %w", err) + } + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftOriginalDetails#44d2b2dd: field date: %w", err) + } + u.Date = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpgradedGiftOriginalDetails) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode upgradedGiftOriginalDetails#44d2b2dd as nil") + } + b.ObjStart() + b.PutID("upgradedGiftOriginalDetails") + b.Comma() + b.FieldStart("sender_user_id") + b.PutInt53(u.SenderUserID) + b.Comma() + b.FieldStart("receiver_user_id") + b.PutInt53(u.ReceiverUserID) + b.Comma() + b.FieldStart("text") + if err := u.Text.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode upgradedGiftOriginalDetails#44d2b2dd: field text: %w", err) + } + b.Comma() + b.FieldStart("date") + b.PutInt32(u.Date) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpgradedGiftOriginalDetails) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode upgradedGiftOriginalDetails#44d2b2dd to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("upgradedGiftOriginalDetails"); err != nil { + return fmt.Errorf("unable to decode upgradedGiftOriginalDetails#44d2b2dd: %w", err) + } + case "sender_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftOriginalDetails#44d2b2dd: field sender_user_id: %w", err) + } + u.SenderUserID = value + case "receiver_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftOriginalDetails#44d2b2dd: field receiver_user_id: %w", err) + } + u.ReceiverUserID = value + case "text": + if err := u.Text.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode upgradedGiftOriginalDetails#44d2b2dd: field text: %w", err) + } + case "date": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftOriginalDetails#44d2b2dd: field date: %w", err) + } + u.Date = value + default: + return b.Skip() + } + return nil + }) +} + +// GetSenderUserID returns value of SenderUserID field. +func (u *UpgradedGiftOriginalDetails) GetSenderUserID() (value int64) { + if u == nil { + return + } + return u.SenderUserID +} + +// GetReceiverUserID returns value of ReceiverUserID field. +func (u *UpgradedGiftOriginalDetails) GetReceiverUserID() (value int64) { + if u == nil { + return + } + return u.ReceiverUserID +} + +// GetText returns value of Text field. +func (u *UpgradedGiftOriginalDetails) GetText() (value FormattedText) { + if u == nil { + return + } + return u.Text +} + +// GetDate returns value of Date field. +func (u *UpgradedGiftOriginalDetails) GetDate() (value int32) { + if u == nil { + return + } + return u.Date +} diff --git a/tdapi/tl_upgraded_gift_symbol_gen.go b/tdapi/tl_upgraded_gift_symbol_gen.go new file mode 100644 index 0000000000..601305aaa0 --- /dev/null +++ b/tdapi/tl_upgraded_gift_symbol_gen.go @@ -0,0 +1,261 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// UpgradedGiftSymbol represents TL type `upgradedGiftSymbol#4340c5af`. +type UpgradedGiftSymbol struct { + // Name of the symbol + Name string + // The sticker representing the upgraded gift + Sticker Sticker + // The number of upgraded gift that receive this symbol for each 1000 gifts upgraded + RarityPerMille int32 +} + +// UpgradedGiftSymbolTypeID is TL type id of UpgradedGiftSymbol. +const UpgradedGiftSymbolTypeID = 0x4340c5af + +// Ensuring interfaces in compile-time for UpgradedGiftSymbol. +var ( + _ bin.Encoder = &UpgradedGiftSymbol{} + _ bin.Decoder = &UpgradedGiftSymbol{} + _ bin.BareEncoder = &UpgradedGiftSymbol{} + _ bin.BareDecoder = &UpgradedGiftSymbol{} +) + +func (u *UpgradedGiftSymbol) Zero() bool { + if u == nil { + return true + } + if !(u.Name == "") { + return false + } + if !(u.Sticker.Zero()) { + return false + } + if !(u.RarityPerMille == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpgradedGiftSymbol) String() string { + if u == nil { + return "UpgradedGiftSymbol(nil)" + } + type Alias UpgradedGiftSymbol + return fmt.Sprintf("UpgradedGiftSymbol%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpgradedGiftSymbol) TypeID() uint32 { + return UpgradedGiftSymbolTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpgradedGiftSymbol) TypeName() string { + return "upgradedGiftSymbol" +} + +// TypeInfo returns info about TL type. +func (u *UpgradedGiftSymbol) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "upgradedGiftSymbol", + ID: UpgradedGiftSymbolTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Name", + SchemaName: "name", + }, + { + Name: "Sticker", + SchemaName: "sticker", + }, + { + Name: "RarityPerMille", + SchemaName: "rarity_per_mille", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpgradedGiftSymbol) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode upgradedGiftSymbol#4340c5af as nil") + } + b.PutID(UpgradedGiftSymbolTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpgradedGiftSymbol) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode upgradedGiftSymbol#4340c5af as nil") + } + b.PutString(u.Name) + if err := u.Sticker.Encode(b); err != nil { + return fmt.Errorf("unable to encode upgradedGiftSymbol#4340c5af: field sticker: %w", err) + } + b.PutInt32(u.RarityPerMille) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpgradedGiftSymbol) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode upgradedGiftSymbol#4340c5af to nil") + } + if err := b.ConsumeID(UpgradedGiftSymbolTypeID); err != nil { + return fmt.Errorf("unable to decode upgradedGiftSymbol#4340c5af: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpgradedGiftSymbol) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode upgradedGiftSymbol#4340c5af to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftSymbol#4340c5af: field name: %w", err) + } + u.Name = value + } + { + if err := u.Sticker.Decode(b); err != nil { + return fmt.Errorf("unable to decode upgradedGiftSymbol#4340c5af: field sticker: %w", err) + } + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftSymbol#4340c5af: field rarity_per_mille: %w", err) + } + u.RarityPerMille = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpgradedGiftSymbol) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode upgradedGiftSymbol#4340c5af as nil") + } + b.ObjStart() + b.PutID("upgradedGiftSymbol") + b.Comma() + b.FieldStart("name") + b.PutString(u.Name) + b.Comma() + b.FieldStart("sticker") + if err := u.Sticker.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode upgradedGiftSymbol#4340c5af: field sticker: %w", err) + } + b.Comma() + b.FieldStart("rarity_per_mille") + b.PutInt32(u.RarityPerMille) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpgradedGiftSymbol) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode upgradedGiftSymbol#4340c5af to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("upgradedGiftSymbol"); err != nil { + return fmt.Errorf("unable to decode upgradedGiftSymbol#4340c5af: %w", err) + } + case "name": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftSymbol#4340c5af: field name: %w", err) + } + u.Name = value + case "sticker": + if err := u.Sticker.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode upgradedGiftSymbol#4340c5af: field sticker: %w", err) + } + case "rarity_per_mille": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode upgradedGiftSymbol#4340c5af: field rarity_per_mille: %w", err) + } + u.RarityPerMille = value + default: + return b.Skip() + } + return nil + }) +} + +// GetName returns value of Name field. +func (u *UpgradedGiftSymbol) GetName() (value string) { + if u == nil { + return + } + return u.Name +} + +// GetSticker returns value of Sticker field. +func (u *UpgradedGiftSymbol) GetSticker() (value Sticker) { + if u == nil { + return + } + return u.Sticker +} + +// GetRarityPerMille returns value of RarityPerMille field. +func (u *UpgradedGiftSymbol) GetRarityPerMille() (value int32) { + if u == nil { + return + } + return u.RarityPerMille +} diff --git a/tdapi/tl_user_full_info_gen.go b/tdapi/tl_user_full_info_gen.go index 42293eae3c..3b767fa21d 100644 --- a/tdapi/tl_user_full_info_gen.go +++ b/tdapi/tl_user_full_info_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// UserFullInfo represents TL type `userFullInfo#85d0c905`. +// UserFullInfo represents TL type `userFullInfo#ae9201c2`. type UserFullInfo struct { // User profile photo set by the current user for the contact; may be null. If null and // user.profile_photo is null, then the photo is empty; otherwise, it is unknown. @@ -75,6 +75,9 @@ type UserFullInfo struct { // Number of group chats where both the other user and the current user are a member; 0 // for the current user GroupInCommonCount int32 + // Information about verification status of the user provided by a bot; may be null if + // none or unknown + BotVerification BotVerification // Information about business settings for Telegram Business accounts; may be null if // none BusinessInfo BusinessInfo @@ -83,7 +86,7 @@ type UserFullInfo struct { } // UserFullInfoTypeID is TL type id of UserFullInfo. -const UserFullInfoTypeID = 0x85d0c905 +const UserFullInfoTypeID = 0xae9201c2 // Ensuring interfaces in compile-time for UserFullInfo. var ( @@ -151,6 +154,9 @@ func (u *UserFullInfo) Zero() bool { if !(u.GroupInCommonCount == 0) { return false } + if !(u.BotVerification.Zero()) { + return false + } if !(u.BusinessInfo.Zero()) { return false } @@ -265,6 +271,10 @@ func (u *UserFullInfo) TypeInfo() tdp.Type { Name: "GroupInCommonCount", SchemaName: "group_in_common_count", }, + { + Name: "BotVerification", + SchemaName: "bot_verification", + }, { Name: "BusinessInfo", SchemaName: "business_info", @@ -280,7 +290,7 @@ func (u *UserFullInfo) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (u *UserFullInfo) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode userFullInfo#85d0c905 as nil") + return fmt.Errorf("can't encode userFullInfo#ae9201c2 as nil") } b.PutID(UserFullInfoTypeID) return u.EncodeBare(b) @@ -289,22 +299,22 @@ func (u *UserFullInfo) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *UserFullInfo) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode userFullInfo#85d0c905 as nil") + return fmt.Errorf("can't encode userFullInfo#ae9201c2 as nil") } if err := u.PersonalPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#85d0c905: field personal_photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field personal_photo: %w", err) } if err := u.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#85d0c905: field photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field photo: %w", err) } if err := u.PublicPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#85d0c905: field public_photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field public_photo: %w", err) } if u.BlockList == nil { - return fmt.Errorf("unable to encode userFullInfo#85d0c905: field block_list is nil") + return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field block_list is nil") } if err := u.BlockList.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#85d0c905: field block_list: %w", err) + return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field block_list: %w", err) } b.PutBool(u.CanBeCalled) b.PutBool(u.SupportsVideoCalls) @@ -316,19 +326,22 @@ func (u *UserFullInfo) EncodeBare(b *bin.Buffer) error { b.PutBool(u.NeedPhoneNumberPrivacyException) b.PutBool(u.SetChatBackground) if err := u.Bio.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#85d0c905: field bio: %w", err) + return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field bio: %w", err) } if err := u.Birthdate.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#85d0c905: field birthdate: %w", err) + return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field birthdate: %w", err) } b.PutInt53(u.PersonalChatID) b.PutInt32(u.GiftCount) b.PutInt32(u.GroupInCommonCount) + if err := u.BotVerification.Encode(b); err != nil { + return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field bot_verification: %w", err) + } if err := u.BusinessInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#85d0c905: field business_info: %w", err) + return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field business_info: %w", err) } if err := u.BotInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#85d0c905: field bot_info: %w", err) + return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field bot_info: %w", err) } return nil } @@ -336,10 +349,10 @@ func (u *UserFullInfo) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (u *UserFullInfo) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode userFullInfo#85d0c905 to nil") + return fmt.Errorf("can't decode userFullInfo#ae9201c2 to nil") } if err := b.ConsumeID(UserFullInfoTypeID); err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: %w", err) } return u.DecodeBare(b) } @@ -347,132 +360,137 @@ func (u *UserFullInfo) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *UserFullInfo) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode userFullInfo#85d0c905 to nil") + return fmt.Errorf("can't decode userFullInfo#ae9201c2 to nil") } { if err := u.PersonalPhoto.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field personal_photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field personal_photo: %w", err) } } { if err := u.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field photo: %w", err) } } { if err := u.PublicPhoto.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field public_photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field public_photo: %w", err) } } { value, err := DecodeBlockList(b) if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field block_list: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field block_list: %w", err) } u.BlockList = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field can_be_called: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field can_be_called: %w", err) } u.CanBeCalled = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field supports_video_calls: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field supports_video_calls: %w", err) } u.SupportsVideoCalls = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field has_private_calls: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field has_private_calls: %w", err) } u.HasPrivateCalls = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field has_private_forwards: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field has_private_forwards: %w", err) } u.HasPrivateForwards = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field has_restricted_voice_and_video_note_messages: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field has_restricted_voice_and_video_note_messages: %w", err) } u.HasRestrictedVoiceAndVideoNoteMessages = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field has_posted_to_profile_stories: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field has_posted_to_profile_stories: %w", err) } u.HasPostedToProfileStories = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field has_sponsored_messages_enabled: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field has_sponsored_messages_enabled: %w", err) } u.HasSponsoredMessagesEnabled = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field need_phone_number_privacy_exception: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field need_phone_number_privacy_exception: %w", err) } u.NeedPhoneNumberPrivacyException = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field set_chat_background: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field set_chat_background: %w", err) } u.SetChatBackground = value } { if err := u.Bio.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field bio: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field bio: %w", err) } } { if err := u.Birthdate.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field birthdate: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field birthdate: %w", err) } } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field personal_chat_id: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field personal_chat_id: %w", err) } u.PersonalChatID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field gift_count: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field gift_count: %w", err) } u.GiftCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field group_in_common_count: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field group_in_common_count: %w", err) } u.GroupInCommonCount = value } + { + if err := u.BotVerification.Decode(b); err != nil { + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field bot_verification: %w", err) + } + } { if err := u.BusinessInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field business_info: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field business_info: %w", err) } } { if err := u.BotInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field bot_info: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field bot_info: %w", err) } } return nil @@ -481,32 +499,32 @@ func (u *UserFullInfo) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UserFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode userFullInfo#85d0c905 as nil") + return fmt.Errorf("can't encode userFullInfo#ae9201c2 as nil") } b.ObjStart() b.PutID("userFullInfo") b.Comma() b.FieldStart("personal_photo") if err := u.PersonalPhoto.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#85d0c905: field personal_photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field personal_photo: %w", err) } b.Comma() b.FieldStart("photo") if err := u.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#85d0c905: field photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field photo: %w", err) } b.Comma() b.FieldStart("public_photo") if err := u.PublicPhoto.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#85d0c905: field public_photo: %w", err) + return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field public_photo: %w", err) } b.Comma() b.FieldStart("block_list") if u.BlockList == nil { - return fmt.Errorf("unable to encode userFullInfo#85d0c905: field block_list is nil") + return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field block_list is nil") } if err := u.BlockList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#85d0c905: field block_list: %w", err) + return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field block_list: %w", err) } b.Comma() b.FieldStart("can_be_called") @@ -538,12 +556,12 @@ func (u *UserFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("bio") if err := u.Bio.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#85d0c905: field bio: %w", err) + return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field bio: %w", err) } b.Comma() b.FieldStart("birthdate") if err := u.Birthdate.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#85d0c905: field birthdate: %w", err) + return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field birthdate: %w", err) } b.Comma() b.FieldStart("personal_chat_id") @@ -555,14 +573,19 @@ func (u *UserFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("group_in_common_count") b.PutInt32(u.GroupInCommonCount) b.Comma() + b.FieldStart("bot_verification") + if err := u.BotVerification.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field bot_verification: %w", err) + } + b.Comma() b.FieldStart("business_info") if err := u.BusinessInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#85d0c905: field business_info: %w", err) + return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field business_info: %w", err) } b.Comma() b.FieldStart("bot_info") if err := u.BotInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#85d0c905: field bot_info: %w", err) + return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field bot_info: %w", err) } b.Comma() b.StripComma() @@ -573,120 +596,124 @@ func (u *UserFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UserFullInfo) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode userFullInfo#85d0c905 to nil") + return fmt.Errorf("can't decode userFullInfo#ae9201c2 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("userFullInfo"); err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: %w", err) } case "personal_photo": if err := u.PersonalPhoto.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field personal_photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field personal_photo: %w", err) } case "photo": if err := u.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field photo: %w", err) } case "public_photo": if err := u.PublicPhoto.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field public_photo: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field public_photo: %w", err) } case "block_list": value, err := DecodeTDLibJSONBlockList(b) if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field block_list: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field block_list: %w", err) } u.BlockList = value case "can_be_called": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field can_be_called: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field can_be_called: %w", err) } u.CanBeCalled = value case "supports_video_calls": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field supports_video_calls: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field supports_video_calls: %w", err) } u.SupportsVideoCalls = value case "has_private_calls": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field has_private_calls: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field has_private_calls: %w", err) } u.HasPrivateCalls = value case "has_private_forwards": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field has_private_forwards: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field has_private_forwards: %w", err) } u.HasPrivateForwards = value case "has_restricted_voice_and_video_note_messages": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field has_restricted_voice_and_video_note_messages: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field has_restricted_voice_and_video_note_messages: %w", err) } u.HasRestrictedVoiceAndVideoNoteMessages = value case "has_posted_to_profile_stories": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field has_posted_to_profile_stories: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field has_posted_to_profile_stories: %w", err) } u.HasPostedToProfileStories = value case "has_sponsored_messages_enabled": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field has_sponsored_messages_enabled: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field has_sponsored_messages_enabled: %w", err) } u.HasSponsoredMessagesEnabled = value case "need_phone_number_privacy_exception": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field need_phone_number_privacy_exception: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field need_phone_number_privacy_exception: %w", err) } u.NeedPhoneNumberPrivacyException = value case "set_chat_background": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field set_chat_background: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field set_chat_background: %w", err) } u.SetChatBackground = value case "bio": if err := u.Bio.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field bio: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field bio: %w", err) } case "birthdate": if err := u.Birthdate.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field birthdate: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field birthdate: %w", err) } case "personal_chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field personal_chat_id: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field personal_chat_id: %w", err) } u.PersonalChatID = value case "gift_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field gift_count: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field gift_count: %w", err) } u.GiftCount = value case "group_in_common_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field group_in_common_count: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field group_in_common_count: %w", err) } u.GroupInCommonCount = value + case "bot_verification": + if err := u.BotVerification.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field bot_verification: %w", err) + } case "business_info": if err := u.BusinessInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field business_info: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field business_info: %w", err) } case "bot_info": if err := u.BotInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#85d0c905: field bot_info: %w", err) + return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field bot_info: %w", err) } default: return b.Skip() @@ -839,6 +866,14 @@ func (u *UserFullInfo) GetGroupInCommonCount() (value int32) { return u.GroupInCommonCount } +// GetBotVerification returns value of BotVerification field. +func (u *UserFullInfo) GetBotVerification() (value BotVerification) { + if u == nil { + return + } + return u.BotVerification +} + // GetBusinessInfo returns value of BusinessInfo field. func (u *UserFullInfo) GetBusinessInfo() (value BusinessInfo) { if u == nil { diff --git a/tdapi/tl_user_gen.go b/tdapi/tl_user_gen.go index 50308df8b5..c674531b16 100644 --- a/tdapi/tl_user_gen.go +++ b/tdapi/tl_user_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// User represents TL type `user#18552c62`. +// User represents TL type `user#598c3933`. type User struct { // User identifier ID int64 @@ -67,8 +67,8 @@ type User struct { IsMutualContact bool // The user is a close friend of the current user; implies that the user is a contact IsCloseFriend bool - // True, if the user is verified - IsVerified bool + // Information about verification status of the user; may be null if none + VerificationStatus VerificationStatus // True, if the user is a Telegram Premium user IsPremium bool // True, if the user is Telegram support account @@ -76,10 +76,6 @@ type User struct { // If non-empty, it contains a human-readable description of the reason why access to // this user must be restricted RestrictionReason string - // True, if many users reported this user as a scam - IsScam bool - // True, if many users reported this user as a fake account - IsFake bool // True, if the user has non-expired stories available to the current user HasActiveStories bool // True, if the user has unread non-expired stories available to the current user @@ -100,7 +96,7 @@ type User struct { } // UserTypeID is TL type id of User. -const UserTypeID = 0x18552c62 +const UserTypeID = 0x598c3933 // Ensuring interfaces in compile-time for User. var ( @@ -159,7 +155,7 @@ func (u *User) Zero() bool { if !(u.IsCloseFriend == false) { return false } - if !(u.IsVerified == false) { + if !(u.VerificationStatus.Zero()) { return false } if !(u.IsPremium == false) { @@ -171,12 +167,6 @@ func (u *User) Zero() bool { if !(u.RestrictionReason == "") { return false } - if !(u.IsScam == false) { - return false - } - if !(u.IsFake == false) { - return false - } if !(u.HasActiveStories == false) { return false } @@ -295,8 +285,8 @@ func (u *User) TypeInfo() tdp.Type { SchemaName: "is_close_friend", }, { - Name: "IsVerified", - SchemaName: "is_verified", + Name: "VerificationStatus", + SchemaName: "verification_status", }, { Name: "IsPremium", @@ -310,14 +300,6 @@ func (u *User) TypeInfo() tdp.Type { Name: "RestrictionReason", SchemaName: "restriction_reason", }, - { - Name: "IsScam", - SchemaName: "is_scam", - }, - { - Name: "IsFake", - SchemaName: "is_fake", - }, { Name: "HasActiveStories", SchemaName: "has_active_stories", @@ -353,7 +335,7 @@ func (u *User) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (u *User) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode user#18552c62 as nil") + return fmt.Errorf("can't encode user#598c3933 as nil") } b.PutID(UserTypeID) return u.EncodeBare(b) @@ -362,49 +344,49 @@ func (u *User) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *User) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode user#18552c62 as nil") + return fmt.Errorf("can't encode user#598c3933 as nil") } b.PutInt53(u.ID) b.PutString(u.FirstName) b.PutString(u.LastName) if err := u.Usernames.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#18552c62: field usernames: %w", err) + return fmt.Errorf("unable to encode user#598c3933: field usernames: %w", err) } b.PutString(u.PhoneNumber) if u.Status == nil { - return fmt.Errorf("unable to encode user#18552c62: field status is nil") + return fmt.Errorf("unable to encode user#598c3933: field status is nil") } if err := u.Status.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#18552c62: field status: %w", err) + return fmt.Errorf("unable to encode user#598c3933: field status: %w", err) } if err := u.ProfilePhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#18552c62: field profile_photo: %w", err) + return fmt.Errorf("unable to encode user#598c3933: field profile_photo: %w", err) } b.PutInt32(u.AccentColorID) b.PutLong(u.BackgroundCustomEmojiID) b.PutInt32(u.ProfileAccentColorID) b.PutLong(u.ProfileBackgroundCustomEmojiID) if err := u.EmojiStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#18552c62: field emoji_status: %w", err) + return fmt.Errorf("unable to encode user#598c3933: field emoji_status: %w", err) } b.PutBool(u.IsContact) b.PutBool(u.IsMutualContact) b.PutBool(u.IsCloseFriend) - b.PutBool(u.IsVerified) + if err := u.VerificationStatus.Encode(b); err != nil { + return fmt.Errorf("unable to encode user#598c3933: field verification_status: %w", err) + } b.PutBool(u.IsPremium) b.PutBool(u.IsSupport) b.PutString(u.RestrictionReason) - b.PutBool(u.IsScam) - b.PutBool(u.IsFake) b.PutBool(u.HasActiveStories) b.PutBool(u.HasUnreadActiveStories) b.PutBool(u.RestrictsNewChats) b.PutBool(u.HaveAccess) if u.Type == nil { - return fmt.Errorf("unable to encode user#18552c62: field type is nil") + return fmt.Errorf("unable to encode user#598c3933: field type is nil") } if err := u.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#18552c62: field type: %w", err) + return fmt.Errorf("unable to encode user#598c3933: field type: %w", err) } b.PutString(u.LanguageCode) b.PutBool(u.AddedToAttachmentMenu) @@ -414,10 +396,10 @@ func (u *User) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (u *User) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode user#18552c62 to nil") + return fmt.Errorf("can't decode user#598c3933 to nil") } if err := b.ConsumeID(UserTypeID); err != nil { - return fmt.Errorf("unable to decode user#18552c62: %w", err) + return fmt.Errorf("unable to decode user#598c3933: %w", err) } return u.DecodeBare(b) } @@ -425,195 +407,179 @@ func (u *User) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *User) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode user#18552c62 to nil") + return fmt.Errorf("can't decode user#598c3933 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field id: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field id: %w", err) } u.ID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field first_name: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field first_name: %w", err) } u.FirstName = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field last_name: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field last_name: %w", err) } u.LastName = value } { if err := u.Usernames.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#18552c62: field usernames: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field usernames: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field phone_number: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field phone_number: %w", err) } u.PhoneNumber = value } { value, err := DecodeUserStatus(b) if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field status: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field status: %w", err) } u.Status = value } { if err := u.ProfilePhoto.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#18552c62: field profile_photo: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field profile_photo: %w", err) } } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field accent_color_id: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field accent_color_id: %w", err) } u.AccentColorID = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field background_custom_emoji_id: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field background_custom_emoji_id: %w", err) } u.BackgroundCustomEmojiID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field profile_accent_color_id: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field profile_accent_color_id: %w", err) } u.ProfileAccentColorID = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field profile_background_custom_emoji_id: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field profile_background_custom_emoji_id: %w", err) } u.ProfileBackgroundCustomEmojiID = value } { if err := u.EmojiStatus.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#18552c62: field emoji_status: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field emoji_status: %w", err) } } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field is_contact: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field is_contact: %w", err) } u.IsContact = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field is_mutual_contact: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field is_mutual_contact: %w", err) } u.IsMutualContact = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field is_close_friend: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field is_close_friend: %w", err) } u.IsCloseFriend = value } { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field is_verified: %w", err) + if err := u.VerificationStatus.Decode(b); err != nil { + return fmt.Errorf("unable to decode user#598c3933: field verification_status: %w", err) } - u.IsVerified = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field is_premium: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field is_premium: %w", err) } u.IsPremium = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field is_support: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field is_support: %w", err) } u.IsSupport = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field restriction_reason: %w", err) } u.RestrictionReason = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field is_scam: %w", err) - } - u.IsScam = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field is_fake: %w", err) - } - u.IsFake = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field has_active_stories: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field has_active_stories: %w", err) } u.HasActiveStories = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field has_unread_active_stories: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field has_unread_active_stories: %w", err) } u.HasUnreadActiveStories = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field restricts_new_chats: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field restricts_new_chats: %w", err) } u.RestrictsNewChats = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field have_access: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field have_access: %w", err) } u.HaveAccess = value } { value, err := DecodeUserType(b) if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field type: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field type: %w", err) } u.Type = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field language_code: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field language_code: %w", err) } u.LanguageCode = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field added_to_attachment_menu: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field added_to_attachment_menu: %w", err) } u.AddedToAttachmentMenu = value } @@ -623,7 +589,7 @@ func (u *User) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode user#18552c62 as nil") + return fmt.Errorf("can't encode user#598c3933 as nil") } b.ObjStart() b.PutID("user") @@ -639,7 +605,7 @@ func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("usernames") if err := u.Usernames.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#18552c62: field usernames: %w", err) + return fmt.Errorf("unable to encode user#598c3933: field usernames: %w", err) } b.Comma() b.FieldStart("phone_number") @@ -647,15 +613,15 @@ func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("status") if u.Status == nil { - return fmt.Errorf("unable to encode user#18552c62: field status is nil") + return fmt.Errorf("unable to encode user#598c3933: field status is nil") } if err := u.Status.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#18552c62: field status: %w", err) + return fmt.Errorf("unable to encode user#598c3933: field status: %w", err) } b.Comma() b.FieldStart("profile_photo") if err := u.ProfilePhoto.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#18552c62: field profile_photo: %w", err) + return fmt.Errorf("unable to encode user#598c3933: field profile_photo: %w", err) } b.Comma() b.FieldStart("accent_color_id") @@ -672,7 +638,7 @@ func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("emoji_status") if err := u.EmojiStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#18552c62: field emoji_status: %w", err) + return fmt.Errorf("unable to encode user#598c3933: field emoji_status: %w", err) } b.Comma() b.FieldStart("is_contact") @@ -684,8 +650,10 @@ func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("is_close_friend") b.PutBool(u.IsCloseFriend) b.Comma() - b.FieldStart("is_verified") - b.PutBool(u.IsVerified) + b.FieldStart("verification_status") + if err := u.VerificationStatus.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode user#598c3933: field verification_status: %w", err) + } b.Comma() b.FieldStart("is_premium") b.PutBool(u.IsPremium) @@ -696,12 +664,6 @@ func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("restriction_reason") b.PutString(u.RestrictionReason) b.Comma() - b.FieldStart("is_scam") - b.PutBool(u.IsScam) - b.Comma() - b.FieldStart("is_fake") - b.PutBool(u.IsFake) - b.Comma() b.FieldStart("has_active_stories") b.PutBool(u.HasActiveStories) b.Comma() @@ -716,10 +678,10 @@ func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("type") if u.Type == nil { - return fmt.Errorf("unable to encode user#18552c62: field type is nil") + return fmt.Errorf("unable to encode user#598c3933: field type is nil") } if err := u.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#18552c62: field type: %w", err) + return fmt.Errorf("unable to encode user#598c3933: field type: %w", err) } b.Comma() b.FieldStart("language_code") @@ -736,175 +698,161 @@ func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *User) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode user#18552c62 to nil") + return fmt.Errorf("can't decode user#598c3933 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("user"); err != nil { - return fmt.Errorf("unable to decode user#18552c62: %w", err) + return fmt.Errorf("unable to decode user#598c3933: %w", err) } case "id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field id: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field id: %w", err) } u.ID = value case "first_name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field first_name: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field first_name: %w", err) } u.FirstName = value case "last_name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field last_name: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field last_name: %w", err) } u.LastName = value case "usernames": if err := u.Usernames.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode user#18552c62: field usernames: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field usernames: %w", err) } case "phone_number": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field phone_number: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field phone_number: %w", err) } u.PhoneNumber = value case "status": value, err := DecodeTDLibJSONUserStatus(b) if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field status: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field status: %w", err) } u.Status = value case "profile_photo": if err := u.ProfilePhoto.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode user#18552c62: field profile_photo: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field profile_photo: %w", err) } case "accent_color_id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field accent_color_id: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field accent_color_id: %w", err) } u.AccentColorID = value case "background_custom_emoji_id": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field background_custom_emoji_id: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field background_custom_emoji_id: %w", err) } u.BackgroundCustomEmojiID = value case "profile_accent_color_id": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field profile_accent_color_id: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field profile_accent_color_id: %w", err) } u.ProfileAccentColorID = value case "profile_background_custom_emoji_id": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field profile_background_custom_emoji_id: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field profile_background_custom_emoji_id: %w", err) } u.ProfileBackgroundCustomEmojiID = value case "emoji_status": if err := u.EmojiStatus.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode user#18552c62: field emoji_status: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field emoji_status: %w", err) } case "is_contact": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field is_contact: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field is_contact: %w", err) } u.IsContact = value case "is_mutual_contact": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field is_mutual_contact: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field is_mutual_contact: %w", err) } u.IsMutualContact = value case "is_close_friend": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field is_close_friend: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field is_close_friend: %w", err) } u.IsCloseFriend = value - case "is_verified": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field is_verified: %w", err) + case "verification_status": + if err := u.VerificationStatus.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode user#598c3933: field verification_status: %w", err) } - u.IsVerified = value case "is_premium": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field is_premium: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field is_premium: %w", err) } u.IsPremium = value case "is_support": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field is_support: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field is_support: %w", err) } u.IsSupport = value case "restriction_reason": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field restriction_reason: %w", err) } u.RestrictionReason = value - case "is_scam": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field is_scam: %w", err) - } - u.IsScam = value - case "is_fake": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field is_fake: %w", err) - } - u.IsFake = value case "has_active_stories": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field has_active_stories: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field has_active_stories: %w", err) } u.HasActiveStories = value case "has_unread_active_stories": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field has_unread_active_stories: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field has_unread_active_stories: %w", err) } u.HasUnreadActiveStories = value case "restricts_new_chats": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field restricts_new_chats: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field restricts_new_chats: %w", err) } u.RestrictsNewChats = value case "have_access": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field have_access: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field have_access: %w", err) } u.HaveAccess = value case "type": value, err := DecodeTDLibJSONUserType(b) if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field type: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field type: %w", err) } u.Type = value case "language_code": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field language_code: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field language_code: %w", err) } u.LanguageCode = value case "added_to_attachment_menu": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode user#18552c62: field added_to_attachment_menu: %w", err) + return fmt.Errorf("unable to decode user#598c3933: field added_to_attachment_menu: %w", err) } u.AddedToAttachmentMenu = value default: @@ -1034,12 +982,12 @@ func (u *User) GetIsCloseFriend() (value bool) { return u.IsCloseFriend } -// GetIsVerified returns value of IsVerified field. -func (u *User) GetIsVerified() (value bool) { +// GetVerificationStatus returns value of VerificationStatus field. +func (u *User) GetVerificationStatus() (value VerificationStatus) { if u == nil { return } - return u.IsVerified + return u.VerificationStatus } // GetIsPremium returns value of IsPremium field. @@ -1066,22 +1014,6 @@ func (u *User) GetRestrictionReason() (value string) { return u.RestrictionReason } -// GetIsScam returns value of IsScam field. -func (u *User) GetIsScam() (value bool) { - if u == nil { - return - } - return u.IsScam -} - -// GetIsFake returns value of IsFake field. -func (u *User) GetIsFake() (value bool) { - if u == nil { - return - } - return u.IsFake -} - // GetHasActiveStories returns value of HasActiveStories field. func (u *User) GetHasActiveStories() (value bool) { if u == nil { diff --git a/tdapi/tl_user_gift_gen.go b/tdapi/tl_user_gift_gen.go index d43ce7f2f9..dc64e079e6 100644 --- a/tdapi/tl_user_gift_gen.go +++ b/tdapi/tl_user_gift_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// UserGift represents TL type `userGift#494eb721`. +// UserGift represents TL type `userGift#a39db860`. type UserGift struct { // Identifier of the user that sent the gift; 0 if unknown SenderUserID int64 @@ -40,23 +40,41 @@ type UserGift struct { // True, if the sender and gift text are shown only to the gift receiver; otherwise, // everyone are able to see them IsPrivate bool - // True, if the gift is displayed on the user's profile page; may be false only for the - // receiver of the gift + // True, if the gift is displayed on the user's profile page; only for the receiver of + // the gift IsSaved bool + // True, if the gift is a regular gift that can be upgraded to a unique gift; only for + // the receiver of the gift + CanBeUpgraded bool + // True, if the gift is an upgraded gift that can be transferred to another user; only + // for the receiver of the gift + CanBeTransferred bool + // True, if the gift was refunded and isn't available anymore + WasRefunded bool // Point in time (Unix timestamp) when the gift was sent Date int32 // The gift - Gift Gift + Gift SentGiftClass // Identifier of the message with the gift in the chat with the sender of the gift; can - // be 0 or an identifier of a deleted message; only for the gift receiver + // be 0 or an identifier of a deleted message; only for the receiver of the gift MessageID int64 - // Number of Telegram Stars that can be claimed by the receiver instead of the gift; 0 if - // the gift can't be sold by the current user + // Number of Telegram Stars that can be claimed by the receiver instead of the regular + // gift; 0 if the gift can't be sold by the current user SellStarCount int64 + // Number of Telegram Stars that were paid by the sender for the ability to upgrade the + // gift + PrepaidUpgradeStarCount int64 + // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the + // receiver of the gift + TransferStarCount int64 + // Point in time (Unix timestamp) when the upgraded gift can be transferred to TON + // blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the + // gift + ExportDate int32 } // UserGiftTypeID is TL type id of UserGift. -const UserGiftTypeID = 0x494eb721 +const UserGiftTypeID = 0xa39db860 // Ensuring interfaces in compile-time for UserGift. var ( @@ -82,10 +100,19 @@ func (u *UserGift) Zero() bool { if !(u.IsSaved == false) { return false } + if !(u.CanBeUpgraded == false) { + return false + } + if !(u.CanBeTransferred == false) { + return false + } + if !(u.WasRefunded == false) { + return false + } if !(u.Date == 0) { return false } - if !(u.Gift.Zero()) { + if !(u.Gift == nil) { return false } if !(u.MessageID == 0) { @@ -94,6 +121,15 @@ func (u *UserGift) Zero() bool { if !(u.SellStarCount == 0) { return false } + if !(u.PrepaidUpgradeStarCount == 0) { + return false + } + if !(u.TransferStarCount == 0) { + return false + } + if !(u.ExportDate == 0) { + return false + } return true } @@ -146,6 +182,18 @@ func (u *UserGift) TypeInfo() tdp.Type { Name: "IsSaved", SchemaName: "is_saved", }, + { + Name: "CanBeUpgraded", + SchemaName: "can_be_upgraded", + }, + { + Name: "CanBeTransferred", + SchemaName: "can_be_transferred", + }, + { + Name: "WasRefunded", + SchemaName: "was_refunded", + }, { Name: "Date", SchemaName: "date", @@ -162,6 +210,18 @@ func (u *UserGift) TypeInfo() tdp.Type { Name: "SellStarCount", SchemaName: "sell_star_count", }, + { + Name: "PrepaidUpgradeStarCount", + SchemaName: "prepaid_upgrade_star_count", + }, + { + Name: "TransferStarCount", + SchemaName: "transfer_star_count", + }, + { + Name: "ExportDate", + SchemaName: "export_date", + }, } return typ } @@ -169,7 +229,7 @@ func (u *UserGift) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (u *UserGift) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode userGift#494eb721 as nil") + return fmt.Errorf("can't encode userGift#a39db860 as nil") } b.PutID(UserGiftTypeID) return u.EncodeBare(b) @@ -178,30 +238,39 @@ func (u *UserGift) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *UserGift) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode userGift#494eb721 as nil") + return fmt.Errorf("can't encode userGift#a39db860 as nil") } b.PutInt53(u.SenderUserID) if err := u.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode userGift#494eb721: field text: %w", err) + return fmt.Errorf("unable to encode userGift#a39db860: field text: %w", err) } b.PutBool(u.IsPrivate) b.PutBool(u.IsSaved) + b.PutBool(u.CanBeUpgraded) + b.PutBool(u.CanBeTransferred) + b.PutBool(u.WasRefunded) b.PutInt32(u.Date) + if u.Gift == nil { + return fmt.Errorf("unable to encode userGift#a39db860: field gift is nil") + } if err := u.Gift.Encode(b); err != nil { - return fmt.Errorf("unable to encode userGift#494eb721: field gift: %w", err) + return fmt.Errorf("unable to encode userGift#a39db860: field gift: %w", err) } b.PutInt53(u.MessageID) b.PutInt53(u.SellStarCount) + b.PutInt53(u.PrepaidUpgradeStarCount) + b.PutInt53(u.TransferStarCount) + b.PutInt32(u.ExportDate) return nil } // Decode implements bin.Decoder. func (u *UserGift) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode userGift#494eb721 to nil") + return fmt.Errorf("can't decode userGift#a39db860 to nil") } if err := b.ConsumeID(UserGiftTypeID); err != nil { - return fmt.Errorf("unable to decode userGift#494eb721: %w", err) + return fmt.Errorf("unable to decode userGift#a39db860: %w", err) } return u.DecodeBare(b) } @@ -209,67 +278,111 @@ func (u *UserGift) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *UserGift) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode userGift#494eb721 to nil") + return fmt.Errorf("can't decode userGift#a39db860 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode userGift#494eb721: field sender_user_id: %w", err) + return fmt.Errorf("unable to decode userGift#a39db860: field sender_user_id: %w", err) } u.SenderUserID = value } { if err := u.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode userGift#494eb721: field text: %w", err) + return fmt.Errorf("unable to decode userGift#a39db860: field text: %w", err) } } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userGift#494eb721: field is_private: %w", err) + return fmt.Errorf("unable to decode userGift#a39db860: field is_private: %w", err) } u.IsPrivate = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userGift#494eb721: field is_saved: %w", err) + return fmt.Errorf("unable to decode userGift#a39db860: field is_saved: %w", err) } u.IsSaved = value } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode userGift#a39db860: field can_be_upgraded: %w", err) + } + u.CanBeUpgraded = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode userGift#a39db860: field can_be_transferred: %w", err) + } + u.CanBeTransferred = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode userGift#a39db860: field was_refunded: %w", err) + } + u.WasRefunded = value + } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode userGift#494eb721: field date: %w", err) + return fmt.Errorf("unable to decode userGift#a39db860: field date: %w", err) } u.Date = value } { - if err := u.Gift.Decode(b); err != nil { - return fmt.Errorf("unable to decode userGift#494eb721: field gift: %w", err) + value, err := DecodeSentGift(b) + if err != nil { + return fmt.Errorf("unable to decode userGift#a39db860: field gift: %w", err) } + u.Gift = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode userGift#494eb721: field message_id: %w", err) + return fmt.Errorf("unable to decode userGift#a39db860: field message_id: %w", err) } u.MessageID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode userGift#494eb721: field sell_star_count: %w", err) + return fmt.Errorf("unable to decode userGift#a39db860: field sell_star_count: %w", err) } u.SellStarCount = value } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode userGift#a39db860: field prepaid_upgrade_star_count: %w", err) + } + u.PrepaidUpgradeStarCount = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode userGift#a39db860: field transfer_star_count: %w", err) + } + u.TransferStarCount = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode userGift#a39db860: field export_date: %w", err) + } + u.ExportDate = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UserGift) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode userGift#494eb721 as nil") + return fmt.Errorf("can't encode userGift#a39db860 as nil") } b.ObjStart() b.PutID("userGift") @@ -279,7 +392,7 @@ func (u *UserGift) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("text") if err := u.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userGift#494eb721: field text: %w", err) + return fmt.Errorf("unable to encode userGift#a39db860: field text: %w", err) } b.Comma() b.FieldStart("is_private") @@ -288,12 +401,24 @@ func (u *UserGift) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("is_saved") b.PutBool(u.IsSaved) b.Comma() + b.FieldStart("can_be_upgraded") + b.PutBool(u.CanBeUpgraded) + b.Comma() + b.FieldStart("can_be_transferred") + b.PutBool(u.CanBeTransferred) + b.Comma() + b.FieldStart("was_refunded") + b.PutBool(u.WasRefunded) + b.Comma() b.FieldStart("date") b.PutInt32(u.Date) b.Comma() b.FieldStart("gift") + if u.Gift == nil { + return fmt.Errorf("unable to encode userGift#a39db860: field gift is nil") + } if err := u.Gift.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userGift#494eb721: field gift: %w", err) + return fmt.Errorf("unable to encode userGift#a39db860: field gift: %w", err) } b.Comma() b.FieldStart("message_id") @@ -302,6 +427,15 @@ func (u *UserGift) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("sell_star_count") b.PutInt53(u.SellStarCount) b.Comma() + b.FieldStart("prepaid_upgrade_star_count") + b.PutInt53(u.PrepaidUpgradeStarCount) + b.Comma() + b.FieldStart("transfer_star_count") + b.PutInt53(u.TransferStarCount) + b.Comma() + b.FieldStart("export_date") + b.PutInt32(u.ExportDate) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -310,59 +444,97 @@ func (u *UserGift) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UserGift) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode userGift#494eb721 to nil") + return fmt.Errorf("can't decode userGift#a39db860 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("userGift"); err != nil { - return fmt.Errorf("unable to decode userGift#494eb721: %w", err) + return fmt.Errorf("unable to decode userGift#a39db860: %w", err) } case "sender_user_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode userGift#494eb721: field sender_user_id: %w", err) + return fmt.Errorf("unable to decode userGift#a39db860: field sender_user_id: %w", err) } u.SenderUserID = value case "text": if err := u.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userGift#494eb721: field text: %w", err) + return fmt.Errorf("unable to decode userGift#a39db860: field text: %w", err) } case "is_private": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userGift#494eb721: field is_private: %w", err) + return fmt.Errorf("unable to decode userGift#a39db860: field is_private: %w", err) } u.IsPrivate = value case "is_saved": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userGift#494eb721: field is_saved: %w", err) + return fmt.Errorf("unable to decode userGift#a39db860: field is_saved: %w", err) } u.IsSaved = value + case "can_be_upgraded": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode userGift#a39db860: field can_be_upgraded: %w", err) + } + u.CanBeUpgraded = value + case "can_be_transferred": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode userGift#a39db860: field can_be_transferred: %w", err) + } + u.CanBeTransferred = value + case "was_refunded": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode userGift#a39db860: field was_refunded: %w", err) + } + u.WasRefunded = value case "date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode userGift#494eb721: field date: %w", err) + return fmt.Errorf("unable to decode userGift#a39db860: field date: %w", err) } u.Date = value case "gift": - if err := u.Gift.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userGift#494eb721: field gift: %w", err) + value, err := DecodeTDLibJSONSentGift(b) + if err != nil { + return fmt.Errorf("unable to decode userGift#a39db860: field gift: %w", err) } + u.Gift = value case "message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode userGift#494eb721: field message_id: %w", err) + return fmt.Errorf("unable to decode userGift#a39db860: field message_id: %w", err) } u.MessageID = value case "sell_star_count": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode userGift#494eb721: field sell_star_count: %w", err) + return fmt.Errorf("unable to decode userGift#a39db860: field sell_star_count: %w", err) } u.SellStarCount = value + case "prepaid_upgrade_star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode userGift#a39db860: field prepaid_upgrade_star_count: %w", err) + } + u.PrepaidUpgradeStarCount = value + case "transfer_star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode userGift#a39db860: field transfer_star_count: %w", err) + } + u.TransferStarCount = value + case "export_date": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode userGift#a39db860: field export_date: %w", err) + } + u.ExportDate = value default: return b.Skip() } @@ -402,6 +574,30 @@ func (u *UserGift) GetIsSaved() (value bool) { return u.IsSaved } +// GetCanBeUpgraded returns value of CanBeUpgraded field. +func (u *UserGift) GetCanBeUpgraded() (value bool) { + if u == nil { + return + } + return u.CanBeUpgraded +} + +// GetCanBeTransferred returns value of CanBeTransferred field. +func (u *UserGift) GetCanBeTransferred() (value bool) { + if u == nil { + return + } + return u.CanBeTransferred +} + +// GetWasRefunded returns value of WasRefunded field. +func (u *UserGift) GetWasRefunded() (value bool) { + if u == nil { + return + } + return u.WasRefunded +} + // GetDate returns value of Date field. func (u *UserGift) GetDate() (value int32) { if u == nil { @@ -411,7 +607,7 @@ func (u *UserGift) GetDate() (value int32) { } // GetGift returns value of Gift field. -func (u *UserGift) GetGift() (value Gift) { +func (u *UserGift) GetGift() (value SentGiftClass) { if u == nil { return } @@ -433,3 +629,27 @@ func (u *UserGift) GetSellStarCount() (value int64) { } return u.SellStarCount } + +// GetPrepaidUpgradeStarCount returns value of PrepaidUpgradeStarCount field. +func (u *UserGift) GetPrepaidUpgradeStarCount() (value int64) { + if u == nil { + return + } + return u.PrepaidUpgradeStarCount +} + +// GetTransferStarCount returns value of TransferStarCount field. +func (u *UserGift) GetTransferStarCount() (value int64) { + if u == nil { + return + } + return u.TransferStarCount +} + +// GetExportDate returns value of ExportDate field. +func (u *UserGift) GetExportDate() (value int32) { + if u == nil { + return + } + return u.ExportDate +} diff --git a/tdapi/tl_verification_status_gen.go b/tdapi/tl_verification_status_gen.go new file mode 100644 index 0000000000..e72ec34aa8 --- /dev/null +++ b/tdapi/tl_verification_status_gen.go @@ -0,0 +1,296 @@ +// 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{} +) + +// VerificationStatus represents TL type `verificationStatus#3ae6a18c`. +type VerificationStatus struct { + // True, if the chat or the user is verified by Telegram + IsVerified bool + // True, if the chat or the user is marked as scam by Telegram + IsScam bool + // True, if the chat or the user is marked as fake by Telegram + IsFake bool + // Identifier of the custom emoji to be shown as verification sign provided by a bot for + // the user; 0 if none + BotVerificationIconCustomEmojiID int64 +} + +// VerificationStatusTypeID is TL type id of VerificationStatus. +const VerificationStatusTypeID = 0x3ae6a18c + +// Ensuring interfaces in compile-time for VerificationStatus. +var ( + _ bin.Encoder = &VerificationStatus{} + _ bin.Decoder = &VerificationStatus{} + _ bin.BareEncoder = &VerificationStatus{} + _ bin.BareDecoder = &VerificationStatus{} +) + +func (v *VerificationStatus) Zero() bool { + if v == nil { + return true + } + if !(v.IsVerified == false) { + return false + } + if !(v.IsScam == false) { + return false + } + if !(v.IsFake == false) { + return false + } + if !(v.BotVerificationIconCustomEmojiID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (v *VerificationStatus) String() string { + if v == nil { + return "VerificationStatus(nil)" + } + type Alias VerificationStatus + return fmt.Sprintf("VerificationStatus%+v", Alias(*v)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*VerificationStatus) TypeID() uint32 { + return VerificationStatusTypeID +} + +// TypeName returns name of type in TL schema. +func (*VerificationStatus) TypeName() string { + return "verificationStatus" +} + +// TypeInfo returns info about TL type. +func (v *VerificationStatus) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "verificationStatus", + ID: VerificationStatusTypeID, + } + if v == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "IsVerified", + SchemaName: "is_verified", + }, + { + Name: "IsScam", + SchemaName: "is_scam", + }, + { + Name: "IsFake", + SchemaName: "is_fake", + }, + { + Name: "BotVerificationIconCustomEmojiID", + SchemaName: "bot_verification_icon_custom_emoji_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (v *VerificationStatus) Encode(b *bin.Buffer) error { + if v == nil { + return fmt.Errorf("can't encode verificationStatus#3ae6a18c as nil") + } + b.PutID(VerificationStatusTypeID) + return v.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (v *VerificationStatus) EncodeBare(b *bin.Buffer) error { + if v == nil { + return fmt.Errorf("can't encode verificationStatus#3ae6a18c as nil") + } + b.PutBool(v.IsVerified) + b.PutBool(v.IsScam) + b.PutBool(v.IsFake) + b.PutLong(v.BotVerificationIconCustomEmojiID) + return nil +} + +// Decode implements bin.Decoder. +func (v *VerificationStatus) Decode(b *bin.Buffer) error { + if v == nil { + return fmt.Errorf("can't decode verificationStatus#3ae6a18c to nil") + } + if err := b.ConsumeID(VerificationStatusTypeID); err != nil { + return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: %w", err) + } + return v.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (v *VerificationStatus) DecodeBare(b *bin.Buffer) error { + if v == nil { + return fmt.Errorf("can't decode verificationStatus#3ae6a18c to nil") + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field is_verified: %w", err) + } + v.IsVerified = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field is_scam: %w", err) + } + v.IsScam = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field is_fake: %w", err) + } + v.IsFake = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field bot_verification_icon_custom_emoji_id: %w", err) + } + v.BotVerificationIconCustomEmojiID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (v *VerificationStatus) EncodeTDLibJSON(b tdjson.Encoder) error { + if v == nil { + return fmt.Errorf("can't encode verificationStatus#3ae6a18c as nil") + } + b.ObjStart() + b.PutID("verificationStatus") + b.Comma() + b.FieldStart("is_verified") + b.PutBool(v.IsVerified) + b.Comma() + b.FieldStart("is_scam") + b.PutBool(v.IsScam) + b.Comma() + b.FieldStart("is_fake") + b.PutBool(v.IsFake) + b.Comma() + b.FieldStart("bot_verification_icon_custom_emoji_id") + b.PutLong(v.BotVerificationIconCustomEmojiID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (v *VerificationStatus) DecodeTDLibJSON(b tdjson.Decoder) error { + if v == nil { + return fmt.Errorf("can't decode verificationStatus#3ae6a18c to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("verificationStatus"); err != nil { + return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: %w", err) + } + case "is_verified": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field is_verified: %w", err) + } + v.IsVerified = value + case "is_scam": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field is_scam: %w", err) + } + v.IsScam = value + case "is_fake": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field is_fake: %w", err) + } + v.IsFake = value + case "bot_verification_icon_custom_emoji_id": + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field bot_verification_icon_custom_emoji_id: %w", err) + } + v.BotVerificationIconCustomEmojiID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetIsVerified returns value of IsVerified field. +func (v *VerificationStatus) GetIsVerified() (value bool) { + if v == nil { + return + } + return v.IsVerified +} + +// GetIsScam returns value of IsScam field. +func (v *VerificationStatus) GetIsScam() (value bool) { + if v == nil { + return + } + return v.IsScam +} + +// GetIsFake returns value of IsFake field. +func (v *VerificationStatus) GetIsFake() (value bool) { + if v == nil { + return + } + return v.IsFake +} + +// GetBotVerificationIconCustomEmojiID returns value of BotVerificationIconCustomEmojiID field. +func (v *VerificationStatus) GetBotVerificationIconCustomEmojiID() (value int64) { + if v == nil { + return + } + return v.BotVerificationIconCustomEmojiID +}