From 58adcc480457a7667690521f0768cc50a3bab8e9 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sun, 15 Dec 2024 02:12:12 +0800 Subject: [PATCH] Update to TDLib 1.8.41 --- client/function.go | 251 ++++++- client/type.go | 1638 +++++++++++++++++++++++++++-------------- client/unmarshaler.go | 664 +++++++++++------ data/td_api.tl | 353 ++++++--- 4 files changed, 2033 insertions(+), 873 deletions(-) diff --git a/client/function.go b/client/function.go index 5159be1..5b97dd5 100755 --- a/client/function.go +++ b/client/function.go @@ -7084,7 +7084,7 @@ type GetPreparedInlineMessageRequest struct { PreparedMessageId string `json:"prepared_message_id"` } -// Saves an inline message to be sent by the given user; for bots only +// Saves an inline message to be sent by the given user func (client *Client) GetPreparedInlineMessage(req *GetPreparedInlineMessageRequest) (*PreparedInlineMessage, error) { result, err := client.Send(Request{ meta: meta{ @@ -8021,6 +8021,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(result.Data) + case TypeInternalLinkTypeChatAffiliateProgram: + return UnmarshalInternalLinkTypeChatAffiliateProgram(result.Data) + case TypeInternalLinkTypeChatBoost: return UnmarshalInternalLinkTypeChatBoost(result.Data) @@ -10897,7 +10900,7 @@ func (client *Client) EditStoryCover(req *EditStoryCoverRequest) (*Ok, error) { type SetStoryPrivacySettingsRequest struct { // Identifier of the story StoryId int32 `json:"story_id"` - // The new privacy settigs for the story + // The new privacy settings for the story PrivacySettings StoryPrivacySettings `json:"privacy_settings"` } @@ -13393,7 +13396,7 @@ type CreateVideoChatRequest struct { Title string `json:"title"` // Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future StartDate int32 `json:"start_date"` - // Pass true to create an RTMP stream instead of an ordinary video chat; requires owner privileges + // Pass true to create an RTMP stream instead of an ordinary video chat IsRtmpStream bool `json:"is_rtmp_stream"` } @@ -14861,8 +14864,14 @@ func (client *Client) GetAllStickerEmojis(req *GetAllStickerEmojisRequest) (*Emo type SearchStickersRequest struct { // Type of the stickers to return StickerType StickerType `json:"sticker_type"` - // Space-separated list of emojis to search for; must be non-empty + // Space-separated list of emojis to search for Emojis string `json:"emojis"` + // Query to search for; may be empty to search for emoji only + Query string `json:"query"` + // List of possible IETF language tags of the user's input language; may be empty if unknown + InputLanguageCodes []string `json:"input_language_codes"` + // The offset from which to return the stickers; must be non-negative + Offset int32 `json:"offset"` // The maximum number of stickers to be returned; 0-100 Limit int32 `json:"limit"` } @@ -14876,6 +14885,9 @@ func (client *Client) SearchStickers(req *SearchStickersRequest) (*Stickers, err Data: map[string]interface{}{ "sticker_type": req.StickerType, "emojis": req.Emojis, + "query": req.Query, + "input_language_codes": req.InputLanguageCodes, + "offset": req.Offset, "limit": req.Limit, }, }) @@ -15796,6 +15808,25 @@ func (client *Client) GetRecentInlineBots() (*Users, error) { return UnmarshalUsers(result.Data) } +// Returns the list of bots owned by the current user +func (client *Client) GetOwnedBots() (*Users, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getOwnedBots", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUsers(result.Data) +} + type SearchHashtagsRequest struct { // Hashtag prefix to search for Prefix string `json:"prefix"` @@ -22230,6 +22261,218 @@ func (client *Client) ReuseStarSubscription(req *ReuseStarSubscriptionRequest) ( return UnmarshalOk(result.Data) } +type SetChatAffiliateProgramRequest struct { + // Identifier of the chat with an owned bot for which affiliate program is changed + ChatId int64 `json:"chat_id"` + // Parameters of the affiliate program; pass null to close the currently active program. If there is an active program, then commission and program duration can only be increased. If the active program is scheduled to be closed, then it can't be changed anymore + Parameters *AffiliateProgramParameters `json:"parameters"` +} + +// Changes affiliate program for a bot +func (client *Client) SetChatAffiliateProgram(req *SetChatAffiliateProgramRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatAffiliateProgram", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "parameters": req.Parameters, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SearchChatAffiliateProgramRequest struct { + // Username of the chat + Username string `json:"username"` + // The referrer from an internalLinkTypeChatAffiliateProgram link + Referrer string `json:"referrer"` +} + +// Searches a chat with an affiliate program. Returns the chat if found and the program is active +func (client *Client) SearchChatAffiliateProgram(req *SearchChatAffiliateProgramRequest) (*Chat, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchChatAffiliateProgram", + }, + Data: map[string]interface{}{ + "username": req.Username, + "referrer": req.Referrer, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChat(result.Data) +} + +type SearchAffiliateProgramsRequest struct { + // Identifier of the chat for which affiliate programs are searched for. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right + ChatId int64 `json:"chat_id"` + // Sort order for the results + SortOrder AffiliateProgramSortOrder `json:"sort_order"` + // Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of affiliate programs to return + Limit int32 `json:"limit"` +} + +// Searches affiliate programs that can be applied to the given chat +func (client *Client) SearchAffiliatePrograms(req *SearchAffiliateProgramsRequest) (*FoundAffiliatePrograms, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchAffiliatePrograms", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "sort_order": req.SortOrder, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundAffiliatePrograms(result.Data) +} + +type ConnectChatAffiliateProgramRequest struct { + // Identifier of the chat to which the affiliate program will be connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right + ChatId int64 `json:"chat_id"` + // Identifier of the bot, which affiliate program is connected + BotUserId int64 `json:"bot_user_id"` +} + +// Connects an affiliate program to the given chat. Returns information about the connected affiliate program +func (client *Client) ConnectChatAffiliateProgram(req *ConnectChatAffiliateProgramRequest) (*ChatAffiliateProgram, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "connectChatAffiliateProgram", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatAffiliateProgram(result.Data) +} + +type DisconnectChatAffiliateProgramRequest struct { + // Identifier of the chat for which the affiliate program is connected + ChatId int64 `json:"chat_id"` + // The referral link of the affiliate program + Url string `json:"url"` +} + +// Disconnects an affiliate program from the given chat and immediately deactivates its referral link. Returns updated information about the disconnected affiliate program +func (client *Client) DisconnectChatAffiliateProgram(req *DisconnectChatAffiliateProgramRequest) (*ChatAffiliateProgram, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "disconnectChatAffiliateProgram", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "url": req.Url, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatAffiliateProgram(result.Data) +} + +type GetChatAffiliateProgramRequest struct { + // Identifier of the chat for which the affiliate program was connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right + ChatId int64 `json:"chat_id"` + // Identifier of the bot that created the program + BotUserId int64 `json:"bot_user_id"` +} + +// Returns an affiliate program that were connected to the given chat by identifier of the bot that created the program +func (client *Client) GetChatAffiliateProgram(req *GetChatAffiliateProgramRequest) (*ChatAffiliateProgram, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatAffiliateProgram", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatAffiliateProgram(result.Data) +} + +type GetChatAffiliateProgramsRequest struct { + // Identifier of the chat for which the affiliate programs were connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right + ChatId int64 `json:"chat_id"` + // Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of affiliate programs to return + Limit int32 `json:"limit"` +} + +// Returns affiliate programs that were connected to the given chat +func (client *Client) GetChatAffiliatePrograms(req *GetChatAffiliateProgramsRequest) (*ChatAffiliatePrograms, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatAffiliatePrograms", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatAffiliatePrograms(result.Data) +} + type GetBusinessFeaturesRequest struct { // Source of the request; pass null if the method is called from settings or some non-standard source Source BusinessFeature `json:"source"` diff --git a/client/type.go b/client/type.go index 7f43b1a..e2c1ee7 100755 --- a/client/type.go +++ b/client/type.go @@ -24,11 +24,9 @@ const ( ClassChatPhotoStickerType = "ChatPhotoStickerType" ClassInputChatPhoto = "InputChatPhoto" ClassStarSubscriptionType = "StarSubscriptionType" + ClassAffiliateProgramSortOrder = "AffiliateProgramSortOrder" ClassStarTransactionDirection = "StarTransactionDirection" - ClassBotTransactionPurpose = "BotTransactionPurpose" - ClassChatTransactionPurpose = "ChatTransactionPurpose" - ClassUserTransactionPurpose = "UserTransactionPurpose" - ClassStarTransactionPartner = "StarTransactionPartner" + ClassStarTransactionType = "StarTransactionType" ClassGiveawayParticipantStatus = "GiveawayParticipantStatus" ClassGiveawayInfo = "GiveawayInfo" ClassGiveawayPrize = "GiveawayPrize" @@ -237,9 +235,17 @@ const ( ClassChatPhotos = "ChatPhotos" ClassChatPermissions = "ChatPermissions" ClassChatAdministratorRights = "ChatAdministratorRights" + ClassStarAmount = "StarAmount" ClassStarSubscriptionPricing = "StarSubscriptionPricing" ClassStarSubscription = "StarSubscription" ClassStarSubscriptions = "StarSubscriptions" + ClassAffiliateProgramParameters = "AffiliateProgramParameters" + ClassAffiliateProgramInfo = "AffiliateProgramInfo" + ClassAffiliateInfo = "AffiliateInfo" + ClassFoundAffiliateProgram = "FoundAffiliateProgram" + ClassFoundAffiliatePrograms = "FoundAffiliatePrograms" + ClassChatAffiliateProgram = "ChatAffiliateProgram" + ClassChatAffiliatePrograms = "ChatAffiliatePrograms" ClassProductInfo = "ProductInfo" ClassPremiumPaymentOption = "PremiumPaymentOption" ClassPremiumStatePaymentOption = "PremiumStatePaymentOption" @@ -713,11 +719,22 @@ const ( TypeInputChatPhotoSticker = "inputChatPhotoSticker" TypeChatPermissions = "chatPermissions" TypeChatAdministratorRights = "chatAdministratorRights" + TypeStarAmount = "starAmount" TypeStarSubscriptionTypeChannel = "starSubscriptionTypeChannel" TypeStarSubscriptionTypeBot = "starSubscriptionTypeBot" TypeStarSubscriptionPricing = "starSubscriptionPricing" TypeStarSubscription = "starSubscription" TypeStarSubscriptions = "starSubscriptions" + TypeAffiliateProgramSortOrderProfitability = "affiliateProgramSortOrderProfitability" + TypeAffiliateProgramSortOrderCreationDate = "affiliateProgramSortOrderCreationDate" + TypeAffiliateProgramSortOrderRevenue = "affiliateProgramSortOrderRevenue" + TypeAffiliateProgramParameters = "affiliateProgramParameters" + TypeAffiliateProgramInfo = "affiliateProgramInfo" + TypeAffiliateInfo = "affiliateInfo" + TypeFoundAffiliateProgram = "foundAffiliateProgram" + TypeFoundAffiliatePrograms = "foundAffiliatePrograms" + TypeChatAffiliateProgram = "chatAffiliateProgram" + TypeChatAffiliatePrograms = "chatAffiliatePrograms" TypeProductInfo = "productInfo" TypePremiumPaymentOption = "premiumPaymentOption" TypePremiumStatePaymentOption = "premiumStatePaymentOption" @@ -735,27 +752,31 @@ const ( TypeUserGifts = "userGifts" TypeStarTransactionDirectionIncoming = "starTransactionDirectionIncoming" TypeStarTransactionDirectionOutgoing = "starTransactionDirectionOutgoing" - TypeBotTransactionPurposePaidMedia = "botTransactionPurposePaidMedia" - TypeBotTransactionPurposeInvoicePayment = "botTransactionPurposeInvoicePayment" - TypeBotTransactionPurposeSubscription = "botTransactionPurposeSubscription" - TypeChatTransactionPurposePaidMedia = "chatTransactionPurposePaidMedia" - TypeChatTransactionPurposeJoin = "chatTransactionPurposeJoin" - TypeChatTransactionPurposeReaction = "chatTransactionPurposeReaction" - TypeChatTransactionPurposeGiveaway = "chatTransactionPurposeGiveaway" - TypeUserTransactionPurposeGiftedStars = "userTransactionPurposeGiftedStars" - TypeUserTransactionPurposeGiftSell = "userTransactionPurposeGiftSell" - TypeUserTransactionPurposeGiftSend = "userTransactionPurposeGiftSend" - TypeStarTransactionPartnerTelegram = "starTransactionPartnerTelegram" - TypeStarTransactionPartnerAppStore = "starTransactionPartnerAppStore" - TypeStarTransactionPartnerGooglePlay = "starTransactionPartnerGooglePlay" - TypeStarTransactionPartnerFragment = "starTransactionPartnerFragment" - TypeStarTransactionPartnerTelegramAds = "starTransactionPartnerTelegramAds" - TypeStarTransactionPartnerTelegramApi = "starTransactionPartnerTelegramApi" - TypeStarTransactionPartnerBot = "starTransactionPartnerBot" - TypeStarTransactionPartnerBusiness = "starTransactionPartnerBusiness" - TypeStarTransactionPartnerChat = "starTransactionPartnerChat" - TypeStarTransactionPartnerUser = "starTransactionPartnerUser" - TypeStarTransactionPartnerUnsupported = "starTransactionPartnerUnsupported" + TypeStarTransactionTypePremiumBotDeposit = "starTransactionTypePremiumBotDeposit" + TypeStarTransactionTypeAppStoreDeposit = "starTransactionTypeAppStoreDeposit" + TypeStarTransactionTypeGooglePlayDeposit = "starTransactionTypeGooglePlayDeposit" + TypeStarTransactionTypeFragmentDeposit = "starTransactionTypeFragmentDeposit" + TypeStarTransactionTypeUserDeposit = "starTransactionTypeUserDeposit" + TypeStarTransactionTypeGiveawayDeposit = "starTransactionTypeGiveawayDeposit" + TypeStarTransactionTypeFragmentWithdrawal = "starTransactionTypeFragmentWithdrawal" + TypeStarTransactionTypeTelegramAdsWithdrawal = "starTransactionTypeTelegramAdsWithdrawal" + TypeStarTransactionTypeTelegramApiUsage = "starTransactionTypeTelegramApiUsage" + TypeStarTransactionTypeBotPaidMediaPurchase = "starTransactionTypeBotPaidMediaPurchase" + TypeStarTransactionTypeBotPaidMediaSale = "starTransactionTypeBotPaidMediaSale" + TypeStarTransactionTypeChannelPaidMediaPurchase = "starTransactionTypeChannelPaidMediaPurchase" + TypeStarTransactionTypeChannelPaidMediaSale = "starTransactionTypeChannelPaidMediaSale" + TypeStarTransactionTypeBotInvoicePurchase = "starTransactionTypeBotInvoicePurchase" + TypeStarTransactionTypeBotInvoiceSale = "starTransactionTypeBotInvoiceSale" + TypeStarTransactionTypeBotSubscriptionPurchase = "starTransactionTypeBotSubscriptionPurchase" + TypeStarTransactionTypeBotSubscriptionSale = "starTransactionTypeBotSubscriptionSale" + TypeStarTransactionTypeChannelSubscriptionPurchase = "starTransactionTypeChannelSubscriptionPurchase" + TypeStarTransactionTypeChannelSubscriptionSale = "starTransactionTypeChannelSubscriptionSale" + TypeStarTransactionTypeGiftPurchase = "starTransactionTypeGiftPurchase" + TypeStarTransactionTypeGiftSale = "starTransactionTypeGiftSale" + TypeStarTransactionTypeChannelPaidReactionSend = "starTransactionTypeChannelPaidReactionSend" + TypeStarTransactionTypeChannelPaidReactionReceive = "starTransactionTypeChannelPaidReactionReceive" + TypeStarTransactionTypeAffiliateProgramCommission = "starTransactionTypeAffiliateProgramCommission" + TypeStarTransactionTypeUnsupported = "starTransactionTypeUnsupported" TypeStarTransaction = "starTransaction" TypeStarTransactions = "starTransactions" TypeGiveawayParticipantStatusEligible = "giveawayParticipantStatusEligible" @@ -1888,6 +1909,7 @@ const ( TypeInternalLinkTypeBusinessChat = "internalLinkTypeBusinessChat" TypeInternalLinkTypeBuyStars = "internalLinkTypeBuyStars" TypeInternalLinkTypeChangePhoneNumber = "internalLinkTypeChangePhoneNumber" + TypeInternalLinkTypeChatAffiliateProgram = "internalLinkTypeChatAffiliateProgram" TypeInternalLinkTypeChatBoost = "internalLinkTypeChatBoost" TypeInternalLinkTypeChatFolderInvite = "internalLinkTypeChatFolderInvite" TypeInternalLinkTypeChatFolderSettings = "internalLinkTypeChatFolderSettings" @@ -1941,6 +1963,10 @@ const ( TypeFileTypeSecret = "fileTypeSecret" TypeFileTypeSecretThumbnail = "fileTypeSecretThumbnail" TypeFileTypeSecure = "fileTypeSecure" + TypeFileTypeSelfDestructingPhoto = "fileTypeSelfDestructingPhoto" + TypeFileTypeSelfDestructingVideo = "fileTypeSelfDestructingVideo" + TypeFileTypeSelfDestructingVideoNote = "fileTypeSelfDestructingVideoNote" + TypeFileTypeSelfDestructingVoiceNote = "fileTypeSelfDestructingVoiceNote" TypeFileTypeSticker = "fileTypeSticker" TypeFileTypeThumbnail = "fileTypeThumbnail" TypeFileTypeUnknown = "fileTypeUnknown" @@ -2310,29 +2336,19 @@ type StarSubscriptionType interface { StarSubscriptionTypeType() string } +// Describes the order of the found affiliate programs +type AffiliateProgramSortOrder interface { + AffiliateProgramSortOrderType() string +} + // Describes direction of a transaction with Telegram Stars type StarTransactionDirection interface { StarTransactionDirectionType() string } -// Describes purpose of a transaction with a bot -type BotTransactionPurpose interface { - BotTransactionPurposeType() string -} - -// Describes purpose of a transaction with a supergroup or a channel -type ChatTransactionPurpose interface { - ChatTransactionPurposeType() string -} - -// Describes purpose of a transaction with a user -type UserTransactionPurpose interface { - UserTransactionPurposeType() string -} - -// Describes source or recipient of a transaction with Telegram Stars -type StarTransactionPartner interface { - StarTransactionPartnerType() string +// Describes type of transaction with Telegram Stars +type StarTransactionType interface { + StarTransactionTypeType() string } // Contains information about status of a user in a giveaway @@ -7297,6 +7313,31 @@ func (*ChatAdministratorRights) GetType() string { return TypeChatAdministratorRights } +// Describes a possibly non-integer amount of Telegram Stars +type StarAmount struct { + meta + // The integer amount of Telegram Stars rounded to 0 + StarCount int64 `json:"star_count"` + // The number of 1/1000000000 shares of Telegram Stars; from -999999999 to 999999999 + NanostarCount int32 `json:"nanostar_count"` +} + +func (entity *StarAmount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarAmount + + return json.Marshal((*stub)(entity)) +} + +func (*StarAmount) GetClass() string { + return ClassStarAmount +} + +func (*StarAmount) GetType() string { + return TypeStarAmount +} + // Describes a subscription to a channel chat type StarSubscriptionTypeChannel struct { meta @@ -7452,7 +7493,7 @@ func (starSubscription *StarSubscription) UnmarshalJSON(data []byte) error { type StarSubscriptions struct { meta // The amount of owned Telegram Stars - StarCount int64 `json:"star_count"` + StarAmount *StarAmount `json:"star_amount"` // List of subscriptions for Telegram Stars Subscriptions []*StarSubscription `json:"subscriptions"` // The number of Telegram Stars required to buy to extend subscriptions expiring soon @@ -7477,6 +7518,274 @@ func (*StarSubscriptions) GetType() string { return TypeStarSubscriptions } +// The affiliate programs must be sorted by the profitability +type AffiliateProgramSortOrderProfitability struct{ + meta +} + +func (entity *AffiliateProgramSortOrderProfitability) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateProgramSortOrderProfitability + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateProgramSortOrderProfitability) GetClass() string { + return ClassAffiliateProgramSortOrder +} + +func (*AffiliateProgramSortOrderProfitability) GetType() string { + return TypeAffiliateProgramSortOrderProfitability +} + +func (*AffiliateProgramSortOrderProfitability) AffiliateProgramSortOrderType() string { + return TypeAffiliateProgramSortOrderProfitability +} + +// The affiliate programs must be sorted by creation date +type AffiliateProgramSortOrderCreationDate struct{ + meta +} + +func (entity *AffiliateProgramSortOrderCreationDate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateProgramSortOrderCreationDate + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateProgramSortOrderCreationDate) GetClass() string { + return ClassAffiliateProgramSortOrder +} + +func (*AffiliateProgramSortOrderCreationDate) GetType() string { + return TypeAffiliateProgramSortOrderCreationDate +} + +func (*AffiliateProgramSortOrderCreationDate) AffiliateProgramSortOrderType() string { + return TypeAffiliateProgramSortOrderCreationDate +} + +// The affiliate programs must be sorted by the expected revenue +type AffiliateProgramSortOrderRevenue struct{ + meta +} + +func (entity *AffiliateProgramSortOrderRevenue) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateProgramSortOrderRevenue + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateProgramSortOrderRevenue) GetClass() string { + return ClassAffiliateProgramSortOrder +} + +func (*AffiliateProgramSortOrderRevenue) GetType() string { + return TypeAffiliateProgramSortOrderRevenue +} + +func (*AffiliateProgramSortOrderRevenue) AffiliateProgramSortOrderType() string { + return TypeAffiliateProgramSortOrderRevenue +} + +// Describes parameters of an affiliate program +type AffiliateProgramParameters struct { + meta + // The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner; getOption("affiliate_program_commission_per_mille_min")-getOption("affiliate_program_commission_per_mille_max") + CommissionPerMille int32 `json:"commission_per_mille"` + // Number of months the program will be active; 0-36. If 0, then the program is eternal + MonthCount int32 `json:"month_count"` +} + +func (entity *AffiliateProgramParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateProgramParameters + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateProgramParameters) GetClass() string { + return ClassAffiliateProgramParameters +} + +func (*AffiliateProgramParameters) GetType() string { + return TypeAffiliateProgramParameters +} + +// Contains information about an active affiliate program +type AffiliateProgramInfo struct { + meta + // Parameters of the affiliate program + Parameters *AffiliateProgramParameters `json:"parameters"` + // Point in time (Unix timestamp) when the affiliate program will be closed; 0 if the affiliate program isn't scheduled to be closed. If positive, then the program can't be connected using connectChatAffiliateProgram, but active connections will work until the date + EndDate int32 `json:"end_date"` + // The amount of daily revenue per user in Telegram Stars of the bot that created the affiliate program + DailyRevenuePerUserAmount *StarAmount `json:"daily_revenue_per_user_amount"` +} + +func (entity *AffiliateProgramInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateProgramInfo + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateProgramInfo) GetClass() string { + return ClassAffiliateProgramInfo +} + +func (*AffiliateProgramInfo) GetType() string { + return TypeAffiliateProgramInfo +} + +// Contains information about an affiliate that received commission from a Telegram Star transaction +type AffiliateInfo struct { + meta + // The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner + CommissionPerMille int32 `json:"commission_per_mille"` + // Identifier of the chat which received the commission + AffiliateChatId int64 `json:"affiliate_chat_id"` + // The amount of Telegram Stars that were received by the affiliate; can be negative for refunds + StarAmount *StarAmount `json:"star_amount"` +} + +func (entity *AffiliateInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateInfo + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateInfo) GetClass() string { + return ClassAffiliateInfo +} + +func (*AffiliateInfo) GetType() string { + return TypeAffiliateInfo +} + +// Describes a found affiliate program +type FoundAffiliateProgram struct { + meta + // User identifier of the bot created the program + BotUserId int64 `json:"bot_user_id"` + // Information about the affiliate program + Parameters *AffiliateProgramInfo `json:"parameters"` +} + +func (entity *FoundAffiliateProgram) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundAffiliateProgram + + return json.Marshal((*stub)(entity)) +} + +func (*FoundAffiliateProgram) GetClass() string { + return ClassFoundAffiliateProgram +} + +func (*FoundAffiliateProgram) GetType() string { + return TypeFoundAffiliateProgram +} + +// Represents a list of found affiliate programs +type FoundAffiliatePrograms struct { + meta + // The total number of found affiliate programs + TotalCount int32 `json:"total_count"` + // The list of affiliate programs + Programs []*FoundAffiliateProgram `json:"programs"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *FoundAffiliatePrograms) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundAffiliatePrograms + + return json.Marshal((*stub)(entity)) +} + +func (*FoundAffiliatePrograms) GetClass() string { + return ClassFoundAffiliatePrograms +} + +func (*FoundAffiliatePrograms) GetType() string { + return TypeFoundAffiliatePrograms +} + +// Describes an affiliate program that was connected to a chat +type ChatAffiliateProgram struct { + meta + // The link that can be used to refer users if the program is still active + Url string `json:"url"` + // User identifier of the bot created the program + BotUserId int64 `json:"bot_user_id"` + // The parameters of the affiliate program + Parameters *AffiliateProgramParameters `json:"parameters"` + // Point in time (Unix timestamp) when the affiliate program was connected + ConnectionDate int32 `json:"connection_date"` + // True, if the program was canceled by the bot, or disconnected by the chat owner and isn't available anymore + IsDisconnected bool `json:"is_disconnected"` + // The number of users that used the affiliate program + UserCount JsonInt64 `json:"user_count"` + // The number of Telegram Stars that were earned by the affiliate program + RevenueStarCount JsonInt64 `json:"revenue_star_count"` +} + +func (entity *ChatAffiliateProgram) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatAffiliateProgram + + return json.Marshal((*stub)(entity)) +} + +func (*ChatAffiliateProgram) GetClass() string { + return ClassChatAffiliateProgram +} + +func (*ChatAffiliateProgram) GetType() string { + return TypeChatAffiliateProgram +} + +// Represents a list of affiliate programs that were connected to a chat +type ChatAffiliatePrograms struct { + meta + // The total number of affiliate programs that were connected to the chat + TotalCount int32 `json:"total_count"` + // The list of connected affiliate programs + Programs []*ChatAffiliateProgram `json:"programs"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *ChatAffiliatePrograms) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatAffiliatePrograms + + return json.Marshal((*stub)(entity)) +} + +func (*ChatAffiliatePrograms) GetClass() string { + return ClassChatAffiliatePrograms +} + +func (*ChatAffiliatePrograms) GetType() string { + return TypeChatAffiliatePrograms +} + // Contains information about a product that can be paid with invoice type ProductInfo struct { meta @@ -8034,427 +8343,192 @@ func (*StarTransactionDirectionOutgoing) StarTransactionDirectionType() string { return TypeStarTransactionDirectionOutgoing } -// Paid media were bought -type BotTransactionPurposePaidMedia struct { +// The transaction is a deposit of Telegram Stars from the Premium bot; for regular users only +type StarTransactionTypePremiumBotDeposit struct{ meta - // The bought media if the transaction wasn't refunded - Media []PaidMedia `json:"media"` - // Bot-provided payload; for bots only - Payload string `json:"payload"` } -func (entity *BotTransactionPurposePaidMedia) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypePremiumBotDeposit) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub BotTransactionPurposePaidMedia + type stub StarTransactionTypePremiumBotDeposit return json.Marshal((*stub)(entity)) } -func (*BotTransactionPurposePaidMedia) GetClass() string { - return ClassBotTransactionPurpose +func (*StarTransactionTypePremiumBotDeposit) GetClass() string { + return ClassStarTransactionType } -func (*BotTransactionPurposePaidMedia) GetType() string { - return TypeBotTransactionPurposePaidMedia +func (*StarTransactionTypePremiumBotDeposit) GetType() string { + return TypeStarTransactionTypePremiumBotDeposit } -func (*BotTransactionPurposePaidMedia) BotTransactionPurposeType() string { - return TypeBotTransactionPurposePaidMedia +func (*StarTransactionTypePremiumBotDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypePremiumBotDeposit } -func (botTransactionPurposePaidMedia *BotTransactionPurposePaidMedia) UnmarshalJSON(data []byte) error { - var tmp struct { - Media []json.RawMessage `json:"media"` - Payload string `json:"payload"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - botTransactionPurposePaidMedia.Payload = tmp.Payload - - fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) - botTransactionPurposePaidMedia.Media = fieldMedia - - return nil -} - -// User bought a product from the bot -type BotTransactionPurposeInvoicePayment struct { +// The transaction is a deposit of Telegram Stars from App Store; for regular users only +type StarTransactionTypeAppStoreDeposit struct{ meta - // Information about the bought product; may be null if not applicable - ProductInfo *ProductInfo `json:"product_info"` - // Invoice payload; for bots only - InvoicePayload []byte `json:"invoice_payload"` } -func (entity *BotTransactionPurposeInvoicePayment) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeAppStoreDeposit) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub BotTransactionPurposeInvoicePayment + type stub StarTransactionTypeAppStoreDeposit return json.Marshal((*stub)(entity)) } -func (*BotTransactionPurposeInvoicePayment) GetClass() string { - return ClassBotTransactionPurpose +func (*StarTransactionTypeAppStoreDeposit) GetClass() string { + return ClassStarTransactionType } -func (*BotTransactionPurposeInvoicePayment) GetType() string { - return TypeBotTransactionPurposeInvoicePayment +func (*StarTransactionTypeAppStoreDeposit) GetType() string { + return TypeStarTransactionTypeAppStoreDeposit } -func (*BotTransactionPurposeInvoicePayment) BotTransactionPurposeType() string { - return TypeBotTransactionPurposeInvoicePayment +func (*StarTransactionTypeAppStoreDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypeAppStoreDeposit } -// User bought a subscription in a bot or a business account -type BotTransactionPurposeSubscription struct { +// The transaction is a deposit of Telegram Stars from Google Play; for regular users only +type StarTransactionTypeGooglePlayDeposit struct{ meta - // The number of seconds between consecutive Telegram Star debiting - Period int32 `json:"period"` - // Information about the bought subscription; may be null if not applicable - ProductInfo *ProductInfo `json:"product_info"` - // Invoice payload; for bots only - InvoicePayload []byte `json:"invoice_payload"` } -func (entity *BotTransactionPurposeSubscription) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeGooglePlayDeposit) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub BotTransactionPurposeSubscription + type stub StarTransactionTypeGooglePlayDeposit return json.Marshal((*stub)(entity)) } -func (*BotTransactionPurposeSubscription) GetClass() string { - return ClassBotTransactionPurpose +func (*StarTransactionTypeGooglePlayDeposit) GetClass() string { + return ClassStarTransactionType } -func (*BotTransactionPurposeSubscription) GetType() string { - return TypeBotTransactionPurposeSubscription +func (*StarTransactionTypeGooglePlayDeposit) GetType() string { + return TypeStarTransactionTypeGooglePlayDeposit } -func (*BotTransactionPurposeSubscription) BotTransactionPurposeType() string { - return TypeBotTransactionPurposeSubscription +func (*StarTransactionTypeGooglePlayDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypeGooglePlayDeposit } -// Paid media were bought -type ChatTransactionPurposePaidMedia struct { +// The transaction is a deposit of Telegram Stars from Fragment; for regular users and bots only +type StarTransactionTypeFragmentDeposit struct{ meta - // Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message - MessageId int64 `json:"message_id"` - // The bought media if the transaction wasn't refunded - Media []PaidMedia `json:"media"` } -func (entity *ChatTransactionPurposePaidMedia) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeFragmentDeposit) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatTransactionPurposePaidMedia + type stub StarTransactionTypeFragmentDeposit return json.Marshal((*stub)(entity)) } -func (*ChatTransactionPurposePaidMedia) GetClass() string { - return ClassChatTransactionPurpose +func (*StarTransactionTypeFragmentDeposit) GetClass() string { + return ClassStarTransactionType } -func (*ChatTransactionPurposePaidMedia) GetType() string { - return TypeChatTransactionPurposePaidMedia +func (*StarTransactionTypeFragmentDeposit) GetType() string { + return TypeStarTransactionTypeFragmentDeposit } -func (*ChatTransactionPurposePaidMedia) ChatTransactionPurposeType() string { - return TypeChatTransactionPurposePaidMedia +func (*StarTransactionTypeFragmentDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypeFragmentDeposit } -func (chatTransactionPurposePaidMedia *ChatTransactionPurposePaidMedia) UnmarshalJSON(data []byte) error { - var tmp struct { - MessageId int64 `json:"message_id"` - Media []json.RawMessage `json:"media"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - chatTransactionPurposePaidMedia.MessageId = tmp.MessageId - - fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) - chatTransactionPurposePaidMedia.Media = fieldMedia - - return nil -} - -// User joined the channel and subscribed to regular payments in Telegram Stars -type ChatTransactionPurposeJoin struct { +// The transaction is a deposit of Telegram Stars by another user; for regular users only +type StarTransactionTypeUserDeposit struct { meta - // The number of seconds between consecutive Telegram Star debiting - Period int32 `json:"period"` -} - -func (entity *ChatTransactionPurposeJoin) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatTransactionPurposeJoin - - return json.Marshal((*stub)(entity)) -} - -func (*ChatTransactionPurposeJoin) GetClass() string { - return ClassChatTransactionPurpose -} - -func (*ChatTransactionPurposeJoin) GetType() string { - return TypeChatTransactionPurposeJoin -} - -func (*ChatTransactionPurposeJoin) ChatTransactionPurposeType() string { - return TypeChatTransactionPurposeJoin -} - -// User paid for a reaction -type ChatTransactionPurposeReaction struct { - meta - // Identifier of the reacted message; can be 0 or an identifier of a deleted message - MessageId int64 `json:"message_id"` -} - -func (entity *ChatTransactionPurposeReaction) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatTransactionPurposeReaction - - return json.Marshal((*stub)(entity)) -} - -func (*ChatTransactionPurposeReaction) GetClass() string { - return ClassChatTransactionPurpose -} - -func (*ChatTransactionPurposeReaction) GetType() string { - return TypeChatTransactionPurposeReaction -} - -func (*ChatTransactionPurposeReaction) ChatTransactionPurposeType() string { - return TypeChatTransactionPurposeReaction -} - -// User received Telegram Stars from a giveaway -type ChatTransactionPurposeGiveaway struct { - meta - // Identifier of the message with giveaway; can be 0 or an identifier of a deleted message - GiveawayMessageId int64 `json:"giveaway_message_id"` -} - -func (entity *ChatTransactionPurposeGiveaway) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatTransactionPurposeGiveaway - - return json.Marshal((*stub)(entity)) -} - -func (*ChatTransactionPurposeGiveaway) GetClass() string { - return ClassChatTransactionPurpose -} - -func (*ChatTransactionPurposeGiveaway) GetType() string { - return TypeChatTransactionPurposeGiveaway -} - -func (*ChatTransactionPurposeGiveaway) ChatTransactionPurposeType() string { - return TypeChatTransactionPurposeGiveaway -} - -// A user gifted Telegram Stars -type UserTransactionPurposeGiftedStars struct { - meta - // A sticker to be shown in the transaction information; may be null if unknown + // Identifier of the user that gifted Telegram Stars; 0 if the user was anonymous + UserId int64 `json:"user_id"` + // The sticker to be shown in the transaction information; may be null if unknown Sticker *Sticker `json:"sticker"` } -func (entity *UserTransactionPurposeGiftedStars) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeUserDeposit) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UserTransactionPurposeGiftedStars + type stub StarTransactionTypeUserDeposit return json.Marshal((*stub)(entity)) } -func (*UserTransactionPurposeGiftedStars) GetClass() string { - return ClassUserTransactionPurpose +func (*StarTransactionTypeUserDeposit) GetClass() string { + return ClassStarTransactionType } -func (*UserTransactionPurposeGiftedStars) GetType() string { - return TypeUserTransactionPurposeGiftedStars +func (*StarTransactionTypeUserDeposit) GetType() string { + return TypeStarTransactionTypeUserDeposit } -func (*UserTransactionPurposeGiftedStars) UserTransactionPurposeType() string { - return TypeUserTransactionPurposeGiftedStars +func (*StarTransactionTypeUserDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypeUserDeposit } -// The user sold a gift received from another user or bot -type UserTransactionPurposeGiftSell struct { +// The transaction is a deposit of Telegram Stars from a giveaway; for regular users only +type StarTransactionTypeGiveawayDeposit struct { meta - // The gift - Gift *Gift `json:"gift"` + // Identifier of a supergroup or a channel chat that created the giveaway + ChatId int64 `json:"chat_id"` + // Identifier of the message with the giveaway; can be 0 or an identifier of a deleted message + GiveawayMessageId int64 `json:"giveaway_message_id"` } -func (entity *UserTransactionPurposeGiftSell) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeGiveawayDeposit) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UserTransactionPurposeGiftSell + type stub StarTransactionTypeGiveawayDeposit return json.Marshal((*stub)(entity)) } -func (*UserTransactionPurposeGiftSell) GetClass() string { - return ClassUserTransactionPurpose +func (*StarTransactionTypeGiveawayDeposit) GetClass() string { + return ClassStarTransactionType } -func (*UserTransactionPurposeGiftSell) GetType() string { - return TypeUserTransactionPurposeGiftSell +func (*StarTransactionTypeGiveawayDeposit) GetType() string { + return TypeStarTransactionTypeGiveawayDeposit } -func (*UserTransactionPurposeGiftSell) UserTransactionPurposeType() string { - return TypeUserTransactionPurposeGiftSell +func (*StarTransactionTypeGiveawayDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiveawayDeposit } -// The user or the bot sent a gift to a user -type UserTransactionPurposeGiftSend struct { +// The transaction is a withdrawal of earned Telegram Stars to Fragment; for bots and channel chats only +type StarTransactionTypeFragmentWithdrawal struct { meta - // The gift - Gift *Gift `json:"gift"` -} - -func (entity *UserTransactionPurposeGiftSend) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub UserTransactionPurposeGiftSend - - return json.Marshal((*stub)(entity)) -} - -func (*UserTransactionPurposeGiftSend) GetClass() string { - return ClassUserTransactionPurpose -} - -func (*UserTransactionPurposeGiftSend) GetType() string { - return TypeUserTransactionPurposeGiftSend -} - -func (*UserTransactionPurposeGiftSend) UserTransactionPurposeType() string { - return TypeUserTransactionPurposeGiftSend -} - -// The transaction is a transaction with Telegram through a bot -type StarTransactionPartnerTelegram struct{ - meta -} - -func (entity *StarTransactionPartnerTelegram) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StarTransactionPartnerTelegram - - return json.Marshal((*stub)(entity)) -} - -func (*StarTransactionPartnerTelegram) GetClass() string { - return ClassStarTransactionPartner -} - -func (*StarTransactionPartnerTelegram) GetType() string { - return TypeStarTransactionPartnerTelegram -} - -func (*StarTransactionPartnerTelegram) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerTelegram -} - -// The transaction is a transaction with App Store -type StarTransactionPartnerAppStore struct{ - meta -} - -func (entity *StarTransactionPartnerAppStore) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StarTransactionPartnerAppStore - - return json.Marshal((*stub)(entity)) -} - -func (*StarTransactionPartnerAppStore) GetClass() string { - return ClassStarTransactionPartner -} - -func (*StarTransactionPartnerAppStore) GetType() string { - return TypeStarTransactionPartnerAppStore -} - -func (*StarTransactionPartnerAppStore) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerAppStore -} - -// The transaction is a transaction with Google Play -type StarTransactionPartnerGooglePlay struct{ - meta -} - -func (entity *StarTransactionPartnerGooglePlay) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StarTransactionPartnerGooglePlay - - return json.Marshal((*stub)(entity)) -} - -func (*StarTransactionPartnerGooglePlay) GetClass() string { - return ClassStarTransactionPartner -} - -func (*StarTransactionPartnerGooglePlay) GetType() string { - return TypeStarTransactionPartnerGooglePlay -} - -func (*StarTransactionPartnerGooglePlay) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerGooglePlay -} - -// The transaction is a transaction with Fragment -type StarTransactionPartnerFragment struct { - meta - // State of the withdrawal; may be null for refunds from Fragment or for Telegram Stars bought on Fragment + // State of the withdrawal; may be null for refunds from Fragment WithdrawalState RevenueWithdrawalState `json:"withdrawal_state"` } -func (entity *StarTransactionPartnerFragment) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeFragmentWithdrawal) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionPartnerFragment + type stub StarTransactionTypeFragmentWithdrawal return json.Marshal((*stub)(entity)) } -func (*StarTransactionPartnerFragment) GetClass() string { - return ClassStarTransactionPartner +func (*StarTransactionTypeFragmentWithdrawal) GetClass() string { + return ClassStarTransactionType } -func (*StarTransactionPartnerFragment) GetType() string { - return TypeStarTransactionPartnerFragment +func (*StarTransactionTypeFragmentWithdrawal) GetType() string { + return TypeStarTransactionTypeFragmentWithdrawal } -func (*StarTransactionPartnerFragment) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerFragment +func (*StarTransactionTypeFragmentWithdrawal) StarTransactionTypeType() string { + return TypeStarTransactionTypeFragmentWithdrawal } -func (starTransactionPartnerFragment *StarTransactionPartnerFragment) UnmarshalJSON(data []byte) error { +func (starTransactionTypeFragmentWithdrawal *StarTransactionTypeFragmentWithdrawal) UnmarshalJSON(data []byte) error { var tmp struct { WithdrawalState json.RawMessage `json:"withdrawal_state"` } @@ -8465,141 +8539,93 @@ func (starTransactionPartnerFragment *StarTransactionPartnerFragment) UnmarshalJ } fieldWithdrawalState, _ := UnmarshalRevenueWithdrawalState(tmp.WithdrawalState) - starTransactionPartnerFragment.WithdrawalState = fieldWithdrawalState + starTransactionTypeFragmentWithdrawal.WithdrawalState = fieldWithdrawalState return nil } -// The transaction is a transaction with Telegram Ad platform -type StarTransactionPartnerTelegramAds struct{ +// The transaction is a withdrawal of earned Telegram Stars to Telegram Ad platform; for bots and channel chats only +type StarTransactionTypeTelegramAdsWithdrawal struct{ meta } -func (entity *StarTransactionPartnerTelegramAds) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeTelegramAdsWithdrawal) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionPartnerTelegramAds + type stub StarTransactionTypeTelegramAdsWithdrawal return json.Marshal((*stub)(entity)) } -func (*StarTransactionPartnerTelegramAds) GetClass() string { - return ClassStarTransactionPartner +func (*StarTransactionTypeTelegramAdsWithdrawal) GetClass() string { + return ClassStarTransactionType } -func (*StarTransactionPartnerTelegramAds) GetType() string { - return TypeStarTransactionPartnerTelegramAds +func (*StarTransactionTypeTelegramAdsWithdrawal) GetType() string { + return TypeStarTransactionTypeTelegramAdsWithdrawal } -func (*StarTransactionPartnerTelegramAds) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerTelegramAds +func (*StarTransactionTypeTelegramAdsWithdrawal) StarTransactionTypeType() string { + return TypeStarTransactionTypeTelegramAdsWithdrawal } -// The transaction is a transaction with Telegram for API usage -type StarTransactionPartnerTelegramApi struct { +// The transaction is a payment for Telegram API usage; for bots only +type StarTransactionTypeTelegramApiUsage struct { meta // The number of billed requests RequestCount int32 `json:"request_count"` } -func (entity *StarTransactionPartnerTelegramApi) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeTelegramApiUsage) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionPartnerTelegramApi + type stub StarTransactionTypeTelegramApiUsage return json.Marshal((*stub)(entity)) } -func (*StarTransactionPartnerTelegramApi) GetClass() string { - return ClassStarTransactionPartner +func (*StarTransactionTypeTelegramApiUsage) GetClass() string { + return ClassStarTransactionType } -func (*StarTransactionPartnerTelegramApi) GetType() string { - return TypeStarTransactionPartnerTelegramApi +func (*StarTransactionTypeTelegramApiUsage) GetType() string { + return TypeStarTransactionTypeTelegramApiUsage } -func (*StarTransactionPartnerTelegramApi) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerTelegramApi +func (*StarTransactionTypeTelegramApiUsage) StarTransactionTypeType() string { + return TypeStarTransactionTypeTelegramApiUsage } -// The transaction is a transaction with a bot -type StarTransactionPartnerBot struct { +// The transaction is a purchase of paid media from a bot or a business account by the current user; for regular users only +type StarTransactionTypeBotPaidMediaPurchase struct { meta - // Identifier of the bot - UserId int64 `json:"user_id"` - // Purpose of the transaction - Purpose BotTransactionPurpose `json:"purpose"` -} - -func (entity *StarTransactionPartnerBot) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StarTransactionPartnerBot - - return json.Marshal((*stub)(entity)) -} - -func (*StarTransactionPartnerBot) GetClass() string { - return ClassStarTransactionPartner -} - -func (*StarTransactionPartnerBot) GetType() string { - return TypeStarTransactionPartnerBot -} - -func (*StarTransactionPartnerBot) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerBot -} - -func (starTransactionPartnerBot *StarTransactionPartnerBot) UnmarshalJSON(data []byte) error { - var tmp struct { - UserId int64 `json:"user_id"` - Purpose json.RawMessage `json:"purpose"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - starTransactionPartnerBot.UserId = tmp.UserId - - fieldPurpose, _ := UnmarshalBotTransactionPurpose(tmp.Purpose) - starTransactionPartnerBot.Purpose = fieldPurpose - - return nil -} - -// The transaction is a transaction with a business account -type StarTransactionPartnerBusiness struct { - meta - // Identifier of the business account user + // Identifier of the bot or the business account user that sent the paid media UserId int64 `json:"user_id"` // The bought media if the transaction wasn't refunded Media []PaidMedia `json:"media"` } -func (entity *StarTransactionPartnerBusiness) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeBotPaidMediaPurchase) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionPartnerBusiness + type stub StarTransactionTypeBotPaidMediaPurchase return json.Marshal((*stub)(entity)) } -func (*StarTransactionPartnerBusiness) GetClass() string { - return ClassStarTransactionPartner +func (*StarTransactionTypeBotPaidMediaPurchase) GetClass() string { + return ClassStarTransactionType } -func (*StarTransactionPartnerBusiness) GetType() string { - return TypeStarTransactionPartnerBusiness +func (*StarTransactionTypeBotPaidMediaPurchase) GetType() string { + return TypeStarTransactionTypeBotPaidMediaPurchase } -func (*StarTransactionPartnerBusiness) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerBusiness +func (*StarTransactionTypeBotPaidMediaPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeBotPaidMediaPurchase } -func (starTransactionPartnerBusiness *StarTransactionPartnerBusiness) UnmarshalJSON(data []byte) error { +func (starTransactionTypeBotPaidMediaPurchase *StarTransactionTypeBotPaidMediaPurchase) UnmarshalJSON(data []byte) error { var tmp struct { UserId int64 `json:"user_id"` Media []json.RawMessage `json:"media"` @@ -8610,95 +8636,53 @@ func (starTransactionPartnerBusiness *StarTransactionPartnerBusiness) UnmarshalJ return err } - starTransactionPartnerBusiness.UserId = tmp.UserId + starTransactionTypeBotPaidMediaPurchase.UserId = tmp.UserId fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) - starTransactionPartnerBusiness.Media = fieldMedia + starTransactionTypeBotPaidMediaPurchase.Media = fieldMedia return nil } -// The transaction is a transaction with a supergroup or a channel chat -type StarTransactionPartnerChat struct { +// The transaction is a sale of paid media by the bot or a business account managed by the bot; for bots only +type StarTransactionTypeBotPaidMediaSale struct { meta - // Identifier of the chat - ChatId int64 `json:"chat_id"` - // Purpose of the transaction - Purpose ChatTransactionPurpose `json:"purpose"` -} - -func (entity *StarTransactionPartnerChat) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StarTransactionPartnerChat - - return json.Marshal((*stub)(entity)) -} - -func (*StarTransactionPartnerChat) GetClass() string { - return ClassStarTransactionPartner -} - -func (*StarTransactionPartnerChat) GetType() string { - return TypeStarTransactionPartnerChat -} - -func (*StarTransactionPartnerChat) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerChat -} - -func (starTransactionPartnerChat *StarTransactionPartnerChat) UnmarshalJSON(data []byte) error { - var tmp struct { - ChatId int64 `json:"chat_id"` - Purpose json.RawMessage `json:"purpose"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - starTransactionPartnerChat.ChatId = tmp.ChatId - - fieldPurpose, _ := UnmarshalChatTransactionPurpose(tmp.Purpose) - starTransactionPartnerChat.Purpose = fieldPurpose - - return nil -} - -// The transaction is a transaction with another user -type StarTransactionPartnerUser struct { - meta - // Identifier of the user; 0 if the user was anonymous + // Identifier of the user that bought the media UserId int64 `json:"user_id"` - // Purpose of the transaction - Purpose UserTransactionPurpose `json:"purpose"` + // The bought media + Media []PaidMedia `json:"media"` + // Bot-provided payload + Payload string `json:"payload"` + // Information about the affiliate which received commission from the transaction; may be null if none + Affiliate *AffiliateInfo `json:"affiliate"` } -func (entity *StarTransactionPartnerUser) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeBotPaidMediaSale) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionPartnerUser + type stub StarTransactionTypeBotPaidMediaSale return json.Marshal((*stub)(entity)) } -func (*StarTransactionPartnerUser) GetClass() string { - return ClassStarTransactionPartner +func (*StarTransactionTypeBotPaidMediaSale) GetClass() string { + return ClassStarTransactionType } -func (*StarTransactionPartnerUser) GetType() string { - return TypeStarTransactionPartnerUser +func (*StarTransactionTypeBotPaidMediaSale) GetType() string { + return TypeStarTransactionTypeBotPaidMediaSale } -func (*StarTransactionPartnerUser) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerUser +func (*StarTransactionTypeBotPaidMediaSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeBotPaidMediaSale } -func (starTransactionPartnerUser *StarTransactionPartnerUser) UnmarshalJSON(data []byte) error { +func (starTransactionTypeBotPaidMediaSale *StarTransactionTypeBotPaidMediaSale) UnmarshalJSON(data []byte) error { var tmp struct { UserId int64 `json:"user_id"` - Purpose json.RawMessage `json:"purpose"` + Media []json.RawMessage `json:"media"` + Payload string `json:"payload"` + Affiliate *AffiliateInfo `json:"affiliate"` } err := json.Unmarshal(data, &tmp) @@ -8706,37 +8690,474 @@ func (starTransactionPartnerUser *StarTransactionPartnerUser) UnmarshalJSON(data return err } - starTransactionPartnerUser.UserId = tmp.UserId + starTransactionTypeBotPaidMediaSale.UserId = tmp.UserId + starTransactionTypeBotPaidMediaSale.Payload = tmp.Payload + starTransactionTypeBotPaidMediaSale.Affiliate = tmp.Affiliate - fieldPurpose, _ := UnmarshalUserTransactionPurpose(tmp.Purpose) - starTransactionPartnerUser.Purpose = fieldPurpose + fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) + starTransactionTypeBotPaidMediaSale.Media = fieldMedia return nil } -// The transaction is a transaction with unknown partner -type StarTransactionPartnerUnsupported struct{ +// The transaction is a purchase of paid media from a channel by the current user; for regular users only +type StarTransactionTypeChannelPaidMediaPurchase struct { meta + // Identifier of the channel chat that sent the paid media + ChatId int64 `json:"chat_id"` + // Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message + MessageId int64 `json:"message_id"` + // The bought media if the transaction wasn't refunded + Media []PaidMedia `json:"media"` } -func (entity *StarTransactionPartnerUnsupported) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeChannelPaidMediaPurchase) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionPartnerUnsupported + type stub StarTransactionTypeChannelPaidMediaPurchase return json.Marshal((*stub)(entity)) } -func (*StarTransactionPartnerUnsupported) GetClass() string { - return ClassStarTransactionPartner +func (*StarTransactionTypeChannelPaidMediaPurchase) GetClass() string { + return ClassStarTransactionType } -func (*StarTransactionPartnerUnsupported) GetType() string { - return TypeStarTransactionPartnerUnsupported +func (*StarTransactionTypeChannelPaidMediaPurchase) GetType() string { + return TypeStarTransactionTypeChannelPaidMediaPurchase } -func (*StarTransactionPartnerUnsupported) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerUnsupported +func (*StarTransactionTypeChannelPaidMediaPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeChannelPaidMediaPurchase +} + +func (starTransactionTypeChannelPaidMediaPurchase *StarTransactionTypeChannelPaidMediaPurchase) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + MessageId int64 `json:"message_id"` + Media []json.RawMessage `json:"media"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypeChannelPaidMediaPurchase.ChatId = tmp.ChatId + starTransactionTypeChannelPaidMediaPurchase.MessageId = tmp.MessageId + + fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) + starTransactionTypeChannelPaidMediaPurchase.Media = fieldMedia + + return nil +} + +// The transaction is a sale of paid media by the channel chat; for channel chats only +type StarTransactionTypeChannelPaidMediaSale struct { + meta + // Identifier of the user that bought the media + UserId int64 `json:"user_id"` + // Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message + MessageId int64 `json:"message_id"` + // The bought media + Media []PaidMedia `json:"media"` +} + +func (entity *StarTransactionTypeChannelPaidMediaSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeChannelPaidMediaSale + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeChannelPaidMediaSale) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeChannelPaidMediaSale) GetType() string { + return TypeStarTransactionTypeChannelPaidMediaSale +} + +func (*StarTransactionTypeChannelPaidMediaSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeChannelPaidMediaSale +} + +func (starTransactionTypeChannelPaidMediaSale *StarTransactionTypeChannelPaidMediaSale) UnmarshalJSON(data []byte) error { + var tmp struct { + UserId int64 `json:"user_id"` + MessageId int64 `json:"message_id"` + Media []json.RawMessage `json:"media"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypeChannelPaidMediaSale.UserId = tmp.UserId + starTransactionTypeChannelPaidMediaSale.MessageId = tmp.MessageId + + fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) + starTransactionTypeChannelPaidMediaSale.Media = fieldMedia + + return nil +} + +// The transaction is a purchase of a product from a bot or a business account by the current user; for regular users only +type StarTransactionTypeBotInvoicePurchase struct { + meta + // Identifier of the bot or the business account user that created the invoice + UserId int64 `json:"user_id"` + // Information about the bought product + ProductInfo *ProductInfo `json:"product_info"` +} + +func (entity *StarTransactionTypeBotInvoicePurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeBotInvoicePurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeBotInvoicePurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeBotInvoicePurchase) GetType() string { + return TypeStarTransactionTypeBotInvoicePurchase +} + +func (*StarTransactionTypeBotInvoicePurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeBotInvoicePurchase +} + +// The transaction is a sale of a product by the bot; for bots only +type StarTransactionTypeBotInvoiceSale struct { + meta + // Identifier of the user that bought the product + UserId int64 `json:"user_id"` + // Information about the bought product + ProductInfo *ProductInfo `json:"product_info"` + // Invoice payload + InvoicePayload []byte `json:"invoice_payload"` + // Information about the affiliate which received commission from the transaction; may be null if none + Affiliate *AffiliateInfo `json:"affiliate"` +} + +func (entity *StarTransactionTypeBotInvoiceSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeBotInvoiceSale + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeBotInvoiceSale) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeBotInvoiceSale) GetType() string { + return TypeStarTransactionTypeBotInvoiceSale +} + +func (*StarTransactionTypeBotInvoiceSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeBotInvoiceSale +} + +// The transaction is a purchase of a subscription from a bot or a business account by the current user; for regular users only +type StarTransactionTypeBotSubscriptionPurchase struct { + meta + // Identifier of the bot or the business account user that created the subscription link + UserId int64 `json:"user_id"` + // The number of seconds between consecutive Telegram Star debitings + SubscriptionPeriod int32 `json:"subscription_period"` + // Information about the bought subscription + ProductInfo *ProductInfo `json:"product_info"` +} + +func (entity *StarTransactionTypeBotSubscriptionPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeBotSubscriptionPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeBotSubscriptionPurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeBotSubscriptionPurchase) GetType() string { + return TypeStarTransactionTypeBotSubscriptionPurchase +} + +func (*StarTransactionTypeBotSubscriptionPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeBotSubscriptionPurchase +} + +// The transaction is a sale of a subscription by the bot; for bots only +type StarTransactionTypeBotSubscriptionSale struct { + meta + // Identifier of the user that bought the subscription + UserId int64 `json:"user_id"` + // The number of seconds between consecutive Telegram Star debitings + SubscriptionPeriod int32 `json:"subscription_period"` + // Information about the bought subscription + ProductInfo *ProductInfo `json:"product_info"` + // Invoice payload + InvoicePayload []byte `json:"invoice_payload"` + // Information about the affiliate which received commission from the transaction; may be null if none + Affiliate *AffiliateInfo `json:"affiliate"` +} + +func (entity *StarTransactionTypeBotSubscriptionSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeBotSubscriptionSale + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeBotSubscriptionSale) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeBotSubscriptionSale) GetType() string { + return TypeStarTransactionTypeBotSubscriptionSale +} + +func (*StarTransactionTypeBotSubscriptionSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeBotSubscriptionSale +} + +// The transaction is a purchase of a subscription to a channel chat by the current user; for regular users only +type StarTransactionTypeChannelSubscriptionPurchase struct { + meta + // Identifier of the channel chat that created the subscription + ChatId int64 `json:"chat_id"` + // The number of seconds between consecutive Telegram Star debitings + SubscriptionPeriod int32 `json:"subscription_period"` +} + +func (entity *StarTransactionTypeChannelSubscriptionPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeChannelSubscriptionPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeChannelSubscriptionPurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeChannelSubscriptionPurchase) GetType() string { + return TypeStarTransactionTypeChannelSubscriptionPurchase +} + +func (*StarTransactionTypeChannelSubscriptionPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeChannelSubscriptionPurchase +} + +// The transaction is a sale of a subscription by the channel chat; for channel chats only +type StarTransactionTypeChannelSubscriptionSale struct { + meta + // Identifier of the user that bought the subscription + UserId int64 `json:"user_id"` + // The number of seconds between consecutive Telegram Star debitings + SubscriptionPeriod int32 `json:"subscription_period"` +} + +func (entity *StarTransactionTypeChannelSubscriptionSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeChannelSubscriptionSale + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeChannelSubscriptionSale) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeChannelSubscriptionSale) GetType() string { + return TypeStarTransactionTypeChannelSubscriptionSale +} + +func (*StarTransactionTypeChannelSubscriptionSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeChannelSubscriptionSale +} + +// The transaction is a purchase of a gift to another user; for regular users and bots only +type StarTransactionTypeGiftPurchase struct { + meta + // Identifier of the user that received the gift + UserId int64 `json:"user_id"` + // The gift + Gift *Gift `json:"gift"` +} + +func (entity *StarTransactionTypeGiftPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGiftPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGiftPurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGiftPurchase) GetType() string { + return TypeStarTransactionTypeGiftPurchase +} + +func (*StarTransactionTypeGiftPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiftPurchase +} + +// The transaction is a sale of a gift received from another user or bot; for regular users only +type StarTransactionTypeGiftSale struct { + meta + // Identifier of the user that sent the gift + UserId int64 `json:"user_id"` + // The gift + Gift *Gift `json:"gift"` +} + +func (entity *StarTransactionTypeGiftSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGiftSale + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGiftSale) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGiftSale) GetType() string { + return TypeStarTransactionTypeGiftSale +} + +func (*StarTransactionTypeGiftSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiftSale +} + +// The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only +type StarTransactionTypeChannelPaidReactionSend struct { + meta + // Identifier of the channel chat + ChatId int64 `json:"chat_id"` + // Identifier of the reacted message; can be 0 or an identifier of a deleted message + MessageId int64 `json:"message_id"` +} + +func (entity *StarTransactionTypeChannelPaidReactionSend) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeChannelPaidReactionSend + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeChannelPaidReactionSend) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeChannelPaidReactionSend) GetType() string { + return TypeStarTransactionTypeChannelPaidReactionSend +} + +func (*StarTransactionTypeChannelPaidReactionSend) StarTransactionTypeType() string { + return TypeStarTransactionTypeChannelPaidReactionSend +} + +// The transaction is a receiving of a paid reaction to a message by the channel chat; for channel chats only +type StarTransactionTypeChannelPaidReactionReceive struct { + meta + // Identifier of the user that added the paid reaction + UserId int64 `json:"user_id"` + // Identifier of the reacted message; can be 0 or an identifier of a deleted message + MessageId int64 `json:"message_id"` +} + +func (entity *StarTransactionTypeChannelPaidReactionReceive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeChannelPaidReactionReceive + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeChannelPaidReactionReceive) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeChannelPaidReactionReceive) GetType() string { + return TypeStarTransactionTypeChannelPaidReactionReceive +} + +func (*StarTransactionTypeChannelPaidReactionReceive) StarTransactionTypeType() string { + return TypeStarTransactionTypeChannelPaidReactionReceive +} + +// The transaction is a receiving of a commission from an affiliate program; for regular users, bots and channel chats only +type StarTransactionTypeAffiliateProgramCommission struct { + meta + // Identifier of the chat that created the affiliate program + ChatId int64 `json:"chat_id"` + // The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner + CommissionPerMille int32 `json:"commission_per_mille"` +} + +func (entity *StarTransactionTypeAffiliateProgramCommission) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeAffiliateProgramCommission + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeAffiliateProgramCommission) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeAffiliateProgramCommission) GetType() string { + return TypeStarTransactionTypeAffiliateProgramCommission +} + +func (*StarTransactionTypeAffiliateProgramCommission) StarTransactionTypeType() string { + return TypeStarTransactionTypeAffiliateProgramCommission +} + +// The transaction is a transaction of an unsupported type +type StarTransactionTypeUnsupported struct{ + meta +} + +func (entity *StarTransactionTypeUnsupported) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeUnsupported + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeUnsupported) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeUnsupported) GetType() string { + return TypeStarTransactionTypeUnsupported +} + +func (*StarTransactionTypeUnsupported) StarTransactionTypeType() string { + return TypeStarTransactionTypeUnsupported } // Represents a transaction changing the amount of owned Telegram Stars @@ -8745,13 +9166,13 @@ type StarTransaction struct { // Unique identifier of the transaction Id string `json:"id"` // The amount of added owned Telegram Stars; negative for outgoing transactions - StarCount int64 `json:"star_count"` + StarAmount *StarAmount `json:"star_amount"` // True, if the transaction is a refund of a previous transaction IsRefund bool `json:"is_refund"` // Point in time (Unix timestamp) when the transaction was completed Date int32 `json:"date"` - // Source of the incoming transaction, or its recipient for outgoing transactions - Partner StarTransactionPartner `json:"partner"` + // Type of the transaction + Type StarTransactionType `json:"type"` } func (entity *StarTransaction) MarshalJSON() ([]byte, error) { @@ -8773,10 +9194,10 @@ func (*StarTransaction) GetType() string { func (starTransaction *StarTransaction) UnmarshalJSON(data []byte) error { var tmp struct { Id string `json:"id"` - StarCount int64 `json:"star_count"` + StarAmount *StarAmount `json:"star_amount"` IsRefund bool `json:"is_refund"` Date int32 `json:"date"` - Partner json.RawMessage `json:"partner"` + Type json.RawMessage `json:"type"` } err := json.Unmarshal(data, &tmp) @@ -8785,12 +9206,12 @@ func (starTransaction *StarTransaction) UnmarshalJSON(data []byte) error { } starTransaction.Id = tmp.Id - starTransaction.StarCount = tmp.StarCount + starTransaction.StarAmount = tmp.StarAmount starTransaction.IsRefund = tmp.IsRefund starTransaction.Date = tmp.Date - fieldPartner, _ := UnmarshalStarTransactionPartner(tmp.Partner) - starTransaction.Partner = fieldPartner + fieldType, _ := UnmarshalStarTransactionType(tmp.Type) + starTransaction.Type = fieldType return nil } @@ -8799,7 +9220,7 @@ func (starTransaction *StarTransaction) UnmarshalJSON(data []byte) error { type StarTransactions struct { meta // The amount of owned Telegram Stars - StarCount int64 `json:"star_count"` + StarAmount *StarAmount `json:"star_amount"` // List of transactions with Telegram Stars Transactions []*StarTransaction `json:"transactions"` // The offset for the next request. If empty, then there are no more results @@ -9283,15 +9704,15 @@ type User struct { Status UserStatus `json:"status"` // Profile photo of the user; may be null ProfilePhoto *ProfilePhoto `json:"profile_photo"` - // Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview. For Telegram Premium users only + // Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview AccentColorId int32 `json:"accent_color_id"` - // Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none. For Telegram Premium users only + // Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` - // Identifier of the accent color for the user's profile; -1 if none. For Telegram Premium users only + // Identifier of the accent color for the user's profile; -1 if none ProfileAccentColorId int32 `json:"profile_accent_color_id"` - // Identifier of a custom emoji to be shown on the background of the user's profile; 0 if none. For Telegram Premium users only + // Identifier of a custom emoji to be shown on the background of the user's profile; 0 if none ProfileBackgroundCustomEmojiId JsonInt64 `json:"profile_background_custom_emoji_id"` - // Emoji status to be shown instead of the default Telegram Premium badge; may be null. For Telegram Premium users only + // Emoji status to be shown instead of the default Telegram Premium badge; may be null EmojiStatus *EmojiStatus `json:"emoji_status"` // The user is a contact of the current user IsContact bool `json:"is_contact"` @@ -9439,6 +9860,8 @@ type BotInfo struct { DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` // Default administrator rights for adding the bot to channels; may be null DefaultChannelAdministratorRights *ChatAdministratorRights `json:"default_channel_administrator_rights"` + // Information about the affiliate program of the bot; may be null if none + AffiliateProgram *AffiliateProgramInfo `json:"affiliate_program"` // Default light background color for bot Web Apps; -1 if not specified WebAppBackgroundLightColor int32 `json:"web_app_background_light_color"` // Default dark background color for bot Web Apps; -1 if not specified @@ -9490,6 +9913,7 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { PrivacyPolicyUrl string `json:"privacy_policy_url"` DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` DefaultChannelAdministratorRights *ChatAdministratorRights `json:"default_channel_administrator_rights"` + AffiliateProgram *AffiliateProgramInfo `json:"affiliate_program"` WebAppBackgroundLightColor int32 `json:"web_app_background_light_color"` WebAppBackgroundDarkColor int32 `json:"web_app_background_dark_color"` WebAppHeaderLightColor int32 `json:"web_app_header_light_color"` @@ -9517,6 +9941,7 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { botInfo.PrivacyPolicyUrl = tmp.PrivacyPolicyUrl botInfo.DefaultGroupAdministratorRights = tmp.DefaultGroupAdministratorRights botInfo.DefaultChannelAdministratorRights = tmp.DefaultChannelAdministratorRights + botInfo.AffiliateProgram = tmp.AffiliateProgram botInfo.WebAppBackgroundLightColor = tmp.WebAppBackgroundLightColor botInfo.WebAppBackgroundDarkColor = tmp.WebAppBackgroundDarkColor botInfo.WebAppHeaderLightColor = tmp.WebAppHeaderLightColor @@ -34198,7 +34623,7 @@ func (*TargetChatTypes) GetType() string { return TypeTargetChatTypes } -// The currently opened chat needs to be kept +// The currently opened chat and forum topic must be kept type TargetChatCurrent struct{ meta } @@ -45817,6 +46242,35 @@ func (*InternalLinkTypeChangePhoneNumber) InternalLinkTypeType() string { return TypeInternalLinkTypeChangePhoneNumber } +// The link is an affiliate program link. Call searchChatAffiliateProgram with the given username and referrer to process the link +type InternalLinkTypeChatAffiliateProgram struct { + meta + // Username to be passed to searchChatAffiliateProgram + Username string `json:"username"` + // Referrer to be passed to searchChatAffiliateProgram + Referrer string `json:"referrer"` +} + +func (entity *InternalLinkTypeChatAffiliateProgram) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeChatAffiliateProgram + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeChatAffiliateProgram) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeChatAffiliateProgram) GetType() string { + return TypeInternalLinkTypeChatAffiliateProgram +} + +func (*InternalLinkTypeChatAffiliateProgram) InternalLinkTypeType() string { + return TypeInternalLinkTypeChatAffiliateProgram +} + // The link is a link to boost a Telegram chat. Call getChatBoostLinkInfo with the given URL to process the link. If the chat is found, then call getChatBoostStatus and getAvailableChatBoostSlots to get the current boost status and check whether the chat can be boosted. If the user wants to boost the chat and the chat can be boosted, then call boostChat type InternalLinkTypeChatBoost struct { meta @@ -47309,6 +47763,106 @@ func (*FileTypeSecure) FileTypeType() string { return TypeFileTypeSecure } +// The file is a self-destructing photo in a private chat +type FileTypeSelfDestructingPhoto struct{ + meta +} + +func (entity *FileTypeSelfDestructingPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeSelfDestructingPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeSelfDestructingPhoto) GetClass() string { + return ClassFileType +} + +func (*FileTypeSelfDestructingPhoto) GetType() string { + return TypeFileTypeSelfDestructingPhoto +} + +func (*FileTypeSelfDestructingPhoto) FileTypeType() string { + return TypeFileTypeSelfDestructingPhoto +} + +// The file is a self-destructing video in a private chat +type FileTypeSelfDestructingVideo struct{ + meta +} + +func (entity *FileTypeSelfDestructingVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeSelfDestructingVideo + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeSelfDestructingVideo) GetClass() string { + return ClassFileType +} + +func (*FileTypeSelfDestructingVideo) GetType() string { + return TypeFileTypeSelfDestructingVideo +} + +func (*FileTypeSelfDestructingVideo) FileTypeType() string { + return TypeFileTypeSelfDestructingVideo +} + +// The file is a self-destructing video note in a private chat +type FileTypeSelfDestructingVideoNote struct{ + meta +} + +func (entity *FileTypeSelfDestructingVideoNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeSelfDestructingVideoNote + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeSelfDestructingVideoNote) GetClass() string { + return ClassFileType +} + +func (*FileTypeSelfDestructingVideoNote) GetType() string { + return TypeFileTypeSelfDestructingVideoNote +} + +func (*FileTypeSelfDestructingVideoNote) FileTypeType() string { + return TypeFileTypeSelfDestructingVideoNote +} + +// The file is a self-destructing voice note in a private chat +type FileTypeSelfDestructingVoiceNote struct{ + meta +} + +func (entity *FileTypeSelfDestructingVoiceNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeSelfDestructingVoiceNote + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeSelfDestructingVoiceNote) GetClass() string { + return ClassFileType +} + +func (*FileTypeSelfDestructingVoiceNote) GetType() string { + return TypeFileTypeSelfDestructingVoiceNote +} + +func (*FileTypeSelfDestructingVoiceNote) FileTypeType() string { + return TypeFileTypeSelfDestructingVoiceNote +} + // The file is a sticker type FileTypeSticker struct{ meta @@ -50505,12 +51059,12 @@ func (*ChatRevenueTransactions) GetType() string { // Contains information about Telegram Stars earned by a bot or a chat type StarRevenueStatus struct { meta - // Total number of Telegram Stars earned - TotalCount int64 `json:"total_count"` - // The number of Telegram Stars that aren't withdrawn yet - CurrentCount int64 `json:"current_count"` - // The number of Telegram Stars that are available for withdrawal - AvailableCount int64 `json:"available_count"` + // Total amount of Telegram Stars earned + TotalAmount *StarAmount `json:"total_amount"` + // The amount of Telegram Stars that aren't withdrawn yet + CurrentAmount *StarAmount `json:"current_amount"` + // The amount of Telegram Stars that are available for withdrawal + AvailableAmount *StarAmount `json:"available_amount"` // True, if Telegram Stars can be withdrawn now or later WithdrawalEnabled bool `json:"withdrawal_enabled"` // Time left before the next withdrawal can be started, in seconds; 0 if withdrawal can be started now @@ -54482,7 +55036,7 @@ type UpdateAccentColors struct { meta // Information about supported colors; colors with identifiers 0 (red), 1 (orange), 2 (purple/violet), 3 (green), 4 (cyan), 5 (blue), 6 (pink) must always be supported and aren't included in the list. The exact colors for the accent colors with identifiers 0-6 must be taken from the app theme Colors []*AccentColor `json:"colors"` - // The list of accent color identifiers, which can be set through setAccentColor and setChatAccentColor. The colors must be shown in the specififed order + // The list of accent color identifiers, which can be set through setAccentColor and setChatAccentColor. The colors must be shown in the specified order AvailableAccentColorIds []int32 `json:"available_accent_color_ids"` } @@ -54511,7 +55065,7 @@ type UpdateProfileAccentColors struct { meta // Information about supported colors Colors []*ProfileAccentColor `json:"colors"` - // The list of accent color identifiers, which can be set through setProfileAccentColor and setChatProfileAccentColor. The colors must be shown in the specififed order + // The list of accent color identifiers, which can be set through setProfileAccentColor and setChatProfileAccentColor. The colors must be shown in the specified order AvailableAccentColorIds []int32 `json:"available_accent_color_ids"` } @@ -54877,8 +55431,8 @@ func (*UpdateActiveLiveLocationMessages) UpdateType() string { // The number of Telegram Stars owned by the current user has changed type UpdateOwnedStarCount struct { meta - // The new number of Telegram Stars owned - StarCount int64 `json:"star_count"` + // The new amount of owned Telegram Stars + StarAmount *StarAmount `json:"star_amount"` } func (entity *UpdateOwnedStarCount) MarshalJSON() ([]byte, error) { diff --git a/client/unmarshaler.go b/client/unmarshaler.go index c30f7ad..ec11136 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -693,6 +693,43 @@ func UnmarshalListOfStarSubscriptionType(dataList []json.RawMessage) ([]StarSubs return list, nil } +func UnmarshalAffiliateProgramSortOrder(data json.RawMessage) (AffiliateProgramSortOrder, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeAffiliateProgramSortOrderProfitability: + return UnmarshalAffiliateProgramSortOrderProfitability(data) + + case TypeAffiliateProgramSortOrderCreationDate: + return UnmarshalAffiliateProgramSortOrderCreationDate(data) + + case TypeAffiliateProgramSortOrderRevenue: + return UnmarshalAffiliateProgramSortOrderRevenue(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfAffiliateProgramSortOrder(dataList []json.RawMessage) ([]AffiliateProgramSortOrder, error) { + list := []AffiliateProgramSortOrder{} + + for _, data := range dataList { + entity, err := UnmarshalAffiliateProgramSortOrder(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalStarTransactionDirection(data json.RawMessage) (StarTransactionDirection, error) { var meta meta @@ -727,7 +764,7 @@ func UnmarshalListOfStarTransactionDirection(dataList []json.RawMessage) ([]Star return list, nil } -func UnmarshalBotTransactionPurpose(data json.RawMessage) (BotTransactionPurpose, error) { +func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -736,163 +773,91 @@ func UnmarshalBotTransactionPurpose(data json.RawMessage) (BotTransactionPurpose } switch meta.Type { - case TypeBotTransactionPurposePaidMedia: - return UnmarshalBotTransactionPurposePaidMedia(data) + case TypeStarTransactionTypePremiumBotDeposit: + return UnmarshalStarTransactionTypePremiumBotDeposit(data) - case TypeBotTransactionPurposeInvoicePayment: - return UnmarshalBotTransactionPurposeInvoicePayment(data) + case TypeStarTransactionTypeAppStoreDeposit: + return UnmarshalStarTransactionTypeAppStoreDeposit(data) - case TypeBotTransactionPurposeSubscription: - return UnmarshalBotTransactionPurposeSubscription(data) + case TypeStarTransactionTypeGooglePlayDeposit: + return UnmarshalStarTransactionTypeGooglePlayDeposit(data) + + case TypeStarTransactionTypeFragmentDeposit: + return UnmarshalStarTransactionTypeFragmentDeposit(data) + + case TypeStarTransactionTypeUserDeposit: + return UnmarshalStarTransactionTypeUserDeposit(data) + + case TypeStarTransactionTypeGiveawayDeposit: + return UnmarshalStarTransactionTypeGiveawayDeposit(data) + + case TypeStarTransactionTypeFragmentWithdrawal: + return UnmarshalStarTransactionTypeFragmentWithdrawal(data) + + case TypeStarTransactionTypeTelegramAdsWithdrawal: + return UnmarshalStarTransactionTypeTelegramAdsWithdrawal(data) + + case TypeStarTransactionTypeTelegramApiUsage: + return UnmarshalStarTransactionTypeTelegramApiUsage(data) + + case TypeStarTransactionTypeBotPaidMediaPurchase: + return UnmarshalStarTransactionTypeBotPaidMediaPurchase(data) + + case TypeStarTransactionTypeBotPaidMediaSale: + return UnmarshalStarTransactionTypeBotPaidMediaSale(data) + + case TypeStarTransactionTypeChannelPaidMediaPurchase: + return UnmarshalStarTransactionTypeChannelPaidMediaPurchase(data) + + case TypeStarTransactionTypeChannelPaidMediaSale: + return UnmarshalStarTransactionTypeChannelPaidMediaSale(data) + + case TypeStarTransactionTypeBotInvoicePurchase: + return UnmarshalStarTransactionTypeBotInvoicePurchase(data) + + case TypeStarTransactionTypeBotInvoiceSale: + return UnmarshalStarTransactionTypeBotInvoiceSale(data) + + case TypeStarTransactionTypeBotSubscriptionPurchase: + return UnmarshalStarTransactionTypeBotSubscriptionPurchase(data) + + case TypeStarTransactionTypeBotSubscriptionSale: + return UnmarshalStarTransactionTypeBotSubscriptionSale(data) + + case TypeStarTransactionTypeChannelSubscriptionPurchase: + return UnmarshalStarTransactionTypeChannelSubscriptionPurchase(data) + + case TypeStarTransactionTypeChannelSubscriptionSale: + return UnmarshalStarTransactionTypeChannelSubscriptionSale(data) + + case TypeStarTransactionTypeGiftPurchase: + return UnmarshalStarTransactionTypeGiftPurchase(data) + + case TypeStarTransactionTypeGiftSale: + return UnmarshalStarTransactionTypeGiftSale(data) + + case TypeStarTransactionTypeChannelPaidReactionSend: + return UnmarshalStarTransactionTypeChannelPaidReactionSend(data) + + case TypeStarTransactionTypeChannelPaidReactionReceive: + return UnmarshalStarTransactionTypeChannelPaidReactionReceive(data) + + case TypeStarTransactionTypeAffiliateProgramCommission: + return UnmarshalStarTransactionTypeAffiliateProgramCommission(data) + + case TypeStarTransactionTypeUnsupported: + return UnmarshalStarTransactionTypeUnsupported(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfBotTransactionPurpose(dataList []json.RawMessage) ([]BotTransactionPurpose, error) { - list := []BotTransactionPurpose{} +func UnmarshalListOfStarTransactionType(dataList []json.RawMessage) ([]StarTransactionType, error) { + list := []StarTransactionType{} for _, data := range dataList { - entity, err := UnmarshalBotTransactionPurpose(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - return list, nil -} - -func UnmarshalChatTransactionPurpose(data json.RawMessage) (ChatTransactionPurpose, error) { - var meta meta - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeChatTransactionPurposePaidMedia: - return UnmarshalChatTransactionPurposePaidMedia(data) - - case TypeChatTransactionPurposeJoin: - return UnmarshalChatTransactionPurposeJoin(data) - - case TypeChatTransactionPurposeReaction: - return UnmarshalChatTransactionPurposeReaction(data) - - case TypeChatTransactionPurposeGiveaway: - return UnmarshalChatTransactionPurposeGiveaway(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfChatTransactionPurpose(dataList []json.RawMessage) ([]ChatTransactionPurpose, error) { - list := []ChatTransactionPurpose{} - - for _, data := range dataList { - entity, err := UnmarshalChatTransactionPurpose(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - return list, nil -} - -func UnmarshalUserTransactionPurpose(data json.RawMessage) (UserTransactionPurpose, error) { - var meta meta - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeUserTransactionPurposeGiftedStars: - return UnmarshalUserTransactionPurposeGiftedStars(data) - - case TypeUserTransactionPurposeGiftSell: - return UnmarshalUserTransactionPurposeGiftSell(data) - - case TypeUserTransactionPurposeGiftSend: - return UnmarshalUserTransactionPurposeGiftSend(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfUserTransactionPurpose(dataList []json.RawMessage) ([]UserTransactionPurpose, error) { - list := []UserTransactionPurpose{} - - for _, data := range dataList { - entity, err := UnmarshalUserTransactionPurpose(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - return list, nil -} - -func UnmarshalStarTransactionPartner(data json.RawMessage) (StarTransactionPartner, error) { - var meta meta - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeStarTransactionPartnerTelegram: - return UnmarshalStarTransactionPartnerTelegram(data) - - case TypeStarTransactionPartnerAppStore: - return UnmarshalStarTransactionPartnerAppStore(data) - - case TypeStarTransactionPartnerGooglePlay: - return UnmarshalStarTransactionPartnerGooglePlay(data) - - case TypeStarTransactionPartnerFragment: - return UnmarshalStarTransactionPartnerFragment(data) - - case TypeStarTransactionPartnerTelegramAds: - return UnmarshalStarTransactionPartnerTelegramAds(data) - - case TypeStarTransactionPartnerTelegramApi: - return UnmarshalStarTransactionPartnerTelegramApi(data) - - case TypeStarTransactionPartnerBot: - return UnmarshalStarTransactionPartnerBot(data) - - case TypeStarTransactionPartnerBusiness: - return UnmarshalStarTransactionPartnerBusiness(data) - - case TypeStarTransactionPartnerChat: - return UnmarshalStarTransactionPartnerChat(data) - - case TypeStarTransactionPartnerUser: - return UnmarshalStarTransactionPartnerUser(data) - - case TypeStarTransactionPartnerUnsupported: - return UnmarshalStarTransactionPartnerUnsupported(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfStarTransactionPartner(dataList []json.RawMessage) ([]StarTransactionPartner, error) { - list := []StarTransactionPartner{} - - for _, data := range dataList { - entity, err := UnmarshalStarTransactionPartner(data) + entity, err := UnmarshalStarTransactionType(data) if err != nil { return nil, err } @@ -6816,6 +6781,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(data) + case TypeInternalLinkTypeChatAffiliateProgram: + return UnmarshalInternalLinkTypeChatAffiliateProgram(data) + case TypeInternalLinkTypeChatBoost: return UnmarshalInternalLinkTypeChatBoost(data) @@ -7016,6 +6984,18 @@ func UnmarshalFileType(data json.RawMessage) (FileType, error) { case TypeFileTypeSecure: return UnmarshalFileTypeSecure(data) + case TypeFileTypeSelfDestructingPhoto: + return UnmarshalFileTypeSelfDestructingPhoto(data) + + case TypeFileTypeSelfDestructingVideo: + return UnmarshalFileTypeSelfDestructingVideo(data) + + case TypeFileTypeSelfDestructingVideoNote: + return UnmarshalFileTypeSelfDestructingVideoNote(data) + + case TypeFileTypeSelfDestructingVoiceNote: + return UnmarshalFileTypeSelfDestructingVoiceNote(data) + case TypeFileTypeSticker: return UnmarshalFileTypeSticker(data) @@ -9354,6 +9334,14 @@ func UnmarshalChatAdministratorRights(data json.RawMessage) (*ChatAdministratorR return &resp, err } +func UnmarshalStarAmount(data json.RawMessage) (*StarAmount, error) { + var resp StarAmount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarSubscriptionTypeChannel(data json.RawMessage) (*StarSubscriptionTypeChannel, error) { var resp StarSubscriptionTypeChannel @@ -9394,6 +9382,86 @@ func UnmarshalStarSubscriptions(data json.RawMessage) (*StarSubscriptions, error return &resp, err } +func UnmarshalAffiliateProgramSortOrderProfitability(data json.RawMessage) (*AffiliateProgramSortOrderProfitability, error) { + var resp AffiliateProgramSortOrderProfitability + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateProgramSortOrderCreationDate(data json.RawMessage) (*AffiliateProgramSortOrderCreationDate, error) { + var resp AffiliateProgramSortOrderCreationDate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateProgramSortOrderRevenue(data json.RawMessage) (*AffiliateProgramSortOrderRevenue, error) { + var resp AffiliateProgramSortOrderRevenue + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateProgramParameters(data json.RawMessage) (*AffiliateProgramParameters, error) { + var resp AffiliateProgramParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateProgramInfo(data json.RawMessage) (*AffiliateProgramInfo, error) { + var resp AffiliateProgramInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateInfo(data json.RawMessage) (*AffiliateInfo, error) { + var resp AffiliateInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFoundAffiliateProgram(data json.RawMessage) (*FoundAffiliateProgram, error) { + var resp FoundAffiliateProgram + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFoundAffiliatePrograms(data json.RawMessage) (*FoundAffiliatePrograms, error) { + var resp FoundAffiliatePrograms + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatAffiliateProgram(data json.RawMessage) (*ChatAffiliateProgram, error) { + var resp ChatAffiliateProgram + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatAffiliatePrograms(data json.RawMessage) (*ChatAffiliatePrograms, error) { + var resp ChatAffiliatePrograms + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalProductInfo(data json.RawMessage) (*ProductInfo, error) { var resp ProductInfo @@ -9530,168 +9598,200 @@ func UnmarshalStarTransactionDirectionOutgoing(data json.RawMessage) (*StarTrans return &resp, err } -func UnmarshalBotTransactionPurposePaidMedia(data json.RawMessage) (*BotTransactionPurposePaidMedia, error) { - var resp BotTransactionPurposePaidMedia +func UnmarshalStarTransactionTypePremiumBotDeposit(data json.RawMessage) (*StarTransactionTypePremiumBotDeposit, error) { + var resp StarTransactionTypePremiumBotDeposit err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalBotTransactionPurposeInvoicePayment(data json.RawMessage) (*BotTransactionPurposeInvoicePayment, error) { - var resp BotTransactionPurposeInvoicePayment +func UnmarshalStarTransactionTypeAppStoreDeposit(data json.RawMessage) (*StarTransactionTypeAppStoreDeposit, error) { + var resp StarTransactionTypeAppStoreDeposit err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalBotTransactionPurposeSubscription(data json.RawMessage) (*BotTransactionPurposeSubscription, error) { - var resp BotTransactionPurposeSubscription +func UnmarshalStarTransactionTypeGooglePlayDeposit(data json.RawMessage) (*StarTransactionTypeGooglePlayDeposit, error) { + var resp StarTransactionTypeGooglePlayDeposit err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatTransactionPurposePaidMedia(data json.RawMessage) (*ChatTransactionPurposePaidMedia, error) { - var resp ChatTransactionPurposePaidMedia +func UnmarshalStarTransactionTypeFragmentDeposit(data json.RawMessage) (*StarTransactionTypeFragmentDeposit, error) { + var resp StarTransactionTypeFragmentDeposit err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatTransactionPurposeJoin(data json.RawMessage) (*ChatTransactionPurposeJoin, error) { - var resp ChatTransactionPurposeJoin +func UnmarshalStarTransactionTypeUserDeposit(data json.RawMessage) (*StarTransactionTypeUserDeposit, error) { + var resp StarTransactionTypeUserDeposit err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatTransactionPurposeReaction(data json.RawMessage) (*ChatTransactionPurposeReaction, error) { - var resp ChatTransactionPurposeReaction +func UnmarshalStarTransactionTypeGiveawayDeposit(data json.RawMessage) (*StarTransactionTypeGiveawayDeposit, error) { + var resp StarTransactionTypeGiveawayDeposit err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatTransactionPurposeGiveaway(data json.RawMessage) (*ChatTransactionPurposeGiveaway, error) { - var resp ChatTransactionPurposeGiveaway +func UnmarshalStarTransactionTypeFragmentWithdrawal(data json.RawMessage) (*StarTransactionTypeFragmentWithdrawal, error) { + var resp StarTransactionTypeFragmentWithdrawal err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalUserTransactionPurposeGiftedStars(data json.RawMessage) (*UserTransactionPurposeGiftedStars, error) { - var resp UserTransactionPurposeGiftedStars +func UnmarshalStarTransactionTypeTelegramAdsWithdrawal(data json.RawMessage) (*StarTransactionTypeTelegramAdsWithdrawal, error) { + var resp StarTransactionTypeTelegramAdsWithdrawal err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalUserTransactionPurposeGiftSell(data json.RawMessage) (*UserTransactionPurposeGiftSell, error) { - var resp UserTransactionPurposeGiftSell +func UnmarshalStarTransactionTypeTelegramApiUsage(data json.RawMessage) (*StarTransactionTypeTelegramApiUsage, error) { + var resp StarTransactionTypeTelegramApiUsage err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalUserTransactionPurposeGiftSend(data json.RawMessage) (*UserTransactionPurposeGiftSend, error) { - var resp UserTransactionPurposeGiftSend +func UnmarshalStarTransactionTypeBotPaidMediaPurchase(data json.RawMessage) (*StarTransactionTypeBotPaidMediaPurchase, error) { + var resp StarTransactionTypeBotPaidMediaPurchase err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerTelegram(data json.RawMessage) (*StarTransactionPartnerTelegram, error) { - var resp StarTransactionPartnerTelegram +func UnmarshalStarTransactionTypeBotPaidMediaSale(data json.RawMessage) (*StarTransactionTypeBotPaidMediaSale, error) { + var resp StarTransactionTypeBotPaidMediaSale err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerAppStore(data json.RawMessage) (*StarTransactionPartnerAppStore, error) { - var resp StarTransactionPartnerAppStore +func UnmarshalStarTransactionTypeChannelPaidMediaPurchase(data json.RawMessage) (*StarTransactionTypeChannelPaidMediaPurchase, error) { + var resp StarTransactionTypeChannelPaidMediaPurchase err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerGooglePlay(data json.RawMessage) (*StarTransactionPartnerGooglePlay, error) { - var resp StarTransactionPartnerGooglePlay +func UnmarshalStarTransactionTypeChannelPaidMediaSale(data json.RawMessage) (*StarTransactionTypeChannelPaidMediaSale, error) { + var resp StarTransactionTypeChannelPaidMediaSale err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerFragment(data json.RawMessage) (*StarTransactionPartnerFragment, error) { - var resp StarTransactionPartnerFragment +func UnmarshalStarTransactionTypeBotInvoicePurchase(data json.RawMessage) (*StarTransactionTypeBotInvoicePurchase, error) { + var resp StarTransactionTypeBotInvoicePurchase err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerTelegramAds(data json.RawMessage) (*StarTransactionPartnerTelegramAds, error) { - var resp StarTransactionPartnerTelegramAds +func UnmarshalStarTransactionTypeBotInvoiceSale(data json.RawMessage) (*StarTransactionTypeBotInvoiceSale, error) { + var resp StarTransactionTypeBotInvoiceSale err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerTelegramApi(data json.RawMessage) (*StarTransactionPartnerTelegramApi, error) { - var resp StarTransactionPartnerTelegramApi +func UnmarshalStarTransactionTypeBotSubscriptionPurchase(data json.RawMessage) (*StarTransactionTypeBotSubscriptionPurchase, error) { + var resp StarTransactionTypeBotSubscriptionPurchase err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerBot(data json.RawMessage) (*StarTransactionPartnerBot, error) { - var resp StarTransactionPartnerBot +func UnmarshalStarTransactionTypeBotSubscriptionSale(data json.RawMessage) (*StarTransactionTypeBotSubscriptionSale, error) { + var resp StarTransactionTypeBotSubscriptionSale err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerBusiness(data json.RawMessage) (*StarTransactionPartnerBusiness, error) { - var resp StarTransactionPartnerBusiness +func UnmarshalStarTransactionTypeChannelSubscriptionPurchase(data json.RawMessage) (*StarTransactionTypeChannelSubscriptionPurchase, error) { + var resp StarTransactionTypeChannelSubscriptionPurchase err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerChat(data json.RawMessage) (*StarTransactionPartnerChat, error) { - var resp StarTransactionPartnerChat +func UnmarshalStarTransactionTypeChannelSubscriptionSale(data json.RawMessage) (*StarTransactionTypeChannelSubscriptionSale, error) { + var resp StarTransactionTypeChannelSubscriptionSale err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerUser(data json.RawMessage) (*StarTransactionPartnerUser, error) { - var resp StarTransactionPartnerUser +func UnmarshalStarTransactionTypeGiftPurchase(data json.RawMessage) (*StarTransactionTypeGiftPurchase, error) { + var resp StarTransactionTypeGiftPurchase err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerUnsupported(data json.RawMessage) (*StarTransactionPartnerUnsupported, error) { - var resp StarTransactionPartnerUnsupported +func UnmarshalStarTransactionTypeGiftSale(data json.RawMessage) (*StarTransactionTypeGiftSale, error) { + var resp StarTransactionTypeGiftSale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeChannelPaidReactionSend(data json.RawMessage) (*StarTransactionTypeChannelPaidReactionSend, error) { + var resp StarTransactionTypeChannelPaidReactionSend + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeChannelPaidReactionReceive(data json.RawMessage) (*StarTransactionTypeChannelPaidReactionReceive, error) { + var resp StarTransactionTypeChannelPaidReactionReceive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeAffiliateProgramCommission(data json.RawMessage) (*StarTransactionTypeAffiliateProgramCommission, error) { + var resp StarTransactionTypeAffiliateProgramCommission + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeUnsupported(data json.RawMessage) (*StarTransactionTypeUnsupported, error) { + var resp StarTransactionTypeUnsupported err := json.Unmarshal(data, &resp) @@ -18754,6 +18854,14 @@ func UnmarshalInternalLinkTypeChangePhoneNumber(data json.RawMessage) (*Internal return &resp, err } +func UnmarshalInternalLinkTypeChatAffiliateProgram(data json.RawMessage) (*InternalLinkTypeChatAffiliateProgram, error) { + var resp InternalLinkTypeChatAffiliateProgram + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeChatBoost(data json.RawMessage) (*InternalLinkTypeChatBoost, error) { var resp InternalLinkTypeChatBoost @@ -19178,6 +19286,38 @@ func UnmarshalFileTypeSecure(data json.RawMessage) (*FileTypeSecure, error) { return &resp, err } +func UnmarshalFileTypeSelfDestructingPhoto(data json.RawMessage) (*FileTypeSelfDestructingPhoto, error) { + var resp FileTypeSelfDestructingPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeSelfDestructingVideo(data json.RawMessage) (*FileTypeSelfDestructingVideo, error) { + var resp FileTypeSelfDestructingVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeSelfDestructingVideoNote(data json.RawMessage) (*FileTypeSelfDestructingVideoNote, error) { + var resp FileTypeSelfDestructingVideoNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeSelfDestructingVoiceNote(data json.RawMessage) (*FileTypeSelfDestructingVoiceNote, error) { + var resp FileTypeSelfDestructingVoiceNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalFileTypeSticker(data json.RawMessage) (*FileTypeSticker, error) { var resp FileTypeSticker @@ -21851,6 +21991,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatAdministratorRights: return UnmarshalChatAdministratorRights(data) + case TypeStarAmount: + return UnmarshalStarAmount(data) + case TypeStarSubscriptionTypeChannel: return UnmarshalStarSubscriptionTypeChannel(data) @@ -21866,6 +22009,36 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarSubscriptions: return UnmarshalStarSubscriptions(data) + case TypeAffiliateProgramSortOrderProfitability: + return UnmarshalAffiliateProgramSortOrderProfitability(data) + + case TypeAffiliateProgramSortOrderCreationDate: + return UnmarshalAffiliateProgramSortOrderCreationDate(data) + + case TypeAffiliateProgramSortOrderRevenue: + return UnmarshalAffiliateProgramSortOrderRevenue(data) + + case TypeAffiliateProgramParameters: + return UnmarshalAffiliateProgramParameters(data) + + case TypeAffiliateProgramInfo: + return UnmarshalAffiliateProgramInfo(data) + + case TypeAffiliateInfo: + return UnmarshalAffiliateInfo(data) + + case TypeFoundAffiliateProgram: + return UnmarshalFoundAffiliateProgram(data) + + case TypeFoundAffiliatePrograms: + return UnmarshalFoundAffiliatePrograms(data) + + case TypeChatAffiliateProgram: + return UnmarshalChatAffiliateProgram(data) + + case TypeChatAffiliatePrograms: + return UnmarshalChatAffiliatePrograms(data) + case TypeProductInfo: return UnmarshalProductInfo(data) @@ -21917,68 +22090,80 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionDirectionOutgoing: return UnmarshalStarTransactionDirectionOutgoing(data) - case TypeBotTransactionPurposePaidMedia: - return UnmarshalBotTransactionPurposePaidMedia(data) + case TypeStarTransactionTypePremiumBotDeposit: + return UnmarshalStarTransactionTypePremiumBotDeposit(data) - case TypeBotTransactionPurposeInvoicePayment: - return UnmarshalBotTransactionPurposeInvoicePayment(data) + case TypeStarTransactionTypeAppStoreDeposit: + return UnmarshalStarTransactionTypeAppStoreDeposit(data) - case TypeBotTransactionPurposeSubscription: - return UnmarshalBotTransactionPurposeSubscription(data) + case TypeStarTransactionTypeGooglePlayDeposit: + return UnmarshalStarTransactionTypeGooglePlayDeposit(data) - case TypeChatTransactionPurposePaidMedia: - return UnmarshalChatTransactionPurposePaidMedia(data) + case TypeStarTransactionTypeFragmentDeposit: + return UnmarshalStarTransactionTypeFragmentDeposit(data) - case TypeChatTransactionPurposeJoin: - return UnmarshalChatTransactionPurposeJoin(data) + case TypeStarTransactionTypeUserDeposit: + return UnmarshalStarTransactionTypeUserDeposit(data) - case TypeChatTransactionPurposeReaction: - return UnmarshalChatTransactionPurposeReaction(data) + case TypeStarTransactionTypeGiveawayDeposit: + return UnmarshalStarTransactionTypeGiveawayDeposit(data) - case TypeChatTransactionPurposeGiveaway: - return UnmarshalChatTransactionPurposeGiveaway(data) + case TypeStarTransactionTypeFragmentWithdrawal: + return UnmarshalStarTransactionTypeFragmentWithdrawal(data) - case TypeUserTransactionPurposeGiftedStars: - return UnmarshalUserTransactionPurposeGiftedStars(data) + case TypeStarTransactionTypeTelegramAdsWithdrawal: + return UnmarshalStarTransactionTypeTelegramAdsWithdrawal(data) - case TypeUserTransactionPurposeGiftSell: - return UnmarshalUserTransactionPurposeGiftSell(data) + case TypeStarTransactionTypeTelegramApiUsage: + return UnmarshalStarTransactionTypeTelegramApiUsage(data) - case TypeUserTransactionPurposeGiftSend: - return UnmarshalUserTransactionPurposeGiftSend(data) + case TypeStarTransactionTypeBotPaidMediaPurchase: + return UnmarshalStarTransactionTypeBotPaidMediaPurchase(data) - case TypeStarTransactionPartnerTelegram: - return UnmarshalStarTransactionPartnerTelegram(data) + case TypeStarTransactionTypeBotPaidMediaSale: + return UnmarshalStarTransactionTypeBotPaidMediaSale(data) - case TypeStarTransactionPartnerAppStore: - return UnmarshalStarTransactionPartnerAppStore(data) + case TypeStarTransactionTypeChannelPaidMediaPurchase: + return UnmarshalStarTransactionTypeChannelPaidMediaPurchase(data) - case TypeStarTransactionPartnerGooglePlay: - return UnmarshalStarTransactionPartnerGooglePlay(data) + case TypeStarTransactionTypeChannelPaidMediaSale: + return UnmarshalStarTransactionTypeChannelPaidMediaSale(data) - case TypeStarTransactionPartnerFragment: - return UnmarshalStarTransactionPartnerFragment(data) + case TypeStarTransactionTypeBotInvoicePurchase: + return UnmarshalStarTransactionTypeBotInvoicePurchase(data) - case TypeStarTransactionPartnerTelegramAds: - return UnmarshalStarTransactionPartnerTelegramAds(data) + case TypeStarTransactionTypeBotInvoiceSale: + return UnmarshalStarTransactionTypeBotInvoiceSale(data) - case TypeStarTransactionPartnerTelegramApi: - return UnmarshalStarTransactionPartnerTelegramApi(data) + case TypeStarTransactionTypeBotSubscriptionPurchase: + return UnmarshalStarTransactionTypeBotSubscriptionPurchase(data) - case TypeStarTransactionPartnerBot: - return UnmarshalStarTransactionPartnerBot(data) + case TypeStarTransactionTypeBotSubscriptionSale: + return UnmarshalStarTransactionTypeBotSubscriptionSale(data) - case TypeStarTransactionPartnerBusiness: - return UnmarshalStarTransactionPartnerBusiness(data) + case TypeStarTransactionTypeChannelSubscriptionPurchase: + return UnmarshalStarTransactionTypeChannelSubscriptionPurchase(data) - case TypeStarTransactionPartnerChat: - return UnmarshalStarTransactionPartnerChat(data) + case TypeStarTransactionTypeChannelSubscriptionSale: + return UnmarshalStarTransactionTypeChannelSubscriptionSale(data) - case TypeStarTransactionPartnerUser: - return UnmarshalStarTransactionPartnerUser(data) + case TypeStarTransactionTypeGiftPurchase: + return UnmarshalStarTransactionTypeGiftPurchase(data) - case TypeStarTransactionPartnerUnsupported: - return UnmarshalStarTransactionPartnerUnsupported(data) + case TypeStarTransactionTypeGiftSale: + return UnmarshalStarTransactionTypeGiftSale(data) + + case TypeStarTransactionTypeChannelPaidReactionSend: + return UnmarshalStarTransactionTypeChannelPaidReactionSend(data) + + case TypeStarTransactionTypeChannelPaidReactionReceive: + return UnmarshalStarTransactionTypeChannelPaidReactionReceive(data) + + case TypeStarTransactionTypeAffiliateProgramCommission: + return UnmarshalStarTransactionTypeAffiliateProgramCommission(data) + + case TypeStarTransactionTypeUnsupported: + return UnmarshalStarTransactionTypeUnsupported(data) case TypeStarTransaction: return UnmarshalStarTransaction(data) @@ -25376,6 +25561,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(data) + case TypeInternalLinkTypeChatAffiliateProgram: + return UnmarshalInternalLinkTypeChatAffiliateProgram(data) + case TypeInternalLinkTypeChatBoost: return UnmarshalInternalLinkTypeChatBoost(data) @@ -25535,6 +25723,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFileTypeSecure: return UnmarshalFileTypeSecure(data) + case TypeFileTypeSelfDestructingPhoto: + return UnmarshalFileTypeSelfDestructingPhoto(data) + + case TypeFileTypeSelfDestructingVideo: + return UnmarshalFileTypeSelfDestructingVideo(data) + + case TypeFileTypeSelfDestructingVideoNote: + return UnmarshalFileTypeSelfDestructingVideoNote(data) + + case TypeFileTypeSelfDestructingVoiceNote: + return UnmarshalFileTypeSelfDestructingVoiceNote(data) + case TypeFileTypeSticker: return UnmarshalFileTypeSticker(data) diff --git a/data/td_api.tl b/data/td_api.tl index ee20b8d..1512e66 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -813,6 +813,12 @@ chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_docum chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool is_anonymous:Bool = ChatAdministratorRights; +//@description Describes a possibly non-integer amount of Telegram Stars +//@star_count The integer amount of Telegram Stars rounded to 0 +//@nanostar_count The number of 1/1000000000 shares of Telegram Stars; from -999999999 to 999999999 +starAmount star_count:int53 nanostar_count:int32 = StarAmount; + + //@class StarSubscriptionType @description Describes type of subscription paid in Telegram Stars //@description Describes a subscription to a channel chat @@ -844,11 +850,70 @@ starSubscriptionPricing period:int32 star_count:int53 = StarSubscriptionPricing; starSubscription id:string chat_id:int53 expiration_date:int32 is_canceled:Bool is_expiring:Bool pricing:starSubscriptionPricing type:StarSubscriptionType = StarSubscription; //@description Represents a list of Telegram Star subscriptions -//@star_count The amount of owned Telegram Stars +//@star_amount The amount of owned Telegram Stars //@subscriptions List of subscriptions for Telegram Stars //@required_star_count The number of Telegram Stars required to buy to extend subscriptions expiring soon //@next_offset The offset for the next request. If empty, then there are no more results -starSubscriptions star_count:int53 subscriptions:vector required_star_count:int53 next_offset:string = StarSubscriptions; +starSubscriptions star_amount:starAmount subscriptions:vector required_star_count:int53 next_offset:string = StarSubscriptions; + + +//@class AffiliateProgramSortOrder @description Describes the order of the found affiliate programs + +//@description The affiliate programs must be sorted by the profitability +affiliateProgramSortOrderProfitability = AffiliateProgramSortOrder; + +//@description The affiliate programs must be sorted by creation date +affiliateProgramSortOrderCreationDate = AffiliateProgramSortOrder; + +//@description The affiliate programs must be sorted by the expected revenue +affiliateProgramSortOrderRevenue = AffiliateProgramSortOrder; + + +//@description Describes parameters of an affiliate program +//@commission_per_mille The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner; +//-getOption("affiliate_program_commission_per_mille_min")-getOption("affiliate_program_commission_per_mille_max") +//@month_count Number of months the program will be active; 0-36. If 0, then the program is eternal +affiliateProgramParameters commission_per_mille:int32 month_count:int32 = AffiliateProgramParameters; + +//@description Contains information about an active affiliate program +//@parameters Parameters of the affiliate program +//@end_date Point in time (Unix timestamp) when the affiliate program will be closed; 0 if the affiliate program isn't scheduled to be closed. +//-If positive, then the program can't be connected using connectChatAffiliateProgram, but active connections will work until the date +//@daily_revenue_per_user_amount The amount of daily revenue per user in Telegram Stars of the bot that created the affiliate program +affiliateProgramInfo parameters:affiliateProgramParameters end_date:int32 daily_revenue_per_user_amount:starAmount = AffiliateProgramInfo; + +//@description Contains information about an affiliate that received commission from a Telegram Star transaction +//@commission_per_mille The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner +//@affiliate_chat_id Identifier of the chat which received the commission +//@star_amount The amount of Telegram Stars that were received by the affiliate; can be negative for refunds +affiliateInfo commission_per_mille:int32 affiliate_chat_id:int53 star_amount:starAmount = AffiliateInfo; + +//@description Describes a found affiliate program +//@bot_user_id User identifier of the bot created the program +//@parameters Information about the affiliate program +foundAffiliateProgram bot_user_id:int53 parameters:affiliateProgramInfo = FoundAffiliateProgram; + +//@description Represents a list of found affiliate programs +//@total_count The total number of found affiliate programs +//@programs The list of affiliate programs +//@next_offset The offset for the next request. If empty, then there are no more results +foundAffiliatePrograms total_count:int32 programs:vector next_offset:string = FoundAffiliatePrograms; + +//@description Describes an affiliate program that was connected to a chat +//@url The link that can be used to refer users if the program is still active +//@bot_user_id User identifier of the bot created the program +//@parameters The parameters of the affiliate program +//@connection_date Point in time (Unix timestamp) when the affiliate program was connected +//@is_disconnected True, if the program was canceled by the bot, or disconnected by the chat owner and isn't available anymore +//@user_count The number of users that used the affiliate program +//@revenue_star_count The number of Telegram Stars that were earned by the affiliate program +chatAffiliateProgram url:string bot_user_id:int53 parameters:affiliateProgramParameters connection_date:int32 is_disconnected:Bool user_count:int64 revenue_star_count:int64 = ChatAffiliateProgram; + +//@description Represents a list of affiliate programs that were connected to a chat +//@total_count The total number of affiliate programs that were connected to the chat +//@programs The list of connected affiliate programs +//@next_offset The offset for the next request. If empty, then there are no more results +chatAffiliatePrograms total_count:int32 programs:vector next_offset:string = ChatAffiliatePrograms; //@description Contains information about a product that can be paid with invoice @@ -971,103 +1036,137 @@ starTransactionDirectionIncoming = StarTransactionDirection; starTransactionDirectionOutgoing = StarTransactionDirection; -//@class BotTransactionPurpose @description Describes purpose of a transaction with a bot +//@class StarTransactionType @description Describes type of transaction with Telegram Stars -//@description Paid media were bought @media The bought media if the transaction wasn't refunded @payload Bot-provided payload; for bots only -botTransactionPurposePaidMedia media:vector payload:string = BotTransactionPurpose; +//@description The transaction is a deposit of Telegram Stars from the Premium bot; for regular users only +starTransactionTypePremiumBotDeposit = StarTransactionType; -//@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 product_info:productInfo invoice_payload:bytes = BotTransactionPurpose; +//@description The transaction is a deposit of Telegram Stars from App Store; for regular users only +starTransactionTypeAppStoreDeposit = StarTransactionType; -//@description User bought a subscription in a bot or a business account -//@period The number of seconds between consecutive Telegram Star debiting -//@product_info Information about the bought subscription; may be null if not applicable -//@invoice_payload Invoice payload; for bots only -botTransactionPurposeSubscription period:int32 product_info:productInfo invoice_payload:bytes = BotTransactionPurpose; +//@description The transaction is a deposit of Telegram Stars from Google Play; for regular users only +starTransactionTypeGooglePlayDeposit = StarTransactionType; +//@description The transaction is a deposit of Telegram Stars from Fragment; for regular users and bots only +starTransactionTypeFragmentDeposit = StarTransactionType; -//@class ChatTransactionPurpose @description Describes purpose of a transaction with a supergroup or a channel +//@description The transaction is a deposit of Telegram Stars by another user; for regular users only +//@user_id Identifier of the user that gifted Telegram Stars; 0 if the user was anonymous +//@sticker The sticker to be shown in the transaction information; may be null if unknown +starTransactionTypeUserDeposit user_id:int53 sticker:sticker = StarTransactionType; -//@description Paid media were bought +//@description The transaction is a deposit of Telegram Stars from a giveaway; for regular users only +//@chat_id Identifier of a supergroup or a channel chat that created the giveaway +//@giveaway_message_id Identifier of the message with the giveaway; can be 0 or an identifier of a deleted message +starTransactionTypeGiveawayDeposit chat_id:int53 giveaway_message_id:int53 = StarTransactionType; + +//@description The transaction is a withdrawal of earned Telegram Stars to Fragment; for bots and channel chats only @withdrawal_state State of the withdrawal; may be null for refunds from Fragment +starTransactionTypeFragmentWithdrawal withdrawal_state:RevenueWithdrawalState = StarTransactionType; + +//@description The transaction is a withdrawal of earned Telegram Stars to Telegram Ad platform; for bots and channel chats only +starTransactionTypeTelegramAdsWithdrawal = StarTransactionType; + +//@description The transaction is a payment for Telegram API usage; for bots only @request_count The number of billed requests +starTransactionTypeTelegramApiUsage request_count:int32 = StarTransactionType; + +//@description The transaction is a purchase of paid media from a bot or a business account by the current user; for regular users only +//@user_id Identifier of the bot or the business account user that sent the paid media +//@media The bought media if the transaction wasn't refunded +starTransactionTypeBotPaidMediaPurchase user_id:int53 media:vector = StarTransactionType; + +//@description The transaction is a sale of paid media by the bot or a business account managed by the bot; for bots only +//@user_id Identifier of the user that bought the media +//@media The bought media +//@payload Bot-provided payload +//@affiliate Information about the affiliate which received commission from the transaction; may be null if none +starTransactionTypeBotPaidMediaSale user_id:int53 media:vector payload:string affiliate:affiliateInfo = StarTransactionType; + +//@description The transaction is a purchase of paid media from a channel by the current user; for regular users only +//@chat_id Identifier of the channel chat that sent the paid media //@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 transaction wasn't refunded -chatTransactionPurposePaidMedia message_id:int53 media:vector = ChatTransactionPurpose; +starTransactionTypeChannelPaidMediaPurchase chat_id:int53 message_id:int53 media:vector = StarTransactionType; -//@description User joined the channel and subscribed to regular payments in Telegram Stars -//@period The number of seconds between consecutive Telegram Star debiting -chatTransactionPurposeJoin period:int32 = ChatTransactionPurpose; +//@description The transaction is a sale of paid media by the channel chat; for channel chats only +//@user_id Identifier of the user that bought the media +//@message_id Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message +//@media The bought media +starTransactionTypeChannelPaidMediaSale user_id:int53 message_id:int53 media:vector = StarTransactionType; -//@description User paid for a reaction +//@description The transaction is a purchase of a product from a bot or a business account by the current user; for regular users only +//@user_id Identifier of the bot or the business account user that created the invoice +//@product_info Information about the bought product +starTransactionTypeBotInvoicePurchase user_id:int53 product_info:productInfo = StarTransactionType; + +//@description The transaction is a sale of a product by the bot; for bots only +//@user_id Identifier of the user that bought the product +//@product_info Information about the bought product +//@invoice_payload Invoice payload +//@affiliate Information about the affiliate which received commission from the transaction; may be null if none +starTransactionTypeBotInvoiceSale user_id:int53 product_info:productInfo invoice_payload:bytes affiliate:affiliateInfo = StarTransactionType; + +//@description The transaction is a purchase of a subscription from a bot or a business account by the current user; for regular users only +//@user_id Identifier of the bot or the business account user that created the subscription link +//@subscription_period The number of seconds between consecutive Telegram Star debitings +//@product_info Information about the bought subscription +starTransactionTypeBotSubscriptionPurchase user_id:int53 subscription_period:int32 product_info:productInfo = StarTransactionType; + +//@description The transaction is a sale of a subscription by the bot; for bots only +//@user_id Identifier of the user that bought the subscription +//@subscription_period The number of seconds between consecutive Telegram Star debitings +//@product_info Information about the bought subscription +//@invoice_payload Invoice payload +//@affiliate Information about the affiliate which received commission from the transaction; may be null if none +starTransactionTypeBotSubscriptionSale user_id:int53 subscription_period:int32 product_info:productInfo invoice_payload:bytes affiliate:affiliateInfo = StarTransactionType; + +//@description The transaction is a purchase of a subscription to a channel chat by the current user; for regular users only +//@chat_id Identifier of the channel chat that created the subscription +//@subscription_period The number of seconds between consecutive Telegram Star debitings +starTransactionTypeChannelSubscriptionPurchase chat_id:int53 subscription_period:int32 = StarTransactionType; + +//@description The transaction is a sale of a subscription by the channel chat; for channel chats only +//@user_id Identifier of the user that bought the subscription +//@subscription_period The number of seconds between consecutive Telegram Star debitings +starTransactionTypeChannelSubscriptionSale user_id:int53 subscription_period:int32 = StarTransactionType; + +//@description The transaction is a purchase of a gift to another user; for regular users and bots only @user_id Identifier of the user that received the gift @gift The gift +starTransactionTypeGiftPurchase user_id:int53 gift:gift = StarTransactionType; + +//@description The transaction is a sale of a gift received from another user or bot; for regular users only @user_id Identifier of the user that sent the gift @gift The gift +starTransactionTypeGiftSale user_id:int53 gift:gift = StarTransactionType; + +//@description The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only +//@chat_id Identifier of the channel chat //@message_id Identifier of the reacted message; can be 0 or an identifier of a deleted message -chatTransactionPurposeReaction message_id:int53 = ChatTransactionPurpose; +starTransactionTypeChannelPaidReactionSend chat_id:int53 message_id:int53 = StarTransactionType; -//@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 giveaway_message_id:int53 = ChatTransactionPurpose; +//@description The transaction is a receiving of a paid reaction to a message by the channel chat; for channel chats only +//@user_id Identifier of the user that added the paid reaction +//@message_id Identifier of the reacted message; can be 0 or an identifier of a deleted message +starTransactionTypeChannelPaidReactionReceive user_id:int53 message_id:int53 = StarTransactionType; +//@description The transaction is a receiving of a commission from an affiliate program; for regular users, bots and channel chats only +//@chat_id Identifier of the chat that created the affiliate program +//@commission_per_mille The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner +starTransactionTypeAffiliateProgramCommission chat_id:int53 commission_per_mille:int32 = StarTransactionType; -//@class UserTransactionPurpose @description Describes purpose of a transaction with a user - -//@description A user gifted Telegram Stars @sticker A sticker to be shown in the transaction information; may be null if unknown -userTransactionPurposeGiftedStars sticker:sticker = UserTransactionPurpose; - -//@description The user sold a gift received from another user or bot @gift The gift -userTransactionPurposeGiftSell gift:gift = UserTransactionPurpose; - -//@description The user or the bot sent a gift to a user @gift The gift -userTransactionPurposeGiftSend gift:gift = UserTransactionPurpose; - - -//@class StarTransactionPartner @description Describes source or recipient of a transaction with Telegram Stars - -//@description The transaction is a transaction with Telegram through a bot -starTransactionPartnerTelegram = StarTransactionPartner; - -//@description The transaction is a transaction with App Store -starTransactionPartnerAppStore = StarTransactionPartner; - -//@description The transaction is a transaction with Google Play -starTransactionPartnerGooglePlay = StarTransactionPartner; - -//@description The transaction is a transaction with Fragment @withdrawal_state State of the withdrawal; may be null for refunds from Fragment or for Telegram Stars bought on Fragment -starTransactionPartnerFragment withdrawal_state:RevenueWithdrawalState = StarTransactionPartner; - -//@description The transaction is a transaction with Telegram Ad platform -starTransactionPartnerTelegramAds = StarTransactionPartner; - -//@description The transaction is a transaction with Telegram for API usage @request_count The number of billed requests -starTransactionPartnerTelegramApi request_count:int32 = StarTransactionPartner; - -//@description The transaction is a transaction with a bot @user_id Identifier of the bot @purpose Purpose of the transaction -starTransactionPartnerBot user_id:int53 purpose:BotTransactionPurpose = StarTransactionPartner; - -//@description The transaction is a transaction with a business account @user_id Identifier of the business account user @media The bought media if the transaction wasn't refunded -starTransactionPartnerBusiness user_id:int53 media:vector = StarTransactionPartner; - -//@description The transaction is a transaction with a supergroup or a channel chat @chat_id Identifier of the chat @purpose Purpose of the transaction -starTransactionPartnerChat chat_id:int53 purpose:ChatTransactionPurpose = StarTransactionPartner; - -//@description The transaction is a transaction with another user @user_id Identifier of the user; 0 if the user was anonymous @purpose Purpose of the transaction -starTransactionPartnerUser user_id:int53 purpose:UserTransactionPurpose = StarTransactionPartner; - -//@description The transaction is a transaction with unknown partner -starTransactionPartnerUnsupported = StarTransactionPartner; +//@description The transaction is a transaction of an unsupported type +starTransactionTypeUnsupported = StarTransactionType; //@description Represents a transaction changing the amount of owned Telegram Stars //@id Unique identifier of the transaction -//@star_count The amount of added owned Telegram Stars; negative for outgoing transactions +//@star_amount The amount of added owned Telegram Stars; negative for outgoing transactions //@is_refund True, if the transaction is a refund of a previous transaction //@date Point in time (Unix timestamp) when the transaction was completed -//@partner Source of the incoming transaction, or its recipient for outgoing transactions -starTransaction id:string star_count:int53 is_refund:Bool date:int32 partner:StarTransactionPartner = StarTransaction; +//@type Type of the transaction +starTransaction id:string star_amount:starAmount is_refund:Bool date:int32 type:StarTransactionType = StarTransaction; //@description Represents a list of Telegram Star transactions -//@star_count The amount of owned Telegram Stars +//@star_amount The amount of owned Telegram Stars //@transactions List of transactions with Telegram Stars //@next_offset The offset for the next request. If empty, then there are no more results -starTransactions star_count:int53 transactions:vector next_offset:string = StarTransactions; +starTransactions star_amount:starAmount transactions:vector next_offset:string = StarTransactions; //@class GiveawayParticipantStatus @description Contains information about status of a user in a giveaway @@ -1165,11 +1264,11 @@ usernames active_usernames:vector disabled_usernames:vector edit //@phone_number Phone number of the user //@status Current online status of the user //@profile_photo Profile photo of the user; may be null -//@accent_color_id Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview. For Telegram Premium users only -//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none. For Telegram Premium users only -//@profile_accent_color_id Identifier of the accent color for the user's profile; -1 if none. For Telegram Premium users only -//@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the background of the user's profile; 0 if none. For Telegram Premium users only -//@emoji_status Emoji status to be shown instead of the default Telegram Premium badge; may be null. For Telegram Premium users only +//@accent_color_id Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview +//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none +//@profile_accent_color_id Identifier of the accent color for the user's profile; -1 if none +//@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the background of the user's profile; 0 if none +//@emoji_status Emoji status to be shown instead of the default Telegram Premium badge; may be null //@is_contact The user is a contact of the current user //@is_mutual_contact The user is a contact of the current user and the current user is a contact of the user //@is_close_friend The user is a close friend of the current user; implies that the user is a contact @@ -1199,6 +1298,7 @@ user id:int53 access_hash:int64 first_name:string last_name:string usernames:use //@privacy_policy_url The HTTP link to the privacy policy of the bot. If empty, then /privacy command must be used if supported by the bot. If the command isn't supported, then https://telegram.org/privacy-tpa must be opened //@default_group_administrator_rights Default administrator rights for adding the bot to basic group and supergroup chats; may be null //@default_channel_administrator_rights Default administrator rights for adding the bot to channels; may be null +//@affiliate_program Information about the affiliate program of the bot; may be null if none //@web_app_background_light_color Default light background color for bot Web Apps; -1 if not specified //@web_app_background_dark_color Default dark background color for bot Web Apps; -1 if not specified //@web_app_header_light_color Default light header color for bot Web Apps; -1 if not specified @@ -1210,7 +1310,7 @@ user id:int53 access_hash:int64 first_name:string last_name:string usernames:use //@edit_description_link The internal link, which can be used to edit bot description; may be null //@edit_description_media_link The internal link, which can be used to edit the photo or animation shown in the chat with the bot if the chat is empty; may be null //@edit_settings_link The internal link, which can be used to edit bot settings; may be null -botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights web_app_background_light_color:int32 web_app_background_dark_color:int32 web_app_header_light_color:int32 web_app_header_dark_color:int32 can_get_revenue_statistics:Bool can_manage_emoji_status:Bool has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; +botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights affiliate_program:affiliateProgramInfo web_app_background_light_color:int32 web_app_background_dark_color:int32 web_app_header_light_color:int32 web_app_header_dark_color:int32 can_get_revenue_statistics:Bool can_manage_emoji_status:Bool has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; //@description Contains full information about a user //@personal_photo User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. @@ -5168,7 +5268,7 @@ targetChatTypes allow_user_chats:Bool allow_bot_chats:Bool allow_group_chats:Boo //@class TargetChat @description Describes the target chat to be opened -//@description The currently opened chat needs to be kept +//@description The currently opened chat and forum topic must be kept targetChatCurrent = TargetChat; //@description The chat needs to be chosen by the user among chats of the specified types @types Allowed types for the chat @@ -6815,6 +6915,11 @@ internalLinkTypeBuyStars star_count:int53 purpose:string = InternalLinkType; //@description The link is a link to the change phone number section of the application internalLinkTypeChangePhoneNumber = InternalLinkType; +//@description The link is an affiliate program link. Call searchChatAffiliateProgram with the given username and referrer to process the link +//@username Username to be passed to searchChatAffiliateProgram +//@referrer Referrer to be passed to searchChatAffiliateProgram +internalLinkTypeChatAffiliateProgram username:string referrer:string = InternalLinkType; + //@description The link is a link to boost a Telegram chat. Call getChatBoostLinkInfo with the given URL to process the link. //-If the chat is found, then call getChatBoostStatus and getAvailableChatBoostSlots to get the current boost status and check whether the chat can be boosted. //-If the user wants to boost the chat and the chat can be boosted, then call boostChat @@ -7060,6 +7165,18 @@ fileTypeSecretThumbnail = FileType; //@description The file is a file from Secure storage used for storing Telegram Passport files fileTypeSecure = FileType; +//@description The file is a self-destructing photo in a private chat +fileTypeSelfDestructingPhoto = FileType; + +//@description The file is a self-destructing video in a private chat +fileTypeSelfDestructingVideo = FileType; + +//@description The file is a self-destructing video note in a private chat +fileTypeSelfDestructingVideoNote = FileType; + +//@description The file is a self-destructing voice note in a private chat +fileTypeSelfDestructingVoiceNote = FileType; + //@description The file is a sticker fileTypeSticker = FileType; @@ -7558,12 +7675,12 @@ chatRevenueTransactions total_count:int32 transactions:vector = Update; //@description The list of supported accent colors has changed //@colors Information about supported colors; colors with identifiers 0 (red), 1 (orange), 2 (purple/violet), 3 (green), 4 (cyan), 5 (blue), 6 (pink) must always be supported //-and aren't included in the list. The exact colors for the accent colors with identifiers 0-6 must be taken from the app theme -//@available_accent_color_ids The list of accent color identifiers, which can be set through setAccentColor and setChatAccentColor. The colors must be shown in the specififed order +//@available_accent_color_ids The list of accent color identifiers, which can be set through setAccentColor and setChatAccentColor. The colors must be shown in the specified order updateAccentColors colors:vector available_accent_color_ids:vector = Update; //@description The list of supported accent colors for user profiles has changed //@colors Information about supported colors -//@available_accent_color_ids The list of accent color identifiers, which can be set through setProfileAccentColor and setChatProfileAccentColor. The colors must be shown in the specififed order +//@available_accent_color_ids The list of accent color identifiers, which can be set through setProfileAccentColor and setChatProfileAccentColor. The colors must be shown in the specified order updateProfileAccentColors colors:vector available_accent_color_ids:vector = Update; //@description Some language pack strings have been updated @localization_target Localization target to which the language pack belongs @language_pack_id Identifier of the updated language pack @strings List of changed language pack strings; empty if all strings have changed @@ -8097,8 +8214,8 @@ updateSavedMessagesTags saved_messages_topic_id:int53 tags:savedMessagesTags = U //@messages The list of messages with active live locations updateActiveLiveLocationMessages messages:vector = Update; -//@description The number of Telegram Stars owned by the current user has changed @star_count The new number of Telegram Stars owned -updateOwnedStarCount star_count:int53 = Update; +//@description The number of Telegram Stars owned by the current user has changed @star_amount The new amount of owned Telegram Stars +updateOwnedStarCount star_amount:starAmount = Update; //@description The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions //@chat_id Identifier of the chat @@ -9545,7 +9662,7 @@ answerInlineQuery inline_query_id:int64 is_personal:Bool button:inlineQueryResul //@chat_types Types of the chats to which the message can be sent savePreparedInlineMessage user_id:int53 result:InputInlineQueryResult chat_types:targetChatTypes = PreparedInlineMessageId; -//@description Saves an inline message to be sent by the given user; for bots only +//@description Saves an inline message to be sent by the given user //@bot_user_id Identifier of the bot that created the message //@prepared_message_id Identifier of the prepared message getPreparedInlineMessage bot_user_id:int53 prepared_message_id:string = PreparedInlineMessage; @@ -10120,7 +10237,7 @@ editStoryCover story_sender_chat_id:int53 story_id:int32 cover_frame_timestamp:d //@description Changes privacy settings of a story. The method can be called only for stories posted on behalf of the current user and if story.can_be_edited == true //@story_id Identifier of the story -//@privacy_settings The new privacy settigs for the story +//@privacy_settings The new privacy settings for the story setStoryPrivacySettings story_id:int32 privacy_settings:StoryPrivacySettings = Ok; //@description Toggles whether a story is accessible after expiration. Can be called only if story.can_toggle_is_posted_to_chat_page == true @@ -10548,7 +10665,7 @@ setVideoChatDefaultParticipant chat_id:int53 default_participant_id:MessageSende //@chat_id Identifier of a chat in which the video chat will be created //@title Group call title; if empty, chat title will be used //@start_date Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future -//@is_rtmp_stream Pass true to create an RTMP stream instead of an ordinary video chat; requires owner privileges +//@is_rtmp_stream Pass true to create an RTMP stream instead of an ordinary video chat createVideoChat chat_id:int53 title:string start_date:int32 is_rtmp_stream:Bool = GroupCallId; //@description Returns RTMP URL for streaming to the chat; requires can_manage_video_chats administrator right @chat_id Chat identifier @@ -10778,9 +10895,12 @@ getAllStickerEmojis sticker_type:StickerType query:string chat_id:int53 return_o //@description Searches for stickers from public sticker sets that correspond to any of the given emoji //@sticker_type Type of the stickers to return -//@emojis Space-separated list of emojis to search for; must be non-empty +//@emojis Space-separated list of emojis to search for +//@query Query to search for; may be empty to search for emoji only +//@input_language_codes List of possible IETF language tags of the user's input language; may be empty if unknown +//@offset The offset from which to return the stickers; must be non-negative //@limit The maximum number of stickers to be returned; 0-100 -searchStickers sticker_type:StickerType emojis:string limit:int32 = Stickers; +searchStickers sticker_type:StickerType emojis:string query:string input_language_codes:vector offset:int32 limit:int32 = Stickers; //@description Returns greeting stickers from regular sticker sets that can be used for the start page of other users getGreetingStickers = Stickers; @@ -10910,6 +11030,9 @@ removeSavedAnimation animation:InputFile = Ok; //@description Returns up to 20 recently used inline bots in the order of their last usage getRecentInlineBots = Users; +//@description Returns the list of bots owned by the current user +getOwnedBots = Users; + //@description Searches for recently used hashtags by their prefix @prefix Hashtag prefix to search for @limit The maximum number of hashtags to be returned searchHashtags prefix:string limit:int32 = Hashtags; @@ -11908,6 +12031,46 @@ editUserStarSubscription user_id:int53 telegram_payment_charge_id:string is_canc reuseStarSubscription subscription_id:string = Ok; +//@description Changes affiliate program for a bot +//@chat_id Identifier of the chat with an owned bot for which affiliate program is changed +//@parameters Parameters of the affiliate program; pass null to close the currently active program. If there is an active program, then commission and program duration can only be increased. +//-If the active program is scheduled to be closed, then it can't be changed anymore +setChatAffiliateProgram chat_id:int53 parameters:affiliateProgramParameters = Ok; + +//@description Searches a chat with an affiliate program. Returns the chat if found and the program is active +//@username Username of the chat +//@referrer The referrer from an internalLinkTypeChatAffiliateProgram link +searchChatAffiliateProgram username:string referrer:string = Chat; + +//@description Searches affiliate programs that can be applied to the given chat +//@chat_id Identifier of the chat for which affiliate programs are searched for. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@sort_order Sort order for the results +//@offset Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of affiliate programs to return +searchAffiliatePrograms chat_id:int53 sort_order:AffiliateProgramSortOrder offset:string limit:int32 = FoundAffiliatePrograms; + +//@description Connects an affiliate program to the given chat. Returns information about the connected affiliate program +//@chat_id Identifier of the chat to which the affiliate program will be connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@bot_user_id Identifier of the bot, which affiliate program is connected +connectChatAffiliateProgram chat_id:int53 bot_user_id:int53 = ChatAffiliateProgram; + +//@description Disconnects an affiliate program from the given chat and immediately deactivates its referral link. Returns updated information about the disconnected affiliate program +//@chat_id Identifier of the chat for which the affiliate program is connected +//@url The referral link of the affiliate program +disconnectChatAffiliateProgram chat_id:int53 url:string = ChatAffiliateProgram; + +//@description Returns an affiliate program that were connected to the given chat by identifier of the bot that created the program +//@chat_id Identifier of the chat for which the affiliate program was connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@bot_user_id Identifier of the bot that created the program +getChatAffiliateProgram chat_id:int53 bot_user_id:int53 = ChatAffiliateProgram; + +//@description Returns affiliate programs that were connected to the given chat +//@chat_id Identifier of the chat for which the affiliate programs were connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@offset Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of affiliate programs to return +getChatAffiliatePrograms chat_id:int53 offset:string limit:int32 = ChatAffiliatePrograms; + + //@description Returns information about features, available to Business users @source Source of the request; pass null if the method is called from settings or some non-standard source getBusinessFeatures source:BusinessFeature = BusinessFeatures;