diff --git a/_schema/tdapi.tl b/_schema/tdapi.tl index 0a6842b29f..f5961ced1e 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: ed98fc1c685881d72e357a361de2d2c7b40fa7f397c8d3036f21761de0fba1ce +// SHA256: 52a13c3af30750d098439cf0fa45bb18e02e6eb5fc1261774f2c8293e72d1b3a double#2210c154 ? = Double; @@ -855,16 +855,16 @@ premiumPaymentOption#8c0c5fb2 currency:string amount:int53 discount_percentage:i //@last_transaction_id Identifier of the last in-store transaction for the currently used option premiumStatePaymentOption#7d06b579 payment_option:premiumPaymentOption is_current:Bool is_upgrade:Bool last_transaction_id:string = PremiumStatePaymentOption; -//@description Describes an option for creating Telegram Premium gift codes. Use telegramPaymentPurposePremiumGiftCodes for out-of-store payments +//@description Describes an option for creating Telegram Premium gift codes or Telegram Premium giveaway. Use telegramPaymentPurposePremiumGiftCodes or telegramPaymentPurposePremiumGiveaway for out-of-store payments //@currency ISO 4217 currency code for Telegram Premium gift code payment //@amount The amount to pay, in the smallest units of the currency -//@user_count Number of users which will be able to activate the gift codes +//@winner_count Number of users which will be able to activate the gift codes //@month_count Number of months the Telegram Premium subscription will be active //@store_product_id Identifier of the store product associated with the option; may be empty if none //@store_product_quantity Number of times the store product must be paid -premiumGiftCodePaymentOption#e2f40fef currency:string amount:int53 user_count:int32 month_count:int32 store_product_id:string store_product_quantity:int32 = PremiumGiftCodePaymentOption; +premiumGiftCodePaymentOption#e5fe2de currency:string amount:int53 winner_count:int32 month_count:int32 store_product_id:string store_product_quantity:int32 = PremiumGiftCodePaymentOption; -//@description Contains a list of options for creating Telegram Premium gift codes +//@description Contains a list of options for creating Telegram Premium gift codes or Telegram Premium giveaway //@options The list of options premiumGiftCodePaymentOptions#97a8cf2e options:vector = PremiumGiftCodePaymentOptions; @@ -890,6 +890,27 @@ starPaymentOption#aeb22811 currency:string amount:int53 star_count:int53 store_p //@options The list of options starPaymentOptions#77c3bbad options:vector = StarPaymentOptions; +//@description Describes an option for the number of winners of a Telegram Star giveaway +//@winner_count The number of users that will be chosen as winners +//@won_star_count The number of Telegram Stars that will be won by the winners of the giveaway +//@is_default True, if the option must be chosen by default +starGiveawayWinnerOption#cc639607 winner_count:int32 won_star_count:int53 is_default:Bool = StarGiveawayWinnerOption; + +//@description Describes an option for creating Telegram Star giveaway. Use telegramPaymentPurposeStarGiveaway for out-of-store payments +//@currency ISO 4217 currency code for the payment +//@amount The amount to pay, in the smallest units of the currency +//@star_count Number of Telegram Stars that will be distributed among winners +//@store_product_id Identifier of the store product associated with the option; may be empty if none +//@yearly_boost_count Number of times the chat will be boosted for one year if the option is chosen +//@winner_options Allowed options for the number of giveaway winners +//@is_default True, if the option must be chosen by default +//@is_additional True, if the option must be shown only in the full list of payment options +starGiveawayPaymentOption#bca2d5e5 currency:string amount:int53 star_count:int53 store_product_id:string yearly_boost_count:int32 winner_options:vector is_default:Bool is_additional:Bool = StarGiveawayPaymentOption; + +//@description Contains a list of options for creating Telegram Star giveaway +//@options The list of options +starGiveawayPaymentOptions#909fbf18 options:vector = StarGiveawayPaymentOptions; + //@class StarTransactionDirection @description Describes direction of a transaction with Telegram Stars //@description The transaction is incoming and increases the number of owned Telegram Stars @@ -902,27 +923,32 @@ starTransactionDirectionOutgoing#6e83b5a0 = StarTransactionDirection; //@description Paid media were bought //@media The bought media if the trancastion wasn't refunded -botTransactionPurposePaidMedia#9593b72f media:vector = BotTransactionPurpose; +//@payload Bot-provided payload; for bots only +botTransactionPurposePaidMedia#62952496 media:vector payload:string = BotTransactionPurpose; //@description User bought a product from the bot //@product_info Information about the bought product; may be null if not applicable //@invoice_payload Invoice payload; for bots only botTransactionPurposeInvoicePayment#699860ac product_info:productInfo invoice_payload:bytes = BotTransactionPurpose; -//@class ChannelTransactionPurpose @description Describes purpose of a transaction with a channel +//@class ChatTransactionPurpose @description Describes purpose of a transaction with a supergroup or a channel //@description Paid media were bought -//@message_id Identifier of the corresponding message with paid media; can be an identifier of a deleted message +//@message_id Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message //@media The bought media if the trancastion wasn't refunded -channelTransactionPurposePaidMedia#b00b2258 message_id:int53 media:vector = ChannelTransactionPurpose; +chatTransactionPurposePaidMedia#d35febb message_id:int53 media:vector = ChatTransactionPurpose; //@description User joined the channel and subscribed to regular payments in Telegram Stars //@period The number of seconds between consecutive Telegram Star debiting -channelTransactionPurposeJoin#ed83dd90 period:int32 = ChannelTransactionPurpose; +chatTransactionPurposeJoin#5b31327a period:int32 = ChatTransactionPurpose; //@description User paid for a reaction -//@message_id Identifier of the reacted message; can be an identifier of a deleted message -channelTransactionPurposeReaction#2ca05bee message_id:int53 = ChannelTransactionPurpose; +//@message_id Identifier of the reacted message; can be 0 or an identifier of a deleted message +chatTransactionPurposeReaction#7a5f9888 message_id:int53 = ChatTransactionPurpose; + +//@description User received Telegram Stars from a giveaway +//@giveaway_message_id Identifier of the message with giveaway; can be 0 or an identifier of a deleted message +chatTransactionPurposeGiveaway#384c8b7f giveaway_message_id:int53 = ChatTransactionPurpose; //@class StarTransactionPartner @description Describes source or recipient of a transaction with Telegram Stars @@ -952,10 +978,10 @@ starTransactionPartnerBot#4ece3a40 user_id:int53 purpose:BotTransactionPurpose = //@media The bought media if the trancastion wasn't refunded starTransactionPartnerBusiness#7af9fb52 user_id:int53 media:vector = StarTransactionPartner; -//@description The transaction is a transaction with a channel chat +//@description The transaction is a transaction with a supergroup or a channel chat //@chat_id Identifier of the chat //@purpose Purpose of the transaction -starTransactionPartnerChannel#7c04767e chat_id:int53 purpose:ChannelTransactionPurpose = StarTransactionPartner; +starTransactionPartnerChat#71db4d40 chat_id:int53 purpose:ChatTransactionPurpose = StarTransactionPartner; //@description The transaction is a gift of Telegram Stars from another user //@user_id Identifier of the user; 0 if the gift was anonymous @@ -979,42 +1005,54 @@ starTransaction#ce1084a8 id:string star_count:int53 is_refund:Bool date:int32 pa //@next_offset The offset for the next request. If empty, then there are no more results starTransactions#306a010e star_count:int53 transactions:vector next_offset:string = StarTransactions; -//@class PremiumGiveawayParticipantStatus @description Contains information about status of a user in a Telegram Premium giveaway +//@class GiveawayParticipantStatus @description Contains information about status of a user in a giveaway //@description The user is eligible for the giveaway -premiumGiveawayParticipantStatusEligible#7ee281c0 = PremiumGiveawayParticipantStatus; +giveawayParticipantStatusEligible#122ade97 = GiveawayParticipantStatus; //@description The user participates in the giveaway -premiumGiveawayParticipantStatusParticipating#740406d1 = PremiumGiveawayParticipantStatus; +giveawayParticipantStatusParticipating#1d53e36f = GiveawayParticipantStatus; //@description The user can't participate in the giveaway, because they have already been member of the chat //@joined_chat_date Point in time (Unix timestamp) when the user joined the chat -premiumGiveawayParticipantStatusAlreadyWasMember#8d3045a3 joined_chat_date:int32 = PremiumGiveawayParticipantStatus; +giveawayParticipantStatusAlreadyWasMember#11f9b5a0 joined_chat_date:int32 = GiveawayParticipantStatus; //@description The user can't participate in the giveaway, because they are an administrator in one of the chats that created the giveaway //@chat_id Identifier of the chat administered by the user -premiumGiveawayParticipantStatusAdministrator#7244dace chat_id:int53 = PremiumGiveawayParticipantStatus; +giveawayParticipantStatusAdministrator#c84b3a75 chat_id:int53 = GiveawayParticipantStatus; //@description The user can't participate in the giveaway, because they phone number is from a disallowed country //@user_country_code A two-letter ISO 3166-1 alpha-2 country code of the user's country -premiumGiveawayParticipantStatusDisallowedCountry#89684090 user_country_code:string = PremiumGiveawayParticipantStatus; +giveawayParticipantStatusDisallowedCountry#700b645b user_country_code:string = GiveawayParticipantStatus; -//@class PremiumGiveawayInfo @description Contains information about Telegram Premium giveaway +//@class GiveawayInfo @description Contains information about a giveaway //@description Describes an ongoing giveaway //@creation_date Point in time (Unix timestamp) when the giveaway was created //@status Status of the current user in the giveaway //@is_ended True, if the giveaway has ended and results are being prepared -premiumGiveawayInfoOngoing#48d3ce6f creation_date:int32 status:PremiumGiveawayParticipantStatus is_ended:Bool = PremiumGiveawayInfo; +giveawayInfoOngoing#624ee050 creation_date:int32 status:GiveawayParticipantStatus is_ended:Bool = GiveawayInfo; //@description Describes a completed giveaway //@creation_date Point in time (Unix timestamp) when the giveaway was created //@actual_winners_selection_date Point in time (Unix timestamp) when the winners were selected. May be bigger than winners selection date specified in parameters of the giveaway //@was_refunded True, if the giveaway was canceled and was fully refunded +//@is_winner True, if the cuurent user is a winner of the giveaway //@winner_count Number of winners in the giveaway -//@activation_count Number of winners, which activated their gift codes -//@gift_code Telegram Premium gift code that was received by the current user; empty if the user isn't a winner in the giveaway -premiumGiveawayInfoCompleted#fc8b501b creation_date:int32 actual_winners_selection_date:int32 was_refunded:Bool winner_count:int32 activation_count:int32 gift_code:string = PremiumGiveawayInfo; +//@activation_count Number of winners, which activated their gift codes; for Telegram Premium giveaways only +//@gift_code Telegram Premium gift code that was received by the current user; empty if the user isn't a winner in the giveaway or the giveaway isn't a Telegram Premium giveaway +//@won_star_count The amount of Telegram Stars won by the current user; 0 if the user isn't a winner in the giveaway or the giveaway isn't a Telegram Star giveaway +giveawayInfoCompleted#328cc35c creation_date:int32 actual_winners_selection_date:int32 was_refunded:Bool is_winner:Bool winner_count:int32 activation_count:int32 gift_code:string won_star_count:int53 = GiveawayInfo; + +//@class GiveawayPrize @description Contains information about a giveaway prize + +//@description The giveaway sends Telegram Premium subscriptions to the winners +//@month_count Number of months the Telegram Premium subscription will be active after code activation +giveawayPrizePremium#1b12e978 month_count:int32 = GiveawayPrize; + +//@description The giveaway sends Telegram Stars to the winners +//@star_count Number of Telegram Stars that will be shared by all winners +giveawayPrizeStars#954c1fa4 star_count:int53 = GiveawayPrize; //@description Contains information about supported accent color for user/chat name, background of empty chat photo, replies to messages and link previews //@id Accent color identifier @@ -2751,26 +2789,19 @@ linkPreviewTypeAlbum#186d97b4 media:vector caption:string //@description The link is a link to an animation //@animation The animation -//@author Author of the animation -linkPreviewTypeAnimation#93534e8e animation:animation author:string = LinkPreviewType; +linkPreviewTypeAnimation#ad5cc534 animation:animation = LinkPreviewType; //@description The link is a link to an app at App Store or Google Play //@photo Photo for the app -//@author Author of the app -linkPreviewTypeApp#b5192746 photo:photo author:string = LinkPreviewType; +linkPreviewTypeApp#e3a68def photo:photo = LinkPreviewType; //@description The link is a link to a web site //@photo Article's main photo; may be null -//@author Author of the article -linkPreviewTypeArticle#965e4e27 photo:photo author:string = LinkPreviewType; +linkPreviewTypeArticle#7cce9bd9 photo:photo = LinkPreviewType; //@description The link is a link to an audio -//@url URL of the audio; may be empty if none -//@mime_type MIME type of the audio file -//@audio The audio description; may be null if unknown -//@duration Duration of the audio, in seconds; 0 if unknown -//@author Author of the audio -linkPreviewTypeAudio#572c6b78 url:string mime_type:string audio:audio duration:int32 author:string = LinkPreviewType; +//@audio The audio description +linkPreviewTypeAudio#75e407d2 audio:audio = LinkPreviewType; //@description The link is a link to a background. Link preview title and description are available only for filled backgrounds //@document Document with the background; may be null for filled backgrounds @@ -2789,35 +2820,45 @@ linkPreviewTypeChat#ae2fa122 type:InviteLinkChatType photo:chatPhoto creates_joi //@description The link is a link to a general file //@document The document description -//@author Author of the document -linkPreviewTypeDocument#53b02747 document:document author:string = LinkPreviewType; +linkPreviewTypeDocument#bf0169a2 document:document = LinkPreviewType; //@description The link is a link to an animation player //@url URL of the external animation player //@thumbnail Thumbnail of the animation; may be null if unknown //@duration Duration of the animation, in seconds -//@author Author of the animation //@width Expected width of the embedded player //@height Expected height of the embedded player -linkPreviewTypeEmbeddedAnimationPlayer#c45fddca url:string thumbnail:photo duration:int32 author:string width:int32 height:int32 = LinkPreviewType; +linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605 url:string thumbnail:photo duration:int32 width:int32 height:int32 = LinkPreviewType; //@description The link is a link to an audio player //@url URL of the external audio player //@thumbnail Thumbnail of the audio; may be null if unknown //@duration Duration of the audio, in seconds -//@author Author of the audio //@width Expected width of the embedded player //@height Expected height of the embedded player -linkPreviewTypeEmbeddedAudioPlayer#31e0dae6 url:string thumbnail:photo duration:int32 author:string width:int32 height:int32 = LinkPreviewType; +linkPreviewTypeEmbeddedAudioPlayer#220b429c url:string thumbnail:photo duration:int32 width:int32 height:int32 = LinkPreviewType; //@description The link is a link to a video player //@url URL of the external video player //@thumbnail Thumbnail of the video; may be null if unknown //@duration Duration of the video, in seconds -//@author Author of the video //@width Expected width of the embedded player //@height Expected height of the embedded player -linkPreviewTypeEmbeddedVideoPlayer#6ee015a3 url:string thumbnail:photo duration:int32 author:string width:int32 height:int32 = LinkPreviewType; +linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03 url:string thumbnail:photo duration:int32 width:int32 height:int32 = LinkPreviewType; + +//@description The link is a link to an audio file +//@url URL of the audio file +//@mime_type MIME type of the audio file +//@duration Duration of the audio, in seconds; 0 if unknown +linkPreviewTypeExternalAudio#8a82ffed url:string mime_type:string duration:int32 = LinkPreviewType; + +//@description The link is a link to a video file +//@url URL of the video file +//@mime_type MIME type of the video file +//@width Expected width of the video preview; 0 if unknown +//@height Expected height of the video preview; 0 if unknown +//@duration Duration of the video, in seconds; 0 if unknown +linkPreviewTypeExternalVideo#517dcb98 url:string mime_type:string width:int32 height:int32 duration:int32 = LinkPreviewType; //@description The link is a link to an invoice linkPreviewTypeInvoice#d47f48da = LinkPreviewType; @@ -2827,8 +2868,7 @@ linkPreviewTypeMessage#19f4c19e = LinkPreviewType; //@description The link is a link to a photo //@photo The photo -//@author Author of the photo -linkPreviewTypePhoto#eeebbab0 photo:photo author:string = LinkPreviewType; +linkPreviewTypePhoto#aecfaaac photo:photo = LinkPreviewType; //@description The link is a link to a Telegram Premium gift code linkPreviewTypePremiumGiftCode#4e0d80b1 = LinkPreviewType; @@ -2867,14 +2907,8 @@ linkPreviewTypeUnsupported#72b92cb9 = LinkPreviewType; linkPreviewTypeUser#a8ad817c photo:chatPhoto is_bot:Bool = LinkPreviewType; //@description The link is a link to a video -//@url URL of the video; may be empty if none -//@mime_type MIME type of the video file -//@video The video description; may be null if unknown -//@width Expected width of the preview -//@height Expected height of the preview -//@duration Duration of the video, in seconds; 0 if unknown -//@author Author of the video -linkPreviewTypeVideo#2beebfbe url:string mime_type:string video:video width:int32 height:int32 duration:int32 author:string = LinkPreviewType; +//@video The video description +linkPreviewTypeVideo#10c9fc08 video:video = LinkPreviewType; //@description The link is a link to a video chat //@photo Photo of the chat with the video chat; may be null if none @@ -2899,6 +2933,7 @@ linkPreviewTypeWebApp#a62eef8a photo:photo = LinkPreviewType; //@site_name Short name of the site (e.g., Google Docs, App Store) //@title Title of the content //@param_description Description of the content +//@author Author of the content //@type Type of the link preview //@has_large_media True, if size of media in the preview can be changed //@show_large_media True, if large media preview must be shown; otherwise, the media preview must be shown small and only the first frame must be shown for videos @@ -2906,7 +2941,7 @@ linkPreviewTypeWebApp#a62eef8a photo:photo = LinkPreviewType; //@skip_confirmation True, if there is no need to show an ordinary open URL confirmation, when opening the URL from the preview, because the URL is shown in the message text in clear //@show_above_text True, if the link preview must be shown above message text; otherwise, the link preview must be shown below the message text //@instant_view_version Version of instant view (currently, can be 1 or 2) for the web page; 0 if none -linkPreview#52a366d6 url:string display_url:string site_name:string title:string description:formattedText type:LinkPreviewType has_large_media:Bool show_large_media:Bool show_media_above_description:Bool skip_confirmation:Bool show_above_text:Bool instant_view_version:int32 = LinkPreview; +linkPreview#6714d1f2 url:string display_url:string site_name:string title:string description:formattedText author:string type:LinkPreviewType has_large_media:Bool show_large_media:Bool show_media_above_description:Bool skip_confirmation:Bool show_above_text:Bool instant_view_version:int32 = LinkPreview; //@description Contains information about a country //@country_code A two-letter ISO 3166-1 alpha-2 country code @@ -2976,6 +3011,7 @@ locationAddress#a3dad322 country_code:string state:string city:string street:str //@background_color A color of the background in the RGB24 format //@secondary_background_color A secondary color for the background in the RGB24 format //@header_background_color A color of the header background in the RGB24 format +//@bottom_bar_background_color A color of the bottom bar background in the RGB24 format //@section_background_color A color of the section background in the RGB24 format //@section_separator_color A color of the section separator in the RGB24 format //@text_color A color of text in the RGB24 format @@ -2987,7 +3023,7 @@ locationAddress#a3dad322 country_code:string state:string city:string street:str //@link_color A color of links in the RGB24 format //@button_color A color of the buttons in the RGB24 format //@button_text_color A color of text on the buttons in the RGB24 format -themeParameters#b47510c1 background_color:int32 secondary_background_color:int32 header_background_color:int32 section_background_color:int32 section_separator_color:int32 text_color:int32 accent_text_color:int32 section_header_text_color:int32 subtitle_text_color:int32 destructive_text_color:int32 hint_color:int32 link_color:int32 button_color:int32 button_text_color:int32 = ThemeParameters; +themeParameters#ef8395af background_color:int32 secondary_background_color:int32 header_background_color:int32 bottom_bar_background_color:int32 section_background_color:int32 section_separator_color:int32 text_color:int32 accent_text_color:int32 section_header_text_color:int32 subtitle_text_color:int32 destructive_text_color:int32 hint_color:int32 link_color:int32 button_color:int32 button_text_color:int32 = ThemeParameters; //@description Portion of the price of a product (e.g., "delivery cost", "tax amount") //@label Label for this portion of the product price @@ -3163,15 +3199,15 @@ paidMediaVideo#1bb52e09 video:video = PaidMedia; //@description The media is unsupported paidMediaUnsupported#6bc3e26 = PaidMedia; -//@description Describes parameters of a Telegram Premium giveaway -//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Premium subscription. +//@description Describes parameters of a giveaway +//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Telegram Premium subscription, //@additional_chat_ids Identifiers of other supergroup or channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats //@winners_selection_date Point in time (Unix timestamp) when the giveaway is expected to be performed; must be 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways //@only_new_members True, if only new members of the chats will be eligible for the giveaway //@has_public_winners True, if the list of winners of the giveaway will be available to everyone //@country_codes The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be eligible for the giveaway. If empty, then all users can participate in the giveaway. //@prize_description Additional description of the giveaway prize; 0-128 characters -premiumGiveawayParameters#f9f5bf5e boosted_chat_id:int53 additional_chat_ids:vector winners_selection_date:int32 only_new_members:Bool has_public_winners:Bool country_codes:vector prize_description:string = PremiumGiveawayParameters; +giveawayParameters#16f1de3d boosted_chat_id:int53 additional_chat_ids:vector winners_selection_date:int32 only_new_members:Bool has_public_winners:Bool country_codes:vector prize_description:string = GiveawayParameters; //@description File with the date it was uploaded //@file The file @@ -3815,35 +3851,37 @@ messageGiftedPremium#30dd808e gifter_user_id:int53 receiver_user_id:int53 curren //@code The gift code messagePremiumGiftCode#26bd1bf3 creator_id:MessageSender is_from_giveaway:Bool is_unclaimed:Bool currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker code:string = MessageContent; -//@description A Telegram Premium giveaway was created for the chat. Use telegramPaymentPurposePremiumGiveaway or storePaymentPurposePremiumGiveaway to create a giveaway -messagePremiumGiveawayCreated#270f2c44 = MessageContent; +//@description A giveaway was created for the chat. Use telegramPaymentPurposePremiumGiveaway, storePaymentPurposePremiumGiveaway, telegramPaymentPurposeStarGiveaway, or storePaymentPurposeStarGiveaway to create a giveaway +//@star_count Number of Telegram Stars that will be shared by winners of the giveaway; 0 for Telegram Premium giveaways +messageGiveawayCreated#39f3639f star_count:int53 = MessageContent; -//@description A Telegram Premium giveaway +//@description A giveaway //@parameters Giveaway parameters //@winner_count Number of users which will receive Telegram Premium subscription gift codes -//@month_count Number of months the Telegram Premium subscription will be active after code activation +//@prize Prize of the giveaway //@sticker A sticker to be shown in the message; may be null if unknown -messagePremiumGiveaway#4aa0d0b0 parameters:premiumGiveawayParameters winner_count:int32 month_count:int32 sticker:sticker = MessageContent; +messageGiveaway#eb61daa8 parameters:giveawayParameters winner_count:int32 prize:GiveawayPrize sticker:sticker = MessageContent; -//@description A Telegram Premium giveaway without public winners has been completed for the chat +//@description A giveaway without public winners has been completed for the chat //@giveaway_message_id Identifier of the message with the giveaway; can be 0 if the message was deleted //@winner_count Number of winners in the giveaway -//@unclaimed_prize_count Number of undistributed prizes -messagePremiumGiveawayCompleted#80533949 giveaway_message_id:int53 winner_count:int32 unclaimed_prize_count:int32 = MessageContent; +//@is_star_giveaway True, if the giveaway is a Telegram Star giveaway +//@unclaimed_prize_count Number of undistributed prizes; for Telegram Premium giveaways only +messageGiveawayCompleted#e424c8f7 giveaway_message_id:int53 winner_count:int32 is_star_giveaway:Bool unclaimed_prize_count:int32 = MessageContent; -//@description A Telegram Premium giveaway with public winners has been completed for the chat -//@boosted_chat_id Identifier of the channel chat, which was automatically boosted by the winners of the giveaway for duration of the Premium subscription +//@description A giveaway with public winners has been completed for the chat +//@boosted_chat_id Identifier of the supergroup or channel chat, which was automatically boosted by the winners of the giveaway //@giveaway_message_id Identifier of the message with the giveaway in the boosted chat //@additional_chat_count Number of other chats that participated in the giveaway //@actual_winners_selection_date Point in time (Unix timestamp) when the winners were selected. May be bigger than winners selection date specified in parameters of the giveaway //@only_new_members True, if only new members of the chats were eligible for the giveaway //@was_refunded True, if the giveaway was canceled and was fully refunded -//@month_count Number of months the Telegram Premium subscription will be active after code activation +//@prize Prize of the giveaway //@prize_description Additional description of the giveaway prize //@winner_count Total number of winners in the giveaway //@winner_user_ids Up to 100 user identifiers of the winners of the giveaway -//@unclaimed_prize_count Number of undistributed prizes -messagePremiumGiveawayWinners#815d5f31 boosted_chat_id:int53 giveaway_message_id:int53 additional_chat_count:int32 actual_winners_selection_date:int32 only_new_members:Bool was_refunded:Bool month_count:int32 prize_description:string winner_count:int32 winner_user_ids:vector unclaimed_prize_count:int32 = MessageContent; +//@unclaimed_prize_count Number of undistributed prizes; for Telegram Premium giveaways only +messageGiveawayWinners#1d99a27a boosted_chat_id:int53 giveaway_message_id:int53 additional_chat_count:int32 actual_winners_selection_date:int32 only_new_members:Bool was_refunded:Bool prize:GiveawayPrize prize_description:string winner_count:int32 winner_user_ids:vector unclaimed_prize_count:int32 = MessageContent; //@description Telegram Stars were gifted to a user //@gifter_user_id The identifier of a user that gifted Telegram Stars; 0 if the gift was anonymous or is outgoing @@ -3857,6 +3895,15 @@ messagePremiumGiveawayWinners#815d5f31 boosted_chat_id:int53 giveaway_message_id //@sticker A sticker to be shown in the message; may be null if unknown messageGiftedStars#41bdbea7 gifter_user_id:int53 receiver_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 star_count:int53 transaction_id:string sticker:sticker = MessageContent; +//@description A Telegram Stars were received by the cuurent user from a giveaway +//@star_count Number of Telegram Stars that were received +//@transaction_id Identifier of the transaction for Telegram Stars credit +//@boosted_chat_id Identifier of the supergroup or channel chat, which was automatically boosted by the winners of the giveaway +//@giveaway_message_id Identifier of the message with the giveaway in the boosted chat; can be 0 if the message was deleted +//@is_unclaimed True, if the corresponding winner wasn't chosen and the Telegram Stars were received by the owner of the boosted chat +//@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 contact has registered with Telegram messageContactRegistered#a678fcff = MessageContent; @@ -4028,7 +4075,7 @@ messageSelfDestructTypeImmediately#c23c9005 = MessageSelfDestructType; //@only_preview Pass true to get a fake message instead of actually sending them messageSendOptions#828489ae disable_notification:Bool from_background:Bool protect_content:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; -//@description Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messagePremiumGiveaway, or messagePremiumGiveawayWinners content can't be copied +//@description Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied //@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local //@replace_caption True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false //@new_caption New message caption; pass null to copy message without caption. Ignored if replace_caption is false @@ -4076,7 +4123,8 @@ inputMessageDocument#615b72b9 document:InputFile thumbnail:inputThumbnail disabl //@paid_media The content of the paid media //@caption Message caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters //@show_caption_above_media True, if the caption must be shown above the video; otherwise, the caption must be shown below the video; not supported in secret chats -inputMessagePaidMedia#36f9c23c star_count:int53 paid_media:vector caption:formattedText show_caption_above_media:Bool = InputMessageContent; +//@payload Bot-provided data for the paid media; bots only +inputMessagePaidMedia#370c4490 star_count:int53 paid_media:vector caption:formattedText show_caption_above_media:Bool payload:string = InputMessageContent; //@description A photo message //@photo Photo to send. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20 @@ -4192,6 +4240,7 @@ inputMessageStory#21099d63 story_sender_chat_id:int53 story_id:int32 = InputMess inputMessageForwarded#651a73f8 from_chat_id:int53 message_id:int53 in_game_share:Bool copy_options:messageCopyOptions = InputMessageContent; //@description Contains properties of a message and describes actions that can be done with the message right now +//@can_be_copied_to_secret_chat True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options //@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false //@can_be_deleted_for_all_users True, if the message can be deleted for all users using the method deleteMessages with revoke == true //@can_be_edited True, if the message can be edited using the methods editMessageText, editMessageMedia, editMessageCaption, or editMessageReplyMarkup. @@ -4216,7 +4265,7 @@ inputMessageForwarded#651a73f8 from_chat_id:int53 message_id:int53 in_game_share //@can_report_supergroup_spam True, if the message can be reported using reportSupergroupSpam //@can_set_fact_check True, if fact check for the message can be changed through setMessageFactCheck //@need_show_statistics True, if message statistics must be available from context menu of the message -messageProperties#11deeec2 can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_scheduling_state:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; +messageProperties#315677ac can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_scheduling_state:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; //@class SearchMessagesFilter @description Represents a filter for message search results @@ -4794,23 +4843,25 @@ chatBoostFeatures#803214be features:vector min_profile_b //@gift_code The created Telegram Premium gift code, which is known only if this is a gift code for the current user, or it has already been claimed chatBoostSourceGiftCode#fa2412ba user_id:int53 gift_code:string = ChatBoostSource; -//@description The chat created a Telegram Premium giveaway +//@description The chat created a giveaway //@user_id Identifier of a user that won in the giveaway; 0 if none -//@gift_code The created Telegram Premium gift code if it was used by the user or can be claimed by the current user; an empty string otherwise +//@gift_code The created Telegram Premium gift code if it was used by the user or can be claimed by the current user; an empty string otherwise; for Telegram Premium giveways only +//@star_count Number of Telegram Stars distributed among winners of the giveaway //@giveaway_message_id Identifier of the corresponding giveaway message; can be an identifier of a deleted message -//@is_unclaimed True, if the winner for the corresponding Telegram Premium subscription wasn't chosen, because there were not enough participants -chatBoostSourceGiveaway#90d1c70 user_id:int53 gift_code:string giveaway_message_id:int53 is_unclaimed:Bool = ChatBoostSource; +//@is_unclaimed True, if the winner for the corresponding giveaway prize wasn't chosen, because there were not enough participants +chatBoostSourceGiveaway#7254949a user_id:int53 gift_code:string star_count:int53 giveaway_message_id:int53 is_unclaimed:Bool = ChatBoostSource; //@description A user with Telegram Premium subscription or gifted Telegram Premium boosted the chat //@user_id Identifier of the user chatBoostSourcePremium#ed4eb user_id:int53 = ChatBoostSource; -//@description Describes a prepaid Telegram Premium giveaway +//@description Describes a prepaid giveaway //@id Unique identifier of the prepaid giveaway -//@winner_count Number of users which will receive Telegram Premium subscription gift codes -//@month_count Number of months the Telegram Premium subscription will be active after code activation +//@winner_count Number of users which will receive giveaway prize +//@prize Prize of the giveaway +//@boost_count The number of boosts received by the chat from the giveaway; for Telegram Star giveaways only //@payment_date Point in time (Unix timestamp) when the giveaway was paid -prepaidPremiumGiveaway#6bd53140 id:int64 winner_count:int32 month_count:int32 payment_date:int32 = PrepaidPremiumGiveaway; +prepaidGiveaway#ef70338f id:int64 winner_count:int32 prize:GiveawayPrize boost_count:int32 payment_date:int32 = PrepaidGiveaway; //@description Describes current boost status of a chat //@boost_url An HTTP URL, which can be used to boost the chat @@ -4823,7 +4874,7 @@ prepaidPremiumGiveaway#6bd53140 id:int64 winner_count:int32 month_count:int32 pa //@premium_member_count Approximate number of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat //@premium_member_percentage A percentage of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat //@prepaid_giveaways The list of prepaid giveaways available for the chat; only for chat administrators -chatBoostStatus#a5007413 boost_url:string applied_slot_ids:vector level:int32 gift_code_boost_count:int32 boost_count:int32 current_level_boost_count:int32 next_level_boost_count:int32 premium_member_count:int32 premium_member_percentage:double prepaid_giveaways:vector = ChatBoostStatus; +chatBoostStatus#401e753c boost_url:string applied_slot_ids:vector level:int32 gift_code_boost_count:int32 boost_count:int32 current_level_boost_count:int32 next_level_boost_count:int32 premium_member_count:int32 premium_member_percentage:double prepaid_giveaways:vector = ChatBoostStatus; //@description Describes a boost applied to a chat //@id Unique identifier of the boost @@ -5574,6 +5625,12 @@ chatEventMemberPromoted#1f4f6861 user_id:int53 old_status:ChatMemberStatus new_s //@new_status New status of the chat member chatEventMemberRestricted#5f951e05 member_id:MessageSender old_status:ChatMemberStatus new_status:ChatMemberStatus = ChatEventAction; +//@description A chat member extended their subscription to the chat +//@user_id Affected chat member user identifier +//@old_status Previous status of the chat member +//@new_status New status of the chat member +chatEventMemberSubscriptionExtended#bbfab002 user_id:int53 old_status:ChatMemberStatus new_status:ChatMemberStatus = ChatEventAction; + //@description The chat available reactions were changed //@old_available_reactions Previous chat available reactions //@new_available_reactions New chat available reactions @@ -5777,7 +5834,8 @@ chatEvents#d73ecdc4 events:vector = ChatEvents; //@invite_link_changes True, if changes to invite links need to be returned //@video_chat_changes True, if video chat actions need to be returned //@forum_changes True, if forum-related actions need to be returned -chatEventLogFilters#623e7a2d message_edits:Bool message_deletions:Bool message_pins:Bool member_joins:Bool member_leaves:Bool member_invites:Bool member_promotions:Bool member_restrictions:Bool info_changes:Bool setting_changes:Bool invite_link_changes:Bool video_chat_changes:Bool forum_changes:Bool = ChatEventLogFilters; +//@subscription_extensions True, if subscription extensions need to be returned +chatEventLogFilters#c26e31b1 message_edits:Bool message_deletions:Bool message_pins:Bool member_joins:Bool member_leaves:Bool member_invites:Bool member_promotions:Bool member_restrictions:Bool info_changes:Bool setting_changes:Bool invite_link_changes:Bool video_chat_changes:Bool forum_changes:Bool subscription_extensions:Bool = ChatEventLogFilters; //@class LanguagePackStringValue @description Represents the value of a string in a language pack @@ -6099,7 +6157,15 @@ storePaymentPurposePremiumGiftCodes#9e11cf42 boosted_chat_id:int53 currency:stri //@parameters Giveaway parameters //@currency ISO 4217 currency code of the payment currency //@amount Paid amount, in the smallest units of the currency -storePaymentPurposePremiumGiveaway#504790d9 parameters:premiumGiveawayParameters currency:string amount:int53 = StorePaymentPurpose; +storePaymentPurposePremiumGiveaway#4da47aaa parameters:giveawayParameters currency:string amount:int53 = StorePaymentPurpose; + +//@description The user creating a Telegram Star giveaway +//@parameters Giveaway parameters +//@currency ISO 4217 currency code of the payment currency +//@amount Paid amount, in the smallest units of the currency +//@winner_count The number of users to receive Telegram Stars +//@star_count The number of Telegram Stars to be distributed through the giveaway +storePaymentPurposeStarGiveaway#c96d899 parameters:giveawayParameters currency:string amount:int53 winner_count:int32 star_count:int53 = StorePaymentPurpose; //@description The user buying Telegram Stars //@currency ISO 4217 currency code of the payment currency @@ -6130,7 +6196,7 @@ telegramPaymentPurposePremiumGiftCodes#91009cc boosted_chat_id:int53 currency:st //@amount Paid amount, in the smallest units of the currency //@winner_count Number of users which will be able to activate the gift codes //@month_count Number of months the Telegram Premium subscription will be active for the users -telegramPaymentPurposePremiumGiveaway#bfd4a227 parameters:premiumGiveawayParameters currency:string amount:int53 winner_count:int32 month_count:int32 = TelegramPaymentPurpose; +telegramPaymentPurposePremiumGiveaway#d2a7c33f parameters:giveawayParameters currency:string amount:int53 winner_count:int32 month_count:int32 = TelegramPaymentPurpose; //@description The user buying Telegram Stars //@currency ISO 4217 currency code of the payment currency @@ -6145,6 +6211,14 @@ telegramPaymentPurposeStars#e273ee52 currency:string amount:int53 star_count:int //@star_count Number of bought Telegram Stars telegramPaymentPurposeGiftedStars#91b68a36 user_id:int53 currency:string amount:int53 star_count:int53 = TelegramPaymentPurpose; +//@description The user creating a Telegram Star giveaway +//@parameters Giveaway parameters +//@currency ISO 4217 currency code of the payment currency +//@amount Paid amount, in the smallest units of the currency +//@winner_count The number of users to receive Telegram Stars +//@star_count The number of Telegram Stars to be distributed through the giveaway +telegramPaymentPurposeStarGiveaway#3c79a391 parameters:giveawayParameters currency:string amount:int53 winner_count:int32 star_count:int53 = TelegramPaymentPurpose; + //@description The user joins a chat and subscribes to regular payments in Telegram Stars //@invite_link Invite link to use telegramPaymentPurposeJoinChat#8ddd6788 invite_link:string = TelegramPaymentPurpose; @@ -6450,11 +6524,11 @@ pushMessageContentPoll#fd5a743a question:string is_regular:Bool is_pinned:Bool = //@month_count Number of months the Telegram Premium subscription will be active after code activation pushMessageContentPremiumGiftCode#18a15025 month_count:int32 = PushMessageContent; -//@description A message with a Telegram Premium giveaway -//@winner_count Number of users which will receive Telegram Premium subscription gift codes; 0 for pinned message -//@month_count Number of months the Telegram Premium subscription will be active after code activation; 0 for pinned message +//@description A message with a giveaway +//@winner_count Number of users which will receive giveaway prizes; 0 for pinned message +//@prize Prize of the giveaway; may be null for pinned message //@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentPremiumGiveaway#57d26df1 winner_count:int32 month_count:int32 is_pinned:Bool = PushMessageContent; +pushMessageContentGiveaway#d63e7f8e winner_count:int32 prize:GiveawayPrize is_pinned:Bool = PushMessageContent; //@description A screenshot of a message in the chat has been taken pushMessageContentScreenshotTaken#cc51ff9 = PushMessageContent; @@ -6766,7 +6840,7 @@ canSendMessageToUserResultUserIsDeleted#8c172661 = CanSendMessageToUserResult; canSendMessageToUserResultUserRestrictsNewChats#7304e1d5 = CanSendMessageToUserResult; //@description Contains information about the period of inactivity after which the current user's account will automatically be deleted -//@days Number of days of inactivity before the account will be flagged for deletion; 30-366 days +//@days Number of days of inactivity before the account will be flagged for deletion; 30-730 days accountTtl#4ef23284 days:int32 = AccountTtl; //@description Contains default auto-delete timer setting for new chats @@ -7642,7 +7716,8 @@ chatStatisticsChannel#b8e95b4 period:dateRange member_count:statisticalValue mea //@total_amount Total amount of the cryptocurrency earned, in the smallest units of the cryptocurrency //@balance_amount Amount of the cryptocurrency that isn't withdrawn yet, in the smallest units of the cryptocurrency //@available_amount Amount of the cryptocurrency available for withdrawal, in the smallest units of the cryptocurrency -chatRevenueAmount#4f3bb29f cryptocurrency:string total_amount:int64 balance_amount:int64 available_amount:int64 = ChatRevenueAmount; +//@withdrawal_enabled True, if Telegram Stars can be withdrawn now or later +chatRevenueAmount#a648ce58 cryptocurrency:string total_amount:int64 balance_amount:int64 available_amount:int64 withdrawal_enabled:Bool = ChatRevenueAmount; //@description A detailed statistics about revenue earned from sponsored messages in a chat //@revenue_by_hour_graph A graph containing amount of revenue in a given hour @@ -8570,6 +8645,11 @@ updateMessageReaction#f46c854a chat_id:int53 message_id:int53 actor_id:MessageSe //@reactions The list of reactions added to the message updateMessageReactions#bd5618e9 chat_id:int53 message_id:int53 date:int32 reactions:vector = Update; +//@description Paid media were purchased by a user; for bots only +//@user_id User identifier +//@payload Bot-specified payload for the paid media +updatePaidMediaPurchased#a410e65b user_id:int53 payload:string = Update; + //@description Contains a list of updates //@updates List of updates updates#b9829222 updates:vector = Updates; @@ -9523,7 +9603,7 @@ setBusinessMessageIsPinned#ff14f5f0 business_connection_id:string chat_id:int53 //@name The name of the shortcut; 1-32 characters checkQuickReplyShortcutName#7d3dd129 name:string = Ok; -//@description Loads quick reply shortcuts created by the current user. The loaded topics will be sent through updateQuickReplyShortcuts +//@description Loads quick reply shortcuts created by the current user. The loaded data will be sent through updateQuickReplyShortcut and updateQuickReplyShortcuts loadQuickReplyShortcuts#c367b29d = Ok; //@description Changes name of a quick reply shortcut @@ -9667,7 +9747,7 @@ clearRecentReactions#4d61c752 = Ok; //@description Adds a reaction or a tag to a message. Use getMessageAvailableReactions to receive the list of available reactions for the message //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message -//@reaction_type Type of the reaction to add. Use addPaidMessageReaction instead to add the paid reaction +//@reaction_type Type of the reaction to add. Use addPendingPaidMessageReaction instead to add the paid reaction //@is_big Pass true if the reaction is added with a big animation //@update_recent_reactions Pass true if the reaction needs to be added to recent reactions; tags are never added to the list of recent reactions addMessageReaction#549855ed chat_id:int53 message_id:int53 reaction_type:ReactionType is_big:Bool update_recent_reactions:Bool = Ok; @@ -9678,14 +9758,20 @@ addMessageReaction#549855ed chat_id:int53 message_id:int53 reaction_type:Reactio //@reaction_type Type of the reaction to remove. The paid reaction can't be removed removeMessageReaction#97474d7b chat_id:int53 message_id:int53 reaction_type:ReactionType = Ok; -//@description Adds the paid message reaction to a message. Use getMessageAvailableReactions to receive the list of available reactions for the message +//@description Adds the paid message reaction to a message. Use getMessageAvailableReactions to check whether the reaction is available for the message //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message -//@star_count Number of Telegram Stars to be used for the reaction; 1-getOption("paid_reaction_star_count_max") -//@is_anonymous Pass true to make paid reaction of the user on the message anonymous; pass false to make the user's profile visible among top reactors -addPaidMessageReaction#542fae53 chat_id:int53 message_id:int53 star_count:int53 is_anonymous:Bool = Ok; +//@star_count Number of Telegram Stars to be used for the reaction. The total number of pending paid reactions must not exceed getOption("paid_reaction_star_count_max") +//@use_default_is_anonymous Pass true if the user didn't choose anonymity explicitly, for example, the reaction is set from the message bubble +//@is_anonymous Pass true to make paid reaction of the user on the message anonymous; pass false to make the user's profile visible among top reactors. Ignored if use_default_is_anonymous == true +addPendingPaidMessageReaction#66548919 chat_id:int53 message_id:int53 star_count:int53 use_default_is_anonymous:Bool is_anonymous:Bool = Ok; -//@description Removes all pending paid reactions on a message. Can be called within 5 seconds after the last addPaidMessageReaction call +//@description Applies all pending paid reactions on a message +//@chat_id Identifier of the chat to which the message belongs +//@message_id Identifier of the message +commitPendingPaidMessageReactions#f5c95606 chat_id:int53 message_id:int53 = Ok; + +//@description Removes all pending paid reactions on a message //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message removePendingPaidMessageReactions#41949cfb chat_id:int53 message_id:int53 = Ok; @@ -9863,10 +9949,10 @@ getInlineQueryResults#79dcf86c bot_user_id:int53 chat_id:int53 user_location:loc //@next_offset Offset for the next inline query; pass an empty string if there are no more results answerInlineQuery#ac7cc5e6 inline_query_id:int64 is_personal:Bool button:inlineQueryResultsButton results:vector cache_time:int32 next_offset:string = Ok; -//@description Returns popular Web App bots +//@description Returns the most grossing Web App bots //@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 bots to be returned; up to 100 -getPopularWebAppBots#e8d04cb offset:string limit:int32 = FoundUsers; +getGrossingWebAppBots#6522ce1a offset:string limit:int32 = FoundUsers; //@description Returns information about a Web App by its short name. Returns a 404 error if the Web App is not found //@bot_user_id Identifier of the target bot @@ -11214,6 +11300,10 @@ getAttachedStickerSets#4d9d930d file_id:int32 = StickerSets; //@set_id Identifier of the sticker set getStickerSet#3eb91bc3 set_id:int64 = StickerSet; +//@description Returns name of a sticker set by its identifier +//@set_id Identifier of the sticker set +getStickerSetName#3dfad681 set_id:int64 = Text; + //@description Searches for a sticker set by its name //@name Name of the sticker set searchStickerSet#45049cee name:string = StickerSet; @@ -12286,7 +12376,7 @@ clickPremiumSubscriptionButton#e9fca306 = Ok; //@description Returns state of Telegram Premium subscription and promotion videos for Premium features getPremiumState#278e3ae2 = PremiumState; -//@description Returns available options for Telegram Premium gift code or giveaway creation +//@description Returns available options for Telegram Premium gift code or Telegram Premium giveaway creation //@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user; 0 if none getPremiumGiftCodePaymentOptions#89523a2c boosted_chat_id:int53 = PremiumGiftCodePaymentOptions; @@ -12298,15 +12388,17 @@ checkPremiumGiftCode#958ad664 code:string = PremiumGiftCodeInfo; //@code The code to apply applyPremiumGiftCode#afb44c1e code:string = Ok; -//@description Launches a prepaid Telegram Premium giveaway +//@description Launches a prepaid giveaway //@giveaway_id Unique identifier of the prepaid giveaway //@parameters Giveaway parameters -launchPrepaidPremiumGiveaway#5328fea1 giveaway_id:int64 parameters:premiumGiveawayParameters = Ok; +//@winner_count The number of users to receive giveaway prize +//@star_count The number of Telegram Stars to be distributed through the giveaway; pass 0 for Telegram Premium giveaways +launchPrepaidGiveaway#261d783a giveaway_id:int64 parameters:giveawayParameters winner_count:int32 star_count:int53 = Ok; -//@description Returns information about a Telegram Premium giveaway +//@description Returns information about a giveaway //@chat_id Identifier of the channel chat which started the giveaway //@message_id Identifier of the giveaway or a giveaway winners message in the chat -getPremiumGiveawayInfo#6adb7b97 chat_id:int53 message_id:int53 = PremiumGiveawayInfo; +getGiveawayInfo#b78790bb chat_id:int53 message_id:int53 = GiveawayInfo; //@description Returns available options for Telegram Stars purchase getStarPaymentOptions#6d930644 = StarPaymentOptions; @@ -12315,6 +12407,9 @@ getStarPaymentOptions#6d930644 = StarPaymentOptions; //@user_id Identifier of the user that will receive Telegram Stars; pass 0 to get options for an unspecified user getStarGiftPaymentOptions#e22760e3 user_id:int53 = StarPaymentOptions; +//@description Returns available options for Telegram Star giveaway creation +getStarGiveawayPaymentOptions#cb5bdb1e = StarGiveawayPaymentOptions; + //@description Returns the list of Telegram Star transactions for the specified owner //@owner_id Identifier of the owner of the Telegram Stars; can be the identifier of the current user, identifier of an owned bot, //@subscription_id If non-empty, only transactions related to the Star Subscription will be returned diff --git a/tdapi/tl_account_ttl_gen.go b/tdapi/tl_account_ttl_gen.go index 88a272a949..a0a36dbcc5 100644 --- a/tdapi/tl_account_ttl_gen.go +++ b/tdapi/tl_account_ttl_gen.go @@ -33,7 +33,7 @@ var ( // AccountTTL represents TL type `accountTtl#4ef23284`. type AccountTTL struct { - // Number of days of inactivity before the account will be flagged for deletion; 30-366 + // Number of days of inactivity before the account will be flagged for deletion; 30-730 // days Days int32 } diff --git a/tdapi/tl_add_message_reaction_gen.go b/tdapi/tl_add_message_reaction_gen.go index 0a93083f67..294f853bb8 100644 --- a/tdapi/tl_add_message_reaction_gen.go +++ b/tdapi/tl_add_message_reaction_gen.go @@ -37,7 +37,7 @@ type AddMessageReactionRequest struct { ChatID int64 // Identifier of the message MessageID int64 - // Type of the reaction to add. Use addPaidMessageReaction instead to add the paid + // Type of the reaction to add. Use addPendingPaidMessageReaction instead to add the paid // reaction ReactionType ReactionTypeClass // Pass true if the reaction is added with a big animation diff --git a/tdapi/tl_add_paid_message_reaction_gen.go b/tdapi/tl_add_paid_message_reaction_gen.go deleted file mode 100644 index c90a657016..0000000000 --- a/tdapi/tl_add_paid_message_reaction_gen.go +++ /dev/null @@ -1,307 +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{} -) - -// AddPaidMessageReactionRequest represents TL type `addPaidMessageReaction#542fae53`. -type AddPaidMessageReactionRequest struct { - // Identifier of the chat to which the message belongs - ChatID int64 - // Identifier of the message - MessageID int64 - // Number of Telegram Stars to be used for the reaction; - // 1-getOption("paid_reaction_star_count_max") - StarCount int64 - // Pass true to make paid reaction of the user on the message anonymous; pass false to - // make the user's profile visible among top reactors - IsAnonymous bool -} - -// AddPaidMessageReactionRequestTypeID is TL type id of AddPaidMessageReactionRequest. -const AddPaidMessageReactionRequestTypeID = 0x542fae53 - -// Ensuring interfaces in compile-time for AddPaidMessageReactionRequest. -var ( - _ bin.Encoder = &AddPaidMessageReactionRequest{} - _ bin.Decoder = &AddPaidMessageReactionRequest{} - _ bin.BareEncoder = &AddPaidMessageReactionRequest{} - _ bin.BareDecoder = &AddPaidMessageReactionRequest{} -) - -func (a *AddPaidMessageReactionRequest) Zero() bool { - if a == nil { - return true - } - if !(a.ChatID == 0) { - return false - } - if !(a.MessageID == 0) { - return false - } - if !(a.StarCount == 0) { - return false - } - if !(a.IsAnonymous == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddPaidMessageReactionRequest) String() string { - if a == nil { - return "AddPaidMessageReactionRequest(nil)" - } - type Alias AddPaidMessageReactionRequest - return fmt.Sprintf("AddPaidMessageReactionRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddPaidMessageReactionRequest) TypeID() uint32 { - return AddPaidMessageReactionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddPaidMessageReactionRequest) TypeName() string { - return "addPaidMessageReaction" -} - -// TypeInfo returns info about TL type. -func (a *AddPaidMessageReactionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addPaidMessageReaction", - ID: AddPaidMessageReactionRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "StarCount", - SchemaName: "star_count", - }, - { - Name: "IsAnonymous", - SchemaName: "is_anonymous", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddPaidMessageReactionRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addPaidMessageReaction#542fae53 as nil") - } - b.PutID(AddPaidMessageReactionRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddPaidMessageReactionRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addPaidMessageReaction#542fae53 as nil") - } - b.PutInt53(a.ChatID) - b.PutInt53(a.MessageID) - b.PutInt53(a.StarCount) - b.PutBool(a.IsAnonymous) - return nil -} - -// Decode implements bin.Decoder. -func (a *AddPaidMessageReactionRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addPaidMessageReaction#542fae53 to nil") - } - if err := b.ConsumeID(AddPaidMessageReactionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addPaidMessageReaction#542fae53: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddPaidMessageReactionRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addPaidMessageReaction#542fae53 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addPaidMessageReaction#542fae53: field chat_id: %w", err) - } - a.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addPaidMessageReaction#542fae53: field message_id: %w", err) - } - a.MessageID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addPaidMessageReaction#542fae53: field star_count: %w", err) - } - a.StarCount = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addPaidMessageReaction#542fae53: field is_anonymous: %w", err) - } - a.IsAnonymous = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddPaidMessageReactionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addPaidMessageReaction#542fae53 as nil") - } - b.ObjStart() - b.PutID("addPaidMessageReaction") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(a.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(a.MessageID) - b.Comma() - b.FieldStart("star_count") - b.PutInt53(a.StarCount) - b.Comma() - b.FieldStart("is_anonymous") - b.PutBool(a.IsAnonymous) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddPaidMessageReactionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addPaidMessageReaction#542fae53 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addPaidMessageReaction"); err != nil { - return fmt.Errorf("unable to decode addPaidMessageReaction#542fae53: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addPaidMessageReaction#542fae53: field chat_id: %w", err) - } - a.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addPaidMessageReaction#542fae53: field message_id: %w", err) - } - a.MessageID = value - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addPaidMessageReaction#542fae53: field star_count: %w", err) - } - a.StarCount = value - case "is_anonymous": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addPaidMessageReaction#542fae53: field is_anonymous: %w", err) - } - a.IsAnonymous = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (a *AddPaidMessageReactionRequest) GetChatID() (value int64) { - if a == nil { - return - } - return a.ChatID -} - -// GetMessageID returns value of MessageID field. -func (a *AddPaidMessageReactionRequest) GetMessageID() (value int64) { - if a == nil { - return - } - return a.MessageID -} - -// GetStarCount returns value of StarCount field. -func (a *AddPaidMessageReactionRequest) GetStarCount() (value int64) { - if a == nil { - return - } - return a.StarCount -} - -// GetIsAnonymous returns value of IsAnonymous field. -func (a *AddPaidMessageReactionRequest) GetIsAnonymous() (value bool) { - if a == nil { - return - } - return a.IsAnonymous -} - -// AddPaidMessageReaction invokes method addPaidMessageReaction#542fae53 returning error if any. -func (c *Client) AddPaidMessageReaction(ctx context.Context, request *AddPaidMessageReactionRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_add_pending_paid_message_reaction_gen.go b/tdapi/tl_add_pending_paid_message_reaction_gen.go new file mode 100644 index 0000000000..901c5f0b63 --- /dev/null +++ b/tdapi/tl_add_pending_paid_message_reaction_gen.go @@ -0,0 +1,343 @@ +// 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{} +) + +// AddPendingPaidMessageReactionRequest represents TL type `addPendingPaidMessageReaction#66548919`. +type AddPendingPaidMessageReactionRequest struct { + // Identifier of the chat to which the message belongs + ChatID int64 + // Identifier of the message + MessageID int64 + // Number of Telegram Stars to be used for the reaction. The total number of pending paid + // reactions must not exceed getOption("paid_reaction_star_count_max") + StarCount int64 + // Pass true if the user didn't choose anonymity explicitly, for example, the reaction is + // set from the message bubble + UseDefaultIsAnonymous bool + // Pass true to make paid reaction of the user on the message anonymous; pass false to + // make the user's profile visible among top reactors. Ignored if + // use_default_is_anonymous == true + IsAnonymous bool +} + +// AddPendingPaidMessageReactionRequestTypeID is TL type id of AddPendingPaidMessageReactionRequest. +const AddPendingPaidMessageReactionRequestTypeID = 0x66548919 + +// Ensuring interfaces in compile-time for AddPendingPaidMessageReactionRequest. +var ( + _ bin.Encoder = &AddPendingPaidMessageReactionRequest{} + _ bin.Decoder = &AddPendingPaidMessageReactionRequest{} + _ bin.BareEncoder = &AddPendingPaidMessageReactionRequest{} + _ bin.BareDecoder = &AddPendingPaidMessageReactionRequest{} +) + +func (a *AddPendingPaidMessageReactionRequest) Zero() bool { + if a == nil { + return true + } + if !(a.ChatID == 0) { + return false + } + if !(a.MessageID == 0) { + return false + } + if !(a.StarCount == 0) { + return false + } + if !(a.UseDefaultIsAnonymous == false) { + return false + } + if !(a.IsAnonymous == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (a *AddPendingPaidMessageReactionRequest) String() string { + if a == nil { + return "AddPendingPaidMessageReactionRequest(nil)" + } + type Alias AddPendingPaidMessageReactionRequest + return fmt.Sprintf("AddPendingPaidMessageReactionRequest%+v", Alias(*a)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AddPendingPaidMessageReactionRequest) TypeID() uint32 { + return AddPendingPaidMessageReactionRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*AddPendingPaidMessageReactionRequest) TypeName() string { + return "addPendingPaidMessageReaction" +} + +// TypeInfo returns info about TL type. +func (a *AddPendingPaidMessageReactionRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "addPendingPaidMessageReaction", + ID: AddPendingPaidMessageReactionRequestTypeID, + } + if a == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "MessageID", + SchemaName: "message_id", + }, + { + Name: "StarCount", + SchemaName: "star_count", + }, + { + Name: "UseDefaultIsAnonymous", + SchemaName: "use_default_is_anonymous", + }, + { + Name: "IsAnonymous", + SchemaName: "is_anonymous", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (a *AddPendingPaidMessageReactionRequest) Encode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode addPendingPaidMessageReaction#66548919 as nil") + } + b.PutID(AddPendingPaidMessageReactionRequestTypeID) + return a.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (a *AddPendingPaidMessageReactionRequest) EncodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode addPendingPaidMessageReaction#66548919 as nil") + } + b.PutInt53(a.ChatID) + b.PutInt53(a.MessageID) + b.PutInt53(a.StarCount) + b.PutBool(a.UseDefaultIsAnonymous) + b.PutBool(a.IsAnonymous) + return nil +} + +// Decode implements bin.Decoder. +func (a *AddPendingPaidMessageReactionRequest) Decode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode addPendingPaidMessageReaction#66548919 to nil") + } + if err := b.ConsumeID(AddPendingPaidMessageReactionRequestTypeID); err != nil { + return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: %w", err) + } + return a.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (a *AddPendingPaidMessageReactionRequest) DecodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode addPendingPaidMessageReaction#66548919 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: field chat_id: %w", err) + } + a.ChatID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: field message_id: %w", err) + } + a.MessageID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: field star_count: %w", err) + } + a.StarCount = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: field use_default_is_anonymous: %w", err) + } + a.UseDefaultIsAnonymous = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: field is_anonymous: %w", err) + } + a.IsAnonymous = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (a *AddPendingPaidMessageReactionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if a == nil { + return fmt.Errorf("can't encode addPendingPaidMessageReaction#66548919 as nil") + } + b.ObjStart() + b.PutID("addPendingPaidMessageReaction") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(a.ChatID) + b.Comma() + b.FieldStart("message_id") + b.PutInt53(a.MessageID) + b.Comma() + b.FieldStart("star_count") + b.PutInt53(a.StarCount) + b.Comma() + b.FieldStart("use_default_is_anonymous") + b.PutBool(a.UseDefaultIsAnonymous) + b.Comma() + b.FieldStart("is_anonymous") + b.PutBool(a.IsAnonymous) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (a *AddPendingPaidMessageReactionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if a == nil { + return fmt.Errorf("can't decode addPendingPaidMessageReaction#66548919 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("addPendingPaidMessageReaction"); err != nil { + return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: field chat_id: %w", err) + } + a.ChatID = value + case "message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: field message_id: %w", err) + } + a.MessageID = value + case "star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: field star_count: %w", err) + } + a.StarCount = value + case "use_default_is_anonymous": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: field use_default_is_anonymous: %w", err) + } + a.UseDefaultIsAnonymous = value + case "is_anonymous": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: field is_anonymous: %w", err) + } + a.IsAnonymous = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (a *AddPendingPaidMessageReactionRequest) GetChatID() (value int64) { + if a == nil { + return + } + return a.ChatID +} + +// GetMessageID returns value of MessageID field. +func (a *AddPendingPaidMessageReactionRequest) GetMessageID() (value int64) { + if a == nil { + return + } + return a.MessageID +} + +// GetStarCount returns value of StarCount field. +func (a *AddPendingPaidMessageReactionRequest) GetStarCount() (value int64) { + if a == nil { + return + } + return a.StarCount +} + +// GetUseDefaultIsAnonymous returns value of UseDefaultIsAnonymous field. +func (a *AddPendingPaidMessageReactionRequest) GetUseDefaultIsAnonymous() (value bool) { + if a == nil { + return + } + return a.UseDefaultIsAnonymous +} + +// GetIsAnonymous returns value of IsAnonymous field. +func (a *AddPendingPaidMessageReactionRequest) GetIsAnonymous() (value bool) { + if a == nil { + return + } + return a.IsAnonymous +} + +// AddPendingPaidMessageReaction invokes method addPendingPaidMessageReaction#66548919 returning error if any. +func (c *Client) AddPendingPaidMessageReaction(ctx context.Context, request *AddPendingPaidMessageReactionRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_bot_transaction_purpose_gen.go b/tdapi/tl_bot_transaction_purpose_gen.go index a97b33c35c..6dab81121e 100644 --- a/tdapi/tl_bot_transaction_purpose_gen.go +++ b/tdapi/tl_bot_transaction_purpose_gen.go @@ -31,14 +31,16 @@ var ( _ = tdjson.Encoder{} ) -// BotTransactionPurposePaidMedia represents TL type `botTransactionPurposePaidMedia#9593b72f`. +// BotTransactionPurposePaidMedia represents TL type `botTransactionPurposePaidMedia#62952496`. type BotTransactionPurposePaidMedia struct { // The bought media if the trancastion wasn't refunded Media []PaidMediaClass + // Bot-provided payload; for bots only + Payload string } // BotTransactionPurposePaidMediaTypeID is TL type id of BotTransactionPurposePaidMedia. -const BotTransactionPurposePaidMediaTypeID = 0x9593b72f +const BotTransactionPurposePaidMediaTypeID = 0x62952496 // construct implements constructor of BotTransactionPurposeClass. func (b BotTransactionPurposePaidMedia) construct() BotTransactionPurposeClass { return &b } @@ -60,6 +62,9 @@ func (b *BotTransactionPurposePaidMedia) Zero() bool { if !(b.Media == nil) { return false } + if !(b.Payload == "") { + return false + } return true } @@ -100,6 +105,10 @@ func (b *BotTransactionPurposePaidMedia) TypeInfo() tdp.Type { Name: "Media", SchemaName: "media", }, + { + Name: "Payload", + SchemaName: "payload", + }, } return typ } @@ -107,7 +116,7 @@ func (b *BotTransactionPurposePaidMedia) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (b *BotTransactionPurposePaidMedia) Encode(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't encode botTransactionPurposePaidMedia#9593b72f as nil") + return fmt.Errorf("can't encode botTransactionPurposePaidMedia#62952496 as nil") } buf.PutID(BotTransactionPurposePaidMediaTypeID) return b.EncodeBare(buf) @@ -116,27 +125,28 @@ func (b *BotTransactionPurposePaidMedia) Encode(buf *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (b *BotTransactionPurposePaidMedia) EncodeBare(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't encode botTransactionPurposePaidMedia#9593b72f as nil") + return fmt.Errorf("can't encode botTransactionPurposePaidMedia#62952496 as nil") } buf.PutInt(len(b.Media)) for idx, v := range b.Media { if v == nil { - return fmt.Errorf("unable to encode botTransactionPurposePaidMedia#9593b72f: field media element with index %d is nil", idx) + return fmt.Errorf("unable to encode botTransactionPurposePaidMedia#62952496: field media element with index %d is nil", idx) } if err := v.EncodeBare(buf); err != nil { - return fmt.Errorf("unable to encode bare botTransactionPurposePaidMedia#9593b72f: field media element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare botTransactionPurposePaidMedia#62952496: field media element with index %d: %w", idx, err) } } + buf.PutString(b.Payload) return nil } // Decode implements bin.Decoder. func (b *BotTransactionPurposePaidMedia) Decode(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't decode botTransactionPurposePaidMedia#9593b72f to nil") + return fmt.Errorf("can't decode botTransactionPurposePaidMedia#62952496 to nil") } if err := buf.ConsumeID(BotTransactionPurposePaidMediaTypeID); err != nil { - return fmt.Errorf("unable to decode botTransactionPurposePaidMedia#9593b72f: %w", err) + return fmt.Errorf("unable to decode botTransactionPurposePaidMedia#62952496: %w", err) } return b.DecodeBare(buf) } @@ -144,12 +154,12 @@ func (b *BotTransactionPurposePaidMedia) Decode(buf *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (b *BotTransactionPurposePaidMedia) DecodeBare(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't decode botTransactionPurposePaidMedia#9593b72f to nil") + return fmt.Errorf("can't decode botTransactionPurposePaidMedia#62952496 to nil") } { headerLen, err := buf.Int() if err != nil { - return fmt.Errorf("unable to decode botTransactionPurposePaidMedia#9593b72f: field media: %w", err) + return fmt.Errorf("unable to decode botTransactionPurposePaidMedia#62952496: field media: %w", err) } if headerLen > 0 { @@ -158,18 +168,25 @@ func (b *BotTransactionPurposePaidMedia) DecodeBare(buf *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodePaidMedia(buf) if err != nil { - return fmt.Errorf("unable to decode botTransactionPurposePaidMedia#9593b72f: field media: %w", err) + return fmt.Errorf("unable to decode botTransactionPurposePaidMedia#62952496: field media: %w", err) } b.Media = append(b.Media, value) } } + { + value, err := buf.String() + if err != nil { + return fmt.Errorf("unable to decode botTransactionPurposePaidMedia#62952496: field payload: %w", err) + } + b.Payload = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (b *BotTransactionPurposePaidMedia) EncodeTDLibJSON(buf tdjson.Encoder) error { if b == nil { - return fmt.Errorf("can't encode botTransactionPurposePaidMedia#9593b72f as nil") + return fmt.Errorf("can't encode botTransactionPurposePaidMedia#62952496 as nil") } buf.ObjStart() buf.PutID("botTransactionPurposePaidMedia") @@ -178,16 +195,19 @@ func (b *BotTransactionPurposePaidMedia) EncodeTDLibJSON(buf tdjson.Encoder) err buf.ArrStart() for idx, v := range b.Media { if v == nil { - return fmt.Errorf("unable to encode botTransactionPurposePaidMedia#9593b72f: field media element with index %d is nil", idx) + return fmt.Errorf("unable to encode botTransactionPurposePaidMedia#62952496: field media element with index %d is nil", idx) } if err := v.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botTransactionPurposePaidMedia#9593b72f: field media element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode botTransactionPurposePaidMedia#62952496: field media element with index %d: %w", idx, err) } buf.Comma() } buf.StripComma() buf.ArrEnd() buf.Comma() + buf.FieldStart("payload") + buf.PutString(b.Payload) + buf.Comma() buf.StripComma() buf.ObjEnd() return nil @@ -196,26 +216,32 @@ func (b *BotTransactionPurposePaidMedia) EncodeTDLibJSON(buf tdjson.Encoder) err // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (b *BotTransactionPurposePaidMedia) DecodeTDLibJSON(buf tdjson.Decoder) error { if b == nil { - return fmt.Errorf("can't decode botTransactionPurposePaidMedia#9593b72f to nil") + return fmt.Errorf("can't decode botTransactionPurposePaidMedia#62952496 to nil") } return buf.Obj(func(buf tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := buf.ConsumeID("botTransactionPurposePaidMedia"); err != nil { - return fmt.Errorf("unable to decode botTransactionPurposePaidMedia#9593b72f: %w", err) + return fmt.Errorf("unable to decode botTransactionPurposePaidMedia#62952496: %w", err) } case "media": if err := buf.Arr(func(buf tdjson.Decoder) error { value, err := DecodeTDLibJSONPaidMedia(buf) if err != nil { - return fmt.Errorf("unable to decode botTransactionPurposePaidMedia#9593b72f: field media: %w", err) + return fmt.Errorf("unable to decode botTransactionPurposePaidMedia#62952496: field media: %w", err) } b.Media = append(b.Media, value) return nil }); err != nil { - return fmt.Errorf("unable to decode botTransactionPurposePaidMedia#9593b72f: field media: %w", err) + return fmt.Errorf("unable to decode botTransactionPurposePaidMedia#62952496: field media: %w", err) + } + case "payload": + value, err := buf.String() + if err != nil { + return fmt.Errorf("unable to decode botTransactionPurposePaidMedia#62952496: field payload: %w", err) } + b.Payload = value default: return buf.Skip() } @@ -231,6 +257,14 @@ func (b *BotTransactionPurposePaidMedia) GetMedia() (value []PaidMediaClass) { return b.Media } +// GetPayload returns value of Payload field. +func (b *BotTransactionPurposePaidMedia) GetPayload() (value string) { + if b == nil { + return + } + return b.Payload +} + // BotTransactionPurposeInvoicePayment represents TL type `botTransactionPurposeInvoicePayment#699860ac`. type BotTransactionPurposeInvoicePayment struct { // Information about the bought product; may be null if not applicable @@ -443,7 +477,7 @@ const BotTransactionPurposeClassName = "BotTransactionPurpose" // panic(err) // } // switch v := g.(type) { -// case *tdapi.BotTransactionPurposePaidMedia: // botTransactionPurposePaidMedia#9593b72f +// case *tdapi.BotTransactionPurposePaidMedia: // botTransactionPurposePaidMedia#62952496 // case *tdapi.BotTransactionPurposeInvoicePayment: // botTransactionPurposeInvoicePayment#699860ac // default: panic(v) // } @@ -477,7 +511,7 @@ func DecodeBotTransactionPurpose(buf *bin.Buffer) (BotTransactionPurposeClass, e } switch id { case BotTransactionPurposePaidMediaTypeID: - // Decoding botTransactionPurposePaidMedia#9593b72f. + // Decoding botTransactionPurposePaidMedia#62952496. v := BotTransactionPurposePaidMedia{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode BotTransactionPurposeClass: %w", err) @@ -503,7 +537,7 @@ func DecodeTDLibJSONBotTransactionPurpose(buf tdjson.Decoder) (BotTransactionPur } switch id { case "botTransactionPurposePaidMedia": - // Decoding botTransactionPurposePaidMedia#9593b72f. + // Decoding botTransactionPurposePaidMedia#62952496. v := BotTransactionPurposePaidMedia{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode BotTransactionPurposeClass: %w", err) diff --git a/tdapi/tl_channel_transaction_purpose_gen.go b/tdapi/tl_channel_transaction_purpose_gen.go deleted file mode 100644 index dd4541d4e9..0000000000 --- a/tdapi/tl_channel_transaction_purpose_gen.go +++ /dev/null @@ -1,751 +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{} -) - -// ChannelTransactionPurposePaidMedia represents TL type `channelTransactionPurposePaidMedia#b00b2258`. -type ChannelTransactionPurposePaidMedia struct { - // Identifier of the corresponding message with paid media; can be an identifier of a - // deleted message - MessageID int64 - // The bought media if the trancastion wasn't refunded - Media []PaidMediaClass -} - -// ChannelTransactionPurposePaidMediaTypeID is TL type id of ChannelTransactionPurposePaidMedia. -const ChannelTransactionPurposePaidMediaTypeID = 0xb00b2258 - -// construct implements constructor of ChannelTransactionPurposeClass. -func (c ChannelTransactionPurposePaidMedia) construct() ChannelTransactionPurposeClass { return &c } - -// Ensuring interfaces in compile-time for ChannelTransactionPurposePaidMedia. -var ( - _ bin.Encoder = &ChannelTransactionPurposePaidMedia{} - _ bin.Decoder = &ChannelTransactionPurposePaidMedia{} - _ bin.BareEncoder = &ChannelTransactionPurposePaidMedia{} - _ bin.BareDecoder = &ChannelTransactionPurposePaidMedia{} - - _ ChannelTransactionPurposeClass = &ChannelTransactionPurposePaidMedia{} -) - -func (c *ChannelTransactionPurposePaidMedia) Zero() bool { - if c == nil { - return true - } - if !(c.MessageID == 0) { - return false - } - if !(c.Media == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChannelTransactionPurposePaidMedia) String() string { - if c == nil { - return "ChannelTransactionPurposePaidMedia(nil)" - } - type Alias ChannelTransactionPurposePaidMedia - return fmt.Sprintf("ChannelTransactionPurposePaidMedia%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChannelTransactionPurposePaidMedia) TypeID() uint32 { - return ChannelTransactionPurposePaidMediaTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChannelTransactionPurposePaidMedia) TypeName() string { - return "channelTransactionPurposePaidMedia" -} - -// TypeInfo returns info about TL type. -func (c *ChannelTransactionPurposePaidMedia) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "channelTransactionPurposePaidMedia", - ID: ChannelTransactionPurposePaidMediaTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "Media", - SchemaName: "media", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChannelTransactionPurposePaidMedia) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode channelTransactionPurposePaidMedia#b00b2258 as nil") - } - b.PutID(ChannelTransactionPurposePaidMediaTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChannelTransactionPurposePaidMedia) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode channelTransactionPurposePaidMedia#b00b2258 as nil") - } - b.PutInt53(c.MessageID) - b.PutInt(len(c.Media)) - for idx, v := range c.Media { - if v == nil { - return fmt.Errorf("unable to encode channelTransactionPurposePaidMedia#b00b2258: field media element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare channelTransactionPurposePaidMedia#b00b2258: field media element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChannelTransactionPurposePaidMedia) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode channelTransactionPurposePaidMedia#b00b2258 to nil") - } - if err := b.ConsumeID(ChannelTransactionPurposePaidMediaTypeID); err != nil { - return fmt.Errorf("unable to decode channelTransactionPurposePaidMedia#b00b2258: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChannelTransactionPurposePaidMedia) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode channelTransactionPurposePaidMedia#b00b2258 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode channelTransactionPurposePaidMedia#b00b2258: field message_id: %w", err) - } - c.MessageID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode channelTransactionPurposePaidMedia#b00b2258: field media: %w", err) - } - - if headerLen > 0 { - c.Media = make([]PaidMediaClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodePaidMedia(b) - if err != nil { - return fmt.Errorf("unable to decode channelTransactionPurposePaidMedia#b00b2258: field media: %w", err) - } - c.Media = append(c.Media, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChannelTransactionPurposePaidMedia) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode channelTransactionPurposePaidMedia#b00b2258 as nil") - } - b.ObjStart() - b.PutID("channelTransactionPurposePaidMedia") - b.Comma() - b.FieldStart("message_id") - b.PutInt53(c.MessageID) - b.Comma() - b.FieldStart("media") - b.ArrStart() - for idx, v := range c.Media { - if v == nil { - return fmt.Errorf("unable to encode channelTransactionPurposePaidMedia#b00b2258: field media element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode channelTransactionPurposePaidMedia#b00b2258: field media 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 (c *ChannelTransactionPurposePaidMedia) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode channelTransactionPurposePaidMedia#b00b2258 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("channelTransactionPurposePaidMedia"); err != nil { - return fmt.Errorf("unable to decode channelTransactionPurposePaidMedia#b00b2258: %w", err) - } - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode channelTransactionPurposePaidMedia#b00b2258: field message_id: %w", err) - } - c.MessageID = value - case "media": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONPaidMedia(b) - if err != nil { - return fmt.Errorf("unable to decode channelTransactionPurposePaidMedia#b00b2258: field media: %w", err) - } - c.Media = append(c.Media, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode channelTransactionPurposePaidMedia#b00b2258: field media: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetMessageID returns value of MessageID field. -func (c *ChannelTransactionPurposePaidMedia) GetMessageID() (value int64) { - if c == nil { - return - } - return c.MessageID -} - -// GetMedia returns value of Media field. -func (c *ChannelTransactionPurposePaidMedia) GetMedia() (value []PaidMediaClass) { - if c == nil { - return - } - return c.Media -} - -// ChannelTransactionPurposeJoin represents TL type `channelTransactionPurposeJoin#ed83dd90`. -type ChannelTransactionPurposeJoin struct { - // The number of seconds between consecutive Telegram Star debiting - Period int32 -} - -// ChannelTransactionPurposeJoinTypeID is TL type id of ChannelTransactionPurposeJoin. -const ChannelTransactionPurposeJoinTypeID = 0xed83dd90 - -// construct implements constructor of ChannelTransactionPurposeClass. -func (c ChannelTransactionPurposeJoin) construct() ChannelTransactionPurposeClass { return &c } - -// Ensuring interfaces in compile-time for ChannelTransactionPurposeJoin. -var ( - _ bin.Encoder = &ChannelTransactionPurposeJoin{} - _ bin.Decoder = &ChannelTransactionPurposeJoin{} - _ bin.BareEncoder = &ChannelTransactionPurposeJoin{} - _ bin.BareDecoder = &ChannelTransactionPurposeJoin{} - - _ ChannelTransactionPurposeClass = &ChannelTransactionPurposeJoin{} -) - -func (c *ChannelTransactionPurposeJoin) Zero() bool { - if c == nil { - return true - } - if !(c.Period == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChannelTransactionPurposeJoin) String() string { - if c == nil { - return "ChannelTransactionPurposeJoin(nil)" - } - type Alias ChannelTransactionPurposeJoin - return fmt.Sprintf("ChannelTransactionPurposeJoin%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChannelTransactionPurposeJoin) TypeID() uint32 { - return ChannelTransactionPurposeJoinTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChannelTransactionPurposeJoin) TypeName() string { - return "channelTransactionPurposeJoin" -} - -// TypeInfo returns info about TL type. -func (c *ChannelTransactionPurposeJoin) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "channelTransactionPurposeJoin", - ID: ChannelTransactionPurposeJoinTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Period", - SchemaName: "period", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChannelTransactionPurposeJoin) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode channelTransactionPurposeJoin#ed83dd90 as nil") - } - b.PutID(ChannelTransactionPurposeJoinTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChannelTransactionPurposeJoin) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode channelTransactionPurposeJoin#ed83dd90 as nil") - } - b.PutInt32(c.Period) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChannelTransactionPurposeJoin) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode channelTransactionPurposeJoin#ed83dd90 to nil") - } - if err := b.ConsumeID(ChannelTransactionPurposeJoinTypeID); err != nil { - return fmt.Errorf("unable to decode channelTransactionPurposeJoin#ed83dd90: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChannelTransactionPurposeJoin) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode channelTransactionPurposeJoin#ed83dd90 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode channelTransactionPurposeJoin#ed83dd90: field period: %w", err) - } - c.Period = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChannelTransactionPurposeJoin) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode channelTransactionPurposeJoin#ed83dd90 as nil") - } - b.ObjStart() - b.PutID("channelTransactionPurposeJoin") - b.Comma() - b.FieldStart("period") - b.PutInt32(c.Period) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChannelTransactionPurposeJoin) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode channelTransactionPurposeJoin#ed83dd90 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("channelTransactionPurposeJoin"); err != nil { - return fmt.Errorf("unable to decode channelTransactionPurposeJoin#ed83dd90: %w", err) - } - case "period": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode channelTransactionPurposeJoin#ed83dd90: field period: %w", err) - } - c.Period = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPeriod returns value of Period field. -func (c *ChannelTransactionPurposeJoin) GetPeriod() (value int32) { - if c == nil { - return - } - return c.Period -} - -// ChannelTransactionPurposeReaction represents TL type `channelTransactionPurposeReaction#2ca05bee`. -type ChannelTransactionPurposeReaction struct { - // Identifier of the reacted message; can be an identifier of a deleted message - MessageID int64 -} - -// ChannelTransactionPurposeReactionTypeID is TL type id of ChannelTransactionPurposeReaction. -const ChannelTransactionPurposeReactionTypeID = 0x2ca05bee - -// construct implements constructor of ChannelTransactionPurposeClass. -func (c ChannelTransactionPurposeReaction) construct() ChannelTransactionPurposeClass { return &c } - -// Ensuring interfaces in compile-time for ChannelTransactionPurposeReaction. -var ( - _ bin.Encoder = &ChannelTransactionPurposeReaction{} - _ bin.Decoder = &ChannelTransactionPurposeReaction{} - _ bin.BareEncoder = &ChannelTransactionPurposeReaction{} - _ bin.BareDecoder = &ChannelTransactionPurposeReaction{} - - _ ChannelTransactionPurposeClass = &ChannelTransactionPurposeReaction{} -) - -func (c *ChannelTransactionPurposeReaction) Zero() bool { - if c == nil { - return true - } - if !(c.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChannelTransactionPurposeReaction) String() string { - if c == nil { - return "ChannelTransactionPurposeReaction(nil)" - } - type Alias ChannelTransactionPurposeReaction - return fmt.Sprintf("ChannelTransactionPurposeReaction%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChannelTransactionPurposeReaction) TypeID() uint32 { - return ChannelTransactionPurposeReactionTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChannelTransactionPurposeReaction) TypeName() string { - return "channelTransactionPurposeReaction" -} - -// TypeInfo returns info about TL type. -func (c *ChannelTransactionPurposeReaction) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "channelTransactionPurposeReaction", - ID: ChannelTransactionPurposeReactionTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChannelTransactionPurposeReaction) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode channelTransactionPurposeReaction#2ca05bee as nil") - } - b.PutID(ChannelTransactionPurposeReactionTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChannelTransactionPurposeReaction) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode channelTransactionPurposeReaction#2ca05bee as nil") - } - b.PutInt53(c.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChannelTransactionPurposeReaction) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode channelTransactionPurposeReaction#2ca05bee to nil") - } - if err := b.ConsumeID(ChannelTransactionPurposeReactionTypeID); err != nil { - return fmt.Errorf("unable to decode channelTransactionPurposeReaction#2ca05bee: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChannelTransactionPurposeReaction) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode channelTransactionPurposeReaction#2ca05bee to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode channelTransactionPurposeReaction#2ca05bee: field message_id: %w", err) - } - c.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChannelTransactionPurposeReaction) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode channelTransactionPurposeReaction#2ca05bee as nil") - } - b.ObjStart() - b.PutID("channelTransactionPurposeReaction") - b.Comma() - b.FieldStart("message_id") - b.PutInt53(c.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChannelTransactionPurposeReaction) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode channelTransactionPurposeReaction#2ca05bee to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("channelTransactionPurposeReaction"); err != nil { - return fmt.Errorf("unable to decode channelTransactionPurposeReaction#2ca05bee: %w", err) - } - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode channelTransactionPurposeReaction#2ca05bee: field message_id: %w", err) - } - c.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMessageID returns value of MessageID field. -func (c *ChannelTransactionPurposeReaction) GetMessageID() (value int64) { - if c == nil { - return - } - return c.MessageID -} - -// ChannelTransactionPurposeClassName is schema name of ChannelTransactionPurposeClass. -const ChannelTransactionPurposeClassName = "ChannelTransactionPurpose" - -// ChannelTransactionPurposeClass represents ChannelTransactionPurpose generic type. -// -// Example: -// -// g, err := tdapi.DecodeChannelTransactionPurpose(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ChannelTransactionPurposePaidMedia: // channelTransactionPurposePaidMedia#b00b2258 -// case *tdapi.ChannelTransactionPurposeJoin: // channelTransactionPurposeJoin#ed83dd90 -// case *tdapi.ChannelTransactionPurposeReaction: // channelTransactionPurposeReaction#2ca05bee -// default: panic(v) -// } -type ChannelTransactionPurposeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ChannelTransactionPurposeClass - - // 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 -} - -// DecodeChannelTransactionPurpose implements binary de-serialization for ChannelTransactionPurposeClass. -func DecodeChannelTransactionPurpose(buf *bin.Buffer) (ChannelTransactionPurposeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ChannelTransactionPurposePaidMediaTypeID: - // Decoding channelTransactionPurposePaidMedia#b00b2258. - v := ChannelTransactionPurposePaidMedia{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChannelTransactionPurposeClass: %w", err) - } - return &v, nil - case ChannelTransactionPurposeJoinTypeID: - // Decoding channelTransactionPurposeJoin#ed83dd90. - v := ChannelTransactionPurposeJoin{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChannelTransactionPurposeClass: %w", err) - } - return &v, nil - case ChannelTransactionPurposeReactionTypeID: - // Decoding channelTransactionPurposeReaction#2ca05bee. - v := ChannelTransactionPurposeReaction{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChannelTransactionPurposeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChannelTransactionPurposeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONChannelTransactionPurpose implements binary de-serialization for ChannelTransactionPurposeClass. -func DecodeTDLibJSONChannelTransactionPurpose(buf tdjson.Decoder) (ChannelTransactionPurposeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "channelTransactionPurposePaidMedia": - // Decoding channelTransactionPurposePaidMedia#b00b2258. - v := ChannelTransactionPurposePaidMedia{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChannelTransactionPurposeClass: %w", err) - } - return &v, nil - case "channelTransactionPurposeJoin": - // Decoding channelTransactionPurposeJoin#ed83dd90. - v := ChannelTransactionPurposeJoin{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChannelTransactionPurposeClass: %w", err) - } - return &v, nil - case "channelTransactionPurposeReaction": - // Decoding channelTransactionPurposeReaction#2ca05bee. - v := ChannelTransactionPurposeReaction{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChannelTransactionPurposeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChannelTransactionPurposeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ChannelTransactionPurpose boxes the ChannelTransactionPurposeClass providing a helper. -type ChannelTransactionPurposeBox struct { - ChannelTransactionPurpose ChannelTransactionPurposeClass -} - -// Decode implements bin.Decoder for ChannelTransactionPurposeBox. -func (b *ChannelTransactionPurposeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ChannelTransactionPurposeBox to nil") - } - v, err := DecodeChannelTransactionPurpose(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChannelTransactionPurpose = v - return nil -} - -// Encode implements bin.Encode for ChannelTransactionPurposeBox. -func (b *ChannelTransactionPurposeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ChannelTransactionPurpose == nil { - return fmt.Errorf("unable to encode ChannelTransactionPurposeClass as nil") - } - return b.ChannelTransactionPurpose.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ChannelTransactionPurposeBox. -func (b *ChannelTransactionPurposeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ChannelTransactionPurposeBox to nil") - } - v, err := DecodeTDLibJSONChannelTransactionPurpose(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChannelTransactionPurpose = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ChannelTransactionPurposeBox. -func (b *ChannelTransactionPurposeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ChannelTransactionPurpose == nil { - return fmt.Errorf("unable to encode ChannelTransactionPurposeClass as nil") - } - return b.ChannelTransactionPurpose.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_chat_boost_source_gen.go b/tdapi/tl_chat_boost_source_gen.go index d115948218..f217962b6b 100644 --- a/tdapi/tl_chat_boost_source_gen.go +++ b/tdapi/tl_chat_boost_source_gen.go @@ -232,23 +232,25 @@ func (c *ChatBoostSourceGiftCode) GetGiftCode() (value string) { return c.GiftCode } -// ChatBoostSourceGiveaway represents TL type `chatBoostSourceGiveaway#90d1c70`. +// ChatBoostSourceGiveaway represents TL type `chatBoostSourceGiveaway#7254949a`. type ChatBoostSourceGiveaway struct { // Identifier of a user that won in the giveaway; 0 if none UserID int64 // The created Telegram Premium gift code if it was used by the user or can be claimed by - // the current user; an empty string otherwise + // the current user; an empty string otherwise; for Telegram Premium giveways only GiftCode string + // Number of Telegram Stars distributed among winners of the giveaway + StarCount int64 // Identifier of the corresponding giveaway message; can be an identifier of a deleted // message GiveawayMessageID int64 - // True, if the winner for the corresponding Telegram Premium subscription wasn't chosen, - // because there were not enough participants + // True, if the winner for the corresponding giveaway prize wasn't chosen, because there + // were not enough participants IsUnclaimed bool } // ChatBoostSourceGiveawayTypeID is TL type id of ChatBoostSourceGiveaway. -const ChatBoostSourceGiveawayTypeID = 0x90d1c70 +const ChatBoostSourceGiveawayTypeID = 0x7254949a // construct implements constructor of ChatBoostSourceClass. func (c ChatBoostSourceGiveaway) construct() ChatBoostSourceClass { return &c } @@ -273,6 +275,9 @@ func (c *ChatBoostSourceGiveaway) Zero() bool { if !(c.GiftCode == "") { return false } + if !(c.StarCount == 0) { + return false + } if !(c.GiveawayMessageID == 0) { return false } @@ -323,6 +328,10 @@ func (c *ChatBoostSourceGiveaway) TypeInfo() tdp.Type { Name: "GiftCode", SchemaName: "gift_code", }, + { + Name: "StarCount", + SchemaName: "star_count", + }, { Name: "GiveawayMessageID", SchemaName: "giveaway_message_id", @@ -338,7 +347,7 @@ func (c *ChatBoostSourceGiveaway) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *ChatBoostSourceGiveaway) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatBoostSourceGiveaway#90d1c70 as nil") + return fmt.Errorf("can't encode chatBoostSourceGiveaway#7254949a as nil") } b.PutID(ChatBoostSourceGiveawayTypeID) return c.EncodeBare(b) @@ -347,10 +356,11 @@ func (c *ChatBoostSourceGiveaway) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatBoostSourceGiveaway) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatBoostSourceGiveaway#90d1c70 as nil") + return fmt.Errorf("can't encode chatBoostSourceGiveaway#7254949a as nil") } b.PutInt53(c.UserID) b.PutString(c.GiftCode) + b.PutInt53(c.StarCount) b.PutInt53(c.GiveawayMessageID) b.PutBool(c.IsUnclaimed) return nil @@ -359,10 +369,10 @@ func (c *ChatBoostSourceGiveaway) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (c *ChatBoostSourceGiveaway) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatBoostSourceGiveaway#90d1c70 to nil") + return fmt.Errorf("can't decode chatBoostSourceGiveaway#7254949a to nil") } if err := b.ConsumeID(ChatBoostSourceGiveawayTypeID); err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#90d1c70: %w", err) + return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: %w", err) } return c.DecodeBare(b) } @@ -370,33 +380,40 @@ func (c *ChatBoostSourceGiveaway) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatBoostSourceGiveaway) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatBoostSourceGiveaway#90d1c70 to nil") + return fmt.Errorf("can't decode chatBoostSourceGiveaway#7254949a to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#90d1c70: field user_id: %w", err) + return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: field user_id: %w", err) } c.UserID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#90d1c70: field gift_code: %w", err) + return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: field gift_code: %w", err) } c.GiftCode = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#90d1c70: field giveaway_message_id: %w", err) + return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: field star_count: %w", err) + } + c.StarCount = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: field giveaway_message_id: %w", err) } c.GiveawayMessageID = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#90d1c70: field is_unclaimed: %w", err) + return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: field is_unclaimed: %w", err) } c.IsUnclaimed = value } @@ -406,7 +423,7 @@ func (c *ChatBoostSourceGiveaway) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *ChatBoostSourceGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatBoostSourceGiveaway#90d1c70 as nil") + return fmt.Errorf("can't encode chatBoostSourceGiveaway#7254949a as nil") } b.ObjStart() b.PutID("chatBoostSourceGiveaway") @@ -417,6 +434,9 @@ func (c *ChatBoostSourceGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("gift_code") b.PutString(c.GiftCode) b.Comma() + b.FieldStart("star_count") + b.PutInt53(c.StarCount) + b.Comma() b.FieldStart("giveaway_message_id") b.PutInt53(c.GiveawayMessageID) b.Comma() @@ -431,37 +451,43 @@ func (c *ChatBoostSourceGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *ChatBoostSourceGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatBoostSourceGiveaway#90d1c70 to nil") + return fmt.Errorf("can't decode chatBoostSourceGiveaway#7254949a to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("chatBoostSourceGiveaway"); err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#90d1c70: %w", err) + return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: %w", err) } case "user_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#90d1c70: field user_id: %w", err) + return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: field user_id: %w", err) } c.UserID = value case "gift_code": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#90d1c70: field gift_code: %w", err) + return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: field gift_code: %w", err) } c.GiftCode = value + case "star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: field star_count: %w", err) + } + c.StarCount = value case "giveaway_message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#90d1c70: field giveaway_message_id: %w", err) + return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: field giveaway_message_id: %w", err) } c.GiveawayMessageID = value case "is_unclaimed": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#90d1c70: field is_unclaimed: %w", err) + return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: field is_unclaimed: %w", err) } c.IsUnclaimed = value default: @@ -487,6 +513,14 @@ func (c *ChatBoostSourceGiveaway) GetGiftCode() (value string) { return c.GiftCode } +// GetStarCount returns value of StarCount field. +func (c *ChatBoostSourceGiveaway) GetStarCount() (value int64) { + if c == nil { + return + } + return c.StarCount +} + // GetGiveawayMessageID returns value of GiveawayMessageID field. func (c *ChatBoostSourceGiveaway) GetGiveawayMessageID() (value int64) { if c == nil { @@ -682,7 +716,7 @@ const ChatBoostSourceClassName = "ChatBoostSource" // } // switch v := g.(type) { // case *tdapi.ChatBoostSourceGiftCode: // chatBoostSourceGiftCode#fa2412ba -// case *tdapi.ChatBoostSourceGiveaway: // chatBoostSourceGiveaway#90d1c70 +// case *tdapi.ChatBoostSourceGiveaway: // chatBoostSourceGiveaway#7254949a // case *tdapi.ChatBoostSourcePremium: // chatBoostSourcePremium#ed4eb // default: panic(v) // } @@ -726,7 +760,7 @@ func DecodeChatBoostSource(buf *bin.Buffer) (ChatBoostSourceClass, error) { } return &v, nil case ChatBoostSourceGiveawayTypeID: - // Decoding chatBoostSourceGiveaway#90d1c70. + // Decoding chatBoostSourceGiveaway#7254949a. v := ChatBoostSourceGiveaway{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatBoostSourceClass: %w", err) @@ -759,7 +793,7 @@ func DecodeTDLibJSONChatBoostSource(buf tdjson.Decoder) (ChatBoostSourceClass, e } return &v, nil case "chatBoostSourceGiveaway": - // Decoding chatBoostSourceGiveaway#90d1c70. + // Decoding chatBoostSourceGiveaway#7254949a. v := ChatBoostSourceGiveaway{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatBoostSourceClass: %w", err) diff --git a/tdapi/tl_chat_boost_status_gen.go b/tdapi/tl_chat_boost_status_gen.go index 0a8666ccd6..cd3cc703b4 100644 --- a/tdapi/tl_chat_boost_status_gen.go +++ b/tdapi/tl_chat_boost_status_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// ChatBoostStatus represents TL type `chatBoostStatus#a5007413`. +// ChatBoostStatus represents TL type `chatBoostStatus#401e753c`. type ChatBoostStatus struct { // An HTTP URL, which can be used to boost the chat BoostURL string @@ -56,11 +56,11 @@ type ChatBoostStatus struct { // user isn't an administrator in the chat PremiumMemberPercentage float64 // The list of prepaid giveaways available for the chat; only for chat administrators - PrepaidGiveaways []PrepaidPremiumGiveaway + PrepaidGiveaways []PrepaidGiveaway } // ChatBoostStatusTypeID is TL type id of ChatBoostStatus. -const ChatBoostStatusTypeID = 0xa5007413 +const ChatBoostStatusTypeID = 0x401e753c // Ensuring interfaces in compile-time for ChatBoostStatus. var ( @@ -187,7 +187,7 @@ func (c *ChatBoostStatus) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *ChatBoostStatus) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatBoostStatus#a5007413 as nil") + return fmt.Errorf("can't encode chatBoostStatus#401e753c as nil") } b.PutID(ChatBoostStatusTypeID) return c.EncodeBare(b) @@ -196,7 +196,7 @@ func (c *ChatBoostStatus) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatBoostStatus) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatBoostStatus#a5007413 as nil") + return fmt.Errorf("can't encode chatBoostStatus#401e753c as nil") } b.PutString(c.BoostURL) b.PutInt(len(c.AppliedSlotIDs)) @@ -213,7 +213,7 @@ func (c *ChatBoostStatus) EncodeBare(b *bin.Buffer) error { b.PutInt(len(c.PrepaidGiveaways)) for idx, v := range c.PrepaidGiveaways { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatBoostStatus#a5007413: field prepaid_giveaways element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare chatBoostStatus#401e753c: field prepaid_giveaways element with index %d: %w", idx, err) } } return nil @@ -222,10 +222,10 @@ func (c *ChatBoostStatus) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (c *ChatBoostStatus) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatBoostStatus#a5007413 to nil") + return fmt.Errorf("can't decode chatBoostStatus#401e753c to nil") } if err := b.ConsumeID(ChatBoostStatusTypeID); err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: %w", err) } return c.DecodeBare(b) } @@ -233,19 +233,19 @@ func (c *ChatBoostStatus) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatBoostStatus) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatBoostStatus#a5007413 to nil") + return fmt.Errorf("can't decode chatBoostStatus#401e753c to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field boost_url: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field boost_url: %w", err) } c.BoostURL = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field applied_slot_ids: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field applied_slot_ids: %w", err) } if headerLen > 0 { @@ -254,7 +254,7 @@ func (c *ChatBoostStatus) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field applied_slot_ids: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field applied_slot_ids: %w", err) } c.AppliedSlotIDs = append(c.AppliedSlotIDs, value) } @@ -262,65 +262,65 @@ func (c *ChatBoostStatus) DecodeBare(b *bin.Buffer) error { { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field level: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field level: %w", err) } c.Level = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field gift_code_boost_count: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field gift_code_boost_count: %w", err) } c.GiftCodeBoostCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field boost_count: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field boost_count: %w", err) } c.BoostCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field current_level_boost_count: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field current_level_boost_count: %w", err) } c.CurrentLevelBoostCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field next_level_boost_count: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field next_level_boost_count: %w", err) } c.NextLevelBoostCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field premium_member_count: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field premium_member_count: %w", err) } c.PremiumMemberCount = value } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field premium_member_percentage: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field premium_member_percentage: %w", err) } c.PremiumMemberPercentage = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field prepaid_giveaways: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field prepaid_giveaways: %w", err) } if headerLen > 0 { - c.PrepaidGiveaways = make([]PrepaidPremiumGiveaway, 0, headerLen%bin.PreallocateLimit) + c.PrepaidGiveaways = make([]PrepaidGiveaway, 0, headerLen%bin.PreallocateLimit) } for idx := 0; idx < headerLen; idx++ { - var value PrepaidPremiumGiveaway + var value PrepaidGiveaway if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatBoostStatus#a5007413: field prepaid_giveaways: %w", err) + return fmt.Errorf("unable to decode bare chatBoostStatus#401e753c: field prepaid_giveaways: %w", err) } c.PrepaidGiveaways = append(c.PrepaidGiveaways, value) } @@ -331,7 +331,7 @@ func (c *ChatBoostStatus) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *ChatBoostStatus) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatBoostStatus#a5007413 as nil") + return fmt.Errorf("can't encode chatBoostStatus#401e753c as nil") } b.ObjStart() b.PutID("chatBoostStatus") @@ -373,7 +373,7 @@ func (c *ChatBoostStatus) EncodeTDLibJSON(b tdjson.Encoder) error { b.ArrStart() for idx, v := range c.PrepaidGiveaways { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatBoostStatus#a5007413: field prepaid_giveaways element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode chatBoostStatus#401e753c: field prepaid_giveaways element with index %d: %w", idx, err) } b.Comma() } @@ -388,84 +388,84 @@ func (c *ChatBoostStatus) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *ChatBoostStatus) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatBoostStatus#a5007413 to nil") + return fmt.Errorf("can't decode chatBoostStatus#401e753c to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("chatBoostStatus"); err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: %w", err) } case "boost_url": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field boost_url: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field boost_url: %w", err) } c.BoostURL = value case "applied_slot_ids": if err := b.Arr(func(b tdjson.Decoder) error { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field applied_slot_ids: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field applied_slot_ids: %w", err) } c.AppliedSlotIDs = append(c.AppliedSlotIDs, value) return nil }); err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field applied_slot_ids: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field applied_slot_ids: %w", err) } case "level": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field level: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field level: %w", err) } c.Level = value case "gift_code_boost_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field gift_code_boost_count: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field gift_code_boost_count: %w", err) } c.GiftCodeBoostCount = value case "boost_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field boost_count: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field boost_count: %w", err) } c.BoostCount = value case "current_level_boost_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field current_level_boost_count: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field current_level_boost_count: %w", err) } c.CurrentLevelBoostCount = value case "next_level_boost_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field next_level_boost_count: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field next_level_boost_count: %w", err) } c.NextLevelBoostCount = value case "premium_member_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field premium_member_count: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field premium_member_count: %w", err) } c.PremiumMemberCount = value case "premium_member_percentage": value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field premium_member_percentage: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field premium_member_percentage: %w", err) } c.PremiumMemberPercentage = value case "prepaid_giveaways": if err := b.Arr(func(b tdjson.Decoder) error { - var value PrepaidPremiumGiveaway + var value PrepaidGiveaway if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field prepaid_giveaways: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field prepaid_giveaways: %w", err) } c.PrepaidGiveaways = append(c.PrepaidGiveaways, value) return nil }); err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#a5007413: field prepaid_giveaways: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field prepaid_giveaways: %w", err) } default: return b.Skip() @@ -547,7 +547,7 @@ func (c *ChatBoostStatus) GetPremiumMemberPercentage() (value float64) { } // GetPrepaidGiveaways returns value of PrepaidGiveaways field. -func (c *ChatBoostStatus) GetPrepaidGiveaways() (value []PrepaidPremiumGiveaway) { +func (c *ChatBoostStatus) GetPrepaidGiveaways() (value []PrepaidGiveaway) { if c == nil { return } diff --git a/tdapi/tl_chat_event_action_gen.go b/tdapi/tl_chat_event_action_gen.go index 6b24d5fe29..06f5bbca24 100644 --- a/tdapi/tl_chat_event_action_gen.go +++ b/tdapi/tl_chat_event_action_gen.go @@ -2320,6 +2320,260 @@ func (c *ChatEventMemberRestricted) GetNewStatus() (value ChatMemberStatusClass) return c.NewStatus } +// ChatEventMemberSubscriptionExtended represents TL type `chatEventMemberSubscriptionExtended#bbfab002`. +type ChatEventMemberSubscriptionExtended struct { + // Affected chat member user identifier + UserID int64 + // Previous status of the chat member + OldStatus ChatMemberStatusClass + // New status of the chat member + NewStatus ChatMemberStatusClass +} + +// ChatEventMemberSubscriptionExtendedTypeID is TL type id of ChatEventMemberSubscriptionExtended. +const ChatEventMemberSubscriptionExtendedTypeID = 0xbbfab002 + +// construct implements constructor of ChatEventActionClass. +func (c ChatEventMemberSubscriptionExtended) construct() ChatEventActionClass { return &c } + +// Ensuring interfaces in compile-time for ChatEventMemberSubscriptionExtended. +var ( + _ bin.Encoder = &ChatEventMemberSubscriptionExtended{} + _ bin.Decoder = &ChatEventMemberSubscriptionExtended{} + _ bin.BareEncoder = &ChatEventMemberSubscriptionExtended{} + _ bin.BareDecoder = &ChatEventMemberSubscriptionExtended{} + + _ ChatEventActionClass = &ChatEventMemberSubscriptionExtended{} +) + +func (c *ChatEventMemberSubscriptionExtended) Zero() bool { + if c == nil { + return true + } + if !(c.UserID == 0) { + return false + } + if !(c.OldStatus == nil) { + return false + } + if !(c.NewStatus == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChatEventMemberSubscriptionExtended) String() string { + if c == nil { + return "ChatEventMemberSubscriptionExtended(nil)" + } + type Alias ChatEventMemberSubscriptionExtended + return fmt.Sprintf("ChatEventMemberSubscriptionExtended%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChatEventMemberSubscriptionExtended) TypeID() uint32 { + return ChatEventMemberSubscriptionExtendedTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChatEventMemberSubscriptionExtended) TypeName() string { + return "chatEventMemberSubscriptionExtended" +} + +// TypeInfo returns info about TL type. +func (c *ChatEventMemberSubscriptionExtended) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "chatEventMemberSubscriptionExtended", + ID: ChatEventMemberSubscriptionExtendedTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "UserID", + SchemaName: "user_id", + }, + { + Name: "OldStatus", + SchemaName: "old_status", + }, + { + Name: "NewStatus", + SchemaName: "new_status", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChatEventMemberSubscriptionExtended) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatEventMemberSubscriptionExtended#bbfab002 as nil") + } + b.PutID(ChatEventMemberSubscriptionExtendedTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChatEventMemberSubscriptionExtended) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatEventMemberSubscriptionExtended#bbfab002 as nil") + } + b.PutInt53(c.UserID) + if c.OldStatus == nil { + return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field old_status is nil") + } + if err := c.OldStatus.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field old_status: %w", err) + } + if c.NewStatus == nil { + return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field new_status is nil") + } + if err := c.NewStatus.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field new_status: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (c *ChatEventMemberSubscriptionExtended) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatEventMemberSubscriptionExtended#bbfab002 to nil") + } + if err := b.ConsumeID(ChatEventMemberSubscriptionExtendedTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChatEventMemberSubscriptionExtended) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatEventMemberSubscriptionExtended#bbfab002 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: field user_id: %w", err) + } + c.UserID = value + } + { + value, err := DecodeChatMemberStatus(b) + if err != nil { + return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: field old_status: %w", err) + } + c.OldStatus = value + } + { + value, err := DecodeChatMemberStatus(b) + if err != nil { + return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: field new_status: %w", err) + } + c.NewStatus = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatEventMemberSubscriptionExtended) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatEventMemberSubscriptionExtended#bbfab002 as nil") + } + b.ObjStart() + b.PutID("chatEventMemberSubscriptionExtended") + b.Comma() + b.FieldStart("user_id") + b.PutInt53(c.UserID) + b.Comma() + b.FieldStart("old_status") + if c.OldStatus == nil { + return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field old_status is nil") + } + if err := c.OldStatus.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field old_status: %w", err) + } + b.Comma() + b.FieldStart("new_status") + if c.NewStatus == nil { + return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field new_status is nil") + } + if err := c.NewStatus.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field new_status: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ChatEventMemberSubscriptionExtended) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode chatEventMemberSubscriptionExtended#bbfab002 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("chatEventMemberSubscriptionExtended"); err != nil { + return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: %w", err) + } + case "user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: field user_id: %w", err) + } + c.UserID = value + case "old_status": + value, err := DecodeTDLibJSONChatMemberStatus(b) + if err != nil { + return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: field old_status: %w", err) + } + c.OldStatus = value + case "new_status": + value, err := DecodeTDLibJSONChatMemberStatus(b) + if err != nil { + return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: field new_status: %w", err) + } + c.NewStatus = value + default: + return b.Skip() + } + return nil + }) +} + +// GetUserID returns value of UserID field. +func (c *ChatEventMemberSubscriptionExtended) GetUserID() (value int64) { + if c == nil { + return + } + return c.UserID +} + +// GetOldStatus returns value of OldStatus field. +func (c *ChatEventMemberSubscriptionExtended) GetOldStatus() (value ChatMemberStatusClass) { + if c == nil { + return + } + return c.OldStatus +} + +// GetNewStatus returns value of NewStatus field. +func (c *ChatEventMemberSubscriptionExtended) GetNewStatus() (value ChatMemberStatusClass) { + if c == nil { + return + } + return c.NewStatus +} + // ChatEventAvailableReactionsChanged represents TL type `chatEventAvailableReactionsChanged#97b8e0bf`. type ChatEventAvailableReactionsChanged struct { // Previous chat available reactions @@ -9626,6 +9880,7 @@ const ChatEventActionClassName = "ChatEventAction" // case *tdapi.ChatEventMemberLeft: // chatEventMemberLeft#c778400f // case *tdapi.ChatEventMemberPromoted: // chatEventMemberPromoted#1f4f6861 // case *tdapi.ChatEventMemberRestricted: // chatEventMemberRestricted#5f951e05 +// case *tdapi.ChatEventMemberSubscriptionExtended: // chatEventMemberSubscriptionExtended#bbfab002 // case *tdapi.ChatEventAvailableReactionsChanged: // chatEventAvailableReactionsChanged#97b8e0bf // case *tdapi.ChatEventBackgroundChanged: // chatEventBackgroundChanged#b6ed6d38 // case *tdapi.ChatEventDescriptionChanged: // chatEventDescriptionChanged#254cf1e @@ -9779,6 +10034,13 @@ func DecodeChatEventAction(buf *bin.Buffer) (ChatEventActionClass, error) { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil + case ChatEventMemberSubscriptionExtendedTypeID: + // Decoding chatEventMemberSubscriptionExtended#bbfab002. + v := ChatEventMemberSubscriptionExtended{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) + } + return &v, nil case ChatEventAvailableReactionsChangedTypeID: // Decoding chatEventAvailableReactionsChanged#97b8e0bf. v := ChatEventAvailableReactionsChanged{} @@ -10141,6 +10403,13 @@ func DecodeTDLibJSONChatEventAction(buf tdjson.Decoder) (ChatEventActionClass, e return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil + case "chatEventMemberSubscriptionExtended": + // Decoding chatEventMemberSubscriptionExtended#bbfab002. + v := ChatEventMemberSubscriptionExtended{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) + } + return &v, nil case "chatEventAvailableReactionsChanged": // Decoding chatEventAvailableReactionsChanged#97b8e0bf. v := ChatEventAvailableReactionsChanged{} diff --git a/tdapi/tl_chat_event_log_filters_gen.go b/tdapi/tl_chat_event_log_filters_gen.go index 06c6be4f96..71be6a38da 100644 --- a/tdapi/tl_chat_event_log_filters_gen.go +++ b/tdapi/tl_chat_event_log_filters_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// ChatEventLogFilters represents TL type `chatEventLogFilters#623e7a2d`. +// ChatEventLogFilters represents TL type `chatEventLogFilters#c26e31b1`. type ChatEventLogFilters struct { // True, if message edits need to be returned MessageEdits bool @@ -59,10 +59,12 @@ type ChatEventLogFilters struct { VideoChatChanges bool // True, if forum-related actions need to be returned ForumChanges bool + // True, if subscription extensions need to be returned + SubscriptionExtensions bool } // ChatEventLogFiltersTypeID is TL type id of ChatEventLogFilters. -const ChatEventLogFiltersTypeID = 0x623e7a2d +const ChatEventLogFiltersTypeID = 0xc26e31b1 // Ensuring interfaces in compile-time for ChatEventLogFilters. var ( @@ -115,6 +117,9 @@ func (c *ChatEventLogFilters) Zero() bool { if !(c.ForumChanges == false) { return false } + if !(c.SubscriptionExtensions == false) { + return false + } return true } @@ -203,6 +208,10 @@ func (c *ChatEventLogFilters) TypeInfo() tdp.Type { Name: "ForumChanges", SchemaName: "forum_changes", }, + { + Name: "SubscriptionExtensions", + SchemaName: "subscription_extensions", + }, } return typ } @@ -210,7 +219,7 @@ func (c *ChatEventLogFilters) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *ChatEventLogFilters) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventLogFilters#623e7a2d as nil") + return fmt.Errorf("can't encode chatEventLogFilters#c26e31b1 as nil") } b.PutID(ChatEventLogFiltersTypeID) return c.EncodeBare(b) @@ -219,7 +228,7 @@ func (c *ChatEventLogFilters) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatEventLogFilters) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventLogFilters#623e7a2d as nil") + return fmt.Errorf("can't encode chatEventLogFilters#c26e31b1 as nil") } b.PutBool(c.MessageEdits) b.PutBool(c.MessageDeletions) @@ -234,16 +243,17 @@ func (c *ChatEventLogFilters) EncodeBare(b *bin.Buffer) error { b.PutBool(c.InviteLinkChanges) b.PutBool(c.VideoChatChanges) b.PutBool(c.ForumChanges) + b.PutBool(c.SubscriptionExtensions) return nil } // Decode implements bin.Decoder. func (c *ChatEventLogFilters) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventLogFilters#623e7a2d to nil") + return fmt.Errorf("can't decode chatEventLogFilters#c26e31b1 to nil") } if err := b.ConsumeID(ChatEventLogFiltersTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: %w", err) } return c.DecodeBare(b) } @@ -251,106 +261,113 @@ func (c *ChatEventLogFilters) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatEventLogFilters) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventLogFilters#623e7a2d to nil") + return fmt.Errorf("can't decode chatEventLogFilters#c26e31b1 to nil") } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field message_edits: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field message_edits: %w", err) } c.MessageEdits = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field message_deletions: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field message_deletions: %w", err) } c.MessageDeletions = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field message_pins: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field message_pins: %w", err) } c.MessagePins = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field member_joins: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field member_joins: %w", err) } c.MemberJoins = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field member_leaves: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field member_leaves: %w", err) } c.MemberLeaves = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field member_invites: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field member_invites: %w", err) } c.MemberInvites = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field member_promotions: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field member_promotions: %w", err) } c.MemberPromotions = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field member_restrictions: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field member_restrictions: %w", err) } c.MemberRestrictions = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field info_changes: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field info_changes: %w", err) } c.InfoChanges = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field setting_changes: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field setting_changes: %w", err) } c.SettingChanges = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field invite_link_changes: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field invite_link_changes: %w", err) } c.InviteLinkChanges = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field video_chat_changes: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field video_chat_changes: %w", err) } c.VideoChatChanges = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field forum_changes: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field forum_changes: %w", err) } c.ForumChanges = value } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field subscription_extensions: %w", err) + } + c.SubscriptionExtensions = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *ChatEventLogFilters) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatEventLogFilters#623e7a2d as nil") + return fmt.Errorf("can't encode chatEventLogFilters#c26e31b1 as nil") } b.ObjStart() b.PutID("chatEventLogFilters") @@ -394,6 +411,9 @@ func (c *ChatEventLogFilters) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("forum_changes") b.PutBool(c.ForumChanges) b.Comma() + b.FieldStart("subscription_extensions") + b.PutBool(c.SubscriptionExtensions) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -402,93 +422,99 @@ func (c *ChatEventLogFilters) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *ChatEventLogFilters) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatEventLogFilters#623e7a2d to nil") + return fmt.Errorf("can't decode chatEventLogFilters#c26e31b1 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("chatEventLogFilters"); err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: %w", err) } case "message_edits": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field message_edits: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field message_edits: %w", err) } c.MessageEdits = value case "message_deletions": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field message_deletions: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field message_deletions: %w", err) } c.MessageDeletions = value case "message_pins": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field message_pins: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field message_pins: %w", err) } c.MessagePins = value case "member_joins": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field member_joins: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field member_joins: %w", err) } c.MemberJoins = value case "member_leaves": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field member_leaves: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field member_leaves: %w", err) } c.MemberLeaves = value case "member_invites": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field member_invites: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field member_invites: %w", err) } c.MemberInvites = value case "member_promotions": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field member_promotions: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field member_promotions: %w", err) } c.MemberPromotions = value case "member_restrictions": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field member_restrictions: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field member_restrictions: %w", err) } c.MemberRestrictions = value case "info_changes": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field info_changes: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field info_changes: %w", err) } c.InfoChanges = value case "setting_changes": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field setting_changes: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field setting_changes: %w", err) } c.SettingChanges = value case "invite_link_changes": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field invite_link_changes: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field invite_link_changes: %w", err) } c.InviteLinkChanges = value case "video_chat_changes": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field video_chat_changes: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field video_chat_changes: %w", err) } c.VideoChatChanges = value case "forum_changes": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#623e7a2d: field forum_changes: %w", err) + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field forum_changes: %w", err) } c.ForumChanges = value + case "subscription_extensions": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field subscription_extensions: %w", err) + } + c.SubscriptionExtensions = value default: return b.Skip() } @@ -599,3 +625,11 @@ func (c *ChatEventLogFilters) GetForumChanges() (value bool) { } return c.ForumChanges } + +// GetSubscriptionExtensions returns value of SubscriptionExtensions field. +func (c *ChatEventLogFilters) GetSubscriptionExtensions() (value bool) { + if c == nil { + return + } + return c.SubscriptionExtensions +} diff --git a/tdapi/tl_chat_revenue_amount_gen.go b/tdapi/tl_chat_revenue_amount_gen.go index 2a52c9ebcb..ea91f92966 100644 --- a/tdapi/tl_chat_revenue_amount_gen.go +++ b/tdapi/tl_chat_revenue_amount_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// ChatRevenueAmount represents TL type `chatRevenueAmount#4f3bb29f`. +// ChatRevenueAmount represents TL type `chatRevenueAmount#a648ce58`. type ChatRevenueAmount struct { // Cryptocurrency in which revenue is calculated Cryptocurrency string @@ -43,10 +43,12 @@ type ChatRevenueAmount struct { // Amount of the cryptocurrency available for withdrawal, in the smallest units of the // cryptocurrency AvailableAmount int64 + // True, if Telegram Stars can be withdrawn now or later + WithdrawalEnabled bool } // ChatRevenueAmountTypeID is TL type id of ChatRevenueAmount. -const ChatRevenueAmountTypeID = 0x4f3bb29f +const ChatRevenueAmountTypeID = 0xa648ce58 // Ensuring interfaces in compile-time for ChatRevenueAmount. var ( @@ -72,6 +74,9 @@ func (c *ChatRevenueAmount) Zero() bool { if !(c.AvailableAmount == 0) { return false } + if !(c.WithdrawalEnabled == false) { + return false + } return true } @@ -124,6 +129,10 @@ func (c *ChatRevenueAmount) TypeInfo() tdp.Type { Name: "AvailableAmount", SchemaName: "available_amount", }, + { + Name: "WithdrawalEnabled", + SchemaName: "withdrawal_enabled", + }, } return typ } @@ -131,7 +140,7 @@ func (c *ChatRevenueAmount) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *ChatRevenueAmount) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatRevenueAmount#4f3bb29f as nil") + return fmt.Errorf("can't encode chatRevenueAmount#a648ce58 as nil") } b.PutID(ChatRevenueAmountTypeID) return c.EncodeBare(b) @@ -140,22 +149,23 @@ func (c *ChatRevenueAmount) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatRevenueAmount) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatRevenueAmount#4f3bb29f as nil") + return fmt.Errorf("can't encode chatRevenueAmount#a648ce58 as nil") } b.PutString(c.Cryptocurrency) b.PutLong(c.TotalAmount) b.PutLong(c.BalanceAmount) b.PutLong(c.AvailableAmount) + b.PutBool(c.WithdrawalEnabled) return nil } // Decode implements bin.Decoder. func (c *ChatRevenueAmount) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatRevenueAmount#4f3bb29f to nil") + return fmt.Errorf("can't decode chatRevenueAmount#a648ce58 to nil") } if err := b.ConsumeID(ChatRevenueAmountTypeID); err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#4f3bb29f: %w", err) + return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: %w", err) } return c.DecodeBare(b) } @@ -163,43 +173,50 @@ func (c *ChatRevenueAmount) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatRevenueAmount) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatRevenueAmount#4f3bb29f to nil") + return fmt.Errorf("can't decode chatRevenueAmount#a648ce58 to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#4f3bb29f: field cryptocurrency: %w", err) + return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: field cryptocurrency: %w", err) } c.Cryptocurrency = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#4f3bb29f: field total_amount: %w", err) + return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: field total_amount: %w", err) } c.TotalAmount = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#4f3bb29f: field balance_amount: %w", err) + return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: field balance_amount: %w", err) } c.BalanceAmount = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#4f3bb29f: field available_amount: %w", err) + return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: field available_amount: %w", err) } c.AvailableAmount = value } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: field withdrawal_enabled: %w", err) + } + c.WithdrawalEnabled = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *ChatRevenueAmount) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatRevenueAmount#4f3bb29f as nil") + return fmt.Errorf("can't encode chatRevenueAmount#a648ce58 as nil") } b.ObjStart() b.PutID("chatRevenueAmount") @@ -216,6 +233,9 @@ func (c *ChatRevenueAmount) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("available_amount") b.PutLong(c.AvailableAmount) b.Comma() + b.FieldStart("withdrawal_enabled") + b.PutBool(c.WithdrawalEnabled) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -224,39 +244,45 @@ func (c *ChatRevenueAmount) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *ChatRevenueAmount) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatRevenueAmount#4f3bb29f to nil") + return fmt.Errorf("can't decode chatRevenueAmount#a648ce58 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("chatRevenueAmount"); err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#4f3bb29f: %w", err) + return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: %w", err) } case "cryptocurrency": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#4f3bb29f: field cryptocurrency: %w", err) + return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: field cryptocurrency: %w", err) } c.Cryptocurrency = value case "total_amount": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#4f3bb29f: field total_amount: %w", err) + return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: field total_amount: %w", err) } c.TotalAmount = value case "balance_amount": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#4f3bb29f: field balance_amount: %w", err) + return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: field balance_amount: %w", err) } c.BalanceAmount = value case "available_amount": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#4f3bb29f: field available_amount: %w", err) + return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: field available_amount: %w", err) } c.AvailableAmount = value + case "withdrawal_enabled": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: field withdrawal_enabled: %w", err) + } + c.WithdrawalEnabled = value default: return b.Skip() } @@ -295,3 +321,11 @@ func (c *ChatRevenueAmount) GetAvailableAmount() (value int64) { } return c.AvailableAmount } + +// GetWithdrawalEnabled returns value of WithdrawalEnabled field. +func (c *ChatRevenueAmount) GetWithdrawalEnabled() (value bool) { + if c == nil { + return + } + return c.WithdrawalEnabled +} diff --git a/tdapi/tl_chat_transaction_purpose_gen.go b/tdapi/tl_chat_transaction_purpose_gen.go new file mode 100644 index 0000000000..25410bb7c4 --- /dev/null +++ b/tdapi/tl_chat_transaction_purpose_gen.go @@ -0,0 +1,933 @@ +// 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{} +) + +// ChatTransactionPurposePaidMedia represents TL type `chatTransactionPurposePaidMedia#d35febb`. +type ChatTransactionPurposePaidMedia struct { + // Identifier of the corresponding message with paid media; can be 0 or an identifier of + // a deleted message + MessageID int64 + // The bought media if the trancastion wasn't refunded + Media []PaidMediaClass +} + +// ChatTransactionPurposePaidMediaTypeID is TL type id of ChatTransactionPurposePaidMedia. +const ChatTransactionPurposePaidMediaTypeID = 0xd35febb + +// construct implements constructor of ChatTransactionPurposeClass. +func (c ChatTransactionPurposePaidMedia) construct() ChatTransactionPurposeClass { return &c } + +// Ensuring interfaces in compile-time for ChatTransactionPurposePaidMedia. +var ( + _ bin.Encoder = &ChatTransactionPurposePaidMedia{} + _ bin.Decoder = &ChatTransactionPurposePaidMedia{} + _ bin.BareEncoder = &ChatTransactionPurposePaidMedia{} + _ bin.BareDecoder = &ChatTransactionPurposePaidMedia{} + + _ ChatTransactionPurposeClass = &ChatTransactionPurposePaidMedia{} +) + +func (c *ChatTransactionPurposePaidMedia) Zero() bool { + if c == nil { + return true + } + if !(c.MessageID == 0) { + return false + } + if !(c.Media == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChatTransactionPurposePaidMedia) String() string { + if c == nil { + return "ChatTransactionPurposePaidMedia(nil)" + } + type Alias ChatTransactionPurposePaidMedia + return fmt.Sprintf("ChatTransactionPurposePaidMedia%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChatTransactionPurposePaidMedia) TypeID() uint32 { + return ChatTransactionPurposePaidMediaTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChatTransactionPurposePaidMedia) TypeName() string { + return "chatTransactionPurposePaidMedia" +} + +// TypeInfo returns info about TL type. +func (c *ChatTransactionPurposePaidMedia) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "chatTransactionPurposePaidMedia", + ID: ChatTransactionPurposePaidMediaTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "MessageID", + SchemaName: "message_id", + }, + { + Name: "Media", + SchemaName: "media", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChatTransactionPurposePaidMedia) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatTransactionPurposePaidMedia#d35febb as nil") + } + b.PutID(ChatTransactionPurposePaidMediaTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChatTransactionPurposePaidMedia) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatTransactionPurposePaidMedia#d35febb as nil") + } + b.PutInt53(c.MessageID) + b.PutInt(len(c.Media)) + for idx, v := range c.Media { + if v == nil { + return fmt.Errorf("unable to encode chatTransactionPurposePaidMedia#d35febb: field media element with index %d is nil", idx) + } + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare chatTransactionPurposePaidMedia#d35febb: field media element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (c *ChatTransactionPurposePaidMedia) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatTransactionPurposePaidMedia#d35febb to nil") + } + if err := b.ConsumeID(ChatTransactionPurposePaidMediaTypeID); err != nil { + return fmt.Errorf("unable to decode chatTransactionPurposePaidMedia#d35febb: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChatTransactionPurposePaidMedia) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatTransactionPurposePaidMedia#d35febb to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode chatTransactionPurposePaidMedia#d35febb: field message_id: %w", err) + } + c.MessageID = value + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode chatTransactionPurposePaidMedia#d35febb: field media: %w", err) + } + + if headerLen > 0 { + c.Media = make([]PaidMediaClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodePaidMedia(b) + if err != nil { + return fmt.Errorf("unable to decode chatTransactionPurposePaidMedia#d35febb: field media: %w", err) + } + c.Media = append(c.Media, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatTransactionPurposePaidMedia) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatTransactionPurposePaidMedia#d35febb as nil") + } + b.ObjStart() + b.PutID("chatTransactionPurposePaidMedia") + b.Comma() + b.FieldStart("message_id") + b.PutInt53(c.MessageID) + b.Comma() + b.FieldStart("media") + b.ArrStart() + for idx, v := range c.Media { + if v == nil { + return fmt.Errorf("unable to encode chatTransactionPurposePaidMedia#d35febb: field media element with index %d is nil", idx) + } + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatTransactionPurposePaidMedia#d35febb: field media 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 (c *ChatTransactionPurposePaidMedia) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode chatTransactionPurposePaidMedia#d35febb to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("chatTransactionPurposePaidMedia"); err != nil { + return fmt.Errorf("unable to decode chatTransactionPurposePaidMedia#d35febb: %w", err) + } + case "message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode chatTransactionPurposePaidMedia#d35febb: field message_id: %w", err) + } + c.MessageID = value + case "media": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := DecodeTDLibJSONPaidMedia(b) + if err != nil { + return fmt.Errorf("unable to decode chatTransactionPurposePaidMedia#d35febb: field media: %w", err) + } + c.Media = append(c.Media, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode chatTransactionPurposePaidMedia#d35febb: field media: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetMessageID returns value of MessageID field. +func (c *ChatTransactionPurposePaidMedia) GetMessageID() (value int64) { + if c == nil { + return + } + return c.MessageID +} + +// GetMedia returns value of Media field. +func (c *ChatTransactionPurposePaidMedia) GetMedia() (value []PaidMediaClass) { + if c == nil { + return + } + return c.Media +} + +// ChatTransactionPurposeJoin represents TL type `chatTransactionPurposeJoin#5b31327a`. +type ChatTransactionPurposeJoin struct { + // The number of seconds between consecutive Telegram Star debiting + Period int32 +} + +// ChatTransactionPurposeJoinTypeID is TL type id of ChatTransactionPurposeJoin. +const ChatTransactionPurposeJoinTypeID = 0x5b31327a + +// construct implements constructor of ChatTransactionPurposeClass. +func (c ChatTransactionPurposeJoin) construct() ChatTransactionPurposeClass { return &c } + +// Ensuring interfaces in compile-time for ChatTransactionPurposeJoin. +var ( + _ bin.Encoder = &ChatTransactionPurposeJoin{} + _ bin.Decoder = &ChatTransactionPurposeJoin{} + _ bin.BareEncoder = &ChatTransactionPurposeJoin{} + _ bin.BareDecoder = &ChatTransactionPurposeJoin{} + + _ ChatTransactionPurposeClass = &ChatTransactionPurposeJoin{} +) + +func (c *ChatTransactionPurposeJoin) Zero() bool { + if c == nil { + return true + } + if !(c.Period == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChatTransactionPurposeJoin) String() string { + if c == nil { + return "ChatTransactionPurposeJoin(nil)" + } + type Alias ChatTransactionPurposeJoin + return fmt.Sprintf("ChatTransactionPurposeJoin%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChatTransactionPurposeJoin) TypeID() uint32 { + return ChatTransactionPurposeJoinTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChatTransactionPurposeJoin) TypeName() string { + return "chatTransactionPurposeJoin" +} + +// TypeInfo returns info about TL type. +func (c *ChatTransactionPurposeJoin) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "chatTransactionPurposeJoin", + ID: ChatTransactionPurposeJoinTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Period", + SchemaName: "period", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChatTransactionPurposeJoin) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatTransactionPurposeJoin#5b31327a as nil") + } + b.PutID(ChatTransactionPurposeJoinTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChatTransactionPurposeJoin) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatTransactionPurposeJoin#5b31327a as nil") + } + b.PutInt32(c.Period) + return nil +} + +// Decode implements bin.Decoder. +func (c *ChatTransactionPurposeJoin) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatTransactionPurposeJoin#5b31327a to nil") + } + if err := b.ConsumeID(ChatTransactionPurposeJoinTypeID); err != nil { + return fmt.Errorf("unable to decode chatTransactionPurposeJoin#5b31327a: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChatTransactionPurposeJoin) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatTransactionPurposeJoin#5b31327a to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatTransactionPurposeJoin#5b31327a: field period: %w", err) + } + c.Period = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatTransactionPurposeJoin) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatTransactionPurposeJoin#5b31327a as nil") + } + b.ObjStart() + b.PutID("chatTransactionPurposeJoin") + b.Comma() + b.FieldStart("period") + b.PutInt32(c.Period) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ChatTransactionPurposeJoin) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode chatTransactionPurposeJoin#5b31327a to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("chatTransactionPurposeJoin"); err != nil { + return fmt.Errorf("unable to decode chatTransactionPurposeJoin#5b31327a: %w", err) + } + case "period": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatTransactionPurposeJoin#5b31327a: field period: %w", err) + } + c.Period = value + default: + return b.Skip() + } + return nil + }) +} + +// GetPeriod returns value of Period field. +func (c *ChatTransactionPurposeJoin) GetPeriod() (value int32) { + if c == nil { + return + } + return c.Period +} + +// ChatTransactionPurposeReaction represents TL type `chatTransactionPurposeReaction#7a5f9888`. +type ChatTransactionPurposeReaction struct { + // Identifier of the reacted message; can be 0 or an identifier of a deleted message + MessageID int64 +} + +// ChatTransactionPurposeReactionTypeID is TL type id of ChatTransactionPurposeReaction. +const ChatTransactionPurposeReactionTypeID = 0x7a5f9888 + +// construct implements constructor of ChatTransactionPurposeClass. +func (c ChatTransactionPurposeReaction) construct() ChatTransactionPurposeClass { return &c } + +// Ensuring interfaces in compile-time for ChatTransactionPurposeReaction. +var ( + _ bin.Encoder = &ChatTransactionPurposeReaction{} + _ bin.Decoder = &ChatTransactionPurposeReaction{} + _ bin.BareEncoder = &ChatTransactionPurposeReaction{} + _ bin.BareDecoder = &ChatTransactionPurposeReaction{} + + _ ChatTransactionPurposeClass = &ChatTransactionPurposeReaction{} +) + +func (c *ChatTransactionPurposeReaction) Zero() bool { + if c == nil { + return true + } + if !(c.MessageID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChatTransactionPurposeReaction) String() string { + if c == nil { + return "ChatTransactionPurposeReaction(nil)" + } + type Alias ChatTransactionPurposeReaction + return fmt.Sprintf("ChatTransactionPurposeReaction%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChatTransactionPurposeReaction) TypeID() uint32 { + return ChatTransactionPurposeReactionTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChatTransactionPurposeReaction) TypeName() string { + return "chatTransactionPurposeReaction" +} + +// TypeInfo returns info about TL type. +func (c *ChatTransactionPurposeReaction) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "chatTransactionPurposeReaction", + ID: ChatTransactionPurposeReactionTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "MessageID", + SchemaName: "message_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChatTransactionPurposeReaction) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatTransactionPurposeReaction#7a5f9888 as nil") + } + b.PutID(ChatTransactionPurposeReactionTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChatTransactionPurposeReaction) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatTransactionPurposeReaction#7a5f9888 as nil") + } + b.PutInt53(c.MessageID) + return nil +} + +// Decode implements bin.Decoder. +func (c *ChatTransactionPurposeReaction) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatTransactionPurposeReaction#7a5f9888 to nil") + } + if err := b.ConsumeID(ChatTransactionPurposeReactionTypeID); err != nil { + return fmt.Errorf("unable to decode chatTransactionPurposeReaction#7a5f9888: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChatTransactionPurposeReaction) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatTransactionPurposeReaction#7a5f9888 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode chatTransactionPurposeReaction#7a5f9888: field message_id: %w", err) + } + c.MessageID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatTransactionPurposeReaction) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatTransactionPurposeReaction#7a5f9888 as nil") + } + b.ObjStart() + b.PutID("chatTransactionPurposeReaction") + b.Comma() + b.FieldStart("message_id") + b.PutInt53(c.MessageID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ChatTransactionPurposeReaction) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode chatTransactionPurposeReaction#7a5f9888 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("chatTransactionPurposeReaction"); err != nil { + return fmt.Errorf("unable to decode chatTransactionPurposeReaction#7a5f9888: %w", err) + } + case "message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode chatTransactionPurposeReaction#7a5f9888: field message_id: %w", err) + } + c.MessageID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetMessageID returns value of MessageID field. +func (c *ChatTransactionPurposeReaction) GetMessageID() (value int64) { + if c == nil { + return + } + return c.MessageID +} + +// ChatTransactionPurposeGiveaway represents TL type `chatTransactionPurposeGiveaway#384c8b7f`. +type ChatTransactionPurposeGiveaway struct { + // Identifier of the message with giveaway; can be 0 or an identifier of a deleted + // message + GiveawayMessageID int64 +} + +// ChatTransactionPurposeGiveawayTypeID is TL type id of ChatTransactionPurposeGiveaway. +const ChatTransactionPurposeGiveawayTypeID = 0x384c8b7f + +// construct implements constructor of ChatTransactionPurposeClass. +func (c ChatTransactionPurposeGiveaway) construct() ChatTransactionPurposeClass { return &c } + +// Ensuring interfaces in compile-time for ChatTransactionPurposeGiveaway. +var ( + _ bin.Encoder = &ChatTransactionPurposeGiveaway{} + _ bin.Decoder = &ChatTransactionPurposeGiveaway{} + _ bin.BareEncoder = &ChatTransactionPurposeGiveaway{} + _ bin.BareDecoder = &ChatTransactionPurposeGiveaway{} + + _ ChatTransactionPurposeClass = &ChatTransactionPurposeGiveaway{} +) + +func (c *ChatTransactionPurposeGiveaway) Zero() bool { + if c == nil { + return true + } + if !(c.GiveawayMessageID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChatTransactionPurposeGiveaway) String() string { + if c == nil { + return "ChatTransactionPurposeGiveaway(nil)" + } + type Alias ChatTransactionPurposeGiveaway + return fmt.Sprintf("ChatTransactionPurposeGiveaway%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChatTransactionPurposeGiveaway) TypeID() uint32 { + return ChatTransactionPurposeGiveawayTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChatTransactionPurposeGiveaway) TypeName() string { + return "chatTransactionPurposeGiveaway" +} + +// TypeInfo returns info about TL type. +func (c *ChatTransactionPurposeGiveaway) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "chatTransactionPurposeGiveaway", + ID: ChatTransactionPurposeGiveawayTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "GiveawayMessageID", + SchemaName: "giveaway_message_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChatTransactionPurposeGiveaway) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatTransactionPurposeGiveaway#384c8b7f as nil") + } + b.PutID(ChatTransactionPurposeGiveawayTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChatTransactionPurposeGiveaway) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatTransactionPurposeGiveaway#384c8b7f as nil") + } + b.PutInt53(c.GiveawayMessageID) + return nil +} + +// Decode implements bin.Decoder. +func (c *ChatTransactionPurposeGiveaway) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatTransactionPurposeGiveaway#384c8b7f to nil") + } + if err := b.ConsumeID(ChatTransactionPurposeGiveawayTypeID); err != nil { + return fmt.Errorf("unable to decode chatTransactionPurposeGiveaway#384c8b7f: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChatTransactionPurposeGiveaway) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatTransactionPurposeGiveaway#384c8b7f to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode chatTransactionPurposeGiveaway#384c8b7f: field giveaway_message_id: %w", err) + } + c.GiveawayMessageID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatTransactionPurposeGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatTransactionPurposeGiveaway#384c8b7f as nil") + } + b.ObjStart() + b.PutID("chatTransactionPurposeGiveaway") + b.Comma() + b.FieldStart("giveaway_message_id") + b.PutInt53(c.GiveawayMessageID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ChatTransactionPurposeGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode chatTransactionPurposeGiveaway#384c8b7f to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("chatTransactionPurposeGiveaway"); err != nil { + return fmt.Errorf("unable to decode chatTransactionPurposeGiveaway#384c8b7f: %w", err) + } + case "giveaway_message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode chatTransactionPurposeGiveaway#384c8b7f: field giveaway_message_id: %w", err) + } + c.GiveawayMessageID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetGiveawayMessageID returns value of GiveawayMessageID field. +func (c *ChatTransactionPurposeGiveaway) GetGiveawayMessageID() (value int64) { + if c == nil { + return + } + return c.GiveawayMessageID +} + +// ChatTransactionPurposeClassName is schema name of ChatTransactionPurposeClass. +const ChatTransactionPurposeClassName = "ChatTransactionPurpose" + +// ChatTransactionPurposeClass represents ChatTransactionPurpose generic type. +// +// Example: +// +// g, err := tdapi.DecodeChatTransactionPurpose(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tdapi.ChatTransactionPurposePaidMedia: // chatTransactionPurposePaidMedia#d35febb +// case *tdapi.ChatTransactionPurposeJoin: // chatTransactionPurposeJoin#5b31327a +// case *tdapi.ChatTransactionPurposeReaction: // chatTransactionPurposeReaction#7a5f9888 +// case *tdapi.ChatTransactionPurposeGiveaway: // chatTransactionPurposeGiveaway#384c8b7f +// default: panic(v) +// } +type ChatTransactionPurposeClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() ChatTransactionPurposeClass + + // 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 +} + +// DecodeChatTransactionPurpose implements binary de-serialization for ChatTransactionPurposeClass. +func DecodeChatTransactionPurpose(buf *bin.Buffer) (ChatTransactionPurposeClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case ChatTransactionPurposePaidMediaTypeID: + // Decoding chatTransactionPurposePaidMedia#d35febb. + v := ChatTransactionPurposePaidMedia{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatTransactionPurposeClass: %w", err) + } + return &v, nil + case ChatTransactionPurposeJoinTypeID: + // Decoding chatTransactionPurposeJoin#5b31327a. + v := ChatTransactionPurposeJoin{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatTransactionPurposeClass: %w", err) + } + return &v, nil + case ChatTransactionPurposeReactionTypeID: + // Decoding chatTransactionPurposeReaction#7a5f9888. + v := ChatTransactionPurposeReaction{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatTransactionPurposeClass: %w", err) + } + return &v, nil + case ChatTransactionPurposeGiveawayTypeID: + // Decoding chatTransactionPurposeGiveaway#384c8b7f. + v := ChatTransactionPurposeGiveaway{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatTransactionPurposeClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode ChatTransactionPurposeClass: %w", bin.NewUnexpectedID(id)) + } +} + +// DecodeTDLibJSONChatTransactionPurpose implements binary de-serialization for ChatTransactionPurposeClass. +func DecodeTDLibJSONChatTransactionPurpose(buf tdjson.Decoder) (ChatTransactionPurposeClass, error) { + id, err := buf.FindTypeID() + if err != nil { + return nil, err + } + switch id { + case "chatTransactionPurposePaidMedia": + // Decoding chatTransactionPurposePaidMedia#d35febb. + v := ChatTransactionPurposePaidMedia{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatTransactionPurposeClass: %w", err) + } + return &v, nil + case "chatTransactionPurposeJoin": + // Decoding chatTransactionPurposeJoin#5b31327a. + v := ChatTransactionPurposeJoin{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatTransactionPurposeClass: %w", err) + } + return &v, nil + case "chatTransactionPurposeReaction": + // Decoding chatTransactionPurposeReaction#7a5f9888. + v := ChatTransactionPurposeReaction{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatTransactionPurposeClass: %w", err) + } + return &v, nil + case "chatTransactionPurposeGiveaway": + // Decoding chatTransactionPurposeGiveaway#384c8b7f. + v := ChatTransactionPurposeGiveaway{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatTransactionPurposeClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode ChatTransactionPurposeClass: %w", tdjson.NewUnexpectedID(id)) + } +} + +// ChatTransactionPurpose boxes the ChatTransactionPurposeClass providing a helper. +type ChatTransactionPurposeBox struct { + ChatTransactionPurpose ChatTransactionPurposeClass +} + +// Decode implements bin.Decoder for ChatTransactionPurposeBox. +func (b *ChatTransactionPurposeBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode ChatTransactionPurposeBox to nil") + } + v, err := DecodeChatTransactionPurpose(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.ChatTransactionPurpose = v + return nil +} + +// Encode implements bin.Encode for ChatTransactionPurposeBox. +func (b *ChatTransactionPurposeBox) Encode(buf *bin.Buffer) error { + if b == nil || b.ChatTransactionPurpose == nil { + return fmt.Errorf("unable to encode ChatTransactionPurposeClass as nil") + } + return b.ChatTransactionPurpose.Encode(buf) +} + +// DecodeTDLibJSON implements bin.Decoder for ChatTransactionPurposeBox. +func (b *ChatTransactionPurposeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("unable to decode ChatTransactionPurposeBox to nil") + } + v, err := DecodeTDLibJSONChatTransactionPurpose(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.ChatTransactionPurpose = v + return nil +} + +// EncodeTDLibJSON implements bin.Encode for ChatTransactionPurposeBox. +func (b *ChatTransactionPurposeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil || b.ChatTransactionPurpose == nil { + return fmt.Errorf("unable to encode ChatTransactionPurposeClass as nil") + } + return b.ChatTransactionPurpose.EncodeTDLibJSON(buf) +} diff --git a/tdapi/tl_commit_pending_paid_message_reactions_gen.go b/tdapi/tl_commit_pending_paid_message_reactions_gen.go new file mode 100644 index 0000000000..fc7b040a7d --- /dev/null +++ b/tdapi/tl_commit_pending_paid_message_reactions_gen.go @@ -0,0 +1,237 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// CommitPendingPaidMessageReactionsRequest represents TL type `commitPendingPaidMessageReactions#f5c95606`. +type CommitPendingPaidMessageReactionsRequest struct { + // Identifier of the chat to which the message belongs + ChatID int64 + // Identifier of the message + MessageID int64 +} + +// CommitPendingPaidMessageReactionsRequestTypeID is TL type id of CommitPendingPaidMessageReactionsRequest. +const CommitPendingPaidMessageReactionsRequestTypeID = 0xf5c95606 + +// Ensuring interfaces in compile-time for CommitPendingPaidMessageReactionsRequest. +var ( + _ bin.Encoder = &CommitPendingPaidMessageReactionsRequest{} + _ bin.Decoder = &CommitPendingPaidMessageReactionsRequest{} + _ bin.BareEncoder = &CommitPendingPaidMessageReactionsRequest{} + _ bin.BareDecoder = &CommitPendingPaidMessageReactionsRequest{} +) + +func (c *CommitPendingPaidMessageReactionsRequest) Zero() bool { + if c == nil { + return true + } + if !(c.ChatID == 0) { + return false + } + if !(c.MessageID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *CommitPendingPaidMessageReactionsRequest) String() string { + if c == nil { + return "CommitPendingPaidMessageReactionsRequest(nil)" + } + type Alias CommitPendingPaidMessageReactionsRequest + return fmt.Sprintf("CommitPendingPaidMessageReactionsRequest%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*CommitPendingPaidMessageReactionsRequest) TypeID() uint32 { + return CommitPendingPaidMessageReactionsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*CommitPendingPaidMessageReactionsRequest) TypeName() string { + return "commitPendingPaidMessageReactions" +} + +// TypeInfo returns info about TL type. +func (c *CommitPendingPaidMessageReactionsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "commitPendingPaidMessageReactions", + ID: CommitPendingPaidMessageReactionsRequestTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "MessageID", + SchemaName: "message_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *CommitPendingPaidMessageReactionsRequest) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode commitPendingPaidMessageReactions#f5c95606 as nil") + } + b.PutID(CommitPendingPaidMessageReactionsRequestTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *CommitPendingPaidMessageReactionsRequest) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode commitPendingPaidMessageReactions#f5c95606 as nil") + } + b.PutInt53(c.ChatID) + b.PutInt53(c.MessageID) + return nil +} + +// Decode implements bin.Decoder. +func (c *CommitPendingPaidMessageReactionsRequest) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode commitPendingPaidMessageReactions#f5c95606 to nil") + } + if err := b.ConsumeID(CommitPendingPaidMessageReactionsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode commitPendingPaidMessageReactions#f5c95606: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *CommitPendingPaidMessageReactionsRequest) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode commitPendingPaidMessageReactions#f5c95606 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode commitPendingPaidMessageReactions#f5c95606: field chat_id: %w", err) + } + c.ChatID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode commitPendingPaidMessageReactions#f5c95606: field message_id: %w", err) + } + c.MessageID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *CommitPendingPaidMessageReactionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode commitPendingPaidMessageReactions#f5c95606 as nil") + } + b.ObjStart() + b.PutID("commitPendingPaidMessageReactions") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(c.ChatID) + b.Comma() + b.FieldStart("message_id") + b.PutInt53(c.MessageID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *CommitPendingPaidMessageReactionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode commitPendingPaidMessageReactions#f5c95606 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("commitPendingPaidMessageReactions"); err != nil { + return fmt.Errorf("unable to decode commitPendingPaidMessageReactions#f5c95606: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode commitPendingPaidMessageReactions#f5c95606: field chat_id: %w", err) + } + c.ChatID = value + case "message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode commitPendingPaidMessageReactions#f5c95606: field message_id: %w", err) + } + c.MessageID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (c *CommitPendingPaidMessageReactionsRequest) GetChatID() (value int64) { + if c == nil { + return + } + return c.ChatID +} + +// GetMessageID returns value of MessageID field. +func (c *CommitPendingPaidMessageReactionsRequest) GetMessageID() (value int64) { + if c == nil { + return + } + return c.MessageID +} + +// CommitPendingPaidMessageReactions invokes method commitPendingPaidMessageReactions#f5c95606 returning error if any. +func (c *Client) CommitPendingPaidMessageReactions(ctx context.Context, request *CommitPendingPaidMessageReactionsRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_get_giveaway_info_gen.go b/tdapi/tl_get_giveaway_info_gen.go new file mode 100644 index 0000000000..7963b24752 --- /dev/null +++ b/tdapi/tl_get_giveaway_info_gen.go @@ -0,0 +1,237 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// GetGiveawayInfoRequest represents TL type `getGiveawayInfo#b78790bb`. +type GetGiveawayInfoRequest struct { + // Identifier of the channel chat which started the giveaway + ChatID int64 + // Identifier of the giveaway or a giveaway winners message in the chat + MessageID int64 +} + +// GetGiveawayInfoRequestTypeID is TL type id of GetGiveawayInfoRequest. +const GetGiveawayInfoRequestTypeID = 0xb78790bb + +// Ensuring interfaces in compile-time for GetGiveawayInfoRequest. +var ( + _ bin.Encoder = &GetGiveawayInfoRequest{} + _ bin.Decoder = &GetGiveawayInfoRequest{} + _ bin.BareEncoder = &GetGiveawayInfoRequest{} + _ bin.BareDecoder = &GetGiveawayInfoRequest{} +) + +func (g *GetGiveawayInfoRequest) Zero() bool { + if g == nil { + return true + } + if !(g.ChatID == 0) { + return false + } + if !(g.MessageID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetGiveawayInfoRequest) String() string { + if g == nil { + return "GetGiveawayInfoRequest(nil)" + } + type Alias GetGiveawayInfoRequest + return fmt.Sprintf("GetGiveawayInfoRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetGiveawayInfoRequest) TypeID() uint32 { + return GetGiveawayInfoRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetGiveawayInfoRequest) TypeName() string { + return "getGiveawayInfo" +} + +// TypeInfo returns info about TL type. +func (g *GetGiveawayInfoRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getGiveawayInfo", + ID: GetGiveawayInfoRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "MessageID", + SchemaName: "message_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetGiveawayInfoRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getGiveawayInfo#b78790bb as nil") + } + b.PutID(GetGiveawayInfoRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetGiveawayInfoRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getGiveawayInfo#b78790bb as nil") + } + b.PutInt53(g.ChatID) + b.PutInt53(g.MessageID) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetGiveawayInfoRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getGiveawayInfo#b78790bb to nil") + } + if err := b.ConsumeID(GetGiveawayInfoRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getGiveawayInfo#b78790bb: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetGiveawayInfoRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getGiveawayInfo#b78790bb to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getGiveawayInfo#b78790bb: field chat_id: %w", err) + } + g.ChatID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getGiveawayInfo#b78790bb: field message_id: %w", err) + } + g.MessageID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetGiveawayInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getGiveawayInfo#b78790bb as nil") + } + b.ObjStart() + b.PutID("getGiveawayInfo") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(g.ChatID) + b.Comma() + b.FieldStart("message_id") + b.PutInt53(g.MessageID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetGiveawayInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getGiveawayInfo#b78790bb to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getGiveawayInfo"); err != nil { + return fmt.Errorf("unable to decode getGiveawayInfo#b78790bb: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getGiveawayInfo#b78790bb: field chat_id: %w", err) + } + g.ChatID = value + case "message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getGiveawayInfo#b78790bb: field message_id: %w", err) + } + g.MessageID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (g *GetGiveawayInfoRequest) GetChatID() (value int64) { + if g == nil { + return + } + return g.ChatID +} + +// GetMessageID returns value of MessageID field. +func (g *GetGiveawayInfoRequest) GetMessageID() (value int64) { + if g == nil { + return + } + return g.MessageID +} + +// GetGiveawayInfo invokes method getGiveawayInfo#b78790bb returning error if any. +func (c *Client) GetGiveawayInfo(ctx context.Context, request *GetGiveawayInfoRequest) (GiveawayInfoClass, error) { + var result GiveawayInfoBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.GiveawayInfo, nil +} diff --git a/tdapi/tl_get_grossing_web_app_bots_gen.go b/tdapi/tl_get_grossing_web_app_bots_gen.go new file mode 100644 index 0000000000..aec144d879 --- /dev/null +++ b/tdapi/tl_get_grossing_web_app_bots_gen.go @@ -0,0 +1,238 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// GetGrossingWebAppBotsRequest represents TL type `getGrossingWebAppBots#6522ce1a`. +type GetGrossingWebAppBotsRequest struct { + // Offset of the first entry to return as received from the previous request; use empty + // string to get the first chunk of results + Offset string + // The maximum number of bots to be returned; up to 100 + Limit int32 +} + +// GetGrossingWebAppBotsRequestTypeID is TL type id of GetGrossingWebAppBotsRequest. +const GetGrossingWebAppBotsRequestTypeID = 0x6522ce1a + +// Ensuring interfaces in compile-time for GetGrossingWebAppBotsRequest. +var ( + _ bin.Encoder = &GetGrossingWebAppBotsRequest{} + _ bin.Decoder = &GetGrossingWebAppBotsRequest{} + _ bin.BareEncoder = &GetGrossingWebAppBotsRequest{} + _ bin.BareDecoder = &GetGrossingWebAppBotsRequest{} +) + +func (g *GetGrossingWebAppBotsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Offset == "") { + return false + } + if !(g.Limit == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetGrossingWebAppBotsRequest) String() string { + if g == nil { + return "GetGrossingWebAppBotsRequest(nil)" + } + type Alias GetGrossingWebAppBotsRequest + return fmt.Sprintf("GetGrossingWebAppBotsRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetGrossingWebAppBotsRequest) TypeID() uint32 { + return GetGrossingWebAppBotsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetGrossingWebAppBotsRequest) TypeName() string { + return "getGrossingWebAppBots" +} + +// TypeInfo returns info about TL type. +func (g *GetGrossingWebAppBotsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getGrossingWebAppBots", + ID: GetGrossingWebAppBotsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Offset", + SchemaName: "offset", + }, + { + Name: "Limit", + SchemaName: "limit", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetGrossingWebAppBotsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getGrossingWebAppBots#6522ce1a as nil") + } + b.PutID(GetGrossingWebAppBotsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetGrossingWebAppBotsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getGrossingWebAppBots#6522ce1a as nil") + } + b.PutString(g.Offset) + b.PutInt32(g.Limit) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetGrossingWebAppBotsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getGrossingWebAppBots#6522ce1a to nil") + } + if err := b.ConsumeID(GetGrossingWebAppBotsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getGrossingWebAppBots#6522ce1a: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetGrossingWebAppBotsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getGrossingWebAppBots#6522ce1a to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getGrossingWebAppBots#6522ce1a: field offset: %w", err) + } + g.Offset = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getGrossingWebAppBots#6522ce1a: field limit: %w", err) + } + g.Limit = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetGrossingWebAppBotsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getGrossingWebAppBots#6522ce1a as nil") + } + b.ObjStart() + b.PutID("getGrossingWebAppBots") + 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 *GetGrossingWebAppBotsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getGrossingWebAppBots#6522ce1a to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getGrossingWebAppBots"); err != nil { + return fmt.Errorf("unable to decode getGrossingWebAppBots#6522ce1a: %w", err) + } + case "offset": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getGrossingWebAppBots#6522ce1a: field offset: %w", err) + } + g.Offset = value + case "limit": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getGrossingWebAppBots#6522ce1a: field limit: %w", err) + } + g.Limit = value + default: + return b.Skip() + } + return nil + }) +} + +// GetOffset returns value of Offset field. +func (g *GetGrossingWebAppBotsRequest) GetOffset() (value string) { + if g == nil { + return + } + return g.Offset +} + +// GetLimit returns value of Limit field. +func (g *GetGrossingWebAppBotsRequest) GetLimit() (value int32) { + if g == nil { + return + } + return g.Limit +} + +// GetGrossingWebAppBots invokes method getGrossingWebAppBots#6522ce1a returning error if any. +func (c *Client) GetGrossingWebAppBots(ctx context.Context, request *GetGrossingWebAppBotsRequest) (*FoundUsers, error) { + var result FoundUsers + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_popular_web_app_bots_gen.go b/tdapi/tl_get_popular_web_app_bots_gen.go deleted file mode 100644 index 35f1dc6fe1..0000000000 --- a/tdapi/tl_get_popular_web_app_bots_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -import ( - "context" - "errors" - "fmt" - "sort" - "strings" - - "go.uber.org/multierr" - - "github.com/gotd/td/bin" - "github.com/gotd/td/tdjson" - "github.com/gotd/td/tdp" - "github.com/gotd/td/tgerr" -) - -// No-op definition for keeping imports. -var ( - _ = bin.Buffer{} - _ = context.Background() - _ = fmt.Stringer(nil) - _ = strings.Builder{} - _ = errors.Is - _ = multierr.AppendInto - _ = sort.Ints - _ = tdp.Format - _ = tgerr.Error{} - _ = tdjson.Encoder{} -) - -// GetPopularWebAppBotsRequest represents TL type `getPopularWebAppBots#e8d04cb`. -type GetPopularWebAppBotsRequest struct { - // Offset of the first entry to return as received from the previous request; use empty - // string to get the first chunk of results - Offset string - // The maximum number of bots to be returned; up to 100 - Limit int32 -} - -// GetPopularWebAppBotsRequestTypeID is TL type id of GetPopularWebAppBotsRequest. -const GetPopularWebAppBotsRequestTypeID = 0xe8d04cb - -// Ensuring interfaces in compile-time for GetPopularWebAppBotsRequest. -var ( - _ bin.Encoder = &GetPopularWebAppBotsRequest{} - _ bin.Decoder = &GetPopularWebAppBotsRequest{} - _ bin.BareEncoder = &GetPopularWebAppBotsRequest{} - _ bin.BareDecoder = &GetPopularWebAppBotsRequest{} -) - -func (g *GetPopularWebAppBotsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Offset == "") { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPopularWebAppBotsRequest) String() string { - if g == nil { - return "GetPopularWebAppBotsRequest(nil)" - } - type Alias GetPopularWebAppBotsRequest - return fmt.Sprintf("GetPopularWebAppBotsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPopularWebAppBotsRequest) TypeID() uint32 { - return GetPopularWebAppBotsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPopularWebAppBotsRequest) TypeName() string { - return "getPopularWebAppBots" -} - -// TypeInfo returns info about TL type. -func (g *GetPopularWebAppBotsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPopularWebAppBots", - ID: GetPopularWebAppBotsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPopularWebAppBotsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPopularWebAppBots#e8d04cb as nil") - } - b.PutID(GetPopularWebAppBotsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPopularWebAppBotsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPopularWebAppBots#e8d04cb as nil") - } - b.PutString(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPopularWebAppBotsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPopularWebAppBots#e8d04cb to nil") - } - if err := b.ConsumeID(GetPopularWebAppBotsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPopularWebAppBots#e8d04cb: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPopularWebAppBotsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPopularWebAppBots#e8d04cb to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPopularWebAppBots#e8d04cb: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getPopularWebAppBots#e8d04cb: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPopularWebAppBotsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPopularWebAppBots#e8d04cb as nil") - } - b.ObjStart() - b.PutID("getPopularWebAppBots") - 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 *GetPopularWebAppBotsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPopularWebAppBots#e8d04cb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPopularWebAppBots"); err != nil { - return fmt.Errorf("unable to decode getPopularWebAppBots#e8d04cb: %w", err) - } - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPopularWebAppBots#e8d04cb: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getPopularWebAppBots#e8d04cb: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOffset returns value of Offset field. -func (g *GetPopularWebAppBotsRequest) GetOffset() (value string) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetPopularWebAppBotsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetPopularWebAppBots invokes method getPopularWebAppBots#e8d04cb returning error if any. -func (c *Client) GetPopularWebAppBots(ctx context.Context, request *GetPopularWebAppBotsRequest) (*FoundUsers, error) { - var result FoundUsers - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_premium_giveaway_info_gen.go b/tdapi/tl_get_premium_giveaway_info_gen.go deleted file mode 100644 index b58fafd3a6..0000000000 --- a/tdapi/tl_get_premium_giveaway_info_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{} -) - -// GetPremiumGiveawayInfoRequest represents TL type `getPremiumGiveawayInfo#6adb7b97`. -type GetPremiumGiveawayInfoRequest struct { - // Identifier of the channel chat which started the giveaway - ChatID int64 - // Identifier of the giveaway or a giveaway winners message in the chat - MessageID int64 -} - -// GetPremiumGiveawayInfoRequestTypeID is TL type id of GetPremiumGiveawayInfoRequest. -const GetPremiumGiveawayInfoRequestTypeID = 0x6adb7b97 - -// Ensuring interfaces in compile-time for GetPremiumGiveawayInfoRequest. -var ( - _ bin.Encoder = &GetPremiumGiveawayInfoRequest{} - _ bin.Decoder = &GetPremiumGiveawayInfoRequest{} - _ bin.BareEncoder = &GetPremiumGiveawayInfoRequest{} - _ bin.BareDecoder = &GetPremiumGiveawayInfoRequest{} -) - -func (g *GetPremiumGiveawayInfoRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPremiumGiveawayInfoRequest) String() string { - if g == nil { - return "GetPremiumGiveawayInfoRequest(nil)" - } - type Alias GetPremiumGiveawayInfoRequest - return fmt.Sprintf("GetPremiumGiveawayInfoRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPremiumGiveawayInfoRequest) TypeID() uint32 { - return GetPremiumGiveawayInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPremiumGiveawayInfoRequest) TypeName() string { - return "getPremiumGiveawayInfo" -} - -// TypeInfo returns info about TL type. -func (g *GetPremiumGiveawayInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPremiumGiveawayInfo", - ID: GetPremiumGiveawayInfoRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPremiumGiveawayInfoRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumGiveawayInfo#6adb7b97 as nil") - } - b.PutID(GetPremiumGiveawayInfoRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPremiumGiveawayInfoRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumGiveawayInfo#6adb7b97 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPremiumGiveawayInfoRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumGiveawayInfo#6adb7b97 to nil") - } - if err := b.ConsumeID(GetPremiumGiveawayInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPremiumGiveawayInfo#6adb7b97: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPremiumGiveawayInfoRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumGiveawayInfo#6adb7b97 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getPremiumGiveawayInfo#6adb7b97: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getPremiumGiveawayInfo#6adb7b97: field message_id: %w", err) - } - g.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPremiumGiveawayInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumGiveawayInfo#6adb7b97 as nil") - } - b.ObjStart() - b.PutID("getPremiumGiveawayInfo") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPremiumGiveawayInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumGiveawayInfo#6adb7b97 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPremiumGiveawayInfo"); err != nil { - return fmt.Errorf("unable to decode getPremiumGiveawayInfo#6adb7b97: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getPremiumGiveawayInfo#6adb7b97: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getPremiumGiveawayInfo#6adb7b97: field message_id: %w", err) - } - g.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetPremiumGiveawayInfoRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetPremiumGiveawayInfoRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetPremiumGiveawayInfo invokes method getPremiumGiveawayInfo#6adb7b97 returning error if any. -func (c *Client) GetPremiumGiveawayInfo(ctx context.Context, request *GetPremiumGiveawayInfoRequest) (PremiumGiveawayInfoClass, error) { - var result PremiumGiveawayInfoBox - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.PremiumGiveawayInfo, nil -} diff --git a/tdapi/tl_get_star_giveaway_payment_options_gen.go b/tdapi/tl_get_star_giveaway_payment_options_gen.go new file mode 100644 index 0000000000..9f9ef5562a --- /dev/null +++ b/tdapi/tl_get_star_giveaway_payment_options_gen.go @@ -0,0 +1,169 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// GetStarGiveawayPaymentOptionsRequest represents TL type `getStarGiveawayPaymentOptions#cb5bdb1e`. +type GetStarGiveawayPaymentOptionsRequest struct { +} + +// GetStarGiveawayPaymentOptionsRequestTypeID is TL type id of GetStarGiveawayPaymentOptionsRequest. +const GetStarGiveawayPaymentOptionsRequestTypeID = 0xcb5bdb1e + +// Ensuring interfaces in compile-time for GetStarGiveawayPaymentOptionsRequest. +var ( + _ bin.Encoder = &GetStarGiveawayPaymentOptionsRequest{} + _ bin.Decoder = &GetStarGiveawayPaymentOptionsRequest{} + _ bin.BareEncoder = &GetStarGiveawayPaymentOptionsRequest{} + _ bin.BareDecoder = &GetStarGiveawayPaymentOptionsRequest{} +) + +func (g *GetStarGiveawayPaymentOptionsRequest) Zero() bool { + if g == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetStarGiveawayPaymentOptionsRequest) String() string { + if g == nil { + return "GetStarGiveawayPaymentOptionsRequest(nil)" + } + type Alias GetStarGiveawayPaymentOptionsRequest + return fmt.Sprintf("GetStarGiveawayPaymentOptionsRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetStarGiveawayPaymentOptionsRequest) TypeID() uint32 { + return GetStarGiveawayPaymentOptionsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetStarGiveawayPaymentOptionsRequest) TypeName() string { + return "getStarGiveawayPaymentOptions" +} + +// TypeInfo returns info about TL type. +func (g *GetStarGiveawayPaymentOptionsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getStarGiveawayPaymentOptions", + ID: GetStarGiveawayPaymentOptionsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (g *GetStarGiveawayPaymentOptionsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getStarGiveawayPaymentOptions#cb5bdb1e as nil") + } + b.PutID(GetStarGiveawayPaymentOptionsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetStarGiveawayPaymentOptionsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getStarGiveawayPaymentOptions#cb5bdb1e as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (g *GetStarGiveawayPaymentOptionsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getStarGiveawayPaymentOptions#cb5bdb1e to nil") + } + if err := b.ConsumeID(GetStarGiveawayPaymentOptionsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getStarGiveawayPaymentOptions#cb5bdb1e: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetStarGiveawayPaymentOptionsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getStarGiveawayPaymentOptions#cb5bdb1e to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetStarGiveawayPaymentOptionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getStarGiveawayPaymentOptions#cb5bdb1e as nil") + } + b.ObjStart() + b.PutID("getStarGiveawayPaymentOptions") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetStarGiveawayPaymentOptionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getStarGiveawayPaymentOptions#cb5bdb1e to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getStarGiveawayPaymentOptions"); err != nil { + return fmt.Errorf("unable to decode getStarGiveawayPaymentOptions#cb5bdb1e: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetStarGiveawayPaymentOptions invokes method getStarGiveawayPaymentOptions#cb5bdb1e returning error if any. +func (c *Client) GetStarGiveawayPaymentOptions(ctx context.Context) (*StarGiveawayPaymentOptions, error) { + var result StarGiveawayPaymentOptions + + request := &GetStarGiveawayPaymentOptionsRequest{} + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_sticker_set_name_gen.go b/tdapi/tl_get_sticker_set_name_gen.go new file mode 100644 index 0000000000..674b125a35 --- /dev/null +++ b/tdapi/tl_get_sticker_set_name_gen.go @@ -0,0 +1,206 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// GetStickerSetNameRequest represents TL type `getStickerSetName#3dfad681`. +type GetStickerSetNameRequest struct { + // Identifier of the sticker set + SetID int64 +} + +// GetStickerSetNameRequestTypeID is TL type id of GetStickerSetNameRequest. +const GetStickerSetNameRequestTypeID = 0x3dfad681 + +// Ensuring interfaces in compile-time for GetStickerSetNameRequest. +var ( + _ bin.Encoder = &GetStickerSetNameRequest{} + _ bin.Decoder = &GetStickerSetNameRequest{} + _ bin.BareEncoder = &GetStickerSetNameRequest{} + _ bin.BareDecoder = &GetStickerSetNameRequest{} +) + +func (g *GetStickerSetNameRequest) Zero() bool { + if g == nil { + return true + } + if !(g.SetID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetStickerSetNameRequest) String() string { + if g == nil { + return "GetStickerSetNameRequest(nil)" + } + type Alias GetStickerSetNameRequest + return fmt.Sprintf("GetStickerSetNameRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetStickerSetNameRequest) TypeID() uint32 { + return GetStickerSetNameRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetStickerSetNameRequest) TypeName() string { + return "getStickerSetName" +} + +// TypeInfo returns info about TL type. +func (g *GetStickerSetNameRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getStickerSetName", + ID: GetStickerSetNameRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "SetID", + SchemaName: "set_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetStickerSetNameRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getStickerSetName#3dfad681 as nil") + } + b.PutID(GetStickerSetNameRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetStickerSetNameRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getStickerSetName#3dfad681 as nil") + } + b.PutLong(g.SetID) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetStickerSetNameRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getStickerSetName#3dfad681 to nil") + } + if err := b.ConsumeID(GetStickerSetNameRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getStickerSetName#3dfad681: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetStickerSetNameRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getStickerSetName#3dfad681 to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode getStickerSetName#3dfad681: field set_id: %w", err) + } + g.SetID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetStickerSetNameRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getStickerSetName#3dfad681 as nil") + } + b.ObjStart() + b.PutID("getStickerSetName") + b.Comma() + b.FieldStart("set_id") + b.PutLong(g.SetID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetStickerSetNameRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getStickerSetName#3dfad681 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getStickerSetName"); err != nil { + return fmt.Errorf("unable to decode getStickerSetName#3dfad681: %w", err) + } + case "set_id": + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode getStickerSetName#3dfad681: field set_id: %w", err) + } + g.SetID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetSetID returns value of SetID field. +func (g *GetStickerSetNameRequest) GetSetID() (value int64) { + if g == nil { + return + } + return g.SetID +} + +// GetStickerSetName invokes method getStickerSetName#3dfad681 returning error if any. +func (c *Client) GetStickerSetName(ctx context.Context, setid int64) (*Text, error) { + var result Text + + request := &GetStickerSetNameRequest{ + SetID: setid, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_giveaway_info_gen.go b/tdapi/tl_giveaway_info_gen.go new file mode 100644 index 0000000000..edecfa2ab0 --- /dev/null +++ b/tdapi/tl_giveaway_info_gen.go @@ -0,0 +1,824 @@ +// 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{} +) + +// GiveawayInfoOngoing represents TL type `giveawayInfoOngoing#624ee050`. +type GiveawayInfoOngoing struct { + // Point in time (Unix timestamp) when the giveaway was created + CreationDate int32 + // Status of the current user in the giveaway + Status GiveawayParticipantStatusClass + // True, if the giveaway has ended and results are being prepared + IsEnded bool +} + +// GiveawayInfoOngoingTypeID is TL type id of GiveawayInfoOngoing. +const GiveawayInfoOngoingTypeID = 0x624ee050 + +// construct implements constructor of GiveawayInfoClass. +func (g GiveawayInfoOngoing) construct() GiveawayInfoClass { return &g } + +// Ensuring interfaces in compile-time for GiveawayInfoOngoing. +var ( + _ bin.Encoder = &GiveawayInfoOngoing{} + _ bin.Decoder = &GiveawayInfoOngoing{} + _ bin.BareEncoder = &GiveawayInfoOngoing{} + _ bin.BareDecoder = &GiveawayInfoOngoing{} + + _ GiveawayInfoClass = &GiveawayInfoOngoing{} +) + +func (g *GiveawayInfoOngoing) Zero() bool { + if g == nil { + return true + } + if !(g.CreationDate == 0) { + return false + } + if !(g.Status == nil) { + return false + } + if !(g.IsEnded == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GiveawayInfoOngoing) String() string { + if g == nil { + return "GiveawayInfoOngoing(nil)" + } + type Alias GiveawayInfoOngoing + return fmt.Sprintf("GiveawayInfoOngoing%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GiveawayInfoOngoing) TypeID() uint32 { + return GiveawayInfoOngoingTypeID +} + +// TypeName returns name of type in TL schema. +func (*GiveawayInfoOngoing) TypeName() string { + return "giveawayInfoOngoing" +} + +// TypeInfo returns info about TL type. +func (g *GiveawayInfoOngoing) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "giveawayInfoOngoing", + ID: GiveawayInfoOngoingTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "CreationDate", + SchemaName: "creation_date", + }, + { + Name: "Status", + SchemaName: "status", + }, + { + Name: "IsEnded", + SchemaName: "is_ended", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GiveawayInfoOngoing) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giveawayInfoOngoing#624ee050 as nil") + } + b.PutID(GiveawayInfoOngoingTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GiveawayInfoOngoing) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giveawayInfoOngoing#624ee050 as nil") + } + b.PutInt32(g.CreationDate) + if g.Status == nil { + return fmt.Errorf("unable to encode giveawayInfoOngoing#624ee050: field status is nil") + } + if err := g.Status.Encode(b); err != nil { + return fmt.Errorf("unable to encode giveawayInfoOngoing#624ee050: field status: %w", err) + } + b.PutBool(g.IsEnded) + return nil +} + +// Decode implements bin.Decoder. +func (g *GiveawayInfoOngoing) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giveawayInfoOngoing#624ee050 to nil") + } + if err := b.ConsumeID(GiveawayInfoOngoingTypeID); err != nil { + return fmt.Errorf("unable to decode giveawayInfoOngoing#624ee050: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GiveawayInfoOngoing) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giveawayInfoOngoing#624ee050 to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoOngoing#624ee050: field creation_date: %w", err) + } + g.CreationDate = value + } + { + value, err := DecodeGiveawayParticipantStatus(b) + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoOngoing#624ee050: field status: %w", err) + } + g.Status = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoOngoing#624ee050: field is_ended: %w", err) + } + g.IsEnded = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GiveawayInfoOngoing) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode giveawayInfoOngoing#624ee050 as nil") + } + b.ObjStart() + b.PutID("giveawayInfoOngoing") + b.Comma() + b.FieldStart("creation_date") + b.PutInt32(g.CreationDate) + b.Comma() + b.FieldStart("status") + if g.Status == nil { + return fmt.Errorf("unable to encode giveawayInfoOngoing#624ee050: field status is nil") + } + if err := g.Status.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode giveawayInfoOngoing#624ee050: field status: %w", err) + } + b.Comma() + b.FieldStart("is_ended") + b.PutBool(g.IsEnded) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GiveawayInfoOngoing) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode giveawayInfoOngoing#624ee050 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("giveawayInfoOngoing"); err != nil { + return fmt.Errorf("unable to decode giveawayInfoOngoing#624ee050: %w", err) + } + case "creation_date": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoOngoing#624ee050: field creation_date: %w", err) + } + g.CreationDate = value + case "status": + value, err := DecodeTDLibJSONGiveawayParticipantStatus(b) + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoOngoing#624ee050: field status: %w", err) + } + g.Status = value + case "is_ended": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoOngoing#624ee050: field is_ended: %w", err) + } + g.IsEnded = value + default: + return b.Skip() + } + return nil + }) +} + +// GetCreationDate returns value of CreationDate field. +func (g *GiveawayInfoOngoing) GetCreationDate() (value int32) { + if g == nil { + return + } + return g.CreationDate +} + +// GetStatus returns value of Status field. +func (g *GiveawayInfoOngoing) GetStatus() (value GiveawayParticipantStatusClass) { + if g == nil { + return + } + return g.Status +} + +// GetIsEnded returns value of IsEnded field. +func (g *GiveawayInfoOngoing) GetIsEnded() (value bool) { + if g == nil { + return + } + return g.IsEnded +} + +// GiveawayInfoCompleted represents TL type `giveawayInfoCompleted#328cc35c`. +type GiveawayInfoCompleted struct { + // Point in time (Unix timestamp) when the giveaway was created + CreationDate int32 + // Point in time (Unix timestamp) when the winners were selected. May be bigger than + // winners selection date specified in parameters of the giveaway + ActualWinnersSelectionDate int32 + // True, if the giveaway was canceled and was fully refunded + WasRefunded bool + // True, if the cuurent user is a winner of the giveaway + IsWinner bool + // Number of winners in the giveaway + WinnerCount int32 + // Number of winners, which activated their gift codes; for Telegram Premium giveaways + // only + ActivationCount int32 + // Telegram Premium gift code that was received by the current user; empty if the user + // isn't a winner in the giveaway or the giveaway isn't a Telegram Premium giveaway + GiftCode string + // The amount of Telegram Stars won by the current user; 0 if the user isn't a winner in + // the giveaway or the giveaway isn't a Telegram Star giveaway + WonStarCount int64 +} + +// GiveawayInfoCompletedTypeID is TL type id of GiveawayInfoCompleted. +const GiveawayInfoCompletedTypeID = 0x328cc35c + +// construct implements constructor of GiveawayInfoClass. +func (g GiveawayInfoCompleted) construct() GiveawayInfoClass { return &g } + +// Ensuring interfaces in compile-time for GiveawayInfoCompleted. +var ( + _ bin.Encoder = &GiveawayInfoCompleted{} + _ bin.Decoder = &GiveawayInfoCompleted{} + _ bin.BareEncoder = &GiveawayInfoCompleted{} + _ bin.BareDecoder = &GiveawayInfoCompleted{} + + _ GiveawayInfoClass = &GiveawayInfoCompleted{} +) + +func (g *GiveawayInfoCompleted) Zero() bool { + if g == nil { + return true + } + if !(g.CreationDate == 0) { + return false + } + if !(g.ActualWinnersSelectionDate == 0) { + return false + } + if !(g.WasRefunded == false) { + return false + } + if !(g.IsWinner == false) { + return false + } + if !(g.WinnerCount == 0) { + return false + } + if !(g.ActivationCount == 0) { + return false + } + if !(g.GiftCode == "") { + return false + } + if !(g.WonStarCount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GiveawayInfoCompleted) String() string { + if g == nil { + return "GiveawayInfoCompleted(nil)" + } + type Alias GiveawayInfoCompleted + return fmt.Sprintf("GiveawayInfoCompleted%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GiveawayInfoCompleted) TypeID() uint32 { + return GiveawayInfoCompletedTypeID +} + +// TypeName returns name of type in TL schema. +func (*GiveawayInfoCompleted) TypeName() string { + return "giveawayInfoCompleted" +} + +// TypeInfo returns info about TL type. +func (g *GiveawayInfoCompleted) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "giveawayInfoCompleted", + ID: GiveawayInfoCompletedTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "CreationDate", + SchemaName: "creation_date", + }, + { + Name: "ActualWinnersSelectionDate", + SchemaName: "actual_winners_selection_date", + }, + { + Name: "WasRefunded", + SchemaName: "was_refunded", + }, + { + Name: "IsWinner", + SchemaName: "is_winner", + }, + { + Name: "WinnerCount", + SchemaName: "winner_count", + }, + { + Name: "ActivationCount", + SchemaName: "activation_count", + }, + { + Name: "GiftCode", + SchemaName: "gift_code", + }, + { + Name: "WonStarCount", + SchemaName: "won_star_count", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GiveawayInfoCompleted) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giveawayInfoCompleted#328cc35c as nil") + } + b.PutID(GiveawayInfoCompletedTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GiveawayInfoCompleted) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giveawayInfoCompleted#328cc35c as nil") + } + b.PutInt32(g.CreationDate) + b.PutInt32(g.ActualWinnersSelectionDate) + b.PutBool(g.WasRefunded) + b.PutBool(g.IsWinner) + b.PutInt32(g.WinnerCount) + b.PutInt32(g.ActivationCount) + b.PutString(g.GiftCode) + b.PutInt53(g.WonStarCount) + return nil +} + +// Decode implements bin.Decoder. +func (g *GiveawayInfoCompleted) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giveawayInfoCompleted#328cc35c to nil") + } + if err := b.ConsumeID(GiveawayInfoCompletedTypeID); err != nil { + return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GiveawayInfoCompleted) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giveawayInfoCompleted#328cc35c to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field creation_date: %w", err) + } + g.CreationDate = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field actual_winners_selection_date: %w", err) + } + g.ActualWinnersSelectionDate = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field was_refunded: %w", err) + } + g.WasRefunded = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field is_winner: %w", err) + } + g.IsWinner = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field winner_count: %w", err) + } + g.WinnerCount = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field activation_count: %w", err) + } + g.ActivationCount = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field gift_code: %w", err) + } + g.GiftCode = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field won_star_count: %w", err) + } + g.WonStarCount = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GiveawayInfoCompleted) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode giveawayInfoCompleted#328cc35c as nil") + } + b.ObjStart() + b.PutID("giveawayInfoCompleted") + b.Comma() + b.FieldStart("creation_date") + b.PutInt32(g.CreationDate) + b.Comma() + b.FieldStart("actual_winners_selection_date") + b.PutInt32(g.ActualWinnersSelectionDate) + b.Comma() + b.FieldStart("was_refunded") + b.PutBool(g.WasRefunded) + b.Comma() + b.FieldStart("is_winner") + b.PutBool(g.IsWinner) + b.Comma() + b.FieldStart("winner_count") + b.PutInt32(g.WinnerCount) + b.Comma() + b.FieldStart("activation_count") + b.PutInt32(g.ActivationCount) + b.Comma() + b.FieldStart("gift_code") + b.PutString(g.GiftCode) + b.Comma() + b.FieldStart("won_star_count") + b.PutInt53(g.WonStarCount) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GiveawayInfoCompleted) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode giveawayInfoCompleted#328cc35c to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("giveawayInfoCompleted"); err != nil { + return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: %w", err) + } + case "creation_date": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field creation_date: %w", err) + } + g.CreationDate = value + case "actual_winners_selection_date": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field actual_winners_selection_date: %w", err) + } + g.ActualWinnersSelectionDate = value + case "was_refunded": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field was_refunded: %w", err) + } + g.WasRefunded = value + case "is_winner": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field is_winner: %w", err) + } + g.IsWinner = value + case "winner_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field winner_count: %w", err) + } + g.WinnerCount = value + case "activation_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field activation_count: %w", err) + } + g.ActivationCount = value + case "gift_code": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field gift_code: %w", err) + } + g.GiftCode = value + case "won_star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field won_star_count: %w", err) + } + g.WonStarCount = value + default: + return b.Skip() + } + return nil + }) +} + +// GetCreationDate returns value of CreationDate field. +func (g *GiveawayInfoCompleted) GetCreationDate() (value int32) { + if g == nil { + return + } + return g.CreationDate +} + +// GetActualWinnersSelectionDate returns value of ActualWinnersSelectionDate field. +func (g *GiveawayInfoCompleted) GetActualWinnersSelectionDate() (value int32) { + if g == nil { + return + } + return g.ActualWinnersSelectionDate +} + +// GetWasRefunded returns value of WasRefunded field. +func (g *GiveawayInfoCompleted) GetWasRefunded() (value bool) { + if g == nil { + return + } + return g.WasRefunded +} + +// GetIsWinner returns value of IsWinner field. +func (g *GiveawayInfoCompleted) GetIsWinner() (value bool) { + if g == nil { + return + } + return g.IsWinner +} + +// GetWinnerCount returns value of WinnerCount field. +func (g *GiveawayInfoCompleted) GetWinnerCount() (value int32) { + if g == nil { + return + } + return g.WinnerCount +} + +// GetActivationCount returns value of ActivationCount field. +func (g *GiveawayInfoCompleted) GetActivationCount() (value int32) { + if g == nil { + return + } + return g.ActivationCount +} + +// GetGiftCode returns value of GiftCode field. +func (g *GiveawayInfoCompleted) GetGiftCode() (value string) { + if g == nil { + return + } + return g.GiftCode +} + +// GetWonStarCount returns value of WonStarCount field. +func (g *GiveawayInfoCompleted) GetWonStarCount() (value int64) { + if g == nil { + return + } + return g.WonStarCount +} + +// GiveawayInfoClassName is schema name of GiveawayInfoClass. +const GiveawayInfoClassName = "GiveawayInfo" + +// GiveawayInfoClass represents GiveawayInfo generic type. +// +// Example: +// +// g, err := tdapi.DecodeGiveawayInfo(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tdapi.GiveawayInfoOngoing: // giveawayInfoOngoing#624ee050 +// case *tdapi.GiveawayInfoCompleted: // giveawayInfoCompleted#328cc35c +// default: panic(v) +// } +type GiveawayInfoClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() GiveawayInfoClass + + // 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 + + // Point in time (Unix timestamp) when the giveaway was created + GetCreationDate() (value int32) +} + +// DecodeGiveawayInfo implements binary de-serialization for GiveawayInfoClass. +func DecodeGiveawayInfo(buf *bin.Buffer) (GiveawayInfoClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case GiveawayInfoOngoingTypeID: + // Decoding giveawayInfoOngoing#624ee050. + v := GiveawayInfoOngoing{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode GiveawayInfoClass: %w", err) + } + return &v, nil + case GiveawayInfoCompletedTypeID: + // Decoding giveawayInfoCompleted#328cc35c. + v := GiveawayInfoCompleted{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode GiveawayInfoClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode GiveawayInfoClass: %w", bin.NewUnexpectedID(id)) + } +} + +// DecodeTDLibJSONGiveawayInfo implements binary de-serialization for GiveawayInfoClass. +func DecodeTDLibJSONGiveawayInfo(buf tdjson.Decoder) (GiveawayInfoClass, error) { + id, err := buf.FindTypeID() + if err != nil { + return nil, err + } + switch id { + case "giveawayInfoOngoing": + // Decoding giveawayInfoOngoing#624ee050. + v := GiveawayInfoOngoing{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode GiveawayInfoClass: %w", err) + } + return &v, nil + case "giveawayInfoCompleted": + // Decoding giveawayInfoCompleted#328cc35c. + v := GiveawayInfoCompleted{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode GiveawayInfoClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode GiveawayInfoClass: %w", tdjson.NewUnexpectedID(id)) + } +} + +// GiveawayInfo boxes the GiveawayInfoClass providing a helper. +type GiveawayInfoBox struct { + GiveawayInfo GiveawayInfoClass +} + +// Decode implements bin.Decoder for GiveawayInfoBox. +func (b *GiveawayInfoBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode GiveawayInfoBox to nil") + } + v, err := DecodeGiveawayInfo(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.GiveawayInfo = v + return nil +} + +// Encode implements bin.Encode for GiveawayInfoBox. +func (b *GiveawayInfoBox) Encode(buf *bin.Buffer) error { + if b == nil || b.GiveawayInfo == nil { + return fmt.Errorf("unable to encode GiveawayInfoClass as nil") + } + return b.GiveawayInfo.Encode(buf) +} + +// DecodeTDLibJSON implements bin.Decoder for GiveawayInfoBox. +func (b *GiveawayInfoBox) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("unable to decode GiveawayInfoBox to nil") + } + v, err := DecodeTDLibJSONGiveawayInfo(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.GiveawayInfo = v + return nil +} + +// EncodeTDLibJSON implements bin.Encode for GiveawayInfoBox. +func (b *GiveawayInfoBox) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil || b.GiveawayInfo == nil { + return fmt.Errorf("unable to encode GiveawayInfoClass as nil") + } + return b.GiveawayInfo.EncodeTDLibJSON(buf) +} diff --git a/tdapi/tl_giveaway_parameters_gen.go b/tdapi/tl_giveaway_parameters_gen.go new file mode 100644 index 0000000000..dbe0462edb --- /dev/null +++ b/tdapi/tl_giveaway_parameters_gen.go @@ -0,0 +1,450 @@ +// 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{} +) + +// GiveawayParameters represents TL type `giveawayParameters#16f1de3d`. +type GiveawayParameters struct { + // Identifier of the supergroup or channel chat, which will be automatically boosted by + // the winners of the giveaway for duration of the Telegram Premium subscription, + BoostedChatID int64 + // Identifiers of other supergroup or channel chats that must be subscribed by the users + // to be eligible for the giveaway. There can be up to + // getOption("giveaway_additional_chat_count_max") additional chats + AdditionalChatIDs []int64 + // Point in time (Unix timestamp) when the giveaway is expected to be performed; must be + // 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways + WinnersSelectionDate int32 + // True, if only new members of the chats will be eligible for the giveaway + OnlyNewMembers bool + // True, if the list of winners of the giveaway will be available to everyone + HasPublicWinners bool + // The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be + // eligible for the giveaway. If empty, then all users can participate in the giveaway. + CountryCodes []string + // Additional description of the giveaway prize; 0-128 characters + PrizeDescription string +} + +// GiveawayParametersTypeID is TL type id of GiveawayParameters. +const GiveawayParametersTypeID = 0x16f1de3d + +// Ensuring interfaces in compile-time for GiveawayParameters. +var ( + _ bin.Encoder = &GiveawayParameters{} + _ bin.Decoder = &GiveawayParameters{} + _ bin.BareEncoder = &GiveawayParameters{} + _ bin.BareDecoder = &GiveawayParameters{} +) + +func (g *GiveawayParameters) Zero() bool { + if g == nil { + return true + } + if !(g.BoostedChatID == 0) { + return false + } + if !(g.AdditionalChatIDs == nil) { + return false + } + if !(g.WinnersSelectionDate == 0) { + return false + } + if !(g.OnlyNewMembers == false) { + return false + } + if !(g.HasPublicWinners == false) { + return false + } + if !(g.CountryCodes == nil) { + return false + } + if !(g.PrizeDescription == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GiveawayParameters) String() string { + if g == nil { + return "GiveawayParameters(nil)" + } + type Alias GiveawayParameters + return fmt.Sprintf("GiveawayParameters%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GiveawayParameters) TypeID() uint32 { + return GiveawayParametersTypeID +} + +// TypeName returns name of type in TL schema. +func (*GiveawayParameters) TypeName() string { + return "giveawayParameters" +} + +// TypeInfo returns info about TL type. +func (g *GiveawayParameters) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "giveawayParameters", + ID: GiveawayParametersTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "BoostedChatID", + SchemaName: "boosted_chat_id", + }, + { + Name: "AdditionalChatIDs", + SchemaName: "additional_chat_ids", + }, + { + Name: "WinnersSelectionDate", + SchemaName: "winners_selection_date", + }, + { + Name: "OnlyNewMembers", + SchemaName: "only_new_members", + }, + { + Name: "HasPublicWinners", + SchemaName: "has_public_winners", + }, + { + Name: "CountryCodes", + SchemaName: "country_codes", + }, + { + Name: "PrizeDescription", + SchemaName: "prize_description", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GiveawayParameters) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giveawayParameters#16f1de3d as nil") + } + b.PutID(GiveawayParametersTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GiveawayParameters) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giveawayParameters#16f1de3d as nil") + } + b.PutInt53(g.BoostedChatID) + b.PutInt(len(g.AdditionalChatIDs)) + for _, v := range g.AdditionalChatIDs { + b.PutInt53(v) + } + b.PutInt32(g.WinnersSelectionDate) + b.PutBool(g.OnlyNewMembers) + b.PutBool(g.HasPublicWinners) + b.PutInt(len(g.CountryCodes)) + for _, v := range g.CountryCodes { + b.PutString(v) + } + b.PutString(g.PrizeDescription) + return nil +} + +// Decode implements bin.Decoder. +func (g *GiveawayParameters) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giveawayParameters#16f1de3d to nil") + } + if err := b.ConsumeID(GiveawayParametersTypeID); err != nil { + return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GiveawayParameters) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giveawayParameters#16f1de3d to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field boosted_chat_id: %w", err) + } + g.BoostedChatID = value + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field additional_chat_ids: %w", err) + } + + if headerLen > 0 { + g.AdditionalChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field additional_chat_ids: %w", err) + } + g.AdditionalChatIDs = append(g.AdditionalChatIDs, value) + } + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field winners_selection_date: %w", err) + } + g.WinnersSelectionDate = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field only_new_members: %w", err) + } + g.OnlyNewMembers = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field has_public_winners: %w", err) + } + g.HasPublicWinners = value + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field country_codes: %w", err) + } + + if headerLen > 0 { + g.CountryCodes = make([]string, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field country_codes: %w", err) + } + g.CountryCodes = append(g.CountryCodes, value) + } + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field prize_description: %w", err) + } + g.PrizeDescription = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GiveawayParameters) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode giveawayParameters#16f1de3d as nil") + } + b.ObjStart() + b.PutID("giveawayParameters") + b.Comma() + b.FieldStart("boosted_chat_id") + b.PutInt53(g.BoostedChatID) + b.Comma() + b.FieldStart("additional_chat_ids") + b.ArrStart() + for _, v := range g.AdditionalChatIDs { + b.PutInt53(v) + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.FieldStart("winners_selection_date") + b.PutInt32(g.WinnersSelectionDate) + b.Comma() + b.FieldStart("only_new_members") + b.PutBool(g.OnlyNewMembers) + b.Comma() + b.FieldStart("has_public_winners") + b.PutBool(g.HasPublicWinners) + b.Comma() + b.FieldStart("country_codes") + b.ArrStart() + for _, v := range g.CountryCodes { + b.PutString(v) + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.FieldStart("prize_description") + b.PutString(g.PrizeDescription) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GiveawayParameters) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode giveawayParameters#16f1de3d to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("giveawayParameters"); err != nil { + return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: %w", err) + } + case "boosted_chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field boosted_chat_id: %w", err) + } + g.BoostedChatID = value + case "additional_chat_ids": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field additional_chat_ids: %w", err) + } + g.AdditionalChatIDs = append(g.AdditionalChatIDs, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field additional_chat_ids: %w", err) + } + case "winners_selection_date": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field winners_selection_date: %w", err) + } + g.WinnersSelectionDate = value + case "only_new_members": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field only_new_members: %w", err) + } + g.OnlyNewMembers = value + case "has_public_winners": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field has_public_winners: %w", err) + } + g.HasPublicWinners = value + case "country_codes": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field country_codes: %w", err) + } + g.CountryCodes = append(g.CountryCodes, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field country_codes: %w", err) + } + case "prize_description": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field prize_description: %w", err) + } + g.PrizeDescription = value + default: + return b.Skip() + } + return nil + }) +} + +// GetBoostedChatID returns value of BoostedChatID field. +func (g *GiveawayParameters) GetBoostedChatID() (value int64) { + if g == nil { + return + } + return g.BoostedChatID +} + +// GetAdditionalChatIDs returns value of AdditionalChatIDs field. +func (g *GiveawayParameters) GetAdditionalChatIDs() (value []int64) { + if g == nil { + return + } + return g.AdditionalChatIDs +} + +// GetWinnersSelectionDate returns value of WinnersSelectionDate field. +func (g *GiveawayParameters) GetWinnersSelectionDate() (value int32) { + if g == nil { + return + } + return g.WinnersSelectionDate +} + +// GetOnlyNewMembers returns value of OnlyNewMembers field. +func (g *GiveawayParameters) GetOnlyNewMembers() (value bool) { + if g == nil { + return + } + return g.OnlyNewMembers +} + +// GetHasPublicWinners returns value of HasPublicWinners field. +func (g *GiveawayParameters) GetHasPublicWinners() (value bool) { + if g == nil { + return + } + return g.HasPublicWinners +} + +// GetCountryCodes returns value of CountryCodes field. +func (g *GiveawayParameters) GetCountryCodes() (value []string) { + if g == nil { + return + } + return g.CountryCodes +} + +// GetPrizeDescription returns value of PrizeDescription field. +func (g *GiveawayParameters) GetPrizeDescription() (value string) { + if g == nil { + return + } + return g.PrizeDescription +} diff --git a/tdapi/tl_giveaway_participant_status_gen.go b/tdapi/tl_giveaway_participant_status_gen.go new file mode 100644 index 0000000000..ca6eefdf25 --- /dev/null +++ b/tdapi/tl_giveaway_participant_status_gen.go @@ -0,0 +1,978 @@ +// 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{} +) + +// GiveawayParticipantStatusEligible represents TL type `giveawayParticipantStatusEligible#122ade97`. +type GiveawayParticipantStatusEligible struct { +} + +// GiveawayParticipantStatusEligibleTypeID is TL type id of GiveawayParticipantStatusEligible. +const GiveawayParticipantStatusEligibleTypeID = 0x122ade97 + +// construct implements constructor of GiveawayParticipantStatusClass. +func (g GiveawayParticipantStatusEligible) construct() GiveawayParticipantStatusClass { return &g } + +// Ensuring interfaces in compile-time for GiveawayParticipantStatusEligible. +var ( + _ bin.Encoder = &GiveawayParticipantStatusEligible{} + _ bin.Decoder = &GiveawayParticipantStatusEligible{} + _ bin.BareEncoder = &GiveawayParticipantStatusEligible{} + _ bin.BareDecoder = &GiveawayParticipantStatusEligible{} + + _ GiveawayParticipantStatusClass = &GiveawayParticipantStatusEligible{} +) + +func (g *GiveawayParticipantStatusEligible) Zero() bool { + if g == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (g *GiveawayParticipantStatusEligible) String() string { + if g == nil { + return "GiveawayParticipantStatusEligible(nil)" + } + type Alias GiveawayParticipantStatusEligible + return fmt.Sprintf("GiveawayParticipantStatusEligible%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GiveawayParticipantStatusEligible) TypeID() uint32 { + return GiveawayParticipantStatusEligibleTypeID +} + +// TypeName returns name of type in TL schema. +func (*GiveawayParticipantStatusEligible) TypeName() string { + return "giveawayParticipantStatusEligible" +} + +// TypeInfo returns info about TL type. +func (g *GiveawayParticipantStatusEligible) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "giveawayParticipantStatusEligible", + ID: GiveawayParticipantStatusEligibleTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (g *GiveawayParticipantStatusEligible) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giveawayParticipantStatusEligible#122ade97 as nil") + } + b.PutID(GiveawayParticipantStatusEligibleTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GiveawayParticipantStatusEligible) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giveawayParticipantStatusEligible#122ade97 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (g *GiveawayParticipantStatusEligible) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giveawayParticipantStatusEligible#122ade97 to nil") + } + if err := b.ConsumeID(GiveawayParticipantStatusEligibleTypeID); err != nil { + return fmt.Errorf("unable to decode giveawayParticipantStatusEligible#122ade97: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GiveawayParticipantStatusEligible) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giveawayParticipantStatusEligible#122ade97 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GiveawayParticipantStatusEligible) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode giveawayParticipantStatusEligible#122ade97 as nil") + } + b.ObjStart() + b.PutID("giveawayParticipantStatusEligible") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GiveawayParticipantStatusEligible) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode giveawayParticipantStatusEligible#122ade97 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("giveawayParticipantStatusEligible"); err != nil { + return fmt.Errorf("unable to decode giveawayParticipantStatusEligible#122ade97: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GiveawayParticipantStatusParticipating represents TL type `giveawayParticipantStatusParticipating#1d53e36f`. +type GiveawayParticipantStatusParticipating struct { +} + +// GiveawayParticipantStatusParticipatingTypeID is TL type id of GiveawayParticipantStatusParticipating. +const GiveawayParticipantStatusParticipatingTypeID = 0x1d53e36f + +// construct implements constructor of GiveawayParticipantStatusClass. +func (g GiveawayParticipantStatusParticipating) construct() GiveawayParticipantStatusClass { return &g } + +// Ensuring interfaces in compile-time for GiveawayParticipantStatusParticipating. +var ( + _ bin.Encoder = &GiveawayParticipantStatusParticipating{} + _ bin.Decoder = &GiveawayParticipantStatusParticipating{} + _ bin.BareEncoder = &GiveawayParticipantStatusParticipating{} + _ bin.BareDecoder = &GiveawayParticipantStatusParticipating{} + + _ GiveawayParticipantStatusClass = &GiveawayParticipantStatusParticipating{} +) + +func (g *GiveawayParticipantStatusParticipating) Zero() bool { + if g == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (g *GiveawayParticipantStatusParticipating) String() string { + if g == nil { + return "GiveawayParticipantStatusParticipating(nil)" + } + type Alias GiveawayParticipantStatusParticipating + return fmt.Sprintf("GiveawayParticipantStatusParticipating%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GiveawayParticipantStatusParticipating) TypeID() uint32 { + return GiveawayParticipantStatusParticipatingTypeID +} + +// TypeName returns name of type in TL schema. +func (*GiveawayParticipantStatusParticipating) TypeName() string { + return "giveawayParticipantStatusParticipating" +} + +// TypeInfo returns info about TL type. +func (g *GiveawayParticipantStatusParticipating) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "giveawayParticipantStatusParticipating", + ID: GiveawayParticipantStatusParticipatingTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (g *GiveawayParticipantStatusParticipating) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giveawayParticipantStatusParticipating#1d53e36f as nil") + } + b.PutID(GiveawayParticipantStatusParticipatingTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GiveawayParticipantStatusParticipating) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giveawayParticipantStatusParticipating#1d53e36f as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (g *GiveawayParticipantStatusParticipating) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giveawayParticipantStatusParticipating#1d53e36f to nil") + } + if err := b.ConsumeID(GiveawayParticipantStatusParticipatingTypeID); err != nil { + return fmt.Errorf("unable to decode giveawayParticipantStatusParticipating#1d53e36f: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GiveawayParticipantStatusParticipating) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giveawayParticipantStatusParticipating#1d53e36f to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GiveawayParticipantStatusParticipating) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode giveawayParticipantStatusParticipating#1d53e36f as nil") + } + b.ObjStart() + b.PutID("giveawayParticipantStatusParticipating") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GiveawayParticipantStatusParticipating) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode giveawayParticipantStatusParticipating#1d53e36f to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("giveawayParticipantStatusParticipating"); err != nil { + return fmt.Errorf("unable to decode giveawayParticipantStatusParticipating#1d53e36f: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GiveawayParticipantStatusAlreadyWasMember represents TL type `giveawayParticipantStatusAlreadyWasMember#11f9b5a0`. +type GiveawayParticipantStatusAlreadyWasMember struct { + // Point in time (Unix timestamp) when the user joined the chat + JoinedChatDate int32 +} + +// GiveawayParticipantStatusAlreadyWasMemberTypeID is TL type id of GiveawayParticipantStatusAlreadyWasMember. +const GiveawayParticipantStatusAlreadyWasMemberTypeID = 0x11f9b5a0 + +// construct implements constructor of GiveawayParticipantStatusClass. +func (g GiveawayParticipantStatusAlreadyWasMember) construct() GiveawayParticipantStatusClass { + return &g +} + +// Ensuring interfaces in compile-time for GiveawayParticipantStatusAlreadyWasMember. +var ( + _ bin.Encoder = &GiveawayParticipantStatusAlreadyWasMember{} + _ bin.Decoder = &GiveawayParticipantStatusAlreadyWasMember{} + _ bin.BareEncoder = &GiveawayParticipantStatusAlreadyWasMember{} + _ bin.BareDecoder = &GiveawayParticipantStatusAlreadyWasMember{} + + _ GiveawayParticipantStatusClass = &GiveawayParticipantStatusAlreadyWasMember{} +) + +func (g *GiveawayParticipantStatusAlreadyWasMember) Zero() bool { + if g == nil { + return true + } + if !(g.JoinedChatDate == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GiveawayParticipantStatusAlreadyWasMember) String() string { + if g == nil { + return "GiveawayParticipantStatusAlreadyWasMember(nil)" + } + type Alias GiveawayParticipantStatusAlreadyWasMember + return fmt.Sprintf("GiveawayParticipantStatusAlreadyWasMember%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GiveawayParticipantStatusAlreadyWasMember) TypeID() uint32 { + return GiveawayParticipantStatusAlreadyWasMemberTypeID +} + +// TypeName returns name of type in TL schema. +func (*GiveawayParticipantStatusAlreadyWasMember) TypeName() string { + return "giveawayParticipantStatusAlreadyWasMember" +} + +// TypeInfo returns info about TL type. +func (g *GiveawayParticipantStatusAlreadyWasMember) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "giveawayParticipantStatusAlreadyWasMember", + ID: GiveawayParticipantStatusAlreadyWasMemberTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "JoinedChatDate", + SchemaName: "joined_chat_date", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GiveawayParticipantStatusAlreadyWasMember) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giveawayParticipantStatusAlreadyWasMember#11f9b5a0 as nil") + } + b.PutID(GiveawayParticipantStatusAlreadyWasMemberTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GiveawayParticipantStatusAlreadyWasMember) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giveawayParticipantStatusAlreadyWasMember#11f9b5a0 as nil") + } + b.PutInt32(g.JoinedChatDate) + return nil +} + +// Decode implements bin.Decoder. +func (g *GiveawayParticipantStatusAlreadyWasMember) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0 to nil") + } + if err := b.ConsumeID(GiveawayParticipantStatusAlreadyWasMemberTypeID); err != nil { + return fmt.Errorf("unable to decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GiveawayParticipantStatusAlreadyWasMember) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0 to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0: field joined_chat_date: %w", err) + } + g.JoinedChatDate = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GiveawayParticipantStatusAlreadyWasMember) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode giveawayParticipantStatusAlreadyWasMember#11f9b5a0 as nil") + } + b.ObjStart() + b.PutID("giveawayParticipantStatusAlreadyWasMember") + b.Comma() + b.FieldStart("joined_chat_date") + b.PutInt32(g.JoinedChatDate) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GiveawayParticipantStatusAlreadyWasMember) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("giveawayParticipantStatusAlreadyWasMember"); err != nil { + return fmt.Errorf("unable to decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0: %w", err) + } + case "joined_chat_date": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0: field joined_chat_date: %w", err) + } + g.JoinedChatDate = value + default: + return b.Skip() + } + return nil + }) +} + +// GetJoinedChatDate returns value of JoinedChatDate field. +func (g *GiveawayParticipantStatusAlreadyWasMember) GetJoinedChatDate() (value int32) { + if g == nil { + return + } + return g.JoinedChatDate +} + +// GiveawayParticipantStatusAdministrator represents TL type `giveawayParticipantStatusAdministrator#c84b3a75`. +type GiveawayParticipantStatusAdministrator struct { + // Identifier of the chat administered by the user + ChatID int64 +} + +// GiveawayParticipantStatusAdministratorTypeID is TL type id of GiveawayParticipantStatusAdministrator. +const GiveawayParticipantStatusAdministratorTypeID = 0xc84b3a75 + +// construct implements constructor of GiveawayParticipantStatusClass. +func (g GiveawayParticipantStatusAdministrator) construct() GiveawayParticipantStatusClass { return &g } + +// Ensuring interfaces in compile-time for GiveawayParticipantStatusAdministrator. +var ( + _ bin.Encoder = &GiveawayParticipantStatusAdministrator{} + _ bin.Decoder = &GiveawayParticipantStatusAdministrator{} + _ bin.BareEncoder = &GiveawayParticipantStatusAdministrator{} + _ bin.BareDecoder = &GiveawayParticipantStatusAdministrator{} + + _ GiveawayParticipantStatusClass = &GiveawayParticipantStatusAdministrator{} +) + +func (g *GiveawayParticipantStatusAdministrator) Zero() bool { + if g == nil { + return true + } + if !(g.ChatID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GiveawayParticipantStatusAdministrator) String() string { + if g == nil { + return "GiveawayParticipantStatusAdministrator(nil)" + } + type Alias GiveawayParticipantStatusAdministrator + return fmt.Sprintf("GiveawayParticipantStatusAdministrator%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GiveawayParticipantStatusAdministrator) TypeID() uint32 { + return GiveawayParticipantStatusAdministratorTypeID +} + +// TypeName returns name of type in TL schema. +func (*GiveawayParticipantStatusAdministrator) TypeName() string { + return "giveawayParticipantStatusAdministrator" +} + +// TypeInfo returns info about TL type. +func (g *GiveawayParticipantStatusAdministrator) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "giveawayParticipantStatusAdministrator", + ID: GiveawayParticipantStatusAdministratorTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GiveawayParticipantStatusAdministrator) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giveawayParticipantStatusAdministrator#c84b3a75 as nil") + } + b.PutID(GiveawayParticipantStatusAdministratorTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GiveawayParticipantStatusAdministrator) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giveawayParticipantStatusAdministrator#c84b3a75 as nil") + } + b.PutInt53(g.ChatID) + return nil +} + +// Decode implements bin.Decoder. +func (g *GiveawayParticipantStatusAdministrator) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giveawayParticipantStatusAdministrator#c84b3a75 to nil") + } + if err := b.ConsumeID(GiveawayParticipantStatusAdministratorTypeID); err != nil { + return fmt.Errorf("unable to decode giveawayParticipantStatusAdministrator#c84b3a75: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GiveawayParticipantStatusAdministrator) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giveawayParticipantStatusAdministrator#c84b3a75 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode giveawayParticipantStatusAdministrator#c84b3a75: field chat_id: %w", err) + } + g.ChatID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GiveawayParticipantStatusAdministrator) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode giveawayParticipantStatusAdministrator#c84b3a75 as nil") + } + b.ObjStart() + b.PutID("giveawayParticipantStatusAdministrator") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(g.ChatID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GiveawayParticipantStatusAdministrator) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode giveawayParticipantStatusAdministrator#c84b3a75 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("giveawayParticipantStatusAdministrator"); err != nil { + return fmt.Errorf("unable to decode giveawayParticipantStatusAdministrator#c84b3a75: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode giveawayParticipantStatusAdministrator#c84b3a75: field chat_id: %w", err) + } + g.ChatID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (g *GiveawayParticipantStatusAdministrator) GetChatID() (value int64) { + if g == nil { + return + } + return g.ChatID +} + +// GiveawayParticipantStatusDisallowedCountry represents TL type `giveawayParticipantStatusDisallowedCountry#700b645b`. +type GiveawayParticipantStatusDisallowedCountry struct { + // A two-letter ISO 3166-1 alpha-2 country code of the user's country + UserCountryCode string +} + +// GiveawayParticipantStatusDisallowedCountryTypeID is TL type id of GiveawayParticipantStatusDisallowedCountry. +const GiveawayParticipantStatusDisallowedCountryTypeID = 0x700b645b + +// construct implements constructor of GiveawayParticipantStatusClass. +func (g GiveawayParticipantStatusDisallowedCountry) construct() GiveawayParticipantStatusClass { + return &g +} + +// Ensuring interfaces in compile-time for GiveawayParticipantStatusDisallowedCountry. +var ( + _ bin.Encoder = &GiveawayParticipantStatusDisallowedCountry{} + _ bin.Decoder = &GiveawayParticipantStatusDisallowedCountry{} + _ bin.BareEncoder = &GiveawayParticipantStatusDisallowedCountry{} + _ bin.BareDecoder = &GiveawayParticipantStatusDisallowedCountry{} + + _ GiveawayParticipantStatusClass = &GiveawayParticipantStatusDisallowedCountry{} +) + +func (g *GiveawayParticipantStatusDisallowedCountry) Zero() bool { + if g == nil { + return true + } + if !(g.UserCountryCode == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GiveawayParticipantStatusDisallowedCountry) String() string { + if g == nil { + return "GiveawayParticipantStatusDisallowedCountry(nil)" + } + type Alias GiveawayParticipantStatusDisallowedCountry + return fmt.Sprintf("GiveawayParticipantStatusDisallowedCountry%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GiveawayParticipantStatusDisallowedCountry) TypeID() uint32 { + return GiveawayParticipantStatusDisallowedCountryTypeID +} + +// TypeName returns name of type in TL schema. +func (*GiveawayParticipantStatusDisallowedCountry) TypeName() string { + return "giveawayParticipantStatusDisallowedCountry" +} + +// TypeInfo returns info about TL type. +func (g *GiveawayParticipantStatusDisallowedCountry) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "giveawayParticipantStatusDisallowedCountry", + ID: GiveawayParticipantStatusDisallowedCountryTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "UserCountryCode", + SchemaName: "user_country_code", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GiveawayParticipantStatusDisallowedCountry) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giveawayParticipantStatusDisallowedCountry#700b645b as nil") + } + b.PutID(GiveawayParticipantStatusDisallowedCountryTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GiveawayParticipantStatusDisallowedCountry) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giveawayParticipantStatusDisallowedCountry#700b645b as nil") + } + b.PutString(g.UserCountryCode) + return nil +} + +// Decode implements bin.Decoder. +func (g *GiveawayParticipantStatusDisallowedCountry) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giveawayParticipantStatusDisallowedCountry#700b645b to nil") + } + if err := b.ConsumeID(GiveawayParticipantStatusDisallowedCountryTypeID); err != nil { + return fmt.Errorf("unable to decode giveawayParticipantStatusDisallowedCountry#700b645b: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GiveawayParticipantStatusDisallowedCountry) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giveawayParticipantStatusDisallowedCountry#700b645b to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode giveawayParticipantStatusDisallowedCountry#700b645b: field user_country_code: %w", err) + } + g.UserCountryCode = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GiveawayParticipantStatusDisallowedCountry) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode giveawayParticipantStatusDisallowedCountry#700b645b as nil") + } + b.ObjStart() + b.PutID("giveawayParticipantStatusDisallowedCountry") + b.Comma() + b.FieldStart("user_country_code") + b.PutString(g.UserCountryCode) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GiveawayParticipantStatusDisallowedCountry) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode giveawayParticipantStatusDisallowedCountry#700b645b to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("giveawayParticipantStatusDisallowedCountry"); err != nil { + return fmt.Errorf("unable to decode giveawayParticipantStatusDisallowedCountry#700b645b: %w", err) + } + case "user_country_code": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode giveawayParticipantStatusDisallowedCountry#700b645b: field user_country_code: %w", err) + } + g.UserCountryCode = value + default: + return b.Skip() + } + return nil + }) +} + +// GetUserCountryCode returns value of UserCountryCode field. +func (g *GiveawayParticipantStatusDisallowedCountry) GetUserCountryCode() (value string) { + if g == nil { + return + } + return g.UserCountryCode +} + +// GiveawayParticipantStatusClassName is schema name of GiveawayParticipantStatusClass. +const GiveawayParticipantStatusClassName = "GiveawayParticipantStatus" + +// GiveawayParticipantStatusClass represents GiveawayParticipantStatus generic type. +// +// Example: +// +// g, err := tdapi.DecodeGiveawayParticipantStatus(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tdapi.GiveawayParticipantStatusEligible: // giveawayParticipantStatusEligible#122ade97 +// case *tdapi.GiveawayParticipantStatusParticipating: // giveawayParticipantStatusParticipating#1d53e36f +// case *tdapi.GiveawayParticipantStatusAlreadyWasMember: // giveawayParticipantStatusAlreadyWasMember#11f9b5a0 +// case *tdapi.GiveawayParticipantStatusAdministrator: // giveawayParticipantStatusAdministrator#c84b3a75 +// case *tdapi.GiveawayParticipantStatusDisallowedCountry: // giveawayParticipantStatusDisallowedCountry#700b645b +// default: panic(v) +// } +type GiveawayParticipantStatusClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() GiveawayParticipantStatusClass + + // 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 +} + +// DecodeGiveawayParticipantStatus implements binary de-serialization for GiveawayParticipantStatusClass. +func DecodeGiveawayParticipantStatus(buf *bin.Buffer) (GiveawayParticipantStatusClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case GiveawayParticipantStatusEligibleTypeID: + // Decoding giveawayParticipantStatusEligible#122ade97. + v := GiveawayParticipantStatusEligible{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err) + } + return &v, nil + case GiveawayParticipantStatusParticipatingTypeID: + // Decoding giveawayParticipantStatusParticipating#1d53e36f. + v := GiveawayParticipantStatusParticipating{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err) + } + return &v, nil + case GiveawayParticipantStatusAlreadyWasMemberTypeID: + // Decoding giveawayParticipantStatusAlreadyWasMember#11f9b5a0. + v := GiveawayParticipantStatusAlreadyWasMember{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err) + } + return &v, nil + case GiveawayParticipantStatusAdministratorTypeID: + // Decoding giveawayParticipantStatusAdministrator#c84b3a75. + v := GiveawayParticipantStatusAdministrator{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err) + } + return &v, nil + case GiveawayParticipantStatusDisallowedCountryTypeID: + // Decoding giveawayParticipantStatusDisallowedCountry#700b645b. + v := GiveawayParticipantStatusDisallowedCountry{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", bin.NewUnexpectedID(id)) + } +} + +// DecodeTDLibJSONGiveawayParticipantStatus implements binary de-serialization for GiveawayParticipantStatusClass. +func DecodeTDLibJSONGiveawayParticipantStatus(buf tdjson.Decoder) (GiveawayParticipantStatusClass, error) { + id, err := buf.FindTypeID() + if err != nil { + return nil, err + } + switch id { + case "giveawayParticipantStatusEligible": + // Decoding giveawayParticipantStatusEligible#122ade97. + v := GiveawayParticipantStatusEligible{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err) + } + return &v, nil + case "giveawayParticipantStatusParticipating": + // Decoding giveawayParticipantStatusParticipating#1d53e36f. + v := GiveawayParticipantStatusParticipating{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err) + } + return &v, nil + case "giveawayParticipantStatusAlreadyWasMember": + // Decoding giveawayParticipantStatusAlreadyWasMember#11f9b5a0. + v := GiveawayParticipantStatusAlreadyWasMember{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err) + } + return &v, nil + case "giveawayParticipantStatusAdministrator": + // Decoding giveawayParticipantStatusAdministrator#c84b3a75. + v := GiveawayParticipantStatusAdministrator{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err) + } + return &v, nil + case "giveawayParticipantStatusDisallowedCountry": + // Decoding giveawayParticipantStatusDisallowedCountry#700b645b. + v := GiveawayParticipantStatusDisallowedCountry{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", tdjson.NewUnexpectedID(id)) + } +} + +// GiveawayParticipantStatus boxes the GiveawayParticipantStatusClass providing a helper. +type GiveawayParticipantStatusBox struct { + GiveawayParticipantStatus GiveawayParticipantStatusClass +} + +// Decode implements bin.Decoder for GiveawayParticipantStatusBox. +func (b *GiveawayParticipantStatusBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode GiveawayParticipantStatusBox to nil") + } + v, err := DecodeGiveawayParticipantStatus(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.GiveawayParticipantStatus = v + return nil +} + +// Encode implements bin.Encode for GiveawayParticipantStatusBox. +func (b *GiveawayParticipantStatusBox) Encode(buf *bin.Buffer) error { + if b == nil || b.GiveawayParticipantStatus == nil { + return fmt.Errorf("unable to encode GiveawayParticipantStatusClass as nil") + } + return b.GiveawayParticipantStatus.Encode(buf) +} + +// DecodeTDLibJSON implements bin.Decoder for GiveawayParticipantStatusBox. +func (b *GiveawayParticipantStatusBox) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("unable to decode GiveawayParticipantStatusBox to nil") + } + v, err := DecodeTDLibJSONGiveawayParticipantStatus(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.GiveawayParticipantStatus = v + return nil +} + +// EncodeTDLibJSON implements bin.Encode for GiveawayParticipantStatusBox. +func (b *GiveawayParticipantStatusBox) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil || b.GiveawayParticipantStatus == nil { + return fmt.Errorf("unable to encode GiveawayParticipantStatusClass as nil") + } + return b.GiveawayParticipantStatus.EncodeTDLibJSON(buf) +} diff --git a/tdapi/tl_giveaway_prize_gen.go b/tdapi/tl_giveaway_prize_gen.go new file mode 100644 index 0000000000..383db8fb0d --- /dev/null +++ b/tdapi/tl_giveaway_prize_gen.go @@ -0,0 +1,502 @@ +// 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{} +) + +// GiveawayPrizePremium represents TL type `giveawayPrizePremium#1b12e978`. +type GiveawayPrizePremium struct { + // Number of months the Telegram Premium subscription will be active after code + // activation + MonthCount int32 +} + +// GiveawayPrizePremiumTypeID is TL type id of GiveawayPrizePremium. +const GiveawayPrizePremiumTypeID = 0x1b12e978 + +// construct implements constructor of GiveawayPrizeClass. +func (g GiveawayPrizePremium) construct() GiveawayPrizeClass { return &g } + +// Ensuring interfaces in compile-time for GiveawayPrizePremium. +var ( + _ bin.Encoder = &GiveawayPrizePremium{} + _ bin.Decoder = &GiveawayPrizePremium{} + _ bin.BareEncoder = &GiveawayPrizePremium{} + _ bin.BareDecoder = &GiveawayPrizePremium{} + + _ GiveawayPrizeClass = &GiveawayPrizePremium{} +) + +func (g *GiveawayPrizePremium) Zero() bool { + if g == nil { + return true + } + if !(g.MonthCount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GiveawayPrizePremium) String() string { + if g == nil { + return "GiveawayPrizePremium(nil)" + } + type Alias GiveawayPrizePremium + return fmt.Sprintf("GiveawayPrizePremium%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GiveawayPrizePremium) TypeID() uint32 { + return GiveawayPrizePremiumTypeID +} + +// TypeName returns name of type in TL schema. +func (*GiveawayPrizePremium) TypeName() string { + return "giveawayPrizePremium" +} + +// TypeInfo returns info about TL type. +func (g *GiveawayPrizePremium) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "giveawayPrizePremium", + ID: GiveawayPrizePremiumTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "MonthCount", + SchemaName: "month_count", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GiveawayPrizePremium) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giveawayPrizePremium#1b12e978 as nil") + } + b.PutID(GiveawayPrizePremiumTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GiveawayPrizePremium) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giveawayPrizePremium#1b12e978 as nil") + } + b.PutInt32(g.MonthCount) + return nil +} + +// Decode implements bin.Decoder. +func (g *GiveawayPrizePremium) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giveawayPrizePremium#1b12e978 to nil") + } + if err := b.ConsumeID(GiveawayPrizePremiumTypeID); err != nil { + return fmt.Errorf("unable to decode giveawayPrizePremium#1b12e978: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GiveawayPrizePremium) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giveawayPrizePremium#1b12e978 to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode giveawayPrizePremium#1b12e978: field month_count: %w", err) + } + g.MonthCount = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GiveawayPrizePremium) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode giveawayPrizePremium#1b12e978 as nil") + } + b.ObjStart() + b.PutID("giveawayPrizePremium") + b.Comma() + b.FieldStart("month_count") + b.PutInt32(g.MonthCount) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GiveawayPrizePremium) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode giveawayPrizePremium#1b12e978 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("giveawayPrizePremium"); err != nil { + return fmt.Errorf("unable to decode giveawayPrizePremium#1b12e978: %w", err) + } + case "month_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode giveawayPrizePremium#1b12e978: field month_count: %w", err) + } + g.MonthCount = value + default: + return b.Skip() + } + return nil + }) +} + +// GetMonthCount returns value of MonthCount field. +func (g *GiveawayPrizePremium) GetMonthCount() (value int32) { + if g == nil { + return + } + return g.MonthCount +} + +// GiveawayPrizeStars represents TL type `giveawayPrizeStars#954c1fa4`. +type GiveawayPrizeStars struct { + // Number of Telegram Stars that will be shared by all winners + StarCount int64 +} + +// GiveawayPrizeStarsTypeID is TL type id of GiveawayPrizeStars. +const GiveawayPrizeStarsTypeID = 0x954c1fa4 + +// construct implements constructor of GiveawayPrizeClass. +func (g GiveawayPrizeStars) construct() GiveawayPrizeClass { return &g } + +// Ensuring interfaces in compile-time for GiveawayPrizeStars. +var ( + _ bin.Encoder = &GiveawayPrizeStars{} + _ bin.Decoder = &GiveawayPrizeStars{} + _ bin.BareEncoder = &GiveawayPrizeStars{} + _ bin.BareDecoder = &GiveawayPrizeStars{} + + _ GiveawayPrizeClass = &GiveawayPrizeStars{} +) + +func (g *GiveawayPrizeStars) Zero() bool { + if g == nil { + return true + } + if !(g.StarCount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GiveawayPrizeStars) String() string { + if g == nil { + return "GiveawayPrizeStars(nil)" + } + type Alias GiveawayPrizeStars + return fmt.Sprintf("GiveawayPrizeStars%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GiveawayPrizeStars) TypeID() uint32 { + return GiveawayPrizeStarsTypeID +} + +// TypeName returns name of type in TL schema. +func (*GiveawayPrizeStars) TypeName() string { + return "giveawayPrizeStars" +} + +// TypeInfo returns info about TL type. +func (g *GiveawayPrizeStars) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "giveawayPrizeStars", + ID: GiveawayPrizeStarsTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "StarCount", + SchemaName: "star_count", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GiveawayPrizeStars) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giveawayPrizeStars#954c1fa4 as nil") + } + b.PutID(GiveawayPrizeStarsTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GiveawayPrizeStars) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode giveawayPrizeStars#954c1fa4 as nil") + } + b.PutInt53(g.StarCount) + return nil +} + +// Decode implements bin.Decoder. +func (g *GiveawayPrizeStars) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giveawayPrizeStars#954c1fa4 to nil") + } + if err := b.ConsumeID(GiveawayPrizeStarsTypeID); err != nil { + return fmt.Errorf("unable to decode giveawayPrizeStars#954c1fa4: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GiveawayPrizeStars) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode giveawayPrizeStars#954c1fa4 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode giveawayPrizeStars#954c1fa4: field star_count: %w", err) + } + g.StarCount = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GiveawayPrizeStars) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode giveawayPrizeStars#954c1fa4 as nil") + } + b.ObjStart() + b.PutID("giveawayPrizeStars") + b.Comma() + b.FieldStart("star_count") + b.PutInt53(g.StarCount) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GiveawayPrizeStars) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode giveawayPrizeStars#954c1fa4 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("giveawayPrizeStars"); err != nil { + return fmt.Errorf("unable to decode giveawayPrizeStars#954c1fa4: %w", err) + } + case "star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode giveawayPrizeStars#954c1fa4: field star_count: %w", err) + } + g.StarCount = value + default: + return b.Skip() + } + return nil + }) +} + +// GetStarCount returns value of StarCount field. +func (g *GiveawayPrizeStars) GetStarCount() (value int64) { + if g == nil { + return + } + return g.StarCount +} + +// GiveawayPrizeClassName is schema name of GiveawayPrizeClass. +const GiveawayPrizeClassName = "GiveawayPrize" + +// GiveawayPrizeClass represents GiveawayPrize generic type. +// +// Example: +// +// g, err := tdapi.DecodeGiveawayPrize(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tdapi.GiveawayPrizePremium: // giveawayPrizePremium#1b12e978 +// case *tdapi.GiveawayPrizeStars: // giveawayPrizeStars#954c1fa4 +// default: panic(v) +// } +type GiveawayPrizeClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() GiveawayPrizeClass + + // 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 +} + +// DecodeGiveawayPrize implements binary de-serialization for GiveawayPrizeClass. +func DecodeGiveawayPrize(buf *bin.Buffer) (GiveawayPrizeClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case GiveawayPrizePremiumTypeID: + // Decoding giveawayPrizePremium#1b12e978. + v := GiveawayPrizePremium{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode GiveawayPrizeClass: %w", err) + } + return &v, nil + case GiveawayPrizeStarsTypeID: + // Decoding giveawayPrizeStars#954c1fa4. + v := GiveawayPrizeStars{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode GiveawayPrizeClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode GiveawayPrizeClass: %w", bin.NewUnexpectedID(id)) + } +} + +// DecodeTDLibJSONGiveawayPrize implements binary de-serialization for GiveawayPrizeClass. +func DecodeTDLibJSONGiveawayPrize(buf tdjson.Decoder) (GiveawayPrizeClass, error) { + id, err := buf.FindTypeID() + if err != nil { + return nil, err + } + switch id { + case "giveawayPrizePremium": + // Decoding giveawayPrizePremium#1b12e978. + v := GiveawayPrizePremium{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode GiveawayPrizeClass: %w", err) + } + return &v, nil + case "giveawayPrizeStars": + // Decoding giveawayPrizeStars#954c1fa4. + v := GiveawayPrizeStars{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode GiveawayPrizeClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode GiveawayPrizeClass: %w", tdjson.NewUnexpectedID(id)) + } +} + +// GiveawayPrize boxes the GiveawayPrizeClass providing a helper. +type GiveawayPrizeBox struct { + GiveawayPrize GiveawayPrizeClass +} + +// Decode implements bin.Decoder for GiveawayPrizeBox. +func (b *GiveawayPrizeBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode GiveawayPrizeBox to nil") + } + v, err := DecodeGiveawayPrize(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.GiveawayPrize = v + return nil +} + +// Encode implements bin.Encode for GiveawayPrizeBox. +func (b *GiveawayPrizeBox) Encode(buf *bin.Buffer) error { + if b == nil || b.GiveawayPrize == nil { + return fmt.Errorf("unable to encode GiveawayPrizeClass as nil") + } + return b.GiveawayPrize.Encode(buf) +} + +// DecodeTDLibJSON implements bin.Decoder for GiveawayPrizeBox. +func (b *GiveawayPrizeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("unable to decode GiveawayPrizeBox to nil") + } + v, err := DecodeTDLibJSONGiveawayPrize(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.GiveawayPrize = v + return nil +} + +// EncodeTDLibJSON implements bin.Encode for GiveawayPrizeBox. +func (b *GiveawayPrizeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil || b.GiveawayPrize == nil { + return fmt.Errorf("unable to encode GiveawayPrizeClass as nil") + } + return b.GiveawayPrize.EncodeTDLibJSON(buf) +} diff --git a/tdapi/tl_input_message_content_gen.go b/tdapi/tl_input_message_content_gen.go index 7b45981d5c..09c07faa71 100644 --- a/tdapi/tl_input_message_content_gen.go +++ b/tdapi/tl_input_message_content_gen.go @@ -1370,7 +1370,7 @@ func (i *InputMessageDocument) GetCaption() (value FormattedText) { return i.Caption } -// InputMessagePaidMedia represents TL type `inputMessagePaidMedia#36f9c23c`. +// InputMessagePaidMedia represents TL type `inputMessagePaidMedia#370c4490`. type InputMessagePaidMedia struct { // The number of Telegram Stars that must be paid to see the media; // 1-getOption("paid_media_message_star_count_max") @@ -1383,10 +1383,12 @@ type InputMessagePaidMedia struct { // True, if the caption must be shown above the video; otherwise, the caption must be // shown below the video; not supported in secret chats ShowCaptionAboveMedia bool + // Bot-provided data for the paid media; bots only + Payload string } // InputMessagePaidMediaTypeID is TL type id of InputMessagePaidMedia. -const InputMessagePaidMediaTypeID = 0x36f9c23c +const InputMessagePaidMediaTypeID = 0x370c4490 // construct implements constructor of InputMessageContentClass. func (i InputMessagePaidMedia) construct() InputMessageContentClass { return &i } @@ -1417,6 +1419,9 @@ func (i *InputMessagePaidMedia) Zero() bool { if !(i.ShowCaptionAboveMedia == false) { return false } + if !(i.Payload == "") { + return false + } return true } @@ -1469,6 +1474,10 @@ func (i *InputMessagePaidMedia) TypeInfo() tdp.Type { Name: "ShowCaptionAboveMedia", SchemaName: "show_caption_above_media", }, + { + Name: "Payload", + SchemaName: "payload", + }, } return typ } @@ -1476,7 +1485,7 @@ func (i *InputMessagePaidMedia) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (i *InputMessagePaidMedia) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputMessagePaidMedia#36f9c23c as nil") + return fmt.Errorf("can't encode inputMessagePaidMedia#370c4490 as nil") } b.PutID(InputMessagePaidMediaTypeID) return i.EncodeBare(b) @@ -1485,29 +1494,30 @@ func (i *InputMessagePaidMedia) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (i *InputMessagePaidMedia) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputMessagePaidMedia#36f9c23c as nil") + return fmt.Errorf("can't encode inputMessagePaidMedia#370c4490 as nil") } b.PutInt53(i.StarCount) b.PutInt(len(i.PaidMedia)) for idx, v := range i.PaidMedia { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare inputMessagePaidMedia#36f9c23c: field paid_media element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare inputMessagePaidMedia#370c4490: field paid_media element with index %d: %w", idx, err) } } if err := i.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePaidMedia#36f9c23c: field caption: %w", err) + return fmt.Errorf("unable to encode inputMessagePaidMedia#370c4490: field caption: %w", err) } b.PutBool(i.ShowCaptionAboveMedia) + b.PutString(i.Payload) return nil } // Decode implements bin.Decoder. func (i *InputMessagePaidMedia) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputMessagePaidMedia#36f9c23c to nil") + return fmt.Errorf("can't decode inputMessagePaidMedia#370c4490 to nil") } if err := b.ConsumeID(InputMessagePaidMediaTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#36f9c23c: %w", err) + return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: %w", err) } return i.DecodeBare(b) } @@ -1515,19 +1525,19 @@ func (i *InputMessagePaidMedia) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (i *InputMessagePaidMedia) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputMessagePaidMedia#36f9c23c to nil") + return fmt.Errorf("can't decode inputMessagePaidMedia#370c4490 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#36f9c23c: field star_count: %w", err) + return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field star_count: %w", err) } i.StarCount = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#36f9c23c: field paid_media: %w", err) + return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field paid_media: %w", err) } if headerLen > 0 { @@ -1536,30 +1546,37 @@ func (i *InputMessagePaidMedia) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value InputPaidMedia if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare inputMessagePaidMedia#36f9c23c: field paid_media: %w", err) + return fmt.Errorf("unable to decode bare inputMessagePaidMedia#370c4490: field paid_media: %w", err) } i.PaidMedia = append(i.PaidMedia, value) } } { if err := i.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#36f9c23c: field caption: %w", err) + return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field caption: %w", err) } } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#36f9c23c: field show_caption_above_media: %w", err) + return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field show_caption_above_media: %w", err) } i.ShowCaptionAboveMedia = value } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field payload: %w", err) + } + i.Payload = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (i *InputMessagePaidMedia) EncodeTDLibJSON(b tdjson.Encoder) error { if i == nil { - return fmt.Errorf("can't encode inputMessagePaidMedia#36f9c23c as nil") + return fmt.Errorf("can't encode inputMessagePaidMedia#370c4490 as nil") } b.ObjStart() b.PutID("inputMessagePaidMedia") @@ -1571,7 +1588,7 @@ func (i *InputMessagePaidMedia) EncodeTDLibJSON(b tdjson.Encoder) error { b.ArrStart() for idx, v := range i.PaidMedia { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePaidMedia#36f9c23c: field paid_media element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode inputMessagePaidMedia#370c4490: field paid_media element with index %d: %w", idx, err) } b.Comma() } @@ -1580,12 +1597,15 @@ func (i *InputMessagePaidMedia) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("caption") if err := i.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePaidMedia#36f9c23c: field caption: %w", err) + return fmt.Errorf("unable to encode inputMessagePaidMedia#370c4490: field caption: %w", err) } b.Comma() b.FieldStart("show_caption_above_media") b.PutBool(i.ShowCaptionAboveMedia) b.Comma() + b.FieldStart("payload") + b.PutString(i.Payload) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -1594,42 +1614,48 @@ func (i *InputMessagePaidMedia) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (i *InputMessagePaidMedia) DecodeTDLibJSON(b tdjson.Decoder) error { if i == nil { - return fmt.Errorf("can't decode inputMessagePaidMedia#36f9c23c to nil") + return fmt.Errorf("can't decode inputMessagePaidMedia#370c4490 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("inputMessagePaidMedia"); err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#36f9c23c: %w", err) + return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: %w", err) } case "star_count": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#36f9c23c: field star_count: %w", err) + return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field star_count: %w", err) } i.StarCount = value case "paid_media": if err := b.Arr(func(b tdjson.Decoder) error { var value InputPaidMedia if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#36f9c23c: field paid_media: %w", err) + return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field paid_media: %w", err) } i.PaidMedia = append(i.PaidMedia, value) return nil }); err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#36f9c23c: field paid_media: %w", err) + return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field paid_media: %w", err) } case "caption": if err := i.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#36f9c23c: field caption: %w", err) + return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field caption: %w", err) } case "show_caption_above_media": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#36f9c23c: field show_caption_above_media: %w", err) + return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field show_caption_above_media: %w", err) } i.ShowCaptionAboveMedia = value + case "payload": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field payload: %w", err) + } + i.Payload = value default: return b.Skip() } @@ -1669,6 +1695,14 @@ func (i *InputMessagePaidMedia) GetShowCaptionAboveMedia() (value bool) { return i.ShowCaptionAboveMedia } +// GetPayload returns value of Payload field. +func (i *InputMessagePaidMedia) GetPayload() (value string) { + if i == nil { + return + } + return i.Payload +} + // InputMessagePhoto represents TL type `inputMessagePhoto#bc78dbcc`. type InputMessagePhoto struct { // Photo to send. The photo must be at most 10 MB in size. The photo's width and height @@ -6149,7 +6183,7 @@ const InputMessageContentClassName = "InputMessageContent" // case *tdapi.InputMessageAnimation: // inputMessageAnimation#19fe563 // case *tdapi.InputMessageAudio: // inputMessageAudio#daa400b2 // case *tdapi.InputMessageDocument: // inputMessageDocument#615b72b9 -// case *tdapi.InputMessagePaidMedia: // inputMessagePaidMedia#36f9c23c +// case *tdapi.InputMessagePaidMedia: // inputMessagePaidMedia#370c4490 // case *tdapi.InputMessagePhoto: // inputMessagePhoto#bc78dbcc // case *tdapi.InputMessageSticker: // inputMessageSticker#3ff1b6f9 // case *tdapi.InputMessageVideo: // inputMessageVideo#1a64cc26 @@ -6224,7 +6258,7 @@ func DecodeInputMessageContent(buf *bin.Buffer) (InputMessageContentClass, error } return &v, nil case InputMessagePaidMediaTypeID: - // Decoding inputMessagePaidMedia#36f9c23c. + // Decoding inputMessagePaidMedia#370c4490. v := InputMessagePaidMedia{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) @@ -6369,7 +6403,7 @@ func DecodeTDLibJSONInputMessageContent(buf tdjson.Decoder) (InputMessageContent } return &v, nil case "inputMessagePaidMedia": - // Decoding inputMessagePaidMedia#36f9c23c. + // Decoding inputMessagePaidMedia#370c4490. v := InputMessagePaidMedia{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) diff --git a/tdapi/tl_launch_prepaid_giveaway_gen.go b/tdapi/tl_launch_prepaid_giveaway_gen.go new file mode 100644 index 0000000000..692f04bc36 --- /dev/null +++ b/tdapi/tl_launch_prepaid_giveaway_gen.go @@ -0,0 +1,306 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// LaunchPrepaidGiveawayRequest represents TL type `launchPrepaidGiveaway#261d783a`. +type LaunchPrepaidGiveawayRequest struct { + // Unique identifier of the prepaid giveaway + GiveawayID int64 + // Giveaway parameters + Parameters GiveawayParameters + // The number of users to receive giveaway prize + WinnerCount int32 + // The number of Telegram Stars to be distributed through the giveaway; pass 0 for + // Telegram Premium giveaways + StarCount int64 +} + +// LaunchPrepaidGiveawayRequestTypeID is TL type id of LaunchPrepaidGiveawayRequest. +const LaunchPrepaidGiveawayRequestTypeID = 0x261d783a + +// Ensuring interfaces in compile-time for LaunchPrepaidGiveawayRequest. +var ( + _ bin.Encoder = &LaunchPrepaidGiveawayRequest{} + _ bin.Decoder = &LaunchPrepaidGiveawayRequest{} + _ bin.BareEncoder = &LaunchPrepaidGiveawayRequest{} + _ bin.BareDecoder = &LaunchPrepaidGiveawayRequest{} +) + +func (l *LaunchPrepaidGiveawayRequest) Zero() bool { + if l == nil { + return true + } + if !(l.GiveawayID == 0) { + return false + } + if !(l.Parameters.Zero()) { + return false + } + if !(l.WinnerCount == 0) { + return false + } + if !(l.StarCount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (l *LaunchPrepaidGiveawayRequest) String() string { + if l == nil { + return "LaunchPrepaidGiveawayRequest(nil)" + } + type Alias LaunchPrepaidGiveawayRequest + return fmt.Sprintf("LaunchPrepaidGiveawayRequest%+v", Alias(*l)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*LaunchPrepaidGiveawayRequest) TypeID() uint32 { + return LaunchPrepaidGiveawayRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*LaunchPrepaidGiveawayRequest) TypeName() string { + return "launchPrepaidGiveaway" +} + +// TypeInfo returns info about TL type. +func (l *LaunchPrepaidGiveawayRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "launchPrepaidGiveaway", + ID: LaunchPrepaidGiveawayRequestTypeID, + } + if l == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "GiveawayID", + SchemaName: "giveaway_id", + }, + { + Name: "Parameters", + SchemaName: "parameters", + }, + { + Name: "WinnerCount", + SchemaName: "winner_count", + }, + { + Name: "StarCount", + SchemaName: "star_count", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (l *LaunchPrepaidGiveawayRequest) Encode(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't encode launchPrepaidGiveaway#261d783a as nil") + } + b.PutID(LaunchPrepaidGiveawayRequestTypeID) + return l.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (l *LaunchPrepaidGiveawayRequest) EncodeBare(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't encode launchPrepaidGiveaway#261d783a as nil") + } + b.PutLong(l.GiveawayID) + if err := l.Parameters.Encode(b); err != nil { + return fmt.Errorf("unable to encode launchPrepaidGiveaway#261d783a: field parameters: %w", err) + } + b.PutInt32(l.WinnerCount) + b.PutInt53(l.StarCount) + return nil +} + +// Decode implements bin.Decoder. +func (l *LaunchPrepaidGiveawayRequest) Decode(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't decode launchPrepaidGiveaway#261d783a to nil") + } + if err := b.ConsumeID(LaunchPrepaidGiveawayRequestTypeID); err != nil { + return fmt.Errorf("unable to decode launchPrepaidGiveaway#261d783a: %w", err) + } + return l.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (l *LaunchPrepaidGiveawayRequest) DecodeBare(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't decode launchPrepaidGiveaway#261d783a to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode launchPrepaidGiveaway#261d783a: field giveaway_id: %w", err) + } + l.GiveawayID = value + } + { + if err := l.Parameters.Decode(b); err != nil { + return fmt.Errorf("unable to decode launchPrepaidGiveaway#261d783a: field parameters: %w", err) + } + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode launchPrepaidGiveaway#261d783a: field winner_count: %w", err) + } + l.WinnerCount = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode launchPrepaidGiveaway#261d783a: field star_count: %w", err) + } + l.StarCount = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (l *LaunchPrepaidGiveawayRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if l == nil { + return fmt.Errorf("can't encode launchPrepaidGiveaway#261d783a as nil") + } + b.ObjStart() + b.PutID("launchPrepaidGiveaway") + b.Comma() + b.FieldStart("giveaway_id") + b.PutLong(l.GiveawayID) + b.Comma() + b.FieldStart("parameters") + if err := l.Parameters.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode launchPrepaidGiveaway#261d783a: field parameters: %w", err) + } + b.Comma() + b.FieldStart("winner_count") + b.PutInt32(l.WinnerCount) + b.Comma() + b.FieldStart("star_count") + b.PutInt53(l.StarCount) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (l *LaunchPrepaidGiveawayRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if l == nil { + return fmt.Errorf("can't decode launchPrepaidGiveaway#261d783a to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("launchPrepaidGiveaway"); err != nil { + return fmt.Errorf("unable to decode launchPrepaidGiveaway#261d783a: %w", err) + } + case "giveaway_id": + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode launchPrepaidGiveaway#261d783a: field giveaway_id: %w", err) + } + l.GiveawayID = value + case "parameters": + if err := l.Parameters.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode launchPrepaidGiveaway#261d783a: field parameters: %w", err) + } + case "winner_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode launchPrepaidGiveaway#261d783a: field winner_count: %w", err) + } + l.WinnerCount = value + case "star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode launchPrepaidGiveaway#261d783a: field star_count: %w", err) + } + l.StarCount = value + default: + return b.Skip() + } + return nil + }) +} + +// GetGiveawayID returns value of GiveawayID field. +func (l *LaunchPrepaidGiveawayRequest) GetGiveawayID() (value int64) { + if l == nil { + return + } + return l.GiveawayID +} + +// GetParameters returns value of Parameters field. +func (l *LaunchPrepaidGiveawayRequest) GetParameters() (value GiveawayParameters) { + if l == nil { + return + } + return l.Parameters +} + +// GetWinnerCount returns value of WinnerCount field. +func (l *LaunchPrepaidGiveawayRequest) GetWinnerCount() (value int32) { + if l == nil { + return + } + return l.WinnerCount +} + +// GetStarCount returns value of StarCount field. +func (l *LaunchPrepaidGiveawayRequest) GetStarCount() (value int64) { + if l == nil { + return + } + return l.StarCount +} + +// LaunchPrepaidGiveaway invokes method launchPrepaidGiveaway#261d783a returning error if any. +func (c *Client) LaunchPrepaidGiveaway(ctx context.Context, request *LaunchPrepaidGiveawayRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_launch_prepaid_premium_giveaway_gen.go b/tdapi/tl_launch_prepaid_premium_giveaway_gen.go deleted file mode 100644 index aeb8bfa5dc..0000000000 --- a/tdapi/tl_launch_prepaid_premium_giveaway_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{} -) - -// LaunchPrepaidPremiumGiveawayRequest represents TL type `launchPrepaidPremiumGiveaway#5328fea1`. -type LaunchPrepaidPremiumGiveawayRequest struct { - // Unique identifier of the prepaid giveaway - GiveawayID int64 - // Giveaway parameters - Parameters PremiumGiveawayParameters -} - -// LaunchPrepaidPremiumGiveawayRequestTypeID is TL type id of LaunchPrepaidPremiumGiveawayRequest. -const LaunchPrepaidPremiumGiveawayRequestTypeID = 0x5328fea1 - -// Ensuring interfaces in compile-time for LaunchPrepaidPremiumGiveawayRequest. -var ( - _ bin.Encoder = &LaunchPrepaidPremiumGiveawayRequest{} - _ bin.Decoder = &LaunchPrepaidPremiumGiveawayRequest{} - _ bin.BareEncoder = &LaunchPrepaidPremiumGiveawayRequest{} - _ bin.BareDecoder = &LaunchPrepaidPremiumGiveawayRequest{} -) - -func (l *LaunchPrepaidPremiumGiveawayRequest) Zero() bool { - if l == nil { - return true - } - if !(l.GiveawayID == 0) { - return false - } - if !(l.Parameters.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LaunchPrepaidPremiumGiveawayRequest) String() string { - if l == nil { - return "LaunchPrepaidPremiumGiveawayRequest(nil)" - } - type Alias LaunchPrepaidPremiumGiveawayRequest - return fmt.Sprintf("LaunchPrepaidPremiumGiveawayRequest%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LaunchPrepaidPremiumGiveawayRequest) TypeID() uint32 { - return LaunchPrepaidPremiumGiveawayRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*LaunchPrepaidPremiumGiveawayRequest) TypeName() string { - return "launchPrepaidPremiumGiveaway" -} - -// TypeInfo returns info about TL type. -func (l *LaunchPrepaidPremiumGiveawayRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "launchPrepaidPremiumGiveaway", - ID: LaunchPrepaidPremiumGiveawayRequestTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GiveawayID", - SchemaName: "giveaway_id", - }, - { - Name: "Parameters", - SchemaName: "parameters", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LaunchPrepaidPremiumGiveawayRequest) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode launchPrepaidPremiumGiveaway#5328fea1 as nil") - } - b.PutID(LaunchPrepaidPremiumGiveawayRequestTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LaunchPrepaidPremiumGiveawayRequest) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode launchPrepaidPremiumGiveaway#5328fea1 as nil") - } - b.PutLong(l.GiveawayID) - if err := l.Parameters.Encode(b); err != nil { - return fmt.Errorf("unable to encode launchPrepaidPremiumGiveaway#5328fea1: field parameters: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LaunchPrepaidPremiumGiveawayRequest) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode launchPrepaidPremiumGiveaway#5328fea1 to nil") - } - if err := b.ConsumeID(LaunchPrepaidPremiumGiveawayRequestTypeID); err != nil { - return fmt.Errorf("unable to decode launchPrepaidPremiumGiveaway#5328fea1: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LaunchPrepaidPremiumGiveawayRequest) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode launchPrepaidPremiumGiveaway#5328fea1 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode launchPrepaidPremiumGiveaway#5328fea1: field giveaway_id: %w", err) - } - l.GiveawayID = value - } - { - if err := l.Parameters.Decode(b); err != nil { - return fmt.Errorf("unable to decode launchPrepaidPremiumGiveaway#5328fea1: field parameters: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LaunchPrepaidPremiumGiveawayRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode launchPrepaidPremiumGiveaway#5328fea1 as nil") - } - b.ObjStart() - b.PutID("launchPrepaidPremiumGiveaway") - b.Comma() - b.FieldStart("giveaway_id") - b.PutLong(l.GiveawayID) - b.Comma() - b.FieldStart("parameters") - if err := l.Parameters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode launchPrepaidPremiumGiveaway#5328fea1: field parameters: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LaunchPrepaidPremiumGiveawayRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode launchPrepaidPremiumGiveaway#5328fea1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("launchPrepaidPremiumGiveaway"); err != nil { - return fmt.Errorf("unable to decode launchPrepaidPremiumGiveaway#5328fea1: %w", err) - } - case "giveaway_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode launchPrepaidPremiumGiveaway#5328fea1: field giveaway_id: %w", err) - } - l.GiveawayID = value - case "parameters": - if err := l.Parameters.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode launchPrepaidPremiumGiveaway#5328fea1: field parameters: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetGiveawayID returns value of GiveawayID field. -func (l *LaunchPrepaidPremiumGiveawayRequest) GetGiveawayID() (value int64) { - if l == nil { - return - } - return l.GiveawayID -} - -// GetParameters returns value of Parameters field. -func (l *LaunchPrepaidPremiumGiveawayRequest) GetParameters() (value PremiumGiveawayParameters) { - if l == nil { - return - } - return l.Parameters -} - -// LaunchPrepaidPremiumGiveaway invokes method launchPrepaidPremiumGiveaway#5328fea1 returning error if any. -func (c *Client) LaunchPrepaidPremiumGiveaway(ctx context.Context, request *LaunchPrepaidPremiumGiveawayRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_link_preview_gen.go b/tdapi/tl_link_preview_gen.go index c0c7efd282..5e7e15878f 100644 --- a/tdapi/tl_link_preview_gen.go +++ b/tdapi/tl_link_preview_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// LinkPreview represents TL type `linkPreview#52a366d6`. +// LinkPreview represents TL type `linkPreview#6714d1f2`. type LinkPreview struct { // Original URL of the link URL string @@ -43,6 +43,8 @@ type LinkPreview struct { Title string // Describes a link preview Description FormattedText + // Author of the content + Author string // Type of the link preview Type LinkPreviewTypeClass // True, if size of media in the preview can be changed @@ -64,7 +66,7 @@ type LinkPreview struct { } // LinkPreviewTypeID is TL type id of LinkPreview. -const LinkPreviewTypeID = 0x52a366d6 +const LinkPreviewTypeID = 0x6714d1f2 // Ensuring interfaces in compile-time for LinkPreview. var ( @@ -93,6 +95,9 @@ func (l *LinkPreview) Zero() bool { if !(l.Description.Zero()) { return false } + if !(l.Author == "") { + return false + } if !(l.Type == nil) { return false } @@ -170,6 +175,10 @@ func (l *LinkPreview) TypeInfo() tdp.Type { Name: "Description", SchemaName: "description", }, + { + Name: "Author", + SchemaName: "author", + }, { Name: "Type", SchemaName: "type", @@ -205,7 +214,7 @@ func (l *LinkPreview) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (l *LinkPreview) Encode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreview#52a366d6 as nil") + return fmt.Errorf("can't encode linkPreview#6714d1f2 as nil") } b.PutID(LinkPreviewTypeID) return l.EncodeBare(b) @@ -214,20 +223,21 @@ func (l *LinkPreview) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (l *LinkPreview) EncodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreview#52a366d6 as nil") + return fmt.Errorf("can't encode linkPreview#6714d1f2 as nil") } b.PutString(l.URL) b.PutString(l.DisplayURL) b.PutString(l.SiteName) b.PutString(l.Title) if err := l.Description.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreview#52a366d6: field description: %w", err) + return fmt.Errorf("unable to encode linkPreview#6714d1f2: field description: %w", err) } + b.PutString(l.Author) if l.Type == nil { - return fmt.Errorf("unable to encode linkPreview#52a366d6: field type is nil") + return fmt.Errorf("unable to encode linkPreview#6714d1f2: field type is nil") } if err := l.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreview#52a366d6: field type: %w", err) + return fmt.Errorf("unable to encode linkPreview#6714d1f2: field type: %w", err) } b.PutBool(l.HasLargeMedia) b.PutBool(l.ShowLargeMedia) @@ -241,10 +251,10 @@ func (l *LinkPreview) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (l *LinkPreview) Decode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreview#52a366d6 to nil") + return fmt.Errorf("can't decode linkPreview#6714d1f2 to nil") } if err := b.ConsumeID(LinkPreviewTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: %w", err) } return l.DecodeBare(b) } @@ -252,87 +262,94 @@ func (l *LinkPreview) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (l *LinkPreview) DecodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreview#52a366d6 to nil") + return fmt.Errorf("can't decode linkPreview#6714d1f2 to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field url: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field url: %w", err) } l.URL = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field display_url: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field display_url: %w", err) } l.DisplayURL = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field site_name: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field site_name: %w", err) } l.SiteName = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field title: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field title: %w", err) } l.Title = value } { if err := l.Description.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field description: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field description: %w", err) + } + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field author: %w", err) } + l.Author = value } { value, err := DecodeLinkPreviewType(b) if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field type: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field type: %w", err) } l.Type = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field has_large_media: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field has_large_media: %w", err) } l.HasLargeMedia = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field show_large_media: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field show_large_media: %w", err) } l.ShowLargeMedia = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field show_media_above_description: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field show_media_above_description: %w", err) } l.ShowMediaAboveDescription = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field skip_confirmation: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field skip_confirmation: %w", err) } l.SkipConfirmation = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field show_above_text: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field show_above_text: %w", err) } l.ShowAboveText = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field instant_view_version: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field instant_view_version: %w", err) } l.InstantViewVersion = value } @@ -342,7 +359,7 @@ func (l *LinkPreview) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (l *LinkPreview) EncodeTDLibJSON(b tdjson.Encoder) error { if l == nil { - return fmt.Errorf("can't encode linkPreview#52a366d6 as nil") + return fmt.Errorf("can't encode linkPreview#6714d1f2 as nil") } b.ObjStart() b.PutID("linkPreview") @@ -361,15 +378,18 @@ func (l *LinkPreview) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("description") if err := l.Description.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreview#52a366d6: field description: %w", err) + return fmt.Errorf("unable to encode linkPreview#6714d1f2: field description: %w", err) } b.Comma() + b.FieldStart("author") + b.PutString(l.Author) + b.Comma() b.FieldStart("type") if l.Type == nil { - return fmt.Errorf("unable to encode linkPreview#52a366d6: field type is nil") + return fmt.Errorf("unable to encode linkPreview#6714d1f2: field type is nil") } if err := l.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreview#52a366d6: field type: %w", err) + return fmt.Errorf("unable to encode linkPreview#6714d1f2: field type: %w", err) } b.Comma() b.FieldStart("has_large_media") @@ -398,83 +418,89 @@ func (l *LinkPreview) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (l *LinkPreview) DecodeTDLibJSON(b tdjson.Decoder) error { if l == nil { - return fmt.Errorf("can't decode linkPreview#52a366d6 to nil") + return fmt.Errorf("can't decode linkPreview#6714d1f2 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("linkPreview"); err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: %w", err) } case "url": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field url: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field url: %w", err) } l.URL = value case "display_url": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field display_url: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field display_url: %w", err) } l.DisplayURL = value case "site_name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field site_name: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field site_name: %w", err) } l.SiteName = value case "title": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field title: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field title: %w", err) } l.Title = value case "description": if err := l.Description.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field description: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field description: %w", err) } + case "author": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field author: %w", err) + } + l.Author = value case "type": value, err := DecodeTDLibJSONLinkPreviewType(b) if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field type: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field type: %w", err) } l.Type = value case "has_large_media": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field has_large_media: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field has_large_media: %w", err) } l.HasLargeMedia = value case "show_large_media": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field show_large_media: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field show_large_media: %w", err) } l.ShowLargeMedia = value case "show_media_above_description": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field show_media_above_description: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field show_media_above_description: %w", err) } l.ShowMediaAboveDescription = value case "skip_confirmation": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field skip_confirmation: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field skip_confirmation: %w", err) } l.SkipConfirmation = value case "show_above_text": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field show_above_text: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field show_above_text: %w", err) } l.ShowAboveText = value case "instant_view_version": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreview#52a366d6: field instant_view_version: %w", err) + return fmt.Errorf("unable to decode linkPreview#6714d1f2: field instant_view_version: %w", err) } l.InstantViewVersion = value default: @@ -524,6 +550,14 @@ func (l *LinkPreview) GetDescription() (value FormattedText) { return l.Description } +// GetAuthor returns value of Author field. +func (l *LinkPreview) GetAuthor() (value string) { + if l == nil { + return + } + return l.Author +} + // GetType returns value of Type field. func (l *LinkPreview) GetType() (value LinkPreviewTypeClass) { if l == nil { diff --git a/tdapi/tl_link_preview_type_gen.go b/tdapi/tl_link_preview_type_gen.go index 39236c29a6..1054024158 100644 --- a/tdapi/tl_link_preview_type_gen.go +++ b/tdapi/tl_link_preview_type_gen.go @@ -265,16 +265,14 @@ func (l *LinkPreviewTypeAlbum) GetCaption() (value string) { return l.Caption } -// LinkPreviewTypeAnimation represents TL type `linkPreviewTypeAnimation#93534e8e`. +// LinkPreviewTypeAnimation represents TL type `linkPreviewTypeAnimation#ad5cc534`. type LinkPreviewTypeAnimation struct { // The animation Animation Animation - // Author of the animation - Author string } // LinkPreviewTypeAnimationTypeID is TL type id of LinkPreviewTypeAnimation. -const LinkPreviewTypeAnimationTypeID = 0x93534e8e +const LinkPreviewTypeAnimationTypeID = 0xad5cc534 // construct implements constructor of LinkPreviewTypeClass. func (l LinkPreviewTypeAnimation) construct() LinkPreviewTypeClass { return &l } @@ -296,9 +294,6 @@ func (l *LinkPreviewTypeAnimation) Zero() bool { if !(l.Animation.Zero()) { return false } - if !(l.Author == "") { - return false - } return true } @@ -339,10 +334,6 @@ func (l *LinkPreviewTypeAnimation) TypeInfo() tdp.Type { Name: "Animation", SchemaName: "animation", }, - { - Name: "Author", - SchemaName: "author", - }, } return typ } @@ -350,7 +341,7 @@ func (l *LinkPreviewTypeAnimation) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (l *LinkPreviewTypeAnimation) Encode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeAnimation#93534e8e as nil") + return fmt.Errorf("can't encode linkPreviewTypeAnimation#ad5cc534 as nil") } b.PutID(LinkPreviewTypeAnimationTypeID) return l.EncodeBare(b) @@ -359,22 +350,21 @@ func (l *LinkPreviewTypeAnimation) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (l *LinkPreviewTypeAnimation) EncodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeAnimation#93534e8e as nil") + return fmt.Errorf("can't encode linkPreviewTypeAnimation#ad5cc534 as nil") } if err := l.Animation.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeAnimation#93534e8e: field animation: %w", err) + return fmt.Errorf("unable to encode linkPreviewTypeAnimation#ad5cc534: field animation: %w", err) } - b.PutString(l.Author) return nil } // Decode implements bin.Decoder. func (l *LinkPreviewTypeAnimation) Decode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeAnimation#93534e8e to nil") + return fmt.Errorf("can't decode linkPreviewTypeAnimation#ad5cc534 to nil") } if err := b.ConsumeID(LinkPreviewTypeAnimationTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAnimation#93534e8e: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeAnimation#ad5cc534: %w", err) } return l.DecodeBare(b) } @@ -382,19 +372,12 @@ func (l *LinkPreviewTypeAnimation) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (l *LinkPreviewTypeAnimation) DecodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeAnimation#93534e8e to nil") + return fmt.Errorf("can't decode linkPreviewTypeAnimation#ad5cc534 to nil") } { if err := l.Animation.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAnimation#93534e8e: field animation: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAnimation#93534e8e: field author: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeAnimation#ad5cc534: field animation: %w", err) } - l.Author = value } return nil } @@ -402,19 +385,16 @@ func (l *LinkPreviewTypeAnimation) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (l *LinkPreviewTypeAnimation) EncodeTDLibJSON(b tdjson.Encoder) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeAnimation#93534e8e as nil") + return fmt.Errorf("can't encode linkPreviewTypeAnimation#ad5cc534 as nil") } b.ObjStart() b.PutID("linkPreviewTypeAnimation") b.Comma() b.FieldStart("animation") if err := l.Animation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeAnimation#93534e8e: field animation: %w", err) + return fmt.Errorf("unable to encode linkPreviewTypeAnimation#ad5cc534: field animation: %w", err) } b.Comma() - b.FieldStart("author") - b.PutString(l.Author) - b.Comma() b.StripComma() b.ObjEnd() return nil @@ -423,25 +403,19 @@ func (l *LinkPreviewTypeAnimation) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (l *LinkPreviewTypeAnimation) DecodeTDLibJSON(b tdjson.Decoder) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeAnimation#93534e8e to nil") + return fmt.Errorf("can't decode linkPreviewTypeAnimation#ad5cc534 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("linkPreviewTypeAnimation"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAnimation#93534e8e: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeAnimation#ad5cc534: %w", err) } case "animation": if err := l.Animation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAnimation#93534e8e: field animation: %w", err) - } - case "author": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAnimation#93534e8e: field author: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeAnimation#ad5cc534: field animation: %w", err) } - l.Author = value default: return b.Skip() } @@ -457,24 +431,14 @@ func (l *LinkPreviewTypeAnimation) GetAnimation() (value Animation) { return l.Animation } -// GetAuthor returns value of Author field. -func (l *LinkPreviewTypeAnimation) GetAuthor() (value string) { - if l == nil { - return - } - return l.Author -} - -// LinkPreviewTypeApp represents TL type `linkPreviewTypeApp#b5192746`. +// LinkPreviewTypeApp represents TL type `linkPreviewTypeApp#e3a68def`. type LinkPreviewTypeApp struct { // Photo for the app Photo Photo - // Author of the app - Author string } // LinkPreviewTypeAppTypeID is TL type id of LinkPreviewTypeApp. -const LinkPreviewTypeAppTypeID = 0xb5192746 +const LinkPreviewTypeAppTypeID = 0xe3a68def // construct implements constructor of LinkPreviewTypeClass. func (l LinkPreviewTypeApp) construct() LinkPreviewTypeClass { return &l } @@ -496,9 +460,6 @@ func (l *LinkPreviewTypeApp) Zero() bool { if !(l.Photo.Zero()) { return false } - if !(l.Author == "") { - return false - } return true } @@ -539,10 +500,6 @@ func (l *LinkPreviewTypeApp) TypeInfo() tdp.Type { Name: "Photo", SchemaName: "photo", }, - { - Name: "Author", - SchemaName: "author", - }, } return typ } @@ -550,7 +507,7 @@ func (l *LinkPreviewTypeApp) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (l *LinkPreviewTypeApp) Encode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeApp#b5192746 as nil") + return fmt.Errorf("can't encode linkPreviewTypeApp#e3a68def as nil") } b.PutID(LinkPreviewTypeAppTypeID) return l.EncodeBare(b) @@ -559,22 +516,21 @@ func (l *LinkPreviewTypeApp) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (l *LinkPreviewTypeApp) EncodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeApp#b5192746 as nil") + return fmt.Errorf("can't encode linkPreviewTypeApp#e3a68def as nil") } if err := l.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeApp#b5192746: field photo: %w", err) + return fmt.Errorf("unable to encode linkPreviewTypeApp#e3a68def: field photo: %w", err) } - b.PutString(l.Author) return nil } // Decode implements bin.Decoder. func (l *LinkPreviewTypeApp) Decode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeApp#b5192746 to nil") + return fmt.Errorf("can't decode linkPreviewTypeApp#e3a68def to nil") } if err := b.ConsumeID(LinkPreviewTypeAppTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeApp#b5192746: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeApp#e3a68def: %w", err) } return l.DecodeBare(b) } @@ -582,19 +538,12 @@ func (l *LinkPreviewTypeApp) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (l *LinkPreviewTypeApp) DecodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeApp#b5192746 to nil") + return fmt.Errorf("can't decode linkPreviewTypeApp#e3a68def to nil") } { if err := l.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeApp#b5192746: field photo: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeApp#b5192746: field author: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeApp#e3a68def: field photo: %w", err) } - l.Author = value } return nil } @@ -602,19 +551,16 @@ func (l *LinkPreviewTypeApp) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (l *LinkPreviewTypeApp) EncodeTDLibJSON(b tdjson.Encoder) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeApp#b5192746 as nil") + return fmt.Errorf("can't encode linkPreviewTypeApp#e3a68def as nil") } b.ObjStart() b.PutID("linkPreviewTypeApp") b.Comma() b.FieldStart("photo") if err := l.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeApp#b5192746: field photo: %w", err) + return fmt.Errorf("unable to encode linkPreviewTypeApp#e3a68def: field photo: %w", err) } b.Comma() - b.FieldStart("author") - b.PutString(l.Author) - b.Comma() b.StripComma() b.ObjEnd() return nil @@ -623,25 +569,19 @@ func (l *LinkPreviewTypeApp) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (l *LinkPreviewTypeApp) DecodeTDLibJSON(b tdjson.Decoder) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeApp#b5192746 to nil") + return fmt.Errorf("can't decode linkPreviewTypeApp#e3a68def to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("linkPreviewTypeApp"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeApp#b5192746: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeApp#e3a68def: %w", err) } case "photo": if err := l.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeApp#b5192746: field photo: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeApp#e3a68def: field photo: %w", err) } - case "author": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeApp#b5192746: field author: %w", err) - } - l.Author = value default: return b.Skip() } @@ -657,24 +597,14 @@ func (l *LinkPreviewTypeApp) GetPhoto() (value Photo) { return l.Photo } -// GetAuthor returns value of Author field. -func (l *LinkPreviewTypeApp) GetAuthor() (value string) { - if l == nil { - return - } - return l.Author -} - -// LinkPreviewTypeArticle represents TL type `linkPreviewTypeArticle#965e4e27`. +// LinkPreviewTypeArticle represents TL type `linkPreviewTypeArticle#7cce9bd9`. type LinkPreviewTypeArticle struct { // Article's main photo; may be null Photo Photo - // Author of the article - Author string } // LinkPreviewTypeArticleTypeID is TL type id of LinkPreviewTypeArticle. -const LinkPreviewTypeArticleTypeID = 0x965e4e27 +const LinkPreviewTypeArticleTypeID = 0x7cce9bd9 // construct implements constructor of LinkPreviewTypeClass. func (l LinkPreviewTypeArticle) construct() LinkPreviewTypeClass { return &l } @@ -696,9 +626,6 @@ func (l *LinkPreviewTypeArticle) Zero() bool { if !(l.Photo.Zero()) { return false } - if !(l.Author == "") { - return false - } return true } @@ -739,10 +666,6 @@ func (l *LinkPreviewTypeArticle) TypeInfo() tdp.Type { Name: "Photo", SchemaName: "photo", }, - { - Name: "Author", - SchemaName: "author", - }, } return typ } @@ -750,7 +673,7 @@ func (l *LinkPreviewTypeArticle) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (l *LinkPreviewTypeArticle) Encode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeArticle#965e4e27 as nil") + return fmt.Errorf("can't encode linkPreviewTypeArticle#7cce9bd9 as nil") } b.PutID(LinkPreviewTypeArticleTypeID) return l.EncodeBare(b) @@ -759,22 +682,21 @@ func (l *LinkPreviewTypeArticle) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (l *LinkPreviewTypeArticle) EncodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeArticle#965e4e27 as nil") + return fmt.Errorf("can't encode linkPreviewTypeArticle#7cce9bd9 as nil") } if err := l.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeArticle#965e4e27: field photo: %w", err) + return fmt.Errorf("unable to encode linkPreviewTypeArticle#7cce9bd9: field photo: %w", err) } - b.PutString(l.Author) return nil } // Decode implements bin.Decoder. func (l *LinkPreviewTypeArticle) Decode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeArticle#965e4e27 to nil") + return fmt.Errorf("can't decode linkPreviewTypeArticle#7cce9bd9 to nil") } if err := b.ConsumeID(LinkPreviewTypeArticleTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeArticle#965e4e27: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeArticle#7cce9bd9: %w", err) } return l.DecodeBare(b) } @@ -782,39 +704,29 @@ func (l *LinkPreviewTypeArticle) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (l *LinkPreviewTypeArticle) DecodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeArticle#965e4e27 to nil") + return fmt.Errorf("can't decode linkPreviewTypeArticle#7cce9bd9 to nil") } { if err := l.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeArticle#965e4e27: field photo: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeArticle#7cce9bd9: field photo: %w", err) } } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeArticle#965e4e27: field author: %w", err) - } - l.Author = value - } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (l *LinkPreviewTypeArticle) EncodeTDLibJSON(b tdjson.Encoder) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeArticle#965e4e27 as nil") + return fmt.Errorf("can't encode linkPreviewTypeArticle#7cce9bd9 as nil") } b.ObjStart() b.PutID("linkPreviewTypeArticle") b.Comma() b.FieldStart("photo") if err := l.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeArticle#965e4e27: field photo: %w", err) + return fmt.Errorf("unable to encode linkPreviewTypeArticle#7cce9bd9: field photo: %w", err) } b.Comma() - b.FieldStart("author") - b.PutString(l.Author) - b.Comma() b.StripComma() b.ObjEnd() return nil @@ -823,25 +735,19 @@ func (l *LinkPreviewTypeArticle) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (l *LinkPreviewTypeArticle) DecodeTDLibJSON(b tdjson.Decoder) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeArticle#965e4e27 to nil") + return fmt.Errorf("can't decode linkPreviewTypeArticle#7cce9bd9 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("linkPreviewTypeArticle"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeArticle#965e4e27: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeArticle#7cce9bd9: %w", err) } case "photo": if err := l.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeArticle#965e4e27: field photo: %w", err) - } - case "author": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeArticle#965e4e27: field author: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeArticle#7cce9bd9: field photo: %w", err) } - l.Author = value default: return b.Skip() } @@ -857,30 +763,14 @@ func (l *LinkPreviewTypeArticle) GetPhoto() (value Photo) { return l.Photo } -// GetAuthor returns value of Author field. -func (l *LinkPreviewTypeArticle) GetAuthor() (value string) { - if l == nil { - return - } - return l.Author -} - -// LinkPreviewTypeAudio represents TL type `linkPreviewTypeAudio#572c6b78`. +// LinkPreviewTypeAudio represents TL type `linkPreviewTypeAudio#75e407d2`. type LinkPreviewTypeAudio struct { - // URL of the audio; may be empty if none - URL string - // MIME type of the audio file - MimeType string - // The audio description; may be null if unknown + // The audio description Audio Audio - // Duration of the audio, in seconds; 0 if unknown - Duration int32 - // Author of the audio - Author string } // LinkPreviewTypeAudioTypeID is TL type id of LinkPreviewTypeAudio. -const LinkPreviewTypeAudioTypeID = 0x572c6b78 +const LinkPreviewTypeAudioTypeID = 0x75e407d2 // construct implements constructor of LinkPreviewTypeClass. func (l LinkPreviewTypeAudio) construct() LinkPreviewTypeClass { return &l } @@ -899,21 +789,9 @@ func (l *LinkPreviewTypeAudio) Zero() bool { if l == nil { return true } - if !(l.URL == "") { - return false - } - if !(l.MimeType == "") { - return false - } if !(l.Audio.Zero()) { return false } - if !(l.Duration == 0) { - return false - } - if !(l.Author == "") { - return false - } return true } @@ -950,26 +828,10 @@ func (l *LinkPreviewTypeAudio) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "MimeType", - SchemaName: "mime_type", - }, { Name: "Audio", SchemaName: "audio", }, - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "Author", - SchemaName: "author", - }, } return typ } @@ -977,7 +839,7 @@ func (l *LinkPreviewTypeAudio) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (l *LinkPreviewTypeAudio) Encode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeAudio#572c6b78 as nil") + return fmt.Errorf("can't encode linkPreviewTypeAudio#75e407d2 as nil") } b.PutID(LinkPreviewTypeAudioTypeID) return l.EncodeBare(b) @@ -986,25 +848,21 @@ func (l *LinkPreviewTypeAudio) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (l *LinkPreviewTypeAudio) EncodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeAudio#572c6b78 as nil") + return fmt.Errorf("can't encode linkPreviewTypeAudio#75e407d2 as nil") } - b.PutString(l.URL) - b.PutString(l.MimeType) if err := l.Audio.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeAudio#572c6b78: field audio: %w", err) + return fmt.Errorf("unable to encode linkPreviewTypeAudio#75e407d2: field audio: %w", err) } - b.PutInt32(l.Duration) - b.PutString(l.Author) return nil } // Decode implements bin.Decoder. func (l *LinkPreviewTypeAudio) Decode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeAudio#572c6b78 to nil") + return fmt.Errorf("can't decode linkPreviewTypeAudio#75e407d2 to nil") } if err := b.ConsumeID(LinkPreviewTypeAudioTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAudio#572c6b78: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeAudio#75e407d2: %w", err) } return l.DecodeBare(b) } @@ -1012,40 +870,12 @@ func (l *LinkPreviewTypeAudio) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (l *LinkPreviewTypeAudio) DecodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeAudio#572c6b78 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAudio#572c6b78: field url: %w", err) - } - l.URL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAudio#572c6b78: field mime_type: %w", err) - } - l.MimeType = value + return fmt.Errorf("can't decode linkPreviewTypeAudio#75e407d2 to nil") } { if err := l.Audio.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAudio#572c6b78: field audio: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAudio#572c6b78: field duration: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeAudio#75e407d2: field audio: %w", err) } - l.Duration = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAudio#572c6b78: field author: %w", err) - } - l.Author = value } return nil } @@ -1053,28 +883,16 @@ func (l *LinkPreviewTypeAudio) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (l *LinkPreviewTypeAudio) EncodeTDLibJSON(b tdjson.Encoder) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeAudio#572c6b78 as nil") + return fmt.Errorf("can't encode linkPreviewTypeAudio#75e407d2 as nil") } b.ObjStart() b.PutID("linkPreviewTypeAudio") b.Comma() - b.FieldStart("url") - b.PutString(l.URL) - b.Comma() - b.FieldStart("mime_type") - b.PutString(l.MimeType) - b.Comma() b.FieldStart("audio") if err := l.Audio.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeAudio#572c6b78: field audio: %w", err) + return fmt.Errorf("unable to encode linkPreviewTypeAudio#75e407d2: field audio: %w", err) } b.Comma() - b.FieldStart("duration") - b.PutInt32(l.Duration) - b.Comma() - b.FieldStart("author") - b.PutString(l.Author) - b.Comma() b.StripComma() b.ObjEnd() return nil @@ -1083,43 +901,19 @@ func (l *LinkPreviewTypeAudio) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (l *LinkPreviewTypeAudio) DecodeTDLibJSON(b tdjson.Decoder) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeAudio#572c6b78 to nil") + return fmt.Errorf("can't decode linkPreviewTypeAudio#75e407d2 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("linkPreviewTypeAudio"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAudio#572c6b78: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAudio#572c6b78: field url: %w", err) - } - l.URL = value - case "mime_type": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAudio#572c6b78: field mime_type: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeAudio#75e407d2: %w", err) } - l.MimeType = value case "audio": if err := l.Audio.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAudio#572c6b78: field audio: %w", err) - } - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAudio#572c6b78: field duration: %w", err) - } - l.Duration = value - case "author": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAudio#572c6b78: field author: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeAudio#75e407d2: field audio: %w", err) } - l.Author = value default: return b.Skip() } @@ -1127,22 +921,6 @@ func (l *LinkPreviewTypeAudio) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetURL returns value of URL field. -func (l *LinkPreviewTypeAudio) GetURL() (value string) { - if l == nil { - return - } - return l.URL -} - -// GetMimeType returns value of MimeType field. -func (l *LinkPreviewTypeAudio) GetMimeType() (value string) { - if l == nil { - return - } - return l.MimeType -} - // GetAudio returns value of Audio field. func (l *LinkPreviewTypeAudio) GetAudio() (value Audio) { if l == nil { @@ -1151,22 +929,6 @@ func (l *LinkPreviewTypeAudio) GetAudio() (value Audio) { return l.Audio } -// GetDuration returns value of Duration field. -func (l *LinkPreviewTypeAudio) GetDuration() (value int32) { - if l == nil { - return - } - return l.Duration -} - -// GetAuthor returns value of Author field. -func (l *LinkPreviewTypeAudio) GetAuthor() (value string) { - if l == nil { - return - } - return l.Author -} - // LinkPreviewTypeBackground represents TL type `linkPreviewTypeBackground#3a48a1e0`. type LinkPreviewTypeBackground struct { // Document with the background; may be null for filled backgrounds @@ -1787,16 +1549,14 @@ func (l *LinkPreviewTypeChat) GetCreatesJoinRequest() (value bool) { return l.CreatesJoinRequest } -// LinkPreviewTypeDocument represents TL type `linkPreviewTypeDocument#53b02747`. +// LinkPreviewTypeDocument represents TL type `linkPreviewTypeDocument#bf0169a2`. type LinkPreviewTypeDocument struct { // The document description Document Document - // Author of the document - Author string } // LinkPreviewTypeDocumentTypeID is TL type id of LinkPreviewTypeDocument. -const LinkPreviewTypeDocumentTypeID = 0x53b02747 +const LinkPreviewTypeDocumentTypeID = 0xbf0169a2 // construct implements constructor of LinkPreviewTypeClass. func (l LinkPreviewTypeDocument) construct() LinkPreviewTypeClass { return &l } @@ -1818,9 +1578,6 @@ func (l *LinkPreviewTypeDocument) Zero() bool { if !(l.Document.Zero()) { return false } - if !(l.Author == "") { - return false - } return true } @@ -1861,10 +1618,6 @@ func (l *LinkPreviewTypeDocument) TypeInfo() tdp.Type { Name: "Document", SchemaName: "document", }, - { - Name: "Author", - SchemaName: "author", - }, } return typ } @@ -1872,7 +1625,7 @@ func (l *LinkPreviewTypeDocument) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (l *LinkPreviewTypeDocument) Encode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeDocument#53b02747 as nil") + return fmt.Errorf("can't encode linkPreviewTypeDocument#bf0169a2 as nil") } b.PutID(LinkPreviewTypeDocumentTypeID) return l.EncodeBare(b) @@ -1881,22 +1634,21 @@ func (l *LinkPreviewTypeDocument) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (l *LinkPreviewTypeDocument) EncodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeDocument#53b02747 as nil") + return fmt.Errorf("can't encode linkPreviewTypeDocument#bf0169a2 as nil") } if err := l.Document.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeDocument#53b02747: field document: %w", err) + return fmt.Errorf("unable to encode linkPreviewTypeDocument#bf0169a2: field document: %w", err) } - b.PutString(l.Author) return nil } // Decode implements bin.Decoder. func (l *LinkPreviewTypeDocument) Decode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeDocument#53b02747 to nil") + return fmt.Errorf("can't decode linkPreviewTypeDocument#bf0169a2 to nil") } if err := b.ConsumeID(LinkPreviewTypeDocumentTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeDocument#53b02747: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeDocument#bf0169a2: %w", err) } return l.DecodeBare(b) } @@ -1904,39 +1656,29 @@ func (l *LinkPreviewTypeDocument) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (l *LinkPreviewTypeDocument) DecodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeDocument#53b02747 to nil") + return fmt.Errorf("can't decode linkPreviewTypeDocument#bf0169a2 to nil") } { if err := l.Document.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeDocument#53b02747: field document: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeDocument#bf0169a2: field document: %w", err) } } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeDocument#53b02747: field author: %w", err) - } - l.Author = value - } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (l *LinkPreviewTypeDocument) EncodeTDLibJSON(b tdjson.Encoder) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeDocument#53b02747 as nil") + return fmt.Errorf("can't encode linkPreviewTypeDocument#bf0169a2 as nil") } b.ObjStart() b.PutID("linkPreviewTypeDocument") b.Comma() b.FieldStart("document") if err := l.Document.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeDocument#53b02747: field document: %w", err) + return fmt.Errorf("unable to encode linkPreviewTypeDocument#bf0169a2: field document: %w", err) } b.Comma() - b.FieldStart("author") - b.PutString(l.Author) - b.Comma() b.StripComma() b.ObjEnd() return nil @@ -1945,25 +1687,19 @@ func (l *LinkPreviewTypeDocument) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (l *LinkPreviewTypeDocument) DecodeTDLibJSON(b tdjson.Decoder) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeDocument#53b02747 to nil") + return fmt.Errorf("can't decode linkPreviewTypeDocument#bf0169a2 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("linkPreviewTypeDocument"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeDocument#53b02747: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeDocument#bf0169a2: %w", err) } case "document": if err := l.Document.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeDocument#53b02747: field document: %w", err) - } - case "author": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeDocument#53b02747: field author: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeDocument#bf0169a2: field document: %w", err) } - l.Author = value default: return b.Skip() } @@ -1979,15 +1715,7 @@ func (l *LinkPreviewTypeDocument) GetDocument() (value Document) { return l.Document } -// GetAuthor returns value of Author field. -func (l *LinkPreviewTypeDocument) GetAuthor() (value string) { - if l == nil { - return - } - return l.Author -} - -// LinkPreviewTypeEmbeddedAnimationPlayer represents TL type `linkPreviewTypeEmbeddedAnimationPlayer#c45fddca`. +// LinkPreviewTypeEmbeddedAnimationPlayer represents TL type `linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605`. type LinkPreviewTypeEmbeddedAnimationPlayer struct { // URL of the external animation player URL string @@ -1995,8 +1723,6 @@ type LinkPreviewTypeEmbeddedAnimationPlayer struct { Thumbnail Photo // Duration of the animation, in seconds Duration int32 - // Author of the animation - Author string // Expected width of the embedded player Width int32 // Expected height of the embedded player @@ -2004,7 +1730,7 @@ type LinkPreviewTypeEmbeddedAnimationPlayer struct { } // LinkPreviewTypeEmbeddedAnimationPlayerTypeID is TL type id of LinkPreviewTypeEmbeddedAnimationPlayer. -const LinkPreviewTypeEmbeddedAnimationPlayerTypeID = 0xc45fddca +const LinkPreviewTypeEmbeddedAnimationPlayerTypeID = 0xaa5ad605 // construct implements constructor of LinkPreviewTypeClass. func (l LinkPreviewTypeEmbeddedAnimationPlayer) construct() LinkPreviewTypeClass { return &l } @@ -2032,9 +1758,6 @@ func (l *LinkPreviewTypeEmbeddedAnimationPlayer) Zero() bool { if !(l.Duration == 0) { return false } - if !(l.Author == "") { - return false - } if !(l.Width == 0) { return false } @@ -2089,10 +1812,6 @@ func (l *LinkPreviewTypeEmbeddedAnimationPlayer) TypeInfo() tdp.Type { Name: "Duration", SchemaName: "duration", }, - { - Name: "Author", - SchemaName: "author", - }, { Name: "Width", SchemaName: "width", @@ -2108,7 +1827,7 @@ func (l *LinkPreviewTypeEmbeddedAnimationPlayer) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (l *LinkPreviewTypeEmbeddedAnimationPlayer) Encode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca as nil") + return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605 as nil") } b.PutID(LinkPreviewTypeEmbeddedAnimationPlayerTypeID) return l.EncodeBare(b) @@ -2117,14 +1836,13 @@ func (l *LinkPreviewTypeEmbeddedAnimationPlayer) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (l *LinkPreviewTypeEmbeddedAnimationPlayer) EncodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca as nil") + return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605 as nil") } b.PutString(l.URL) if err := l.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field thumbnail: %w", err) + return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field thumbnail: %w", err) } b.PutInt32(l.Duration) - b.PutString(l.Author) b.PutInt32(l.Width) b.PutInt32(l.Height) return nil @@ -2133,10 +1851,10 @@ func (l *LinkPreviewTypeEmbeddedAnimationPlayer) EncodeBare(b *bin.Buffer) error // Decode implements bin.Decoder. func (l *LinkPreviewTypeEmbeddedAnimationPlayer) Decode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca to nil") + return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605 to nil") } if err := b.ConsumeID(LinkPreviewTypeEmbeddedAnimationPlayerTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: %w", err) } return l.DecodeBare(b) } @@ -2144,45 +1862,38 @@ func (l *LinkPreviewTypeEmbeddedAnimationPlayer) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (l *LinkPreviewTypeEmbeddedAnimationPlayer) DecodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca to nil") + return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605 to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field url: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field url: %w", err) } l.URL = value } { if err := l.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field thumbnail: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field thumbnail: %w", err) } } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field duration: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field duration: %w", err) } l.Duration = value } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field author: %w", err) - } - l.Author = value - } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field width: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field width: %w", err) } l.Width = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field height: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field height: %w", err) } l.Height = value } @@ -2192,7 +1903,7 @@ func (l *LinkPreviewTypeEmbeddedAnimationPlayer) DecodeBare(b *bin.Buffer) error // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (l *LinkPreviewTypeEmbeddedAnimationPlayer) EncodeTDLibJSON(b tdjson.Encoder) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca as nil") + return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605 as nil") } b.ObjStart() b.PutID("linkPreviewTypeEmbeddedAnimationPlayer") @@ -2202,15 +1913,12 @@ func (l *LinkPreviewTypeEmbeddedAnimationPlayer) EncodeTDLibJSON(b tdjson.Encode b.Comma() b.FieldStart("thumbnail") if err := l.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field thumbnail: %w", err) + return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field thumbnail: %w", err) } b.Comma() b.FieldStart("duration") b.PutInt32(l.Duration) b.Comma() - b.FieldStart("author") - b.PutString(l.Author) - b.Comma() b.FieldStart("width") b.PutInt32(l.Width) b.Comma() @@ -2225,47 +1933,41 @@ func (l *LinkPreviewTypeEmbeddedAnimationPlayer) EncodeTDLibJSON(b tdjson.Encode // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (l *LinkPreviewTypeEmbeddedAnimationPlayer) DecodeTDLibJSON(b tdjson.Decoder) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca to nil") + return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("linkPreviewTypeEmbeddedAnimationPlayer"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: %w", err) } case "url": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field url: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field url: %w", err) } l.URL = value case "thumbnail": if err := l.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field thumbnail: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field thumbnail: %w", err) } case "duration": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field duration: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field duration: %w", err) } l.Duration = value - case "author": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field author: %w", err) - } - l.Author = value case "width": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field width: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field width: %w", err) } l.Width = value case "height": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field height: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field height: %w", err) } l.Height = value default: @@ -2299,14 +2001,6 @@ func (l *LinkPreviewTypeEmbeddedAnimationPlayer) GetDuration() (value int32) { return l.Duration } -// GetAuthor returns value of Author field. -func (l *LinkPreviewTypeEmbeddedAnimationPlayer) GetAuthor() (value string) { - if l == nil { - return - } - return l.Author -} - // GetWidth returns value of Width field. func (l *LinkPreviewTypeEmbeddedAnimationPlayer) GetWidth() (value int32) { if l == nil { @@ -2323,7 +2017,7 @@ func (l *LinkPreviewTypeEmbeddedAnimationPlayer) GetHeight() (value int32) { return l.Height } -// LinkPreviewTypeEmbeddedAudioPlayer represents TL type `linkPreviewTypeEmbeddedAudioPlayer#31e0dae6`. +// LinkPreviewTypeEmbeddedAudioPlayer represents TL type `linkPreviewTypeEmbeddedAudioPlayer#220b429c`. type LinkPreviewTypeEmbeddedAudioPlayer struct { // URL of the external audio player URL string @@ -2331,8 +2025,6 @@ type LinkPreviewTypeEmbeddedAudioPlayer struct { Thumbnail Photo // Duration of the audio, in seconds Duration int32 - // Author of the audio - Author string // Expected width of the embedded player Width int32 // Expected height of the embedded player @@ -2340,7 +2032,7 @@ type LinkPreviewTypeEmbeddedAudioPlayer struct { } // LinkPreviewTypeEmbeddedAudioPlayerTypeID is TL type id of LinkPreviewTypeEmbeddedAudioPlayer. -const LinkPreviewTypeEmbeddedAudioPlayerTypeID = 0x31e0dae6 +const LinkPreviewTypeEmbeddedAudioPlayerTypeID = 0x220b429c // construct implements constructor of LinkPreviewTypeClass. func (l LinkPreviewTypeEmbeddedAudioPlayer) construct() LinkPreviewTypeClass { return &l } @@ -2368,9 +2060,6 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) Zero() bool { if !(l.Duration == 0) { return false } - if !(l.Author == "") { - return false - } if !(l.Width == 0) { return false } @@ -2425,10 +2114,6 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) TypeInfo() tdp.Type { Name: "Duration", SchemaName: "duration", }, - { - Name: "Author", - SchemaName: "author", - }, { Name: "Width", SchemaName: "width", @@ -2444,7 +2129,7 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (l *LinkPreviewTypeEmbeddedAudioPlayer) Encode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6 as nil") + return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAudioPlayer#220b429c as nil") } b.PutID(LinkPreviewTypeEmbeddedAudioPlayerTypeID) return l.EncodeBare(b) @@ -2453,14 +2138,13 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (l *LinkPreviewTypeEmbeddedAudioPlayer) EncodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6 as nil") + return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAudioPlayer#220b429c as nil") } b.PutString(l.URL) if err := l.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field thumbnail: %w", err) + return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field thumbnail: %w", err) } b.PutInt32(l.Duration) - b.PutString(l.Author) b.PutInt32(l.Width) b.PutInt32(l.Height) return nil @@ -2469,10 +2153,10 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (l *LinkPreviewTypeEmbeddedAudioPlayer) Decode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6 to nil") + return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAudioPlayer#220b429c to nil") } if err := b.ConsumeID(LinkPreviewTypeEmbeddedAudioPlayerTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: %w", err) } return l.DecodeBare(b) } @@ -2480,45 +2164,38 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (l *LinkPreviewTypeEmbeddedAudioPlayer) DecodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6 to nil") + return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAudioPlayer#220b429c to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field url: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field url: %w", err) } l.URL = value } { if err := l.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field thumbnail: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field thumbnail: %w", err) } } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field duration: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field duration: %w", err) } l.Duration = value } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field author: %w", err) - } - l.Author = value - } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field width: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field width: %w", err) } l.Width = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field height: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field height: %w", err) } l.Height = value } @@ -2528,7 +2205,7 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (l *LinkPreviewTypeEmbeddedAudioPlayer) EncodeTDLibJSON(b tdjson.Encoder) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6 as nil") + return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAudioPlayer#220b429c as nil") } b.ObjStart() b.PutID("linkPreviewTypeEmbeddedAudioPlayer") @@ -2538,15 +2215,12 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) EncodeTDLibJSON(b tdjson.Encoder) e b.Comma() b.FieldStart("thumbnail") if err := l.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field thumbnail: %w", err) + return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field thumbnail: %w", err) } b.Comma() b.FieldStart("duration") b.PutInt32(l.Duration) b.Comma() - b.FieldStart("author") - b.PutString(l.Author) - b.Comma() b.FieldStart("width") b.PutInt32(l.Width) b.Comma() @@ -2561,47 +2235,41 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) EncodeTDLibJSON(b tdjson.Encoder) e // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (l *LinkPreviewTypeEmbeddedAudioPlayer) DecodeTDLibJSON(b tdjson.Decoder) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6 to nil") + return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAudioPlayer#220b429c to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("linkPreviewTypeEmbeddedAudioPlayer"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: %w", err) } case "url": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field url: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field url: %w", err) } l.URL = value case "thumbnail": if err := l.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field thumbnail: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field thumbnail: %w", err) } case "duration": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field duration: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field duration: %w", err) } l.Duration = value - case "author": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field author: %w", err) - } - l.Author = value case "width": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field width: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field width: %w", err) } l.Width = value case "height": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field height: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field height: %w", err) } l.Height = value default: @@ -2635,14 +2303,6 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) GetDuration() (value int32) { return l.Duration } -// GetAuthor returns value of Author field. -func (l *LinkPreviewTypeEmbeddedAudioPlayer) GetAuthor() (value string) { - if l == nil { - return - } - return l.Author -} - // GetWidth returns value of Width field. func (l *LinkPreviewTypeEmbeddedAudioPlayer) GetWidth() (value int32) { if l == nil { @@ -2659,7 +2319,7 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) GetHeight() (value int32) { return l.Height } -// LinkPreviewTypeEmbeddedVideoPlayer represents TL type `linkPreviewTypeEmbeddedVideoPlayer#6ee015a3`. +// LinkPreviewTypeEmbeddedVideoPlayer represents TL type `linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03`. type LinkPreviewTypeEmbeddedVideoPlayer struct { // URL of the external video player URL string @@ -2667,8 +2327,6 @@ type LinkPreviewTypeEmbeddedVideoPlayer struct { Thumbnail Photo // Duration of the video, in seconds Duration int32 - // Author of the video - Author string // Expected width of the embedded player Width int32 // Expected height of the embedded player @@ -2676,7 +2334,7 @@ type LinkPreviewTypeEmbeddedVideoPlayer struct { } // LinkPreviewTypeEmbeddedVideoPlayerTypeID is TL type id of LinkPreviewTypeEmbeddedVideoPlayer. -const LinkPreviewTypeEmbeddedVideoPlayerTypeID = 0x6ee015a3 +const LinkPreviewTypeEmbeddedVideoPlayerTypeID = 0xa7bfbb03 // construct implements constructor of LinkPreviewTypeClass. func (l LinkPreviewTypeEmbeddedVideoPlayer) construct() LinkPreviewTypeClass { return &l } @@ -2704,9 +2362,6 @@ func (l *LinkPreviewTypeEmbeddedVideoPlayer) Zero() bool { if !(l.Duration == 0) { return false } - if !(l.Author == "") { - return false - } if !(l.Width == 0) { return false } @@ -2761,10 +2416,6 @@ func (l *LinkPreviewTypeEmbeddedVideoPlayer) TypeInfo() tdp.Type { Name: "Duration", SchemaName: "duration", }, - { - Name: "Author", - SchemaName: "author", - }, { Name: "Width", SchemaName: "width", @@ -2780,7 +2431,7 @@ func (l *LinkPreviewTypeEmbeddedVideoPlayer) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (l *LinkPreviewTypeEmbeddedVideoPlayer) Encode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3 as nil") + return fmt.Errorf("can't encode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03 as nil") } b.PutID(LinkPreviewTypeEmbeddedVideoPlayerTypeID) return l.EncodeBare(b) @@ -2789,14 +2440,13 @@ func (l *LinkPreviewTypeEmbeddedVideoPlayer) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (l *LinkPreviewTypeEmbeddedVideoPlayer) EncodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3 as nil") + return fmt.Errorf("can't encode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03 as nil") } b.PutString(l.URL) if err := l.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field thumbnail: %w", err) + return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field thumbnail: %w", err) } b.PutInt32(l.Duration) - b.PutString(l.Author) b.PutInt32(l.Width) b.PutInt32(l.Height) return nil @@ -2805,10 +2455,10 @@ func (l *LinkPreviewTypeEmbeddedVideoPlayer) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (l *LinkPreviewTypeEmbeddedVideoPlayer) Decode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3 to nil") + return fmt.Errorf("can't decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03 to nil") } if err := b.ConsumeID(LinkPreviewTypeEmbeddedVideoPlayerTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: %w", err) } return l.DecodeBare(b) } @@ -2816,45 +2466,38 @@ func (l *LinkPreviewTypeEmbeddedVideoPlayer) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (l *LinkPreviewTypeEmbeddedVideoPlayer) DecodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3 to nil") + return fmt.Errorf("can't decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03 to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field url: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field url: %w", err) } l.URL = value } { if err := l.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field thumbnail: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field thumbnail: %w", err) } } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field duration: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field duration: %w", err) } l.Duration = value } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field author: %w", err) - } - l.Author = value - } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field width: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field width: %w", err) } l.Width = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field height: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field height: %w", err) } l.Height = value } @@ -2864,7 +2507,7 @@ func (l *LinkPreviewTypeEmbeddedVideoPlayer) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (l *LinkPreviewTypeEmbeddedVideoPlayer) EncodeTDLibJSON(b tdjson.Encoder) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3 as nil") + return fmt.Errorf("can't encode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03 as nil") } b.ObjStart() b.PutID("linkPreviewTypeEmbeddedVideoPlayer") @@ -2874,14 +2517,542 @@ func (l *LinkPreviewTypeEmbeddedVideoPlayer) EncodeTDLibJSON(b tdjson.Encoder) e b.Comma() b.FieldStart("thumbnail") if err := l.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field thumbnail: %w", err) + return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field thumbnail: %w", err) + } + b.Comma() + b.FieldStart("duration") + b.PutInt32(l.Duration) + b.Comma() + b.FieldStart("width") + b.PutInt32(l.Width) + b.Comma() + b.FieldStart("height") + b.PutInt32(l.Height) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (l *LinkPreviewTypeEmbeddedVideoPlayer) DecodeTDLibJSON(b tdjson.Decoder) error { + if l == nil { + return fmt.Errorf("can't decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03 to nil") } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("linkPreviewTypeEmbeddedVideoPlayer"); err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: %w", err) + } + case "url": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field url: %w", err) + } + l.URL = value + case "thumbnail": + if err := l.Thumbnail.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field thumbnail: %w", err) + } + case "duration": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field duration: %w", err) + } + l.Duration = value + case "width": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field width: %w", err) + } + l.Width = value + case "height": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field height: %w", err) + } + l.Height = value + default: + return b.Skip() + } + return nil + }) +} + +// GetURL returns value of URL field. +func (l *LinkPreviewTypeEmbeddedVideoPlayer) GetURL() (value string) { + if l == nil { + return + } + return l.URL +} + +// GetThumbnail returns value of Thumbnail field. +func (l *LinkPreviewTypeEmbeddedVideoPlayer) GetThumbnail() (value Photo) { + if l == nil { + return + } + return l.Thumbnail +} + +// GetDuration returns value of Duration field. +func (l *LinkPreviewTypeEmbeddedVideoPlayer) GetDuration() (value int32) { + if l == nil { + return + } + return l.Duration +} + +// GetWidth returns value of Width field. +func (l *LinkPreviewTypeEmbeddedVideoPlayer) GetWidth() (value int32) { + if l == nil { + return + } + return l.Width +} + +// GetHeight returns value of Height field. +func (l *LinkPreviewTypeEmbeddedVideoPlayer) GetHeight() (value int32) { + if l == nil { + return + } + return l.Height +} + +// LinkPreviewTypeExternalAudio represents TL type `linkPreviewTypeExternalAudio#8a82ffed`. +type LinkPreviewTypeExternalAudio struct { + // URL of the audio file + URL string + // MIME type of the audio file + MimeType string + // Duration of the audio, in seconds; 0 if unknown + Duration int32 +} + +// LinkPreviewTypeExternalAudioTypeID is TL type id of LinkPreviewTypeExternalAudio. +const LinkPreviewTypeExternalAudioTypeID = 0x8a82ffed + +// construct implements constructor of LinkPreviewTypeClass. +func (l LinkPreviewTypeExternalAudio) construct() LinkPreviewTypeClass { return &l } + +// Ensuring interfaces in compile-time for LinkPreviewTypeExternalAudio. +var ( + _ bin.Encoder = &LinkPreviewTypeExternalAudio{} + _ bin.Decoder = &LinkPreviewTypeExternalAudio{} + _ bin.BareEncoder = &LinkPreviewTypeExternalAudio{} + _ bin.BareDecoder = &LinkPreviewTypeExternalAudio{} + + _ LinkPreviewTypeClass = &LinkPreviewTypeExternalAudio{} +) + +func (l *LinkPreviewTypeExternalAudio) Zero() bool { + if l == nil { + return true + } + if !(l.URL == "") { + return false + } + if !(l.MimeType == "") { + return false + } + if !(l.Duration == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (l *LinkPreviewTypeExternalAudio) String() string { + if l == nil { + return "LinkPreviewTypeExternalAudio(nil)" + } + type Alias LinkPreviewTypeExternalAudio + return fmt.Sprintf("LinkPreviewTypeExternalAudio%+v", Alias(*l)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*LinkPreviewTypeExternalAudio) TypeID() uint32 { + return LinkPreviewTypeExternalAudioTypeID +} + +// TypeName returns name of type in TL schema. +func (*LinkPreviewTypeExternalAudio) TypeName() string { + return "linkPreviewTypeExternalAudio" +} + +// TypeInfo returns info about TL type. +func (l *LinkPreviewTypeExternalAudio) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "linkPreviewTypeExternalAudio", + ID: LinkPreviewTypeExternalAudioTypeID, + } + if l == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "URL", + SchemaName: "url", + }, + { + Name: "MimeType", + SchemaName: "mime_type", + }, + { + Name: "Duration", + SchemaName: "duration", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (l *LinkPreviewTypeExternalAudio) Encode(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't encode linkPreviewTypeExternalAudio#8a82ffed as nil") + } + b.PutID(LinkPreviewTypeExternalAudioTypeID) + return l.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (l *LinkPreviewTypeExternalAudio) EncodeBare(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't encode linkPreviewTypeExternalAudio#8a82ffed as nil") + } + b.PutString(l.URL) + b.PutString(l.MimeType) + b.PutInt32(l.Duration) + return nil +} + +// Decode implements bin.Decoder. +func (l *LinkPreviewTypeExternalAudio) Decode(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't decode linkPreviewTypeExternalAudio#8a82ffed to nil") + } + if err := b.ConsumeID(LinkPreviewTypeExternalAudioTypeID); err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeExternalAudio#8a82ffed: %w", err) + } + return l.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (l *LinkPreviewTypeExternalAudio) DecodeBare(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't decode linkPreviewTypeExternalAudio#8a82ffed to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeExternalAudio#8a82ffed: field url: %w", err) + } + l.URL = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeExternalAudio#8a82ffed: field mime_type: %w", err) + } + l.MimeType = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeExternalAudio#8a82ffed: field duration: %w", err) + } + l.Duration = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (l *LinkPreviewTypeExternalAudio) EncodeTDLibJSON(b tdjson.Encoder) error { + if l == nil { + return fmt.Errorf("can't encode linkPreviewTypeExternalAudio#8a82ffed as nil") + } + b.ObjStart() + b.PutID("linkPreviewTypeExternalAudio") + b.Comma() + b.FieldStart("url") + b.PutString(l.URL) + b.Comma() + b.FieldStart("mime_type") + b.PutString(l.MimeType) + b.Comma() + b.FieldStart("duration") + b.PutInt32(l.Duration) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (l *LinkPreviewTypeExternalAudio) DecodeTDLibJSON(b tdjson.Decoder) error { + if l == nil { + return fmt.Errorf("can't decode linkPreviewTypeExternalAudio#8a82ffed to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("linkPreviewTypeExternalAudio"); err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeExternalAudio#8a82ffed: %w", err) + } + case "url": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeExternalAudio#8a82ffed: field url: %w", err) + } + l.URL = value + case "mime_type": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeExternalAudio#8a82ffed: field mime_type: %w", err) + } + l.MimeType = value + case "duration": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeExternalAudio#8a82ffed: field duration: %w", err) + } + l.Duration = value + default: + return b.Skip() + } + return nil + }) +} + +// GetURL returns value of URL field. +func (l *LinkPreviewTypeExternalAudio) GetURL() (value string) { + if l == nil { + return + } + return l.URL +} + +// GetMimeType returns value of MimeType field. +func (l *LinkPreviewTypeExternalAudio) GetMimeType() (value string) { + if l == nil { + return + } + return l.MimeType +} + +// GetDuration returns value of Duration field. +func (l *LinkPreviewTypeExternalAudio) GetDuration() (value int32) { + if l == nil { + return + } + return l.Duration +} + +// LinkPreviewTypeExternalVideo represents TL type `linkPreviewTypeExternalVideo#517dcb98`. +type LinkPreviewTypeExternalVideo struct { + // URL of the video file + URL string + // MIME type of the video file + MimeType string + // Expected width of the video preview; 0 if unknown + Width int32 + // Expected height of the video preview; 0 if unknown + Height int32 + // Duration of the video, in seconds; 0 if unknown + Duration int32 +} + +// LinkPreviewTypeExternalVideoTypeID is TL type id of LinkPreviewTypeExternalVideo. +const LinkPreviewTypeExternalVideoTypeID = 0x517dcb98 + +// construct implements constructor of LinkPreviewTypeClass. +func (l LinkPreviewTypeExternalVideo) construct() LinkPreviewTypeClass { return &l } + +// Ensuring interfaces in compile-time for LinkPreviewTypeExternalVideo. +var ( + _ bin.Encoder = &LinkPreviewTypeExternalVideo{} + _ bin.Decoder = &LinkPreviewTypeExternalVideo{} + _ bin.BareEncoder = &LinkPreviewTypeExternalVideo{} + _ bin.BareDecoder = &LinkPreviewTypeExternalVideo{} + + _ LinkPreviewTypeClass = &LinkPreviewTypeExternalVideo{} +) + +func (l *LinkPreviewTypeExternalVideo) Zero() bool { + if l == nil { + return true + } + if !(l.URL == "") { + return false + } + if !(l.MimeType == "") { + return false + } + if !(l.Width == 0) { + return false + } + if !(l.Height == 0) { + return false + } + if !(l.Duration == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (l *LinkPreviewTypeExternalVideo) String() string { + if l == nil { + return "LinkPreviewTypeExternalVideo(nil)" + } + type Alias LinkPreviewTypeExternalVideo + return fmt.Sprintf("LinkPreviewTypeExternalVideo%+v", Alias(*l)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*LinkPreviewTypeExternalVideo) TypeID() uint32 { + return LinkPreviewTypeExternalVideoTypeID +} + +// TypeName returns name of type in TL schema. +func (*LinkPreviewTypeExternalVideo) TypeName() string { + return "linkPreviewTypeExternalVideo" +} + +// TypeInfo returns info about TL type. +func (l *LinkPreviewTypeExternalVideo) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "linkPreviewTypeExternalVideo", + ID: LinkPreviewTypeExternalVideoTypeID, + } + if l == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "URL", + SchemaName: "url", + }, + { + Name: "MimeType", + SchemaName: "mime_type", + }, + { + Name: "Width", + SchemaName: "width", + }, + { + Name: "Height", + SchemaName: "height", + }, + { + Name: "Duration", + SchemaName: "duration", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (l *LinkPreviewTypeExternalVideo) Encode(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't encode linkPreviewTypeExternalVideo#517dcb98 as nil") + } + b.PutID(LinkPreviewTypeExternalVideoTypeID) + return l.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (l *LinkPreviewTypeExternalVideo) EncodeBare(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't encode linkPreviewTypeExternalVideo#517dcb98 as nil") + } + b.PutString(l.URL) + b.PutString(l.MimeType) + b.PutInt32(l.Width) + b.PutInt32(l.Height) + b.PutInt32(l.Duration) + return nil +} + +// Decode implements bin.Decoder. +func (l *LinkPreviewTypeExternalVideo) Decode(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't decode linkPreviewTypeExternalVideo#517dcb98 to nil") + } + if err := b.ConsumeID(LinkPreviewTypeExternalVideoTypeID); err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: %w", err) + } + return l.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (l *LinkPreviewTypeExternalVideo) DecodeBare(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't decode linkPreviewTypeExternalVideo#517dcb98 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: field url: %w", err) + } + l.URL = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: field mime_type: %w", err) + } + l.MimeType = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: field width: %w", err) + } + l.Width = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: field height: %w", err) + } + l.Height = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: field duration: %w", err) + } + l.Duration = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (l *LinkPreviewTypeExternalVideo) EncodeTDLibJSON(b tdjson.Encoder) error { + if l == nil { + return fmt.Errorf("can't encode linkPreviewTypeExternalVideo#517dcb98 as nil") + } + b.ObjStart() + b.PutID("linkPreviewTypeExternalVideo") b.Comma() - b.FieldStart("duration") - b.PutInt32(l.Duration) + b.FieldStart("url") + b.PutString(l.URL) b.Comma() - b.FieldStart("author") - b.PutString(l.Author) + b.FieldStart("mime_type") + b.PutString(l.MimeType) b.Comma() b.FieldStart("width") b.PutInt32(l.Width) @@ -2889,57 +3060,56 @@ func (l *LinkPreviewTypeEmbeddedVideoPlayer) EncodeTDLibJSON(b tdjson.Encoder) e b.FieldStart("height") b.PutInt32(l.Height) b.Comma() + b.FieldStart("duration") + b.PutInt32(l.Duration) + b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeEmbeddedVideoPlayer) DecodeTDLibJSON(b tdjson.Decoder) error { +func (l *LinkPreviewTypeExternalVideo) DecodeTDLibJSON(b tdjson.Decoder) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3 to nil") + return fmt.Errorf("can't decode linkPreviewTypeExternalVideo#517dcb98 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeEmbeddedVideoPlayer"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: %w", err) + if err := b.ConsumeID("linkPreviewTypeExternalVideo"); err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: %w", err) } case "url": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field url: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: field url: %w", err) } l.URL = value - case "thumbnail": - if err := l.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field thumbnail: %w", err) - } - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field duration: %w", err) - } - l.Duration = value - case "author": + case "mime_type": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field author: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: field mime_type: %w", err) } - l.Author = value + l.MimeType = value case "width": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field width: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: field width: %w", err) } l.Width = value case "height": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field height: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: field height: %w", err) } l.Height = value + case "duration": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: field duration: %w", err) + } + l.Duration = value default: return b.Skip() } @@ -2948,51 +3118,43 @@ func (l *LinkPreviewTypeEmbeddedVideoPlayer) DecodeTDLibJSON(b tdjson.Decoder) e } // GetURL returns value of URL field. -func (l *LinkPreviewTypeEmbeddedVideoPlayer) GetURL() (value string) { +func (l *LinkPreviewTypeExternalVideo) GetURL() (value string) { if l == nil { return } return l.URL } -// GetThumbnail returns value of Thumbnail field. -func (l *LinkPreviewTypeEmbeddedVideoPlayer) GetThumbnail() (value Photo) { - if l == nil { - return - } - return l.Thumbnail -} - -// GetDuration returns value of Duration field. -func (l *LinkPreviewTypeEmbeddedVideoPlayer) GetDuration() (value int32) { +// GetMimeType returns value of MimeType field. +func (l *LinkPreviewTypeExternalVideo) GetMimeType() (value string) { if l == nil { return } - return l.Duration + return l.MimeType } -// GetAuthor returns value of Author field. -func (l *LinkPreviewTypeEmbeddedVideoPlayer) GetAuthor() (value string) { +// GetWidth returns value of Width field. +func (l *LinkPreviewTypeExternalVideo) GetWidth() (value int32) { if l == nil { return } - return l.Author + return l.Width } -// GetWidth returns value of Width field. -func (l *LinkPreviewTypeEmbeddedVideoPlayer) GetWidth() (value int32) { +// GetHeight returns value of Height field. +func (l *LinkPreviewTypeExternalVideo) GetHeight() (value int32) { if l == nil { return } - return l.Width + return l.Height } -// GetHeight returns value of Height field. -func (l *LinkPreviewTypeEmbeddedVideoPlayer) GetHeight() (value int32) { +// GetDuration returns value of Duration field. +func (l *LinkPreviewTypeExternalVideo) GetDuration() (value int32) { if l == nil { return } - return l.Height + return l.Duration } // LinkPreviewTypeInvoice represents TL type `linkPreviewTypeInvoice#d47f48da`. @@ -3257,16 +3419,14 @@ func (l *LinkPreviewTypeMessage) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// LinkPreviewTypePhoto represents TL type `linkPreviewTypePhoto#eeebbab0`. +// LinkPreviewTypePhoto represents TL type `linkPreviewTypePhoto#aecfaaac`. type LinkPreviewTypePhoto struct { // The photo Photo Photo - // Author of the photo - Author string } // LinkPreviewTypePhotoTypeID is TL type id of LinkPreviewTypePhoto. -const LinkPreviewTypePhotoTypeID = 0xeeebbab0 +const LinkPreviewTypePhotoTypeID = 0xaecfaaac // construct implements constructor of LinkPreviewTypeClass. func (l LinkPreviewTypePhoto) construct() LinkPreviewTypeClass { return &l } @@ -3288,9 +3448,6 @@ func (l *LinkPreviewTypePhoto) Zero() bool { if !(l.Photo.Zero()) { return false } - if !(l.Author == "") { - return false - } return true } @@ -3331,10 +3488,6 @@ func (l *LinkPreviewTypePhoto) TypeInfo() tdp.Type { Name: "Photo", SchemaName: "photo", }, - { - Name: "Author", - SchemaName: "author", - }, } return typ } @@ -3342,7 +3495,7 @@ func (l *LinkPreviewTypePhoto) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (l *LinkPreviewTypePhoto) Encode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypePhoto#eeebbab0 as nil") + return fmt.Errorf("can't encode linkPreviewTypePhoto#aecfaaac as nil") } b.PutID(LinkPreviewTypePhotoTypeID) return l.EncodeBare(b) @@ -3351,22 +3504,21 @@ func (l *LinkPreviewTypePhoto) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (l *LinkPreviewTypePhoto) EncodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypePhoto#eeebbab0 as nil") + return fmt.Errorf("can't encode linkPreviewTypePhoto#aecfaaac as nil") } if err := l.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypePhoto#eeebbab0: field photo: %w", err) + return fmt.Errorf("unable to encode linkPreviewTypePhoto#aecfaaac: field photo: %w", err) } - b.PutString(l.Author) return nil } // Decode implements bin.Decoder. func (l *LinkPreviewTypePhoto) Decode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypePhoto#eeebbab0 to nil") + return fmt.Errorf("can't decode linkPreviewTypePhoto#aecfaaac to nil") } if err := b.ConsumeID(LinkPreviewTypePhotoTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypePhoto#eeebbab0: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypePhoto#aecfaaac: %w", err) } return l.DecodeBare(b) } @@ -3374,39 +3526,29 @@ func (l *LinkPreviewTypePhoto) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (l *LinkPreviewTypePhoto) DecodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypePhoto#eeebbab0 to nil") + return fmt.Errorf("can't decode linkPreviewTypePhoto#aecfaaac to nil") } { if err := l.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypePhoto#eeebbab0: field photo: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypePhoto#aecfaaac: field photo: %w", err) } } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypePhoto#eeebbab0: field author: %w", err) - } - l.Author = value - } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (l *LinkPreviewTypePhoto) EncodeTDLibJSON(b tdjson.Encoder) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypePhoto#eeebbab0 as nil") + return fmt.Errorf("can't encode linkPreviewTypePhoto#aecfaaac as nil") } b.ObjStart() b.PutID("linkPreviewTypePhoto") b.Comma() b.FieldStart("photo") if err := l.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypePhoto#eeebbab0: field photo: %w", err) + return fmt.Errorf("unable to encode linkPreviewTypePhoto#aecfaaac: field photo: %w", err) } b.Comma() - b.FieldStart("author") - b.PutString(l.Author) - b.Comma() b.StripComma() b.ObjEnd() return nil @@ -3415,25 +3557,19 @@ func (l *LinkPreviewTypePhoto) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (l *LinkPreviewTypePhoto) DecodeTDLibJSON(b tdjson.Decoder) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypePhoto#eeebbab0 to nil") + return fmt.Errorf("can't decode linkPreviewTypePhoto#aecfaaac to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("linkPreviewTypePhoto"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypePhoto#eeebbab0: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypePhoto#aecfaaac: %w", err) } case "photo": if err := l.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypePhoto#eeebbab0: field photo: %w", err) - } - case "author": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypePhoto#eeebbab0: field author: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypePhoto#aecfaaac: field photo: %w", err) } - l.Author = value default: return b.Skip() } @@ -3449,14 +3585,6 @@ func (l *LinkPreviewTypePhoto) GetPhoto() (value Photo) { return l.Photo } -// GetAuthor returns value of Author field. -func (l *LinkPreviewTypePhoto) GetAuthor() (value string) { - if l == nil { - return - } - return l.Author -} - // LinkPreviewTypePremiumGiftCode represents TL type `linkPreviewTypePremiumGiftCode#4e0d80b1`. type LinkPreviewTypePremiumGiftCode struct { } @@ -5004,26 +5132,14 @@ func (l *LinkPreviewTypeUser) GetIsBot() (value bool) { return l.IsBot } -// LinkPreviewTypeVideo represents TL type `linkPreviewTypeVideo#2beebfbe`. +// LinkPreviewTypeVideo represents TL type `linkPreviewTypeVideo#10c9fc08`. type LinkPreviewTypeVideo struct { - // URL of the video; may be empty if none - URL string - // MIME type of the video file - MimeType string - // The video description; may be null if unknown + // The video description Video Video - // Expected width of the preview - Width int32 - // Expected height of the preview - Height int32 - // Duration of the video, in seconds; 0 if unknown - Duration int32 - // Author of the video - Author string } // LinkPreviewTypeVideoTypeID is TL type id of LinkPreviewTypeVideo. -const LinkPreviewTypeVideoTypeID = 0x2beebfbe +const LinkPreviewTypeVideoTypeID = 0x10c9fc08 // construct implements constructor of LinkPreviewTypeClass. func (l LinkPreviewTypeVideo) construct() LinkPreviewTypeClass { return &l } @@ -5042,27 +5158,9 @@ func (l *LinkPreviewTypeVideo) Zero() bool { if l == nil { return true } - if !(l.URL == "") { - return false - } - if !(l.MimeType == "") { - return false - } if !(l.Video.Zero()) { return false } - if !(l.Width == 0) { - return false - } - if !(l.Height == 0) { - return false - } - if !(l.Duration == 0) { - return false - } - if !(l.Author == "") { - return false - } return true } @@ -5099,34 +5197,10 @@ func (l *LinkPreviewTypeVideo) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "MimeType", - SchemaName: "mime_type", - }, { Name: "Video", SchemaName: "video", }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "Author", - SchemaName: "author", - }, } return typ } @@ -5134,7 +5208,7 @@ func (l *LinkPreviewTypeVideo) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (l *LinkPreviewTypeVideo) Encode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeVideo#2beebfbe as nil") + return fmt.Errorf("can't encode linkPreviewTypeVideo#10c9fc08 as nil") } b.PutID(LinkPreviewTypeVideoTypeID) return l.EncodeBare(b) @@ -5143,27 +5217,21 @@ func (l *LinkPreviewTypeVideo) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (l *LinkPreviewTypeVideo) EncodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeVideo#2beebfbe as nil") + return fmt.Errorf("can't encode linkPreviewTypeVideo#10c9fc08 as nil") } - b.PutString(l.URL) - b.PutString(l.MimeType) if err := l.Video.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeVideo#2beebfbe: field video: %w", err) + return fmt.Errorf("unable to encode linkPreviewTypeVideo#10c9fc08: field video: %w", err) } - b.PutInt32(l.Width) - b.PutInt32(l.Height) - b.PutInt32(l.Duration) - b.PutString(l.Author) return nil } // Decode implements bin.Decoder. func (l *LinkPreviewTypeVideo) Decode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeVideo#2beebfbe to nil") + return fmt.Errorf("can't decode linkPreviewTypeVideo#10c9fc08 to nil") } if err := b.ConsumeID(LinkPreviewTypeVideoTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideo#2beebfbe: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeVideo#10c9fc08: %w", err) } return l.DecodeBare(b) } @@ -5171,54 +5239,12 @@ func (l *LinkPreviewTypeVideo) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (l *LinkPreviewTypeVideo) DecodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeVideo#2beebfbe to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideo#2beebfbe: field url: %w", err) - } - l.URL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideo#2beebfbe: field mime_type: %w", err) - } - l.MimeType = value + return fmt.Errorf("can't decode linkPreviewTypeVideo#10c9fc08 to nil") } { if err := l.Video.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideo#2beebfbe: field video: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideo#2beebfbe: field width: %w", err) - } - l.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideo#2beebfbe: field height: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeVideo#10c9fc08: field video: %w", err) } - l.Height = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideo#2beebfbe: field duration: %w", err) - } - l.Duration = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideo#2beebfbe: field author: %w", err) - } - l.Author = value } return nil } @@ -5226,34 +5252,16 @@ func (l *LinkPreviewTypeVideo) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (l *LinkPreviewTypeVideo) EncodeTDLibJSON(b tdjson.Encoder) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeVideo#2beebfbe as nil") + return fmt.Errorf("can't encode linkPreviewTypeVideo#10c9fc08 as nil") } b.ObjStart() b.PutID("linkPreviewTypeVideo") b.Comma() - b.FieldStart("url") - b.PutString(l.URL) - b.Comma() - b.FieldStart("mime_type") - b.PutString(l.MimeType) - b.Comma() b.FieldStart("video") if err := l.Video.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeVideo#2beebfbe: field video: %w", err) + return fmt.Errorf("unable to encode linkPreviewTypeVideo#10c9fc08: field video: %w", err) } b.Comma() - b.FieldStart("width") - b.PutInt32(l.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(l.Height) - b.Comma() - b.FieldStart("duration") - b.PutInt32(l.Duration) - b.Comma() - b.FieldStart("author") - b.PutString(l.Author) - b.Comma() b.StripComma() b.ObjEnd() return nil @@ -5262,55 +5270,19 @@ func (l *LinkPreviewTypeVideo) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (l *LinkPreviewTypeVideo) DecodeTDLibJSON(b tdjson.Decoder) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeVideo#2beebfbe to nil") + return fmt.Errorf("can't decode linkPreviewTypeVideo#10c9fc08 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("linkPreviewTypeVideo"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideo#2beebfbe: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideo#2beebfbe: field url: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeVideo#10c9fc08: %w", err) } - l.URL = value - case "mime_type": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideo#2beebfbe: field mime_type: %w", err) - } - l.MimeType = value case "video": if err := l.Video.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideo#2beebfbe: field video: %w", err) - } - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideo#2beebfbe: field width: %w", err) - } - l.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideo#2beebfbe: field height: %w", err) - } - l.Height = value - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideo#2beebfbe: field duration: %w", err) - } - l.Duration = value - case "author": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideo#2beebfbe: field author: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeVideo#10c9fc08: field video: %w", err) } - l.Author = value default: return b.Skip() } @@ -5318,22 +5290,6 @@ func (l *LinkPreviewTypeVideo) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetURL returns value of URL field. -func (l *LinkPreviewTypeVideo) GetURL() (value string) { - if l == nil { - return - } - return l.URL -} - -// GetMimeType returns value of MimeType field. -func (l *LinkPreviewTypeVideo) GetMimeType() (value string) { - if l == nil { - return - } - return l.MimeType -} - // GetVideo returns value of Video field. func (l *LinkPreviewTypeVideo) GetVideo() (value Video) { if l == nil { @@ -5342,38 +5298,6 @@ func (l *LinkPreviewTypeVideo) GetVideo() (value Video) { return l.Video } -// GetWidth returns value of Width field. -func (l *LinkPreviewTypeVideo) GetWidth() (value int32) { - if l == nil { - return - } - return l.Width -} - -// GetHeight returns value of Height field. -func (l *LinkPreviewTypeVideo) GetHeight() (value int32) { - if l == nil { - return - } - return l.Height -} - -// GetDuration returns value of Duration field. -func (l *LinkPreviewTypeVideo) GetDuration() (value int32) { - if l == nil { - return - } - return l.Duration -} - -// GetAuthor returns value of Author field. -func (l *LinkPreviewTypeVideo) GetAuthor() (value string) { - if l == nil { - return - } - return l.Author -} - // LinkPreviewTypeVideoChat represents TL type `linkPreviewTypeVideoChat#1908ee13`. type LinkPreviewTypeVideoChat struct { // Photo of the chat with the video chat; may be null if none @@ -6086,20 +6010,22 @@ const LinkPreviewTypeClassName = "LinkPreviewType" // } // switch v := g.(type) { // case *tdapi.LinkPreviewTypeAlbum: // linkPreviewTypeAlbum#186d97b4 -// case *tdapi.LinkPreviewTypeAnimation: // linkPreviewTypeAnimation#93534e8e -// case *tdapi.LinkPreviewTypeApp: // linkPreviewTypeApp#b5192746 -// case *tdapi.LinkPreviewTypeArticle: // linkPreviewTypeArticle#965e4e27 -// case *tdapi.LinkPreviewTypeAudio: // linkPreviewTypeAudio#572c6b78 +// case *tdapi.LinkPreviewTypeAnimation: // linkPreviewTypeAnimation#ad5cc534 +// case *tdapi.LinkPreviewTypeApp: // linkPreviewTypeApp#e3a68def +// case *tdapi.LinkPreviewTypeArticle: // linkPreviewTypeArticle#7cce9bd9 +// case *tdapi.LinkPreviewTypeAudio: // linkPreviewTypeAudio#75e407d2 // case *tdapi.LinkPreviewTypeBackground: // linkPreviewTypeBackground#3a48a1e0 // case *tdapi.LinkPreviewTypeChannelBoost: // linkPreviewTypeChannelBoost#c6f40456 // case *tdapi.LinkPreviewTypeChat: // linkPreviewTypeChat#ae2fa122 -// case *tdapi.LinkPreviewTypeDocument: // linkPreviewTypeDocument#53b02747 -// case *tdapi.LinkPreviewTypeEmbeddedAnimationPlayer: // linkPreviewTypeEmbeddedAnimationPlayer#c45fddca -// case *tdapi.LinkPreviewTypeEmbeddedAudioPlayer: // linkPreviewTypeEmbeddedAudioPlayer#31e0dae6 -// case *tdapi.LinkPreviewTypeEmbeddedVideoPlayer: // linkPreviewTypeEmbeddedVideoPlayer#6ee015a3 +// case *tdapi.LinkPreviewTypeDocument: // linkPreviewTypeDocument#bf0169a2 +// case *tdapi.LinkPreviewTypeEmbeddedAnimationPlayer: // linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605 +// case *tdapi.LinkPreviewTypeEmbeddedAudioPlayer: // linkPreviewTypeEmbeddedAudioPlayer#220b429c +// case *tdapi.LinkPreviewTypeEmbeddedVideoPlayer: // linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03 +// case *tdapi.LinkPreviewTypeExternalAudio: // linkPreviewTypeExternalAudio#8a82ffed +// case *tdapi.LinkPreviewTypeExternalVideo: // linkPreviewTypeExternalVideo#517dcb98 // case *tdapi.LinkPreviewTypeInvoice: // linkPreviewTypeInvoice#d47f48da // case *tdapi.LinkPreviewTypeMessage: // linkPreviewTypeMessage#19f4c19e -// case *tdapi.LinkPreviewTypePhoto: // linkPreviewTypePhoto#eeebbab0 +// case *tdapi.LinkPreviewTypePhoto: // linkPreviewTypePhoto#aecfaaac // case *tdapi.LinkPreviewTypePremiumGiftCode: // linkPreviewTypePremiumGiftCode#4e0d80b1 // case *tdapi.LinkPreviewTypeShareableChatFolder: // linkPreviewTypeShareableChatFolder#805ab33c // case *tdapi.LinkPreviewTypeSticker: // linkPreviewTypeSticker#245f4d25 @@ -6109,7 +6035,7 @@ const LinkPreviewTypeClassName = "LinkPreviewType" // case *tdapi.LinkPreviewTypeTheme: // linkPreviewTypeTheme#6b7a9ba5 // case *tdapi.LinkPreviewTypeUnsupported: // linkPreviewTypeUnsupported#72b92cb9 // case *tdapi.LinkPreviewTypeUser: // linkPreviewTypeUser#a8ad817c -// case *tdapi.LinkPreviewTypeVideo: // linkPreviewTypeVideo#2beebfbe +// case *tdapi.LinkPreviewTypeVideo: // linkPreviewTypeVideo#10c9fc08 // case *tdapi.LinkPreviewTypeVideoChat: // linkPreviewTypeVideoChat#1908ee13 // case *tdapi.LinkPreviewTypeVideoNote: // linkPreviewTypeVideoNote#cf70db61 // case *tdapi.LinkPreviewTypeVoiceNote: // linkPreviewTypeVoiceNote#d2d2cf2b @@ -6153,28 +6079,28 @@ func DecodeLinkPreviewType(buf *bin.Buffer) (LinkPreviewTypeClass, error) { } return &v, nil case LinkPreviewTypeAnimationTypeID: - // Decoding linkPreviewTypeAnimation#93534e8e. + // Decoding linkPreviewTypeAnimation#ad5cc534. v := LinkPreviewTypeAnimation{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) } return &v, nil case LinkPreviewTypeAppTypeID: - // Decoding linkPreviewTypeApp#b5192746. + // Decoding linkPreviewTypeApp#e3a68def. v := LinkPreviewTypeApp{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) } return &v, nil case LinkPreviewTypeArticleTypeID: - // Decoding linkPreviewTypeArticle#965e4e27. + // Decoding linkPreviewTypeArticle#7cce9bd9. v := LinkPreviewTypeArticle{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) } return &v, nil case LinkPreviewTypeAudioTypeID: - // Decoding linkPreviewTypeAudio#572c6b78. + // Decoding linkPreviewTypeAudio#75e407d2. v := LinkPreviewTypeAudio{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) @@ -6202,33 +6128,47 @@ func DecodeLinkPreviewType(buf *bin.Buffer) (LinkPreviewTypeClass, error) { } return &v, nil case LinkPreviewTypeDocumentTypeID: - // Decoding linkPreviewTypeDocument#53b02747. + // Decoding linkPreviewTypeDocument#bf0169a2. v := LinkPreviewTypeDocument{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) } return &v, nil case LinkPreviewTypeEmbeddedAnimationPlayerTypeID: - // Decoding linkPreviewTypeEmbeddedAnimationPlayer#c45fddca. + // Decoding linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605. v := LinkPreviewTypeEmbeddedAnimationPlayer{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) } return &v, nil case LinkPreviewTypeEmbeddedAudioPlayerTypeID: - // Decoding linkPreviewTypeEmbeddedAudioPlayer#31e0dae6. + // Decoding linkPreviewTypeEmbeddedAudioPlayer#220b429c. v := LinkPreviewTypeEmbeddedAudioPlayer{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) } return &v, nil case LinkPreviewTypeEmbeddedVideoPlayerTypeID: - // Decoding linkPreviewTypeEmbeddedVideoPlayer#6ee015a3. + // Decoding linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03. v := LinkPreviewTypeEmbeddedVideoPlayer{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) } return &v, nil + case LinkPreviewTypeExternalAudioTypeID: + // Decoding linkPreviewTypeExternalAudio#8a82ffed. + v := LinkPreviewTypeExternalAudio{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) + } + return &v, nil + case LinkPreviewTypeExternalVideoTypeID: + // Decoding linkPreviewTypeExternalVideo#517dcb98. + v := LinkPreviewTypeExternalVideo{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) + } + return &v, nil case LinkPreviewTypeInvoiceTypeID: // Decoding linkPreviewTypeInvoice#d47f48da. v := LinkPreviewTypeInvoice{} @@ -6244,7 +6184,7 @@ func DecodeLinkPreviewType(buf *bin.Buffer) (LinkPreviewTypeClass, error) { } return &v, nil case LinkPreviewTypePhotoTypeID: - // Decoding linkPreviewTypePhoto#eeebbab0. + // Decoding linkPreviewTypePhoto#aecfaaac. v := LinkPreviewTypePhoto{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) @@ -6314,7 +6254,7 @@ func DecodeLinkPreviewType(buf *bin.Buffer) (LinkPreviewTypeClass, error) { } return &v, nil case LinkPreviewTypeVideoTypeID: - // Decoding linkPreviewTypeVideo#2beebfbe. + // Decoding linkPreviewTypeVideo#10c9fc08. v := LinkPreviewTypeVideo{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) @@ -6368,28 +6308,28 @@ func DecodeTDLibJSONLinkPreviewType(buf tdjson.Decoder) (LinkPreviewTypeClass, e } return &v, nil case "linkPreviewTypeAnimation": - // Decoding linkPreviewTypeAnimation#93534e8e. + // Decoding linkPreviewTypeAnimation#ad5cc534. v := LinkPreviewTypeAnimation{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) } return &v, nil case "linkPreviewTypeApp": - // Decoding linkPreviewTypeApp#b5192746. + // Decoding linkPreviewTypeApp#e3a68def. v := LinkPreviewTypeApp{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) } return &v, nil case "linkPreviewTypeArticle": - // Decoding linkPreviewTypeArticle#965e4e27. + // Decoding linkPreviewTypeArticle#7cce9bd9. v := LinkPreviewTypeArticle{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) } return &v, nil case "linkPreviewTypeAudio": - // Decoding linkPreviewTypeAudio#572c6b78. + // Decoding linkPreviewTypeAudio#75e407d2. v := LinkPreviewTypeAudio{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) @@ -6417,33 +6357,47 @@ func DecodeTDLibJSONLinkPreviewType(buf tdjson.Decoder) (LinkPreviewTypeClass, e } return &v, nil case "linkPreviewTypeDocument": - // Decoding linkPreviewTypeDocument#53b02747. + // Decoding linkPreviewTypeDocument#bf0169a2. v := LinkPreviewTypeDocument{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) } return &v, nil case "linkPreviewTypeEmbeddedAnimationPlayer": - // Decoding linkPreviewTypeEmbeddedAnimationPlayer#c45fddca. + // Decoding linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605. v := LinkPreviewTypeEmbeddedAnimationPlayer{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) } return &v, nil case "linkPreviewTypeEmbeddedAudioPlayer": - // Decoding linkPreviewTypeEmbeddedAudioPlayer#31e0dae6. + // Decoding linkPreviewTypeEmbeddedAudioPlayer#220b429c. v := LinkPreviewTypeEmbeddedAudioPlayer{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) } return &v, nil case "linkPreviewTypeEmbeddedVideoPlayer": - // Decoding linkPreviewTypeEmbeddedVideoPlayer#6ee015a3. + // Decoding linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03. v := LinkPreviewTypeEmbeddedVideoPlayer{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) } return &v, nil + case "linkPreviewTypeExternalAudio": + // Decoding linkPreviewTypeExternalAudio#8a82ffed. + v := LinkPreviewTypeExternalAudio{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) + } + return &v, nil + case "linkPreviewTypeExternalVideo": + // Decoding linkPreviewTypeExternalVideo#517dcb98. + v := LinkPreviewTypeExternalVideo{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) + } + return &v, nil case "linkPreviewTypeInvoice": // Decoding linkPreviewTypeInvoice#d47f48da. v := LinkPreviewTypeInvoice{} @@ -6459,7 +6413,7 @@ func DecodeTDLibJSONLinkPreviewType(buf tdjson.Decoder) (LinkPreviewTypeClass, e } return &v, nil case "linkPreviewTypePhoto": - // Decoding linkPreviewTypePhoto#eeebbab0. + // Decoding linkPreviewTypePhoto#aecfaaac. v := LinkPreviewTypePhoto{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) @@ -6529,7 +6483,7 @@ func DecodeTDLibJSONLinkPreviewType(buf tdjson.Decoder) (LinkPreviewTypeClass, e } return &v, nil case "linkPreviewTypeVideo": - // Decoding linkPreviewTypeVideo#2beebfbe. + // Decoding linkPreviewTypeVideo#10c9fc08. v := LinkPreviewTypeVideo{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) diff --git a/tdapi/tl_message_content_gen.go b/tdapi/tl_message_content_gen.go index aa317011b3..07fe73506a 100644 --- a/tdapi/tl_message_content_gen.go +++ b/tdapi/tl_message_content_gen.go @@ -12536,112 +12536,134 @@ func (m *MessagePremiumGiftCode) GetCode() (value string) { return m.Code } -// MessagePremiumGiveawayCreated represents TL type `messagePremiumGiveawayCreated#270f2c44`. -type MessagePremiumGiveawayCreated struct { +// MessageGiveawayCreated represents TL type `messageGiveawayCreated#39f3639f`. +type MessageGiveawayCreated struct { + // Number of Telegram Stars that will be shared by winners of the giveaway; 0 for + // Telegram Premium giveaways + StarCount int64 } -// MessagePremiumGiveawayCreatedTypeID is TL type id of MessagePremiumGiveawayCreated. -const MessagePremiumGiveawayCreatedTypeID = 0x270f2c44 +// MessageGiveawayCreatedTypeID is TL type id of MessageGiveawayCreated. +const MessageGiveawayCreatedTypeID = 0x39f3639f // construct implements constructor of MessageContentClass. -func (m MessagePremiumGiveawayCreated) construct() MessageContentClass { return &m } +func (m MessageGiveawayCreated) construct() MessageContentClass { return &m } -// Ensuring interfaces in compile-time for MessagePremiumGiveawayCreated. +// Ensuring interfaces in compile-time for MessageGiveawayCreated. var ( - _ bin.Encoder = &MessagePremiumGiveawayCreated{} - _ bin.Decoder = &MessagePremiumGiveawayCreated{} - _ bin.BareEncoder = &MessagePremiumGiveawayCreated{} - _ bin.BareDecoder = &MessagePremiumGiveawayCreated{} + _ bin.Encoder = &MessageGiveawayCreated{} + _ bin.Decoder = &MessageGiveawayCreated{} + _ bin.BareEncoder = &MessageGiveawayCreated{} + _ bin.BareDecoder = &MessageGiveawayCreated{} - _ MessageContentClass = &MessagePremiumGiveawayCreated{} + _ MessageContentClass = &MessageGiveawayCreated{} ) -func (m *MessagePremiumGiveawayCreated) Zero() bool { +func (m *MessageGiveawayCreated) Zero() bool { if m == nil { return true } + if !(m.StarCount == 0) { + return false + } return true } // String implements fmt.Stringer. -func (m *MessagePremiumGiveawayCreated) String() string { +func (m *MessageGiveawayCreated) String() string { if m == nil { - return "MessagePremiumGiveawayCreated(nil)" + return "MessageGiveawayCreated(nil)" } - type Alias MessagePremiumGiveawayCreated - return fmt.Sprintf("MessagePremiumGiveawayCreated%+v", Alias(*m)) + type Alias MessageGiveawayCreated + return fmt.Sprintf("MessageGiveawayCreated%+v", Alias(*m)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessagePremiumGiveawayCreated) TypeID() uint32 { - return MessagePremiumGiveawayCreatedTypeID +func (*MessageGiveawayCreated) TypeID() uint32 { + return MessageGiveawayCreatedTypeID } // TypeName returns name of type in TL schema. -func (*MessagePremiumGiveawayCreated) TypeName() string { - return "messagePremiumGiveawayCreated" +func (*MessageGiveawayCreated) TypeName() string { + return "messageGiveawayCreated" } // TypeInfo returns info about TL type. -func (m *MessagePremiumGiveawayCreated) TypeInfo() tdp.Type { +func (m *MessageGiveawayCreated) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "messagePremiumGiveawayCreated", - ID: MessagePremiumGiveawayCreatedTypeID, + Name: "messageGiveawayCreated", + ID: MessageGiveawayCreatedTypeID, } if m == nil { typ.Null = true return typ } - typ.Fields = []tdp.Field{} + typ.Fields = []tdp.Field{ + { + Name: "StarCount", + SchemaName: "star_count", + }, + } return typ } // Encode implements bin.Encoder. -func (m *MessagePremiumGiveawayCreated) Encode(b *bin.Buffer) error { +func (m *MessageGiveawayCreated) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messagePremiumGiveawayCreated#270f2c44 as nil") + return fmt.Errorf("can't encode messageGiveawayCreated#39f3639f as nil") } - b.PutID(MessagePremiumGiveawayCreatedTypeID) + b.PutID(MessageGiveawayCreatedTypeID) return m.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (m *MessagePremiumGiveawayCreated) EncodeBare(b *bin.Buffer) error { +func (m *MessageGiveawayCreated) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messagePremiumGiveawayCreated#270f2c44 as nil") + return fmt.Errorf("can't encode messageGiveawayCreated#39f3639f as nil") } + b.PutInt53(m.StarCount) return nil } // Decode implements bin.Decoder. -func (m *MessagePremiumGiveawayCreated) Decode(b *bin.Buffer) error { +func (m *MessageGiveawayCreated) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messagePremiumGiveawayCreated#270f2c44 to nil") + return fmt.Errorf("can't decode messageGiveawayCreated#39f3639f to nil") } - if err := b.ConsumeID(MessagePremiumGiveawayCreatedTypeID); err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayCreated#270f2c44: %w", err) + if err := b.ConsumeID(MessageGiveawayCreatedTypeID); err != nil { + return fmt.Errorf("unable to decode messageGiveawayCreated#39f3639f: %w", err) } return m.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (m *MessagePremiumGiveawayCreated) DecodeBare(b *bin.Buffer) error { +func (m *MessageGiveawayCreated) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messagePremiumGiveawayCreated#270f2c44 to nil") + return fmt.Errorf("can't decode messageGiveawayCreated#39f3639f to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGiveawayCreated#39f3639f: field star_count: %w", err) + } + m.StarCount = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessagePremiumGiveawayCreated) EncodeTDLibJSON(b tdjson.Encoder) error { +func (m *MessageGiveawayCreated) EncodeTDLibJSON(b tdjson.Encoder) error { if m == nil { - return fmt.Errorf("can't encode messagePremiumGiveawayCreated#270f2c44 as nil") + return fmt.Errorf("can't encode messageGiveawayCreated#39f3639f as nil") } b.ObjStart() - b.PutID("messagePremiumGiveawayCreated") + b.PutID("messageGiveawayCreated") + b.Comma() + b.FieldStart("star_count") + b.PutInt53(m.StarCount) b.Comma() b.StripComma() b.ObjEnd() @@ -12649,17 +12671,23 @@ func (m *MessagePremiumGiveawayCreated) EncodeTDLibJSON(b tdjson.Encoder) error } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessagePremiumGiveawayCreated) DecodeTDLibJSON(b tdjson.Decoder) error { +func (m *MessageGiveawayCreated) DecodeTDLibJSON(b tdjson.Decoder) error { if m == nil { - return fmt.Errorf("can't decode messagePremiumGiveawayCreated#270f2c44 to nil") + return fmt.Errorf("can't decode messageGiveawayCreated#39f3639f to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("messagePremiumGiveawayCreated"); err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayCreated#270f2c44: %w", err) + if err := b.ConsumeID("messageGiveawayCreated"); err != nil { + return fmt.Errorf("unable to decode messageGiveawayCreated#39f3639f: %w", err) } + case "star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGiveawayCreated#39f3639f: field star_count: %w", err) + } + m.StarCount = value default: return b.Skip() } @@ -12667,36 +12695,43 @@ func (m *MessagePremiumGiveawayCreated) DecodeTDLibJSON(b tdjson.Decoder) error }) } -// MessagePremiumGiveaway represents TL type `messagePremiumGiveaway#4aa0d0b0`. -type MessagePremiumGiveaway struct { +// GetStarCount returns value of StarCount field. +func (m *MessageGiveawayCreated) GetStarCount() (value int64) { + if m == nil { + return + } + return m.StarCount +} + +// MessageGiveaway represents TL type `messageGiveaway#eb61daa8`. +type MessageGiveaway struct { // Giveaway parameters - Parameters PremiumGiveawayParameters + Parameters GiveawayParameters // Number of users which will receive Telegram Premium subscription gift codes WinnerCount int32 - // Number of months the Telegram Premium subscription will be active after code - // activation - MonthCount int32 + // Prize of the giveaway + Prize GiveawayPrizeClass // A sticker to be shown in the message; may be null if unknown Sticker Sticker } -// MessagePremiumGiveawayTypeID is TL type id of MessagePremiumGiveaway. -const MessagePremiumGiveawayTypeID = 0x4aa0d0b0 +// MessageGiveawayTypeID is TL type id of MessageGiveaway. +const MessageGiveawayTypeID = 0xeb61daa8 // construct implements constructor of MessageContentClass. -func (m MessagePremiumGiveaway) construct() MessageContentClass { return &m } +func (m MessageGiveaway) construct() MessageContentClass { return &m } -// Ensuring interfaces in compile-time for MessagePremiumGiveaway. +// Ensuring interfaces in compile-time for MessageGiveaway. var ( - _ bin.Encoder = &MessagePremiumGiveaway{} - _ bin.Decoder = &MessagePremiumGiveaway{} - _ bin.BareEncoder = &MessagePremiumGiveaway{} - _ bin.BareDecoder = &MessagePremiumGiveaway{} + _ bin.Encoder = &MessageGiveaway{} + _ bin.Decoder = &MessageGiveaway{} + _ bin.BareEncoder = &MessageGiveaway{} + _ bin.BareDecoder = &MessageGiveaway{} - _ MessageContentClass = &MessagePremiumGiveaway{} + _ MessageContentClass = &MessageGiveaway{} ) -func (m *MessagePremiumGiveaway) Zero() bool { +func (m *MessageGiveaway) Zero() bool { if m == nil { return true } @@ -12706,7 +12741,7 @@ func (m *MessagePremiumGiveaway) Zero() bool { if !(m.WinnerCount == 0) { return false } - if !(m.MonthCount == 0) { + if !(m.Prize == nil) { return false } if !(m.Sticker.Zero()) { @@ -12717,31 +12752,31 @@ func (m *MessagePremiumGiveaway) Zero() bool { } // String implements fmt.Stringer. -func (m *MessagePremiumGiveaway) String() string { +func (m *MessageGiveaway) String() string { if m == nil { - return "MessagePremiumGiveaway(nil)" + return "MessageGiveaway(nil)" } - type Alias MessagePremiumGiveaway - return fmt.Sprintf("MessagePremiumGiveaway%+v", Alias(*m)) + type Alias MessageGiveaway + return fmt.Sprintf("MessageGiveaway%+v", Alias(*m)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessagePremiumGiveaway) TypeID() uint32 { - return MessagePremiumGiveawayTypeID +func (*MessageGiveaway) TypeID() uint32 { + return MessageGiveawayTypeID } // TypeName returns name of type in TL schema. -func (*MessagePremiumGiveaway) TypeName() string { - return "messagePremiumGiveaway" +func (*MessageGiveaway) TypeName() string { + return "messageGiveaway" } // TypeInfo returns info about TL type. -func (m *MessagePremiumGiveaway) TypeInfo() tdp.Type { +func (m *MessageGiveaway) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "messagePremiumGiveaway", - ID: MessagePremiumGiveawayTypeID, + Name: "messageGiveaway", + ID: MessageGiveawayTypeID, } if m == nil { typ.Null = true @@ -12757,8 +12792,8 @@ func (m *MessagePremiumGiveaway) TypeInfo() tdp.Type { SchemaName: "winner_count", }, { - Name: "MonthCount", - SchemaName: "month_count", + Name: "Prize", + SchemaName: "prize", }, { Name: "Sticker", @@ -12769,95 +12804,105 @@ func (m *MessagePremiumGiveaway) TypeInfo() tdp.Type { } // Encode implements bin.Encoder. -func (m *MessagePremiumGiveaway) Encode(b *bin.Buffer) error { +func (m *MessageGiveaway) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messagePremiumGiveaway#4aa0d0b0 as nil") + return fmt.Errorf("can't encode messageGiveaway#eb61daa8 as nil") } - b.PutID(MessagePremiumGiveawayTypeID) + b.PutID(MessageGiveawayTypeID) return m.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (m *MessagePremiumGiveaway) EncodeBare(b *bin.Buffer) error { +func (m *MessageGiveaway) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messagePremiumGiveaway#4aa0d0b0 as nil") + return fmt.Errorf("can't encode messageGiveaway#eb61daa8 as nil") } if err := m.Parameters.Encode(b); err != nil { - return fmt.Errorf("unable to encode messagePremiumGiveaway#4aa0d0b0: field parameters: %w", err) + return fmt.Errorf("unable to encode messageGiveaway#eb61daa8: field parameters: %w", err) } b.PutInt32(m.WinnerCount) - b.PutInt32(m.MonthCount) + if m.Prize == nil { + return fmt.Errorf("unable to encode messageGiveaway#eb61daa8: field prize is nil") + } + if err := m.Prize.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageGiveaway#eb61daa8: field prize: %w", err) + } if err := m.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode messagePremiumGiveaway#4aa0d0b0: field sticker: %w", err) + return fmt.Errorf("unable to encode messageGiveaway#eb61daa8: field sticker: %w", err) } return nil } // Decode implements bin.Decoder. -func (m *MessagePremiumGiveaway) Decode(b *bin.Buffer) error { +func (m *MessageGiveaway) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messagePremiumGiveaway#4aa0d0b0 to nil") + return fmt.Errorf("can't decode messageGiveaway#eb61daa8 to nil") } - if err := b.ConsumeID(MessagePremiumGiveawayTypeID); err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveaway#4aa0d0b0: %w", err) + if err := b.ConsumeID(MessageGiveawayTypeID); err != nil { + return fmt.Errorf("unable to decode messageGiveaway#eb61daa8: %w", err) } return m.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (m *MessagePremiumGiveaway) DecodeBare(b *bin.Buffer) error { +func (m *MessageGiveaway) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messagePremiumGiveaway#4aa0d0b0 to nil") + return fmt.Errorf("can't decode messageGiveaway#eb61daa8 to nil") } { if err := m.Parameters.Decode(b); err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveaway#4aa0d0b0: field parameters: %w", err) + return fmt.Errorf("unable to decode messageGiveaway#eb61daa8: field parameters: %w", err) } } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveaway#4aa0d0b0: field winner_count: %w", err) + return fmt.Errorf("unable to decode messageGiveaway#eb61daa8: field winner_count: %w", err) } m.WinnerCount = value } { - value, err := b.Int32() + value, err := DecodeGiveawayPrize(b) if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveaway#4aa0d0b0: field month_count: %w", err) + return fmt.Errorf("unable to decode messageGiveaway#eb61daa8: field prize: %w", err) } - m.MonthCount = value + m.Prize = value } { if err := m.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveaway#4aa0d0b0: field sticker: %w", err) + return fmt.Errorf("unable to decode messageGiveaway#eb61daa8: field sticker: %w", err) } } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessagePremiumGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { +func (m *MessageGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { if m == nil { - return fmt.Errorf("can't encode messagePremiumGiveaway#4aa0d0b0 as nil") + return fmt.Errorf("can't encode messageGiveaway#eb61daa8 as nil") } b.ObjStart() - b.PutID("messagePremiumGiveaway") + b.PutID("messageGiveaway") b.Comma() b.FieldStart("parameters") if err := m.Parameters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messagePremiumGiveaway#4aa0d0b0: field parameters: %w", err) + return fmt.Errorf("unable to encode messageGiveaway#eb61daa8: field parameters: %w", err) } b.Comma() b.FieldStart("winner_count") b.PutInt32(m.WinnerCount) b.Comma() - b.FieldStart("month_count") - b.PutInt32(m.MonthCount) + b.FieldStart("prize") + if m.Prize == nil { + return fmt.Errorf("unable to encode messageGiveaway#eb61daa8: field prize is nil") + } + if err := m.Prize.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode messageGiveaway#eb61daa8: field prize: %w", err) + } b.Comma() b.FieldStart("sticker") if err := m.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messagePremiumGiveaway#4aa0d0b0: field sticker: %w", err) + return fmt.Errorf("unable to encode messageGiveaway#eb61daa8: field sticker: %w", err) } b.Comma() b.StripComma() @@ -12866,36 +12911,36 @@ func (m *MessagePremiumGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessagePremiumGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { +func (m *MessageGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { if m == nil { - return fmt.Errorf("can't decode messagePremiumGiveaway#4aa0d0b0 to nil") + return fmt.Errorf("can't decode messageGiveaway#eb61daa8 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("messagePremiumGiveaway"); err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveaway#4aa0d0b0: %w", err) + if err := b.ConsumeID("messageGiveaway"); err != nil { + return fmt.Errorf("unable to decode messageGiveaway#eb61daa8: %w", err) } case "parameters": if err := m.Parameters.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveaway#4aa0d0b0: field parameters: %w", err) + return fmt.Errorf("unable to decode messageGiveaway#eb61daa8: field parameters: %w", err) } case "winner_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveaway#4aa0d0b0: field winner_count: %w", err) + return fmt.Errorf("unable to decode messageGiveaway#eb61daa8: field winner_count: %w", err) } m.WinnerCount = value - case "month_count": - value, err := b.Int32() + case "prize": + value, err := DecodeTDLibJSONGiveawayPrize(b) if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveaway#4aa0d0b0: field month_count: %w", err) + return fmt.Errorf("unable to decode messageGiveaway#eb61daa8: field prize: %w", err) } - m.MonthCount = value + m.Prize = value case "sticker": if err := m.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveaway#4aa0d0b0: field sticker: %w", err) + return fmt.Errorf("unable to decode messageGiveaway#eb61daa8: field sticker: %w", err) } default: return b.Skip() @@ -12905,7 +12950,7 @@ func (m *MessagePremiumGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetParameters returns value of Parameters field. -func (m *MessagePremiumGiveaway) GetParameters() (value PremiumGiveawayParameters) { +func (m *MessageGiveaway) GetParameters() (value GiveawayParameters) { if m == nil { return } @@ -12913,56 +12958,58 @@ func (m *MessagePremiumGiveaway) GetParameters() (value PremiumGiveawayParameter } // GetWinnerCount returns value of WinnerCount field. -func (m *MessagePremiumGiveaway) GetWinnerCount() (value int32) { +func (m *MessageGiveaway) GetWinnerCount() (value int32) { if m == nil { return } return m.WinnerCount } -// GetMonthCount returns value of MonthCount field. -func (m *MessagePremiumGiveaway) GetMonthCount() (value int32) { +// GetPrize returns value of Prize field. +func (m *MessageGiveaway) GetPrize() (value GiveawayPrizeClass) { if m == nil { return } - return m.MonthCount + return m.Prize } // GetSticker returns value of Sticker field. -func (m *MessagePremiumGiveaway) GetSticker() (value Sticker) { +func (m *MessageGiveaway) GetSticker() (value Sticker) { if m == nil { return } return m.Sticker } -// MessagePremiumGiveawayCompleted represents TL type `messagePremiumGiveawayCompleted#80533949`. -type MessagePremiumGiveawayCompleted struct { +// MessageGiveawayCompleted represents TL type `messageGiveawayCompleted#e424c8f7`. +type MessageGiveawayCompleted struct { // Identifier of the message with the giveaway; can be 0 if the message was deleted GiveawayMessageID int64 // Number of winners in the giveaway WinnerCount int32 - // Number of undistributed prizes + // True, if the giveaway is a Telegram Star giveaway + IsStarGiveaway bool + // Number of undistributed prizes; for Telegram Premium giveaways only UnclaimedPrizeCount int32 } -// MessagePremiumGiveawayCompletedTypeID is TL type id of MessagePremiumGiveawayCompleted. -const MessagePremiumGiveawayCompletedTypeID = 0x80533949 +// MessageGiveawayCompletedTypeID is TL type id of MessageGiveawayCompleted. +const MessageGiveawayCompletedTypeID = 0xe424c8f7 // construct implements constructor of MessageContentClass. -func (m MessagePremiumGiveawayCompleted) construct() MessageContentClass { return &m } +func (m MessageGiveawayCompleted) construct() MessageContentClass { return &m } -// Ensuring interfaces in compile-time for MessagePremiumGiveawayCompleted. +// Ensuring interfaces in compile-time for MessageGiveawayCompleted. var ( - _ bin.Encoder = &MessagePremiumGiveawayCompleted{} - _ bin.Decoder = &MessagePremiumGiveawayCompleted{} - _ bin.BareEncoder = &MessagePremiumGiveawayCompleted{} - _ bin.BareDecoder = &MessagePremiumGiveawayCompleted{} + _ bin.Encoder = &MessageGiveawayCompleted{} + _ bin.Decoder = &MessageGiveawayCompleted{} + _ bin.BareEncoder = &MessageGiveawayCompleted{} + _ bin.BareDecoder = &MessageGiveawayCompleted{} - _ MessageContentClass = &MessagePremiumGiveawayCompleted{} + _ MessageContentClass = &MessageGiveawayCompleted{} ) -func (m *MessagePremiumGiveawayCompleted) Zero() bool { +func (m *MessageGiveawayCompleted) Zero() bool { if m == nil { return true } @@ -12972,6 +13019,9 @@ func (m *MessagePremiumGiveawayCompleted) Zero() bool { if !(m.WinnerCount == 0) { return false } + if !(m.IsStarGiveaway == false) { + return false + } if !(m.UnclaimedPrizeCount == 0) { return false } @@ -12980,31 +13030,31 @@ func (m *MessagePremiumGiveawayCompleted) Zero() bool { } // String implements fmt.Stringer. -func (m *MessagePremiumGiveawayCompleted) String() string { +func (m *MessageGiveawayCompleted) String() string { if m == nil { - return "MessagePremiumGiveawayCompleted(nil)" + return "MessageGiveawayCompleted(nil)" } - type Alias MessagePremiumGiveawayCompleted - return fmt.Sprintf("MessagePremiumGiveawayCompleted%+v", Alias(*m)) + type Alias MessageGiveawayCompleted + return fmt.Sprintf("MessageGiveawayCompleted%+v", Alias(*m)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessagePremiumGiveawayCompleted) TypeID() uint32 { - return MessagePremiumGiveawayCompletedTypeID +func (*MessageGiveawayCompleted) TypeID() uint32 { + return MessageGiveawayCompletedTypeID } // TypeName returns name of type in TL schema. -func (*MessagePremiumGiveawayCompleted) TypeName() string { - return "messagePremiumGiveawayCompleted" +func (*MessageGiveawayCompleted) TypeName() string { + return "messageGiveawayCompleted" } // TypeInfo returns info about TL type. -func (m *MessagePremiumGiveawayCompleted) TypeInfo() tdp.Type { +func (m *MessageGiveawayCompleted) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "messagePremiumGiveawayCompleted", - ID: MessagePremiumGiveawayCompletedTypeID, + Name: "messageGiveawayCompleted", + ID: MessageGiveawayCompletedTypeID, } if m == nil { typ.Null = true @@ -13019,6 +13069,10 @@ func (m *MessagePremiumGiveawayCompleted) TypeInfo() tdp.Type { Name: "WinnerCount", SchemaName: "winner_count", }, + { + Name: "IsStarGiveaway", + SchemaName: "is_star_giveaway", + }, { Name: "UnclaimedPrizeCount", SchemaName: "unclaimed_prize_count", @@ -13028,59 +13082,67 @@ func (m *MessagePremiumGiveawayCompleted) TypeInfo() tdp.Type { } // Encode implements bin.Encoder. -func (m *MessagePremiumGiveawayCompleted) Encode(b *bin.Buffer) error { +func (m *MessageGiveawayCompleted) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messagePremiumGiveawayCompleted#80533949 as nil") + return fmt.Errorf("can't encode messageGiveawayCompleted#e424c8f7 as nil") } - b.PutID(MessagePremiumGiveawayCompletedTypeID) + b.PutID(MessageGiveawayCompletedTypeID) return m.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (m *MessagePremiumGiveawayCompleted) EncodeBare(b *bin.Buffer) error { +func (m *MessageGiveawayCompleted) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messagePremiumGiveawayCompleted#80533949 as nil") + return fmt.Errorf("can't encode messageGiveawayCompleted#e424c8f7 as nil") } b.PutInt53(m.GiveawayMessageID) b.PutInt32(m.WinnerCount) + b.PutBool(m.IsStarGiveaway) b.PutInt32(m.UnclaimedPrizeCount) return nil } // Decode implements bin.Decoder. -func (m *MessagePremiumGiveawayCompleted) Decode(b *bin.Buffer) error { +func (m *MessageGiveawayCompleted) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messagePremiumGiveawayCompleted#80533949 to nil") + return fmt.Errorf("can't decode messageGiveawayCompleted#e424c8f7 to nil") } - if err := b.ConsumeID(MessagePremiumGiveawayCompletedTypeID); err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayCompleted#80533949: %w", err) + if err := b.ConsumeID(MessageGiveawayCompletedTypeID); err != nil { + return fmt.Errorf("unable to decode messageGiveawayCompleted#e424c8f7: %w", err) } return m.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (m *MessagePremiumGiveawayCompleted) DecodeBare(b *bin.Buffer) error { +func (m *MessageGiveawayCompleted) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messagePremiumGiveawayCompleted#80533949 to nil") + return fmt.Errorf("can't decode messageGiveawayCompleted#e424c8f7 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayCompleted#80533949: field giveaway_message_id: %w", err) + return fmt.Errorf("unable to decode messageGiveawayCompleted#e424c8f7: field giveaway_message_id: %w", err) } m.GiveawayMessageID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayCompleted#80533949: field winner_count: %w", err) + return fmt.Errorf("unable to decode messageGiveawayCompleted#e424c8f7: field winner_count: %w", err) } m.WinnerCount = value } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageGiveawayCompleted#e424c8f7: field is_star_giveaway: %w", err) + } + m.IsStarGiveaway = value + } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayCompleted#80533949: field unclaimed_prize_count: %w", err) + return fmt.Errorf("unable to decode messageGiveawayCompleted#e424c8f7: field unclaimed_prize_count: %w", err) } m.UnclaimedPrizeCount = value } @@ -13088,12 +13150,12 @@ func (m *MessagePremiumGiveawayCompleted) DecodeBare(b *bin.Buffer) error { } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessagePremiumGiveawayCompleted) EncodeTDLibJSON(b tdjson.Encoder) error { +func (m *MessageGiveawayCompleted) EncodeTDLibJSON(b tdjson.Encoder) error { if m == nil { - return fmt.Errorf("can't encode messagePremiumGiveawayCompleted#80533949 as nil") + return fmt.Errorf("can't encode messageGiveawayCompleted#e424c8f7 as nil") } b.ObjStart() - b.PutID("messagePremiumGiveawayCompleted") + b.PutID("messageGiveawayCompleted") b.Comma() b.FieldStart("giveaway_message_id") b.PutInt53(m.GiveawayMessageID) @@ -13101,6 +13163,9 @@ func (m *MessagePremiumGiveawayCompleted) EncodeTDLibJSON(b tdjson.Encoder) erro b.FieldStart("winner_count") b.PutInt32(m.WinnerCount) b.Comma() + b.FieldStart("is_star_giveaway") + b.PutBool(m.IsStarGiveaway) + b.Comma() b.FieldStart("unclaimed_prize_count") b.PutInt32(m.UnclaimedPrizeCount) b.Comma() @@ -13110,33 +13175,39 @@ func (m *MessagePremiumGiveawayCompleted) EncodeTDLibJSON(b tdjson.Encoder) erro } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessagePremiumGiveawayCompleted) DecodeTDLibJSON(b tdjson.Decoder) error { +func (m *MessageGiveawayCompleted) DecodeTDLibJSON(b tdjson.Decoder) error { if m == nil { - return fmt.Errorf("can't decode messagePremiumGiveawayCompleted#80533949 to nil") + return fmt.Errorf("can't decode messageGiveawayCompleted#e424c8f7 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("messagePremiumGiveawayCompleted"); err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayCompleted#80533949: %w", err) + if err := b.ConsumeID("messageGiveawayCompleted"); err != nil { + return fmt.Errorf("unable to decode messageGiveawayCompleted#e424c8f7: %w", err) } case "giveaway_message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayCompleted#80533949: field giveaway_message_id: %w", err) + return fmt.Errorf("unable to decode messageGiveawayCompleted#e424c8f7: field giveaway_message_id: %w", err) } m.GiveawayMessageID = value case "winner_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayCompleted#80533949: field winner_count: %w", err) + return fmt.Errorf("unable to decode messageGiveawayCompleted#e424c8f7: field winner_count: %w", err) } m.WinnerCount = value + case "is_star_giveaway": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageGiveawayCompleted#e424c8f7: field is_star_giveaway: %w", err) + } + m.IsStarGiveaway = value case "unclaimed_prize_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayCompleted#80533949: field unclaimed_prize_count: %w", err) + return fmt.Errorf("unable to decode messageGiveawayCompleted#e424c8f7: field unclaimed_prize_count: %w", err) } m.UnclaimedPrizeCount = value default: @@ -13147,7 +13218,7 @@ func (m *MessagePremiumGiveawayCompleted) DecodeTDLibJSON(b tdjson.Decoder) erro } // GetGiveawayMessageID returns value of GiveawayMessageID field. -func (m *MessagePremiumGiveawayCompleted) GetGiveawayMessageID() (value int64) { +func (m *MessageGiveawayCompleted) GetGiveawayMessageID() (value int64) { if m == nil { return } @@ -13155,25 +13226,33 @@ func (m *MessagePremiumGiveawayCompleted) GetGiveawayMessageID() (value int64) { } // GetWinnerCount returns value of WinnerCount field. -func (m *MessagePremiumGiveawayCompleted) GetWinnerCount() (value int32) { +func (m *MessageGiveawayCompleted) GetWinnerCount() (value int32) { if m == nil { return } return m.WinnerCount } +// GetIsStarGiveaway returns value of IsStarGiveaway field. +func (m *MessageGiveawayCompleted) GetIsStarGiveaway() (value bool) { + if m == nil { + return + } + return m.IsStarGiveaway +} + // GetUnclaimedPrizeCount returns value of UnclaimedPrizeCount field. -func (m *MessagePremiumGiveawayCompleted) GetUnclaimedPrizeCount() (value int32) { +func (m *MessageGiveawayCompleted) GetUnclaimedPrizeCount() (value int32) { if m == nil { return } return m.UnclaimedPrizeCount } -// MessagePremiumGiveawayWinners represents TL type `messagePremiumGiveawayWinners#815d5f31`. -type MessagePremiumGiveawayWinners struct { - // Identifier of the channel chat, which was automatically boosted by the winners of the - // giveaway for duration of the Premium subscription +// MessageGiveawayWinners represents TL type `messageGiveawayWinners#1d99a27a`. +type MessageGiveawayWinners struct { + // Identifier of the supergroup or channel chat, which was automatically boosted by the + // winners of the giveaway BoostedChatID int64 // Identifier of the message with the giveaway in the boosted chat GiveawayMessageID int64 @@ -13186,36 +13265,35 @@ type MessagePremiumGiveawayWinners struct { OnlyNewMembers bool // True, if the giveaway was canceled and was fully refunded WasRefunded bool - // Number of months the Telegram Premium subscription will be active after code - // activation - MonthCount int32 + // Prize of the giveaway + Prize GiveawayPrizeClass // Additional description of the giveaway prize PrizeDescription string // Total number of winners in the giveaway WinnerCount int32 // Up to 100 user identifiers of the winners of the giveaway WinnerUserIDs []int64 - // Number of undistributed prizes + // Number of undistributed prizes; for Telegram Premium giveaways only UnclaimedPrizeCount int32 } -// MessagePremiumGiveawayWinnersTypeID is TL type id of MessagePremiumGiveawayWinners. -const MessagePremiumGiveawayWinnersTypeID = 0x815d5f31 +// MessageGiveawayWinnersTypeID is TL type id of MessageGiveawayWinners. +const MessageGiveawayWinnersTypeID = 0x1d99a27a // construct implements constructor of MessageContentClass. -func (m MessagePremiumGiveawayWinners) construct() MessageContentClass { return &m } +func (m MessageGiveawayWinners) construct() MessageContentClass { return &m } -// Ensuring interfaces in compile-time for MessagePremiumGiveawayWinners. +// Ensuring interfaces in compile-time for MessageGiveawayWinners. var ( - _ bin.Encoder = &MessagePremiumGiveawayWinners{} - _ bin.Decoder = &MessagePremiumGiveawayWinners{} - _ bin.BareEncoder = &MessagePremiumGiveawayWinners{} - _ bin.BareDecoder = &MessagePremiumGiveawayWinners{} + _ bin.Encoder = &MessageGiveawayWinners{} + _ bin.Decoder = &MessageGiveawayWinners{} + _ bin.BareEncoder = &MessageGiveawayWinners{} + _ bin.BareDecoder = &MessageGiveawayWinners{} - _ MessageContentClass = &MessagePremiumGiveawayWinners{} + _ MessageContentClass = &MessageGiveawayWinners{} ) -func (m *MessagePremiumGiveawayWinners) Zero() bool { +func (m *MessageGiveawayWinners) Zero() bool { if m == nil { return true } @@ -13237,7 +13315,7 @@ func (m *MessagePremiumGiveawayWinners) Zero() bool { if !(m.WasRefunded == false) { return false } - if !(m.MonthCount == 0) { + if !(m.Prize == nil) { return false } if !(m.PrizeDescription == "") { @@ -13257,31 +13335,31 @@ func (m *MessagePremiumGiveawayWinners) Zero() bool { } // String implements fmt.Stringer. -func (m *MessagePremiumGiveawayWinners) String() string { +func (m *MessageGiveawayWinners) String() string { if m == nil { - return "MessagePremiumGiveawayWinners(nil)" + return "MessageGiveawayWinners(nil)" } - type Alias MessagePremiumGiveawayWinners - return fmt.Sprintf("MessagePremiumGiveawayWinners%+v", Alias(*m)) + type Alias MessageGiveawayWinners + return fmt.Sprintf("MessageGiveawayWinners%+v", Alias(*m)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessagePremiumGiveawayWinners) TypeID() uint32 { - return MessagePremiumGiveawayWinnersTypeID +func (*MessageGiveawayWinners) TypeID() uint32 { + return MessageGiveawayWinnersTypeID } // TypeName returns name of type in TL schema. -func (*MessagePremiumGiveawayWinners) TypeName() string { - return "messagePremiumGiveawayWinners" +func (*MessageGiveawayWinners) TypeName() string { + return "messageGiveawayWinners" } // TypeInfo returns info about TL type. -func (m *MessagePremiumGiveawayWinners) TypeInfo() tdp.Type { +func (m *MessageGiveawayWinners) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "messagePremiumGiveawayWinners", - ID: MessagePremiumGiveawayWinnersTypeID, + Name: "messageGiveawayWinners", + ID: MessageGiveawayWinnersTypeID, } if m == nil { typ.Null = true @@ -13313,8 +13391,8 @@ func (m *MessagePremiumGiveawayWinners) TypeInfo() tdp.Type { SchemaName: "was_refunded", }, { - Name: "MonthCount", - SchemaName: "month_count", + Name: "Prize", + SchemaName: "prize", }, { Name: "PrizeDescription", @@ -13337,18 +13415,18 @@ func (m *MessagePremiumGiveawayWinners) TypeInfo() tdp.Type { } // Encode implements bin.Encoder. -func (m *MessagePremiumGiveawayWinners) Encode(b *bin.Buffer) error { +func (m *MessageGiveawayWinners) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messagePremiumGiveawayWinners#815d5f31 as nil") + return fmt.Errorf("can't encode messageGiveawayWinners#1d99a27a as nil") } - b.PutID(MessagePremiumGiveawayWinnersTypeID) + b.PutID(MessageGiveawayWinnersTypeID) return m.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (m *MessagePremiumGiveawayWinners) EncodeBare(b *bin.Buffer) error { +func (m *MessageGiveawayWinners) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messagePremiumGiveawayWinners#815d5f31 as nil") + return fmt.Errorf("can't encode messageGiveawayWinners#1d99a27a as nil") } b.PutInt53(m.BoostedChatID) b.PutInt53(m.GiveawayMessageID) @@ -13356,7 +13434,12 @@ func (m *MessagePremiumGiveawayWinners) EncodeBare(b *bin.Buffer) error { b.PutInt32(m.ActualWinnersSelectionDate) b.PutBool(m.OnlyNewMembers) b.PutBool(m.WasRefunded) - b.PutInt32(m.MonthCount) + if m.Prize == nil { + return fmt.Errorf("unable to encode messageGiveawayWinners#1d99a27a: field prize is nil") + } + if err := m.Prize.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageGiveawayWinners#1d99a27a: field prize: %w", err) + } b.PutString(m.PrizeDescription) b.PutInt32(m.WinnerCount) b.PutInt(len(m.WinnerUserIDs)) @@ -13368,88 +13451,88 @@ func (m *MessagePremiumGiveawayWinners) EncodeBare(b *bin.Buffer) error { } // Decode implements bin.Decoder. -func (m *MessagePremiumGiveawayWinners) Decode(b *bin.Buffer) error { +func (m *MessageGiveawayWinners) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messagePremiumGiveawayWinners#815d5f31 to nil") + return fmt.Errorf("can't decode messageGiveawayWinners#1d99a27a to nil") } - if err := b.ConsumeID(MessagePremiumGiveawayWinnersTypeID); err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: %w", err) + if err := b.ConsumeID(MessageGiveawayWinnersTypeID); err != nil { + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: %w", err) } return m.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (m *MessagePremiumGiveawayWinners) DecodeBare(b *bin.Buffer) error { +func (m *MessageGiveawayWinners) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messagePremiumGiveawayWinners#815d5f31 to nil") + return fmt.Errorf("can't decode messageGiveawayWinners#1d99a27a to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field boosted_chat_id: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field boosted_chat_id: %w", err) } m.BoostedChatID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field giveaway_message_id: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field giveaway_message_id: %w", err) } m.GiveawayMessageID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field additional_chat_count: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field additional_chat_count: %w", err) } m.AdditionalChatCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field actual_winners_selection_date: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field actual_winners_selection_date: %w", err) } m.ActualWinnersSelectionDate = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field only_new_members: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field only_new_members: %w", err) } m.OnlyNewMembers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field was_refunded: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field was_refunded: %w", err) } m.WasRefunded = value } { - value, err := b.Int32() + value, err := DecodeGiveawayPrize(b) if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field month_count: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field prize: %w", err) } - m.MonthCount = value + m.Prize = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field prize_description: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field prize_description: %w", err) } m.PrizeDescription = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field winner_count: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field winner_count: %w", err) } m.WinnerCount = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field winner_user_ids: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field winner_user_ids: %w", err) } if headerLen > 0 { @@ -13458,7 +13541,7 @@ func (m *MessagePremiumGiveawayWinners) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field winner_user_ids: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field winner_user_ids: %w", err) } m.WinnerUserIDs = append(m.WinnerUserIDs, value) } @@ -13466,7 +13549,7 @@ func (m *MessagePremiumGiveawayWinners) DecodeBare(b *bin.Buffer) error { { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field unclaimed_prize_count: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field unclaimed_prize_count: %w", err) } m.UnclaimedPrizeCount = value } @@ -13474,12 +13557,12 @@ func (m *MessagePremiumGiveawayWinners) DecodeBare(b *bin.Buffer) error { } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessagePremiumGiveawayWinners) EncodeTDLibJSON(b tdjson.Encoder) error { +func (m *MessageGiveawayWinners) EncodeTDLibJSON(b tdjson.Encoder) error { if m == nil { - return fmt.Errorf("can't encode messagePremiumGiveawayWinners#815d5f31 as nil") + return fmt.Errorf("can't encode messageGiveawayWinners#1d99a27a as nil") } b.ObjStart() - b.PutID("messagePremiumGiveawayWinners") + b.PutID("messageGiveawayWinners") b.Comma() b.FieldStart("boosted_chat_id") b.PutInt53(m.BoostedChatID) @@ -13499,8 +13582,13 @@ func (m *MessagePremiumGiveawayWinners) EncodeTDLibJSON(b tdjson.Encoder) error b.FieldStart("was_refunded") b.PutBool(m.WasRefunded) b.Comma() - b.FieldStart("month_count") - b.PutInt32(m.MonthCount) + b.FieldStart("prize") + if m.Prize == nil { + return fmt.Errorf("unable to encode messageGiveawayWinners#1d99a27a: field prize is nil") + } + if err := m.Prize.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode messageGiveawayWinners#1d99a27a: field prize: %w", err) + } b.Comma() b.FieldStart("prize_description") b.PutString(m.PrizeDescription) @@ -13526,86 +13614,86 @@ func (m *MessagePremiumGiveawayWinners) EncodeTDLibJSON(b tdjson.Encoder) error } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessagePremiumGiveawayWinners) DecodeTDLibJSON(b tdjson.Decoder) error { +func (m *MessageGiveawayWinners) DecodeTDLibJSON(b tdjson.Decoder) error { if m == nil { - return fmt.Errorf("can't decode messagePremiumGiveawayWinners#815d5f31 to nil") + return fmt.Errorf("can't decode messageGiveawayWinners#1d99a27a to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("messagePremiumGiveawayWinners"); err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: %w", err) + if err := b.ConsumeID("messageGiveawayWinners"); err != nil { + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: %w", err) } case "boosted_chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field boosted_chat_id: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field boosted_chat_id: %w", err) } m.BoostedChatID = value case "giveaway_message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field giveaway_message_id: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field giveaway_message_id: %w", err) } m.GiveawayMessageID = value case "additional_chat_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field additional_chat_count: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field additional_chat_count: %w", err) } m.AdditionalChatCount = value case "actual_winners_selection_date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field actual_winners_selection_date: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field actual_winners_selection_date: %w", err) } m.ActualWinnersSelectionDate = value case "only_new_members": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field only_new_members: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field only_new_members: %w", err) } m.OnlyNewMembers = value case "was_refunded": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field was_refunded: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field was_refunded: %w", err) } m.WasRefunded = value - case "month_count": - value, err := b.Int32() + case "prize": + value, err := DecodeTDLibJSONGiveawayPrize(b) if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field month_count: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field prize: %w", err) } - m.MonthCount = value + m.Prize = value case "prize_description": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field prize_description: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field prize_description: %w", err) } m.PrizeDescription = value case "winner_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field winner_count: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field winner_count: %w", err) } m.WinnerCount = value case "winner_user_ids": if err := b.Arr(func(b tdjson.Decoder) error { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field winner_user_ids: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field winner_user_ids: %w", err) } m.WinnerUserIDs = append(m.WinnerUserIDs, value) return nil }); err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field winner_user_ids: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field winner_user_ids: %w", err) } case "unclaimed_prize_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiveawayWinners#815d5f31: field unclaimed_prize_count: %w", err) + return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field unclaimed_prize_count: %w", err) } m.UnclaimedPrizeCount = value default: @@ -13616,7 +13704,7 @@ func (m *MessagePremiumGiveawayWinners) DecodeTDLibJSON(b tdjson.Decoder) error } // GetBoostedChatID returns value of BoostedChatID field. -func (m *MessagePremiumGiveawayWinners) GetBoostedChatID() (value int64) { +func (m *MessageGiveawayWinners) GetBoostedChatID() (value int64) { if m == nil { return } @@ -13624,7 +13712,7 @@ func (m *MessagePremiumGiveawayWinners) GetBoostedChatID() (value int64) { } // GetGiveawayMessageID returns value of GiveawayMessageID field. -func (m *MessagePremiumGiveawayWinners) GetGiveawayMessageID() (value int64) { +func (m *MessageGiveawayWinners) GetGiveawayMessageID() (value int64) { if m == nil { return } @@ -13632,7 +13720,7 @@ func (m *MessagePremiumGiveawayWinners) GetGiveawayMessageID() (value int64) { } // GetAdditionalChatCount returns value of AdditionalChatCount field. -func (m *MessagePremiumGiveawayWinners) GetAdditionalChatCount() (value int32) { +func (m *MessageGiveawayWinners) GetAdditionalChatCount() (value int32) { if m == nil { return } @@ -13640,7 +13728,7 @@ func (m *MessagePremiumGiveawayWinners) GetAdditionalChatCount() (value int32) { } // GetActualWinnersSelectionDate returns value of ActualWinnersSelectionDate field. -func (m *MessagePremiumGiveawayWinners) GetActualWinnersSelectionDate() (value int32) { +func (m *MessageGiveawayWinners) GetActualWinnersSelectionDate() (value int32) { if m == nil { return } @@ -13648,7 +13736,7 @@ func (m *MessagePremiumGiveawayWinners) GetActualWinnersSelectionDate() (value i } // GetOnlyNewMembers returns value of OnlyNewMembers field. -func (m *MessagePremiumGiveawayWinners) GetOnlyNewMembers() (value bool) { +func (m *MessageGiveawayWinners) GetOnlyNewMembers() (value bool) { if m == nil { return } @@ -13656,23 +13744,23 @@ func (m *MessagePremiumGiveawayWinners) GetOnlyNewMembers() (value bool) { } // GetWasRefunded returns value of WasRefunded field. -func (m *MessagePremiumGiveawayWinners) GetWasRefunded() (value bool) { +func (m *MessageGiveawayWinners) GetWasRefunded() (value bool) { if m == nil { return } return m.WasRefunded } -// GetMonthCount returns value of MonthCount field. -func (m *MessagePremiumGiveawayWinners) GetMonthCount() (value int32) { +// GetPrize returns value of Prize field. +func (m *MessageGiveawayWinners) GetPrize() (value GiveawayPrizeClass) { if m == nil { return } - return m.MonthCount + return m.Prize } // GetPrizeDescription returns value of PrizeDescription field. -func (m *MessagePremiumGiveawayWinners) GetPrizeDescription() (value string) { +func (m *MessageGiveawayWinners) GetPrizeDescription() (value string) { if m == nil { return } @@ -13680,7 +13768,7 @@ func (m *MessagePremiumGiveawayWinners) GetPrizeDescription() (value string) { } // GetWinnerCount returns value of WinnerCount field. -func (m *MessagePremiumGiveawayWinners) GetWinnerCount() (value int32) { +func (m *MessageGiveawayWinners) GetWinnerCount() (value int32) { if m == nil { return } @@ -13688,7 +13776,7 @@ func (m *MessagePremiumGiveawayWinners) GetWinnerCount() (value int32) { } // GetWinnerUserIDs returns value of WinnerUserIDs field. -func (m *MessagePremiumGiveawayWinners) GetWinnerUserIDs() (value []int64) { +func (m *MessageGiveawayWinners) GetWinnerUserIDs() (value []int64) { if m == nil { return } @@ -13696,7 +13784,7 @@ func (m *MessagePremiumGiveawayWinners) GetWinnerUserIDs() (value []int64) { } // GetUnclaimedPrizeCount returns value of UnclaimedPrizeCount field. -func (m *MessagePremiumGiveawayWinners) GetUnclaimedPrizeCount() (value int32) { +func (m *MessageGiveawayWinners) GetUnclaimedPrizeCount() (value int32) { if m == nil { return } @@ -14142,6 +14230,345 @@ func (m *MessageGiftedStars) GetSticker() (value Sticker) { return m.Sticker } +// MessageGiveawayPrizeStars represents TL type `messageGiveawayPrizeStars#aa0f5de3`. +type MessageGiveawayPrizeStars struct { + // Number of Telegram Stars that were received + StarCount int64 + // Identifier of the transaction for Telegram Stars credit + TransactionID string + // Identifier of the supergroup or channel chat, which was automatically boosted by the + // winners of the giveaway + BoostedChatID int64 + // Identifier of the message with the giveaway in the boosted chat; can be 0 if the + // message was deleted + GiveawayMessageID int64 + // True, if the corresponding winner wasn't chosen and the Telegram Stars were received + // by the owner of the boosted chat + IsUnclaimed bool + // A sticker to be shown in the message; may be null if unknown + Sticker Sticker +} + +// MessageGiveawayPrizeStarsTypeID is TL type id of MessageGiveawayPrizeStars. +const MessageGiveawayPrizeStarsTypeID = 0xaa0f5de3 + +// construct implements constructor of MessageContentClass. +func (m MessageGiveawayPrizeStars) construct() MessageContentClass { return &m } + +// Ensuring interfaces in compile-time for MessageGiveawayPrizeStars. +var ( + _ bin.Encoder = &MessageGiveawayPrizeStars{} + _ bin.Decoder = &MessageGiveawayPrizeStars{} + _ bin.BareEncoder = &MessageGiveawayPrizeStars{} + _ bin.BareDecoder = &MessageGiveawayPrizeStars{} + + _ MessageContentClass = &MessageGiveawayPrizeStars{} +) + +func (m *MessageGiveawayPrizeStars) Zero() bool { + if m == nil { + return true + } + if !(m.StarCount == 0) { + return false + } + if !(m.TransactionID == "") { + return false + } + if !(m.BoostedChatID == 0) { + return false + } + if !(m.GiveawayMessageID == 0) { + return false + } + if !(m.IsUnclaimed == false) { + return false + } + if !(m.Sticker.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageGiveawayPrizeStars) String() string { + if m == nil { + return "MessageGiveawayPrizeStars(nil)" + } + type Alias MessageGiveawayPrizeStars + return fmt.Sprintf("MessageGiveawayPrizeStars%+v", Alias(*m)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageGiveawayPrizeStars) TypeID() uint32 { + return MessageGiveawayPrizeStarsTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageGiveawayPrizeStars) TypeName() string { + return "messageGiveawayPrizeStars" +} + +// TypeInfo returns info about TL type. +func (m *MessageGiveawayPrizeStars) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageGiveawayPrizeStars", + ID: MessageGiveawayPrizeStarsTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "StarCount", + SchemaName: "star_count", + }, + { + Name: "TransactionID", + SchemaName: "transaction_id", + }, + { + Name: "BoostedChatID", + SchemaName: "boosted_chat_id", + }, + { + Name: "GiveawayMessageID", + SchemaName: "giveaway_message_id", + }, + { + Name: "IsUnclaimed", + SchemaName: "is_unclaimed", + }, + { + Name: "Sticker", + SchemaName: "sticker", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MessageGiveawayPrizeStars) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageGiveawayPrizeStars#aa0f5de3 as nil") + } + b.PutID(MessageGiveawayPrizeStarsTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageGiveawayPrizeStars) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageGiveawayPrizeStars#aa0f5de3 as nil") + } + b.PutInt53(m.StarCount) + b.PutString(m.TransactionID) + b.PutInt53(m.BoostedChatID) + b.PutInt53(m.GiveawayMessageID) + b.PutBool(m.IsUnclaimed) + if err := m.Sticker.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageGiveawayPrizeStars#aa0f5de3: field sticker: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageGiveawayPrizeStars) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageGiveawayPrizeStars#aa0f5de3 to nil") + } + if err := b.ConsumeID(MessageGiveawayPrizeStarsTypeID); err != nil { + return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageGiveawayPrizeStars) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageGiveawayPrizeStars#aa0f5de3 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field star_count: %w", err) + } + m.StarCount = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field transaction_id: %w", err) + } + m.TransactionID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field boosted_chat_id: %w", err) + } + m.BoostedChatID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field giveaway_message_id: %w", err) + } + m.GiveawayMessageID = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field is_unclaimed: %w", err) + } + m.IsUnclaimed = value + } + { + if err := m.Sticker.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field sticker: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (m *MessageGiveawayPrizeStars) EncodeTDLibJSON(b tdjson.Encoder) error { + if m == nil { + return fmt.Errorf("can't encode messageGiveawayPrizeStars#aa0f5de3 as nil") + } + b.ObjStart() + b.PutID("messageGiveawayPrizeStars") + b.Comma() + b.FieldStart("star_count") + b.PutInt53(m.StarCount) + b.Comma() + b.FieldStart("transaction_id") + b.PutString(m.TransactionID) + b.Comma() + b.FieldStart("boosted_chat_id") + b.PutInt53(m.BoostedChatID) + b.Comma() + b.FieldStart("giveaway_message_id") + b.PutInt53(m.GiveawayMessageID) + b.Comma() + b.FieldStart("is_unclaimed") + b.PutBool(m.IsUnclaimed) + b.Comma() + b.FieldStart("sticker") + if err := m.Sticker.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode messageGiveawayPrizeStars#aa0f5de3: field sticker: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (m *MessageGiveawayPrizeStars) DecodeTDLibJSON(b tdjson.Decoder) error { + if m == nil { + return fmt.Errorf("can't decode messageGiveawayPrizeStars#aa0f5de3 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("messageGiveawayPrizeStars"); err != nil { + return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: %w", err) + } + case "star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field star_count: %w", err) + } + m.StarCount = value + case "transaction_id": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field transaction_id: %w", err) + } + m.TransactionID = value + case "boosted_chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field boosted_chat_id: %w", err) + } + m.BoostedChatID = value + case "giveaway_message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field giveaway_message_id: %w", err) + } + m.GiveawayMessageID = value + case "is_unclaimed": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field is_unclaimed: %w", err) + } + m.IsUnclaimed = value + case "sticker": + if err := m.Sticker.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field sticker: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetStarCount returns value of StarCount field. +func (m *MessageGiveawayPrizeStars) GetStarCount() (value int64) { + if m == nil { + return + } + return m.StarCount +} + +// GetTransactionID returns value of TransactionID field. +func (m *MessageGiveawayPrizeStars) GetTransactionID() (value string) { + if m == nil { + return + } + return m.TransactionID +} + +// GetBoostedChatID returns value of BoostedChatID field. +func (m *MessageGiveawayPrizeStars) GetBoostedChatID() (value int64) { + if m == nil { + return + } + return m.BoostedChatID +} + +// GetGiveawayMessageID returns value of GiveawayMessageID field. +func (m *MessageGiveawayPrizeStars) GetGiveawayMessageID() (value int64) { + if m == nil { + return + } + return m.GiveawayMessageID +} + +// GetIsUnclaimed returns value of IsUnclaimed field. +func (m *MessageGiveawayPrizeStars) GetIsUnclaimed() (value bool) { + if m == nil { + return + } + return m.IsUnclaimed +} + +// GetSticker returns value of Sticker field. +func (m *MessageGiveawayPrizeStars) GetSticker() (value Sticker) { + if m == nil { + return + } + return m.Sticker +} + // MessageContactRegistered represents TL type `messageContactRegistered#a678fcff`. type MessageContactRegistered struct { } @@ -16125,11 +16552,12 @@ const MessageContentClassName = "MessageContent" // case *tdapi.MessagePaymentRefunded: // messagePaymentRefunded#11bcb8f3 // case *tdapi.MessageGiftedPremium: // messageGiftedPremium#30dd808e // case *tdapi.MessagePremiumGiftCode: // messagePremiumGiftCode#26bd1bf3 -// case *tdapi.MessagePremiumGiveawayCreated: // messagePremiumGiveawayCreated#270f2c44 -// case *tdapi.MessagePremiumGiveaway: // messagePremiumGiveaway#4aa0d0b0 -// case *tdapi.MessagePremiumGiveawayCompleted: // messagePremiumGiveawayCompleted#80533949 -// case *tdapi.MessagePremiumGiveawayWinners: // messagePremiumGiveawayWinners#815d5f31 +// case *tdapi.MessageGiveawayCreated: // messageGiveawayCreated#39f3639f +// case *tdapi.MessageGiveaway: // messageGiveaway#eb61daa8 +// case *tdapi.MessageGiveawayCompleted: // messageGiveawayCompleted#e424c8f7 +// case *tdapi.MessageGiveawayWinners: // messageGiveawayWinners#1d99a27a // case *tdapi.MessageGiftedStars: // messageGiftedStars#41bdbea7 +// case *tdapi.MessageGiveawayPrizeStars: // messageGiveawayPrizeStars#aa0f5de3 // case *tdapi.MessageContactRegistered: // messageContactRegistered#a678fcff // case *tdapi.MessageUsersShared: // messageUsersShared#7f1f4a22 // case *tdapi.MessageChatShared: // messageChatShared#aec6d961 @@ -16570,30 +16998,30 @@ func DecodeMessageContent(buf *bin.Buffer) (MessageContentClass, error) { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil - case MessagePremiumGiveawayCreatedTypeID: - // Decoding messagePremiumGiveawayCreated#270f2c44. - v := MessagePremiumGiveawayCreated{} + case MessageGiveawayCreatedTypeID: + // Decoding messageGiveawayCreated#39f3639f. + v := MessageGiveawayCreated{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil - case MessagePremiumGiveawayTypeID: - // Decoding messagePremiumGiveaway#4aa0d0b0. - v := MessagePremiumGiveaway{} + case MessageGiveawayTypeID: + // Decoding messageGiveaway#eb61daa8. + v := MessageGiveaway{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil - case MessagePremiumGiveawayCompletedTypeID: - // Decoding messagePremiumGiveawayCompleted#80533949. - v := MessagePremiumGiveawayCompleted{} + case MessageGiveawayCompletedTypeID: + // Decoding messageGiveawayCompleted#e424c8f7. + v := MessageGiveawayCompleted{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil - case MessagePremiumGiveawayWinnersTypeID: - // Decoding messagePremiumGiveawayWinners#815d5f31. - v := MessagePremiumGiveawayWinners{} + case MessageGiveawayWinnersTypeID: + // Decoding messageGiveawayWinners#1d99a27a. + v := MessageGiveawayWinners{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } @@ -16605,6 +17033,13 @@ func DecodeMessageContent(buf *bin.Buffer) (MessageContentClass, error) { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil + case MessageGiveawayPrizeStarsTypeID: + // Decoding messageGiveawayPrizeStars#aa0f5de3. + v := MessageGiveawayPrizeStars{} + 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{} @@ -17086,30 +17521,30 @@ func DecodeTDLibJSONMessageContent(buf tdjson.Decoder) (MessageContentClass, err return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil - case "messagePremiumGiveawayCreated": - // Decoding messagePremiumGiveawayCreated#270f2c44. - v := MessagePremiumGiveawayCreated{} + case "messageGiveawayCreated": + // Decoding messageGiveawayCreated#39f3639f. + v := MessageGiveawayCreated{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil - case "messagePremiumGiveaway": - // Decoding messagePremiumGiveaway#4aa0d0b0. - v := MessagePremiumGiveaway{} + case "messageGiveaway": + // Decoding messageGiveaway#eb61daa8. + v := MessageGiveaway{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil - case "messagePremiumGiveawayCompleted": - // Decoding messagePremiumGiveawayCompleted#80533949. - v := MessagePremiumGiveawayCompleted{} + case "messageGiveawayCompleted": + // Decoding messageGiveawayCompleted#e424c8f7. + v := MessageGiveawayCompleted{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil - case "messagePremiumGiveawayWinners": - // Decoding messagePremiumGiveawayWinners#815d5f31. - v := MessagePremiumGiveawayWinners{} + case "messageGiveawayWinners": + // Decoding messageGiveawayWinners#1d99a27a. + v := MessageGiveawayWinners{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } @@ -17121,6 +17556,13 @@ func DecodeTDLibJSONMessageContent(buf tdjson.Decoder) (MessageContentClass, err return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil + case "messageGiveawayPrizeStars": + // Decoding messageGiveawayPrizeStars#aa0f5de3. + v := MessageGiveawayPrizeStars{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) + } + return &v, nil case "messageContactRegistered": // Decoding messageContactRegistered#a678fcff. v := MessageContactRegistered{} diff --git a/tdapi/tl_message_properties_gen.go b/tdapi/tl_message_properties_gen.go index 09b5685619..112a0edd64 100644 --- a/tdapi/tl_message_properties_gen.go +++ b/tdapi/tl_message_properties_gen.go @@ -31,8 +31,11 @@ var ( _ = tdjson.Encoder{} ) -// MessageProperties represents TL type `messageProperties#11deeec2`. +// MessageProperties represents TL type `messageProperties#315677ac`. type MessageProperties struct { + // True, if content of the message can be copied to a secret chat using + // inputMessageForwarded or forwardMessages with copy options + CanBeCopiedToSecretChat bool // True, if the message can be deleted only for the current user while other users will // continue to see it using the method deleteMessages with revoke == false CanBeDeletedOnlyForSelf bool @@ -95,7 +98,7 @@ type MessageProperties struct { } // MessagePropertiesTypeID is TL type id of MessageProperties. -const MessagePropertiesTypeID = 0x11deeec2 +const MessagePropertiesTypeID = 0x315677ac // Ensuring interfaces in compile-time for MessageProperties. var ( @@ -109,6 +112,9 @@ func (m *MessageProperties) Zero() bool { if m == nil { return true } + if !(m.CanBeCopiedToSecretChat == false) { + return false + } if !(m.CanBeDeletedOnlyForSelf == false) { return false } @@ -217,6 +223,10 @@ func (m *MessageProperties) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "CanBeCopiedToSecretChat", + SchemaName: "can_be_copied_to_secret_chat", + }, { Name: "CanBeDeletedOnlyForSelf", SchemaName: "can_be_deleted_only_for_self", @@ -320,7 +330,7 @@ func (m *MessageProperties) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (m *MessageProperties) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageProperties#11deeec2 as nil") + return fmt.Errorf("can't encode messageProperties#315677ac as nil") } b.PutID(MessagePropertiesTypeID) return m.EncodeBare(b) @@ -329,8 +339,9 @@ func (m *MessageProperties) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageProperties) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageProperties#11deeec2 as nil") + return fmt.Errorf("can't encode messageProperties#315677ac as nil") } + b.PutBool(m.CanBeCopiedToSecretChat) b.PutBool(m.CanBeDeletedOnlyForSelf) b.PutBool(m.CanBeDeletedForAllUsers) b.PutBool(m.CanBeEdited) @@ -361,10 +372,10 @@ func (m *MessageProperties) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *MessageProperties) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageProperties#11deeec2 to nil") + return fmt.Errorf("can't decode messageProperties#315677ac to nil") } if err := b.ConsumeID(MessagePropertiesTypeID); err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: %w", err) } return m.DecodeBare(b) } @@ -372,173 +383,180 @@ func (m *MessageProperties) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageProperties) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageProperties#11deeec2 to nil") + return fmt.Errorf("can't decode messageProperties#315677ac to nil") + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_copied_to_secret_chat: %w", err) + } + m.CanBeCopiedToSecretChat = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_be_deleted_only_for_self: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_deleted_only_for_self: %w", err) } m.CanBeDeletedOnlyForSelf = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_be_deleted_for_all_users: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_deleted_for_all_users: %w", err) } m.CanBeDeletedForAllUsers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_be_edited: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_edited: %w", err) } m.CanBeEdited = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_be_forwarded: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_forwarded: %w", err) } m.CanBeForwarded = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_be_paid: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_paid: %w", err) } m.CanBePaid = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_be_pinned: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_pinned: %w", err) } m.CanBePinned = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_be_replied: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_replied: %w", err) } m.CanBeReplied = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_be_replied_in_another_chat: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_replied_in_another_chat: %w", err) } m.CanBeRepliedInAnotherChat = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_be_saved: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_saved: %w", err) } m.CanBeSaved = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_be_shared_in_story: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_shared_in_story: %w", err) } m.CanBeSharedInStory = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_edit_scheduling_state: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_edit_scheduling_state: %w", err) } m.CanEditSchedulingState = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_get_embedding_code: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_get_embedding_code: %w", err) } m.CanGetEmbeddingCode = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_get_link: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_get_link: %w", err) } m.CanGetLink = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_get_media_timestamp_links: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_get_media_timestamp_links: %w", err) } m.CanGetMediaTimestampLinks = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_get_message_thread: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_get_message_thread: %w", err) } m.CanGetMessageThread = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_get_read_date: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_get_read_date: %w", err) } m.CanGetReadDate = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_get_statistics: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_get_statistics: %w", err) } m.CanGetStatistics = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_get_viewers: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_get_viewers: %w", err) } m.CanGetViewers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_recognize_speech: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_recognize_speech: %w", err) } m.CanRecognizeSpeech = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_report_chat: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_report_chat: %w", err) } m.CanReportChat = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_report_reactions: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_report_reactions: %w", err) } m.CanReportReactions = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_report_supergroup_spam: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_report_supergroup_spam: %w", err) } m.CanReportSupergroupSpam = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_set_fact_check: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_set_fact_check: %w", err) } m.CanSetFactCheck = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field need_show_statistics: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field need_show_statistics: %w", err) } m.NeedShowStatistics = value } @@ -548,11 +566,14 @@ func (m *MessageProperties) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (m *MessageProperties) EncodeTDLibJSON(b tdjson.Encoder) error { if m == nil { - return fmt.Errorf("can't encode messageProperties#11deeec2 as nil") + return fmt.Errorf("can't encode messageProperties#315677ac as nil") } b.ObjStart() b.PutID("messageProperties") b.Comma() + b.FieldStart("can_be_copied_to_secret_chat") + b.PutBool(m.CanBeCopiedToSecretChat) + b.Comma() b.FieldStart("can_be_deleted_only_for_self") b.PutBool(m.CanBeDeletedOnlyForSelf) b.Comma() @@ -633,157 +654,163 @@ func (m *MessageProperties) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (m *MessageProperties) DecodeTDLibJSON(b tdjson.Decoder) error { if m == nil { - return fmt.Errorf("can't decode messageProperties#11deeec2 to nil") + return fmt.Errorf("can't decode messageProperties#315677ac to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("messageProperties"); err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: %w", err) } + case "can_be_copied_to_secret_chat": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_copied_to_secret_chat: %w", err) + } + m.CanBeCopiedToSecretChat = value case "can_be_deleted_only_for_self": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_be_deleted_only_for_self: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_deleted_only_for_self: %w", err) } m.CanBeDeletedOnlyForSelf = value case "can_be_deleted_for_all_users": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_be_deleted_for_all_users: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_deleted_for_all_users: %w", err) } m.CanBeDeletedForAllUsers = value case "can_be_edited": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_be_edited: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_edited: %w", err) } m.CanBeEdited = value case "can_be_forwarded": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_be_forwarded: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_forwarded: %w", err) } m.CanBeForwarded = value case "can_be_paid": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_be_paid: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_paid: %w", err) } m.CanBePaid = value case "can_be_pinned": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_be_pinned: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_pinned: %w", err) } m.CanBePinned = value case "can_be_replied": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_be_replied: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_replied: %w", err) } m.CanBeReplied = value case "can_be_replied_in_another_chat": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_be_replied_in_another_chat: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_replied_in_another_chat: %w", err) } m.CanBeRepliedInAnotherChat = value case "can_be_saved": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_be_saved: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_saved: %w", err) } m.CanBeSaved = value case "can_be_shared_in_story": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_be_shared_in_story: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_be_shared_in_story: %w", err) } m.CanBeSharedInStory = value case "can_edit_scheduling_state": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_edit_scheduling_state: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_edit_scheduling_state: %w", err) } m.CanEditSchedulingState = value case "can_get_embedding_code": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_get_embedding_code: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_get_embedding_code: %w", err) } m.CanGetEmbeddingCode = value case "can_get_link": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_get_link: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_get_link: %w", err) } m.CanGetLink = value case "can_get_media_timestamp_links": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_get_media_timestamp_links: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_get_media_timestamp_links: %w", err) } m.CanGetMediaTimestampLinks = value case "can_get_message_thread": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_get_message_thread: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_get_message_thread: %w", err) } m.CanGetMessageThread = value case "can_get_read_date": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_get_read_date: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_get_read_date: %w", err) } m.CanGetReadDate = value case "can_get_statistics": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_get_statistics: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_get_statistics: %w", err) } m.CanGetStatistics = value case "can_get_viewers": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_get_viewers: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_get_viewers: %w", err) } m.CanGetViewers = value case "can_recognize_speech": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_recognize_speech: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_recognize_speech: %w", err) } m.CanRecognizeSpeech = value case "can_report_chat": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_report_chat: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_report_chat: %w", err) } m.CanReportChat = value case "can_report_reactions": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_report_reactions: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_report_reactions: %w", err) } m.CanReportReactions = value case "can_report_supergroup_spam": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_report_supergroup_spam: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_report_supergroup_spam: %w", err) } m.CanReportSupergroupSpam = value case "can_set_fact_check": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field can_set_fact_check: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field can_set_fact_check: %w", err) } m.CanSetFactCheck = value case "need_show_statistics": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageProperties#11deeec2: field need_show_statistics: %w", err) + return fmt.Errorf("unable to decode messageProperties#315677ac: field need_show_statistics: %w", err) } m.NeedShowStatistics = value default: @@ -793,6 +820,14 @@ func (m *MessageProperties) DecodeTDLibJSON(b tdjson.Decoder) error { }) } +// GetCanBeCopiedToSecretChat returns value of CanBeCopiedToSecretChat field. +func (m *MessageProperties) GetCanBeCopiedToSecretChat() (value bool) { + if m == nil { + return + } + return m.CanBeCopiedToSecretChat +} + // GetCanBeDeletedOnlyForSelf returns value of CanBeDeletedOnlyForSelf field. func (m *MessageProperties) GetCanBeDeletedOnlyForSelf() (value bool) { if m == nil { diff --git a/tdapi/tl_premium_gift_code_payment_option_gen.go b/tdapi/tl_premium_gift_code_payment_option_gen.go index fbe1e21f7e..64d51c7108 100644 --- a/tdapi/tl_premium_gift_code_payment_option_gen.go +++ b/tdapi/tl_premium_gift_code_payment_option_gen.go @@ -31,14 +31,14 @@ var ( _ = tdjson.Encoder{} ) -// PremiumGiftCodePaymentOption represents TL type `premiumGiftCodePaymentOption#e2f40fef`. +// PremiumGiftCodePaymentOption represents TL type `premiumGiftCodePaymentOption#e5fe2de`. type PremiumGiftCodePaymentOption struct { // ISO 4217 currency code for Telegram Premium gift code payment Currency string // The amount to pay, in the smallest units of the currency Amount int64 // Number of users which will be able to activate the gift codes - UserCount int32 + WinnerCount int32 // Number of months the Telegram Premium subscription will be active MonthCount int32 // Identifier of the store product associated with the option; may be empty if none @@ -48,7 +48,7 @@ type PremiumGiftCodePaymentOption struct { } // PremiumGiftCodePaymentOptionTypeID is TL type id of PremiumGiftCodePaymentOption. -const PremiumGiftCodePaymentOptionTypeID = 0xe2f40fef +const PremiumGiftCodePaymentOptionTypeID = 0xe5fe2de // Ensuring interfaces in compile-time for PremiumGiftCodePaymentOption. var ( @@ -68,7 +68,7 @@ func (p *PremiumGiftCodePaymentOption) Zero() bool { if !(p.Amount == 0) { return false } - if !(p.UserCount == 0) { + if !(p.WinnerCount == 0) { return false } if !(p.MonthCount == 0) { @@ -125,8 +125,8 @@ func (p *PremiumGiftCodePaymentOption) TypeInfo() tdp.Type { SchemaName: "amount", }, { - Name: "UserCount", - SchemaName: "user_count", + Name: "WinnerCount", + SchemaName: "winner_count", }, { Name: "MonthCount", @@ -147,7 +147,7 @@ func (p *PremiumGiftCodePaymentOption) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (p *PremiumGiftCodePaymentOption) Encode(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't encode premiumGiftCodePaymentOption#e2f40fef as nil") + return fmt.Errorf("can't encode premiumGiftCodePaymentOption#e5fe2de as nil") } b.PutID(PremiumGiftCodePaymentOptionTypeID) return p.EncodeBare(b) @@ -156,11 +156,11 @@ func (p *PremiumGiftCodePaymentOption) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (p *PremiumGiftCodePaymentOption) EncodeBare(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't encode premiumGiftCodePaymentOption#e2f40fef as nil") + return fmt.Errorf("can't encode premiumGiftCodePaymentOption#e5fe2de as nil") } b.PutString(p.Currency) b.PutInt53(p.Amount) - b.PutInt32(p.UserCount) + b.PutInt32(p.WinnerCount) b.PutInt32(p.MonthCount) b.PutString(p.StoreProductID) b.PutInt32(p.StoreProductQuantity) @@ -170,10 +170,10 @@ func (p *PremiumGiftCodePaymentOption) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (p *PremiumGiftCodePaymentOption) Decode(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't decode premiumGiftCodePaymentOption#e2f40fef to nil") + return fmt.Errorf("can't decode premiumGiftCodePaymentOption#e5fe2de to nil") } if err := b.ConsumeID(PremiumGiftCodePaymentOptionTypeID); err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e2f40fef: %w", err) + return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e5fe2de: %w", err) } return p.DecodeBare(b) } @@ -181,47 +181,47 @@ func (p *PremiumGiftCodePaymentOption) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (p *PremiumGiftCodePaymentOption) DecodeBare(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't decode premiumGiftCodePaymentOption#e2f40fef to nil") + return fmt.Errorf("can't decode premiumGiftCodePaymentOption#e5fe2de to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e2f40fef: field currency: %w", err) + return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e5fe2de: field currency: %w", err) } p.Currency = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e2f40fef: field amount: %w", err) + return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e5fe2de: field amount: %w", err) } p.Amount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e2f40fef: field user_count: %w", err) + return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e5fe2de: field winner_count: %w", err) } - p.UserCount = value + p.WinnerCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e2f40fef: field month_count: %w", err) + return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e5fe2de: field month_count: %w", err) } p.MonthCount = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e2f40fef: field store_product_id: %w", err) + return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e5fe2de: field store_product_id: %w", err) } p.StoreProductID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e2f40fef: field store_product_quantity: %w", err) + return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e5fe2de: field store_product_quantity: %w", err) } p.StoreProductQuantity = value } @@ -231,7 +231,7 @@ func (p *PremiumGiftCodePaymentOption) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (p *PremiumGiftCodePaymentOption) EncodeTDLibJSON(b tdjson.Encoder) error { if p == nil { - return fmt.Errorf("can't encode premiumGiftCodePaymentOption#e2f40fef as nil") + return fmt.Errorf("can't encode premiumGiftCodePaymentOption#e5fe2de as nil") } b.ObjStart() b.PutID("premiumGiftCodePaymentOption") @@ -242,8 +242,8 @@ func (p *PremiumGiftCodePaymentOption) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("amount") b.PutInt53(p.Amount) b.Comma() - b.FieldStart("user_count") - b.PutInt32(p.UserCount) + b.FieldStart("winner_count") + b.PutInt32(p.WinnerCount) b.Comma() b.FieldStart("month_count") b.PutInt32(p.MonthCount) @@ -262,49 +262,49 @@ func (p *PremiumGiftCodePaymentOption) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (p *PremiumGiftCodePaymentOption) DecodeTDLibJSON(b tdjson.Decoder) error { if p == nil { - return fmt.Errorf("can't decode premiumGiftCodePaymentOption#e2f40fef to nil") + return fmt.Errorf("can't decode premiumGiftCodePaymentOption#e5fe2de to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("premiumGiftCodePaymentOption"); err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e2f40fef: %w", err) + return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e5fe2de: %w", err) } case "currency": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e2f40fef: field currency: %w", err) + return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e5fe2de: field currency: %w", err) } p.Currency = value case "amount": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e2f40fef: field amount: %w", err) + return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e5fe2de: field amount: %w", err) } p.Amount = value - case "user_count": + case "winner_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e2f40fef: field user_count: %w", err) + return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e5fe2de: field winner_count: %w", err) } - p.UserCount = value + p.WinnerCount = value case "month_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e2f40fef: field month_count: %w", err) + return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e5fe2de: field month_count: %w", err) } p.MonthCount = value case "store_product_id": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e2f40fef: field store_product_id: %w", err) + return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e5fe2de: field store_product_id: %w", err) } p.StoreProductID = value case "store_product_quantity": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e2f40fef: field store_product_quantity: %w", err) + return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#e5fe2de: field store_product_quantity: %w", err) } p.StoreProductQuantity = value default: @@ -330,12 +330,12 @@ func (p *PremiumGiftCodePaymentOption) GetAmount() (value int64) { return p.Amount } -// GetUserCount returns value of UserCount field. -func (p *PremiumGiftCodePaymentOption) GetUserCount() (value int32) { +// GetWinnerCount returns value of WinnerCount field. +func (p *PremiumGiftCodePaymentOption) GetWinnerCount() (value int32) { if p == nil { return } - return p.UserCount + return p.WinnerCount } // GetMonthCount returns value of MonthCount field. diff --git a/tdapi/tl_premium_giveaway_info_gen.go b/tdapi/tl_premium_giveaway_info_gen.go deleted file mode 100644 index 9eabfcc2b3..0000000000 --- a/tdapi/tl_premium_giveaway_info_gen.go +++ /dev/null @@ -1,754 +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{} -) - -// PremiumGiveawayInfoOngoing represents TL type `premiumGiveawayInfoOngoing#48d3ce6f`. -type PremiumGiveawayInfoOngoing struct { - // Point in time (Unix timestamp) when the giveaway was created - CreationDate int32 - // Status of the current user in the giveaway - Status PremiumGiveawayParticipantStatusClass - // True, if the giveaway has ended and results are being prepared - IsEnded bool -} - -// PremiumGiveawayInfoOngoingTypeID is TL type id of PremiumGiveawayInfoOngoing. -const PremiumGiveawayInfoOngoingTypeID = 0x48d3ce6f - -// construct implements constructor of PremiumGiveawayInfoClass. -func (p PremiumGiveawayInfoOngoing) construct() PremiumGiveawayInfoClass { return &p } - -// Ensuring interfaces in compile-time for PremiumGiveawayInfoOngoing. -var ( - _ bin.Encoder = &PremiumGiveawayInfoOngoing{} - _ bin.Decoder = &PremiumGiveawayInfoOngoing{} - _ bin.BareEncoder = &PremiumGiveawayInfoOngoing{} - _ bin.BareDecoder = &PremiumGiveawayInfoOngoing{} - - _ PremiumGiveawayInfoClass = &PremiumGiveawayInfoOngoing{} -) - -func (p *PremiumGiveawayInfoOngoing) Zero() bool { - if p == nil { - return true - } - if !(p.CreationDate == 0) { - return false - } - if !(p.Status == nil) { - return false - } - if !(p.IsEnded == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumGiveawayInfoOngoing) String() string { - if p == nil { - return "PremiumGiveawayInfoOngoing(nil)" - } - type Alias PremiumGiveawayInfoOngoing - return fmt.Sprintf("PremiumGiveawayInfoOngoing%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumGiveawayInfoOngoing) TypeID() uint32 { - return PremiumGiveawayInfoOngoingTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumGiveawayInfoOngoing) TypeName() string { - return "premiumGiveawayInfoOngoing" -} - -// TypeInfo returns info about TL type. -func (p *PremiumGiveawayInfoOngoing) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumGiveawayInfoOngoing", - ID: PremiumGiveawayInfoOngoingTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CreationDate", - SchemaName: "creation_date", - }, - { - Name: "Status", - SchemaName: "status", - }, - { - Name: "IsEnded", - SchemaName: "is_ended", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumGiveawayInfoOngoing) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayInfoOngoing#48d3ce6f as nil") - } - b.PutID(PremiumGiveawayInfoOngoingTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumGiveawayInfoOngoing) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayInfoOngoing#48d3ce6f as nil") - } - b.PutInt32(p.CreationDate) - if p.Status == nil { - return fmt.Errorf("unable to encode premiumGiveawayInfoOngoing#48d3ce6f: field status is nil") - } - if err := p.Status.Encode(b); err != nil { - return fmt.Errorf("unable to encode premiumGiveawayInfoOngoing#48d3ce6f: field status: %w", err) - } - b.PutBool(p.IsEnded) - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumGiveawayInfoOngoing) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayInfoOngoing#48d3ce6f to nil") - } - if err := b.ConsumeID(PremiumGiveawayInfoOngoingTypeID); err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoOngoing#48d3ce6f: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumGiveawayInfoOngoing) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayInfoOngoing#48d3ce6f to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoOngoing#48d3ce6f: field creation_date: %w", err) - } - p.CreationDate = value - } - { - value, err := DecodePremiumGiveawayParticipantStatus(b) - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoOngoing#48d3ce6f: field status: %w", err) - } - p.Status = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoOngoing#48d3ce6f: field is_ended: %w", err) - } - p.IsEnded = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumGiveawayInfoOngoing) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayInfoOngoing#48d3ce6f as nil") - } - b.ObjStart() - b.PutID("premiumGiveawayInfoOngoing") - b.Comma() - b.FieldStart("creation_date") - b.PutInt32(p.CreationDate) - b.Comma() - b.FieldStart("status") - if p.Status == nil { - return fmt.Errorf("unable to encode premiumGiveawayInfoOngoing#48d3ce6f: field status is nil") - } - if err := p.Status.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode premiumGiveawayInfoOngoing#48d3ce6f: field status: %w", err) - } - b.Comma() - b.FieldStart("is_ended") - b.PutBool(p.IsEnded) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumGiveawayInfoOngoing) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayInfoOngoing#48d3ce6f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumGiveawayInfoOngoing"); err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoOngoing#48d3ce6f: %w", err) - } - case "creation_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoOngoing#48d3ce6f: field creation_date: %w", err) - } - p.CreationDate = value - case "status": - value, err := DecodeTDLibJSONPremiumGiveawayParticipantStatus(b) - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoOngoing#48d3ce6f: field status: %w", err) - } - p.Status = value - case "is_ended": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoOngoing#48d3ce6f: field is_ended: %w", err) - } - p.IsEnded = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCreationDate returns value of CreationDate field. -func (p *PremiumGiveawayInfoOngoing) GetCreationDate() (value int32) { - if p == nil { - return - } - return p.CreationDate -} - -// GetStatus returns value of Status field. -func (p *PremiumGiveawayInfoOngoing) GetStatus() (value PremiumGiveawayParticipantStatusClass) { - if p == nil { - return - } - return p.Status -} - -// GetIsEnded returns value of IsEnded field. -func (p *PremiumGiveawayInfoOngoing) GetIsEnded() (value bool) { - if p == nil { - return - } - return p.IsEnded -} - -// PremiumGiveawayInfoCompleted represents TL type `premiumGiveawayInfoCompleted#fc8b501b`. -type PremiumGiveawayInfoCompleted struct { - // Point in time (Unix timestamp) when the giveaway was created - CreationDate int32 - // Point in time (Unix timestamp) when the winners were selected. May be bigger than - // winners selection date specified in parameters of the giveaway - ActualWinnersSelectionDate int32 - // True, if the giveaway was canceled and was fully refunded - WasRefunded bool - // Number of winners in the giveaway - WinnerCount int32 - // Number of winners, which activated their gift codes - ActivationCount int32 - // Telegram Premium gift code that was received by the current user; empty if the user - // isn't a winner in the giveaway - GiftCode string -} - -// PremiumGiveawayInfoCompletedTypeID is TL type id of PremiumGiveawayInfoCompleted. -const PremiumGiveawayInfoCompletedTypeID = 0xfc8b501b - -// construct implements constructor of PremiumGiveawayInfoClass. -func (p PremiumGiveawayInfoCompleted) construct() PremiumGiveawayInfoClass { return &p } - -// Ensuring interfaces in compile-time for PremiumGiveawayInfoCompleted. -var ( - _ bin.Encoder = &PremiumGiveawayInfoCompleted{} - _ bin.Decoder = &PremiumGiveawayInfoCompleted{} - _ bin.BareEncoder = &PremiumGiveawayInfoCompleted{} - _ bin.BareDecoder = &PremiumGiveawayInfoCompleted{} - - _ PremiumGiveawayInfoClass = &PremiumGiveawayInfoCompleted{} -) - -func (p *PremiumGiveawayInfoCompleted) Zero() bool { - if p == nil { - return true - } - if !(p.CreationDate == 0) { - return false - } - if !(p.ActualWinnersSelectionDate == 0) { - return false - } - if !(p.WasRefunded == false) { - return false - } - if !(p.WinnerCount == 0) { - return false - } - if !(p.ActivationCount == 0) { - return false - } - if !(p.GiftCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumGiveawayInfoCompleted) String() string { - if p == nil { - return "PremiumGiveawayInfoCompleted(nil)" - } - type Alias PremiumGiveawayInfoCompleted - return fmt.Sprintf("PremiumGiveawayInfoCompleted%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumGiveawayInfoCompleted) TypeID() uint32 { - return PremiumGiveawayInfoCompletedTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumGiveawayInfoCompleted) TypeName() string { - return "premiumGiveawayInfoCompleted" -} - -// TypeInfo returns info about TL type. -func (p *PremiumGiveawayInfoCompleted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumGiveawayInfoCompleted", - ID: PremiumGiveawayInfoCompletedTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CreationDate", - SchemaName: "creation_date", - }, - { - Name: "ActualWinnersSelectionDate", - SchemaName: "actual_winners_selection_date", - }, - { - Name: "WasRefunded", - SchemaName: "was_refunded", - }, - { - Name: "WinnerCount", - SchemaName: "winner_count", - }, - { - Name: "ActivationCount", - SchemaName: "activation_count", - }, - { - Name: "GiftCode", - SchemaName: "gift_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumGiveawayInfoCompleted) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayInfoCompleted#fc8b501b as nil") - } - b.PutID(PremiumGiveawayInfoCompletedTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumGiveawayInfoCompleted) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayInfoCompleted#fc8b501b as nil") - } - b.PutInt32(p.CreationDate) - b.PutInt32(p.ActualWinnersSelectionDate) - b.PutBool(p.WasRefunded) - b.PutInt32(p.WinnerCount) - b.PutInt32(p.ActivationCount) - b.PutString(p.GiftCode) - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumGiveawayInfoCompleted) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayInfoCompleted#fc8b501b to nil") - } - if err := b.ConsumeID(PremiumGiveawayInfoCompletedTypeID); err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoCompleted#fc8b501b: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumGiveawayInfoCompleted) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayInfoCompleted#fc8b501b to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoCompleted#fc8b501b: field creation_date: %w", err) - } - p.CreationDate = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoCompleted#fc8b501b: field actual_winners_selection_date: %w", err) - } - p.ActualWinnersSelectionDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoCompleted#fc8b501b: field was_refunded: %w", err) - } - p.WasRefunded = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoCompleted#fc8b501b: field winner_count: %w", err) - } - p.WinnerCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoCompleted#fc8b501b: field activation_count: %w", err) - } - p.ActivationCount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoCompleted#fc8b501b: field gift_code: %w", err) - } - p.GiftCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumGiveawayInfoCompleted) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayInfoCompleted#fc8b501b as nil") - } - b.ObjStart() - b.PutID("premiumGiveawayInfoCompleted") - b.Comma() - b.FieldStart("creation_date") - b.PutInt32(p.CreationDate) - b.Comma() - b.FieldStart("actual_winners_selection_date") - b.PutInt32(p.ActualWinnersSelectionDate) - b.Comma() - b.FieldStart("was_refunded") - b.PutBool(p.WasRefunded) - b.Comma() - b.FieldStart("winner_count") - b.PutInt32(p.WinnerCount) - b.Comma() - b.FieldStart("activation_count") - b.PutInt32(p.ActivationCount) - b.Comma() - b.FieldStart("gift_code") - b.PutString(p.GiftCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumGiveawayInfoCompleted) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayInfoCompleted#fc8b501b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumGiveawayInfoCompleted"); err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoCompleted#fc8b501b: %w", err) - } - case "creation_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoCompleted#fc8b501b: field creation_date: %w", err) - } - p.CreationDate = value - case "actual_winners_selection_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoCompleted#fc8b501b: field actual_winners_selection_date: %w", err) - } - p.ActualWinnersSelectionDate = value - case "was_refunded": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoCompleted#fc8b501b: field was_refunded: %w", err) - } - p.WasRefunded = value - case "winner_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoCompleted#fc8b501b: field winner_count: %w", err) - } - p.WinnerCount = value - case "activation_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoCompleted#fc8b501b: field activation_count: %w", err) - } - p.ActivationCount = value - case "gift_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayInfoCompleted#fc8b501b: field gift_code: %w", err) - } - p.GiftCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCreationDate returns value of CreationDate field. -func (p *PremiumGiveawayInfoCompleted) GetCreationDate() (value int32) { - if p == nil { - return - } - return p.CreationDate -} - -// GetActualWinnersSelectionDate returns value of ActualWinnersSelectionDate field. -func (p *PremiumGiveawayInfoCompleted) GetActualWinnersSelectionDate() (value int32) { - if p == nil { - return - } - return p.ActualWinnersSelectionDate -} - -// GetWasRefunded returns value of WasRefunded field. -func (p *PremiumGiveawayInfoCompleted) GetWasRefunded() (value bool) { - if p == nil { - return - } - return p.WasRefunded -} - -// GetWinnerCount returns value of WinnerCount field. -func (p *PremiumGiveawayInfoCompleted) GetWinnerCount() (value int32) { - if p == nil { - return - } - return p.WinnerCount -} - -// GetActivationCount returns value of ActivationCount field. -func (p *PremiumGiveawayInfoCompleted) GetActivationCount() (value int32) { - if p == nil { - return - } - return p.ActivationCount -} - -// GetGiftCode returns value of GiftCode field. -func (p *PremiumGiveawayInfoCompleted) GetGiftCode() (value string) { - if p == nil { - return - } - return p.GiftCode -} - -// PremiumGiveawayInfoClassName is schema name of PremiumGiveawayInfoClass. -const PremiumGiveawayInfoClassName = "PremiumGiveawayInfo" - -// PremiumGiveawayInfoClass represents PremiumGiveawayInfo generic type. -// -// Example: -// -// g, err := tdapi.DecodePremiumGiveawayInfo(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PremiumGiveawayInfoOngoing: // premiumGiveawayInfoOngoing#48d3ce6f -// case *tdapi.PremiumGiveawayInfoCompleted: // premiumGiveawayInfoCompleted#fc8b501b -// default: panic(v) -// } -type PremiumGiveawayInfoClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PremiumGiveawayInfoClass - - // 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 - - // Point in time (Unix timestamp) when the giveaway was created - GetCreationDate() (value int32) -} - -// DecodePremiumGiveawayInfo implements binary de-serialization for PremiumGiveawayInfoClass. -func DecodePremiumGiveawayInfo(buf *bin.Buffer) (PremiumGiveawayInfoClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PremiumGiveawayInfoOngoingTypeID: - // Decoding premiumGiveawayInfoOngoing#48d3ce6f. - v := PremiumGiveawayInfoOngoing{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumGiveawayInfoClass: %w", err) - } - return &v, nil - case PremiumGiveawayInfoCompletedTypeID: - // Decoding premiumGiveawayInfoCompleted#fc8b501b. - v := PremiumGiveawayInfoCompleted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumGiveawayInfoClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PremiumGiveawayInfoClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPremiumGiveawayInfo implements binary de-serialization for PremiumGiveawayInfoClass. -func DecodeTDLibJSONPremiumGiveawayInfo(buf tdjson.Decoder) (PremiumGiveawayInfoClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "premiumGiveawayInfoOngoing": - // Decoding premiumGiveawayInfoOngoing#48d3ce6f. - v := PremiumGiveawayInfoOngoing{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumGiveawayInfoClass: %w", err) - } - return &v, nil - case "premiumGiveawayInfoCompleted": - // Decoding premiumGiveawayInfoCompleted#fc8b501b. - v := PremiumGiveawayInfoCompleted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumGiveawayInfoClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PremiumGiveawayInfoClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PremiumGiveawayInfo boxes the PremiumGiveawayInfoClass providing a helper. -type PremiumGiveawayInfoBox struct { - PremiumGiveawayInfo PremiumGiveawayInfoClass -} - -// Decode implements bin.Decoder for PremiumGiveawayInfoBox. -func (b *PremiumGiveawayInfoBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PremiumGiveawayInfoBox to nil") - } - v, err := DecodePremiumGiveawayInfo(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PremiumGiveawayInfo = v - return nil -} - -// Encode implements bin.Encode for PremiumGiveawayInfoBox. -func (b *PremiumGiveawayInfoBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PremiumGiveawayInfo == nil { - return fmt.Errorf("unable to encode PremiumGiveawayInfoClass as nil") - } - return b.PremiumGiveawayInfo.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PremiumGiveawayInfoBox. -func (b *PremiumGiveawayInfoBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PremiumGiveawayInfoBox to nil") - } - v, err := DecodeTDLibJSONPremiumGiveawayInfo(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PremiumGiveawayInfo = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PremiumGiveawayInfoBox. -func (b *PremiumGiveawayInfoBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PremiumGiveawayInfo == nil { - return fmt.Errorf("unable to encode PremiumGiveawayInfoClass as nil") - } - return b.PremiumGiveawayInfo.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_premium_giveaway_parameters_gen.go b/tdapi/tl_premium_giveaway_parameters_gen.go deleted file mode 100644 index 00a40ae43b..0000000000 --- a/tdapi/tl_premium_giveaway_parameters_gen.go +++ /dev/null @@ -1,450 +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{} -) - -// PremiumGiveawayParameters represents TL type `premiumGiveawayParameters#f9f5bf5e`. -type PremiumGiveawayParameters struct { - // Identifier of the supergroup or channel chat, which will be automatically boosted by - // the winners of the giveaway for duration of the Premium subscription. - BoostedChatID int64 - // Identifiers of other supergroup or channel chats that must be subscribed by the users - // to be eligible for the giveaway. There can be up to - // getOption("giveaway_additional_chat_count_max") additional chats - AdditionalChatIDs []int64 - // Point in time (Unix timestamp) when the giveaway is expected to be performed; must be - // 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways - WinnersSelectionDate int32 - // True, if only new members of the chats will be eligible for the giveaway - OnlyNewMembers bool - // True, if the list of winners of the giveaway will be available to everyone - HasPublicWinners bool - // The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be - // eligible for the giveaway. If empty, then all users can participate in the giveaway. - CountryCodes []string - // Additional description of the giveaway prize; 0-128 characters - PrizeDescription string -} - -// PremiumGiveawayParametersTypeID is TL type id of PremiumGiveawayParameters. -const PremiumGiveawayParametersTypeID = 0xf9f5bf5e - -// Ensuring interfaces in compile-time for PremiumGiveawayParameters. -var ( - _ bin.Encoder = &PremiumGiveawayParameters{} - _ bin.Decoder = &PremiumGiveawayParameters{} - _ bin.BareEncoder = &PremiumGiveawayParameters{} - _ bin.BareDecoder = &PremiumGiveawayParameters{} -) - -func (p *PremiumGiveawayParameters) Zero() bool { - if p == nil { - return true - } - if !(p.BoostedChatID == 0) { - return false - } - if !(p.AdditionalChatIDs == nil) { - return false - } - if !(p.WinnersSelectionDate == 0) { - return false - } - if !(p.OnlyNewMembers == false) { - return false - } - if !(p.HasPublicWinners == false) { - return false - } - if !(p.CountryCodes == nil) { - return false - } - if !(p.PrizeDescription == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumGiveawayParameters) String() string { - if p == nil { - return "PremiumGiveawayParameters(nil)" - } - type Alias PremiumGiveawayParameters - return fmt.Sprintf("PremiumGiveawayParameters%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumGiveawayParameters) TypeID() uint32 { - return PremiumGiveawayParametersTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumGiveawayParameters) TypeName() string { - return "premiumGiveawayParameters" -} - -// TypeInfo returns info about TL type. -func (p *PremiumGiveawayParameters) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumGiveawayParameters", - ID: PremiumGiveawayParametersTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BoostedChatID", - SchemaName: "boosted_chat_id", - }, - { - Name: "AdditionalChatIDs", - SchemaName: "additional_chat_ids", - }, - { - Name: "WinnersSelectionDate", - SchemaName: "winners_selection_date", - }, - { - Name: "OnlyNewMembers", - SchemaName: "only_new_members", - }, - { - Name: "HasPublicWinners", - SchemaName: "has_public_winners", - }, - { - Name: "CountryCodes", - SchemaName: "country_codes", - }, - { - Name: "PrizeDescription", - SchemaName: "prize_description", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumGiveawayParameters) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayParameters#f9f5bf5e as nil") - } - b.PutID(PremiumGiveawayParametersTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumGiveawayParameters) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayParameters#f9f5bf5e as nil") - } - b.PutInt53(p.BoostedChatID) - b.PutInt(len(p.AdditionalChatIDs)) - for _, v := range p.AdditionalChatIDs { - b.PutInt53(v) - } - b.PutInt32(p.WinnersSelectionDate) - b.PutBool(p.OnlyNewMembers) - b.PutBool(p.HasPublicWinners) - b.PutInt(len(p.CountryCodes)) - for _, v := range p.CountryCodes { - b.PutString(v) - } - b.PutString(p.PrizeDescription) - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumGiveawayParameters) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayParameters#f9f5bf5e to nil") - } - if err := b.ConsumeID(PremiumGiveawayParametersTypeID); err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParameters#f9f5bf5e: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumGiveawayParameters) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayParameters#f9f5bf5e to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParameters#f9f5bf5e: field boosted_chat_id: %w", err) - } - p.BoostedChatID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParameters#f9f5bf5e: field additional_chat_ids: %w", err) - } - - if headerLen > 0 { - p.AdditionalChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParameters#f9f5bf5e: field additional_chat_ids: %w", err) - } - p.AdditionalChatIDs = append(p.AdditionalChatIDs, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParameters#f9f5bf5e: field winners_selection_date: %w", err) - } - p.WinnersSelectionDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParameters#f9f5bf5e: field only_new_members: %w", err) - } - p.OnlyNewMembers = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParameters#f9f5bf5e: field has_public_winners: %w", err) - } - p.HasPublicWinners = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParameters#f9f5bf5e: field country_codes: %w", err) - } - - if headerLen > 0 { - p.CountryCodes = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParameters#f9f5bf5e: field country_codes: %w", err) - } - p.CountryCodes = append(p.CountryCodes, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParameters#f9f5bf5e: field prize_description: %w", err) - } - p.PrizeDescription = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumGiveawayParameters) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayParameters#f9f5bf5e as nil") - } - b.ObjStart() - b.PutID("premiumGiveawayParameters") - b.Comma() - b.FieldStart("boosted_chat_id") - b.PutInt53(p.BoostedChatID) - b.Comma() - b.FieldStart("additional_chat_ids") - b.ArrStart() - for _, v := range p.AdditionalChatIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("winners_selection_date") - b.PutInt32(p.WinnersSelectionDate) - b.Comma() - b.FieldStart("only_new_members") - b.PutBool(p.OnlyNewMembers) - b.Comma() - b.FieldStart("has_public_winners") - b.PutBool(p.HasPublicWinners) - b.Comma() - b.FieldStart("country_codes") - b.ArrStart() - for _, v := range p.CountryCodes { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("prize_description") - b.PutString(p.PrizeDescription) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumGiveawayParameters) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayParameters#f9f5bf5e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumGiveawayParameters"); err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParameters#f9f5bf5e: %w", err) - } - case "boosted_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParameters#f9f5bf5e: field boosted_chat_id: %w", err) - } - p.BoostedChatID = value - case "additional_chat_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParameters#f9f5bf5e: field additional_chat_ids: %w", err) - } - p.AdditionalChatIDs = append(p.AdditionalChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParameters#f9f5bf5e: field additional_chat_ids: %w", err) - } - case "winners_selection_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParameters#f9f5bf5e: field winners_selection_date: %w", err) - } - p.WinnersSelectionDate = value - case "only_new_members": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParameters#f9f5bf5e: field only_new_members: %w", err) - } - p.OnlyNewMembers = value - case "has_public_winners": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParameters#f9f5bf5e: field has_public_winners: %w", err) - } - p.HasPublicWinners = value - case "country_codes": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParameters#f9f5bf5e: field country_codes: %w", err) - } - p.CountryCodes = append(p.CountryCodes, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParameters#f9f5bf5e: field country_codes: %w", err) - } - case "prize_description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParameters#f9f5bf5e: field prize_description: %w", err) - } - p.PrizeDescription = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBoostedChatID returns value of BoostedChatID field. -func (p *PremiumGiveawayParameters) GetBoostedChatID() (value int64) { - if p == nil { - return - } - return p.BoostedChatID -} - -// GetAdditionalChatIDs returns value of AdditionalChatIDs field. -func (p *PremiumGiveawayParameters) GetAdditionalChatIDs() (value []int64) { - if p == nil { - return - } - return p.AdditionalChatIDs -} - -// GetWinnersSelectionDate returns value of WinnersSelectionDate field. -func (p *PremiumGiveawayParameters) GetWinnersSelectionDate() (value int32) { - if p == nil { - return - } - return p.WinnersSelectionDate -} - -// GetOnlyNewMembers returns value of OnlyNewMembers field. -func (p *PremiumGiveawayParameters) GetOnlyNewMembers() (value bool) { - if p == nil { - return - } - return p.OnlyNewMembers -} - -// GetHasPublicWinners returns value of HasPublicWinners field. -func (p *PremiumGiveawayParameters) GetHasPublicWinners() (value bool) { - if p == nil { - return - } - return p.HasPublicWinners -} - -// GetCountryCodes returns value of CountryCodes field. -func (p *PremiumGiveawayParameters) GetCountryCodes() (value []string) { - if p == nil { - return - } - return p.CountryCodes -} - -// GetPrizeDescription returns value of PrizeDescription field. -func (p *PremiumGiveawayParameters) GetPrizeDescription() (value string) { - if p == nil { - return - } - return p.PrizeDescription -} diff --git a/tdapi/tl_premium_giveaway_participant_status_gen.go b/tdapi/tl_premium_giveaway_participant_status_gen.go deleted file mode 100644 index 58035da349..0000000000 --- a/tdapi/tl_premium_giveaway_participant_status_gen.go +++ /dev/null @@ -1,984 +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{} -) - -// PremiumGiveawayParticipantStatusEligible represents TL type `premiumGiveawayParticipantStatusEligible#7ee281c0`. -type PremiumGiveawayParticipantStatusEligible struct { -} - -// PremiumGiveawayParticipantStatusEligibleTypeID is TL type id of PremiumGiveawayParticipantStatusEligible. -const PremiumGiveawayParticipantStatusEligibleTypeID = 0x7ee281c0 - -// construct implements constructor of PremiumGiveawayParticipantStatusClass. -func (p PremiumGiveawayParticipantStatusEligible) construct() PremiumGiveawayParticipantStatusClass { - return &p -} - -// Ensuring interfaces in compile-time for PremiumGiveawayParticipantStatusEligible. -var ( - _ bin.Encoder = &PremiumGiveawayParticipantStatusEligible{} - _ bin.Decoder = &PremiumGiveawayParticipantStatusEligible{} - _ bin.BareEncoder = &PremiumGiveawayParticipantStatusEligible{} - _ bin.BareDecoder = &PremiumGiveawayParticipantStatusEligible{} - - _ PremiumGiveawayParticipantStatusClass = &PremiumGiveawayParticipantStatusEligible{} -) - -func (p *PremiumGiveawayParticipantStatusEligible) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumGiveawayParticipantStatusEligible) String() string { - if p == nil { - return "PremiumGiveawayParticipantStatusEligible(nil)" - } - type Alias PremiumGiveawayParticipantStatusEligible - return fmt.Sprintf("PremiumGiveawayParticipantStatusEligible%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumGiveawayParticipantStatusEligible) TypeID() uint32 { - return PremiumGiveawayParticipantStatusEligibleTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumGiveawayParticipantStatusEligible) TypeName() string { - return "premiumGiveawayParticipantStatusEligible" -} - -// TypeInfo returns info about TL type. -func (p *PremiumGiveawayParticipantStatusEligible) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumGiveawayParticipantStatusEligible", - ID: PremiumGiveawayParticipantStatusEligibleTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumGiveawayParticipantStatusEligible) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayParticipantStatusEligible#7ee281c0 as nil") - } - b.PutID(PremiumGiveawayParticipantStatusEligibleTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumGiveawayParticipantStatusEligible) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayParticipantStatusEligible#7ee281c0 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumGiveawayParticipantStatusEligible) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayParticipantStatusEligible#7ee281c0 to nil") - } - if err := b.ConsumeID(PremiumGiveawayParticipantStatusEligibleTypeID); err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParticipantStatusEligible#7ee281c0: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumGiveawayParticipantStatusEligible) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayParticipantStatusEligible#7ee281c0 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumGiveawayParticipantStatusEligible) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayParticipantStatusEligible#7ee281c0 as nil") - } - b.ObjStart() - b.PutID("premiumGiveawayParticipantStatusEligible") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumGiveawayParticipantStatusEligible) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayParticipantStatusEligible#7ee281c0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumGiveawayParticipantStatusEligible"); err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParticipantStatusEligible#7ee281c0: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumGiveawayParticipantStatusParticipating represents TL type `premiumGiveawayParticipantStatusParticipating#740406d1`. -type PremiumGiveawayParticipantStatusParticipating struct { -} - -// PremiumGiveawayParticipantStatusParticipatingTypeID is TL type id of PremiumGiveawayParticipantStatusParticipating. -const PremiumGiveawayParticipantStatusParticipatingTypeID = 0x740406d1 - -// construct implements constructor of PremiumGiveawayParticipantStatusClass. -func (p PremiumGiveawayParticipantStatusParticipating) construct() PremiumGiveawayParticipantStatusClass { - return &p -} - -// Ensuring interfaces in compile-time for PremiumGiveawayParticipantStatusParticipating. -var ( - _ bin.Encoder = &PremiumGiveawayParticipantStatusParticipating{} - _ bin.Decoder = &PremiumGiveawayParticipantStatusParticipating{} - _ bin.BareEncoder = &PremiumGiveawayParticipantStatusParticipating{} - _ bin.BareDecoder = &PremiumGiveawayParticipantStatusParticipating{} - - _ PremiumGiveawayParticipantStatusClass = &PremiumGiveawayParticipantStatusParticipating{} -) - -func (p *PremiumGiveawayParticipantStatusParticipating) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumGiveawayParticipantStatusParticipating) String() string { - if p == nil { - return "PremiumGiveawayParticipantStatusParticipating(nil)" - } - type Alias PremiumGiveawayParticipantStatusParticipating - return fmt.Sprintf("PremiumGiveawayParticipantStatusParticipating%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumGiveawayParticipantStatusParticipating) TypeID() uint32 { - return PremiumGiveawayParticipantStatusParticipatingTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumGiveawayParticipantStatusParticipating) TypeName() string { - return "premiumGiveawayParticipantStatusParticipating" -} - -// TypeInfo returns info about TL type. -func (p *PremiumGiveawayParticipantStatusParticipating) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumGiveawayParticipantStatusParticipating", - ID: PremiumGiveawayParticipantStatusParticipatingTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumGiveawayParticipantStatusParticipating) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayParticipantStatusParticipating#740406d1 as nil") - } - b.PutID(PremiumGiveawayParticipantStatusParticipatingTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumGiveawayParticipantStatusParticipating) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayParticipantStatusParticipating#740406d1 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumGiveawayParticipantStatusParticipating) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayParticipantStatusParticipating#740406d1 to nil") - } - if err := b.ConsumeID(PremiumGiveawayParticipantStatusParticipatingTypeID); err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParticipantStatusParticipating#740406d1: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumGiveawayParticipantStatusParticipating) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayParticipantStatusParticipating#740406d1 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumGiveawayParticipantStatusParticipating) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayParticipantStatusParticipating#740406d1 as nil") - } - b.ObjStart() - b.PutID("premiumGiveawayParticipantStatusParticipating") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumGiveawayParticipantStatusParticipating) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayParticipantStatusParticipating#740406d1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumGiveawayParticipantStatusParticipating"); err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParticipantStatusParticipating#740406d1: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumGiveawayParticipantStatusAlreadyWasMember represents TL type `premiumGiveawayParticipantStatusAlreadyWasMember#8d3045a3`. -type PremiumGiveawayParticipantStatusAlreadyWasMember struct { - // Point in time (Unix timestamp) when the user joined the chat - JoinedChatDate int32 -} - -// PremiumGiveawayParticipantStatusAlreadyWasMemberTypeID is TL type id of PremiumGiveawayParticipantStatusAlreadyWasMember. -const PremiumGiveawayParticipantStatusAlreadyWasMemberTypeID = 0x8d3045a3 - -// construct implements constructor of PremiumGiveawayParticipantStatusClass. -func (p PremiumGiveawayParticipantStatusAlreadyWasMember) construct() PremiumGiveawayParticipantStatusClass { - return &p -} - -// Ensuring interfaces in compile-time for PremiumGiveawayParticipantStatusAlreadyWasMember. -var ( - _ bin.Encoder = &PremiumGiveawayParticipantStatusAlreadyWasMember{} - _ bin.Decoder = &PremiumGiveawayParticipantStatusAlreadyWasMember{} - _ bin.BareEncoder = &PremiumGiveawayParticipantStatusAlreadyWasMember{} - _ bin.BareDecoder = &PremiumGiveawayParticipantStatusAlreadyWasMember{} - - _ PremiumGiveawayParticipantStatusClass = &PremiumGiveawayParticipantStatusAlreadyWasMember{} -) - -func (p *PremiumGiveawayParticipantStatusAlreadyWasMember) Zero() bool { - if p == nil { - return true - } - if !(p.JoinedChatDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumGiveawayParticipantStatusAlreadyWasMember) String() string { - if p == nil { - return "PremiumGiveawayParticipantStatusAlreadyWasMember(nil)" - } - type Alias PremiumGiveawayParticipantStatusAlreadyWasMember - return fmt.Sprintf("PremiumGiveawayParticipantStatusAlreadyWasMember%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumGiveawayParticipantStatusAlreadyWasMember) TypeID() uint32 { - return PremiumGiveawayParticipantStatusAlreadyWasMemberTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumGiveawayParticipantStatusAlreadyWasMember) TypeName() string { - return "premiumGiveawayParticipantStatusAlreadyWasMember" -} - -// TypeInfo returns info about TL type. -func (p *PremiumGiveawayParticipantStatusAlreadyWasMember) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumGiveawayParticipantStatusAlreadyWasMember", - ID: PremiumGiveawayParticipantStatusAlreadyWasMemberTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "JoinedChatDate", - SchemaName: "joined_chat_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumGiveawayParticipantStatusAlreadyWasMember) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayParticipantStatusAlreadyWasMember#8d3045a3 as nil") - } - b.PutID(PremiumGiveawayParticipantStatusAlreadyWasMemberTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumGiveawayParticipantStatusAlreadyWasMember) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayParticipantStatusAlreadyWasMember#8d3045a3 as nil") - } - b.PutInt32(p.JoinedChatDate) - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumGiveawayParticipantStatusAlreadyWasMember) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayParticipantStatusAlreadyWasMember#8d3045a3 to nil") - } - if err := b.ConsumeID(PremiumGiveawayParticipantStatusAlreadyWasMemberTypeID); err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParticipantStatusAlreadyWasMember#8d3045a3: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumGiveawayParticipantStatusAlreadyWasMember) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayParticipantStatusAlreadyWasMember#8d3045a3 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParticipantStatusAlreadyWasMember#8d3045a3: field joined_chat_date: %w", err) - } - p.JoinedChatDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumGiveawayParticipantStatusAlreadyWasMember) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayParticipantStatusAlreadyWasMember#8d3045a3 as nil") - } - b.ObjStart() - b.PutID("premiumGiveawayParticipantStatusAlreadyWasMember") - b.Comma() - b.FieldStart("joined_chat_date") - b.PutInt32(p.JoinedChatDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumGiveawayParticipantStatusAlreadyWasMember) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayParticipantStatusAlreadyWasMember#8d3045a3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumGiveawayParticipantStatusAlreadyWasMember"); err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParticipantStatusAlreadyWasMember#8d3045a3: %w", err) - } - case "joined_chat_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParticipantStatusAlreadyWasMember#8d3045a3: field joined_chat_date: %w", err) - } - p.JoinedChatDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetJoinedChatDate returns value of JoinedChatDate field. -func (p *PremiumGiveawayParticipantStatusAlreadyWasMember) GetJoinedChatDate() (value int32) { - if p == nil { - return - } - return p.JoinedChatDate -} - -// PremiumGiveawayParticipantStatusAdministrator represents TL type `premiumGiveawayParticipantStatusAdministrator#7244dace`. -type PremiumGiveawayParticipantStatusAdministrator struct { - // Identifier of the chat administered by the user - ChatID int64 -} - -// PremiumGiveawayParticipantStatusAdministratorTypeID is TL type id of PremiumGiveawayParticipantStatusAdministrator. -const PremiumGiveawayParticipantStatusAdministratorTypeID = 0x7244dace - -// construct implements constructor of PremiumGiveawayParticipantStatusClass. -func (p PremiumGiveawayParticipantStatusAdministrator) construct() PremiumGiveawayParticipantStatusClass { - return &p -} - -// Ensuring interfaces in compile-time for PremiumGiveawayParticipantStatusAdministrator. -var ( - _ bin.Encoder = &PremiumGiveawayParticipantStatusAdministrator{} - _ bin.Decoder = &PremiumGiveawayParticipantStatusAdministrator{} - _ bin.BareEncoder = &PremiumGiveawayParticipantStatusAdministrator{} - _ bin.BareDecoder = &PremiumGiveawayParticipantStatusAdministrator{} - - _ PremiumGiveawayParticipantStatusClass = &PremiumGiveawayParticipantStatusAdministrator{} -) - -func (p *PremiumGiveawayParticipantStatusAdministrator) Zero() bool { - if p == nil { - return true - } - if !(p.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumGiveawayParticipantStatusAdministrator) String() string { - if p == nil { - return "PremiumGiveawayParticipantStatusAdministrator(nil)" - } - type Alias PremiumGiveawayParticipantStatusAdministrator - return fmt.Sprintf("PremiumGiveawayParticipantStatusAdministrator%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumGiveawayParticipantStatusAdministrator) TypeID() uint32 { - return PremiumGiveawayParticipantStatusAdministratorTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumGiveawayParticipantStatusAdministrator) TypeName() string { - return "premiumGiveawayParticipantStatusAdministrator" -} - -// TypeInfo returns info about TL type. -func (p *PremiumGiveawayParticipantStatusAdministrator) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumGiveawayParticipantStatusAdministrator", - ID: PremiumGiveawayParticipantStatusAdministratorTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumGiveawayParticipantStatusAdministrator) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayParticipantStatusAdministrator#7244dace as nil") - } - b.PutID(PremiumGiveawayParticipantStatusAdministratorTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumGiveawayParticipantStatusAdministrator) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayParticipantStatusAdministrator#7244dace as nil") - } - b.PutInt53(p.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumGiveawayParticipantStatusAdministrator) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayParticipantStatusAdministrator#7244dace to nil") - } - if err := b.ConsumeID(PremiumGiveawayParticipantStatusAdministratorTypeID); err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParticipantStatusAdministrator#7244dace: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumGiveawayParticipantStatusAdministrator) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayParticipantStatusAdministrator#7244dace to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParticipantStatusAdministrator#7244dace: field chat_id: %w", err) - } - p.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumGiveawayParticipantStatusAdministrator) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayParticipantStatusAdministrator#7244dace as nil") - } - b.ObjStart() - b.PutID("premiumGiveawayParticipantStatusAdministrator") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(p.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumGiveawayParticipantStatusAdministrator) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayParticipantStatusAdministrator#7244dace to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumGiveawayParticipantStatusAdministrator"); err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParticipantStatusAdministrator#7244dace: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParticipantStatusAdministrator#7244dace: field chat_id: %w", err) - } - p.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (p *PremiumGiveawayParticipantStatusAdministrator) GetChatID() (value int64) { - if p == nil { - return - } - return p.ChatID -} - -// PremiumGiveawayParticipantStatusDisallowedCountry represents TL type `premiumGiveawayParticipantStatusDisallowedCountry#89684090`. -type PremiumGiveawayParticipantStatusDisallowedCountry struct { - // A two-letter ISO 3166-1 alpha-2 country code of the user's country - UserCountryCode string -} - -// PremiumGiveawayParticipantStatusDisallowedCountryTypeID is TL type id of PremiumGiveawayParticipantStatusDisallowedCountry. -const PremiumGiveawayParticipantStatusDisallowedCountryTypeID = 0x89684090 - -// construct implements constructor of PremiumGiveawayParticipantStatusClass. -func (p PremiumGiveawayParticipantStatusDisallowedCountry) construct() PremiumGiveawayParticipantStatusClass { - return &p -} - -// Ensuring interfaces in compile-time for PremiumGiveawayParticipantStatusDisallowedCountry. -var ( - _ bin.Encoder = &PremiumGiveawayParticipantStatusDisallowedCountry{} - _ bin.Decoder = &PremiumGiveawayParticipantStatusDisallowedCountry{} - _ bin.BareEncoder = &PremiumGiveawayParticipantStatusDisallowedCountry{} - _ bin.BareDecoder = &PremiumGiveawayParticipantStatusDisallowedCountry{} - - _ PremiumGiveawayParticipantStatusClass = &PremiumGiveawayParticipantStatusDisallowedCountry{} -) - -func (p *PremiumGiveawayParticipantStatusDisallowedCountry) Zero() bool { - if p == nil { - return true - } - if !(p.UserCountryCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumGiveawayParticipantStatusDisallowedCountry) String() string { - if p == nil { - return "PremiumGiveawayParticipantStatusDisallowedCountry(nil)" - } - type Alias PremiumGiveawayParticipantStatusDisallowedCountry - return fmt.Sprintf("PremiumGiveawayParticipantStatusDisallowedCountry%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumGiveawayParticipantStatusDisallowedCountry) TypeID() uint32 { - return PremiumGiveawayParticipantStatusDisallowedCountryTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumGiveawayParticipantStatusDisallowedCountry) TypeName() string { - return "premiumGiveawayParticipantStatusDisallowedCountry" -} - -// TypeInfo returns info about TL type. -func (p *PremiumGiveawayParticipantStatusDisallowedCountry) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumGiveawayParticipantStatusDisallowedCountry", - ID: PremiumGiveawayParticipantStatusDisallowedCountryTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserCountryCode", - SchemaName: "user_country_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumGiveawayParticipantStatusDisallowedCountry) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayParticipantStatusDisallowedCountry#89684090 as nil") - } - b.PutID(PremiumGiveawayParticipantStatusDisallowedCountryTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumGiveawayParticipantStatusDisallowedCountry) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayParticipantStatusDisallowedCountry#89684090 as nil") - } - b.PutString(p.UserCountryCode) - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumGiveawayParticipantStatusDisallowedCountry) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayParticipantStatusDisallowedCountry#89684090 to nil") - } - if err := b.ConsumeID(PremiumGiveawayParticipantStatusDisallowedCountryTypeID); err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParticipantStatusDisallowedCountry#89684090: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumGiveawayParticipantStatusDisallowedCountry) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayParticipantStatusDisallowedCountry#89684090 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParticipantStatusDisallowedCountry#89684090: field user_country_code: %w", err) - } - p.UserCountryCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumGiveawayParticipantStatusDisallowedCountry) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiveawayParticipantStatusDisallowedCountry#89684090 as nil") - } - b.ObjStart() - b.PutID("premiumGiveawayParticipantStatusDisallowedCountry") - b.Comma() - b.FieldStart("user_country_code") - b.PutString(p.UserCountryCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumGiveawayParticipantStatusDisallowedCountry) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiveawayParticipantStatusDisallowedCountry#89684090 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumGiveawayParticipantStatusDisallowedCountry"); err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParticipantStatusDisallowedCountry#89684090: %w", err) - } - case "user_country_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode premiumGiveawayParticipantStatusDisallowedCountry#89684090: field user_country_code: %w", err) - } - p.UserCountryCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserCountryCode returns value of UserCountryCode field. -func (p *PremiumGiveawayParticipantStatusDisallowedCountry) GetUserCountryCode() (value string) { - if p == nil { - return - } - return p.UserCountryCode -} - -// PremiumGiveawayParticipantStatusClassName is schema name of PremiumGiveawayParticipantStatusClass. -const PremiumGiveawayParticipantStatusClassName = "PremiumGiveawayParticipantStatus" - -// PremiumGiveawayParticipantStatusClass represents PremiumGiveawayParticipantStatus generic type. -// -// Example: -// -// g, err := tdapi.DecodePremiumGiveawayParticipantStatus(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PremiumGiveawayParticipantStatusEligible: // premiumGiveawayParticipantStatusEligible#7ee281c0 -// case *tdapi.PremiumGiveawayParticipantStatusParticipating: // premiumGiveawayParticipantStatusParticipating#740406d1 -// case *tdapi.PremiumGiveawayParticipantStatusAlreadyWasMember: // premiumGiveawayParticipantStatusAlreadyWasMember#8d3045a3 -// case *tdapi.PremiumGiveawayParticipantStatusAdministrator: // premiumGiveawayParticipantStatusAdministrator#7244dace -// case *tdapi.PremiumGiveawayParticipantStatusDisallowedCountry: // premiumGiveawayParticipantStatusDisallowedCountry#89684090 -// default: panic(v) -// } -type PremiumGiveawayParticipantStatusClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PremiumGiveawayParticipantStatusClass - - // 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 -} - -// DecodePremiumGiveawayParticipantStatus implements binary de-serialization for PremiumGiveawayParticipantStatusClass. -func DecodePremiumGiveawayParticipantStatus(buf *bin.Buffer) (PremiumGiveawayParticipantStatusClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PremiumGiveawayParticipantStatusEligibleTypeID: - // Decoding premiumGiveawayParticipantStatusEligible#7ee281c0. - v := PremiumGiveawayParticipantStatusEligible{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumGiveawayParticipantStatusClass: %w", err) - } - return &v, nil - case PremiumGiveawayParticipantStatusParticipatingTypeID: - // Decoding premiumGiveawayParticipantStatusParticipating#740406d1. - v := PremiumGiveawayParticipantStatusParticipating{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumGiveawayParticipantStatusClass: %w", err) - } - return &v, nil - case PremiumGiveawayParticipantStatusAlreadyWasMemberTypeID: - // Decoding premiumGiveawayParticipantStatusAlreadyWasMember#8d3045a3. - v := PremiumGiveawayParticipantStatusAlreadyWasMember{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumGiveawayParticipantStatusClass: %w", err) - } - return &v, nil - case PremiumGiveawayParticipantStatusAdministratorTypeID: - // Decoding premiumGiveawayParticipantStatusAdministrator#7244dace. - v := PremiumGiveawayParticipantStatusAdministrator{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumGiveawayParticipantStatusClass: %w", err) - } - return &v, nil - case PremiumGiveawayParticipantStatusDisallowedCountryTypeID: - // Decoding premiumGiveawayParticipantStatusDisallowedCountry#89684090. - v := PremiumGiveawayParticipantStatusDisallowedCountry{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumGiveawayParticipantStatusClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PremiumGiveawayParticipantStatusClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPremiumGiveawayParticipantStatus implements binary de-serialization for PremiumGiveawayParticipantStatusClass. -func DecodeTDLibJSONPremiumGiveawayParticipantStatus(buf tdjson.Decoder) (PremiumGiveawayParticipantStatusClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "premiumGiveawayParticipantStatusEligible": - // Decoding premiumGiveawayParticipantStatusEligible#7ee281c0. - v := PremiumGiveawayParticipantStatusEligible{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumGiveawayParticipantStatusClass: %w", err) - } - return &v, nil - case "premiumGiveawayParticipantStatusParticipating": - // Decoding premiumGiveawayParticipantStatusParticipating#740406d1. - v := PremiumGiveawayParticipantStatusParticipating{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumGiveawayParticipantStatusClass: %w", err) - } - return &v, nil - case "premiumGiveawayParticipantStatusAlreadyWasMember": - // Decoding premiumGiveawayParticipantStatusAlreadyWasMember#8d3045a3. - v := PremiumGiveawayParticipantStatusAlreadyWasMember{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumGiveawayParticipantStatusClass: %w", err) - } - return &v, nil - case "premiumGiveawayParticipantStatusAdministrator": - // Decoding premiumGiveawayParticipantStatusAdministrator#7244dace. - v := PremiumGiveawayParticipantStatusAdministrator{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumGiveawayParticipantStatusClass: %w", err) - } - return &v, nil - case "premiumGiveawayParticipantStatusDisallowedCountry": - // Decoding premiumGiveawayParticipantStatusDisallowedCountry#89684090. - v := PremiumGiveawayParticipantStatusDisallowedCountry{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumGiveawayParticipantStatusClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PremiumGiveawayParticipantStatusClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PremiumGiveawayParticipantStatus boxes the PremiumGiveawayParticipantStatusClass providing a helper. -type PremiumGiveawayParticipantStatusBox struct { - PremiumGiveawayParticipantStatus PremiumGiveawayParticipantStatusClass -} - -// Decode implements bin.Decoder for PremiumGiveawayParticipantStatusBox. -func (b *PremiumGiveawayParticipantStatusBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PremiumGiveawayParticipantStatusBox to nil") - } - v, err := DecodePremiumGiveawayParticipantStatus(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PremiumGiveawayParticipantStatus = v - return nil -} - -// Encode implements bin.Encode for PremiumGiveawayParticipantStatusBox. -func (b *PremiumGiveawayParticipantStatusBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PremiumGiveawayParticipantStatus == nil { - return fmt.Errorf("unable to encode PremiumGiveawayParticipantStatusClass as nil") - } - return b.PremiumGiveawayParticipantStatus.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PremiumGiveawayParticipantStatusBox. -func (b *PremiumGiveawayParticipantStatusBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PremiumGiveawayParticipantStatusBox to nil") - } - v, err := DecodeTDLibJSONPremiumGiveawayParticipantStatus(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PremiumGiveawayParticipantStatus = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PremiumGiveawayParticipantStatusBox. -func (b *PremiumGiveawayParticipantStatusBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PremiumGiveawayParticipantStatus == nil { - return fmt.Errorf("unable to encode PremiumGiveawayParticipantStatusClass as nil") - } - return b.PremiumGiveawayParticipantStatus.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_prepaid_giveaway_gen.go b/tdapi/tl_prepaid_giveaway_gen.go new file mode 100644 index 0000000000..0d5064d0e6 --- /dev/null +++ b/tdapi/tl_prepaid_giveaway_gen.go @@ -0,0 +1,340 @@ +// 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{} +) + +// PrepaidGiveaway represents TL type `prepaidGiveaway#ef70338f`. +type PrepaidGiveaway struct { + // Unique identifier of the prepaid giveaway + ID int64 + // Number of users which will receive giveaway prize + WinnerCount int32 + // Prize of the giveaway + Prize GiveawayPrizeClass + // The number of boosts received by the chat from the giveaway; for Telegram Star + // giveaways only + BoostCount int32 + // Point in time (Unix timestamp) when the giveaway was paid + PaymentDate int32 +} + +// PrepaidGiveawayTypeID is TL type id of PrepaidGiveaway. +const PrepaidGiveawayTypeID = 0xef70338f + +// Ensuring interfaces in compile-time for PrepaidGiveaway. +var ( + _ bin.Encoder = &PrepaidGiveaway{} + _ bin.Decoder = &PrepaidGiveaway{} + _ bin.BareEncoder = &PrepaidGiveaway{} + _ bin.BareDecoder = &PrepaidGiveaway{} +) + +func (p *PrepaidGiveaway) Zero() bool { + if p == nil { + return true + } + if !(p.ID == 0) { + return false + } + if !(p.WinnerCount == 0) { + return false + } + if !(p.Prize == nil) { + return false + } + if !(p.BoostCount == 0) { + return false + } + if !(p.PaymentDate == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *PrepaidGiveaway) String() string { + if p == nil { + return "PrepaidGiveaway(nil)" + } + type Alias PrepaidGiveaway + return fmt.Sprintf("PrepaidGiveaway%+v", Alias(*p)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PrepaidGiveaway) TypeID() uint32 { + return PrepaidGiveawayTypeID +} + +// TypeName returns name of type in TL schema. +func (*PrepaidGiveaway) TypeName() string { + return "prepaidGiveaway" +} + +// TypeInfo returns info about TL type. +func (p *PrepaidGiveaway) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "prepaidGiveaway", + ID: PrepaidGiveawayTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ID", + SchemaName: "id", + }, + { + Name: "WinnerCount", + SchemaName: "winner_count", + }, + { + Name: "Prize", + SchemaName: "prize", + }, + { + Name: "BoostCount", + SchemaName: "boost_count", + }, + { + Name: "PaymentDate", + SchemaName: "payment_date", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (p *PrepaidGiveaway) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode prepaidGiveaway#ef70338f as nil") + } + b.PutID(PrepaidGiveawayTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *PrepaidGiveaway) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode prepaidGiveaway#ef70338f as nil") + } + b.PutLong(p.ID) + b.PutInt32(p.WinnerCount) + if p.Prize == nil { + return fmt.Errorf("unable to encode prepaidGiveaway#ef70338f: field prize is nil") + } + if err := p.Prize.Encode(b); err != nil { + return fmt.Errorf("unable to encode prepaidGiveaway#ef70338f: field prize: %w", err) + } + b.PutInt32(p.BoostCount) + b.PutInt32(p.PaymentDate) + return nil +} + +// Decode implements bin.Decoder. +func (p *PrepaidGiveaway) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode prepaidGiveaway#ef70338f to nil") + } + if err := b.ConsumeID(PrepaidGiveawayTypeID); err != nil { + return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *PrepaidGiveaway) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode prepaidGiveaway#ef70338f to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: field id: %w", err) + } + p.ID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: field winner_count: %w", err) + } + p.WinnerCount = value + } + { + value, err := DecodeGiveawayPrize(b) + if err != nil { + return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: field prize: %w", err) + } + p.Prize = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: field boost_count: %w", err) + } + p.BoostCount = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: field payment_date: %w", err) + } + p.PaymentDate = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (p *PrepaidGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { + if p == nil { + return fmt.Errorf("can't encode prepaidGiveaway#ef70338f as nil") + } + b.ObjStart() + b.PutID("prepaidGiveaway") + b.Comma() + b.FieldStart("id") + b.PutLong(p.ID) + b.Comma() + b.FieldStart("winner_count") + b.PutInt32(p.WinnerCount) + b.Comma() + b.FieldStart("prize") + if p.Prize == nil { + return fmt.Errorf("unable to encode prepaidGiveaway#ef70338f: field prize is nil") + } + if err := p.Prize.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode prepaidGiveaway#ef70338f: field prize: %w", err) + } + b.Comma() + b.FieldStart("boost_count") + b.PutInt32(p.BoostCount) + b.Comma() + b.FieldStart("payment_date") + b.PutInt32(p.PaymentDate) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (p *PrepaidGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { + if p == nil { + return fmt.Errorf("can't decode prepaidGiveaway#ef70338f to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("prepaidGiveaway"); err != nil { + return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: %w", err) + } + case "id": + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: field id: %w", err) + } + p.ID = value + case "winner_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: field winner_count: %w", err) + } + p.WinnerCount = value + case "prize": + value, err := DecodeTDLibJSONGiveawayPrize(b) + if err != nil { + return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: field prize: %w", err) + } + p.Prize = value + case "boost_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: field boost_count: %w", err) + } + p.BoostCount = value + case "payment_date": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: field payment_date: %w", err) + } + p.PaymentDate = value + default: + return b.Skip() + } + return nil + }) +} + +// GetID returns value of ID field. +func (p *PrepaidGiveaway) GetID() (value int64) { + if p == nil { + return + } + return p.ID +} + +// GetWinnerCount returns value of WinnerCount field. +func (p *PrepaidGiveaway) GetWinnerCount() (value int32) { + if p == nil { + return + } + return p.WinnerCount +} + +// GetPrize returns value of Prize field. +func (p *PrepaidGiveaway) GetPrize() (value GiveawayPrizeClass) { + if p == nil { + return + } + return p.Prize +} + +// GetBoostCount returns value of BoostCount field. +func (p *PrepaidGiveaway) GetBoostCount() (value int32) { + if p == nil { + return + } + return p.BoostCount +} + +// GetPaymentDate returns value of PaymentDate field. +func (p *PrepaidGiveaway) GetPaymentDate() (value int32) { + if p == nil { + return + } + return p.PaymentDate +} diff --git a/tdapi/tl_prepaid_premium_giveaway_gen.go b/tdapi/tl_prepaid_premium_giveaway_gen.go deleted file mode 100644 index 157fe4f35a..0000000000 --- a/tdapi/tl_prepaid_premium_giveaway_gen.go +++ /dev/null @@ -1,296 +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{} -) - -// PrepaidPremiumGiveaway represents TL type `prepaidPremiumGiveaway#6bd53140`. -type PrepaidPremiumGiveaway struct { - // Unique identifier of the prepaid giveaway - ID int64 - // Number of users which will receive Telegram Premium subscription gift codes - WinnerCount int32 - // Number of months the Telegram Premium subscription will be active after code - // activation - MonthCount int32 - // Point in time (Unix timestamp) when the giveaway was paid - PaymentDate int32 -} - -// PrepaidPremiumGiveawayTypeID is TL type id of PrepaidPremiumGiveaway. -const PrepaidPremiumGiveawayTypeID = 0x6bd53140 - -// Ensuring interfaces in compile-time for PrepaidPremiumGiveaway. -var ( - _ bin.Encoder = &PrepaidPremiumGiveaway{} - _ bin.Decoder = &PrepaidPremiumGiveaway{} - _ bin.BareEncoder = &PrepaidPremiumGiveaway{} - _ bin.BareDecoder = &PrepaidPremiumGiveaway{} -) - -func (p *PrepaidPremiumGiveaway) Zero() bool { - if p == nil { - return true - } - if !(p.ID == 0) { - return false - } - if !(p.WinnerCount == 0) { - return false - } - if !(p.MonthCount == 0) { - return false - } - if !(p.PaymentDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PrepaidPremiumGiveaway) String() string { - if p == nil { - return "PrepaidPremiumGiveaway(nil)" - } - type Alias PrepaidPremiumGiveaway - return fmt.Sprintf("PrepaidPremiumGiveaway%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PrepaidPremiumGiveaway) TypeID() uint32 { - return PrepaidPremiumGiveawayTypeID -} - -// TypeName returns name of type in TL schema. -func (*PrepaidPremiumGiveaway) TypeName() string { - return "prepaidPremiumGiveaway" -} - -// TypeInfo returns info about TL type. -func (p *PrepaidPremiumGiveaway) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "prepaidPremiumGiveaway", - ID: PrepaidPremiumGiveawayTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "WinnerCount", - SchemaName: "winner_count", - }, - { - Name: "MonthCount", - SchemaName: "month_count", - }, - { - Name: "PaymentDate", - SchemaName: "payment_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PrepaidPremiumGiveaway) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode prepaidPremiumGiveaway#6bd53140 as nil") - } - b.PutID(PrepaidPremiumGiveawayTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PrepaidPremiumGiveaway) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode prepaidPremiumGiveaway#6bd53140 as nil") - } - b.PutLong(p.ID) - b.PutInt32(p.WinnerCount) - b.PutInt32(p.MonthCount) - b.PutInt32(p.PaymentDate) - return nil -} - -// Decode implements bin.Decoder. -func (p *PrepaidPremiumGiveaway) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode prepaidPremiumGiveaway#6bd53140 to nil") - } - if err := b.ConsumeID(PrepaidPremiumGiveawayTypeID); err != nil { - return fmt.Errorf("unable to decode prepaidPremiumGiveaway#6bd53140: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PrepaidPremiumGiveaway) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode prepaidPremiumGiveaway#6bd53140 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode prepaidPremiumGiveaway#6bd53140: field id: %w", err) - } - p.ID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode prepaidPremiumGiveaway#6bd53140: field winner_count: %w", err) - } - p.WinnerCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode prepaidPremiumGiveaway#6bd53140: field month_count: %w", err) - } - p.MonthCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode prepaidPremiumGiveaway#6bd53140: field payment_date: %w", err) - } - p.PaymentDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PrepaidPremiumGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode prepaidPremiumGiveaway#6bd53140 as nil") - } - b.ObjStart() - b.PutID("prepaidPremiumGiveaway") - b.Comma() - b.FieldStart("id") - b.PutLong(p.ID) - b.Comma() - b.FieldStart("winner_count") - b.PutInt32(p.WinnerCount) - b.Comma() - b.FieldStart("month_count") - b.PutInt32(p.MonthCount) - b.Comma() - b.FieldStart("payment_date") - b.PutInt32(p.PaymentDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PrepaidPremiumGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode prepaidPremiumGiveaway#6bd53140 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("prepaidPremiumGiveaway"); err != nil { - return fmt.Errorf("unable to decode prepaidPremiumGiveaway#6bd53140: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode prepaidPremiumGiveaway#6bd53140: field id: %w", err) - } - p.ID = value - case "winner_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode prepaidPremiumGiveaway#6bd53140: field winner_count: %w", err) - } - p.WinnerCount = value - case "month_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode prepaidPremiumGiveaway#6bd53140: field month_count: %w", err) - } - p.MonthCount = value - case "payment_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode prepaidPremiumGiveaway#6bd53140: field payment_date: %w", err) - } - p.PaymentDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (p *PrepaidPremiumGiveaway) GetID() (value int64) { - if p == nil { - return - } - return p.ID -} - -// GetWinnerCount returns value of WinnerCount field. -func (p *PrepaidPremiumGiveaway) GetWinnerCount() (value int32) { - if p == nil { - return - } - return p.WinnerCount -} - -// GetMonthCount returns value of MonthCount field. -func (p *PrepaidPremiumGiveaway) GetMonthCount() (value int32) { - if p == nil { - return - } - return p.MonthCount -} - -// GetPaymentDate returns value of PaymentDate field. -func (p *PrepaidPremiumGiveaway) GetPaymentDate() (value int32) { - if p == nil { - return - } - return p.PaymentDate -} diff --git a/tdapi/tl_push_message_content_gen.go b/tdapi/tl_push_message_content_gen.go index b3d19d42de..e173ab851e 100644 --- a/tdapi/tl_push_message_content_gen.go +++ b/tdapi/tl_push_message_content_gen.go @@ -2866,42 +2866,40 @@ func (p *PushMessageContentPremiumGiftCode) GetMonthCount() (value int32) { return p.MonthCount } -// PushMessageContentPremiumGiveaway represents TL type `pushMessageContentPremiumGiveaway#57d26df1`. -type PushMessageContentPremiumGiveaway struct { - // Number of users which will receive Telegram Premium subscription gift codes; 0 for - // pinned message +// PushMessageContentGiveaway represents TL type `pushMessageContentGiveaway#d63e7f8e`. +type PushMessageContentGiveaway struct { + // Number of users which will receive giveaway prizes; 0 for pinned message WinnerCount int32 - // Number of months the Telegram Premium subscription will be active after code - // activation; 0 for pinned message - MonthCount int32 + // Prize of the giveaway; may be null for pinned message + Prize GiveawayPrizeClass // True, if the message is a pinned message with the specified content IsPinned bool } -// PushMessageContentPremiumGiveawayTypeID is TL type id of PushMessageContentPremiumGiveaway. -const PushMessageContentPremiumGiveawayTypeID = 0x57d26df1 +// PushMessageContentGiveawayTypeID is TL type id of PushMessageContentGiveaway. +const PushMessageContentGiveawayTypeID = 0xd63e7f8e // construct implements constructor of PushMessageContentClass. -func (p PushMessageContentPremiumGiveaway) construct() PushMessageContentClass { return &p } +func (p PushMessageContentGiveaway) construct() PushMessageContentClass { return &p } -// Ensuring interfaces in compile-time for PushMessageContentPremiumGiveaway. +// Ensuring interfaces in compile-time for PushMessageContentGiveaway. var ( - _ bin.Encoder = &PushMessageContentPremiumGiveaway{} - _ bin.Decoder = &PushMessageContentPremiumGiveaway{} - _ bin.BareEncoder = &PushMessageContentPremiumGiveaway{} - _ bin.BareDecoder = &PushMessageContentPremiumGiveaway{} + _ bin.Encoder = &PushMessageContentGiveaway{} + _ bin.Decoder = &PushMessageContentGiveaway{} + _ bin.BareEncoder = &PushMessageContentGiveaway{} + _ bin.BareDecoder = &PushMessageContentGiveaway{} - _ PushMessageContentClass = &PushMessageContentPremiumGiveaway{} + _ PushMessageContentClass = &PushMessageContentGiveaway{} ) -func (p *PushMessageContentPremiumGiveaway) Zero() bool { +func (p *PushMessageContentGiveaway) Zero() bool { if p == nil { return true } if !(p.WinnerCount == 0) { return false } - if !(p.MonthCount == 0) { + if !(p.Prize == nil) { return false } if !(p.IsPinned == false) { @@ -2912,31 +2910,31 @@ func (p *PushMessageContentPremiumGiveaway) Zero() bool { } // String implements fmt.Stringer. -func (p *PushMessageContentPremiumGiveaway) String() string { +func (p *PushMessageContentGiveaway) String() string { if p == nil { - return "PushMessageContentPremiumGiveaway(nil)" + return "PushMessageContentGiveaway(nil)" } - type Alias PushMessageContentPremiumGiveaway - return fmt.Sprintf("PushMessageContentPremiumGiveaway%+v", Alias(*p)) + type Alias PushMessageContentGiveaway + return fmt.Sprintf("PushMessageContentGiveaway%+v", Alias(*p)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentPremiumGiveaway) TypeID() uint32 { - return PushMessageContentPremiumGiveawayTypeID +func (*PushMessageContentGiveaway) TypeID() uint32 { + return PushMessageContentGiveawayTypeID } // TypeName returns name of type in TL schema. -func (*PushMessageContentPremiumGiveaway) TypeName() string { - return "pushMessageContentPremiumGiveaway" +func (*PushMessageContentGiveaway) TypeName() string { + return "pushMessageContentGiveaway" } // TypeInfo returns info about TL type. -func (p *PushMessageContentPremiumGiveaway) TypeInfo() tdp.Type { +func (p *PushMessageContentGiveaway) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "pushMessageContentPremiumGiveaway", - ID: PushMessageContentPremiumGiveawayTypeID, + Name: "pushMessageContentGiveaway", + ID: PushMessageContentGiveawayTypeID, } if p == nil { typ.Null = true @@ -2948,8 +2946,8 @@ func (p *PushMessageContentPremiumGiveaway) TypeInfo() tdp.Type { SchemaName: "winner_count", }, { - Name: "MonthCount", - SchemaName: "month_count", + Name: "Prize", + SchemaName: "prize", }, { Name: "IsPinned", @@ -2960,59 +2958,64 @@ func (p *PushMessageContentPremiumGiveaway) TypeInfo() tdp.Type { } // Encode implements bin.Encoder. -func (p *PushMessageContentPremiumGiveaway) Encode(b *bin.Buffer) error { +func (p *PushMessageContentGiveaway) Encode(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't encode pushMessageContentPremiumGiveaway#57d26df1 as nil") + return fmt.Errorf("can't encode pushMessageContentGiveaway#d63e7f8e as nil") } - b.PutID(PushMessageContentPremiumGiveawayTypeID) + b.PutID(PushMessageContentGiveawayTypeID) return p.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentPremiumGiveaway) EncodeBare(b *bin.Buffer) error { +func (p *PushMessageContentGiveaway) EncodeBare(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't encode pushMessageContentPremiumGiveaway#57d26df1 as nil") + return fmt.Errorf("can't encode pushMessageContentGiveaway#d63e7f8e as nil") } b.PutInt32(p.WinnerCount) - b.PutInt32(p.MonthCount) + if p.Prize == nil { + return fmt.Errorf("unable to encode pushMessageContentGiveaway#d63e7f8e: field prize is nil") + } + if err := p.Prize.Encode(b); err != nil { + return fmt.Errorf("unable to encode pushMessageContentGiveaway#d63e7f8e: field prize: %w", err) + } b.PutBool(p.IsPinned) return nil } // Decode implements bin.Decoder. -func (p *PushMessageContentPremiumGiveaway) Decode(b *bin.Buffer) error { +func (p *PushMessageContentGiveaway) Decode(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't decode pushMessageContentPremiumGiveaway#57d26df1 to nil") + return fmt.Errorf("can't decode pushMessageContentGiveaway#d63e7f8e to nil") } - if err := b.ConsumeID(PushMessageContentPremiumGiveawayTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentPremiumGiveaway#57d26df1: %w", err) + if err := b.ConsumeID(PushMessageContentGiveawayTypeID); err != nil { + return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: %w", err) } return p.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentPremiumGiveaway) DecodeBare(b *bin.Buffer) error { +func (p *PushMessageContentGiveaway) DecodeBare(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't decode pushMessageContentPremiumGiveaway#57d26df1 to nil") + return fmt.Errorf("can't decode pushMessageContentGiveaway#d63e7f8e to nil") } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPremiumGiveaway#57d26df1: field winner_count: %w", err) + return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: field winner_count: %w", err) } p.WinnerCount = value } { - value, err := b.Int32() + value, err := DecodeGiveawayPrize(b) if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPremiumGiveaway#57d26df1: field month_count: %w", err) + return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: field prize: %w", err) } - p.MonthCount = value + p.Prize = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPremiumGiveaway#57d26df1: field is_pinned: %w", err) + return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: field is_pinned: %w", err) } p.IsPinned = value } @@ -3020,18 +3023,23 @@ func (p *PushMessageContentPremiumGiveaway) DecodeBare(b *bin.Buffer) error { } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentPremiumGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { +func (p *PushMessageContentGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { if p == nil { - return fmt.Errorf("can't encode pushMessageContentPremiumGiveaway#57d26df1 as nil") + return fmt.Errorf("can't encode pushMessageContentGiveaway#d63e7f8e as nil") } b.ObjStart() - b.PutID("pushMessageContentPremiumGiveaway") + b.PutID("pushMessageContentGiveaway") b.Comma() b.FieldStart("winner_count") b.PutInt32(p.WinnerCount) b.Comma() - b.FieldStart("month_count") - b.PutInt32(p.MonthCount) + b.FieldStart("prize") + if p.Prize == nil { + return fmt.Errorf("unable to encode pushMessageContentGiveaway#d63e7f8e: field prize is nil") + } + if err := p.Prize.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode pushMessageContentGiveaway#d63e7f8e: field prize: %w", err) + } b.Comma() b.FieldStart("is_pinned") b.PutBool(p.IsPinned) @@ -3042,33 +3050,33 @@ func (p *PushMessageContentPremiumGiveaway) EncodeTDLibJSON(b tdjson.Encoder) er } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentPremiumGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { +func (p *PushMessageContentGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { if p == nil { - return fmt.Errorf("can't decode pushMessageContentPremiumGiveaway#57d26df1 to nil") + return fmt.Errorf("can't decode pushMessageContentGiveaway#d63e7f8e to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentPremiumGiveaway"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentPremiumGiveaway#57d26df1: %w", err) + if err := b.ConsumeID("pushMessageContentGiveaway"); err != nil { + return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: %w", err) } case "winner_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPremiumGiveaway#57d26df1: field winner_count: %w", err) + return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: field winner_count: %w", err) } p.WinnerCount = value - case "month_count": - value, err := b.Int32() + case "prize": + value, err := DecodeTDLibJSONGiveawayPrize(b) if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPremiumGiveaway#57d26df1: field month_count: %w", err) + return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: field prize: %w", err) } - p.MonthCount = value + p.Prize = value case "is_pinned": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPremiumGiveaway#57d26df1: field is_pinned: %w", err) + return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: field is_pinned: %w", err) } p.IsPinned = value default: @@ -3079,23 +3087,23 @@ func (p *PushMessageContentPremiumGiveaway) DecodeTDLibJSON(b tdjson.Decoder) er } // GetWinnerCount returns value of WinnerCount field. -func (p *PushMessageContentPremiumGiveaway) GetWinnerCount() (value int32) { +func (p *PushMessageContentGiveaway) GetWinnerCount() (value int32) { if p == nil { return } return p.WinnerCount } -// GetMonthCount returns value of MonthCount field. -func (p *PushMessageContentPremiumGiveaway) GetMonthCount() (value int32) { +// GetPrize returns value of Prize field. +func (p *PushMessageContentGiveaway) GetPrize() (value GiveawayPrizeClass) { if p == nil { return } - return p.MonthCount + return p.Prize } // GetIsPinned returns value of IsPinned field. -func (p *PushMessageContentPremiumGiveaway) GetIsPinned() (value bool) { +func (p *PushMessageContentGiveaway) GetIsPinned() (value bool) { if p == nil { return } @@ -6783,7 +6791,7 @@ const PushMessageContentClassName = "PushMessageContent" // case *tdapi.PushMessageContentPhoto: // pushMessageContentPhoto#861dc52 // case *tdapi.PushMessageContentPoll: // pushMessageContentPoll#fd5a743a // case *tdapi.PushMessageContentPremiumGiftCode: // pushMessageContentPremiumGiftCode#18a15025 -// case *tdapi.PushMessageContentPremiumGiveaway: // pushMessageContentPremiumGiveaway#57d26df1 +// case *tdapi.PushMessageContentGiveaway: // pushMessageContentGiveaway#d63e7f8e // case *tdapi.PushMessageContentScreenshotTaken: // pushMessageContentScreenshotTaken#cc51ff9 // case *tdapi.PushMessageContentSticker: // pushMessageContentSticker#5c98bdd3 // case *tdapi.PushMessageContentStory: // pushMessageContentStory#996471c9 @@ -6933,9 +6941,9 @@ func DecodePushMessageContent(buf *bin.Buffer) (PushMessageContentClass, error) return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) } return &v, nil - case PushMessageContentPremiumGiveawayTypeID: - // Decoding pushMessageContentPremiumGiveaway#57d26df1. - v := PushMessageContentPremiumGiveaway{} + case PushMessageContentGiveawayTypeID: + // Decoding pushMessageContentGiveaway#d63e7f8e. + v := PushMessageContentGiveaway{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) } @@ -7190,9 +7198,9 @@ func DecodeTDLibJSONPushMessageContent(buf tdjson.Decoder) (PushMessageContentCl return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) } return &v, nil - case "pushMessageContentPremiumGiveaway": - // Decoding pushMessageContentPremiumGiveaway#57d26df1. - v := PushMessageContentPremiumGiveaway{} + case "pushMessageContentGiveaway": + // Decoding pushMessageContentGiveaway#d63e7f8e. + v := PushMessageContentGiveaway{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) } diff --git a/tdapi/tl_registry_gen.go b/tdapi/tl_registry_gen.go index 6c9e828208..82433d2d68 100644 --- a/tdapi/tl_registry_gen.go +++ b/tdapi/tl_registry_gen.go @@ -182,18 +182,22 @@ func TypesMap() map[uint32]string { ProductInfoTypeID: "productInfo#87e47ca4", PremiumPaymentOptionTypeID: "premiumPaymentOption#8c0c5fb2", PremiumStatePaymentOptionTypeID: "premiumStatePaymentOption#7d06b579", - PremiumGiftCodePaymentOptionTypeID: "premiumGiftCodePaymentOption#e2f40fef", + PremiumGiftCodePaymentOptionTypeID: "premiumGiftCodePaymentOption#e5fe2de", PremiumGiftCodePaymentOptionsTypeID: "premiumGiftCodePaymentOptions#97a8cf2e", PremiumGiftCodeInfoTypeID: "premiumGiftCodeInfo#b88fa8de", StarPaymentOptionTypeID: "starPaymentOption#aeb22811", StarPaymentOptionsTypeID: "starPaymentOptions#77c3bbad", + StarGiveawayWinnerOptionTypeID: "starGiveawayWinnerOption#cc639607", + StarGiveawayPaymentOptionTypeID: "starGiveawayPaymentOption#bca2d5e5", + StarGiveawayPaymentOptionsTypeID: "starGiveawayPaymentOptions#909fbf18", StarTransactionDirectionIncomingTypeID: "starTransactionDirectionIncoming#b2cabe46", StarTransactionDirectionOutgoingTypeID: "starTransactionDirectionOutgoing#6e83b5a0", - BotTransactionPurposePaidMediaTypeID: "botTransactionPurposePaidMedia#9593b72f", + BotTransactionPurposePaidMediaTypeID: "botTransactionPurposePaidMedia#62952496", BotTransactionPurposeInvoicePaymentTypeID: "botTransactionPurposeInvoicePayment#699860ac", - ChannelTransactionPurposePaidMediaTypeID: "channelTransactionPurposePaidMedia#b00b2258", - ChannelTransactionPurposeJoinTypeID: "channelTransactionPurposeJoin#ed83dd90", - ChannelTransactionPurposeReactionTypeID: "channelTransactionPurposeReaction#2ca05bee", + ChatTransactionPurposePaidMediaTypeID: "chatTransactionPurposePaidMedia#d35febb", + ChatTransactionPurposeJoinTypeID: "chatTransactionPurposeJoin#5b31327a", + ChatTransactionPurposeReactionTypeID: "chatTransactionPurposeReaction#7a5f9888", + ChatTransactionPurposeGiveawayTypeID: "chatTransactionPurposeGiveaway#384c8b7f", StarTransactionPartnerTelegramTypeID: "starTransactionPartnerTelegram#7a899cc0", StarTransactionPartnerAppStoreTypeID: "starTransactionPartnerAppStore#e34026dc", StarTransactionPartnerGooglePlayTypeID: "starTransactionPartnerGooglePlay#f229f2a0", @@ -201,18 +205,20 @@ func TypesMap() map[uint32]string { StarTransactionPartnerTelegramAdsTypeID: "starTransactionPartnerTelegramAds#91f9c6b", StarTransactionPartnerBotTypeID: "starTransactionPartnerBot#4ece3a40", StarTransactionPartnerBusinessTypeID: "starTransactionPartnerBusiness#7af9fb52", - StarTransactionPartnerChannelTypeID: "starTransactionPartnerChannel#7c04767e", + StarTransactionPartnerChatTypeID: "starTransactionPartnerChat#71db4d40", StarTransactionPartnerUserTypeID: "starTransactionPartnerUser#2cf89d66", StarTransactionPartnerUnsupportedTypeID: "starTransactionPartnerUnsupported#c4b20d73", StarTransactionTypeID: "starTransaction#ce1084a8", StarTransactionsTypeID: "starTransactions#306a010e", - PremiumGiveawayParticipantStatusEligibleTypeID: "premiumGiveawayParticipantStatusEligible#7ee281c0", - PremiumGiveawayParticipantStatusParticipatingTypeID: "premiumGiveawayParticipantStatusParticipating#740406d1", - PremiumGiveawayParticipantStatusAlreadyWasMemberTypeID: "premiumGiveawayParticipantStatusAlreadyWasMember#8d3045a3", - PremiumGiveawayParticipantStatusAdministratorTypeID: "premiumGiveawayParticipantStatusAdministrator#7244dace", - PremiumGiveawayParticipantStatusDisallowedCountryTypeID: "premiumGiveawayParticipantStatusDisallowedCountry#89684090", - PremiumGiveawayInfoOngoingTypeID: "premiumGiveawayInfoOngoing#48d3ce6f", - PremiumGiveawayInfoCompletedTypeID: "premiumGiveawayInfoCompleted#fc8b501b", + GiveawayParticipantStatusEligibleTypeID: "giveawayParticipantStatusEligible#122ade97", + GiveawayParticipantStatusParticipatingTypeID: "giveawayParticipantStatusParticipating#1d53e36f", + GiveawayParticipantStatusAlreadyWasMemberTypeID: "giveawayParticipantStatusAlreadyWasMember#11f9b5a0", + GiveawayParticipantStatusAdministratorTypeID: "giveawayParticipantStatusAdministrator#c84b3a75", + GiveawayParticipantStatusDisallowedCountryTypeID: "giveawayParticipantStatusDisallowedCountry#700b645b", + GiveawayInfoOngoingTypeID: "giveawayInfoOngoing#624ee050", + GiveawayInfoCompletedTypeID: "giveawayInfoCompleted#328cc35c", + GiveawayPrizePremiumTypeID: "giveawayPrizePremium#1b12e978", + GiveawayPrizeStarsTypeID: "giveawayPrizeStars#954c1fa4", AccentColorTypeID: "accentColor#53312690", ProfileAccentColorsTypeID: "profileAccentColors#218e9367", ProfileAccentColorTypeID: "profileAccentColor#213d8295", @@ -496,20 +502,22 @@ func TypesMap() map[uint32]string { LinkPreviewAlbumMediaPhotoTypeID: "linkPreviewAlbumMediaPhoto#c83db38e", LinkPreviewAlbumMediaVideoTypeID: "linkPreviewAlbumMediaVideo#174856db", LinkPreviewTypeAlbumTypeID: "linkPreviewTypeAlbum#186d97b4", - LinkPreviewTypeAnimationTypeID: "linkPreviewTypeAnimation#93534e8e", - LinkPreviewTypeAppTypeID: "linkPreviewTypeApp#b5192746", - LinkPreviewTypeArticleTypeID: "linkPreviewTypeArticle#965e4e27", - LinkPreviewTypeAudioTypeID: "linkPreviewTypeAudio#572c6b78", + LinkPreviewTypeAnimationTypeID: "linkPreviewTypeAnimation#ad5cc534", + LinkPreviewTypeAppTypeID: "linkPreviewTypeApp#e3a68def", + LinkPreviewTypeArticleTypeID: "linkPreviewTypeArticle#7cce9bd9", + LinkPreviewTypeAudioTypeID: "linkPreviewTypeAudio#75e407d2", LinkPreviewTypeBackgroundTypeID: "linkPreviewTypeBackground#3a48a1e0", LinkPreviewTypeChannelBoostTypeID: "linkPreviewTypeChannelBoost#c6f40456", LinkPreviewTypeChatTypeID: "linkPreviewTypeChat#ae2fa122", - LinkPreviewTypeDocumentTypeID: "linkPreviewTypeDocument#53b02747", - LinkPreviewTypeEmbeddedAnimationPlayerTypeID: "linkPreviewTypeEmbeddedAnimationPlayer#c45fddca", - LinkPreviewTypeEmbeddedAudioPlayerTypeID: "linkPreviewTypeEmbeddedAudioPlayer#31e0dae6", - LinkPreviewTypeEmbeddedVideoPlayerTypeID: "linkPreviewTypeEmbeddedVideoPlayer#6ee015a3", + LinkPreviewTypeDocumentTypeID: "linkPreviewTypeDocument#bf0169a2", + LinkPreviewTypeEmbeddedAnimationPlayerTypeID: "linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605", + LinkPreviewTypeEmbeddedAudioPlayerTypeID: "linkPreviewTypeEmbeddedAudioPlayer#220b429c", + LinkPreviewTypeEmbeddedVideoPlayerTypeID: "linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03", + LinkPreviewTypeExternalAudioTypeID: "linkPreviewTypeExternalAudio#8a82ffed", + LinkPreviewTypeExternalVideoTypeID: "linkPreviewTypeExternalVideo#517dcb98", LinkPreviewTypeInvoiceTypeID: "linkPreviewTypeInvoice#d47f48da", LinkPreviewTypeMessageTypeID: "linkPreviewTypeMessage#19f4c19e", - LinkPreviewTypePhotoTypeID: "linkPreviewTypePhoto#eeebbab0", + LinkPreviewTypePhotoTypeID: "linkPreviewTypePhoto#aecfaaac", LinkPreviewTypePremiumGiftCodeTypeID: "linkPreviewTypePremiumGiftCode#4e0d80b1", LinkPreviewTypeShareableChatFolderTypeID: "linkPreviewTypeShareableChatFolder#805ab33c", LinkPreviewTypeStickerTypeID: "linkPreviewTypeSticker#245f4d25", @@ -519,12 +527,12 @@ func TypesMap() map[uint32]string { LinkPreviewTypeThemeTypeID: "linkPreviewTypeTheme#6b7a9ba5", LinkPreviewTypeUnsupportedTypeID: "linkPreviewTypeUnsupported#72b92cb9", LinkPreviewTypeUserTypeID: "linkPreviewTypeUser#a8ad817c", - LinkPreviewTypeVideoTypeID: "linkPreviewTypeVideo#2beebfbe", + LinkPreviewTypeVideoTypeID: "linkPreviewTypeVideo#10c9fc08", LinkPreviewTypeVideoChatTypeID: "linkPreviewTypeVideoChat#1908ee13", LinkPreviewTypeVideoNoteTypeID: "linkPreviewTypeVideoNote#cf70db61", LinkPreviewTypeVoiceNoteTypeID: "linkPreviewTypeVoiceNote#d2d2cf2b", LinkPreviewTypeWebAppTypeID: "linkPreviewTypeWebApp#a62eef8a", - LinkPreviewTypeID: "linkPreview#52a366d6", + LinkPreviewTypeID: "linkPreview#6714d1f2", CountryInfoTypeID: "countryInfo#d9936dff", CountriesTypeID: "countries#94b50e0f", PhoneNumberInfoTypeID: "phoneNumberInfo#d2c398a1", @@ -535,7 +543,7 @@ func TypesMap() map[uint32]string { BankCardInfoTypeID: "bankCardInfo#2bc7da9f", AddressTypeID: "address#86304f3a", LocationAddressTypeID: "locationAddress#a3dad322", - ThemeParametersTypeID: "themeParameters#b47510c1", + ThemeParametersTypeID: "themeParameters#ef8395af", LabeledPricePartTypeID: "labeledPricePart#20f2e726", InvoiceTypeID: "invoice#c19b2377", OrderInfoTypeID: "orderInfo#2ebad96e", @@ -564,7 +572,7 @@ func TypesMap() map[uint32]string { PaidMediaPhotoTypeID: "paidMediaPhoto#ba82551a", PaidMediaVideoTypeID: "paidMediaVideo#1bb52e09", PaidMediaUnsupportedTypeID: "paidMediaUnsupported#6bc3e26", - PremiumGiveawayParametersTypeID: "premiumGiveawayParameters#f9f5bf5e", + GiveawayParametersTypeID: "giveawayParameters#16f1de3d", DatedFileTypeID: "datedFile#9247b09d", PassportElementTypePersonalDetailsTypeID: "passportElementTypePersonalDetails#c27ad953", PassportElementTypePassportTypeID: "passportElementTypePassport#e5fdab48", @@ -695,11 +703,12 @@ func TypesMap() map[uint32]string { MessagePaymentRefundedTypeID: "messagePaymentRefunded#11bcb8f3", MessageGiftedPremiumTypeID: "messageGiftedPremium#30dd808e", MessagePremiumGiftCodeTypeID: "messagePremiumGiftCode#26bd1bf3", - MessagePremiumGiveawayCreatedTypeID: "messagePremiumGiveawayCreated#270f2c44", - MessagePremiumGiveawayTypeID: "messagePremiumGiveaway#4aa0d0b0", - MessagePremiumGiveawayCompletedTypeID: "messagePremiumGiveawayCompleted#80533949", - MessagePremiumGiveawayWinnersTypeID: "messagePremiumGiveawayWinners#815d5f31", + MessageGiveawayCreatedTypeID: "messageGiveawayCreated#39f3639f", + MessageGiveawayTypeID: "messageGiveaway#eb61daa8", + MessageGiveawayCompletedTypeID: "messageGiveawayCompleted#e424c8f7", + MessageGiveawayWinnersTypeID: "messageGiveawayWinners#1d99a27a", MessageGiftedStarsTypeID: "messageGiftedStars#41bdbea7", + MessageGiveawayPrizeStarsTypeID: "messageGiveawayPrizeStars#aa0f5de3", MessageContactRegisteredTypeID: "messageContactRegistered#a678fcff", MessageUsersSharedTypeID: "messageUsersShared#7f1f4a22", MessageChatSharedTypeID: "messageChatShared#aec6d961", @@ -746,7 +755,7 @@ func TypesMap() map[uint32]string { InputMessageAnimationTypeID: "inputMessageAnimation#19fe563", InputMessageAudioTypeID: "inputMessageAudio#daa400b2", InputMessageDocumentTypeID: "inputMessageDocument#615b72b9", - InputMessagePaidMediaTypeID: "inputMessagePaidMedia#36f9c23c", + InputMessagePaidMediaTypeID: "inputMessagePaidMedia#370c4490", InputMessagePhotoTypeID: "inputMessagePhoto#bc78dbcc", InputMessageStickerTypeID: "inputMessageSticker#3ff1b6f9", InputMessageVideoTypeID: "inputMessageVideo#1a64cc26", @@ -761,7 +770,7 @@ func TypesMap() map[uint32]string { InputMessagePollTypeID: "inputMessagePoll#9046c716", InputMessageStoryTypeID: "inputMessageStory#21099d63", InputMessageForwardedTypeID: "inputMessageForwarded#651a73f8", - MessagePropertiesTypeID: "messageProperties#11deeec2", + MessagePropertiesTypeID: "messageProperties#315677ac", SearchMessagesFilterEmptyTypeID: "searchMessagesFilterEmpty#cc2e1337", SearchMessagesFilterAnimationTypeID: "searchMessagesFilterAnimation#f6b800c5", SearchMessagesFilterAudioTypeID: "searchMessagesFilterAudio#33b5147b", @@ -869,10 +878,10 @@ func TypesMap() map[uint32]string { ChatBoostLevelFeaturesTypeID: "chatBoostLevelFeatures#f4b51914", ChatBoostFeaturesTypeID: "chatBoostFeatures#803214be", ChatBoostSourceGiftCodeTypeID: "chatBoostSourceGiftCode#fa2412ba", - ChatBoostSourceGiveawayTypeID: "chatBoostSourceGiveaway#90d1c70", + ChatBoostSourceGiveawayTypeID: "chatBoostSourceGiveaway#7254949a", ChatBoostSourcePremiumTypeID: "chatBoostSourcePremium#ed4eb", - PrepaidPremiumGiveawayTypeID: "prepaidPremiumGiveaway#6bd53140", - ChatBoostStatusTypeID: "chatBoostStatus#a5007413", + PrepaidGiveawayTypeID: "prepaidGiveaway#ef70338f", + ChatBoostStatusTypeID: "chatBoostStatus#401e753c", ChatBoostTypeID: "chatBoost#96bfccb2", FoundChatBoostsTypeID: "foundChatBoosts#dc80d52e", ChatBoostSlotTypeID: "chatBoostSlot#757fac7", @@ -991,6 +1000,7 @@ func TypesMap() map[uint32]string { ChatEventMemberLeftTypeID: "chatEventMemberLeft#c778400f", ChatEventMemberPromotedTypeID: "chatEventMemberPromoted#1f4f6861", ChatEventMemberRestrictedTypeID: "chatEventMemberRestricted#5f951e05", + ChatEventMemberSubscriptionExtendedTypeID: "chatEventMemberSubscriptionExtended#bbfab002", ChatEventAvailableReactionsChangedTypeID: "chatEventAvailableReactionsChanged#97b8e0bf", ChatEventBackgroundChangedTypeID: "chatEventBackgroundChanged#b6ed6d38", ChatEventDescriptionChangedTypeID: "chatEventDescriptionChanged#254cf1e", @@ -1031,7 +1041,7 @@ func TypesMap() map[uint32]string { ChatEventForumTopicPinnedTypeID: "chatEventForumTopicPinned#7fc523ee", ChatEventTypeID: "chatEvent#d921b3d0", ChatEventsTypeID: "chatEvents#d73ecdc4", - ChatEventLogFiltersTypeID: "chatEventLogFilters#623e7a2d", + ChatEventLogFiltersTypeID: "chatEventLogFilters#c26e31b1", LanguagePackStringValueOrdinaryTypeID: "languagePackStringValueOrdinary#f124a660", LanguagePackStringValuePluralizedTypeID: "languagePackStringValuePluralized#71a812c5", LanguagePackStringValueDeletedTypeID: "languagePackStringValueDeleted#6d5cb6fa", @@ -1115,13 +1125,15 @@ func TypesMap() map[uint32]string { StorePaymentPurposePremiumSubscriptionTypeID: "storePaymentPurposePremiumSubscription#4b558114", StorePaymentPurposeGiftedPremiumTypeID: "storePaymentPurposeGiftedPremium#7240c0d1", StorePaymentPurposePremiumGiftCodesTypeID: "storePaymentPurposePremiumGiftCodes#9e11cf42", - StorePaymentPurposePremiumGiveawayTypeID: "storePaymentPurposePremiumGiveaway#504790d9", + StorePaymentPurposePremiumGiveawayTypeID: "storePaymentPurposePremiumGiveaway#4da47aaa", + StorePaymentPurposeStarGiveawayTypeID: "storePaymentPurposeStarGiveaway#c96d899", StorePaymentPurposeStarsTypeID: "storePaymentPurposeStars#9480cf14", StorePaymentPurposeGiftedStarsTypeID: "storePaymentPurposeGiftedStars#3544a624", TelegramPaymentPurposePremiumGiftCodesTypeID: "telegramPaymentPurposePremiumGiftCodes#91009cc", - TelegramPaymentPurposePremiumGiveawayTypeID: "telegramPaymentPurposePremiumGiveaway#bfd4a227", + TelegramPaymentPurposePremiumGiveawayTypeID: "telegramPaymentPurposePremiumGiveaway#d2a7c33f", TelegramPaymentPurposeStarsTypeID: "telegramPaymentPurposeStars#e273ee52", TelegramPaymentPurposeGiftedStarsTypeID: "telegramPaymentPurposeGiftedStars#91b68a36", + TelegramPaymentPurposeStarGiveawayTypeID: "telegramPaymentPurposeStarGiveaway#3c79a391", TelegramPaymentPurposeJoinChatTypeID: "telegramPaymentPurposeJoinChat#8ddd6788", DeviceTokenFirebaseCloudMessagingTypeID: "deviceTokenFirebaseCloudMessaging#d0714a07", DeviceTokenApplePushTypeID: "deviceTokenApplePush#17196bc3", @@ -1189,7 +1201,7 @@ func TypesMap() map[uint32]string { PushMessageContentPhotoTypeID: "pushMessageContentPhoto#861dc52", PushMessageContentPollTypeID: "pushMessageContentPoll#fd5a743a", PushMessageContentPremiumGiftCodeTypeID: "pushMessageContentPremiumGiftCode#18a15025", - PushMessageContentPremiumGiveawayTypeID: "pushMessageContentPremiumGiveaway#57d26df1", + PushMessageContentGiveawayTypeID: "pushMessageContentGiveaway#d63e7f8e", PushMessageContentScreenshotTakenTypeID: "pushMessageContentScreenshotTaken#cc51ff9", PushMessageContentStickerTypeID: "pushMessageContentSticker#5c98bdd3", PushMessageContentStoryTypeID: "pushMessageContentStory#996471c9", @@ -1453,7 +1465,7 @@ func TypesMap() map[uint32]string { ChatStatisticsInviterInfoTypeID: "chatStatisticsInviterInfo#2583d48b", ChatStatisticsSupergroupTypeID: "chatStatisticsSupergroup#c67549ef", ChatStatisticsChannelTypeID: "chatStatisticsChannel#b8e95b4", - ChatRevenueAmountTypeID: "chatRevenueAmount#4f3bb29f", + ChatRevenueAmountTypeID: "chatRevenueAmount#a648ce58", ChatRevenueStatisticsTypeID: "chatRevenueStatistics#636318bb", MessageStatisticsTypeID: "messageStatistics#a2ce4f07", StoryStatisticsTypeID: "storyStatistics#46448b6b", @@ -1630,6 +1642,7 @@ func TypesMap() map[uint32]string { UpdateChatBoostTypeID: "updateChatBoost#50727e24", UpdateMessageReactionTypeID: "updateMessageReaction#f46c854a", UpdateMessageReactionsTypeID: "updateMessageReactions#bd5618e9", + UpdatePaidMediaPurchasedTypeID: "updatePaidMediaPurchased#a410e65b", UpdatesTypeID: "updates#b9829222", LogStreamDefaultTypeID: "logStreamDefault#52e296bc", LogStreamFileTypeID: "logStreamFile#5b528de5", @@ -1838,7 +1851,8 @@ func TypesMap() map[uint32]string { ClearRecentReactionsRequestTypeID: "clearRecentReactions#4d61c752", AddMessageReactionRequestTypeID: "addMessageReaction#549855ed", RemoveMessageReactionRequestTypeID: "removeMessageReaction#97474d7b", - AddPaidMessageReactionRequestTypeID: "addPaidMessageReaction#542fae53", + AddPendingPaidMessageReactionRequestTypeID: "addPendingPaidMessageReaction#66548919", + CommitPendingPaidMessageReactionsRequestTypeID: "commitPendingPaidMessageReactions#f5c95606", RemovePendingPaidMessageReactionsRequestTypeID: "removePendingPaidMessageReactions#41949cfb", TogglePaidMessageReactionIsAnonymousRequestTypeID: "togglePaidMessageReactionIsAnonymous#9774db11", SetMessageReactionsRequestTypeID: "setMessageReactions#71fa9e8f", @@ -1872,7 +1886,7 @@ func TypesMap() map[uint32]string { ShareChatWithBotRequestTypeID: "shareChatWithBot#a6530ae2", GetInlineQueryResultsRequestTypeID: "getInlineQueryResults#79dcf86c", AnswerInlineQueryRequestTypeID: "answerInlineQuery#ac7cc5e6", - GetPopularWebAppBotsRequestTypeID: "getPopularWebAppBots#e8d04cb", + GetGrossingWebAppBotsRequestTypeID: "getGrossingWebAppBots#6522ce1a", SearchWebAppRequestTypeID: "searchWebApp#b5fc8a35", GetWebAppLinkURLRequestTypeID: "getWebAppLinkUrl#4f0ef3cc", GetMainWebAppRequestTypeID: "getMainWebApp#be84329a", @@ -2133,6 +2147,7 @@ func TypesMap() map[uint32]string { GetTrendingStickerSetsRequestTypeID: "getTrendingStickerSets#e058455e", GetAttachedStickerSetsRequestTypeID: "getAttachedStickerSets#4d9d930d", GetStickerSetRequestTypeID: "getStickerSet#3eb91bc3", + GetStickerSetNameRequestTypeID: "getStickerSetName#3dfad681", SearchStickerSetRequestTypeID: "searchStickerSet#45049cee", SearchInstalledStickerSetsRequestTypeID: "searchInstalledStickerSets#7e5e7fa4", SearchStickerSetsRequestTypeID: "searchStickerSets#faa066c", @@ -2369,10 +2384,11 @@ func TypesMap() map[uint32]string { GetPremiumGiftCodePaymentOptionsRequestTypeID: "getPremiumGiftCodePaymentOptions#89523a2c", CheckPremiumGiftCodeRequestTypeID: "checkPremiumGiftCode#958ad664", ApplyPremiumGiftCodeRequestTypeID: "applyPremiumGiftCode#afb44c1e", - LaunchPrepaidPremiumGiveawayRequestTypeID: "launchPrepaidPremiumGiveaway#5328fea1", - GetPremiumGiveawayInfoRequestTypeID: "getPremiumGiveawayInfo#6adb7b97", + LaunchPrepaidGiveawayRequestTypeID: "launchPrepaidGiveaway#261d783a", + GetGiveawayInfoRequestTypeID: "getGiveawayInfo#b78790bb", GetStarPaymentOptionsRequestTypeID: "getStarPaymentOptions#6d930644", GetStarGiftPaymentOptionsRequestTypeID: "getStarGiftPaymentOptions#e22760e3", + GetStarGiveawayPaymentOptionsRequestTypeID: "getStarGiveawayPaymentOptions#cb5bdb1e", GetStarTransactionsRequestTypeID: "getStarTransactions#f096f8f1", GetStarSubscriptionsRequestTypeID: "getStarSubscriptions#d9c7b2ec", CanPurchaseFromStoreRequestTypeID: "canPurchaseFromStore#3caa9368", @@ -2586,13 +2602,17 @@ func NamesMap() map[string]uint32 { "premiumGiftCodeInfo": PremiumGiftCodeInfoTypeID, "starPaymentOption": StarPaymentOptionTypeID, "starPaymentOptions": StarPaymentOptionsTypeID, + "starGiveawayWinnerOption": StarGiveawayWinnerOptionTypeID, + "starGiveawayPaymentOption": StarGiveawayPaymentOptionTypeID, + "starGiveawayPaymentOptions": StarGiveawayPaymentOptionsTypeID, "starTransactionDirectionIncoming": StarTransactionDirectionIncomingTypeID, "starTransactionDirectionOutgoing": StarTransactionDirectionOutgoingTypeID, "botTransactionPurposePaidMedia": BotTransactionPurposePaidMediaTypeID, "botTransactionPurposeInvoicePayment": BotTransactionPurposeInvoicePaymentTypeID, - "channelTransactionPurposePaidMedia": ChannelTransactionPurposePaidMediaTypeID, - "channelTransactionPurposeJoin": ChannelTransactionPurposeJoinTypeID, - "channelTransactionPurposeReaction": ChannelTransactionPurposeReactionTypeID, + "chatTransactionPurposePaidMedia": ChatTransactionPurposePaidMediaTypeID, + "chatTransactionPurposeJoin": ChatTransactionPurposeJoinTypeID, + "chatTransactionPurposeReaction": ChatTransactionPurposeReactionTypeID, + "chatTransactionPurposeGiveaway": ChatTransactionPurposeGiveawayTypeID, "starTransactionPartnerTelegram": StarTransactionPartnerTelegramTypeID, "starTransactionPartnerAppStore": StarTransactionPartnerAppStoreTypeID, "starTransactionPartnerGooglePlay": StarTransactionPartnerGooglePlayTypeID, @@ -2600,18 +2620,20 @@ func NamesMap() map[string]uint32 { "starTransactionPartnerTelegramAds": StarTransactionPartnerTelegramAdsTypeID, "starTransactionPartnerBot": StarTransactionPartnerBotTypeID, "starTransactionPartnerBusiness": StarTransactionPartnerBusinessTypeID, - "starTransactionPartnerChannel": StarTransactionPartnerChannelTypeID, + "starTransactionPartnerChat": StarTransactionPartnerChatTypeID, "starTransactionPartnerUser": StarTransactionPartnerUserTypeID, "starTransactionPartnerUnsupported": StarTransactionPartnerUnsupportedTypeID, "starTransaction": StarTransactionTypeID, "starTransactions": StarTransactionsTypeID, - "premiumGiveawayParticipantStatusEligible": PremiumGiveawayParticipantStatusEligibleTypeID, - "premiumGiveawayParticipantStatusParticipating": PremiumGiveawayParticipantStatusParticipatingTypeID, - "premiumGiveawayParticipantStatusAlreadyWasMember": PremiumGiveawayParticipantStatusAlreadyWasMemberTypeID, - "premiumGiveawayParticipantStatusAdministrator": PremiumGiveawayParticipantStatusAdministratorTypeID, - "premiumGiveawayParticipantStatusDisallowedCountry": PremiumGiveawayParticipantStatusDisallowedCountryTypeID, - "premiumGiveawayInfoOngoing": PremiumGiveawayInfoOngoingTypeID, - "premiumGiveawayInfoCompleted": PremiumGiveawayInfoCompletedTypeID, + "giveawayParticipantStatusEligible": GiveawayParticipantStatusEligibleTypeID, + "giveawayParticipantStatusParticipating": GiveawayParticipantStatusParticipatingTypeID, + "giveawayParticipantStatusAlreadyWasMember": GiveawayParticipantStatusAlreadyWasMemberTypeID, + "giveawayParticipantStatusAdministrator": GiveawayParticipantStatusAdministratorTypeID, + "giveawayParticipantStatusDisallowedCountry": GiveawayParticipantStatusDisallowedCountryTypeID, + "giveawayInfoOngoing": GiveawayInfoOngoingTypeID, + "giveawayInfoCompleted": GiveawayInfoCompletedTypeID, + "giveawayPrizePremium": GiveawayPrizePremiumTypeID, + "giveawayPrizeStars": GiveawayPrizeStarsTypeID, "accentColor": AccentColorTypeID, "profileAccentColors": ProfileAccentColorsTypeID, "profileAccentColor": ProfileAccentColorTypeID, @@ -2906,6 +2928,8 @@ func NamesMap() map[string]uint32 { "linkPreviewTypeEmbeddedAnimationPlayer": LinkPreviewTypeEmbeddedAnimationPlayerTypeID, "linkPreviewTypeEmbeddedAudioPlayer": LinkPreviewTypeEmbeddedAudioPlayerTypeID, "linkPreviewTypeEmbeddedVideoPlayer": LinkPreviewTypeEmbeddedVideoPlayerTypeID, + "linkPreviewTypeExternalAudio": LinkPreviewTypeExternalAudioTypeID, + "linkPreviewTypeExternalVideo": LinkPreviewTypeExternalVideoTypeID, "linkPreviewTypeInvoice": LinkPreviewTypeInvoiceTypeID, "linkPreviewTypeMessage": LinkPreviewTypeMessageTypeID, "linkPreviewTypePhoto": LinkPreviewTypePhotoTypeID, @@ -2963,7 +2987,7 @@ func NamesMap() map[string]uint32 { "paidMediaPhoto": PaidMediaPhotoTypeID, "paidMediaVideo": PaidMediaVideoTypeID, "paidMediaUnsupported": PaidMediaUnsupportedTypeID, - "premiumGiveawayParameters": PremiumGiveawayParametersTypeID, + "giveawayParameters": GiveawayParametersTypeID, "datedFile": DatedFileTypeID, "passportElementTypePersonalDetails": PassportElementTypePersonalDetailsTypeID, "passportElementTypePassport": PassportElementTypePassportTypeID, @@ -3094,11 +3118,12 @@ func NamesMap() map[string]uint32 { "messagePaymentRefunded": MessagePaymentRefundedTypeID, "messageGiftedPremium": MessageGiftedPremiumTypeID, "messagePremiumGiftCode": MessagePremiumGiftCodeTypeID, - "messagePremiumGiveawayCreated": MessagePremiumGiveawayCreatedTypeID, - "messagePremiumGiveaway": MessagePremiumGiveawayTypeID, - "messagePremiumGiveawayCompleted": MessagePremiumGiveawayCompletedTypeID, - "messagePremiumGiveawayWinners": MessagePremiumGiveawayWinnersTypeID, + "messageGiveawayCreated": MessageGiveawayCreatedTypeID, + "messageGiveaway": MessageGiveawayTypeID, + "messageGiveawayCompleted": MessageGiveawayCompletedTypeID, + "messageGiveawayWinners": MessageGiveawayWinnersTypeID, "messageGiftedStars": MessageGiftedStarsTypeID, + "messageGiveawayPrizeStars": MessageGiveawayPrizeStarsTypeID, "messageContactRegistered": MessageContactRegisteredTypeID, "messageUsersShared": MessageUsersSharedTypeID, "messageChatShared": MessageChatSharedTypeID, @@ -3270,7 +3295,7 @@ func NamesMap() map[string]uint32 { "chatBoostSourceGiftCode": ChatBoostSourceGiftCodeTypeID, "chatBoostSourceGiveaway": ChatBoostSourceGiveawayTypeID, "chatBoostSourcePremium": ChatBoostSourcePremiumTypeID, - "prepaidPremiumGiveaway": PrepaidPremiumGiveawayTypeID, + "prepaidGiveaway": PrepaidGiveawayTypeID, "chatBoostStatus": ChatBoostStatusTypeID, "chatBoost": ChatBoostTypeID, "foundChatBoosts": FoundChatBoostsTypeID, @@ -3390,6 +3415,7 @@ func NamesMap() map[string]uint32 { "chatEventMemberLeft": ChatEventMemberLeftTypeID, "chatEventMemberPromoted": ChatEventMemberPromotedTypeID, "chatEventMemberRestricted": ChatEventMemberRestrictedTypeID, + "chatEventMemberSubscriptionExtended": ChatEventMemberSubscriptionExtendedTypeID, "chatEventAvailableReactionsChanged": ChatEventAvailableReactionsChangedTypeID, "chatEventBackgroundChanged": ChatEventBackgroundChangedTypeID, "chatEventDescriptionChanged": ChatEventDescriptionChangedTypeID, @@ -3515,12 +3541,14 @@ func NamesMap() map[string]uint32 { "storePaymentPurposeGiftedPremium": StorePaymentPurposeGiftedPremiumTypeID, "storePaymentPurposePremiumGiftCodes": StorePaymentPurposePremiumGiftCodesTypeID, "storePaymentPurposePremiumGiveaway": StorePaymentPurposePremiumGiveawayTypeID, + "storePaymentPurposeStarGiveaway": StorePaymentPurposeStarGiveawayTypeID, "storePaymentPurposeStars": StorePaymentPurposeStarsTypeID, "storePaymentPurposeGiftedStars": StorePaymentPurposeGiftedStarsTypeID, "telegramPaymentPurposePremiumGiftCodes": TelegramPaymentPurposePremiumGiftCodesTypeID, "telegramPaymentPurposePremiumGiveaway": TelegramPaymentPurposePremiumGiveawayTypeID, "telegramPaymentPurposeStars": TelegramPaymentPurposeStarsTypeID, "telegramPaymentPurposeGiftedStars": TelegramPaymentPurposeGiftedStarsTypeID, + "telegramPaymentPurposeStarGiveaway": TelegramPaymentPurposeStarGiveawayTypeID, "telegramPaymentPurposeJoinChat": TelegramPaymentPurposeJoinChatTypeID, "deviceTokenFirebaseCloudMessaging": DeviceTokenFirebaseCloudMessagingTypeID, "deviceTokenApplePush": DeviceTokenApplePushTypeID, @@ -3588,7 +3616,7 @@ func NamesMap() map[string]uint32 { "pushMessageContentPhoto": PushMessageContentPhotoTypeID, "pushMessageContentPoll": PushMessageContentPollTypeID, "pushMessageContentPremiumGiftCode": PushMessageContentPremiumGiftCodeTypeID, - "pushMessageContentPremiumGiveaway": PushMessageContentPremiumGiveawayTypeID, + "pushMessageContentGiveaway": PushMessageContentGiveawayTypeID, "pushMessageContentScreenshotTaken": PushMessageContentScreenshotTakenTypeID, "pushMessageContentSticker": PushMessageContentStickerTypeID, "pushMessageContentStory": PushMessageContentStoryTypeID, @@ -4029,6 +4057,7 @@ func NamesMap() map[string]uint32 { "updateChatBoost": UpdateChatBoostTypeID, "updateMessageReaction": UpdateMessageReactionTypeID, "updateMessageReactions": UpdateMessageReactionsTypeID, + "updatePaidMediaPurchased": UpdatePaidMediaPurchasedTypeID, "updates": UpdatesTypeID, "logStreamDefault": LogStreamDefaultTypeID, "logStreamFile": LogStreamFileTypeID, @@ -4237,7 +4266,8 @@ func NamesMap() map[string]uint32 { "clearRecentReactions": ClearRecentReactionsRequestTypeID, "addMessageReaction": AddMessageReactionRequestTypeID, "removeMessageReaction": RemoveMessageReactionRequestTypeID, - "addPaidMessageReaction": AddPaidMessageReactionRequestTypeID, + "addPendingPaidMessageReaction": AddPendingPaidMessageReactionRequestTypeID, + "commitPendingPaidMessageReactions": CommitPendingPaidMessageReactionsRequestTypeID, "removePendingPaidMessageReactions": RemovePendingPaidMessageReactionsRequestTypeID, "togglePaidMessageReactionIsAnonymous": TogglePaidMessageReactionIsAnonymousRequestTypeID, "setMessageReactions": SetMessageReactionsRequestTypeID, @@ -4271,7 +4301,7 @@ func NamesMap() map[string]uint32 { "shareChatWithBot": ShareChatWithBotRequestTypeID, "getInlineQueryResults": GetInlineQueryResultsRequestTypeID, "answerInlineQuery": AnswerInlineQueryRequestTypeID, - "getPopularWebAppBots": GetPopularWebAppBotsRequestTypeID, + "getGrossingWebAppBots": GetGrossingWebAppBotsRequestTypeID, "searchWebApp": SearchWebAppRequestTypeID, "getWebAppLinkUrl": GetWebAppLinkURLRequestTypeID, "getMainWebApp": GetMainWebAppRequestTypeID, @@ -4532,6 +4562,7 @@ func NamesMap() map[string]uint32 { "getTrendingStickerSets": GetTrendingStickerSetsRequestTypeID, "getAttachedStickerSets": GetAttachedStickerSetsRequestTypeID, "getStickerSet": GetStickerSetRequestTypeID, + "getStickerSetName": GetStickerSetNameRequestTypeID, "searchStickerSet": SearchStickerSetRequestTypeID, "searchInstalledStickerSets": SearchInstalledStickerSetsRequestTypeID, "searchStickerSets": SearchStickerSetsRequestTypeID, @@ -4768,10 +4799,11 @@ func NamesMap() map[string]uint32 { "getPremiumGiftCodePaymentOptions": GetPremiumGiftCodePaymentOptionsRequestTypeID, "checkPremiumGiftCode": CheckPremiumGiftCodeRequestTypeID, "applyPremiumGiftCode": ApplyPremiumGiftCodeRequestTypeID, - "launchPrepaidPremiumGiveaway": LaunchPrepaidPremiumGiveawayRequestTypeID, - "getPremiumGiveawayInfo": GetPremiumGiveawayInfoRequestTypeID, + "launchPrepaidGiveaway": LaunchPrepaidGiveawayRequestTypeID, + "getGiveawayInfo": GetGiveawayInfoRequestTypeID, "getStarPaymentOptions": GetStarPaymentOptionsRequestTypeID, "getStarGiftPaymentOptions": GetStarGiftPaymentOptionsRequestTypeID, + "getStarGiveawayPaymentOptions": GetStarGiveawayPaymentOptionsRequestTypeID, "getStarTransactions": GetStarTransactionsRequestTypeID, "getStarSubscriptions": GetStarSubscriptionsRequestTypeID, "canPurchaseFromStore": CanPurchaseFromStoreRequestTypeID, @@ -4985,13 +5017,17 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PremiumGiftCodeInfoTypeID: func() bin.Object { return &PremiumGiftCodeInfo{} }, StarPaymentOptionTypeID: func() bin.Object { return &StarPaymentOption{} }, StarPaymentOptionsTypeID: func() bin.Object { return &StarPaymentOptions{} }, + StarGiveawayWinnerOptionTypeID: func() bin.Object { return &StarGiveawayWinnerOption{} }, + StarGiveawayPaymentOptionTypeID: func() bin.Object { return &StarGiveawayPaymentOption{} }, + StarGiveawayPaymentOptionsTypeID: func() bin.Object { return &StarGiveawayPaymentOptions{} }, StarTransactionDirectionIncomingTypeID: func() bin.Object { return &StarTransactionDirectionIncoming{} }, StarTransactionDirectionOutgoingTypeID: func() bin.Object { return &StarTransactionDirectionOutgoing{} }, BotTransactionPurposePaidMediaTypeID: func() bin.Object { return &BotTransactionPurposePaidMedia{} }, BotTransactionPurposeInvoicePaymentTypeID: func() bin.Object { return &BotTransactionPurposeInvoicePayment{} }, - ChannelTransactionPurposePaidMediaTypeID: func() bin.Object { return &ChannelTransactionPurposePaidMedia{} }, - ChannelTransactionPurposeJoinTypeID: func() bin.Object { return &ChannelTransactionPurposeJoin{} }, - ChannelTransactionPurposeReactionTypeID: func() bin.Object { return &ChannelTransactionPurposeReaction{} }, + ChatTransactionPurposePaidMediaTypeID: func() bin.Object { return &ChatTransactionPurposePaidMedia{} }, + ChatTransactionPurposeJoinTypeID: func() bin.Object { return &ChatTransactionPurposeJoin{} }, + ChatTransactionPurposeReactionTypeID: func() bin.Object { return &ChatTransactionPurposeReaction{} }, + ChatTransactionPurposeGiveawayTypeID: func() bin.Object { return &ChatTransactionPurposeGiveaway{} }, StarTransactionPartnerTelegramTypeID: func() bin.Object { return &StarTransactionPartnerTelegram{} }, StarTransactionPartnerAppStoreTypeID: func() bin.Object { return &StarTransactionPartnerAppStore{} }, StarTransactionPartnerGooglePlayTypeID: func() bin.Object { return &StarTransactionPartnerGooglePlay{} }, @@ -4999,18 +5035,20 @@ func TypesConstructorMap() map[uint32]func() bin.Object { StarTransactionPartnerTelegramAdsTypeID: func() bin.Object { return &StarTransactionPartnerTelegramAds{} }, StarTransactionPartnerBotTypeID: func() bin.Object { return &StarTransactionPartnerBot{} }, StarTransactionPartnerBusinessTypeID: func() bin.Object { return &StarTransactionPartnerBusiness{} }, - StarTransactionPartnerChannelTypeID: func() bin.Object { return &StarTransactionPartnerChannel{} }, + StarTransactionPartnerChatTypeID: func() bin.Object { return &StarTransactionPartnerChat{} }, StarTransactionPartnerUserTypeID: func() bin.Object { return &StarTransactionPartnerUser{} }, StarTransactionPartnerUnsupportedTypeID: func() bin.Object { return &StarTransactionPartnerUnsupported{} }, StarTransactionTypeID: func() bin.Object { return &StarTransaction{} }, StarTransactionsTypeID: func() bin.Object { return &StarTransactions{} }, - PremiumGiveawayParticipantStatusEligibleTypeID: func() bin.Object { return &PremiumGiveawayParticipantStatusEligible{} }, - PremiumGiveawayParticipantStatusParticipatingTypeID: func() bin.Object { return &PremiumGiveawayParticipantStatusParticipating{} }, - PremiumGiveawayParticipantStatusAlreadyWasMemberTypeID: func() bin.Object { return &PremiumGiveawayParticipantStatusAlreadyWasMember{} }, - PremiumGiveawayParticipantStatusAdministratorTypeID: func() bin.Object { return &PremiumGiveawayParticipantStatusAdministrator{} }, - PremiumGiveawayParticipantStatusDisallowedCountryTypeID: func() bin.Object { return &PremiumGiveawayParticipantStatusDisallowedCountry{} }, - PremiumGiveawayInfoOngoingTypeID: func() bin.Object { return &PremiumGiveawayInfoOngoing{} }, - PremiumGiveawayInfoCompletedTypeID: func() bin.Object { return &PremiumGiveawayInfoCompleted{} }, + GiveawayParticipantStatusEligibleTypeID: func() bin.Object { return &GiveawayParticipantStatusEligible{} }, + GiveawayParticipantStatusParticipatingTypeID: func() bin.Object { return &GiveawayParticipantStatusParticipating{} }, + GiveawayParticipantStatusAlreadyWasMemberTypeID: func() bin.Object { return &GiveawayParticipantStatusAlreadyWasMember{} }, + GiveawayParticipantStatusAdministratorTypeID: func() bin.Object { return &GiveawayParticipantStatusAdministrator{} }, + GiveawayParticipantStatusDisallowedCountryTypeID: func() bin.Object { return &GiveawayParticipantStatusDisallowedCountry{} }, + GiveawayInfoOngoingTypeID: func() bin.Object { return &GiveawayInfoOngoing{} }, + GiveawayInfoCompletedTypeID: func() bin.Object { return &GiveawayInfoCompleted{} }, + GiveawayPrizePremiumTypeID: func() bin.Object { return &GiveawayPrizePremium{} }, + GiveawayPrizeStarsTypeID: func() bin.Object { return &GiveawayPrizeStars{} }, AccentColorTypeID: func() bin.Object { return &AccentColor{} }, ProfileAccentColorsTypeID: func() bin.Object { return &ProfileAccentColors{} }, ProfileAccentColorTypeID: func() bin.Object { return &ProfileAccentColor{} }, @@ -5305,6 +5343,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { LinkPreviewTypeEmbeddedAnimationPlayerTypeID: func() bin.Object { return &LinkPreviewTypeEmbeddedAnimationPlayer{} }, LinkPreviewTypeEmbeddedAudioPlayerTypeID: func() bin.Object { return &LinkPreviewTypeEmbeddedAudioPlayer{} }, LinkPreviewTypeEmbeddedVideoPlayerTypeID: func() bin.Object { return &LinkPreviewTypeEmbeddedVideoPlayer{} }, + LinkPreviewTypeExternalAudioTypeID: func() bin.Object { return &LinkPreviewTypeExternalAudio{} }, + LinkPreviewTypeExternalVideoTypeID: func() bin.Object { return &LinkPreviewTypeExternalVideo{} }, LinkPreviewTypeInvoiceTypeID: func() bin.Object { return &LinkPreviewTypeInvoice{} }, LinkPreviewTypeMessageTypeID: func() bin.Object { return &LinkPreviewTypeMessage{} }, LinkPreviewTypePhotoTypeID: func() bin.Object { return &LinkPreviewTypePhoto{} }, @@ -5362,7 +5402,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PaidMediaPhotoTypeID: func() bin.Object { return &PaidMediaPhoto{} }, PaidMediaVideoTypeID: func() bin.Object { return &PaidMediaVideo{} }, PaidMediaUnsupportedTypeID: func() bin.Object { return &PaidMediaUnsupported{} }, - PremiumGiveawayParametersTypeID: func() bin.Object { return &PremiumGiveawayParameters{} }, + GiveawayParametersTypeID: func() bin.Object { return &GiveawayParameters{} }, DatedFileTypeID: func() bin.Object { return &DatedFile{} }, PassportElementTypePersonalDetailsTypeID: func() bin.Object { return &PassportElementTypePersonalDetails{} }, PassportElementTypePassportTypeID: func() bin.Object { return &PassportElementTypePassport{} }, @@ -5493,11 +5533,12 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessagePaymentRefundedTypeID: func() bin.Object { return &MessagePaymentRefunded{} }, MessageGiftedPremiumTypeID: func() bin.Object { return &MessageGiftedPremium{} }, MessagePremiumGiftCodeTypeID: func() bin.Object { return &MessagePremiumGiftCode{} }, - MessagePremiumGiveawayCreatedTypeID: func() bin.Object { return &MessagePremiumGiveawayCreated{} }, - MessagePremiumGiveawayTypeID: func() bin.Object { return &MessagePremiumGiveaway{} }, - MessagePremiumGiveawayCompletedTypeID: func() bin.Object { return &MessagePremiumGiveawayCompleted{} }, - MessagePremiumGiveawayWinnersTypeID: func() bin.Object { return &MessagePremiumGiveawayWinners{} }, + MessageGiveawayCreatedTypeID: func() bin.Object { return &MessageGiveawayCreated{} }, + MessageGiveawayTypeID: func() bin.Object { return &MessageGiveaway{} }, + MessageGiveawayCompletedTypeID: func() bin.Object { return &MessageGiveawayCompleted{} }, + MessageGiveawayWinnersTypeID: func() bin.Object { return &MessageGiveawayWinners{} }, MessageGiftedStarsTypeID: func() bin.Object { return &MessageGiftedStars{} }, + MessageGiveawayPrizeStarsTypeID: func() bin.Object { return &MessageGiveawayPrizeStars{} }, MessageContactRegisteredTypeID: func() bin.Object { return &MessageContactRegistered{} }, MessageUsersSharedTypeID: func() bin.Object { return &MessageUsersShared{} }, MessageChatSharedTypeID: func() bin.Object { return &MessageChatShared{} }, @@ -5669,7 +5710,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ChatBoostSourceGiftCodeTypeID: func() bin.Object { return &ChatBoostSourceGiftCode{} }, ChatBoostSourceGiveawayTypeID: func() bin.Object { return &ChatBoostSourceGiveaway{} }, ChatBoostSourcePremiumTypeID: func() bin.Object { return &ChatBoostSourcePremium{} }, - PrepaidPremiumGiveawayTypeID: func() bin.Object { return &PrepaidPremiumGiveaway{} }, + PrepaidGiveawayTypeID: func() bin.Object { return &PrepaidGiveaway{} }, ChatBoostStatusTypeID: func() bin.Object { return &ChatBoostStatus{} }, ChatBoostTypeID: func() bin.Object { return &ChatBoost{} }, FoundChatBoostsTypeID: func() bin.Object { return &FoundChatBoosts{} }, @@ -5789,6 +5830,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ChatEventMemberLeftTypeID: func() bin.Object { return &ChatEventMemberLeft{} }, ChatEventMemberPromotedTypeID: func() bin.Object { return &ChatEventMemberPromoted{} }, ChatEventMemberRestrictedTypeID: func() bin.Object { return &ChatEventMemberRestricted{} }, + ChatEventMemberSubscriptionExtendedTypeID: func() bin.Object { return &ChatEventMemberSubscriptionExtended{} }, ChatEventAvailableReactionsChangedTypeID: func() bin.Object { return &ChatEventAvailableReactionsChanged{} }, ChatEventBackgroundChangedTypeID: func() bin.Object { return &ChatEventBackgroundChanged{} }, ChatEventDescriptionChangedTypeID: func() bin.Object { return &ChatEventDescriptionChanged{} }, @@ -5914,12 +5956,14 @@ func TypesConstructorMap() map[uint32]func() bin.Object { StorePaymentPurposeGiftedPremiumTypeID: func() bin.Object { return &StorePaymentPurposeGiftedPremium{} }, StorePaymentPurposePremiumGiftCodesTypeID: func() bin.Object { return &StorePaymentPurposePremiumGiftCodes{} }, StorePaymentPurposePremiumGiveawayTypeID: func() bin.Object { return &StorePaymentPurposePremiumGiveaway{} }, + StorePaymentPurposeStarGiveawayTypeID: func() bin.Object { return &StorePaymentPurposeStarGiveaway{} }, StorePaymentPurposeStarsTypeID: func() bin.Object { return &StorePaymentPurposeStars{} }, StorePaymentPurposeGiftedStarsTypeID: func() bin.Object { return &StorePaymentPurposeGiftedStars{} }, TelegramPaymentPurposePremiumGiftCodesTypeID: func() bin.Object { return &TelegramPaymentPurposePremiumGiftCodes{} }, TelegramPaymentPurposePremiumGiveawayTypeID: func() bin.Object { return &TelegramPaymentPurposePremiumGiveaway{} }, TelegramPaymentPurposeStarsTypeID: func() bin.Object { return &TelegramPaymentPurposeStars{} }, TelegramPaymentPurposeGiftedStarsTypeID: func() bin.Object { return &TelegramPaymentPurposeGiftedStars{} }, + TelegramPaymentPurposeStarGiveawayTypeID: func() bin.Object { return &TelegramPaymentPurposeStarGiveaway{} }, TelegramPaymentPurposeJoinChatTypeID: func() bin.Object { return &TelegramPaymentPurposeJoinChat{} }, DeviceTokenFirebaseCloudMessagingTypeID: func() bin.Object { return &DeviceTokenFirebaseCloudMessaging{} }, DeviceTokenApplePushTypeID: func() bin.Object { return &DeviceTokenApplePush{} }, @@ -5987,7 +6031,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PushMessageContentPhotoTypeID: func() bin.Object { return &PushMessageContentPhoto{} }, PushMessageContentPollTypeID: func() bin.Object { return &PushMessageContentPoll{} }, PushMessageContentPremiumGiftCodeTypeID: func() bin.Object { return &PushMessageContentPremiumGiftCode{} }, - PushMessageContentPremiumGiveawayTypeID: func() bin.Object { return &PushMessageContentPremiumGiveaway{} }, + PushMessageContentGiveawayTypeID: func() bin.Object { return &PushMessageContentGiveaway{} }, PushMessageContentScreenshotTakenTypeID: func() bin.Object { return &PushMessageContentScreenshotTaken{} }, PushMessageContentStickerTypeID: func() bin.Object { return &PushMessageContentSticker{} }, PushMessageContentStoryTypeID: func() bin.Object { return &PushMessageContentStory{} }, @@ -6428,6 +6472,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UpdateChatBoostTypeID: func() bin.Object { return &UpdateChatBoost{} }, UpdateMessageReactionTypeID: func() bin.Object { return &UpdateMessageReaction{} }, UpdateMessageReactionsTypeID: func() bin.Object { return &UpdateMessageReactions{} }, + UpdatePaidMediaPurchasedTypeID: func() bin.Object { return &UpdatePaidMediaPurchased{} }, UpdatesTypeID: func() bin.Object { return &Updates{} }, LogStreamDefaultTypeID: func() bin.Object { return &LogStreamDefault{} }, LogStreamFileTypeID: func() bin.Object { return &LogStreamFile{} }, @@ -6636,7 +6681,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ClearRecentReactionsRequestTypeID: func() bin.Object { return &ClearRecentReactionsRequest{} }, AddMessageReactionRequestTypeID: func() bin.Object { return &AddMessageReactionRequest{} }, RemoveMessageReactionRequestTypeID: func() bin.Object { return &RemoveMessageReactionRequest{} }, - AddPaidMessageReactionRequestTypeID: func() bin.Object { return &AddPaidMessageReactionRequest{} }, + AddPendingPaidMessageReactionRequestTypeID: func() bin.Object { return &AddPendingPaidMessageReactionRequest{} }, + CommitPendingPaidMessageReactionsRequestTypeID: func() bin.Object { return &CommitPendingPaidMessageReactionsRequest{} }, RemovePendingPaidMessageReactionsRequestTypeID: func() bin.Object { return &RemovePendingPaidMessageReactionsRequest{} }, TogglePaidMessageReactionIsAnonymousRequestTypeID: func() bin.Object { return &TogglePaidMessageReactionIsAnonymousRequest{} }, SetMessageReactionsRequestTypeID: func() bin.Object { return &SetMessageReactionsRequest{} }, @@ -6670,7 +6716,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ShareChatWithBotRequestTypeID: func() bin.Object { return &ShareChatWithBotRequest{} }, GetInlineQueryResultsRequestTypeID: func() bin.Object { return &GetInlineQueryResultsRequest{} }, AnswerInlineQueryRequestTypeID: func() bin.Object { return &AnswerInlineQueryRequest{} }, - GetPopularWebAppBotsRequestTypeID: func() bin.Object { return &GetPopularWebAppBotsRequest{} }, + GetGrossingWebAppBotsRequestTypeID: func() bin.Object { return &GetGrossingWebAppBotsRequest{} }, SearchWebAppRequestTypeID: func() bin.Object { return &SearchWebAppRequest{} }, GetWebAppLinkURLRequestTypeID: func() bin.Object { return &GetWebAppLinkURLRequest{} }, GetMainWebAppRequestTypeID: func() bin.Object { return &GetMainWebAppRequest{} }, @@ -6931,6 +6977,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { GetTrendingStickerSetsRequestTypeID: func() bin.Object { return &GetTrendingStickerSetsRequest{} }, GetAttachedStickerSetsRequestTypeID: func() bin.Object { return &GetAttachedStickerSetsRequest{} }, GetStickerSetRequestTypeID: func() bin.Object { return &GetStickerSetRequest{} }, + GetStickerSetNameRequestTypeID: func() bin.Object { return &GetStickerSetNameRequest{} }, SearchStickerSetRequestTypeID: func() bin.Object { return &SearchStickerSetRequest{} }, SearchInstalledStickerSetsRequestTypeID: func() bin.Object { return &SearchInstalledStickerSetsRequest{} }, SearchStickerSetsRequestTypeID: func() bin.Object { return &SearchStickerSetsRequest{} }, @@ -7167,10 +7214,11 @@ func TypesConstructorMap() map[uint32]func() bin.Object { GetPremiumGiftCodePaymentOptionsRequestTypeID: func() bin.Object { return &GetPremiumGiftCodePaymentOptionsRequest{} }, CheckPremiumGiftCodeRequestTypeID: func() bin.Object { return &CheckPremiumGiftCodeRequest{} }, ApplyPremiumGiftCodeRequestTypeID: func() bin.Object { return &ApplyPremiumGiftCodeRequest{} }, - LaunchPrepaidPremiumGiveawayRequestTypeID: func() bin.Object { return &LaunchPrepaidPremiumGiveawayRequest{} }, - GetPremiumGiveawayInfoRequestTypeID: func() bin.Object { return &GetPremiumGiveawayInfoRequest{} }, + LaunchPrepaidGiveawayRequestTypeID: func() bin.Object { return &LaunchPrepaidGiveawayRequest{} }, + GetGiveawayInfoRequestTypeID: func() bin.Object { return &GetGiveawayInfoRequest{} }, GetStarPaymentOptionsRequestTypeID: func() bin.Object { return &GetStarPaymentOptionsRequest{} }, GetStarGiftPaymentOptionsRequestTypeID: func() bin.Object { return &GetStarGiftPaymentOptionsRequest{} }, + GetStarGiveawayPaymentOptionsRequestTypeID: func() bin.Object { return &GetStarGiveawayPaymentOptionsRequest{} }, GetStarTransactionsRequestTypeID: func() bin.Object { return &GetStarTransactionsRequest{} }, GetStarSubscriptionsRequestTypeID: func() bin.Object { return &GetStarSubscriptionsRequest{} }, CanPurchaseFromStoreRequestTypeID: func() bin.Object { return &CanPurchaseFromStoreRequest{} }, @@ -7373,11 +7421,6 @@ func ClassConstructorsMap() map[string][]uint32 { CanTransferOwnershipResultPasswordTooFreshTypeID, CanTransferOwnershipResultSessionTooFreshTypeID, }, - ChannelTransactionPurposeClassName: { - ChannelTransactionPurposePaidMediaTypeID, - ChannelTransactionPurposeJoinTypeID, - ChannelTransactionPurposeReactionTypeID, - }, ChatActionBarClassName: { ChatActionBarReportSpamTypeID, ChatActionBarReportUnrelatedLocationTypeID, @@ -7426,6 +7469,7 @@ func ClassConstructorsMap() map[string][]uint32 { ChatEventMemberLeftTypeID, ChatEventMemberPromotedTypeID, ChatEventMemberRestrictedTypeID, + ChatEventMemberSubscriptionExtendedTypeID, ChatEventAvailableReactionsChangedTypeID, ChatEventBackgroundChangedTypeID, ChatEventDescriptionChangedTypeID, @@ -7508,6 +7552,12 @@ func ClassConstructorsMap() map[string][]uint32 { ChatStatisticsObjectTypeMessageTypeID, ChatStatisticsObjectTypeStoryTypeID, }, + ChatTransactionPurposeClassName: { + ChatTransactionPurposePaidMediaTypeID, + ChatTransactionPurposeJoinTypeID, + ChatTransactionPurposeReactionTypeID, + ChatTransactionPurposeGiveawayTypeID, + }, ChatTypeClassName: { ChatTypePrivateTypeID, ChatTypeBasicGroupTypeID, @@ -7604,6 +7654,21 @@ func ClassConstructorsMap() map[string][]uint32 { FirebaseDeviceVerificationParametersSafetyNetTypeID, FirebaseDeviceVerificationParametersPlayIntegrityTypeID, }, + GiveawayInfoClassName: { + GiveawayInfoOngoingTypeID, + GiveawayInfoCompletedTypeID, + }, + GiveawayParticipantStatusClassName: { + GiveawayParticipantStatusEligibleTypeID, + GiveawayParticipantStatusParticipatingTypeID, + GiveawayParticipantStatusAlreadyWasMemberTypeID, + GiveawayParticipantStatusAdministratorTypeID, + GiveawayParticipantStatusDisallowedCountryTypeID, + }, + GiveawayPrizeClassName: { + GiveawayPrizePremiumTypeID, + GiveawayPrizeStarsTypeID, + }, GroupCallVideoQualityClassName: { GroupCallVideoQualityThumbnailTypeID, GroupCallVideoQualityMediumTypeID, @@ -7840,6 +7905,8 @@ func ClassConstructorsMap() map[string][]uint32 { LinkPreviewTypeEmbeddedAnimationPlayerTypeID, LinkPreviewTypeEmbeddedAudioPlayerTypeID, LinkPreviewTypeEmbeddedVideoPlayerTypeID, + LinkPreviewTypeExternalAudioTypeID, + LinkPreviewTypeExternalVideoTypeID, LinkPreviewTypeInvoiceTypeID, LinkPreviewTypeMessageTypeID, LinkPreviewTypePhotoTypeID, @@ -7931,11 +7998,12 @@ func ClassConstructorsMap() map[string][]uint32 { MessagePaymentRefundedTypeID, MessageGiftedPremiumTypeID, MessagePremiumGiftCodeTypeID, - MessagePremiumGiveawayCreatedTypeID, - MessagePremiumGiveawayTypeID, - MessagePremiumGiveawayCompletedTypeID, - MessagePremiumGiveawayWinnersTypeID, + MessageGiveawayCreatedTypeID, + MessageGiveawayTypeID, + MessageGiveawayCompletedTypeID, + MessageGiveawayWinnersTypeID, MessageGiftedStarsTypeID, + MessageGiveawayPrizeStarsTypeID, MessageContactRegisteredTypeID, MessageUsersSharedTypeID, MessageChatSharedTypeID, @@ -8171,17 +8239,6 @@ func ClassConstructorsMap() map[string][]uint32 { PremiumFeatureBusinessTypeID, PremiumFeatureMessageEffectsTypeID, }, - PremiumGiveawayInfoClassName: { - PremiumGiveawayInfoOngoingTypeID, - PremiumGiveawayInfoCompletedTypeID, - }, - PremiumGiveawayParticipantStatusClassName: { - PremiumGiveawayParticipantStatusEligibleTypeID, - PremiumGiveawayParticipantStatusParticipatingTypeID, - PremiumGiveawayParticipantStatusAlreadyWasMemberTypeID, - PremiumGiveawayParticipantStatusAdministratorTypeID, - PremiumGiveawayParticipantStatusDisallowedCountryTypeID, - }, PremiumLimitTypeClassName: { PremiumLimitTypeSupergroupCountTypeID, PremiumLimitTypePinnedChatCountTypeID, @@ -8248,7 +8305,7 @@ func ClassConstructorsMap() map[string][]uint32 { PushMessageContentPhotoTypeID, PushMessageContentPollTypeID, PushMessageContentPremiumGiftCodeTypeID, - PushMessageContentPremiumGiveawayTypeID, + PushMessageContentGiveawayTypeID, PushMessageContentScreenshotTakenTypeID, PushMessageContentStickerTypeID, PushMessageContentStoryTypeID, @@ -8407,7 +8464,7 @@ func ClassConstructorsMap() map[string][]uint32 { StarTransactionPartnerTelegramAdsTypeID, StarTransactionPartnerBotTypeID, StarTransactionPartnerBusinessTypeID, - StarTransactionPartnerChannelTypeID, + StarTransactionPartnerChatTypeID, StarTransactionPartnerUserTypeID, StarTransactionPartnerUnsupportedTypeID, }, @@ -8436,6 +8493,7 @@ func ClassConstructorsMap() map[string][]uint32 { StorePaymentPurposeGiftedPremiumTypeID, StorePaymentPurposePremiumGiftCodesTypeID, StorePaymentPurposePremiumGiveawayTypeID, + StorePaymentPurposeStarGiveawayTypeID, StorePaymentPurposeStarsTypeID, StorePaymentPurposeGiftedStarsTypeID, }, @@ -8512,6 +8570,7 @@ func ClassConstructorsMap() map[string][]uint32 { TelegramPaymentPurposePremiumGiveawayTypeID, TelegramPaymentPurposeStarsTypeID, TelegramPaymentPurposeGiftedStarsTypeID, + TelegramPaymentPurposeStarGiveawayTypeID, TelegramPaymentPurposeJoinChatTypeID, }, TextEntityTypeClassName: { @@ -8712,6 +8771,7 @@ func ClassConstructorsMap() map[string][]uint32 { UpdateChatBoostTypeID, UpdateMessageReactionTypeID, UpdateMessageReactionsTypeID, + UpdatePaidMediaPurchasedTypeID, }, UserPrivacySettingClassName: { UserPrivacySettingShowStatusTypeID, diff --git a/tdapi/tl_star_giveaway_payment_option_gen.go b/tdapi/tl_star_giveaway_payment_option_gen.go new file mode 100644 index 0000000000..548d181c7a --- /dev/null +++ b/tdapi/tl_star_giveaway_payment_option_gen.go @@ -0,0 +1,459 @@ +// 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{} +) + +// StarGiveawayPaymentOption represents TL type `starGiveawayPaymentOption#bca2d5e5`. +type StarGiveawayPaymentOption struct { + // ISO 4217 currency code for the payment + Currency string + // The amount to pay, in the smallest units of the currency + Amount int64 + // Number of Telegram Stars that will be distributed among winners + StarCount int64 + // Identifier of the store product associated with the option; may be empty if none + StoreProductID string + // Number of times the chat will be boosted for one year if the option is chosen + YearlyBoostCount int32 + // Allowed options for the number of giveaway winners + WinnerOptions []StarGiveawayWinnerOption + // True, if the option must be chosen by default + IsDefault bool + // True, if the option must be shown only in the full list of payment options + IsAdditional bool +} + +// StarGiveawayPaymentOptionTypeID is TL type id of StarGiveawayPaymentOption. +const StarGiveawayPaymentOptionTypeID = 0xbca2d5e5 + +// Ensuring interfaces in compile-time for StarGiveawayPaymentOption. +var ( + _ bin.Encoder = &StarGiveawayPaymentOption{} + _ bin.Decoder = &StarGiveawayPaymentOption{} + _ bin.BareEncoder = &StarGiveawayPaymentOption{} + _ bin.BareDecoder = &StarGiveawayPaymentOption{} +) + +func (s *StarGiveawayPaymentOption) Zero() bool { + if s == nil { + return true + } + if !(s.Currency == "") { + return false + } + if !(s.Amount == 0) { + return false + } + if !(s.StarCount == 0) { + return false + } + if !(s.StoreProductID == "") { + return false + } + if !(s.YearlyBoostCount == 0) { + return false + } + if !(s.WinnerOptions == nil) { + return false + } + if !(s.IsDefault == false) { + return false + } + if !(s.IsAdditional == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarGiveawayPaymentOption) String() string { + if s == nil { + return "StarGiveawayPaymentOption(nil)" + } + type Alias StarGiveawayPaymentOption + return fmt.Sprintf("StarGiveawayPaymentOption%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarGiveawayPaymentOption) TypeID() uint32 { + return StarGiveawayPaymentOptionTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarGiveawayPaymentOption) TypeName() string { + return "starGiveawayPaymentOption" +} + +// TypeInfo returns info about TL type. +func (s *StarGiveawayPaymentOption) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starGiveawayPaymentOption", + ID: StarGiveawayPaymentOptionTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Currency", + SchemaName: "currency", + }, + { + Name: "Amount", + SchemaName: "amount", + }, + { + Name: "StarCount", + SchemaName: "star_count", + }, + { + Name: "StoreProductID", + SchemaName: "store_product_id", + }, + { + Name: "YearlyBoostCount", + SchemaName: "yearly_boost_count", + }, + { + Name: "WinnerOptions", + SchemaName: "winner_options", + }, + { + Name: "IsDefault", + SchemaName: "is_default", + }, + { + Name: "IsAdditional", + SchemaName: "is_additional", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StarGiveawayPaymentOption) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiveawayPaymentOption#bca2d5e5 as nil") + } + b.PutID(StarGiveawayPaymentOptionTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarGiveawayPaymentOption) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiveawayPaymentOption#bca2d5e5 as nil") + } + b.PutString(s.Currency) + b.PutInt53(s.Amount) + b.PutInt53(s.StarCount) + b.PutString(s.StoreProductID) + b.PutInt32(s.YearlyBoostCount) + b.PutInt(len(s.WinnerOptions)) + for idx, v := range s.WinnerOptions { + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare starGiveawayPaymentOption#bca2d5e5: field winner_options element with index %d: %w", idx, err) + } + } + b.PutBool(s.IsDefault) + b.PutBool(s.IsAdditional) + return nil +} + +// Decode implements bin.Decoder. +func (s *StarGiveawayPaymentOption) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiveawayPaymentOption#bca2d5e5 to nil") + } + if err := b.ConsumeID(StarGiveawayPaymentOptionTypeID); err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarGiveawayPaymentOption) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiveawayPaymentOption#bca2d5e5 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field currency: %w", err) + } + s.Currency = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field amount: %w", err) + } + s.Amount = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field star_count: %w", err) + } + s.StarCount = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field store_product_id: %w", err) + } + s.StoreProductID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field yearly_boost_count: %w", err) + } + s.YearlyBoostCount = value + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field winner_options: %w", err) + } + + if headerLen > 0 { + s.WinnerOptions = make([]StarGiveawayWinnerOption, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value StarGiveawayWinnerOption + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare starGiveawayPaymentOption#bca2d5e5: field winner_options: %w", err) + } + s.WinnerOptions = append(s.WinnerOptions, value) + } + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field is_default: %w", err) + } + s.IsDefault = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field is_additional: %w", err) + } + s.IsAdditional = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StarGiveawayPaymentOption) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode starGiveawayPaymentOption#bca2d5e5 as nil") + } + b.ObjStart() + b.PutID("starGiveawayPaymentOption") + b.Comma() + b.FieldStart("currency") + b.PutString(s.Currency) + b.Comma() + b.FieldStart("amount") + b.PutInt53(s.Amount) + b.Comma() + b.FieldStart("star_count") + b.PutInt53(s.StarCount) + b.Comma() + b.FieldStart("store_product_id") + b.PutString(s.StoreProductID) + b.Comma() + b.FieldStart("yearly_boost_count") + b.PutInt32(s.YearlyBoostCount) + b.Comma() + b.FieldStart("winner_options") + b.ArrStart() + for idx, v := range s.WinnerOptions { + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode starGiveawayPaymentOption#bca2d5e5: field winner_options element with index %d: %w", idx, err) + } + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.FieldStart("is_default") + b.PutBool(s.IsDefault) + b.Comma() + b.FieldStart("is_additional") + b.PutBool(s.IsAdditional) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StarGiveawayPaymentOption) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode starGiveawayPaymentOption#bca2d5e5 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("starGiveawayPaymentOption"); err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: %w", err) + } + case "currency": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field currency: %w", err) + } + s.Currency = value + case "amount": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field amount: %w", err) + } + s.Amount = value + case "star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field star_count: %w", err) + } + s.StarCount = value + case "store_product_id": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field store_product_id: %w", err) + } + s.StoreProductID = value + case "yearly_boost_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field yearly_boost_count: %w", err) + } + s.YearlyBoostCount = value + case "winner_options": + if err := b.Arr(func(b tdjson.Decoder) error { + var value StarGiveawayWinnerOption + if err := value.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field winner_options: %w", err) + } + s.WinnerOptions = append(s.WinnerOptions, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field winner_options: %w", err) + } + case "is_default": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field is_default: %w", err) + } + s.IsDefault = value + case "is_additional": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field is_additional: %w", err) + } + s.IsAdditional = value + default: + return b.Skip() + } + return nil + }) +} + +// GetCurrency returns value of Currency field. +func (s *StarGiveawayPaymentOption) GetCurrency() (value string) { + if s == nil { + return + } + return s.Currency +} + +// GetAmount returns value of Amount field. +func (s *StarGiveawayPaymentOption) GetAmount() (value int64) { + if s == nil { + return + } + return s.Amount +} + +// GetStarCount returns value of StarCount field. +func (s *StarGiveawayPaymentOption) GetStarCount() (value int64) { + if s == nil { + return + } + return s.StarCount +} + +// GetStoreProductID returns value of StoreProductID field. +func (s *StarGiveawayPaymentOption) GetStoreProductID() (value string) { + if s == nil { + return + } + return s.StoreProductID +} + +// GetYearlyBoostCount returns value of YearlyBoostCount field. +func (s *StarGiveawayPaymentOption) GetYearlyBoostCount() (value int32) { + if s == nil { + return + } + return s.YearlyBoostCount +} + +// GetWinnerOptions returns value of WinnerOptions field. +func (s *StarGiveawayPaymentOption) GetWinnerOptions() (value []StarGiveawayWinnerOption) { + if s == nil { + return + } + return s.WinnerOptions +} + +// GetIsDefault returns value of IsDefault field. +func (s *StarGiveawayPaymentOption) GetIsDefault() (value bool) { + if s == nil { + return + } + return s.IsDefault +} + +// GetIsAdditional returns value of IsAdditional field. +func (s *StarGiveawayPaymentOption) GetIsAdditional() (value bool) { + if s == nil { + return + } + return s.IsAdditional +} diff --git a/tdapi/tl_star_giveaway_payment_options_gen.go b/tdapi/tl_star_giveaway_payment_options_gen.go new file mode 100644 index 0000000000..d5370a28a3 --- /dev/null +++ b/tdapi/tl_star_giveaway_payment_options_gen.go @@ -0,0 +1,221 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// StarGiveawayPaymentOptions represents TL type `starGiveawayPaymentOptions#909fbf18`. +type StarGiveawayPaymentOptions struct { + // The list of options + Options []StarGiveawayPaymentOption +} + +// StarGiveawayPaymentOptionsTypeID is TL type id of StarGiveawayPaymentOptions. +const StarGiveawayPaymentOptionsTypeID = 0x909fbf18 + +// Ensuring interfaces in compile-time for StarGiveawayPaymentOptions. +var ( + _ bin.Encoder = &StarGiveawayPaymentOptions{} + _ bin.Decoder = &StarGiveawayPaymentOptions{} + _ bin.BareEncoder = &StarGiveawayPaymentOptions{} + _ bin.BareDecoder = &StarGiveawayPaymentOptions{} +) + +func (s *StarGiveawayPaymentOptions) Zero() bool { + if s == nil { + return true + } + if !(s.Options == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarGiveawayPaymentOptions) String() string { + if s == nil { + return "StarGiveawayPaymentOptions(nil)" + } + type Alias StarGiveawayPaymentOptions + return fmt.Sprintf("StarGiveawayPaymentOptions%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarGiveawayPaymentOptions) TypeID() uint32 { + return StarGiveawayPaymentOptionsTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarGiveawayPaymentOptions) TypeName() string { + return "starGiveawayPaymentOptions" +} + +// TypeInfo returns info about TL type. +func (s *StarGiveawayPaymentOptions) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starGiveawayPaymentOptions", + ID: StarGiveawayPaymentOptionsTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Options", + SchemaName: "options", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StarGiveawayPaymentOptions) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiveawayPaymentOptions#909fbf18 as nil") + } + b.PutID(StarGiveawayPaymentOptionsTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarGiveawayPaymentOptions) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiveawayPaymentOptions#909fbf18 as nil") + } + b.PutInt(len(s.Options)) + for idx, v := range s.Options { + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare starGiveawayPaymentOptions#909fbf18: field options element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StarGiveawayPaymentOptions) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiveawayPaymentOptions#909fbf18 to nil") + } + if err := b.ConsumeID(StarGiveawayPaymentOptionsTypeID); err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOptions#909fbf18: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarGiveawayPaymentOptions) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiveawayPaymentOptions#909fbf18 to nil") + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOptions#909fbf18: field options: %w", err) + } + + if headerLen > 0 { + s.Options = make([]StarGiveawayPaymentOption, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value StarGiveawayPaymentOption + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare starGiveawayPaymentOptions#909fbf18: field options: %w", err) + } + s.Options = append(s.Options, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StarGiveawayPaymentOptions) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode starGiveawayPaymentOptions#909fbf18 as nil") + } + b.ObjStart() + b.PutID("starGiveawayPaymentOptions") + b.Comma() + b.FieldStart("options") + b.ArrStart() + for idx, v := range s.Options { + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode starGiveawayPaymentOptions#909fbf18: field options 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 (s *StarGiveawayPaymentOptions) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode starGiveawayPaymentOptions#909fbf18 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("starGiveawayPaymentOptions"); err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOptions#909fbf18: %w", err) + } + case "options": + if err := b.Arr(func(b tdjson.Decoder) error { + var value StarGiveawayPaymentOption + if err := value.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOptions#909fbf18: field options: %w", err) + } + s.Options = append(s.Options, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode starGiveawayPaymentOptions#909fbf18: field options: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetOptions returns value of Options field. +func (s *StarGiveawayPaymentOptions) GetOptions() (value []StarGiveawayPaymentOption) { + if s == nil { + return + } + return s.Options +} diff --git a/tdapi/tl_star_giveaway_winner_option_gen.go b/tdapi/tl_star_giveaway_winner_option_gen.go new file mode 100644 index 0000000000..5caddadd02 --- /dev/null +++ b/tdapi/tl_star_giveaway_winner_option_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{} +) + +// StarGiveawayWinnerOption represents TL type `starGiveawayWinnerOption#cc639607`. +type StarGiveawayWinnerOption struct { + // The number of users that will be chosen as winners + WinnerCount int32 + // The number of Telegram Stars that will be won by the winners of the giveaway + WonStarCount int64 + // True, if the option must be chosen by default + IsDefault bool +} + +// StarGiveawayWinnerOptionTypeID is TL type id of StarGiveawayWinnerOption. +const StarGiveawayWinnerOptionTypeID = 0xcc639607 + +// Ensuring interfaces in compile-time for StarGiveawayWinnerOption. +var ( + _ bin.Encoder = &StarGiveawayWinnerOption{} + _ bin.Decoder = &StarGiveawayWinnerOption{} + _ bin.BareEncoder = &StarGiveawayWinnerOption{} + _ bin.BareDecoder = &StarGiveawayWinnerOption{} +) + +func (s *StarGiveawayWinnerOption) Zero() bool { + if s == nil { + return true + } + if !(s.WinnerCount == 0) { + return false + } + if !(s.WonStarCount == 0) { + return false + } + if !(s.IsDefault == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarGiveawayWinnerOption) String() string { + if s == nil { + return "StarGiveawayWinnerOption(nil)" + } + type Alias StarGiveawayWinnerOption + return fmt.Sprintf("StarGiveawayWinnerOption%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarGiveawayWinnerOption) TypeID() uint32 { + return StarGiveawayWinnerOptionTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarGiveawayWinnerOption) TypeName() string { + return "starGiveawayWinnerOption" +} + +// TypeInfo returns info about TL type. +func (s *StarGiveawayWinnerOption) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starGiveawayWinnerOption", + ID: StarGiveawayWinnerOptionTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "WinnerCount", + SchemaName: "winner_count", + }, + { + Name: "WonStarCount", + SchemaName: "won_star_count", + }, + { + Name: "IsDefault", + SchemaName: "is_default", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StarGiveawayWinnerOption) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiveawayWinnerOption#cc639607 as nil") + } + b.PutID(StarGiveawayWinnerOptionTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarGiveawayWinnerOption) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiveawayWinnerOption#cc639607 as nil") + } + b.PutInt32(s.WinnerCount) + b.PutInt53(s.WonStarCount) + b.PutBool(s.IsDefault) + return nil +} + +// Decode implements bin.Decoder. +func (s *StarGiveawayWinnerOption) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiveawayWinnerOption#cc639607 to nil") + } + if err := b.ConsumeID(StarGiveawayWinnerOptionTypeID); err != nil { + return fmt.Errorf("unable to decode starGiveawayWinnerOption#cc639607: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarGiveawayWinnerOption) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiveawayWinnerOption#cc639607 to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayWinnerOption#cc639607: field winner_count: %w", err) + } + s.WinnerCount = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayWinnerOption#cc639607: field won_star_count: %w", err) + } + s.WonStarCount = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayWinnerOption#cc639607: field is_default: %w", err) + } + s.IsDefault = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StarGiveawayWinnerOption) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode starGiveawayWinnerOption#cc639607 as nil") + } + b.ObjStart() + b.PutID("starGiveawayWinnerOption") + b.Comma() + b.FieldStart("winner_count") + b.PutInt32(s.WinnerCount) + b.Comma() + b.FieldStart("won_star_count") + b.PutInt53(s.WonStarCount) + b.Comma() + b.FieldStart("is_default") + b.PutBool(s.IsDefault) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StarGiveawayWinnerOption) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode starGiveawayWinnerOption#cc639607 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("starGiveawayWinnerOption"); err != nil { + return fmt.Errorf("unable to decode starGiveawayWinnerOption#cc639607: %w", err) + } + case "winner_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayWinnerOption#cc639607: field winner_count: %w", err) + } + s.WinnerCount = value + case "won_star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayWinnerOption#cc639607: field won_star_count: %w", err) + } + s.WonStarCount = value + case "is_default": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode starGiveawayWinnerOption#cc639607: field is_default: %w", err) + } + s.IsDefault = value + default: + return b.Skip() + } + return nil + }) +} + +// GetWinnerCount returns value of WinnerCount field. +func (s *StarGiveawayWinnerOption) GetWinnerCount() (value int32) { + if s == nil { + return + } + return s.WinnerCount +} + +// GetWonStarCount returns value of WonStarCount field. +func (s *StarGiveawayWinnerOption) GetWonStarCount() (value int64) { + if s == nil { + return + } + return s.WonStarCount +} + +// GetIsDefault returns value of IsDefault field. +func (s *StarGiveawayWinnerOption) GetIsDefault() (value bool) { + if s == nil { + return + } + return s.IsDefault +} diff --git a/tdapi/tl_star_transaction_partner_gen.go b/tdapi/tl_star_transaction_partner_gen.go index aecccbce87..1fbfc0b1ba 100644 --- a/tdapi/tl_star_transaction_partner_gen.go +++ b/tdapi/tl_star_transaction_partner_gen.go @@ -1175,31 +1175,31 @@ func (s *StarTransactionPartnerBusiness) GetMedia() (value []PaidMediaClass) { return s.Media } -// StarTransactionPartnerChannel represents TL type `starTransactionPartnerChannel#7c04767e`. -type StarTransactionPartnerChannel struct { +// StarTransactionPartnerChat represents TL type `starTransactionPartnerChat#71db4d40`. +type StarTransactionPartnerChat struct { // Identifier of the chat ChatID int64 // Purpose of the transaction - Purpose ChannelTransactionPurposeClass + Purpose ChatTransactionPurposeClass } -// StarTransactionPartnerChannelTypeID is TL type id of StarTransactionPartnerChannel. -const StarTransactionPartnerChannelTypeID = 0x7c04767e +// StarTransactionPartnerChatTypeID is TL type id of StarTransactionPartnerChat. +const StarTransactionPartnerChatTypeID = 0x71db4d40 // construct implements constructor of StarTransactionPartnerClass. -func (s StarTransactionPartnerChannel) construct() StarTransactionPartnerClass { return &s } +func (s StarTransactionPartnerChat) construct() StarTransactionPartnerClass { return &s } -// Ensuring interfaces in compile-time for StarTransactionPartnerChannel. +// Ensuring interfaces in compile-time for StarTransactionPartnerChat. var ( - _ bin.Encoder = &StarTransactionPartnerChannel{} - _ bin.Decoder = &StarTransactionPartnerChannel{} - _ bin.BareEncoder = &StarTransactionPartnerChannel{} - _ bin.BareDecoder = &StarTransactionPartnerChannel{} + _ bin.Encoder = &StarTransactionPartnerChat{} + _ bin.Decoder = &StarTransactionPartnerChat{} + _ bin.BareEncoder = &StarTransactionPartnerChat{} + _ bin.BareDecoder = &StarTransactionPartnerChat{} - _ StarTransactionPartnerClass = &StarTransactionPartnerChannel{} + _ StarTransactionPartnerClass = &StarTransactionPartnerChat{} ) -func (s *StarTransactionPartnerChannel) Zero() bool { +func (s *StarTransactionPartnerChat) Zero() bool { if s == nil { return true } @@ -1214,31 +1214,31 @@ func (s *StarTransactionPartnerChannel) Zero() bool { } // String implements fmt.Stringer. -func (s *StarTransactionPartnerChannel) String() string { +func (s *StarTransactionPartnerChat) String() string { if s == nil { - return "StarTransactionPartnerChannel(nil)" + return "StarTransactionPartnerChat(nil)" } - type Alias StarTransactionPartnerChannel - return fmt.Sprintf("StarTransactionPartnerChannel%+v", Alias(*s)) + type Alias StarTransactionPartnerChat + return fmt.Sprintf("StarTransactionPartnerChat%+v", Alias(*s)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionPartnerChannel) TypeID() uint32 { - return StarTransactionPartnerChannelTypeID +func (*StarTransactionPartnerChat) TypeID() uint32 { + return StarTransactionPartnerChatTypeID } // TypeName returns name of type in TL schema. -func (*StarTransactionPartnerChannel) TypeName() string { - return "starTransactionPartnerChannel" +func (*StarTransactionPartnerChat) TypeName() string { + return "starTransactionPartnerChat" } // TypeInfo returns info about TL type. -func (s *StarTransactionPartnerChannel) TypeInfo() tdp.Type { +func (s *StarTransactionPartnerChat) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "starTransactionPartnerChannel", - ID: StarTransactionPartnerChannelTypeID, + Name: "starTransactionPartnerChat", + ID: StarTransactionPartnerChatTypeID, } if s == nil { typ.Null = true @@ -1258,56 +1258,56 @@ func (s *StarTransactionPartnerChannel) TypeInfo() tdp.Type { } // Encode implements bin.Encoder. -func (s *StarTransactionPartnerChannel) Encode(b *bin.Buffer) error { +func (s *StarTransactionPartnerChat) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starTransactionPartnerChannel#7c04767e as nil") + return fmt.Errorf("can't encode starTransactionPartnerChat#71db4d40 as nil") } - b.PutID(StarTransactionPartnerChannelTypeID) + b.PutID(StarTransactionPartnerChatTypeID) return s.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (s *StarTransactionPartnerChannel) EncodeBare(b *bin.Buffer) error { +func (s *StarTransactionPartnerChat) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starTransactionPartnerChannel#7c04767e as nil") + return fmt.Errorf("can't encode starTransactionPartnerChat#71db4d40 as nil") } b.PutInt53(s.ChatID) if s.Purpose == nil { - return fmt.Errorf("unable to encode starTransactionPartnerChannel#7c04767e: field purpose is nil") + return fmt.Errorf("unable to encode starTransactionPartnerChat#71db4d40: field purpose is nil") } if err := s.Purpose.Encode(b); err != nil { - return fmt.Errorf("unable to encode starTransactionPartnerChannel#7c04767e: field purpose: %w", err) + return fmt.Errorf("unable to encode starTransactionPartnerChat#71db4d40: field purpose: %w", err) } return nil } // Decode implements bin.Decoder. -func (s *StarTransactionPartnerChannel) Decode(b *bin.Buffer) error { +func (s *StarTransactionPartnerChat) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starTransactionPartnerChannel#7c04767e to nil") + return fmt.Errorf("can't decode starTransactionPartnerChat#71db4d40 to nil") } - if err := b.ConsumeID(StarTransactionPartnerChannelTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionPartnerChannel#7c04767e: %w", err) + if err := b.ConsumeID(StarTransactionPartnerChatTypeID); err != nil { + return fmt.Errorf("unable to decode starTransactionPartnerChat#71db4d40: %w", err) } return s.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (s *StarTransactionPartnerChannel) DecodeBare(b *bin.Buffer) error { +func (s *StarTransactionPartnerChat) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starTransactionPartnerChannel#7c04767e to nil") + return fmt.Errorf("can't decode starTransactionPartnerChat#71db4d40 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode starTransactionPartnerChannel#7c04767e: field chat_id: %w", err) + return fmt.Errorf("unable to decode starTransactionPartnerChat#71db4d40: field chat_id: %w", err) } s.ChatID = value } { - value, err := DecodeChannelTransactionPurpose(b) + value, err := DecodeChatTransactionPurpose(b) if err != nil { - return fmt.Errorf("unable to decode starTransactionPartnerChannel#7c04767e: field purpose: %w", err) + return fmt.Errorf("unable to decode starTransactionPartnerChat#71db4d40: field purpose: %w", err) } s.Purpose = value } @@ -1315,22 +1315,22 @@ func (s *StarTransactionPartnerChannel) DecodeBare(b *bin.Buffer) error { } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionPartnerChannel) EncodeTDLibJSON(b tdjson.Encoder) error { +func (s *StarTransactionPartnerChat) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode starTransactionPartnerChannel#7c04767e as nil") + return fmt.Errorf("can't encode starTransactionPartnerChat#71db4d40 as nil") } b.ObjStart() - b.PutID("starTransactionPartnerChannel") + b.PutID("starTransactionPartnerChat") b.Comma() b.FieldStart("chat_id") b.PutInt53(s.ChatID) b.Comma() b.FieldStart("purpose") if s.Purpose == nil { - return fmt.Errorf("unable to encode starTransactionPartnerChannel#7c04767e: field purpose is nil") + return fmt.Errorf("unable to encode starTransactionPartnerChat#71db4d40: field purpose is nil") } if err := s.Purpose.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactionPartnerChannel#7c04767e: field purpose: %w", err) + return fmt.Errorf("unable to encode starTransactionPartnerChat#71db4d40: field purpose: %w", err) } b.Comma() b.StripComma() @@ -1339,27 +1339,27 @@ func (s *StarTransactionPartnerChannel) EncodeTDLibJSON(b tdjson.Encoder) error } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionPartnerChannel) DecodeTDLibJSON(b tdjson.Decoder) error { +func (s *StarTransactionPartnerChat) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode starTransactionPartnerChannel#7c04767e to nil") + return fmt.Errorf("can't decode starTransactionPartnerChat#71db4d40 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("starTransactionPartnerChannel"); err != nil { - return fmt.Errorf("unable to decode starTransactionPartnerChannel#7c04767e: %w", err) + if err := b.ConsumeID("starTransactionPartnerChat"); err != nil { + return fmt.Errorf("unable to decode starTransactionPartnerChat#71db4d40: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode starTransactionPartnerChannel#7c04767e: field chat_id: %w", err) + return fmt.Errorf("unable to decode starTransactionPartnerChat#71db4d40: field chat_id: %w", err) } s.ChatID = value case "purpose": - value, err := DecodeTDLibJSONChannelTransactionPurpose(b) + value, err := DecodeTDLibJSONChatTransactionPurpose(b) if err != nil { - return fmt.Errorf("unable to decode starTransactionPartnerChannel#7c04767e: field purpose: %w", err) + return fmt.Errorf("unable to decode starTransactionPartnerChat#71db4d40: field purpose: %w", err) } s.Purpose = value default: @@ -1370,7 +1370,7 @@ func (s *StarTransactionPartnerChannel) DecodeTDLibJSON(b tdjson.Decoder) error } // GetChatID returns value of ChatID field. -func (s *StarTransactionPartnerChannel) GetChatID() (value int64) { +func (s *StarTransactionPartnerChat) GetChatID() (value int64) { if s == nil { return } @@ -1378,7 +1378,7 @@ func (s *StarTransactionPartnerChannel) GetChatID() (value int64) { } // GetPurpose returns value of Purpose field. -func (s *StarTransactionPartnerChannel) GetPurpose() (value ChannelTransactionPurposeClass) { +func (s *StarTransactionPartnerChat) GetPurpose() (value ChatTransactionPurposeClass) { if s == nil { return } @@ -1735,7 +1735,7 @@ const StarTransactionPartnerClassName = "StarTransactionPartner" // case *tdapi.StarTransactionPartnerTelegramAds: // starTransactionPartnerTelegramAds#91f9c6b // case *tdapi.StarTransactionPartnerBot: // starTransactionPartnerBot#4ece3a40 // case *tdapi.StarTransactionPartnerBusiness: // starTransactionPartnerBusiness#7af9fb52 -// case *tdapi.StarTransactionPartnerChannel: // starTransactionPartnerChannel#7c04767e +// case *tdapi.StarTransactionPartnerChat: // starTransactionPartnerChat#71db4d40 // case *tdapi.StarTransactionPartnerUser: // starTransactionPartnerUser#2cf89d66 // case *tdapi.StarTransactionPartnerUnsupported: // starTransactionPartnerUnsupported#c4b20d73 // default: panic(v) @@ -1818,9 +1818,9 @@ func DecodeStarTransactionPartner(buf *bin.Buffer) (StarTransactionPartnerClass, return nil, fmt.Errorf("unable to decode StarTransactionPartnerClass: %w", err) } return &v, nil - case StarTransactionPartnerChannelTypeID: - // Decoding starTransactionPartnerChannel#7c04767e. - v := StarTransactionPartnerChannel{} + case StarTransactionPartnerChatTypeID: + // Decoding starTransactionPartnerChat#71db4d40. + v := StarTransactionPartnerChat{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode StarTransactionPartnerClass: %w", err) } @@ -1900,9 +1900,9 @@ func DecodeTDLibJSONStarTransactionPartner(buf tdjson.Decoder) (StarTransactionP return nil, fmt.Errorf("unable to decode StarTransactionPartnerClass: %w", err) } return &v, nil - case "starTransactionPartnerChannel": - // Decoding starTransactionPartnerChannel#7c04767e. - v := StarTransactionPartnerChannel{} + case "starTransactionPartnerChat": + // Decoding starTransactionPartnerChat#71db4d40. + v := StarTransactionPartnerChat{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode StarTransactionPartnerClass: %w", err) } diff --git a/tdapi/tl_store_payment_purpose_gen.go b/tdapi/tl_store_payment_purpose_gen.go index 7d1148e6cf..964bbce675 100644 --- a/tdapi/tl_store_payment_purpose_gen.go +++ b/tdapi/tl_store_payment_purpose_gen.go @@ -760,10 +760,10 @@ func (s *StorePaymentPurposePremiumGiftCodes) GetUserIDs() (value []int64) { return s.UserIDs } -// StorePaymentPurposePremiumGiveaway represents TL type `storePaymentPurposePremiumGiveaway#504790d9`. +// StorePaymentPurposePremiumGiveaway represents TL type `storePaymentPurposePremiumGiveaway#4da47aaa`. type StorePaymentPurposePremiumGiveaway struct { // Giveaway parameters - Parameters PremiumGiveawayParameters + Parameters GiveawayParameters // ISO 4217 currency code of the payment currency Currency string // Paid amount, in the smallest units of the currency @@ -771,7 +771,7 @@ type StorePaymentPurposePremiumGiveaway struct { } // StorePaymentPurposePremiumGiveawayTypeID is TL type id of StorePaymentPurposePremiumGiveaway. -const StorePaymentPurposePremiumGiveawayTypeID = 0x504790d9 +const StorePaymentPurposePremiumGiveawayTypeID = 0x4da47aaa // construct implements constructor of StorePaymentPurposeClass. func (s StorePaymentPurposePremiumGiveaway) construct() StorePaymentPurposeClass { return &s } @@ -854,7 +854,7 @@ func (s *StorePaymentPurposePremiumGiveaway) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *StorePaymentPurposePremiumGiveaway) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode storePaymentPurposePremiumGiveaway#504790d9 as nil") + return fmt.Errorf("can't encode storePaymentPurposePremiumGiveaway#4da47aaa as nil") } b.PutID(StorePaymentPurposePremiumGiveawayTypeID) return s.EncodeBare(b) @@ -863,10 +863,10 @@ func (s *StorePaymentPurposePremiumGiveaway) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StorePaymentPurposePremiumGiveaway) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode storePaymentPurposePremiumGiveaway#504790d9 as nil") + return fmt.Errorf("can't encode storePaymentPurposePremiumGiveaway#4da47aaa as nil") } if err := s.Parameters.Encode(b); err != nil { - return fmt.Errorf("unable to encode storePaymentPurposePremiumGiveaway#504790d9: field parameters: %w", err) + return fmt.Errorf("unable to encode storePaymentPurposePremiumGiveaway#4da47aaa: field parameters: %w", err) } b.PutString(s.Currency) b.PutInt53(s.Amount) @@ -876,10 +876,10 @@ func (s *StorePaymentPurposePremiumGiveaway) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *StorePaymentPurposePremiumGiveaway) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode storePaymentPurposePremiumGiveaway#504790d9 to nil") + return fmt.Errorf("can't decode storePaymentPurposePremiumGiveaway#4da47aaa to nil") } if err := b.ConsumeID(StorePaymentPurposePremiumGiveawayTypeID); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#504790d9: %w", err) + return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#4da47aaa: %w", err) } return s.DecodeBare(b) } @@ -887,24 +887,24 @@ func (s *StorePaymentPurposePremiumGiveaway) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StorePaymentPurposePremiumGiveaway) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode storePaymentPurposePremiumGiveaway#504790d9 to nil") + return fmt.Errorf("can't decode storePaymentPurposePremiumGiveaway#4da47aaa to nil") } { if err := s.Parameters.Decode(b); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#504790d9: field parameters: %w", err) + return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#4da47aaa: field parameters: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#504790d9: field currency: %w", err) + return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#4da47aaa: field currency: %w", err) } s.Currency = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#504790d9: field amount: %w", err) + return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#4da47aaa: field amount: %w", err) } s.Amount = value } @@ -914,14 +914,14 @@ func (s *StorePaymentPurposePremiumGiveaway) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *StorePaymentPurposePremiumGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode storePaymentPurposePremiumGiveaway#504790d9 as nil") + return fmt.Errorf("can't encode storePaymentPurposePremiumGiveaway#4da47aaa as nil") } b.ObjStart() b.PutID("storePaymentPurposePremiumGiveaway") b.Comma() b.FieldStart("parameters") if err := s.Parameters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storePaymentPurposePremiumGiveaway#504790d9: field parameters: %w", err) + return fmt.Errorf("unable to encode storePaymentPurposePremiumGiveaway#4da47aaa: field parameters: %w", err) } b.Comma() b.FieldStart("currency") @@ -938,29 +938,29 @@ func (s *StorePaymentPurposePremiumGiveaway) EncodeTDLibJSON(b tdjson.Encoder) e // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *StorePaymentPurposePremiumGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode storePaymentPurposePremiumGiveaway#504790d9 to nil") + return fmt.Errorf("can't decode storePaymentPurposePremiumGiveaway#4da47aaa to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("storePaymentPurposePremiumGiveaway"); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#504790d9: %w", err) + return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#4da47aaa: %w", err) } case "parameters": if err := s.Parameters.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#504790d9: field parameters: %w", err) + return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#4da47aaa: field parameters: %w", err) } case "currency": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#504790d9: field currency: %w", err) + return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#4da47aaa: field currency: %w", err) } s.Currency = value case "amount": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#504790d9: field amount: %w", err) + return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#4da47aaa: field amount: %w", err) } s.Amount = value default: @@ -971,7 +971,7 @@ func (s *StorePaymentPurposePremiumGiveaway) DecodeTDLibJSON(b tdjson.Decoder) e } // GetParameters returns value of Parameters field. -func (s *StorePaymentPurposePremiumGiveaway) GetParameters() (value PremiumGiveawayParameters) { +func (s *StorePaymentPurposePremiumGiveaway) GetParameters() (value GiveawayParameters) { if s == nil { return } @@ -994,6 +994,308 @@ func (s *StorePaymentPurposePremiumGiveaway) GetAmount() (value int64) { return s.Amount } +// StorePaymentPurposeStarGiveaway represents TL type `storePaymentPurposeStarGiveaway#c96d899`. +type StorePaymentPurposeStarGiveaway struct { + // Giveaway parameters + Parameters GiveawayParameters + // ISO 4217 currency code of the payment currency + Currency string + // Paid amount, in the smallest units of the currency + Amount int64 + // The number of users to receive Telegram Stars + WinnerCount int32 + // The number of Telegram Stars to be distributed through the giveaway + StarCount int64 +} + +// StorePaymentPurposeStarGiveawayTypeID is TL type id of StorePaymentPurposeStarGiveaway. +const StorePaymentPurposeStarGiveawayTypeID = 0xc96d899 + +// construct implements constructor of StorePaymentPurposeClass. +func (s StorePaymentPurposeStarGiveaway) construct() StorePaymentPurposeClass { return &s } + +// Ensuring interfaces in compile-time for StorePaymentPurposeStarGiveaway. +var ( + _ bin.Encoder = &StorePaymentPurposeStarGiveaway{} + _ bin.Decoder = &StorePaymentPurposeStarGiveaway{} + _ bin.BareEncoder = &StorePaymentPurposeStarGiveaway{} + _ bin.BareDecoder = &StorePaymentPurposeStarGiveaway{} + + _ StorePaymentPurposeClass = &StorePaymentPurposeStarGiveaway{} +) + +func (s *StorePaymentPurposeStarGiveaway) Zero() bool { + if s == nil { + return true + } + if !(s.Parameters.Zero()) { + return false + } + if !(s.Currency == "") { + return false + } + if !(s.Amount == 0) { + return false + } + if !(s.WinnerCount == 0) { + return false + } + if !(s.StarCount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StorePaymentPurposeStarGiveaway) String() string { + if s == nil { + return "StorePaymentPurposeStarGiveaway(nil)" + } + type Alias StorePaymentPurposeStarGiveaway + return fmt.Sprintf("StorePaymentPurposeStarGiveaway%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StorePaymentPurposeStarGiveaway) TypeID() uint32 { + return StorePaymentPurposeStarGiveawayTypeID +} + +// TypeName returns name of type in TL schema. +func (*StorePaymentPurposeStarGiveaway) TypeName() string { + return "storePaymentPurposeStarGiveaway" +} + +// TypeInfo returns info about TL type. +func (s *StorePaymentPurposeStarGiveaway) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "storePaymentPurposeStarGiveaway", + ID: StorePaymentPurposeStarGiveawayTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Parameters", + SchemaName: "parameters", + }, + { + Name: "Currency", + SchemaName: "currency", + }, + { + Name: "Amount", + SchemaName: "amount", + }, + { + Name: "WinnerCount", + SchemaName: "winner_count", + }, + { + Name: "StarCount", + SchemaName: "star_count", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StorePaymentPurposeStarGiveaway) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storePaymentPurposeStarGiveaway#c96d899 as nil") + } + b.PutID(StorePaymentPurposeStarGiveawayTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StorePaymentPurposeStarGiveaway) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storePaymentPurposeStarGiveaway#c96d899 as nil") + } + if err := s.Parameters.Encode(b); err != nil { + return fmt.Errorf("unable to encode storePaymentPurposeStarGiveaway#c96d899: field parameters: %w", err) + } + b.PutString(s.Currency) + b.PutInt53(s.Amount) + b.PutInt32(s.WinnerCount) + b.PutInt53(s.StarCount) + return nil +} + +// Decode implements bin.Decoder. +func (s *StorePaymentPurposeStarGiveaway) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storePaymentPurposeStarGiveaway#c96d899 to nil") + } + if err := b.ConsumeID(StorePaymentPurposeStarGiveawayTypeID); err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StorePaymentPurposeStarGiveaway) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storePaymentPurposeStarGiveaway#c96d899 to nil") + } + { + if err := s.Parameters.Decode(b); err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: field parameters: %w", err) + } + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: field currency: %w", err) + } + s.Currency = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: field amount: %w", err) + } + s.Amount = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: field winner_count: %w", err) + } + s.WinnerCount = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: field star_count: %w", err) + } + s.StarCount = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StorePaymentPurposeStarGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode storePaymentPurposeStarGiveaway#c96d899 as nil") + } + b.ObjStart() + b.PutID("storePaymentPurposeStarGiveaway") + b.Comma() + b.FieldStart("parameters") + if err := s.Parameters.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode storePaymentPurposeStarGiveaway#c96d899: field parameters: %w", err) + } + b.Comma() + b.FieldStart("currency") + b.PutString(s.Currency) + b.Comma() + b.FieldStart("amount") + b.PutInt53(s.Amount) + b.Comma() + b.FieldStart("winner_count") + b.PutInt32(s.WinnerCount) + b.Comma() + b.FieldStart("star_count") + b.PutInt53(s.StarCount) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StorePaymentPurposeStarGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode storePaymentPurposeStarGiveaway#c96d899 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("storePaymentPurposeStarGiveaway"); err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: %w", err) + } + case "parameters": + if err := s.Parameters.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: field parameters: %w", err) + } + case "currency": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: field currency: %w", err) + } + s.Currency = value + case "amount": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: field amount: %w", err) + } + s.Amount = value + case "winner_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: field winner_count: %w", err) + } + s.WinnerCount = value + case "star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: field star_count: %w", err) + } + s.StarCount = value + default: + return b.Skip() + } + return nil + }) +} + +// GetParameters returns value of Parameters field. +func (s *StorePaymentPurposeStarGiveaway) GetParameters() (value GiveawayParameters) { + if s == nil { + return + } + return s.Parameters +} + +// GetCurrency returns value of Currency field. +func (s *StorePaymentPurposeStarGiveaway) GetCurrency() (value string) { + if s == nil { + return + } + return s.Currency +} + +// GetAmount returns value of Amount field. +func (s *StorePaymentPurposeStarGiveaway) GetAmount() (value int64) { + if s == nil { + return + } + return s.Amount +} + +// GetWinnerCount returns value of WinnerCount field. +func (s *StorePaymentPurposeStarGiveaway) GetWinnerCount() (value int32) { + if s == nil { + return + } + return s.WinnerCount +} + +// GetStarCount returns value of StarCount field. +func (s *StorePaymentPurposeStarGiveaway) GetStarCount() (value int64) { + if s == nil { + return + } + return s.StarCount +} + // StorePaymentPurposeStars represents TL type `storePaymentPurposeStars#9480cf14`. type StorePaymentPurposeStars struct { // ISO 4217 currency code of the payment currency @@ -1511,7 +1813,8 @@ const StorePaymentPurposeClassName = "StorePaymentPurpose" // case *tdapi.StorePaymentPurposePremiumSubscription: // storePaymentPurposePremiumSubscription#4b558114 // case *tdapi.StorePaymentPurposeGiftedPremium: // storePaymentPurposeGiftedPremium#7240c0d1 // case *tdapi.StorePaymentPurposePremiumGiftCodes: // storePaymentPurposePremiumGiftCodes#9e11cf42 -// case *tdapi.StorePaymentPurposePremiumGiveaway: // storePaymentPurposePremiumGiveaway#504790d9 +// case *tdapi.StorePaymentPurposePremiumGiveaway: // storePaymentPurposePremiumGiveaway#4da47aaa +// case *tdapi.StorePaymentPurposeStarGiveaway: // storePaymentPurposeStarGiveaway#c96d899 // case *tdapi.StorePaymentPurposeStars: // storePaymentPurposeStars#9480cf14 // case *tdapi.StorePaymentPurposeGiftedStars: // storePaymentPurposeGiftedStars#3544a624 // default: panic(v) @@ -1567,12 +1870,19 @@ func DecodeStorePaymentPurpose(buf *bin.Buffer) (StorePaymentPurposeClass, error } return &v, nil case StorePaymentPurposePremiumGiveawayTypeID: - // Decoding storePaymentPurposePremiumGiveaway#504790d9. + // Decoding storePaymentPurposePremiumGiveaway#4da47aaa. v := StorePaymentPurposePremiumGiveaway{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", err) } return &v, nil + case StorePaymentPurposeStarGiveawayTypeID: + // Decoding storePaymentPurposeStarGiveaway#c96d899. + v := StorePaymentPurposeStarGiveaway{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", err) + } + return &v, nil case StorePaymentPurposeStarsTypeID: // Decoding storePaymentPurposeStars#9480cf14. v := StorePaymentPurposeStars{} @@ -1621,12 +1931,19 @@ func DecodeTDLibJSONStorePaymentPurpose(buf tdjson.Decoder) (StorePaymentPurpose } return &v, nil case "storePaymentPurposePremiumGiveaway": - // Decoding storePaymentPurposePremiumGiveaway#504790d9. + // Decoding storePaymentPurposePremiumGiveaway#4da47aaa. v := StorePaymentPurposePremiumGiveaway{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", err) } return &v, nil + case "storePaymentPurposeStarGiveaway": + // Decoding storePaymentPurposeStarGiveaway#c96d899. + v := StorePaymentPurposeStarGiveaway{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", err) + } + return &v, nil case "storePaymentPurposeStars": // Decoding storePaymentPurposeStars#9480cf14. v := StorePaymentPurposeStars{} diff --git a/tdapi/tl_telegram_payment_purpose_gen.go b/tdapi/tl_telegram_payment_purpose_gen.go index 23c5dc9cd9..91bc9694b3 100644 --- a/tdapi/tl_telegram_payment_purpose_gen.go +++ b/tdapi/tl_telegram_payment_purpose_gen.go @@ -359,10 +359,10 @@ func (t *TelegramPaymentPurposePremiumGiftCodes) GetMonthCount() (value int32) { return t.MonthCount } -// TelegramPaymentPurposePremiumGiveaway represents TL type `telegramPaymentPurposePremiumGiveaway#bfd4a227`. +// TelegramPaymentPurposePremiumGiveaway represents TL type `telegramPaymentPurposePremiumGiveaway#d2a7c33f`. type TelegramPaymentPurposePremiumGiveaway struct { // Giveaway parameters - Parameters PremiumGiveawayParameters + Parameters GiveawayParameters // ISO 4217 currency code of the payment currency Currency string // Paid amount, in the smallest units of the currency @@ -374,7 +374,7 @@ type TelegramPaymentPurposePremiumGiveaway struct { } // TelegramPaymentPurposePremiumGiveawayTypeID is TL type id of TelegramPaymentPurposePremiumGiveaway. -const TelegramPaymentPurposePremiumGiveawayTypeID = 0xbfd4a227 +const TelegramPaymentPurposePremiumGiveawayTypeID = 0xd2a7c33f // construct implements constructor of TelegramPaymentPurposeClass. func (t TelegramPaymentPurposePremiumGiveaway) construct() TelegramPaymentPurposeClass { return &t } @@ -471,7 +471,7 @@ func (t *TelegramPaymentPurposePremiumGiveaway) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (t *TelegramPaymentPurposePremiumGiveaway) Encode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposePremiumGiveaway#bfd4a227 as nil") + return fmt.Errorf("can't encode telegramPaymentPurposePremiumGiveaway#d2a7c33f as nil") } b.PutID(TelegramPaymentPurposePremiumGiveawayTypeID) return t.EncodeBare(b) @@ -480,10 +480,10 @@ func (t *TelegramPaymentPurposePremiumGiveaway) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (t *TelegramPaymentPurposePremiumGiveaway) EncodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposePremiumGiveaway#bfd4a227 as nil") + return fmt.Errorf("can't encode telegramPaymentPurposePremiumGiveaway#d2a7c33f as nil") } if err := t.Parameters.Encode(b); err != nil { - return fmt.Errorf("unable to encode telegramPaymentPurposePremiumGiveaway#bfd4a227: field parameters: %w", err) + return fmt.Errorf("unable to encode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field parameters: %w", err) } b.PutString(t.Currency) b.PutInt53(t.Amount) @@ -495,10 +495,10 @@ func (t *TelegramPaymentPurposePremiumGiveaway) EncodeBare(b *bin.Buffer) error // Decode implements bin.Decoder. func (t *TelegramPaymentPurposePremiumGiveaway) Decode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposePremiumGiveaway#bfd4a227 to nil") + return fmt.Errorf("can't decode telegramPaymentPurposePremiumGiveaway#d2a7c33f to nil") } if err := b.ConsumeID(TelegramPaymentPurposePremiumGiveawayTypeID); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#bfd4a227: %w", err) + return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: %w", err) } return t.DecodeBare(b) } @@ -506,38 +506,38 @@ func (t *TelegramPaymentPurposePremiumGiveaway) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (t *TelegramPaymentPurposePremiumGiveaway) DecodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposePremiumGiveaway#bfd4a227 to nil") + return fmt.Errorf("can't decode telegramPaymentPurposePremiumGiveaway#d2a7c33f to nil") } { if err := t.Parameters.Decode(b); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#bfd4a227: field parameters: %w", err) + return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field parameters: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#bfd4a227: field currency: %w", err) + return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field currency: %w", err) } t.Currency = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#bfd4a227: field amount: %w", err) + return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field amount: %w", err) } t.Amount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#bfd4a227: field winner_count: %w", err) + return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field winner_count: %w", err) } t.WinnerCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#bfd4a227: field month_count: %w", err) + return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field month_count: %w", err) } t.MonthCount = value } @@ -547,14 +547,14 @@ func (t *TelegramPaymentPurposePremiumGiveaway) DecodeBare(b *bin.Buffer) error // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (t *TelegramPaymentPurposePremiumGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposePremiumGiveaway#bfd4a227 as nil") + return fmt.Errorf("can't encode telegramPaymentPurposePremiumGiveaway#d2a7c33f as nil") } b.ObjStart() b.PutID("telegramPaymentPurposePremiumGiveaway") b.Comma() b.FieldStart("parameters") if err := t.Parameters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode telegramPaymentPurposePremiumGiveaway#bfd4a227: field parameters: %w", err) + return fmt.Errorf("unable to encode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field parameters: %w", err) } b.Comma() b.FieldStart("currency") @@ -577,41 +577,41 @@ func (t *TelegramPaymentPurposePremiumGiveaway) EncodeTDLibJSON(b tdjson.Encoder // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (t *TelegramPaymentPurposePremiumGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposePremiumGiveaway#bfd4a227 to nil") + return fmt.Errorf("can't decode telegramPaymentPurposePremiumGiveaway#d2a7c33f to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("telegramPaymentPurposePremiumGiveaway"); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#bfd4a227: %w", err) + return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: %w", err) } case "parameters": if err := t.Parameters.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#bfd4a227: field parameters: %w", err) + return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field parameters: %w", err) } case "currency": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#bfd4a227: field currency: %w", err) + return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field currency: %w", err) } t.Currency = value case "amount": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#bfd4a227: field amount: %w", err) + return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field amount: %w", err) } t.Amount = value case "winner_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#bfd4a227: field winner_count: %w", err) + return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field winner_count: %w", err) } t.WinnerCount = value case "month_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#bfd4a227: field month_count: %w", err) + return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field month_count: %w", err) } t.MonthCount = value default: @@ -622,7 +622,7 @@ func (t *TelegramPaymentPurposePremiumGiveaway) DecodeTDLibJSON(b tdjson.Decoder } // GetParameters returns value of Parameters field. -func (t *TelegramPaymentPurposePremiumGiveaway) GetParameters() (value PremiumGiveawayParameters) { +func (t *TelegramPaymentPurposePremiumGiveaway) GetParameters() (value GiveawayParameters) { if t == nil { return } @@ -1163,6 +1163,308 @@ func (t *TelegramPaymentPurposeGiftedStars) GetStarCount() (value int64) { return t.StarCount } +// TelegramPaymentPurposeStarGiveaway represents TL type `telegramPaymentPurposeStarGiveaway#3c79a391`. +type TelegramPaymentPurposeStarGiveaway struct { + // Giveaway parameters + Parameters GiveawayParameters + // ISO 4217 currency code of the payment currency + Currency string + // Paid amount, in the smallest units of the currency + Amount int64 + // The number of users to receive Telegram Stars + WinnerCount int32 + // The number of Telegram Stars to be distributed through the giveaway + StarCount int64 +} + +// TelegramPaymentPurposeStarGiveawayTypeID is TL type id of TelegramPaymentPurposeStarGiveaway. +const TelegramPaymentPurposeStarGiveawayTypeID = 0x3c79a391 + +// construct implements constructor of TelegramPaymentPurposeClass. +func (t TelegramPaymentPurposeStarGiveaway) construct() TelegramPaymentPurposeClass { return &t } + +// Ensuring interfaces in compile-time for TelegramPaymentPurposeStarGiveaway. +var ( + _ bin.Encoder = &TelegramPaymentPurposeStarGiveaway{} + _ bin.Decoder = &TelegramPaymentPurposeStarGiveaway{} + _ bin.BareEncoder = &TelegramPaymentPurposeStarGiveaway{} + _ bin.BareDecoder = &TelegramPaymentPurposeStarGiveaway{} + + _ TelegramPaymentPurposeClass = &TelegramPaymentPurposeStarGiveaway{} +) + +func (t *TelegramPaymentPurposeStarGiveaway) Zero() bool { + if t == nil { + return true + } + if !(t.Parameters.Zero()) { + return false + } + if !(t.Currency == "") { + return false + } + if !(t.Amount == 0) { + return false + } + if !(t.WinnerCount == 0) { + return false + } + if !(t.StarCount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *TelegramPaymentPurposeStarGiveaway) String() string { + if t == nil { + return "TelegramPaymentPurposeStarGiveaway(nil)" + } + type Alias TelegramPaymentPurposeStarGiveaway + return fmt.Sprintf("TelegramPaymentPurposeStarGiveaway%+v", Alias(*t)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*TelegramPaymentPurposeStarGiveaway) TypeID() uint32 { + return TelegramPaymentPurposeStarGiveawayTypeID +} + +// TypeName returns name of type in TL schema. +func (*TelegramPaymentPurposeStarGiveaway) TypeName() string { + return "telegramPaymentPurposeStarGiveaway" +} + +// TypeInfo returns info about TL type. +func (t *TelegramPaymentPurposeStarGiveaway) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "telegramPaymentPurposeStarGiveaway", + ID: TelegramPaymentPurposeStarGiveawayTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Parameters", + SchemaName: "parameters", + }, + { + Name: "Currency", + SchemaName: "currency", + }, + { + Name: "Amount", + SchemaName: "amount", + }, + { + Name: "WinnerCount", + SchemaName: "winner_count", + }, + { + Name: "StarCount", + SchemaName: "star_count", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *TelegramPaymentPurposeStarGiveaway) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode telegramPaymentPurposeStarGiveaway#3c79a391 as nil") + } + b.PutID(TelegramPaymentPurposeStarGiveawayTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *TelegramPaymentPurposeStarGiveaway) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode telegramPaymentPurposeStarGiveaway#3c79a391 as nil") + } + if err := t.Parameters.Encode(b); err != nil { + return fmt.Errorf("unable to encode telegramPaymentPurposeStarGiveaway#3c79a391: field parameters: %w", err) + } + b.PutString(t.Currency) + b.PutInt53(t.Amount) + b.PutInt32(t.WinnerCount) + b.PutInt53(t.StarCount) + return nil +} + +// Decode implements bin.Decoder. +func (t *TelegramPaymentPurposeStarGiveaway) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode telegramPaymentPurposeStarGiveaway#3c79a391 to nil") + } + if err := b.ConsumeID(TelegramPaymentPurposeStarGiveawayTypeID); err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *TelegramPaymentPurposeStarGiveaway) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode telegramPaymentPurposeStarGiveaway#3c79a391 to nil") + } + { + if err := t.Parameters.Decode(b); err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: field parameters: %w", err) + } + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: field currency: %w", err) + } + t.Currency = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: field amount: %w", err) + } + t.Amount = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: field winner_count: %w", err) + } + t.WinnerCount = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: field star_count: %w", err) + } + t.StarCount = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (t *TelegramPaymentPurposeStarGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { + if t == nil { + return fmt.Errorf("can't encode telegramPaymentPurposeStarGiveaway#3c79a391 as nil") + } + b.ObjStart() + b.PutID("telegramPaymentPurposeStarGiveaway") + b.Comma() + b.FieldStart("parameters") + if err := t.Parameters.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode telegramPaymentPurposeStarGiveaway#3c79a391: field parameters: %w", err) + } + b.Comma() + b.FieldStart("currency") + b.PutString(t.Currency) + b.Comma() + b.FieldStart("amount") + b.PutInt53(t.Amount) + b.Comma() + b.FieldStart("winner_count") + b.PutInt32(t.WinnerCount) + b.Comma() + b.FieldStart("star_count") + b.PutInt53(t.StarCount) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (t *TelegramPaymentPurposeStarGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { + if t == nil { + return fmt.Errorf("can't decode telegramPaymentPurposeStarGiveaway#3c79a391 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("telegramPaymentPurposeStarGiveaway"); err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: %w", err) + } + case "parameters": + if err := t.Parameters.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: field parameters: %w", err) + } + case "currency": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: field currency: %w", err) + } + t.Currency = value + case "amount": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: field amount: %w", err) + } + t.Amount = value + case "winner_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: field winner_count: %w", err) + } + t.WinnerCount = value + case "star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: field star_count: %w", err) + } + t.StarCount = value + default: + return b.Skip() + } + return nil + }) +} + +// GetParameters returns value of Parameters field. +func (t *TelegramPaymentPurposeStarGiveaway) GetParameters() (value GiveawayParameters) { + if t == nil { + return + } + return t.Parameters +} + +// GetCurrency returns value of Currency field. +func (t *TelegramPaymentPurposeStarGiveaway) GetCurrency() (value string) { + if t == nil { + return + } + return t.Currency +} + +// GetAmount returns value of Amount field. +func (t *TelegramPaymentPurposeStarGiveaway) GetAmount() (value int64) { + if t == nil { + return + } + return t.Amount +} + +// GetWinnerCount returns value of WinnerCount field. +func (t *TelegramPaymentPurposeStarGiveaway) GetWinnerCount() (value int32) { + if t == nil { + return + } + return t.WinnerCount +} + +// GetStarCount returns value of StarCount field. +func (t *TelegramPaymentPurposeStarGiveaway) GetStarCount() (value int64) { + if t == nil { + return + } + return t.StarCount +} + // TelegramPaymentPurposeJoinChat represents TL type `telegramPaymentPurposeJoinChat#8ddd6788`. type TelegramPaymentPurposeJoinChat struct { // Invite link to use @@ -1342,9 +1644,10 @@ const TelegramPaymentPurposeClassName = "TelegramPaymentPurpose" // } // switch v := g.(type) { // case *tdapi.TelegramPaymentPurposePremiumGiftCodes: // telegramPaymentPurposePremiumGiftCodes#91009cc -// case *tdapi.TelegramPaymentPurposePremiumGiveaway: // telegramPaymentPurposePremiumGiveaway#bfd4a227 +// case *tdapi.TelegramPaymentPurposePremiumGiveaway: // telegramPaymentPurposePremiumGiveaway#d2a7c33f // case *tdapi.TelegramPaymentPurposeStars: // telegramPaymentPurposeStars#e273ee52 // case *tdapi.TelegramPaymentPurposeGiftedStars: // telegramPaymentPurposeGiftedStars#91b68a36 +// case *tdapi.TelegramPaymentPurposeStarGiveaway: // telegramPaymentPurposeStarGiveaway#3c79a391 // case *tdapi.TelegramPaymentPurposeJoinChat: // telegramPaymentPurposeJoinChat#8ddd6788 // default: panic(v) // } @@ -1385,7 +1688,7 @@ func DecodeTelegramPaymentPurpose(buf *bin.Buffer) (TelegramPaymentPurposeClass, } return &v, nil case TelegramPaymentPurposePremiumGiveawayTypeID: - // Decoding telegramPaymentPurposePremiumGiveaway#bfd4a227. + // Decoding telegramPaymentPurposePremiumGiveaway#d2a7c33f. v := TelegramPaymentPurposePremiumGiveaway{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) @@ -1405,6 +1708,13 @@ func DecodeTelegramPaymentPurpose(buf *bin.Buffer) (TelegramPaymentPurposeClass, return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) } return &v, nil + case TelegramPaymentPurposeStarGiveawayTypeID: + // Decoding telegramPaymentPurposeStarGiveaway#3c79a391. + v := TelegramPaymentPurposeStarGiveaway{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) + } + return &v, nil case TelegramPaymentPurposeJoinChatTypeID: // Decoding telegramPaymentPurposeJoinChat#8ddd6788. v := TelegramPaymentPurposeJoinChat{} @@ -1432,7 +1742,7 @@ func DecodeTDLibJSONTelegramPaymentPurpose(buf tdjson.Decoder) (TelegramPaymentP } return &v, nil case "telegramPaymentPurposePremiumGiveaway": - // Decoding telegramPaymentPurposePremiumGiveaway#bfd4a227. + // Decoding telegramPaymentPurposePremiumGiveaway#d2a7c33f. v := TelegramPaymentPurposePremiumGiveaway{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) @@ -1452,6 +1762,13 @@ func DecodeTDLibJSONTelegramPaymentPurpose(buf tdjson.Decoder) (TelegramPaymentP return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) } return &v, nil + case "telegramPaymentPurposeStarGiveaway": + // Decoding telegramPaymentPurposeStarGiveaway#3c79a391. + v := TelegramPaymentPurposeStarGiveaway{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) + } + return &v, nil case "telegramPaymentPurposeJoinChat": // Decoding telegramPaymentPurposeJoinChat#8ddd6788. v := TelegramPaymentPurposeJoinChat{} diff --git a/tdapi/tl_theme_parameters_gen.go b/tdapi/tl_theme_parameters_gen.go index aea4b64865..7b84459b75 100644 --- a/tdapi/tl_theme_parameters_gen.go +++ b/tdapi/tl_theme_parameters_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// ThemeParameters represents TL type `themeParameters#b47510c1`. +// ThemeParameters represents TL type `themeParameters#ef8395af`. type ThemeParameters struct { // A color of the background in the RGB24 format BackgroundColor int32 @@ -39,6 +39,8 @@ type ThemeParameters struct { SecondaryBackgroundColor int32 // A color of the header background in the RGB24 format HeaderBackgroundColor int32 + // A color of the bottom bar background in the RGB24 format + BottomBarBackgroundColor int32 // A color of the section background in the RGB24 format SectionBackgroundColor int32 // A color of the section separator in the RGB24 format @@ -64,7 +66,7 @@ type ThemeParameters struct { } // ThemeParametersTypeID is TL type id of ThemeParameters. -const ThemeParametersTypeID = 0xb47510c1 +const ThemeParametersTypeID = 0xef8395af // Ensuring interfaces in compile-time for ThemeParameters. var ( @@ -87,6 +89,9 @@ func (t *ThemeParameters) Zero() bool { if !(t.HeaderBackgroundColor == 0) { return false } + if !(t.BottomBarBackgroundColor == 0) { + return false + } if !(t.SectionBackgroundColor == 0) { return false } @@ -168,6 +173,10 @@ func (t *ThemeParameters) TypeInfo() tdp.Type { Name: "HeaderBackgroundColor", SchemaName: "header_background_color", }, + { + Name: "BottomBarBackgroundColor", + SchemaName: "bottom_bar_background_color", + }, { Name: "SectionBackgroundColor", SchemaName: "section_background_color", @@ -219,7 +228,7 @@ func (t *ThemeParameters) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (t *ThemeParameters) Encode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode themeParameters#b47510c1 as nil") + return fmt.Errorf("can't encode themeParameters#ef8395af as nil") } b.PutID(ThemeParametersTypeID) return t.EncodeBare(b) @@ -228,11 +237,12 @@ func (t *ThemeParameters) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (t *ThemeParameters) EncodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode themeParameters#b47510c1 as nil") + return fmt.Errorf("can't encode themeParameters#ef8395af as nil") } b.PutInt32(t.BackgroundColor) b.PutInt32(t.SecondaryBackgroundColor) b.PutInt32(t.HeaderBackgroundColor) + b.PutInt32(t.BottomBarBackgroundColor) b.PutInt32(t.SectionBackgroundColor) b.PutInt32(t.SectionSeparatorColor) b.PutInt32(t.TextColor) @@ -250,10 +260,10 @@ func (t *ThemeParameters) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (t *ThemeParameters) Decode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode themeParameters#b47510c1 to nil") + return fmt.Errorf("can't decode themeParameters#ef8395af to nil") } if err := b.ConsumeID(ThemeParametersTypeID); err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: %w", err) } return t.DecodeBare(b) } @@ -261,103 +271,110 @@ func (t *ThemeParameters) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (t *ThemeParameters) DecodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode themeParameters#b47510c1 to nil") + return fmt.Errorf("can't decode themeParameters#ef8395af to nil") } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field background_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field background_color: %w", err) } t.BackgroundColor = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field secondary_background_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field secondary_background_color: %w", err) } t.SecondaryBackgroundColor = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field header_background_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field header_background_color: %w", err) } t.HeaderBackgroundColor = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field section_background_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field bottom_bar_background_color: %w", err) + } + t.BottomBarBackgroundColor = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode themeParameters#ef8395af: field section_background_color: %w", err) } t.SectionBackgroundColor = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field section_separator_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field section_separator_color: %w", err) } t.SectionSeparatorColor = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field text_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field text_color: %w", err) } t.TextColor = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field accent_text_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field accent_text_color: %w", err) } t.AccentTextColor = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field section_header_text_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field section_header_text_color: %w", err) } t.SectionHeaderTextColor = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field subtitle_text_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field subtitle_text_color: %w", err) } t.SubtitleTextColor = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field destructive_text_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field destructive_text_color: %w", err) } t.DestructiveTextColor = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field hint_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field hint_color: %w", err) } t.HintColor = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field link_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field link_color: %w", err) } t.LinkColor = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field button_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field button_color: %w", err) } t.ButtonColor = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field button_text_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field button_text_color: %w", err) } t.ButtonTextColor = value } @@ -367,7 +384,7 @@ func (t *ThemeParameters) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (t *ThemeParameters) EncodeTDLibJSON(b tdjson.Encoder) error { if t == nil { - return fmt.Errorf("can't encode themeParameters#b47510c1 as nil") + return fmt.Errorf("can't encode themeParameters#ef8395af as nil") } b.ObjStart() b.PutID("themeParameters") @@ -381,6 +398,9 @@ func (t *ThemeParameters) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("header_background_color") b.PutInt32(t.HeaderBackgroundColor) b.Comma() + b.FieldStart("bottom_bar_background_color") + b.PutInt32(t.BottomBarBackgroundColor) + b.Comma() b.FieldStart("section_background_color") b.PutInt32(t.SectionBackgroundColor) b.Comma() @@ -422,97 +442,103 @@ func (t *ThemeParameters) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (t *ThemeParameters) DecodeTDLibJSON(b tdjson.Decoder) error { if t == nil { - return fmt.Errorf("can't decode themeParameters#b47510c1 to nil") + return fmt.Errorf("can't decode themeParameters#ef8395af to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("themeParameters"); err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: %w", err) } case "background_color": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field background_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field background_color: %w", err) } t.BackgroundColor = value case "secondary_background_color": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field secondary_background_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field secondary_background_color: %w", err) } t.SecondaryBackgroundColor = value case "header_background_color": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field header_background_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field header_background_color: %w", err) } t.HeaderBackgroundColor = value + case "bottom_bar_background_color": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode themeParameters#ef8395af: field bottom_bar_background_color: %w", err) + } + t.BottomBarBackgroundColor = value case "section_background_color": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field section_background_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field section_background_color: %w", err) } t.SectionBackgroundColor = value case "section_separator_color": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field section_separator_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field section_separator_color: %w", err) } t.SectionSeparatorColor = value case "text_color": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field text_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field text_color: %w", err) } t.TextColor = value case "accent_text_color": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field accent_text_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field accent_text_color: %w", err) } t.AccentTextColor = value case "section_header_text_color": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field section_header_text_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field section_header_text_color: %w", err) } t.SectionHeaderTextColor = value case "subtitle_text_color": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field subtitle_text_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field subtitle_text_color: %w", err) } t.SubtitleTextColor = value case "destructive_text_color": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field destructive_text_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field destructive_text_color: %w", err) } t.DestructiveTextColor = value case "hint_color": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field hint_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field hint_color: %w", err) } t.HintColor = value case "link_color": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field link_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field link_color: %w", err) } t.LinkColor = value case "button_color": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field button_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field button_color: %w", err) } t.ButtonColor = value case "button_text_color": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode themeParameters#b47510c1: field button_text_color: %w", err) + return fmt.Errorf("unable to decode themeParameters#ef8395af: field button_text_color: %w", err) } t.ButtonTextColor = value default: @@ -546,6 +572,14 @@ func (t *ThemeParameters) GetHeaderBackgroundColor() (value int32) { return t.HeaderBackgroundColor } +// GetBottomBarBackgroundColor returns value of BottomBarBackgroundColor field. +func (t *ThemeParameters) GetBottomBarBackgroundColor() (value int32) { + if t == nil { + return + } + return t.BottomBarBackgroundColor +} + // GetSectionBackgroundColor returns value of SectionBackgroundColor field. func (t *ThemeParameters) GetSectionBackgroundColor() (value int32) { if t == nil { diff --git a/tdapi/tl_update_gen.go b/tdapi/tl_update_gen.go index 097588078c..62e2a24537 100644 --- a/tdapi/tl_update_gen.go +++ b/tdapi/tl_update_gen.go @@ -32909,6 +32909,206 @@ func (u *UpdateMessageReactions) GetReactions() (value []MessageReaction) { return u.Reactions } +// UpdatePaidMediaPurchased represents TL type `updatePaidMediaPurchased#a410e65b`. +type UpdatePaidMediaPurchased struct { + // User identifier + UserID int64 + // Bot-specified payload for the paid media + Payload string +} + +// UpdatePaidMediaPurchasedTypeID is TL type id of UpdatePaidMediaPurchased. +const UpdatePaidMediaPurchasedTypeID = 0xa410e65b + +// construct implements constructor of UpdateClass. +func (u UpdatePaidMediaPurchased) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdatePaidMediaPurchased. +var ( + _ bin.Encoder = &UpdatePaidMediaPurchased{} + _ bin.Decoder = &UpdatePaidMediaPurchased{} + _ bin.BareEncoder = &UpdatePaidMediaPurchased{} + _ bin.BareDecoder = &UpdatePaidMediaPurchased{} + + _ UpdateClass = &UpdatePaidMediaPurchased{} +) + +func (u *UpdatePaidMediaPurchased) Zero() bool { + if u == nil { + return true + } + if !(u.UserID == 0) { + return false + } + if !(u.Payload == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdatePaidMediaPurchased) String() string { + if u == nil { + return "UpdatePaidMediaPurchased(nil)" + } + type Alias UpdatePaidMediaPurchased + return fmt.Sprintf("UpdatePaidMediaPurchased%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdatePaidMediaPurchased) TypeID() uint32 { + return UpdatePaidMediaPurchasedTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdatePaidMediaPurchased) TypeName() string { + return "updatePaidMediaPurchased" +} + +// TypeInfo returns info about TL type. +func (u *UpdatePaidMediaPurchased) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updatePaidMediaPurchased", + ID: UpdatePaidMediaPurchasedTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "UserID", + SchemaName: "user_id", + }, + { + Name: "Payload", + SchemaName: "payload", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdatePaidMediaPurchased) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updatePaidMediaPurchased#a410e65b as nil") + } + b.PutID(UpdatePaidMediaPurchasedTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdatePaidMediaPurchased) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updatePaidMediaPurchased#a410e65b as nil") + } + b.PutInt53(u.UserID) + b.PutString(u.Payload) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdatePaidMediaPurchased) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updatePaidMediaPurchased#a410e65b to nil") + } + if err := b.ConsumeID(UpdatePaidMediaPurchasedTypeID); err != nil { + return fmt.Errorf("unable to decode updatePaidMediaPurchased#a410e65b: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdatePaidMediaPurchased) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updatePaidMediaPurchased#a410e65b to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode updatePaidMediaPurchased#a410e65b: field user_id: %w", err) + } + u.UserID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode updatePaidMediaPurchased#a410e65b: field payload: %w", err) + } + u.Payload = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpdatePaidMediaPurchased) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode updatePaidMediaPurchased#a410e65b as nil") + } + b.ObjStart() + b.PutID("updatePaidMediaPurchased") + b.Comma() + b.FieldStart("user_id") + b.PutInt53(u.UserID) + b.Comma() + b.FieldStart("payload") + b.PutString(u.Payload) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpdatePaidMediaPurchased) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode updatePaidMediaPurchased#a410e65b to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("updatePaidMediaPurchased"); err != nil { + return fmt.Errorf("unable to decode updatePaidMediaPurchased#a410e65b: %w", err) + } + case "user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode updatePaidMediaPurchased#a410e65b: field user_id: %w", err) + } + u.UserID = value + case "payload": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode updatePaidMediaPurchased#a410e65b: field payload: %w", err) + } + u.Payload = value + default: + return b.Skip() + } + return nil + }) +} + +// GetUserID returns value of UserID field. +func (u *UpdatePaidMediaPurchased) GetUserID() (value int64) { + if u == nil { + return + } + return u.UserID +} + +// GetPayload returns value of Payload field. +func (u *UpdatePaidMediaPurchased) GetPayload() (value string) { + if u == nil { + return + } + return u.Payload +} + // UpdateClassName is schema name of UpdateClass. const UpdateClassName = "Update" @@ -33071,6 +33271,7 @@ const UpdateClassName = "Update" // case *tdapi.UpdateChatBoost: // updateChatBoost#50727e24 // case *tdapi.UpdateMessageReaction: // updateMessageReaction#f46c854a // case *tdapi.UpdateMessageReactions: // updateMessageReactions#bd5618e9 +// case *tdapi.UpdatePaidMediaPurchased: // updatePaidMediaPurchased#a410e65b // default: panic(v) // } type UpdateClass interface { @@ -34152,6 +34353,13 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case UpdatePaidMediaPurchasedTypeID: + // Decoding updatePaidMediaPurchased#a410e65b. + v := UpdatePaidMediaPurchased{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode UpdateClass: %w", bin.NewUnexpectedID(id)) } @@ -35214,6 +35422,13 @@ func DecodeTDLibJSONUpdate(buf tdjson.Decoder) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case "updatePaidMediaPurchased": + // Decoding updatePaidMediaPurchased#a410e65b. + v := UpdatePaidMediaPurchased{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode UpdateClass: %w", tdjson.NewUnexpectedID(id)) }